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" title="Link to this section">§</a><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
429 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
430 </p><p><br />
431 </p>
432 <h1><a href="#b_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
433
434 !! end
435
436 !! test
437 Extra newlines between heading and content are swallowed
438 !! wikitext
439 =b=
440
441
442
443 [[a]]
444 !! html
445 <h1><a href="#b" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
446 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
447 </p>
448 !! end
449
450 !! test
451 Parsing an URL
452 !! wikitext
453 http://fr.wikipedia.org/wiki/🍺
454 <!-- EasterEgg we love beer, better be able be able to link to it -->
455 !! html
456 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
457 </p>
458 !! end
459
460 # Note that the html+tidy output removes the spaces after the <li>,
461 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
462 # This is an issue for all tests with lists. We intentionally do
463 # *not* add html+tidy clauses for these, as we don't want to
464 # document/test the broken behavior. (Parsoid matches the non-tidy
465 # output in these cases.)
466
467 !! test
468 Simple list
469 !! wikitext
470 * Item 1
471 * Item 2
472 !! html
473 <ul><li> Item 1</li>
474 <li> Item 2</li></ul>
475
476 !! end
477
478 !! test
479 Italics and bold
480 !! wikitext
481 * plain
482 * plain''italic''plain
483 * plain''italic''plain''italic''plain
484 * plain'''bold'''plain
485 * plain'''bold'''plain'''bold'''plain
486 * plain''italic''plain'''bold'''plain
487 * plain'''bold'''plain''italic''plain
488 * plain''italic'''bold-italic'''italic''plain
489 * plain'''bold''bold-italic''bold'''plain
490 * plain'''''bold-italic'''italic''plain
491 * plain'''''bold-italic''bold'''plain
492 * plain''italic'''bold-italic'''''plain
493 * plain'''bold''bold-italic'''''plain
494 * plain l'''italic''plain
495 * plain l''''bold''' plain
496 !! html
497 <ul><li> plain</li>
498 <li> plain<i>italic</i>plain</li>
499 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
500 <li> plain<b>bold</b>plain</li>
501 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
502 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
503 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
504 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
505 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
506 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
507 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
508 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
509 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
510 <li> plain l'<i>italic</i>plain</li>
511 <li> plain l'<b>bold</b> plain</li></ul>
512
513 !! end
514
515 # this example taken from the [[simple:Moon]] article (bug 47326)
516 !! test
517 Italics and possessives (1)
518 !! wikitext
519 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
520 !! html
521 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
522 </p>
523 !! end
524
525 # this example taken from [[en:Flaming Pie]] (bug 49926)
526 !! test
527 Italics and possessives (2)
528 !! wikitext
529 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
530 !! html
531 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
532 </p>
533 !! end
534
535 # this example taken from [[en:Dictionary]] (bug 49926)
536 !! test
537 Italics and possessives (3)
538 !! wikitext
539 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
540 !! html
541 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
542 </p>
543 !! end
544
545
546 ###
547 ### 2-quote opening sequence tests
548 ###
549 !! test
550 Italics and bold: 2-quote opening sequence: (2,2)
551 !! wikitext
552 ''foo''
553 !! html
554 <p><i>foo</i>
555 </p>
556 !!end
557
558 !! test
559 Italics and bold: 2-quote opening sequence: (2,3)
560 !! wikitext
561 ''foo'''
562 !! html/*
563 <p><i>foo'</i>
564 </p>
565 !!end
566
567 !! test
568 Italics and bold: 2-quote opening sequence: (2,4)
569 !! options
570 parsoid=wt2html
571 !! wikitext
572 ''foo''''
573 !! html/*
574 <p><i>foo''</i>
575 </p>
576 !!end
577
578 # same html as previous, but wikitext adjusted to match parsoid html2wt
579 !! test
580 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
581 !! wikitext
582 ''foo<nowiki>''</nowiki>''
583 !! html
584 <p><i>foo''</i>
585 </p>
586 !! end
587
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 2-quote opening sequence: (2,5)
591 !! options
592 parsoid=wt2html
593 !! wikitext
594 ''foo'''''
595 !! html/php
596 <p><i>foo</i>
597 </p>
598 !! html/parsoid
599 <p><i>foo</i><b></b>
600 </p>
601 !!end
602
603 # same html as previous, but wikitext adjusted to match parsoid html2wt
604 !! test
605 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
606 !! wikitext
607 ''foo'''''<nowiki/>'''
608 !! html/php
609 <p><i>foo</i>
610 </p>
611 !! html/parsoid
612 <p><i>foo</i><b></b>
613 </p>
614 !! end
615
616
617 ###
618 ### 3-quote opening sequence tests
619 ###
620
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,2)
623 !! wikitext
624 '''foo''
625 !! html/*
626 <p>'<i>foo</i>
627 </p>
628 !!end
629
630 !! test
631 Italics and bold: 3-quote opening sequence: (3,3)
632 !! wikitext
633 '''foo'''
634 !! html
635 <p><b>foo</b>
636 </p>
637 !!end
638
639 !! test
640 Italics and bold: 3-quote opening sequence: (3,4)
641 !! wikitext
642 '''foo''''
643 !! html/*
644 <p><b>foo'</b>
645 </p>
646 !!end
647
648 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
649 !! test
650 Italics and bold: 3-quote opening sequence: (3,5)
651 !! options
652 parsoid=wt2html
653 !! wikitext
654 '''foo'''''
655 !! html/php
656 <p><b>foo</b>
657 </p>
658 !! html/parsoid
659 <p><b>foo</b><i></i>
660 </p>
661 !!end
662
663 # same html as previous, but wikitext adjusted to match parsoid html2wt
664 !! test
665 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
666 !! wikitext
667 '''foo'''''<nowiki/>''
668 !! html/php
669 <p><b>foo</b>
670 </p>
671 !! html/parsoid
672 <p><b>foo</b><i></i>
673 </p>
674 !! end
675
676
677 ###
678 ### 4-quote opening sequence tests
679 ###
680
681 !! test
682 Italics and bold: 4-quote opening sequence: (4,2)
683 !! options
684 parsoid=wt2html
685 !! wikitext
686 ''''foo''
687 !! html/*
688 <p>''<i>foo</i>
689 </p>
690 !!end
691
692 # same html as previous, but wikitext adjusted to match parsoid html2wt
693 !! test
694 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
695 !! wikitext
696 <nowiki>''</nowiki>''foo''
697 !! html
698 <p>''<i>foo</i>
699 </p>
700 !! end
701
702 !! test
703 Italics and bold: 4-quote opening sequence: (4,3)
704 !! wikitext
705 ''''foo'''
706 !! html/*
707 <p>'<b>foo</b>
708 </p>
709 !!end
710
711 !! test
712 Italics and bold: 4-quote opening sequence: (4,4)
713 !! options
714 parsoid=wt2html
715 !! wikitext
716 ''''foo''''
717 !! html/*
718 <p>'<b>foo'</b>
719 </p>
720 !!end
721
722 # same html as previous, but wikitext adjusted to match parsoid html2wt
723 !! test
724 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
725 !! wikitext
726 '<nowiki/>'''foo''''
727 !! html
728 <p>'<b>foo'</b>
729 </p>
730 !! end
731
732 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
733 !! test
734 Italics and bold: 4-quote opening sequence: (4,5)
735 !! options
736 parsoid=wt2html
737 !! wikitext
738 ''''foo'''''
739 !! html/php
740 <p>'<b>foo</b>
741 </p>
742 !! html/parsoid
743 <p>'<b>foo</b><i></i>
744 </p>
745 !!end
746
747 # same html as previous, but wikitext adjusted to match parsoid html2wt
748 !! test
749 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
750 !! wikitext
751 '<nowiki/>'''foo'''''<nowiki/>''
752 !! html/php
753 <p>'<b>foo</b>
754 </p>
755 !! html/parsoid
756 <p>'<b>foo</b><i></i>
757 </p>
758 !! end
759
760
761 ###
762 ### 5-quote opening sequence tests
763 ###
764
765 !! test
766 Italics and bold: 5-quote opening sequence: (5,2)
767 !! options
768 parsoid=wt2html
769 !! wikitext
770 '''''foo''
771 !! html/*
772 <p><b><i>foo</i></b>
773 </p>
774 !!end
775
776 # same html as previous, but wikitext adjusted to match parsoid html2wt
777 # skipping wt2html and html2html because it wants to put <i> before <b>
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,2+3)
780 !! options
781 parsoid=wt2wt,html2wt
782 !! wikitext
783 '''''foo'''''
784 !! html
785 <p><b><i>foo</i></b>
786 </p>
787 !! end
788
789 !! test
790 Italics and bold: 5-quote opening sequence: (5,3)
791 !! options
792 parsoid=wt2html
793 !! wikitext
794 '''''foo'''
795 !! html/*
796 <p><i><b>foo</b></i>
797 </p>
798 !!end
799
800 # same html as previous, but wikitext adjusted to match parsoid html2wt
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,3+2)
803 !! wikitext
804 '''''foo'''''
805 !! html
806 <p><i><b>foo</b></i>
807 </p>
808 !! end
809
810 !! test
811 Italics and bold: 5-quote opening sequence: (5,4)
812 !! options
813 parsoid=wt2html
814 !! wikitext
815 '''''foo''''
816 !! html/*
817 <p><i><b>foo'</b></i>
818 </p>
819 !!end
820
821 !! test
822 Italics and bold: 5-quote opening sequence: (5,5)
823 !! wikitext
824 '''''foo'''''
825 !! html
826 <p><i><b>foo</b></i>
827 </p>
828 !!end
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,6)
832 !! wikitext
833 '''''foo''''''
834 !! html/*
835 <p><i><b>foo'</b></i>
836 </p>
837 !! end
838
839 ###
840 ### multiple quote sequences in a line
841 ###
842 !! test
843 Italics and bold: multiple quote sequences: (2,4,2)
844 !! options
845 parsoid=wt2html
846 !! wikitext
847 ''foo''''bar''
848 !! html/*
849 <p><i>foo'<b>bar</b></i>
850 </p>
851 !!end
852
853
854 # same html as previous, but wikitext adjusted to match parsoid html2wt
855 !! test
856 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
857 !! wikitext
858 ''foo'<nowiki/>'''bar'''''
859 !! html
860 <p><i>foo'<b>bar</b></i>
861 </p>
862 !! end
863
864
865 !! test
866 Italics and bold: multiple quote sequences: (2,4,3)
867 !! options
868 parsoid=wt2html
869 !! wikitext
870 ''foo''''bar'''
871 !! html/*
872 <p><i>foo'<b>bar</b></i>
873 </p>
874 !!end
875
876
877 # same html as previous, but wikitext adjusted to match parsoid html2wt
878 !! test
879 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
880 !! wikitext
881 ''foo'<nowiki/>'''bar'''''
882 !! html
883 <p><i>foo'<b>bar</b></i>
884 </p>
885 !! end
886
887
888 !! test
889 Italics and bold: multiple quote sequences: (2,4,4)
890 !! options
891 parsoid=wt2html
892 !! wikitext
893 ''foo''''bar''''
894 !! html/*
895 <p><i>foo'<b>bar'</b></i>
896 </p>
897 !!end
898
899
900 # same html as previous, but wikitext adjusted to match parsoid html2wt
901 !! test
902 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
903 !! wikitext
904 ''foo'<nowiki/>'''bar'<nowiki/>'''''
905 !! html
906 <p><i>foo'<b>bar'</b></i>
907 </p>
908 !! end
909
910
911 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
912 !! test
913 Italics and bold: multiple quote sequences: (3,4,2)
914 !! options
915 parsoid=wt2html
916 !! wikitext
917 '''foo''''bar''
918 !! html/php
919 <p><b>foo'</b>bar
920 </p>
921 !! html/parsoid
922 <p><b>foo'</b>bar<i></i>
923 </p>
924 !!end
925
926 # same html as previous, but wikitext adjusted to match parsoid html2wt
927 !! test
928 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
929 !! options
930 parsoid
931 !! wikitext
932 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
933 !! html/php
934 <p><b>foo'</b>bar
935 </p>
936 !! html/parsoid
937 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
938 </p>
939 !! end
940
941
942 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
943 !! test
944 Italics and bold: multiple quote sequences: (3,4,3)
945 !! options
946 parsoid=wt2html
947 !! wikitext
948 '''foo''''bar'''
949 !! html/php
950 <p><b>foo'</b>bar
951 </p>
952 !! html/parsoid
953 <p><b>foo'</b>bar<b></b>
954 </p>
955 !!end
956
957 # same html as previous, but wikitext adjusted to match parsoid html2wt
958 !! test
959 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
960 !! wikitext
961 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
962 !! html/php
963 <p><b>foo'</b>bar
964 </p>
965 !! html/parsoid
966 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
967 </p>
968 !! end
969
970 ###
971 ### other quote tests
972 ###
973 !! test
974 Italics and bold: other quote tests: (2,3,5)
975 !! wikitext
976 ''this is about '''foo's family'''''
977 !! html
978 <p><i>this is about <b>foo's family</b></i>
979 </p>
980 !!end
981
982
983 !! test
984 Italics and bold: other quote tests: (2,(3,3),2)
985 !! wikitext
986 ''this is about '''foo's''' family''
987 !! html
988 <p><i>this is about <b>foo's</b> family</i>
989 </p>
990 !!end
991
992
993 !! test
994 Italics and bold: other quote tests: (3,2,3,2)
995 !! options
996 parsoid=wt2html
997 !! wikitext
998 '''this is about ''foo'''s family''
999 !! html/*
1000 <p><b>this is about <i>foo</i></b><i>s family</i>
1001 </p>
1002 !!end
1003
1004
1005 # same html as previous, but wikitext adjusted to match parsoid html2wt
1006 !! test
1007 Italics and bold: other quote tests: (3,2,3+2+2,2)
1008 !! wikitext
1009 '''this is about ''foo'''''<nowiki/>''s family''
1010 !! html
1011 <p><b>this is about <i>foo</i></b><i>s family</i>
1012 </p>
1013 !! end
1014
1015
1016 !! test
1017 Italics and bold: other quote tests: (3,2,3,3)
1018 !! wikitext
1019 '''this is about ''foo'''s family'''
1020 !! html/*
1021 <p>'<i>this is about </i>foo<b>s family</b>
1022 </p>
1023 !!end
1024
1025
1026 !! test
1027 Italics and bold: other quote tests: (3,(2,2),3)
1028 !! wikitext
1029 '''this is about ''foo's'' family'''
1030 !! html
1031 <p><b>this is about <i>foo's</i> family</b>
1032 </p>
1033 !!end
1034
1035
1036 !! test
1037 Italicized possessive
1038 !! wikitext
1039 The ''[[Main Page]]'''s talk page.
1040 !! html/php
1041 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1042 </p>
1043 !! html/parsoid
1044 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1045 !! end
1046
1047 !! test
1048 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1049 (Requires tidy for PHP parser output to be fixed up)
1050 !! options
1051 parsoid=wt2html,wt2wt
1052 !! wikitext
1053 {|
1054 !''a!!''b
1055 |''a||''b
1056 |}
1057 !! html/php+tidy
1058 <table>
1059 <tr>
1060 <th><i>a</i></th>
1061 <th><i>b</i></th>
1062 <td><i>a</i></td>
1063 <td><i>b</i></td>
1064 </tr>
1065 </table>
1066 !! html/parsoid
1067 <table>
1068 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1069 <td><i>a</i></td><td><i>b</i></td></tr>
1070 </tbody></table>
1071 !! end
1072
1073 ###
1074 ### Non-html5 tags
1075 ###
1076
1077 !! test
1078 Non-html5 tags should be accepted
1079 !! wikitext
1080 <center>''foo''</center>
1081 <big>''foo''</big>
1082 <font>''foo''</font>
1083 <strike>''foo''</strike>
1084 <tt>''foo''</tt>
1085 !! html
1086 <center><i>foo</i></center>
1087 <p><big><i>foo</i></big>
1088 <font><i>foo</i></font>
1089 <strike><i>foo</i></strike>
1090 <tt><i>foo</i></tt>
1091 </p>
1092 !! end
1093
1094 !! test
1095 <wbr> is valid wikitext (bug 52468)
1096 !! wikitext
1097 <wbr>
1098 !! html
1099 <p><wbr />
1100 </p>
1101 !! end
1102
1103 # <strike> is HTML4, <s> is HTML4/5.
1104 !! test
1105 <s> or <strike> for strikethrough
1106 !! wikitext
1107 <strike>strike</strike>
1108
1109 <s>s</s>
1110 !! html
1111 <p><strike>strike</strike>
1112 </p><p><s>s</s>
1113 </p>
1114 !! end
1115
1116 ## a not permitted
1117 ## i,b,br omitted
1118 !! test
1119 Text-level semantic html elements in wikitext
1120 !! wikitext
1121 <em>text</em>
1122 <strong>text</strong>
1123 <small>text</small>
1124 <s>text</s>
1125 <cite>text</cite>
1126 <q>text</q>
1127 <dfn>text</dfn>
1128 <abbr>text</abbr>
1129 <data>text</data>
1130 <time>text</time>
1131 <code>text</code>
1132 <var>text</var>
1133 <samp>text</samp>
1134 <kbd>text</kbd>
1135 <sub>text</sub>
1136 <u>text</u>
1137 <mark>text</mark>
1138 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1139 <bdi>text</bdi>
1140 <bdo>text</bdo>
1141 <span>text</span>
1142 <wbr />
1143 !! html
1144 <p><em>text</em>
1145 <strong>text</strong>
1146 <small>text</small>
1147 <s>text</s>
1148 <cite>text</cite>
1149 <q>text</q>
1150 <dfn>text</dfn>
1151 <abbr>text</abbr>
1152 <data>text</data>
1153 <time>text</time>
1154 <code>text</code>
1155 <var>text</var>
1156 <samp>text</samp>
1157 <kbd>text</kbd>
1158 <sub>text</sub>
1159 <u>text</u>
1160 <mark>text</mark>
1161 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1162 <bdi>text</bdi>
1163 <bdo>text</bdo>
1164 <span>text</span>
1165 <wbr />
1166 </p>
1167 !! end
1168
1169 # test cases taken from
1170 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1171 !! test
1172 Ruby markup (W3C-style)
1173 !! wikitext
1174 ; Mono-ruby for individual base characters
1175 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1176 ; Group ruby
1177 : <ruby>今日<rt>きょう</rt></ruby>
1178 ; Jukugo ruby
1179 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1180 ; Inline ruby
1181 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1182 ; Double-sided ruby
1183 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1184 <ruby>
1185 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1186 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1187 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1188 </ruby>
1189 !! html
1190 <dl><dt> Mono-ruby for individual base characters</dt>
1191 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1192 <dt> Group ruby</dt>
1193 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1194 <dt> Jukugo ruby</dt>
1195 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1196 <dt> Inline ruby</dt>
1197 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1198 <dt> Double-sided ruby</dt>
1199 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1200 <p><ruby>
1201 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1202 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1203 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1204 </ruby>
1205 </p>
1206 !! end
1207
1208 # The next two test different paths in the sanitizer.
1209 !! test
1210 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1211 !! wikitext
1212 <b→> doesn't terminate </b→>
1213
1214 <bä> doesn't terminate </bä>
1215
1216 <boo> doesn't terminate </boo>
1217
1218 <s.foo> doesn't terminate </s.foo>
1219
1220 <sub-ID#1>
1221 !! html
1222 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1223 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1224 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1225 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1226 </p><p>&lt;sub-ID#1&gt;
1227 </p>
1228 !! end
1229
1230 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1231 !! test
1232 Non-word characters don't terminate tag names + tidy
1233 !! wikitext
1234 <b→> doesn't terminate </b→>
1235
1236 <bä> doesn't terminate </bä>
1237
1238 <boo> doesn't terminate </boo>
1239
1240 <s.foo> doesn't terminate </s.foo>
1241
1242 <sub-ID#1>
1243 !! html+tidy
1244 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1245 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1246 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1247 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1248 <p>&lt;sub-ID#1&gt;</p>
1249 !! end
1250
1251 !! test
1252 Isolated close tags should be treated as literal text (bug 52760)
1253 !! wikitext
1254 </b>
1255
1256 <s.foo>s</s>
1257 !! html
1258 <p>&lt;/b&gt;
1259 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1260 </p>
1261 !! end
1262
1263 ###
1264 ### Special characters
1265 ###
1266
1267 !! test
1268 Bare pipe character (bug 52363)
1269 !! wikitext
1270 |
1271 !! html
1272 <p>|
1273 </p>
1274 !! end
1275
1276 !! test
1277 Bare pipe character from a template (bug 52363)
1278 !! wikitext
1279 {{pipe}}
1280 !! html
1281 <p>|
1282 </p>
1283 !! end
1284
1285 ###
1286 ### <nowiki> test cases
1287 ###
1288
1289 !! test
1290 <nowiki> unordered list
1291 !! wikitext
1292 <nowiki>* This is not an unordered list item.</nowiki>
1293 !! html
1294 <p>* This is not an unordered list item.
1295 </p>
1296 !! end
1297
1298 !! test
1299 <nowiki> spacing
1300 !! wikitext
1301 <nowiki>Lorem ipsum dolor
1302
1303 sed abit.
1304 sed nullum.
1305
1306 :and a colon
1307 </nowiki>
1308 !! html
1309 <p>Lorem ipsum dolor
1310
1311 sed abit.
1312 sed nullum.
1313
1314 :and a colon
1315
1316 </p>
1317 !! end
1318
1319 !! test
1320 nowiki 3
1321 !! wikitext
1322 :There is not nowiki.
1323 :There is <nowiki>nowiki</nowiki>.
1324
1325 #There is not nowiki.
1326 #There is <nowiki>nowiki</nowiki>.
1327
1328 *There is not nowiki.
1329 *There is <nowiki>nowiki</nowiki>.
1330 !! html
1331 <dl><dd>There is not nowiki.</dd>
1332 <dd>There is nowiki.</dd></dl>
1333 <ol><li>There is not nowiki.</li>
1334 <li>There is nowiki.</li></ol>
1335 <ul><li>There is not nowiki.</li>
1336 <li>There is nowiki.</li></ul>
1337
1338 !! end
1339
1340 !! test
1341 Entities inside <nowiki>
1342 !! wikitext
1343 <nowiki>&lt;</nowiki>
1344 !! html
1345 <p>&lt;
1346 </p>
1347 !! end
1348
1349 !! test
1350 Entities inside template parameters
1351 !! options
1352 parsoid
1353 !! wikitext
1354 {{echo|&ndash;}}
1355 !! html
1356 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1357 !! end
1358
1359 !! test
1360 Properly escape nowiki when combined with other wiki markup
1361 !! options
1362 parsoid=html2wt
1363 !! html
1364 <p>* &lt;/nowiki&gt; tag</p>
1365 !! wikitext
1366 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1367 !! end
1368
1369 ###
1370 ### Comments
1371 ###
1372 !! test
1373 Comments and Indent-Pre
1374 !! wikitext
1375 <!-- comment 1 --> asdf
1376
1377 <!-- comment 1 --> asdf
1378 <!-- comment 2 -->
1379
1380 <!-- comment 1 --> asdf
1381 <!-- comment 2 -->xyz
1382
1383 <!-- comment 1 --> asdf
1384 <!-- comment 2 --> xyz
1385 !! html
1386 <pre>asdf
1387 </pre>
1388 <pre>asdf
1389 </pre>
1390 <pre>asdf
1391 </pre>
1392 <p>xyz
1393 </p>
1394 <pre>asdf
1395 xyz
1396 </pre>
1397 !! end
1398
1399 !! test
1400 Comment test 2a
1401 !! wikitext
1402 asdf
1403 <!-- comment 1 -->
1404 jkl
1405 !! html
1406 <p>asdf
1407 jkl
1408 </p>
1409 !! end
1410
1411 !! test
1412 Comment test 2b
1413 !! wikitext
1414 asdf
1415 <!-- comment 1 -->
1416
1417 jkl
1418 !! html
1419 <p>asdf
1420 </p><p>jkl
1421 </p>
1422 !! end
1423
1424 !! test
1425 Comment test 3
1426 !! wikitext
1427 asdf
1428 <!-- comment 1 -->
1429 <!-- comment 2 -->
1430 jkl
1431 !! html
1432 <p>asdf
1433 jkl
1434 </p>
1435 !! end
1436
1437 !! test
1438 Comment test 4
1439 !! wikitext
1440 asdf<!-- comment 1 -->jkl
1441 !! html
1442 <p>asdfjkl
1443 </p>
1444 !! end
1445
1446 !! test
1447 Comment spacing
1448 !! wikitext
1449 a
1450 <!-- foo --> b <!-- bar -->
1451 c
1452 !! html
1453 <p>a
1454 </p>
1455 <pre> b
1456 </pre>
1457 <p>c
1458 </p>
1459 !! end
1460
1461 !! test
1462 Comment whitespace
1463 !! wikitext
1464 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1465 !! html
1466
1467 !! end
1468
1469 !! test
1470 Comment semantics and delimiters
1471 !! wikitext
1472 <!-- --><!----><!-----><!------>
1473 !! html
1474
1475 !! end
1476
1477 !! test
1478 Comment semantics and delimiters, redux
1479 !! wikitext
1480 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1481 -- foo -- funky huh? ... -->
1482 !! html
1483
1484 !! end
1485
1486 !! test
1487 Comment semantics and delimiters: directors cut
1488 !! wikitext
1489 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1490 everything starting with < followed by !-- until the first -- and > we see,
1491 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1492 -->-->
1493 !! html
1494 <p>--&gt;
1495 </p>
1496 !! end
1497
1498 !! test
1499 Comment semantics: nesting
1500 !! wikitext
1501 <!--<!-- no, we're not going to do anything fancy here -->-->
1502 !! html
1503 <p>--&gt;
1504 </p>
1505 !! end
1506
1507 !! test
1508 Comment semantics: unclosed comment at end
1509 !! wikitext
1510 <!--This comment will run out to the end of the document
1511 !! html
1512
1513 !! end
1514
1515 # Bug 58184: document parsoid's behaviour
1516 !! test
1517 Suppress comment closing tag in lenient browsers
1518 !! options
1519 parsoid=wt2html,html2html
1520 !! wikitext
1521 <!-- Browsers--!> think this is closed -->
1522 !! html/php
1523
1524 !! html/parsoid
1525 <!-- Browsers--¡> think this is closed -->
1526 !! end
1527
1528 !! test
1529 Comment in template title
1530 !! wikitext
1531 {{f<!---->oo}}
1532 !! html
1533 <p>FOO
1534 </p>
1535 !! end
1536
1537 !! test
1538 Comment on its own line post-expand
1539 !! wikitext
1540 a
1541 {{blank}}<!---->
1542 b
1543 !! html
1544 <p>a
1545 </p><p>b
1546 </p>
1547 !! end
1548
1549 !! test
1550 Comment on its own line post-expand with non-significant whitespace
1551 !! wikitext
1552 a
1553 {{blank}} <!---->
1554 b
1555 !! html
1556 <p>a
1557 </p><p>b
1558 </p>
1559 !! end
1560
1561 !! test
1562 Multiple comments should still parse as SOL-transparent
1563 !! options
1564 parsoid=wt2html,wt2wt
1565 !! wikitext
1566 <!--c1-->*a
1567 <!--c2--><!--c3--><!--c4-->*b
1568 !! html
1569 <ul>
1570 <li>a
1571 </li>
1572 <li>b
1573 </li>
1574 </ul>
1575 !! end
1576
1577 ###
1578 ### paragraph wrapping tests
1579 ###
1580 !! test
1581 No block tags
1582 !! wikitext
1583 a
1584
1585 b
1586 !! html
1587 <p>a
1588 </p><p>b
1589 </p>
1590 !! end
1591
1592 !! test
1593 Block tag on one line (<div>)
1594 !! wikitext
1595 a <div>foo</div>
1596
1597 b
1598 !! html
1599 a <div>foo</div>
1600 <p>b
1601 </p>
1602 !! html+tidy
1603 <p>a</p>
1604 <div>foo</div>
1605 <p>b</p>
1606 !! end
1607
1608 !! test
1609 Block tag on one line (<blockquote>)
1610 !! wikitext
1611 a <blockquote>foo</blockquote>
1612
1613 b
1614 !! html
1615 a <blockquote>foo</blockquote>
1616 <p>b
1617 </p>
1618 !! html+tidy
1619 <p>a</p>
1620 <blockquote>
1621 <p>foo</p>
1622 </blockquote>
1623 <p>b</p>
1624 !! end
1625
1626 !! test
1627 Block tag on both lines (<div>)
1628 !! wikitext
1629 a <div>foo</div>
1630
1631 b <div>foo</div>
1632 !! html
1633 a <div>foo</div>
1634 b <div>foo</div>
1635
1636 !! html+tidy
1637 <p>a</p>
1638 <div>foo</div>
1639 <p>b</p>
1640 <div>foo</div>
1641 !! end
1642
1643 !! test
1644 Block tag on both lines (<blockquote>)
1645 !! wikitext
1646 a <blockquote>foo</blockquote>
1647
1648 b <blockquote>foo</blockquote>
1649 !! html
1650 a <blockquote>foo</blockquote>
1651 b <blockquote>foo</blockquote>
1652
1653 !! html+tidy
1654 <p>a</p>
1655 <blockquote>
1656 <p>foo</p>
1657 </blockquote>
1658 <p>b</p>
1659 <blockquote>
1660 <p>foo</p>
1661 </blockquote>
1662 !! end
1663
1664 !! test
1665 Multiple lines without block tags
1666 !! wikitext
1667 <div>foo</div> a
1668 b
1669 c
1670 d<!--foo--> e
1671 x <div>foo</div> z
1672 !! html
1673 <div>foo</div> a
1674 <p>b
1675 c
1676 d e
1677 </p>
1678 x <div>foo</div> z
1679
1680 !! html+tidy
1681 <div>foo</div>
1682 <p>a</p>
1683 <p>b c d e</p>
1684 <p>x</p>
1685 <div>foo</div>
1686 <p>z</p>
1687 !! end
1688
1689 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1690 # So, we have a separate section for Parsoid. We don't want
1691 # to mimic this stripping behavior in Parsoid. It affects
1692 # editing experience and also requires us to maintain additional
1693 # info for RT-ing.
1694 !! test
1695 Empty lines between lines with block tags
1696 !! wikitext
1697 <div></div>
1698
1699
1700 <div></div>a
1701
1702 b
1703 <div>a</div>b
1704
1705 <div>b</div>d
1706
1707
1708 <div>e</div>
1709 !! html
1710 <div></div>
1711 <p><br />
1712 </p>
1713 <div></div>a
1714 <p>b
1715 </p>
1716 <div>a</div>b
1717 <div>b</div>d
1718 <p><br />
1719 </p>
1720 <div>e</div>
1721
1722 !! html+tidy
1723 <p><br /></p>
1724 <p>a</p>
1725 <p>b</p>
1726 <div>a</div>
1727 <p>b</p>
1728 <div>b</div>
1729 <p>d</p>
1730 <p><br /></p>
1731 <div>e</div>
1732 !! html/parsoid
1733 <div data-parsoid='{"stx":"html"}'></div>
1734
1735 <p><br /></p>
1736 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1737
1738 <p>b</p>
1739 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1740
1741 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1742
1743 <p><br /></p>
1744 <div data-parsoid='{"stx":"html"}'>e</div>
1745 !! end
1746
1747 ## PHP parser emits output which is broken
1748 ## XXX The parsoid output doesn't match the tidy output.
1749 !! test
1750 Unclosed HTML p-tags should be handled properly
1751 !! wikitext
1752 <div><p>foo</div>
1753 a
1754
1755 b
1756 !! html/php+tidy
1757 <div>
1758 <p>foo&lt;/div&gt;</p>
1759 <p>a</p>
1760 b</div>
1761 !! html/parsoid
1762 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1763 <p>a</p>
1764 <p>b</p>
1765 !! end
1766
1767 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1768 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1769 ## them for now.
1770 !! test
1771 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1772 !! options
1773 parsoid=wt2html
1774 !! wikitext
1775 a [[Category:A1]] [[Category:A2]]
1776 [[Category:A3]]
1777 [[Category:A4]]
1778 !! html/parsoid
1779 <p>a</p>
1780 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1781 !! end
1782
1783 !! test
1784 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1785 !! options
1786 parsoid=wt2html
1787 !! wikitext
1788 [[Category:A1]]a
1789 !! html/parsoid
1790 <link href="Category:A1"/><p>a</p>
1791 !! end
1792
1793 ###
1794 ### Preformatted text
1795 ###
1796 !! test
1797 Preformatted text
1798 !! wikitext
1799 This is some
1800 Preformatted text
1801 With ''italic''
1802 And '''bold'''
1803 And a [[Main Page|link]]
1804 !! html
1805 <pre>This is some
1806 Preformatted text
1807 With <i>italic</i>
1808 And <b>bold</b>
1809 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1810 </pre>
1811 !! end
1812
1813 !! test
1814 Tabs don't trigger preformatted text
1815 !! wikitext
1816 This is not
1817 preformatted text.
1818 This is preformatted text.
1819 So is this.
1820 !! html
1821 <p> This is not
1822 preformatted text.
1823 </p>
1824 <pre>This is preformatted text.
1825 So is this.
1826 </pre>
1827 !! end
1828
1829 !! test
1830 Ident preformatting with inline content
1831 !! wikitext
1832 a
1833 ''b''
1834 !! html
1835 <pre>a
1836 <i>b</i>
1837 </pre>
1838 !! end
1839
1840 !! test
1841 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1842 !! wikitext
1843 <pre><nowiki>
1844 <b>
1845 <cite>
1846 <em>
1847 </nowiki></pre>
1848 !! html
1849 <pre>
1850 &lt;b&gt;
1851 &lt;cite&gt;
1852 &lt;em&gt;
1853 </pre>
1854
1855 !! end
1856
1857 !! test
1858 Regression with preformatted in <center>
1859 !! wikitext
1860 <center>
1861 Blah
1862 </center>
1863 !! html
1864 <center>
1865 <pre>Blah
1866 </pre>
1867 </center>
1868
1869 !! end
1870
1871 !! test
1872 Bug 52763: Preformatted in <blockquote>
1873 !! wikitext
1874 <blockquote>
1875 Blah
1876 {|
1877 |
1878 indented cell (no pre-wrapping!)
1879 |}
1880 </blockquote>
1881 !! html
1882 <blockquote>
1883 <p> Blah
1884 </p>
1885 <table>
1886 <tr>
1887 <td>
1888 <p> indented cell (no pre-wrapping!)
1889 </p>
1890 </td></tr></table>
1891 </blockquote>
1892
1893 !! end
1894
1895 !! test
1896 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1897 !! wikitext
1898 <blockquote>
1899 Foo
1900
1901 Bar
1902 </blockquote>
1903 !! html
1904 <blockquote>
1905 <p>Foo
1906 </p><p>Bar
1907 </p>
1908 </blockquote>
1909
1910 !! end
1911
1912 !! test
1913 Bug 15491: <ins>/<del> in blockquote
1914 !! wikitext
1915 <blockquote>
1916 Foo <del>bar</del> <ins>baz</ins> quux
1917 </blockquote>
1918 !! html
1919 <blockquote>
1920 <p>Foo <del>bar</del> <ins>baz</ins> quux
1921 </p>
1922 </blockquote>
1923
1924 !! end
1925
1926 # Note that the p-wrapping is newline sensitive, which could be
1927 # considered a bug: tidy will wrap only the 'Foo' in the example
1928 # below in a <p> tag. (see comment 23-25 of bug #6200)
1929 !! test
1930 Bug 15491: <ins>/<del> in blockquote (2)
1931 !! wikitext
1932 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1933 </blockquote>
1934 !! html
1935 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1936 </blockquote>
1937
1938 !! html+tidy
1939 <blockquote>
1940 <p>Foo</p>
1941 <del>bar</del> <ins>baz</ins> quux</blockquote>
1942 !! end
1943
1944 !! test
1945 <pre> with attributes (bug 3202)
1946 !! wikitext
1947 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1948 !! html
1949 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1950
1951 !! end
1952
1953 !! test
1954 <pre> with width attribute (bug 3202)
1955 !! wikitext
1956 <pre width="8">Narrow screen goodies</pre>
1957 !! html
1958 <pre width="8">Narrow screen goodies</pre>
1959
1960 !! end
1961
1962 !! test
1963 <pre> with forbidden attribute (bug 3202)
1964 !! wikitext
1965 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1966 !! html
1967 <pre width="8">Narrow screen goodies</pre>
1968
1969 !! end
1970
1971 !! test
1972 Entities inside <pre>
1973 !! wikitext
1974 <pre>&lt;</pre>
1975 !! html
1976 <pre>&lt;</pre>
1977
1978 !! end
1979
1980 !! test
1981 <pre> with forbidden attribute values (bug 3202)
1982 !! wikitext
1983 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1984 !! html
1985 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1986
1987 !! end
1988
1989 !! test
1990 <nowiki> inside <pre> (bug 13238)
1991 !! wikitext
1992 <pre>
1993 <nowiki>
1994 </pre>
1995 <pre>
1996 <nowiki></nowiki>
1997 </pre>
1998 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1999 !! html
2000 <pre>
2001 &lt;nowiki&gt;
2002 </pre>
2003 <pre>
2004
2005 </pre>
2006 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2007
2008 !! end
2009
2010 !! test
2011 <nowiki> and <pre> preference (first one wins)
2012 !! wikitext
2013 <pre>
2014 <nowiki>
2015 </pre>
2016 </nowiki>
2017 </pre>
2018
2019 <nowiki>
2020 <pre>
2021 <nowiki>
2022 </pre>
2023 </nowiki>
2024 </pre>
2025
2026 !! html
2027 <pre>
2028 &lt;nowiki&gt;
2029 </pre>
2030 <p>&lt;/nowiki&gt;
2031 &lt;/pre&gt;
2032 </p><p>
2033 &lt;pre&gt;
2034 &lt;nowiki&gt;
2035 &lt;/pre&gt;
2036
2037 &lt;/pre&gt;
2038 </p>
2039 !! end
2040
2041 !! test
2042 </pre> inside nowiki
2043 !! wikitext
2044 <nowiki></pre></nowiki>
2045 !! html
2046 <p>&lt;/pre&gt;
2047 </p>
2048 !! end
2049
2050 # Parsoid doesn't strip empty tags, like Tidy does.
2051 !! test
2052 Empty pre; pre inside other HTML tags (bug 54946)
2053 !! options
2054 parsoid=wt2html,wt2wt
2055 !! wikitext
2056 a
2057
2058 <div><pre>
2059 foo
2060 </pre></div>
2061 <pre></pre>
2062 !! html/php
2063 <p>a
2064 </p>
2065 <div><pre>
2066 foo
2067 </pre></div>
2068 <pre></pre>
2069
2070 !! html/php+tidy
2071 <p>a</p>
2072 <div>
2073 <pre>
2074 foo
2075 </pre></div>
2076 !! html/parsoid
2077 <p>a</p>
2078
2079 <div><pre>foo
2080 </pre></div>
2081 <pre></pre>
2082 !! end
2083
2084 !! test
2085 HTML pre followed by indent-pre
2086 !! wikitext
2087 <pre>foo</pre>
2088 bar
2089 !! html
2090 <pre>foo</pre>
2091 <pre>bar
2092 </pre>
2093 !! end
2094
2095 !!test
2096 Block tag pre
2097 !!options
2098 parsoid
2099 !! wikitext
2100 <p><pre>foo</pre></p>
2101 !! html
2102 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2103 !!end
2104
2105 !!test
2106 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2107 !! wikitext
2108 {{echo|}}
2109 !! html
2110
2111 !!end
2112
2113 !!test
2114 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2115 !! wikitext
2116 {{echo|
2117 foo}}
2118 !! html
2119 <p>foo
2120 </p>
2121 !!end
2122
2123 !! test
2124 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2125 !! wikitext
2126 {{echo|a
2127 b}}
2128 !! html
2129 <pre>a
2130 </pre>
2131 <p>b
2132 </p>
2133 !!end
2134
2135 !! test
2136 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2137 !! wikitext
2138 {{echo|a
2139 b
2140 c
2141 d
2142 e
2143 }}
2144 !! html
2145 <pre>a
2146 </pre>
2147 <p>b
2148 c
2149 </p>
2150 <pre>d
2151 </pre>
2152 <p>e
2153 </p>
2154 !!end
2155
2156 !!test
2157 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2158 !! wikitext
2159 {{echo| foo}}
2160
2161 {{echo| foo}}{{echo| bar}}
2162
2163 {{echo| foo}}
2164 {{echo| bar}}
2165
2166 {{echo|<!--cmt--> foo}}
2167
2168 <!--cmt-->{{echo| foo}}
2169
2170 {{echo|{{echo| }}bar}}
2171 !! html
2172 <pre>foo
2173 </pre>
2174 <pre>foo bar
2175 </pre>
2176 <pre>foo
2177 bar
2178 </pre>
2179 <pre>foo
2180 </pre>
2181 <pre>foo
2182 </pre>
2183 <pre>bar
2184 </pre>
2185 !!end
2186
2187 !! test
2188 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2189 !! wikitext
2190 {{echo| }}a
2191
2192 {{echo|
2193 }}a
2194
2195 {{echo|
2196 b}}
2197
2198 {{echo|a
2199 }}b
2200
2201 {{echo|a
2202 }} b
2203 !! html
2204 <pre>a
2205 </pre>
2206 <p><br />
2207 </p>
2208 <pre>a
2209 </pre>
2210 <p><br />
2211 </p>
2212 <pre>b
2213 </pre>
2214 <p>a
2215 </p>
2216 <pre>b
2217 </pre>
2218 <p>a
2219 </p>
2220 <pre>b
2221 </pre>
2222 !!end
2223
2224 !! test
2225 Things that look like <pre> tags aren't treated as such
2226 !! wikitext
2227 Barack Obama <President> of the United States
2228 <President></President>
2229 !! html
2230 <p>Barack Obama &lt;President&gt; of the United States
2231 &lt;President&gt;&lt;/President&gt;
2232 </p>
2233 !! end
2234
2235 ## PHP parser discards the "<pre " string
2236 !! test
2237 Handle broken pre-like tags (bug 64025)
2238 !! options
2239 parsoid=wt2html
2240 !! wikitext
2241 {{echo|<pre <pre>x</pre>}}
2242
2243 <table><pre </table>
2244 !! html/php
2245 <pre>x</pre>
2246 <table><pre></pre></table>
2247
2248 !! html/parsoid
2249 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2250
2251
2252 <p>&lt;pre </p>
2253
2254 <table></table>
2255 !! end
2256
2257 !! test
2258 Parsoid: handle pre with space after attribute
2259 !! options
2260 parsoid=wt2html
2261 !! wikitext
2262 <pre style="width:50%;" >{{echo|foo}}</pre>
2263 !! html
2264 <pre style="width:50%;">{{echo|foo}}</pre>
2265 !! end
2266
2267 # TODO / maybe: fix wt2wt for this
2268 !! test
2269 Parsoid: Don't paragraph-wrap fosterable content
2270 !! options
2271 parsoid=wt2html
2272 !! wikitext
2273 {|
2274 <td></td>
2275 <td></td>
2276
2277
2278
2279 |}
2280 !! html
2281 <table>
2282
2283 <tbody>
2284 <tr>
2285 <td></td>
2286
2287 <td></td></tr>
2288
2289
2290
2291 </tbody></table>
2292 !! end
2293
2294 !! test
2295 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2296 !! options
2297 parsoid=wt2html
2298 !! wikitext
2299 {|
2300 <td>
2301 <td>
2302 </td>
2303
2304
2305
2306 |}
2307 !! html
2308 <table>
2309
2310 <tbody>
2311 <tr>
2312 <td></td>
2313
2314 <td>
2315 </td></tr>
2316
2317
2318
2319 </tbody></table>
2320 !! end
2321
2322
2323 #--------------------------------------------------------------------
2324 # Transclusion parameter whitespace stripping tests
2325 # Behavior is different for positional and named parameters
2326 #--------------------------------------------------------------------
2327 !! test
2328 Templates: Strip leading and trailing whitespace from named-param values
2329 !! wikitext
2330 {{echo|1= a }}
2331
2332 {{echo|1= {{echo|b}} }}
2333
2334 {{echo| 1 =
2335 c }}
2336
2337 {{echo| 1 =
2338 * d
2339 }}
2340 !! html
2341 <p>a
2342 </p><p>b
2343 </p><p>c
2344 </p>
2345 <ul><li> d</li></ul>
2346
2347 !! end
2348
2349 !! test
2350 Templates: Don't strip whitespace from positional-param values
2351 !! wikitext
2352 {{echo|a }}
2353
2354 {{echo|{{echo|b}} }}
2355
2356 {{echo| c
2357 }}
2358
2359 {{echo| {{echo|d}}
2360 }}
2361
2362 {{echo|
2363 e}}
2364
2365 {{echo|
2366 * f}}
2367
2368 {{echo|
2369 }}g
2370 !! html
2371 <p>a
2372 </p><p>b
2373 </p>
2374 <pre>c
2375 </pre>
2376 <p><br />
2377 </p>
2378 <pre>d
2379 </pre>
2380 <p><br />
2381 </p>
2382 <pre>e
2383 </pre>
2384 <p><br />
2385 </p>
2386 <ul><li> f</li></ul>
2387 <p><br />
2388 </p>
2389 <pre>g
2390 </pre>
2391 !! end
2392
2393 !! test
2394 Templates: Handle empty comment-and-ws-only lines correctly
2395 !! wikitext
2396 {{echo|foo
2397 <!--should be ignored-->
2398 <!--should be ignored as well-->
2399 bar}}
2400 !! html
2401 <p>foo
2402 bar
2403 </p>
2404 !! end
2405
2406 !! test
2407 Templates: Handle comments in the target
2408 !! wikitext
2409 {{echo
2410 <!-- should be ignored -->
2411 |foo}}
2412
2413 {{echo<!-- should be ignored -->
2414 |foo}}
2415
2416 {{echo<!-- should be ignored -->|foo}}
2417
2418 {{<!-- should be ignored -->echo|foo}}
2419 !!html/parsoid
2420 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2421
2422 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2423
2424 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2425
2426 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2427 !!end
2428
2429 !! test
2430 Templates: Handle comments in parameter names (bug 67657)
2431 !! wikitext
2432 {{echo|1
2433 <!-- should be ignored -->
2434 =foo}}
2435
2436 {{echo|
2437 <!-- should be ignored -->
2438 1 = foo}}
2439
2440 {{echo|1<!-- should be ignored --> = foo}}
2441
2442 {{echo|<!-- should be ignored -->1 = foo}}
2443 !!html/parsoid
2444 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2445
2446 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2447
2448 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2449
2450 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2451 !!end
2452
2453 !! test
2454 Templates: Other wikitext in parameter names (bug 67657)
2455 !! wikitext
2456 {{echo|''1''=foo}}
2457 !!html/parsoid
2458 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2459 !!html/php
2460 <p>{{{1}}}
2461 </p>
2462 !!end
2463
2464 #--------------------------------------------------------------------
2465 # Transclusion parameter escaping tests
2466 #--------------------------------------------------------------------
2467 !! test
2468 Templates: Parsoid parameter escaping test 1
2469 !! options
2470 parsoid
2471 !! wikitext
2472 {{echo|[foo]|{{echo|[bar]}}}}
2473 !! html
2474 <p about="#mwt1" typeof="mw:Transclusion"
2475 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2476 !! end
2477
2478 !! test
2479 Parsoid: Pipes in external links in template parameter
2480 !! options
2481 parsoid
2482 !! wikitext
2483 {{echo|[{{echo|http://example.com}} link]}}
2484 !! html
2485 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2486 !! end
2487
2488 !! test
2489 Parsoid: pipe in transclusion parameter
2490 !! options
2491 parsoid
2492 !! wikitext
2493 {{echo|http://foo.com/a&#124;b}}
2494 !! html
2495 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2496 typeof="mw:Transclusion"
2497 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2498 !! end
2499
2500 !! test
2501 Parsoid: Pipe in external link target and content in template parameter
2502 !! options
2503 parsoid=html2wt,wt2wt
2504 !! wikitext
2505 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2506 !! html
2507 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2508 typeof="mw:Transclusion"
2509 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2510 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2511 !! end
2512
2513 !! test
2514 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2515 !! options
2516 parsoid
2517 !! wikitext
2518 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2519 !! html
2520 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2521 !! end
2522
2523 !! test
2524 Templates: Don't escape already nowiki-escaped text in template parameters
2525 !! options
2526 parsoid=html2wt,wt2wt
2527 !! wikitext
2528 {{echo|foo<nowiki>|</nowiki>bar}}
2529 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2530 {{echo|<nowiki></nowiki>}}
2531 !! html
2532 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2533 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2534 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2535 </p>
2536 !! end
2537
2538 ## Bug 52824
2539 !! test
2540 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2541 !! options
2542 parsoid=html2wt,wt2wt
2543 !! wikitext
2544 {{echo|{{echo|1=bar}}}}
2545 !! html
2546 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2547 !! end
2548
2549 ## Bug 56733
2550 !! test
2551 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2552 !! options
2553 parsoid
2554 !! wikitext
2555 {{echo|a : b}}
2556 !! html
2557 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2558 !! end
2559
2560 ## Bug T73412
2561 !! test
2562 Templates: Preserve blank parameter names
2563 !! wikitext
2564 {{echo|=foo}}
2565 !! html/php
2566 <p>{{{1}}}
2567 </p>
2568 !! html/parsoid
2569 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2570 !! end
2571
2572 ###
2573 ### Parsoid-centric tests for testing RT edge cases for pre
2574 ###
2575
2576 !!test
2577 1a. Indent-Pre and Comments
2578 !! wikitext
2579 a
2580 <!--a-->
2581 c
2582 !! html
2583 <pre>a
2584 </pre>
2585 <p>c
2586 </p>
2587 !!end
2588
2589 !!test
2590 1b. Indent-Pre and Comments
2591 !! wikitext
2592 a
2593 <!--a-->
2594 c
2595 !! html
2596 <pre>a
2597 </pre>
2598 <p>c
2599 </p>
2600 !!end
2601
2602 !!test
2603 1c. Indent-Pre and Comments
2604 !! wikitext
2605 <!--a--> a
2606
2607 <!--a--> a
2608 !! html
2609 <pre> a
2610 </pre>
2611 <pre> a
2612 </pre>
2613 !!end
2614
2615 !!test
2616 1d. Indent-Pre and Comments
2617 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2618 !! wikitext
2619 <!--a--> a
2620
2621 <!--b-->b
2622 !! html
2623 <pre>a
2624 </pre>
2625 <pre>b
2626 </pre>
2627 !!end
2628
2629 !!test
2630 2a. Indent-Pre and tables
2631 !! wikitext
2632 {|
2633 |-
2634 !h1!!h2
2635 |foo||bar
2636 |}
2637 !! html
2638 <table>
2639
2640 <tr>
2641 <th>h1</th>
2642 <th>h2
2643 </th>
2644 <td>foo</td>
2645 <td>bar
2646 </td></tr></table>
2647
2648 !!end
2649
2650 !!test
2651 2b. Indent-Pre and tables
2652 !! wikitext
2653 {|
2654 |-
2655 |foo
2656 |}
2657 !! html
2658 <table>
2659
2660 <tr>
2661 <td>foo
2662 </td></tr></table>
2663
2664 !!end
2665
2666 !!test
2667 2c. Indent-Pre and tables (bug 42252)
2668 !! wikitext
2669 {|
2670 |+ foo
2671 ! | bar
2672 |}
2673 !! html
2674 <table>
2675 <caption> foo
2676 </caption>
2677 <tr>
2678 <th> bar
2679 </th></tr></table>
2680
2681 !!end
2682
2683 !!test
2684 2d. Indent-Pre and tables
2685 !! wikitext
2686 a
2687 {|
2688 | b
2689 |}
2690 !! html/php
2691 <pre>a
2692 </pre>
2693 <table>
2694 <tr>
2695 <td> b
2696 </td></tr></table>
2697
2698 !! html/parsoid
2699 <pre>a</pre>
2700 <table>
2701 <tbody><tr><td> b</td></tr>
2702 </tbody></table>
2703 !!end
2704
2705 !!test
2706 2e. Indent-Pre and table-line syntax
2707 !! wikitext
2708 a
2709 | b
2710 | c
2711 !! html/php
2712 <pre>a
2713 | b
2714 | c
2715 </pre>
2716 !!end
2717
2718 !!test
2719 2f. Indent-pre started by table-line syntax
2720 !! wikitext
2721 a
2722 | b
2723 | c
2724 !! html/php
2725 <p>a
2726 </p>
2727 <pre>| b
2728 | c
2729 </pre>
2730 !! html/parsoid
2731 <p>a</p>
2732 <pre>
2733 | b
2734 | c</pre>
2735 !!end
2736
2737 !!test
2738 3a. Indent-Pre and block tags (single-line html)
2739 !! wikitext
2740 a <p> foo </p>
2741 b <div> foo </div>
2742 c <blockquote> foo </blockquote>
2743 <span> foo </span>
2744 !! html
2745 a <p> foo </p>
2746 b <div> foo </div>
2747 c <blockquote> foo </blockquote>
2748 <pre><span> foo </span>
2749 </pre>
2750 !! html/parsoid
2751 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2752 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2753 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2754 <pre><span> foo </span>
2755 </pre>
2756 !! html+tidy
2757 <p>a</p>
2758 <p>foo</p>
2759 <p>b</p>
2760 <div>foo</div>
2761 <p>c</p>
2762 <blockquote>
2763 <p>foo</p>
2764 </blockquote>
2765 <pre>
2766 <span> foo </span>
2767 </pre>
2768 !! end
2769
2770 !!test
2771 3b. Indent-Pre and block tags (multi-line html)
2772 !! wikitext
2773 a <span>foo</span>
2774 b <div> foo </div>
2775 !! html
2776 <pre>a <span>foo</span>
2777 </pre>
2778 b <div> foo </div>
2779
2780 !! html/parsoid
2781 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2782 b <div data-parsoid='{"stx":"html"}'> foo </div>
2783 !! html+tidy
2784 <pre>
2785 a <span>foo</span>
2786 </pre>
2787 <p>b</p>
2788 <div>foo</div>
2789 !!end
2790
2791 !!test
2792 3c. Indent-Pre and block tags (pre-content on separate line)
2793 !! wikitext
2794 <p>
2795 foo
2796 </p>
2797
2798 <div>
2799 foo
2800 </div>
2801
2802 <center>
2803 foo
2804 </center>
2805
2806 <blockquote>
2807 foo
2808 </blockquote>
2809
2810 <blockquote>
2811 <pre>
2812 foo
2813 </pre>
2814 </blockquote>
2815
2816 <table><tr><td>
2817 foo
2818 </td></tr></table>
2819
2820 <ul><li>
2821 foo
2822 </li></ul>
2823
2824 !! html
2825 <p>
2826 foo
2827 </p>
2828 <div>
2829 <pre>foo
2830 </pre>
2831 </div>
2832 <center>
2833 <pre>foo
2834 </pre>
2835 </center>
2836 <blockquote>
2837 <p> foo
2838 </p>
2839 </blockquote>
2840 <blockquote>
2841 <pre>
2842 foo
2843 </pre>
2844 </blockquote>
2845 <table><tr><td>
2846 <pre>foo
2847 </pre>
2848 </td></tr></table>
2849 <ul><li>
2850 foo
2851 </li></ul>
2852
2853 !!end
2854
2855 !!test
2856 4. Indent-Pre and extension tags
2857 !! wikitext
2858 a <gallery>
2859 File:foobar.jpg
2860 </gallery>
2861 !! html
2862 a <ul class="gallery mw-gallery-traditional">
2863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2864 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></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" /></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 ;{{echo|a:b}}
3970 ;{{echo|''a:b''}}
3971 !! html
3972 <dl><dt>a</dt>
3973 <dd>b</dd>
3974 <dt><b>a:b</b></dt>
3975 <dt><i>a:b</i></dt>
3976 <dt><span>a:b</span></dt>
3977 <dt><div>a:b</div></dt>
3978 <dt>a</dt>
3979 <dd>b</dd>
3980 <dt><i>a:b</i></dt></dl>
3981
3982 !! end
3983
3984 !! test
3985 Definition Lists: colons and tables 1
3986 !! wikitext
3987 :{|
3988 | x
3989 |}
3990 :{|
3991 | y
3992 |}
3993 !! html
3994 <dl><dd><table>
3995 <tr>
3996 <td> x
3997 </td></tr></table></dd></dl>
3998 <dl><dd><table>
3999 <tr>
4000 <td> y
4001 </td></tr></table></dd></dl>
4002
4003 !! end
4004
4005 # Parsoid's output (as documented below) differs from php's in this case.
4006 # This is probably a bug. If we fixup parsoid to match php's output, the
4007 # above test should pass and the below test case can be removed. It is
4008 # unclear which output is more desirable.
4009
4010 !! test
4011 Definition Lists: colons and tables 2
4012 !! wikitext
4013 :{|
4014 | x
4015 |}
4016 :{|
4017 | y
4018 |}
4019 !! html/parsoid
4020 <dl><dd><table>
4021 <tr>
4022 <td> x
4023 </td></tr></table></dd>
4024 <dd><table>
4025 <tr>
4026 <td> y
4027 </td></tr></table></dd></dl>
4028 !! end
4029
4030
4031 ###
4032 ### External links
4033 ###
4034 !! test
4035 External links: non-bracketed
4036 !! wikitext
4037 Non-bracketed: http://example.com
4038 !! html
4039 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4040 </p>
4041 !! end
4042
4043 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4044 !! test
4045 External links: numbered
4046 !! wikitext
4047 Numbered: [http://example.com]
4048 Numbered: [http://example.net]
4049 Numbered: [http://example.com]
4050 !! html/php
4051 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4052 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4053 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4054 </p>
4055 !! html/parsoid
4056 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4057 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4058 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4059 !!end
4060
4061 !! test
4062 External links: specified text
4063 !! wikitext
4064 Specified text: [http://example.com link]
4065 !! html
4066 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4067 </p>
4068 !!end
4069
4070 !! test
4071 External links: trail
4072 !! wikitext
4073 Linktrails should not work for external links: [http://example.com link]s
4074 !! html
4075 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4076 </p>
4077 !! end
4078
4079 !! test
4080 External links: dollar sign in URL
4081 !! wikitext
4082 http://example.com/1$2345
4083 !! html
4084 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4085 </p>
4086 !! end
4087
4088 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4089 !! test
4090 External links: dollar sign in URL (autonumber)
4091 !! wikitext
4092 [http://example.com/1$2345]
4093 !! html/php
4094 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4095 </p>
4096 !! html/parsoid
4097 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4098 !!end
4099
4100 !! test
4101 External links: open square bracket forbidden in URL (bug 4377)
4102 !! options
4103 parsoid=wt2html,wt2wt,html2html
4104 !! wikitext
4105 http://example.com/1[2345
4106 !! html/php
4107 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4108 </p>
4109 !! html/parsoid
4110 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4111 !! end
4112
4113 !! test
4114 External links: open square bracket forbidden in URL (named) (bug 4377)
4115 !! options
4116 parsoid=wt2html,html2html
4117 !! wikitext
4118 [http://example.com/1[2345]
4119 !! html/php
4120 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4121 </p>
4122 !! html/parsoid
4123 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4124 !!end
4125
4126 # parsoid adds a space before the link name
4127 !! test
4128 External links: open square bracket forbidden in URL (named) (bug 4377)
4129 Parsoid variant.
4130 !! wikitext
4131 [http://example.com/1 [2345]
4132 !! html
4133 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4134 </p>
4135 !!end
4136
4137 !! test
4138 External links: nowiki in URL link text (bug 6230)
4139 !! wikitext
4140 [http://example.com/ <nowiki>''example site''</nowiki>]
4141 !! html
4142 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4143 </p>
4144 !! end
4145
4146 !! test
4147 External links: newline forbidden in text (bug 6230 regression check)
4148 !! wikitext
4149 [http://example.com/ first
4150 second]
4151 !! html
4152 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4153 second]
4154 </p>
4155 !!end
4156
4157 !! test
4158 External links: Pipe char between url and text
4159 !! wikitext
4160 [http://example.com | link]
4161 !! html
4162 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4163 </p>
4164 !!end
4165
4166 !! test
4167 External links: protocol-relative URL in brackets
4168 !! wikitext
4169 [//example.com/ Test]
4170 !! html
4171 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4172 </p>
4173 !! end
4174
4175 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4176 !! test
4177 External links: protocol-relative URL in brackets without text
4178 !! wikitext
4179 [//example.com]
4180 !! html/php
4181 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4182 </p>
4183 !! html/parsoid
4184 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4185 !! end
4186
4187 !! test
4188 External links: protocol-relative URL in free text is left alone
4189 !! wikitext
4190 //example.com/Foo
4191 !! html
4192 <p>//example.com/Foo
4193 </p>
4194 !!end
4195
4196 !! test
4197 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4198 !! wikitext
4199 foo//example.com/Foo
4200 !! html
4201 <p>foo//example.com/Foo
4202 </p>
4203 !! end
4204
4205 !! test
4206 External links: with no contents
4207 !! wikitext
4208 [http://en.wikipedia.org/wiki/Foo]
4209
4210 [[wikipedia:Foo|Bar]]
4211
4212 [[wikipedia:Foo|<span>Bar</span>]]
4213 !! html/php
4214 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4215 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4216 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4217 </p>
4218 !! html/parsoid
4219 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4220 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4221 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4222 !! end
4223
4224 !! test
4225 External links: Free with trailing punctuation
4226 !! wikitext
4227 http://example.com,
4228 http://example.com;
4229 http://example.com\
4230 http://example.com.
4231 http://example.com:
4232 http://example.com!
4233 http://example.com?
4234 http://example.com)
4235 http://example.com/url_with_(brackets)
4236 (http://example.com/url_without_brackets)
4237 http://example.com/url_with_entity&nbsp;
4238 http://example.com/url_with_entity&#xA0;
4239 http://example.com/url_with_entity&#160;
4240 http://example.com/url_with_entity&lt;
4241 http://example.com/url_with_entity&#x3C;
4242 http://example.com/url_with_entity&#60;
4243 !! html/php
4244 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4245 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4246 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4247 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4248 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4249 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4250 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4251 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4252 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4253 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4254 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4255 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4256 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4257 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4258 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4259 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4260 </p>
4261 !! html/parsoid
4262 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4263 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4264 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4265 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4266 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4267 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4268 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4269 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4270 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4271 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4272 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4273 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4274 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4275 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4276 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4277 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4278 !! end
4279
4280 !! test
4281 External links: No preceding word characters allowed (bug 65278)
4282 !! wikitext
4283 NOPEhttp://example.com
4284 N0http://example.com
4285 ok:http://example.com
4286 ok-http://example.com
4287 !! html
4288 <p>NOPEhttp://example.com
4289 N0http://example.com
4290 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4291 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4292 </p>
4293 !! end
4294
4295 !! test
4296 External image
4297 !! wikitext
4298 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4299 !! html
4300 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4301 </p>
4302 !! end
4303
4304 !! test
4305 External image from https
4306 !! wikitext
4307 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4308 !! html
4309 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4310 </p>
4311 !! end
4312
4313 !! test
4314 External image (when not allowed)
4315 !! options
4316 wgAllowExternalImages=0
4317 !! wikitext
4318 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4319 !! html
4320 <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>
4321 </p>
4322 !! end
4323
4324 !! test
4325 Link to non-http image, no img tag
4326 !! wikitext
4327 Link to non-http image, no img tag: ftp://example.com/test.jpg
4328 !! html
4329 <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>
4330 </p>
4331 !! end
4332
4333 !! test
4334 External links: terminating separator
4335 !! wikitext
4336 Terminating separator: http://example.com/thing,
4337 !! html
4338 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4339 </p>
4340 !! end
4341
4342 !! test
4343 External links: intervening separator
4344 !! wikitext
4345 Intervening separator: http://example.com/1,2,3
4346 !! html
4347 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4348 </p>
4349 !! end
4350
4351 !! test
4352 External links: old bug with URL in query
4353 !! wikitext
4354 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4355 !! html
4356 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4357 </p>
4358 !! end
4359
4360 !! test
4361 External links: old URL-in-URL bug, mixed protocols
4362 !! wikitext
4363 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4364 !! html
4365 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4366 </p>
4367 !!end
4368
4369 !! test
4370 External links: URL in text
4371 !! wikitext
4372 URL in text: [http://example.com http://example.com]
4373 !! html
4374 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4375 </p>
4376 !! end
4377
4378 !! test
4379 External links: Clickable images
4380 !! wikitext
4381 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4382 !! html/php
4383 <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>
4384 </p>
4385 !! html/parsoid
4386 <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>
4387 !! end
4388
4389 !! test
4390 External links: raw ampersand
4391 !! wikitext
4392 Old &amp; use: http://x&y
4393 !! html
4394 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4395 </p>
4396 !! end
4397
4398 !! test
4399 External links: encoded ampersand
4400 !! wikitext
4401 Old &amp; use: http://x&amp;y
4402 !! html/php
4403 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4404 </p>
4405 !! html/parsoid
4406 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4407 !! end
4408
4409 !! test
4410 External links: encoded equals (bug 6102)
4411 !! wikitext
4412 http://example.com/?foo&#61;bar
4413 !! html/php
4414 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4415 </p>
4416 !! html/parsoid
4417 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4418 !! end
4419
4420 ##
4421 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4422 ## does it number them. As discussed in bug 53505, we can identify
4423 ## autonumbered links via CSS.
4424 ##
4425
4426 !! test
4427 External links: [raw ampersand]
4428 !! wikitext
4429 Old &amp; use: [http://x&y]
4430 !! html/php
4431 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4432 </p>
4433 !! html/parsoid
4434 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4435 !! end
4436
4437 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4438 # mode will return the [raw ampersand] wikitext
4439 !! test
4440 External links: [encoded ampersand]
4441 !! options
4442 parsoid=wt2html,wt2wt,html2html
4443 !! wikitext
4444 Old &amp; use: [http://x&amp;y]
4445 !! html/php
4446 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4447 </p>
4448 !! html/parsoid
4449 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4450 !! end
4451
4452 !! test
4453 External links: [raw equals]
4454 !! wikitext
4455 [http://example.com/?foo=bar]
4456 !! html/php
4457 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4458 </p>
4459 !! html/parsoid
4460 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4461 !! end
4462
4463 # note that parsoid html is identical to [raw equals] case; so html2wt
4464 # mode will return the [raw equals] wikitext
4465 !! test
4466 External links: [encoded equals] (bug 6102)
4467 !! options
4468 parsoid=wt2html,wt2wt,html2html
4469 !! wikitext
4470 [http://example.com/?foo&#61;bar]
4471 !! html/php
4472 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4473 </p>
4474 !! html/parsoid
4475 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4476 !! end
4477
4478 # xxx parsoid strips the IDN character, so the round-trip tests will
4479 # obviously fail and are disabled. --cscott
4480 !! test
4481 External links: [IDN ignored character reference in hostname; strip it right off]
4482 !! options
4483 parsoid=wt2html,wt2wt,html2html
4484 !! wikitext
4485 [http://e&zwnj;xample.com/]
4486 !! html/php
4487 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4488 </p>
4489 !! html/parsoid
4490 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4491 !! end
4492
4493 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4494 # Where an external link could easily circumvent the sanitization of the text of
4495 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4496 # test demands a higher standard. That's a bit strange.
4497 #
4498 # Example:
4499 #
4500 # http://e‌xample.com -> [http://example.com|http://example.com]
4501 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4502 #
4503 # The first example is sanitized, but the second is not. Any security benefits
4504 # from this production are trivial to circumvent. Either remove this test and
4505 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4506 # the test accordingly.
4507 #
4508 # All our love,
4509 # The Parsoid team.
4510 # xxx parsoid strips the IDN character, so the round-trip tests will
4511 # obviously fail and are disabled. --cscott
4512 !! test
4513 External links: IDN ignored character reference in hostname; strip it right off
4514 !! options
4515 parsoid=wt2html,html2html
4516 !! wikitext
4517 http://e&zwnj;xample.com/
4518 !! html/php
4519 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4520 </p>
4521 !! html/parsoid
4522 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4523 !! end
4524
4525 !! test
4526 External links: www.jpeg.org (bug 554)
4527 !! wikitext
4528 http://www.jpeg.org
4529 !! html
4530 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4531 </p>
4532 !! end
4533
4534 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4535 !! test
4536 External links: URL within URL (original bug 2)
4537 !! wikitext
4538 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4539 !! html/php
4540 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4541 </p>
4542 !! html/parsoid
4543 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4544 !! end
4545
4546 !! test
4547 BUG 361: URL inside bracketed URL
4548 !! wikitext
4549 [http://www.example.com/foo http://www.example.com/bar]
4550 !! html
4551 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4552 </p>
4553 !! end
4554
4555 !! test
4556 BUG 361: URL within URL, not bracketed
4557 !! wikitext
4558 http://www.example.com/foo?=http://www.example.com/bar
4559 !! html
4560 <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>
4561 </p>
4562 !! end
4563
4564 !! test
4565 BUG 289: ">"-token in URL-tail
4566 !! wikitext
4567 http://www.example.com/<hello>
4568 !! html
4569 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4570 </p>
4571 !!end
4572
4573 !! test
4574 BUG 289: literal ">"-token in URL-tail
4575 !! wikitext
4576 http://www.example.com/<b>html</b>
4577 !! html/php
4578 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4579 </p>
4580 !! html/parsoid
4581 <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>
4582 !! end
4583
4584 !! test
4585 BUG 289: ">"-token in bracketed URL
4586 !! wikitext
4587 [http://www.example.com/<hello> stuff]
4588 !! html
4589 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4590 </p>
4591 !!end
4592
4593 !! test
4594 BUG 289: literal ">"-token in bracketed URL
4595 !! wikitext
4596 [http://www.example.com/<b>html</b> stuff]
4597 !! html
4598 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4599 </p>
4600 !!end
4601
4602 !! test
4603 BUG 289: literal double quote at end of URL
4604 !! wikitext
4605 http://www.example.com/"hello"
4606 !! html
4607 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4608 </p>
4609 !!end
4610
4611 !! test
4612 BUG 289: literal double quote in bracketed URL
4613 !! wikitext
4614 [http://www.example.com/"hello" stuff]
4615 !! html
4616 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4617 </p>
4618 !!end
4619
4620 !! test
4621 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4622 !! wikitext
4623 [http://www.example.com test]
4624 !! html
4625 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4626 </p>
4627 !! end
4628
4629 !! test
4630 External links: link text with spaces
4631 !! wikitext
4632 [http://www.example.com a b c]
4633 [http://www.example.com ''a'' ''b'']
4634 !! html
4635 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4636 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4637 </p>
4638 !! end
4639
4640 !! test
4641 External links: wiki links within external link (Bug 3695)
4642 !! wikitext
4643 [http://example.com [[wikilink]] embedded in ext link]
4644 !! html/php
4645 <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>
4646 </p>
4647 !! html/parsoid
4648 <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>
4649 !! end
4650
4651 !! test
4652 BUG 787: Links with one slash after the url protocol are invalid
4653 !! wikitext
4654 http:/example.com
4655
4656 [http:/example.com title]
4657 !! html
4658 <p>http:/example.com
4659 </p><p>[http:/example.com title]
4660 </p>
4661 !! end
4662
4663 !! test
4664 Bracketed external links with template-generated invalid target
4665 !! wikitext
4666 [{{echo|http:/example.com}} title]
4667 !! html
4668 <p>[http:/example.com title]
4669 </p>
4670 !! end
4671
4672 !! test
4673 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4674 !! wikitext
4675 ''[http://example.com text'']
4676 [http://example.com '''text]'''
4677 ''Something [http://example.com in italic'']
4678 ''Something [http://example.com mixed''''', even bold]'''
4679 '''''Now [http://example.com both''''']
4680 !! html
4681 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4682 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4683 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4684 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4685 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4686 </p>
4687 !! end
4688
4689
4690 !! test
4691 Bug 4781: %26 in URL
4692 !! wikitext
4693 http://www.example.com/?title=AT%26T
4694 !! html/php
4695 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4696 </p>
4697 !! html/parsoid
4698 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4699 !! end
4700
4701 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4702 # % is actually legal in HTML5. Any change in output would need testing though.
4703 !! test
4704 Bug 4781, 5267: %25 in URL
4705 !! wikitext
4706 http://www.example.com/?title=100%25_Bran
4707 !! html/php
4708 <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>
4709 </p>
4710 !! html/parsoid
4711 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4712 !! end
4713
4714 !! test
4715 Bug 4781, 5267: %28, %29 in URL
4716 !! wikitext
4717 http://www.example.com/?title=Ben-Hur_%281959_film%29
4718 !! html/php
4719 <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>
4720 </p>
4721 !! html/parsoid
4722 <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>
4723 !! end
4724
4725
4726 !! test
4727 Bug 4781: %26 in autonumber URL
4728 !! wikitext
4729 [http://www.example.com/?title=AT%26T]
4730 !! html/php
4731 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4732 </p>
4733 !! html/parsoid
4734 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4735 !! end
4736
4737 !! test
4738 Bug 4781, 5267: %26 in autonumber URL
4739 !! wikitext
4740 [http://www.example.com/?title=100%25_Bran]
4741 !! html/php
4742 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4743 </p>
4744 !! html/parsoid
4745 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4746 !! end
4747
4748 !! test
4749 Bug 4781, 5267: %28, %29 in autonumber URL
4750 !! wikitext
4751 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4752 !! html/php
4753 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4754 </p>
4755 !! html/parsoid
4756 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4757 !! end
4758
4759
4760 !! test
4761 Bug 4781: %26 in bracketed URL
4762 !! wikitext
4763 [http://www.example.com/?title=AT%26T link]
4764 !! html/php
4765 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4766 </p>
4767 !! html/parsoid
4768 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4769 !! end
4770
4771 !! test
4772 Bug 4781, 5267: %25 in bracketed URL
4773 !! wikitext
4774 [http://www.example.com/?title=100%25_Bran link]
4775 !! html
4776 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4777 </p>
4778 !! end
4779
4780 !! test
4781 Bug 4781, 5267: %28, %29 in bracketed URL
4782 !! wikitext
4783 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4784 !! html/php
4785 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4786 </p>
4787 !! html/parsoid
4788 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4789 !! end
4790
4791 !! test
4792 External link containing a period in the anchor. (bug 63947)
4793 !! wikitext
4794 [//foo.org/bar#baz. bang]
4795
4796 [//foo.org/bar. bang]
4797 !! html/php
4798 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4799 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4800 </p>
4801 !! html/parsoid
4802 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4803 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4804 !! end
4805
4806 !! test
4807 External link containing a single quote. (bug 63947)
4808 !! wikitext
4809 [//foo.org/bar'baz]
4810
4811 [//foo.org/bar'baz bang]
4812 !! html/php
4813 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4814 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4815 </p>
4816 !! html/parsoid
4817 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4818 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4819 !! end
4820
4821
4822 !! test
4823 External link containing a period in the anchor. (bug 63947)
4824 !! wikitext
4825 [//foo.org/bar#baz. bang]
4826
4827 [//foo.org/bar. bang]
4828 !! html/php
4829 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4830 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4831 </p>
4832 !! html/parsoid
4833 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4834 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4835 !! end
4836
4837 !! test
4838 External link containing a single quote. (bug 63947)
4839 !! wikitext
4840 [//foo.org/bar'baz]
4841
4842 [//foo.org/bar'baz bang]
4843 !! html/php
4844 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4845 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4846 </p>
4847 !! html/parsoid
4848 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4849 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4850 !! end
4851
4852
4853 !! test
4854 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4855 !! wikitext
4856 Some [http://example.com/ pretty ''italics'' and stuff]!
4857 !! html
4858 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4859 </p>
4860 !! end
4861
4862 !! test
4863 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4864 !! wikitext
4865 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4866 !! html
4867 <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>
4868 </p>
4869 !! end
4870
4871 !! test
4872 External link containing double-single-quotes with no space separating the url from text in italics
4873 !! wikitext
4874 [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]].]
4875 !! html/php
4876 <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>
4877 </p>
4878 !! html/php+tidy
4879 <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>
4880 !! html/parsoid
4881 <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>
4882 !! end
4883
4884 !! test
4885 External link with comments in link text
4886 !! wikitext
4887 [http://www.google.com Google <!-- comment -->]
4888 !! html
4889 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4890 </p>
4891 !! end
4892
4893 !! test
4894 URL-encoding in URL functions (single parameter)
4895 !! wikitext
4896 {{localurl:Some page|amp=&}}
4897 !! html
4898 <p>/index.php?title=Some_page&amp;amp=&amp;
4899 </p>
4900 !! end
4901
4902 !! test
4903 URL-encoding in URL functions (multiple parameters)
4904 !! wikitext
4905 {{localurl:Some page|q=?&amp=&}}
4906 !! html
4907 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4908 </p>
4909 !! end
4910
4911 !! test
4912 Brackets in urls
4913 !! wikitext
4914 http://example.com/index.php?foozoid%5B%5D=bar
4915
4916 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4917 !! html/php
4918 <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>
4919 </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>
4920 </p>
4921 !! html/parsoid
4922 <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>
4923
4924 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4925 !! end
4926
4927 !! test
4928 IPv6 urls (bug 21261)
4929 !! options
4930 disabled
4931 !! wikitext
4932 http://[2404:130:0:1000::187:2]/index.php
4933 !! html
4934 <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>
4935 </p>
4936 !! end
4937
4938 !! test
4939 Non-extlinks in brackets
4940 !! wikitext
4941 [foo]
4942 [foo bar]
4943 [foo ''bar'']
4944 [fool's] errand
4945 [fool's errand]
4946 [{{echo|foo}}]
4947 [{{echo|foo}} bar]
4948 [{{echo|foo}} ''bar'']
4949 [{{echo|foo}}l's] errand
4950 [{{echo|foo}}l's errand]
4951 [url={{echo|foo}}]
4952 [url=http://example.com]
4953 !! html
4954 <p>[foo]
4955 [foo bar]
4956 [foo <i>bar</i>]
4957 [fool's] errand
4958 [fool's errand]
4959 [foo]
4960 [foo bar]
4961 [foo <i>bar</i>]
4962 [fool's] errand
4963 [fool's errand]
4964 [url=foo]
4965 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4966 </p>
4967 !! end
4968
4969 !! test
4970 Percent encoding in external links
4971 !! wikitext
4972 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4973 !! html/php
4974 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4975 </p>
4976 !! html/parsoid
4977 <p><a rel="mw:ExtLink"
4978 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4979 !! end
4980
4981 !! test
4982 Use url link syntax for links where the content is equal the link target
4983 !! wikitext
4984 http://example.com
4985 !! html/php
4986 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4990 !! end
4991
4992 !! test
4993 Parenthesis in external links, especially URL links
4994 !! wikitext
4995 http://example.com)
4996
4997 http://example.com/test)
4998
4999 http://example.com/(test)
5000
5001 http://example.com/((test)
5002
5003 (http://example.com/(test))
5004
5005 (http://example.com/(test)))))
5006
5007 http://example.com/a)b
5008
5009 [http://example.com) foo]
5010 !! html/php
5011 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5012 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5013 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5014 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5015 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5016 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5017 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5018 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5019 </p>
5020 !! html/parsoid
5021 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5022 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5023 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5024 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5025 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5026 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5027 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5028 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5029 !! end
5030
5031 !! test
5032 Parenthesis in external links, w/ transclusion or comment
5033 !! wikitext
5034 (http://example.com/{{echo|hi}})
5035
5036 (http://example.com<!-- hi -->)
5037 !! html/php
5038 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5039 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5040 </p>
5041 !! html/parsoid
5042 <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>
5043
5044 <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>
5045 !! end
5046
5047 !! test
5048 Replace invalid link targets when serializing
5049 !! options
5050 parsoid=html2wt
5051 !! html
5052 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5053 !! wikitext
5054 [[MediaWiki:Badtitletext|Manual]]
5055 !! end
5056
5057 ###
5058 ### Quotes
5059 ###
5060
5061 !! test
5062 Quotes
5063 !! wikitext
5064 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5065
5066 Normal text. '''''Bold italic text.''''' Normal text.
5067 !! html
5068 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5069 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5070 </p>
5071 !! end
5072
5073
5074 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5075 # parser strips. The wikitext contains just the first half of the bold
5076 # quote pair.
5077 !! test
5078 Unclosed and unmatched quotes
5079 !! wikitext
5080 '''''Bold italic text '''with bold deactivated''' in between.'''''
5081
5082 '''''Bold italic text ''with italic deactivated'' in between.'''''
5083
5084 '''Bold text..
5085
5086 ..spanning two paragraphs (should not work).'''
5087
5088 '''Bold tag left open
5089
5090 ''Italic tag left open
5091
5092 Normal text.
5093
5094 <!-- Unmatching number of opening, closing tags: -->
5095 '''This year''''s election ''should'' beat '''last year''''s.
5096
5097 ''Tom'''s car is bigger than ''Susan'''s.
5098
5099 Plain ''italic'''s plain
5100 !! html/php
5101 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5102 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5103 </p><p><b>Bold text..</b>
5104 </p><p>..spanning two paragraphs (should not work).
5105 </p><p><b>Bold tag left open</b>
5106 </p><p><i>Italic tag left open</i>
5107 </p><p>Normal text.
5108 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5109 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5110 </p><p>Plain <i>italic'</i>s plain
5111 </p>
5112 !! html/parsoid
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).<b></b>
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 !! end
5125
5126 ###
5127 ### Tables
5128 ###
5129 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5130 ###
5131
5132 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5133 # is the bare minimum required by the spec, see:
5134 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5135 # Parsoid team replies: empty table tags are legal in HTML5
5136 !! test
5137 A table with no data.
5138 !! options
5139 parsoid=wt2html
5140 !! wikitext
5141 {||}
5142 !! html/php
5143
5144 !! html/parsoid
5145 <table></table>
5146
5147 !! end
5148
5149 !! test
5150 A table with stray table end tags on start tag line (wt2html)
5151 !! options
5152 parsoid=wt2html
5153 !! wikitext
5154 {|style="color: red;"|}
5155
5156 {|style="color: red;" |}
5157 |foo
5158 |}
5159
5160 {|style="color: red;"|} id="foo"
5161 |foo
5162 |}
5163
5164 {|style="color: red;" |} id="foo"
5165 |foo
5166 |}
5167 !! html
5168 <table style="color: red;"></table>
5169
5170 <table style="color: red;">
5171 <tbody><tr>
5172 <td>foo</td>
5173 </tr></tbody>
5174 </table>
5175
5176 <table style="color: red;" id="foo">
5177 <tbody><tr>
5178 <td>foo</td>
5179 </tr></tbody>
5180 </table>
5181
5182 <table style="color: red;" id="foo">
5183 <tbody><tr>
5184 <td>foo</td>
5185 </tr></tbody>
5186 </table>
5187
5188 !! end
5189
5190 !! test
5191 A table with no data (take 2)
5192 !! wikitext
5193 {|
5194 |}
5195 !! html/parsoid
5196 <table></table>
5197 !! end
5198
5199 # A table with nothing but a caption is invalid XHTML, we might want to render
5200 # this as <p>caption</p>
5201 # Parsoid team replies: table with only a caption is legal in HTML5
5202 !! test
5203 A table with nothing but a caption
5204 !! wikitext
5205 {|
5206 |+ caption
5207 |}
5208 !! html/php
5209 <table>
5210 <caption> caption
5211 </caption><tr><td></td></tr></table>
5212
5213 !! html/parsoid
5214 <table><caption> caption</caption></table>
5215 !! end
5216
5217 !! test
5218 A table with caption with default-spaced attributes and a table row
5219 !! wikitext
5220 {|
5221 |+ style="color: red;" | caption1
5222 |-
5223 | foo
5224 |}
5225 !! html
5226 <table>
5227 <caption style="color: red;"> caption1
5228 </caption>
5229 <tr>
5230 <td> foo
5231 </td></tr></table>
5232
5233 !! end
5234
5235 !! test
5236 A table with captions with non-default spaced attributes and a table row
5237 !! wikitext
5238 {|
5239 |+style="color: red;"|caption2
5240 |+ style="color: red;"| caption3
5241 |-
5242 | foo
5243 |}
5244 !! html
5245 <table>
5246 <caption style="color: red;">caption2
5247 </caption>
5248 <caption style="color: red;"> caption3
5249 </caption>
5250 <tr>
5251 <td> foo
5252 </td></tr></table>
5253
5254 !! end
5255
5256 !! test
5257 Table td-cell syntax variations
5258 !! wikitext
5259 {|
5260 | foo bar foo | baz
5261 | foo bar foo || baz
5262 | style='color:red;' | baz
5263 | style='color:red;' || baz
5264 |}
5265 !! html
5266 <table>
5267 <tr>
5268 <td> baz
5269 </td>
5270 <td> foo bar foo </td>
5271 <td> baz
5272 </td>
5273 <td style="color:red;"> baz
5274 </td>
5275 <td> style='color:red;' </td>
5276 <td> baz
5277 </td></tr></table>
5278
5279 !! end
5280
5281 !! test
5282 Simple table
5283 !! wikitext
5284 {|
5285 | 1 || 2
5286 |-
5287 | 3 || 4
5288 |}
5289 !! html
5290 <table>
5291 <tr>
5292 <td> 1 </td>
5293 <td> 2
5294 </td></tr>
5295 <tr>
5296 <td> 3 </td>
5297 <td> 4
5298 </td></tr></table>
5299
5300 !! end
5301
5302 !! test
5303 Simple table but with multiple dashes for row wikitext
5304 !! wikitext
5305 {|
5306 | foo
5307 |-----
5308 | bar
5309 |}
5310 !! html
5311 <table>
5312 <tr>
5313 <td> foo
5314 </td></tr>
5315 <tr>
5316 <td> bar
5317 </td></tr></table>
5318
5319 !! end
5320 !! test
5321 Multiplication table
5322 !! wikitext
5323 {| border="1" cellpadding="2"
5324 |+Multiplication table
5325 |-
5326 ! &times; !! 1 !! 2 !! 3
5327 |-
5328 ! 1
5329 | 1 || 2 || 3
5330 |-
5331 ! 2
5332 | 2 || 4 || 6
5333 |-
5334 ! 3
5335 | 3 || 6 || 9
5336 |-
5337 ! 4
5338 | 4 || 8 || 12
5339 |-
5340 ! 5
5341 | 5 || 10 || 15
5342 |}
5343 !! html
5344 <table border="1" cellpadding="2">
5345 <caption>Multiplication table
5346 </caption>
5347 <tr>
5348 <th> &#215; </th>
5349 <th> 1 </th>
5350 <th> 2 </th>
5351 <th> 3
5352 </th></tr>
5353 <tr>
5354 <th> 1
5355 </th>
5356 <td> 1 </td>
5357 <td> 2 </td>
5358 <td> 3
5359 </td></tr>
5360 <tr>
5361 <th> 2
5362 </th>
5363 <td> 2 </td>
5364 <td> 4 </td>
5365 <td> 6
5366 </td></tr>
5367 <tr>
5368 <th> 3
5369 </th>
5370 <td> 3 </td>
5371 <td> 6 </td>
5372 <td> 9
5373 </td></tr>
5374 <tr>
5375 <th> 4
5376 </th>
5377 <td> 4 </td>
5378 <td> 8 </td>
5379 <td> 12
5380 </td></tr>
5381 <tr>
5382 <th> 5
5383 </th>
5384 <td> 5 </td>
5385 <td> 10 </td>
5386 <td> 15
5387 </td></tr></table>
5388
5389 !! end
5390
5391 !! test
5392 Accept "||" in table headings
5393 !! wikitext
5394 {|
5395 !h1 || h2
5396 |}
5397 !! html
5398 <table>
5399 <tr>
5400 <th>h1 </th>
5401 <th> h2
5402 </th></tr></table>
5403
5404 !! end
5405
5406 !! test
5407 Accept "!!" in table data
5408 !! wikitext
5409 {|
5410 | Foo!! ||
5411 |}
5412 !! html
5413 <table>
5414 <tr>
5415 <td> Foo!! </td>
5416 <td>
5417 </td></tr></table>
5418
5419 !! html/parsoid
5420 <table>
5421 <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>
5422 </tbody></table>
5423 !! end
5424
5425 !! test
5426 Accept "||" in indented table headings
5427 !! wikitext
5428 :{|
5429 !h1 || h2
5430 |}
5431 !! html
5432 <dl><dd><table>
5433 <tr>
5434 <th>h1 </th>
5435 <th> h2
5436 </th></tr></table></dd></dl>
5437
5438 !! end
5439
5440 !! test
5441 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5442 !! wikitext
5443 {|
5444 !| h1
5445 || a
5446 |}
5447 !! html
5448 <table>
5449 <tr>
5450 <th> h1
5451 </th>
5452 <td> a
5453 </td></tr></table>
5454
5455 !! end
5456
5457 !!test
5458 Accept "| !" at start of line in tables (ignore !-attribute)
5459 !! wikitext
5460 {|
5461 |-
5462 | !style="color:red" | bar
5463 |}
5464 !! html
5465 <table>
5466
5467 <tr>
5468 <td> bar
5469 </td></tr></table>
5470
5471 !!end
5472
5473 !!test
5474 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 +/-
5475 !! wikitext
5476 {|
5477 |-
5478 |style='color:red;'|+1
5479 |style='color:blue;'|-1
5480 |-
5481 | 1 || 2 || 3
5482 | 1 ||+2 ||-3
5483 |-
5484 | +1
5485 | -1
5486 |}
5487 !! html
5488 <table>
5489
5490 <tr>
5491 <td style="color:red;">+1
5492 </td>
5493 <td style="color:blue;">-1
5494 </td></tr>
5495 <tr>
5496 <td> 1 </td>
5497 <td> 2 </td>
5498 <td> 3
5499 </td>
5500 <td> 1 </td>
5501 <td>+2 </td>
5502 <td>-3
5503 </td></tr>
5504 <tr>
5505 <td> +1
5506 </td>
5507 <td> -1
5508 </td></tr></table>
5509
5510 !!end
5511
5512 !! test
5513 Table rowspan
5514 !! wikitext
5515 {| border=1
5516 | Cell 1, row 1
5517 |rowspan=2| Cell 2, row 1 (and 2)
5518 | Cell 3, row 1
5519 |-
5520 | Cell 1, row 2
5521 | Cell 3, row 2
5522 |}
5523 !! html
5524 <table border="1">
5525 <tr>
5526 <td> Cell 1, row 1
5527 </td>
5528 <td rowspan="2"> Cell 2, row 1 (and 2)
5529 </td>
5530 <td> Cell 3, row 1
5531 </td></tr>
5532 <tr>
5533 <td> Cell 1, row 2
5534 </td>
5535 <td> Cell 3, row 2
5536 </td></tr></table>
5537
5538 !! end
5539
5540 !! test
5541 Nested table
5542 !! wikitext
5543 {| border=1
5544 | &alpha;
5545 |
5546 {| bgcolor=#ABCDEF border=2
5547 |nested
5548 |-
5549 |table
5550 |}
5551 |the original table again
5552 |}
5553 !! html
5554 <table border="1">
5555 <tr>
5556 <td> &#945;
5557 </td>
5558 <td>
5559 <table bgcolor="#ABCDEF" border="2">
5560 <tr>
5561 <td>nested
5562 </td></tr>
5563 <tr>
5564 <td>table
5565 </td></tr></table>
5566 </td>
5567 <td>the original table again
5568 </td></tr></table>
5569
5570 !! end
5571
5572 !! test
5573 Invalid attributes in table cell (bug 1830)
5574 !! wikitext
5575 {|
5576 |Cell:|broken
5577 |}
5578 !! html
5579 <table>
5580 <tr>
5581 <td>broken
5582 </td></tr></table>
5583
5584 !! end
5585
5586 # The "|}" to close the table is missing from the input, so parsoid's
5587 # *2wt modes will fail.
5588 !! test
5589 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5590 !! options
5591 parsoid=wt2html,html2html
5592 !! wikitext
5593 {|
5594 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5595 !! html/php
5596 <table>
5597 <tr>
5598 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5599 <td>]" onmouseover="alert(document.cookie)"&gt;test
5600 </td>
5601 </tr>
5602 </table>
5603
5604 !! html/parsoid
5605 <table><tbody>
5606 <tr>
5607 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5608 !! end
5609
5610 # FIXME: The php output is broken.
5611 !! test
5612 ! and || in td attributes should not be parsed as <th>/<td>
5613 !! wikitext
5614 {|
5615 | style="color: red !important;" data-contrived="put this here ||" | foo
5616 |}
5617 !! html/php
5618 <table>
5619 <tr>
5620 <td> style="color: red !important;" data-contrived="put this here </td>
5621 <td> foo
5622 </td></tr></table>
5623
5624 !! html/parsoid
5625 <table>
5626 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5627 </tbody></table>
5628 !! end
5629
5630 !! test
5631 Indented table markup mixed with indented pre content (proposed in bug 6200)
5632 !! wikitext
5633 <table>
5634 <tr>
5635 <td>
5636 Text that should be rendered preformatted
5637 </td>
5638 </tr>
5639 </table>
5640 !! html
5641 <table>
5642 <tr>
5643 <td>
5644 <pre>Text that should be rendered preformatted
5645 </pre>
5646 </td>
5647 </tr>
5648 </table>
5649
5650 !! end
5651
5652 !! test
5653 1. Template-generated table cell attributes and cell content
5654 !! wikitext
5655 {|
5656 |{{table_attribs}}
5657 | {{table_attribs}}
5658 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5659 |align=center {{table_attribs}}
5660 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5661 |}
5662 !! html
5663 <table>
5664 <tr>
5665 <td style="color:red;">Foo
5666 </td>
5667 <td style="color:red;">Foo
5668 </td>
5669 <td style="color:red;">Foo
5670 </td>
5671 <td align="center" style="color:red;">Foo
5672 </td>
5673 <td align="center" style="color:red;">Foo
5674 </td></tr></table>
5675
5676 !! end
5677
5678 !! test
5679 2. Template-generated table cell attributes and cell content
5680 !! wikitext
5681 {|
5682 |{{table_attribs_2}}
5683 |}
5684 !! html/php
5685 <table>
5686 <tr>
5687 <td style="color:red;">Foo
5688 </td>
5689 <td>Bar</td>
5690 <td>Baz
5691 </td></tr></table>
5692
5693 !! html/parsoid
5694 <table>
5695 <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>
5696 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
5697 </tbody></table>
5698 !! end
5699
5700 !! test
5701 3. Template-generated table cell attributes and cell content
5702 !! wikitext
5703 {|
5704 !align=center {{table_header_cells}}
5705 |-
5706 |align=center {{table_cells}}
5707 |}
5708 !! html/php
5709 <table>
5710 <tr>
5711 <th align="center" style="color:red;">Foo</th>
5712 <th style="color:red;"><i>Bar</i></th>
5713 <th style="color:brown;"><i>Foo</i> and Baz
5714 </th></tr>
5715 <tr>
5716 <td align="center" style="color:red;">Foo</td>
5717 <td style="color:red;"><i>Bar</i></td>
5718 <td style="color:brown;"><i>Foo</i> and Baz
5719 </td></tr></table>
5720
5721 !! html/parsoid
5722 <table>
5723 <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>
5724 <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>
5725 </tbody></table>
5726 !! end
5727
5728 !! test
5729 Table with row followed by newlines and table heading
5730 !! wikitext
5731 {|
5732 |-
5733
5734 ! foo
5735 |}
5736 !! html
5737 <table>
5738
5739
5740 <tr>
5741 <th> foo
5742 </th></tr></table>
5743
5744 !! end
5745
5746 !! test
5747 Table with empty line following the start tag
5748 !! wikitext
5749 {|
5750
5751 |-
5752 | foo
5753 |}
5754 !! html
5755 <table>
5756
5757
5758 <tr>
5759 <td> foo
5760 </td></tr></table>
5761
5762 !! end
5763
5764 # FIXME: Preserve the attribute properly (with an empty string as value) in
5765 # the PHP parser. Parsoid implements the behavior below.
5766 !! test
5767 Table attributes with empty value
5768 !! wikitext
5769 {|
5770 | style=| hello
5771 |}
5772 !! html/parsoid
5773 <table>
5774 <tbody>
5775 <tr>
5776 <td style=""> hello
5777 </td></tr></tbody></table>
5778
5779 !! end
5780
5781 !! test
5782 Wikitext table with a lot of comments
5783 !! wikitext
5784 {|
5785 <!-- c0 -->
5786 | foo
5787 <!-- c1 -->
5788 |- <!-- c2 -->
5789 <!-- c3 -->
5790 |<!-- c4 -->
5791 <!-- c5 -->
5792 |}
5793 !! html
5794 <table>
5795 <tr>
5796 <td> foo
5797 </td></tr>
5798 <tr>
5799 <td>
5800 </td></tr></table>
5801
5802 !! end
5803
5804 !! test
5805 Wikitext table with double-line table cell
5806 !! wikitext
5807 {|
5808 |a
5809 b
5810 |}
5811 !! html
5812 <table>
5813 <tr>
5814 <td>a
5815 <p>b
5816 </p>
5817 </td></tr></table>
5818
5819 !! end
5820
5821 !! test
5822 Table cell with a single comment
5823 !! wikitext
5824 {|
5825 | <!-- c1 -->
5826 | a
5827 |}
5828 !! html
5829 <table>
5830 <tr>
5831 <td>
5832 </td>
5833 <td> a
5834 </td></tr></table>
5835
5836 !! end
5837
5838 !! test
5839 Table-cell after a comment-only-empty-line
5840 !! wikitext
5841 {|
5842 |a
5843 <!--c1-->
5844 <!--c2-->| b
5845 |}
5846 !! html
5847 <table>
5848 <tr>
5849 <td>a
5850 </td>
5851 <td> b
5852 </td></tr></table>
5853
5854 !! html/parsoid
5855 <table>
5856 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5857 <!--c1-->
5858 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5859 </tbody></table>
5860
5861 !! end
5862
5863 !! test
5864 Build table with {{!}}
5865 !! wikitext
5866 {{{!}} class="wikitable"
5867 ! header
5868 ! second header
5869 {{!}}- style="color:red;"
5870 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5871 {{!}}}
5872 !! html
5873 <table class="wikitable">
5874 <tr>
5875 <th> header
5876 </th>
5877 <th> second header
5878 </th></tr>
5879 <tr style="color:red;">
5880 <td> data </td>
5881 <td style="color:red;"> second data
5882 </td></tr></table>
5883
5884 !! end
5885
5886 !! test
5887 Build table with pipe as data
5888 !! wikitext
5889 {| class="wikitable"
5890 ! header
5891 ! second header
5892 |- style="color:red;"
5893 | data || style="color:red;" | second data
5894 |-
5895 | style="color:red;" | data with | || style="color:red;" | second data with |
5896 |-
5897 || data with | ||| second data with |
5898 |}
5899 !! html
5900 <table class="wikitable">
5901 <tr>
5902 <th> header
5903 </th>
5904 <th> second header
5905 </th></tr>
5906 <tr style="color:red;">
5907 <td> data </td>
5908 <td style="color:red;"> second data
5909 </td></tr>
5910 <tr>
5911 <td style="color:red;"> data with | </td>
5912 <td style="color:red;"> second data with |
5913 </td></tr>
5914 <tr>
5915 <td> data with | </td>
5916 <td> second data with |
5917 </td></tr></table>
5918
5919 !! end
5920
5921 !! test
5922 Build table with wikilink
5923 !! wikitext
5924 {| class="wikitable"
5925 ! header || second header
5926 |- style="color:red;"
5927 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5928 |-
5929 | data || second data [[Main Page|link|text with pipe]]
5930 |}
5931 !! html
5932 <table class="wikitable">
5933 <tr>
5934 <th> header </th>
5935 <th> second header
5936 </th></tr>
5937 <tr style="color:red;">
5938 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5939 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5940 </td></tr>
5941 <tr>
5942 <td> data </td>
5943 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5944 </td></tr></table>
5945
5946 !! end
5947
5948 # The expected HTML structure in this test is debatable. The PHP parser does
5949 # not parse this kind of table at all. The main focus for Parsoid is on
5950 # round-tripping, so this output is ok for now. TODO: revisit!
5951 !! test
5952 Wikitext table with html-syntax row
5953 !! wikitext
5954 {|
5955 |-
5956 <td>foo</td>
5957 |}
5958 !! html/parsoid
5959 <table>
5960 <tbody>
5961 <tr>
5962 <td>foo</td></tr></tbody></table>
5963 !! end
5964
5965 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5966 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5967 ## PHP parser, which tidy then compounds by fostering the content
5968 ## entirely out of the table. Parsoid recognizes the table context
5969 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5970 ## depends on PHP's treatment of broken table markup!
5971 !! test
5972 Implicit <td> after a |-
5973 !! options
5974 parsoid=wt2html,html2html
5975 !! wikitext
5976 {|
5977 |-
5978 a
5979 |}
5980 !! html/php
5981 <table>
5982
5983 a
5984 </table>
5985
5986 !! html/php+tidy
5987 <p>a</p>
5988 !! html/parsoid
5989 <table>
5990 <tr><td>a</td></tr>
5991 </table>
5992 !! end
5993
5994 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5995 !! test
5996 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5997 !! options
5998 parsoid=wt2html,html2html
5999 !! wikitext
6000 {|
6001 |-
6002 |
6003 a
6004 |-
6005 b
6006 |}
6007 !! html/php
6008 <table>
6009
6010 <tr>
6011 <td>
6012 <pre>a
6013 </pre>
6014 </td></tr>
6015 b
6016 </table>
6017
6018 !! html/php+tidy
6019 <p>b</p>
6020 <table>
6021 <tr>
6022 <td>
6023 <pre>
6024 a
6025 </pre></td>
6026 </tr>
6027 </table>
6028 !! html/parsoid
6029 <table>
6030 <tbody>
6031 <tr><td><pre>a</pre></td></tr>
6032 <tr><td> b</td></tr>
6033 </tbody>
6034 </table>
6035 !! end
6036
6037 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6038 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6039 !! test
6040 Lists should be recognized in an implicit <td> context
6041 !! options
6042 parsoid=wt2html,html2html
6043 !! wikitext
6044 {|
6045 |-
6046 *a
6047 |}
6048 !! html/php
6049 <table>
6050
6051 <ul><li>a</li></ul>
6052 </table>
6053
6054 !! html/php+tidy
6055 <ul>
6056 <li>a</li>
6057 </ul>
6058 !! html/parsoid
6059 <table>
6060 <tr>
6061 <td><ul>
6062 <li>a</li>
6063 </ul></td>
6064 </tr>
6065 </table>
6066 !! end
6067
6068 !! test
6069 Parsoid: Round-trip tables directly followed by content (bug 51219)
6070 !! options
6071 parsoid=wt2html,wt2wt
6072 !! wikitext
6073 {|
6074 |foo
6075 |} bar
6076
6077 {|
6078 |baz
6079 |}<b>quux</b>
6080 !! html+tidy
6081 <table>
6082 <tr>
6083 <td>foo</td>
6084 </tr>
6085 </table>
6086 <p>bar</p>
6087 <table>
6088 <tr>
6089 <td>baz</td>
6090 </tr>
6091 </table>
6092 <p><b>quux</b></p>
6093 !! end
6094
6095 !! test
6096 Parsoid: Default to a newline after tables in new content (bug 51219)
6097 !! options
6098 parsoid=html2wt
6099 !! html
6100 <table><tbody>
6101 <tr><td>foo</td></tr></tbody></table> bar
6102 <table><tbody>
6103 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6104 !! wikitext
6105 {|
6106 |foo
6107 |}
6108 <nowiki> </nowiki>bar
6109 {|
6110 |baz
6111 |}
6112 '''quux'''
6113 !! end
6114
6115 !! test
6116 Parsoid: newline inducing block nodes don't suppress <nowiki>
6117 !! options
6118 parsoid=html2wt
6119 !! html
6120 a<h1>foo</h1>
6121 !! wikitext
6122 <nowiki> </nowiki>a
6123
6124 = foo =
6125 !! end
6126
6127 !! test
6128 Parsoid: Row-syntax table headings followed by comment & table cells
6129 !! options
6130 parsoid=wt2html,wt2wt
6131 !! wikitext
6132 {|
6133 ! foo || bar
6134 <!-- foo --> || baz || quux
6135 |}
6136 !! html/php
6137 <table>
6138 <tr>
6139 <th> foo </th>
6140 <th> bar
6141 </th>
6142 <td> baz </td>
6143 <td> quux
6144 </td></tr></table>
6145
6146 !! html/parsoid
6147 <table>
6148 <tbody><tr><th> foo </th><th> bar
6149 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6150 </tbody></table>
6151 !! end
6152
6153
6154 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6155 # preserves it.
6156 !!test
6157 Parsoid: Recover better from broken table attributes
6158 !!options
6159 parsoid=wt2html
6160 !!wikitext
6161 {| class="foo
6162 | class="bar" |
6163 foo
6164 |}
6165 !!html/php+tidy
6166 <table>
6167 <tr>
6168 <td class="bar">
6169 <p>foo</p>
6170 </td>
6171 </tr>
6172 </table>
6173 !!html/parsoid
6174 <table class="foo">
6175 <tr>
6176 <td class="bar">
6177 <p>foo</p></td></tr>
6178 </tbody></table>
6179 !!end
6180
6181 !! test
6182 Strip unsupported table tags
6183 !! options
6184 parsoid=html2wt
6185 !! html
6186 <table>
6187 <thead>
6188 <tr>
6189 <th>Month</th>
6190 <th>Savings</th>
6191 </tr>
6192 </thead>
6193 <tbody>
6194 <tr>
6195 <td>January</td>
6196 <td>$100</td>
6197 </tr>
6198 <tr>
6199 <td>February</td>
6200 <td>$80</td>
6201 </tr>
6202 </tbody>
6203 <tfoot>
6204 <tr>
6205 <td>Sum</td>
6206 <td>$180</td>
6207 </tr>
6208 </tfoot>
6209 </table>
6210 !! wikitext
6211 {|
6212
6213 !Month
6214 !Savings
6215
6216 |January
6217 |$100
6218
6219 |-
6220 |February
6221 |$80
6222
6223 |Sum
6224 |$180
6225
6226 |}
6227 !! end
6228
6229 ###
6230 ### Internal links
6231 ###
6232 !! test
6233 Plain link, capitalized
6234 !! wikitext
6235 [[Main Page]]
6236 !! html
6237 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6238 </p>
6239 !! end
6240
6241 !! test
6242 Plain link, uncapitalized
6243 !! wikitext
6244 [[main Page]]
6245 !! html
6246 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6247 </p>
6248 !! end
6249
6250 !! test
6251 Piped link
6252 !! wikitext
6253 [[Main Page|The Main Page]]
6254 !! html
6255 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6256 </p>
6257 !! end
6258
6259 !! test
6260 Piped link with comment in link text
6261 !! wikitext
6262 [[Main Page|The Main<!--front--> Page]]
6263 !! html
6264 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6265 </p>
6266 !! end
6267
6268 !! test
6269 Piped link with multiple pipe characters in link text
6270 !! wikitext
6271 [[Main Page||The|Main|Page|]]
6272 !! html/php
6273 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6274 </p>
6275 !! html/parsoid
6276 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6277 !! end
6278
6279 !! test
6280 Broken link
6281 !! wikitext
6282 [[Zigzagzogzagzig]]
6283 !! html
6284 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6285 </p>
6286 !! end
6287
6288 !! test
6289 Broken link with fragment
6290 !! wikitext
6291 [[Zigzagzogzagzig#zug]]
6292 !! html
6293 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6294 </p>
6295 !! end
6296
6297 !! test
6298 Special page link with fragment
6299 !! wikitext
6300 [[Special:Version#anchor]]
6301 !! html
6302 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6303 </p>
6304 !! end
6305
6306 !! test
6307 Nonexistent special page link with fragment
6308 !! wikitext
6309 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6310 !! html
6311 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6312 </p>
6313 !! end
6314
6315 !! test
6316 Link with prefix
6317 !! wikitext
6318 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6319 !! html
6320 <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>
6321 </p>
6322 !! end
6323
6324 !! test
6325 Link with suffix
6326 !! wikitext
6327 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6328 !! html
6329 <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>!!!
6330 </p>
6331 !! end
6332
6333 !! article
6334 prefixed article
6335 !! text
6336 Some text
6337 !! endarticle
6338
6339 !! test
6340 Bug 43661: Piped links with identical prefixes
6341 !! wikitext
6342 [[prefixed article|prefixed articles with spaces]]
6343
6344 [[prefixed article|prefixed articlesaoeu]]
6345
6346 [[Main Page|Main Page test]]
6347 !! html
6348 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6349 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6350 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6351 </p>
6352 !! end
6353
6354
6355 !! test
6356 Link with HTML entity in suffix / tail
6357 !! wikitext
6358 [[Main Page]]&quot;, [[Main Page]]&#97;
6359 !! html/php
6360 <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;
6361 </p>
6362 !! html/parsoid
6363 <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>
6364 !! end
6365
6366 !! test
6367 Link with 3 brackets
6368 !! wikitext
6369 [[[Main Page]]]
6370 !! html
6371 <p>[[[Main Page]]]
6372 </p>
6373 !! end
6374
6375 !! test
6376 Link with 4 brackets
6377 !! wikitext
6378 [[[[Main Page]]]]
6379 !! html
6380 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6381 </p>
6382 !! end
6383
6384 !! test
6385 Piped link with 3 brackets
6386 !! wikitext
6387 [[[main page|the main page]]]
6388 !! html
6389 <p>[[[main page|the main page]]]
6390 </p>
6391 !! end
6392
6393 !! test
6394 Piped link with extlink-like text
6395 !! wikitext
6396 [[Main Page|[bar]]]
6397 [[Main Page|This is a [bar]]]
6398 !! html/php
6399 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6400 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6401 </p>
6402 !! html/parsoid
6403 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6404 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6405 !! end
6406
6407 !! test
6408 Link with multiple pipes
6409 !! wikitext
6410 [[Main Page|The|Main|Page]]
6411 !! html
6412 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6413 </p>
6414 !! end
6415
6416 # Note that parsoid does not munge anchor text; all non-space
6417 # characters are valid in HTML5 ids.
6418 !! test
6419 Anchor containing a #. (bug 63430)
6420 !! wikitext
6421 [[Main Page#And#Link]]
6422 !! html/php
6423 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6424 </p>
6425 !! html/parsoid
6426 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6427 !! end
6428
6429 !! test
6430 Link to namespaces
6431 !! wikitext
6432 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6433 !! html
6434 <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>
6435 </p>
6436 !! end
6437
6438 !! test
6439 Link with space in namespace
6440 !! wikitext
6441 [[User talk:Foo bar]]
6442 !! html
6443 <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>
6444 </p>
6445 !! end
6446
6447 !! article
6448 MemoryAlpha:AlphaTest
6449 !! text
6450 This is an article in the MemoryAlpha namespace
6451 (which shadows the memoryalpha interwiki link).
6452 !! endarticle
6453
6454 !! test
6455 Namespace takes precedence over interwiki link (bug 51680)
6456 !! wikitext
6457 [[MemoryAlpha:AlphaTest]]
6458 !! html
6459 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6460 </p>
6461 !! end
6462
6463 # The previous test doesn't work correctly in html2*, due to not recognizing the
6464 # link as an internal one. This one checks for the correct behavior.
6465 !! test
6466 Link to namespace preferred over interwiki with correct rel attribute
6467 !! options
6468 parsoid=html2wt,html2html
6469 !! html
6470 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6471 !! wikitext
6472 [[MemoryAlpha:AlphaTest]]
6473 !! end
6474
6475 !! test
6476 Piped link to namespace
6477 !! wikitext
6478 [[Meta:Disclaimers|The disclaimers]]
6479 !! html
6480 <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>
6481 </p>
6482 !! end
6483
6484 !! test
6485 Link containing }
6486 !! wikitext
6487 [[Usually caused by a typo (oops}]]
6488 !! html
6489 <p>[[Usually caused by a typo (oops}]]
6490 </p>
6491 !! end
6492
6493 !! article
6494 7% Solution
6495 !! text
6496 Just a test of an article title containing a percent.
6497 !! endarticle
6498
6499 !! test
6500 Link containing % (not as a hex sequence)
6501 !! wikitext
6502 [[7% Solution]]
6503 !! html/php
6504 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6505 </p>
6506 !! html/parsoid
6507 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6508 !! end
6509
6510 # note that the parsoid HTML is identical to the previous test output,
6511 # so the previous test ensures that the html2wt mode will generate the
6512 # "not as a hex sequence" wikitext.
6513 !! test
6514 Link containing % as a single hex sequence interpreted to char
6515 !! options
6516 parsoid=wt2wt,wt2html,html2html
6517 !! wikitext
6518 [[7%25 Solution]]
6519 !! html/php
6520 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6521 </p>
6522 !! html/parsoid
6523 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6524 !!end
6525
6526 !! test
6527 Link containing % as a double hex sequence interpreted to hex sequence
6528 !! wikitext
6529 [[7%2525 Solution]]
6530 !! html
6531 <p>[[7%2525 Solution]]
6532 </p>
6533 !!end
6534
6535 # note that parsoid does not munge anchor text; all non-space
6536 # characters are valid in HTML5 anchors.
6537 !! test
6538 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6539 Example for such a section: == < ==
6540 !! wikitext
6541 [[%23%3c]][[%23%3e]]
6542 !! html/php
6543 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6544 </p>
6545 !! html/parsoid
6546 <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>
6547 !! end
6548
6549 !! test
6550 Link containing "<#" and ">#" as a hex sequences
6551 !! wikitext
6552 [[%3c%23]][[%3e%23]]
6553 !! html
6554 <p>[[%3c%23]][[%3e%23]]
6555 </p>
6556 !! end
6557
6558 !! test
6559 Link containing an equals sign
6560 !! wikitext
6561 [[Special:BookSources/isbn=4-00-026157-6]]
6562 !! html/php
6563 <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>
6564 </p>
6565 !! html/parsoid
6566 <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>
6567 !! end
6568
6569 !! article
6570 Foo~bar
6571 !! text
6572 Just a test of an article title containing a tilde.
6573 !! endarticle
6574
6575 # note that links containing signatures, like [[Foo~~~~]], are
6576 # massaged by the pre-save transform (PST) and so the tildes are never
6577 # seen by the parser.
6578 !! test
6579 Link containing a tilde
6580 !! wikitext
6581 [[Foo~bar]]
6582 !! html/php
6583 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6584 </p>
6585 !! html/parsoid
6586 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6587 !! end
6588
6589 !! test
6590 Link containing double-single-quotes '' (bug 4598)
6591 !! wikitext
6592 [[Lista d''e paise d''o munno]]
6593 !! html/php
6594 <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>
6595 </p>
6596 !! html/parsoid
6597 <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>
6598 !! end
6599
6600 !! test
6601 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6602 !! wikitext
6603 Some [[Link|pretty ''italics'' and stuff]]!
6604 !! html/php
6605 <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>!
6606 </p>
6607 !! html/parsoid
6608 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6609 !! end
6610
6611 !! test
6612 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6613 !! wikitext
6614 ''Some [[Link|pretty ''italics'' and stuff]]!''
6615 !! html
6616 <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>
6617 </p>
6618 !! end
6619
6620 !! test
6621 Link with double quotes in title part (literal) and alternate part (interpreted)
6622 !! wikitext
6623 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6624
6625 [[''Pentecoste'']]
6626
6627 [[''Pentecoste''|Pentecoste]]
6628
6629 [[''Pentecoste''|''Pentecoste'']]
6630 !! html/php
6631 <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>
6632 </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>
6633 </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>
6634 </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>
6635 </p>
6636 !! html/parsoid
6637 <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>
6638 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6639 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6640 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6641 !! end
6642
6643 !! test
6644 Broken image links with HTML captions (bug 39700)
6645 !! wikitext
6646 [[File:Nonexistent|<script></script>]]
6647 [[File:Nonexistent|100x100px|<script></script>]]
6648 [[File:Nonexistent|&lt;]]
6649 [[File:Nonexistent|a<i>b</i>c]]
6650 !! html/php
6651 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6652 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6653 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6654 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6655 </p>
6656 !! html/parsoid
6657 <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>
6658 <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>
6659 <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>
6660 <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>
6661 !! end
6662
6663 !! test
6664 Plain link to URL
6665 !! wikitext
6666 [[http://www.example.com]]
6667 !! html/php
6668 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6669 </p>
6670 !! html/parsoid
6671 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6672 !! end
6673
6674 !! test
6675 Plain link to URL with link text
6676 !! wikitext
6677 [[http://www.example.com Link text]]
6678 !! html
6679 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6680 </p>
6681 !! end
6682
6683 !! test
6684 Plain link to protocol-relative URL
6685 !! wikitext
6686 [[//www.example.com]]
6687 !! html/php
6688 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6689 </p>
6690 !! html/parsoid
6691 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6692 !! end
6693
6694 !! test
6695 Plain link to protocol-relative URL with link text
6696 !! wikitext
6697 [[//www.example.com Link text]]
6698 !! html
6699 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6700 </p>
6701 !! end
6702
6703 !! test
6704 Plain link to page with question mark in title
6705 !! wikitext
6706 [[A?b]]
6707
6708 [[A?b|Baz]]
6709 !! html
6710 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6711 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6712 </p>
6713 !! end
6714
6715
6716 # I'm fairly sure the expected result here is wrong.
6717 # We want these to be URL links, not pseudo-pages with URLs for titles....
6718 # However the current output is also pretty screwy.
6719 #
6720 # ----
6721 # I'm changing it to match the current output--it arguably makes more
6722 # sense in the light of the test above. Old expected result was:
6723 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6724 #</p>
6725 # But I think this test is bordering on "garbage in, garbage out" anyway.
6726 # -- wtm
6727 !! test
6728 Piped link to URL
6729 !! wikitext
6730 Piped link to URL: [[http://www.example.com|an example URL]]
6731 !! html/php
6732 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6733 </p>
6734 !! html/parsoid
6735 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6736 !! end
6737
6738 !! test
6739 BUG 2: [[page|http://url/]] should link to page, not http://url/
6740 !! wikitext
6741 [[Main Page|http://url/]]
6742 !! html/php
6743 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6744 </p>
6745 !! html/parsoid
6746 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6747 !! end
6748
6749 # Parsoid does not mark self-links, by design.
6750 !! test
6751 BUG 337: Escaped self-links should be bold
6752 !! options
6753 title=[[Bug462]]
6754 !! wikitext
6755 [[Bu&#103;462]] [[Bug462]]
6756 !! html/php
6757 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6758 </p>
6759 !! html/php+tidy
6760 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6761 !! html/parsoid
6762 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6763 !! end
6764
6765 !! test
6766 Self-link to section should not be bold
6767 !! options
6768 title=[[Main Page]]
6769 !! wikitext
6770 [[Main Page#section]]
6771 !! html
6772 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6773 </p>
6774 !! end
6775
6776 !! article
6777 00
6778 !! text
6779 This is 00.
6780 !! endarticle
6781
6782 !!test
6783 Self-link to numeric title
6784 !!options
6785 title=[[0]]
6786 !! wikitext
6787 [[0]]
6788 !! html
6789 <p><strong class="selflink">0</strong>
6790 </p>
6791 !!end
6792
6793 !!test
6794 Link to numeric-equivalent title
6795 !!options
6796 title=[[0]]
6797 !! wikitext
6798 [[00]]
6799 !! html
6800 <p><a href="/wiki/00" title="00">00</a>
6801 </p>
6802 !!end
6803
6804 !! test
6805 <nowiki> inside a link
6806 !! wikitext
6807 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6808 !! html
6809 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6810 </p>
6811 !! end
6812
6813 !! test
6814 Non-breaking spaces in title
6815 !! wikitext
6816 [[&nbsp; Main &nbsp; Page &nbsp;]]
6817 !! html
6818 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6819 </p>
6820 !!end
6821
6822 !! test
6823 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6824 !! options
6825 language=ca
6826 !! wikitext
6827 '''[[Main Page]]'''
6828 !! html
6829 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6830 </p>
6831 !! end
6832
6833 !! test
6834 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6835 !! options
6836 language=ca
6837 !! wikitext
6838 ''[[Main Page]]''
6839 !! html
6840 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6841 </p>
6842 !! end
6843
6844 !! test
6845 Internal link with en linktrail: no apostrophes (bug 27473)
6846 !! options
6847 language=en
6848 !! wikitext
6849 [[Something]]'nice
6850 !! html
6851 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6852 </p>
6853 !! end
6854
6855 !! test
6856 Internal link with ca linktrail with apostrophes (bug 27473)
6857 !! options
6858 language=ca
6859 !! wikitext
6860 [[Something]]'nice
6861 !! html
6862 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6863 </p>
6864 !! end
6865
6866 !! test
6867 Internal link with kaa linktrail with apostrophes (bug 27473)
6868 !! options
6869 language=kaa
6870 !! wikitext
6871 [[Something]]'nice
6872 !! html
6873 <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>
6874 </p>
6875 !! end
6876
6877 !! test
6878 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6879 !! wikitext
6880 [[User:Foo/Test/63636:Bar|Test]]
6881 !! html/php
6882 <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>
6883 </p>
6884 !! html/parsoid
6885 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6886 !! end
6887
6888 !! test
6889 Purely hash wikilink
6890 !! options
6891 title=[[User:test/123]]
6892 !! wikitext
6893 [[#a|b]]
6894 !! html/php
6895 <p><a href="#a">b</a>
6896 </p>
6897 !! html/parsoid
6898 <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>
6899 !! end
6900
6901 !! test
6902 1. Interaction of linktrail and template encapsulation
6903 !! options
6904 parsoid
6905 !! wikitext
6906 {{echo|[[Foo]]}}l
6907 !! html
6908 <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>
6909 !! end
6910
6911 !! test
6912 2. Interaction of linktrail and template encapsulation
6913 !! options
6914 parsoid
6915 !! wikitext
6916 {{echo|Some [[Fool]]}}s
6917 !! html
6918 <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>
6919 !! end
6920
6921 !! test
6922 3. Interaction of linktrail and template encapsulation
6923 !! options
6924 parsoid
6925 !! wikitext
6926 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6927 !! html
6928 <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>
6929 !! end
6930
6931 !! article
6932 Söfnuður
6933 !! text
6934 Test.
6935 !! endarticle
6936
6937 !! test
6938 Internal link with is link prefix
6939 !! options
6940 language=is
6941 !! wikitext
6942 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6943 !! html
6944 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6945 </p>
6946 !! end
6947
6948 !! article
6949 Mótmælendatrú
6950 !! text
6951 Test.
6952 !! endarticle
6953
6954 !! test
6955 Internal link with is link trail and link prefix
6956 !! options
6957 language=is
6958 !! wikitext
6959 [[mótmælendatrú|xxx]]ar
6960 [[mótmælendatrú]]ar
6961 mótmælenda[[söfnuður]]
6962 mótmælenda[[söfnuður|söfnuðir]]
6963 mótmælenda[[söfnuður|söfnuðir]]xxx
6964 !! html
6965 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6966 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6967 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6968 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6969 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6970 </p>
6971 !! end
6972
6973 !! test
6974 Parsoid link trail escaping
6975 !! options
6976 parsoid=html2wt,html2html
6977 !! html
6978 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6979 !! wikitext
6980 [[apple]]<nowiki/>s
6981 !! end
6982
6983 !! test
6984 Parsoid link prefix escaping
6985 !! options
6986 language=is
6987 parsoid=html2wt,html2html
6988 !! html
6989 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6990 !! wikitext
6991 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6992 !! end
6993
6994 !! test
6995 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6996 !! wikitext
6997 [[Foo| bar]]
6998
6999 [[Foo| ''bar'']]
7000
7001 [http://wp.org foo]
7002
7003 [http://wp.org ''foo'']
7004 !! html
7005 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7006 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7007 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7008 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7009 </p>
7010 !! end
7011
7012 !! test
7013 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7014 !! options
7015 parsoid
7016 !! wikitext
7017 [[Foo|{{echo|a}} b {{echo|c}}]]
7018 !! html
7019 <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>
7020 !! end
7021
7022 !! test
7023 Link with angle bracket after anchor
7024 !! wikitext
7025 [[Foo#<bar>]]
7026 !! html/php
7027 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7028 </p>
7029 !! html/parsoid
7030 <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>
7031 !! end
7032
7033 ###
7034 ### Interwiki links (see maintenance/interwiki.sql)
7035 ###
7036
7037 !! test
7038 Inline interwiki link
7039 !! options
7040 parsoid=wt2html,wt2wt,html2html
7041 !! wikitext
7042 [[MeatBall:SoftSecurity]]
7043 !! html/php
7044 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7045 </p>
7046 !! html/parsoid
7047 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7048 !! end
7049
7050 !! test
7051 Inline interwiki link with empty title (bug 2372)
7052 !! options
7053 parsoid=wt2html,wt2wt,html2html
7054 !! wikitext
7055 [[MeatBall:]]
7056 !! html/php
7057 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7058 </p>
7059 !! html/parsoid
7060 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7061 !! end
7062
7063 !! test
7064 Interwiki link encoding conversion (bug 1636)
7065 !! wikitext
7066 *[[Wikipedia:ro:Olteni&#0355;a]]
7067 *[[Wikipedia:ro:Olteni&#355;a]]
7068 !! html
7069 <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>
7070 <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>
7071
7072 !! html+tidy
7073 <ul>
7074 <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>
7075 <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>
7076 </ul>
7077 !! end
7078
7079 !! test
7080 Interwiki link with fragment (bug 2130)
7081 !! wikitext
7082 [[MeatBall:SoftSecurity#foo]]
7083 !! html
7084 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7085 </p>
7086 !! end
7087
7088 # Ideally the wikipedia: prefix here should be proto-relative too
7089 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7090 # define the 'en' prefix, and originally the test used 'wikipedia',
7091 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7092 # article.
7093 !! test
7094 Different interwiki prefixes mapping to the same URL
7095 !! wikitext
7096 [[:en:Foo]]
7097
7098 [[:en:Foo|Foo]]
7099
7100 [[wikipedia:Foo]]
7101
7102 [[:wikipedia:Foo|Foo]]
7103
7104 [[wikipedia:en:Foo]]
7105
7106 [[:wikipedia:en:Foo]]
7107
7108 [[ wikiPEdia :Foo]]
7109 !! html/parsoid
7110 <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>
7111
7112 <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>
7113
7114 <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>
7115
7116 <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>
7117
7118 <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>
7119
7120 <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>
7121
7122 <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>
7123 !! end
7124
7125 !! test
7126 Interwiki links that cannot be represented in wiki syntax
7127 !! wikitext
7128 [[meatball:ok]]
7129 [[meatball:ok#foo|ok with fragment]]
7130 [[meatball:ok_as_well?|ok ending with ? mark]]
7131 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7132 [http://de.wikipedia.org/wiki/#foo is just fragment]
7133
7134 !! html/php
7135 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7136 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7137 <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>
7138 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7139 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7140 </p>
7141 !! html/parsoid
7142 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7143 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7144 <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>
7145 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7146 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7147 !! end
7148
7149 !! test
7150 Interwiki links: trail
7151 !! wikitext
7152 [[wikipedia:Foo|Ba]]r
7153 !! html/php
7154 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7155 </p>
7156 !! html/parsoid
7157 <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>
7158 !! end
7159
7160 !! test
7161 Local interwiki link
7162 !! options
7163 parsoid=wt2html,wt2wt,html2html
7164 !! wikitext
7165 [[local:Template:Foo]]
7166 !! html/php
7167 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7168 </p>
7169 !! html/parsoid
7170 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7171 !! end
7172
7173 # Parsoid does not mark self-links, by design.
7174 !! test
7175 Local interwiki link: self-link to current page
7176 !! options
7177 title=[[Main Page]]
7178 parsoid=wt2html,wt2wt,html2html
7179 !! wikitext
7180 [[local:Main Page]]
7181 !! html/php
7182 <p><strong class="selflink">local:Main Page</strong>
7183 </p>
7184 !! html/parsoid
7185 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7186 !! end
7187
7188 !! test
7189 Local interwiki link: prefix only (bug 64167)
7190 !! options
7191 parsoid=wt2html,wt2wt,html2html
7192 !! wikitext
7193 [[local:]]
7194 !! html/php
7195 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7196 </p>
7197 !! html/parsoid
7198 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7199 !! end
7200
7201 !! test
7202 Local interwiki link: with additional interwiki prefix (bug 61357)
7203 !! options
7204 parsoid=wt2html,wt2wt,html2html
7205 !! wikitext
7206 [[local:meatball:Hello]]
7207 !! html/php
7208 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7209 </p>
7210 !! html/parsoid
7211 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7212 !! end
7213
7214 !! test
7215 Multiple local interwiki link prefixes
7216 !! wikitext
7217 [[local:local:local:local:mi:local:Foo]]
7218 !! options
7219 parsoid=wt2html,wt2wt,html2html
7220 !! html/php
7221 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7222 </p>
7223 !! html/parsoid
7224 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7225 !! end
7226
7227 ###
7228 ### Interlanguage links
7229 ### Language links (so that searching for '### language' matches..)
7230 ###
7231
7232 !! test
7233 Interlanguage link
7234 !! options
7235 parsoid=wt2html,wt2wt,html2html
7236 !! wikitext
7237 Blah blah blah
7238 [[zh:Chinese]]
7239 !! html/php
7240 <p>Blah blah blah
7241 </p>
7242 !! html/parsoid
7243 <p>Blah blah blah</p>
7244 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7245 !! end
7246
7247 !! test
7248 Interlanguage link with spacing
7249 !! options
7250 parsoid=wt2html,wt2wt,html2html
7251 !! wikitext
7252 Blah blah blah
7253 [[ zh : Chinese ]]
7254 !! html/php
7255 <p>Blah blah blah
7256 </p>
7257 !! html/parsoid
7258 <p>Blah blah blah</p>
7259 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7260 !! end
7261
7262 !! test
7263 Double interlanguage link
7264 !! options
7265 parsoid=wt2html,wt2wt,html2html
7266 !! wikitext
7267 Blah blah blah
7268 [[es:Spanish]]
7269 [[zh:Chinese]]
7270 !! html/php
7271 <p>Blah blah blah
7272 </p>
7273 !! html/parsoid
7274 <p>Blah blah blah</p>
7275 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7276 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7277 !! end
7278
7279 !! test
7280 Interlanguage link variations
7281 !! options
7282 parsoid=wt2html,wt2wt,html2html
7283 !! wikitext
7284 Blah blah blah
7285 [[ es :Spanish]]
7286 [[ ZH :Chinese]]
7287 [[es:Foo_bar]]
7288 [[es:Foo bar]]
7289 !! html/php
7290 <p>Blah blah blah
7291 </p>
7292 !! html/parsoid
7293 <p>Blah blah blah</p>
7294 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7295 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7296 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7297 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7298 !! end
7299
7300 !! test
7301 Interlanguage link, with prefix links
7302 !! options
7303 language=ln
7304 !! wikitext
7305 Blah blah blah
7306 [[zh:Chinese]]
7307 !! html/php
7308 <p>Blah blah blah
7309 </p>
7310 !! html/parsoid
7311 <p>Blah blah blah</p>
7312 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7313 !! end
7314
7315 !! test
7316 Double interlanguage link, with prefix links (bug 8897)
7317 !! options
7318 language=ln
7319 !! wikitext
7320 Blah blah blah
7321 [[es:Spanish]]
7322 [[zh:Chinese]]
7323 !! html/php
7324 <p>Blah blah blah
7325 </p>
7326 !! html/parsoid
7327 <p>Blah blah blah</p>
7328 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7329 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7330 !! end
7331
7332 !! test
7333 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7334 !! wikitext
7335 Blah blah blah
7336 [[mul:Article]]
7337 !! html/php
7338 <p>Blah blah blah
7339 </p>
7340 !! html/parsoid
7341 <p>Blah blah blah</p>
7342 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7343 !! end
7344
7345 !! test
7346 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7347 !! options
7348 language=ln
7349 !! wikitext
7350 [[WW&nbsp;II]]
7351 !! html
7352 <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>
7353 </p>
7354 !! end
7355
7356 !! test
7357 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7358 !! options
7359 parsoid=html2wt
7360 !! html
7361 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7362 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7363 !! wikitext
7364 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7365
7366 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7367 !! end
7368
7369 !! test
7370 Parsoid: handle constructor well
7371 !! wikitext
7372 [[constructor]]
7373
7374 [[constructor:foo]]
7375 !! html/php
7376 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7377 </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>
7378 </p>
7379 !! html/parsoid
7380 <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>
7381
7382 <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>
7383 !! end
7384
7385 !! article
7386 ko:
7387 !! text
7388 Test.
7389 !! endarticle
7390
7391 # Note that `ko` isn't a known interlanguage prefix
7392 !! test
7393 Parsoid: recognize interlanguage links without a target page
7394 !! options
7395 ill
7396 !! wikitext
7397 [[es:]]
7398
7399 [[ko:]]
7400 !! html/php
7401 es:
7402 !! html/parsoid
7403 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7404
7405 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7406 !! end
7407
7408 # Note that `ko` isn't a known interwiki prefix
7409 !! test
7410 Parsoid: recognize interwiki links without a target page
7411 !! options
7412 parsoid=wt2html,wt2wt,html2html
7413 !! wikitext
7414 [[:es:]]
7415
7416 [[:ko:]]
7417 !! html/php
7418 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7419 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7420 </p>
7421 !! html/parsoid
7422 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7423 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7424 !! end
7425
7426 !! test
7427 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7428 !! wikitext
7429 [[mi:Foo]]
7430 !! html/php
7431 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7432 </p>
7433 !! html/parsoid
7434 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7435 !! end
7436
7437 !! test
7438 Interlanguage link with preceding local interwiki link (bug 68085)
7439 !! options
7440 parsoid=wt2html,wt2wt,html2html
7441 !! wikitext
7442 Blah blah blah
7443 [[local:es:Spanish]]
7444 !! html/php
7445 <p>Blah blah blah
7446 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7447 </p>
7448 !! html/parsoid
7449 <p>Blah blah blah
7450 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7451 !! end
7452
7453 !! test
7454 Looks like an interlanguage link, but is actually a local interwiki
7455 !! options
7456 parsoid=wt2html,wt2wt,html2html
7457 !! wikitext
7458 Blah blah blah
7459 [[mi:Template:Foo]]
7460 !! html/php
7461 <p>Blah blah blah
7462 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7463 </p>
7464 !! html/parsoid
7465 <p>Blah blah blah
7466 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7467 !! end
7468
7469 ###
7470 ### Redirects, Parsoid-only
7471 ###
7472 !! test
7473 1. Simple redirect to page
7474 !! options
7475 parsoid
7476 !! wikitext
7477 #REDIRECT [[Main Page]]
7478 !! html
7479 <link rel="mw:PageProp/redirect" href="./Main_Page">
7480 !! end
7481
7482 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7483 !! test
7484 2. Other redirect variants
7485 !! options
7486 parsoid=wt2html,wt2wt
7487 !! wikitext
7488 #REDIRECT [[Main_Page]]
7489 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7490 !! html/parsoid
7491 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7492 !! end
7493
7494 !! test
7495 Empty redirect
7496 !! options
7497 parsoid=wt2html,wt2wt
7498 !! wikitext
7499 #REDIRECT [[]]
7500 !! html
7501 <ol>
7502 <li>REDIRECT [[]]</li></ol>
7503 !! end
7504
7505 !! test
7506 Optional colon in #REDIRECT
7507 !! options
7508 # the colon is archaic syntax. we support it for wt2html, but we
7509 # don't care that it roundtrips back to the modern syntax.
7510 parsoid=wt2html,html2html
7511 !! wikitext
7512 #REDIRECT:[[Main Page]]
7513 !! html
7514 <link rel="mw:PageProp/redirect" href="./Main_Page">
7515 !! end
7516
7517 !! test
7518 Whitespace in #REDIRECT with optional colon
7519 !! options
7520 # the colon and gratuitous whitespace is archaic syntax. we support
7521 # it for wt2html, but we don't care that it roundtrips back to the
7522 # modern syntax (without extra whitespace)
7523 parsoid=wt2html,html2html
7524 !! wikitext
7525
7526 #REDIRECT
7527 :
7528 [[Main Page]]
7529 !! html
7530 <link rel="mw:PageProp/redirect" href="./Main_Page">
7531 !! end
7532
7533 !! test
7534 Piped link in #REDIRECT
7535 !! options
7536 # content after piped link is ignored. we support this syntax,
7537 # but don't care that the piped link is lost when we roundtrip this.
7538 parsoid=wt2html
7539 !! wikitext
7540 #REDIRECT [[Main Page|bar]]
7541 !! html
7542 <link rel="mw:PageProp/redirect" href="./Main_Page">
7543 !! end
7544
7545 !! test
7546 Redirect to category
7547 !! options
7548 parsoid=wt2html
7549 !! wikitext
7550 #REDIRECT [[Category:Foo]]
7551 !! html
7552 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7553 !! end
7554
7555 !! test
7556 Redirect to category with URL encoding
7557 !! options
7558 parsoid=wt2html
7559 !! wikitext
7560 #REDIRECT [[Category%3AFoo]]
7561 !! html
7562 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7563 !! end
7564
7565 !! test
7566 Redirect to category page
7567 !! options
7568 parsoid=wt2html,html2html
7569 !! wikitext
7570 #REDIRECT [[:Category:Foo]]
7571 !! html
7572 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7573 !! end
7574
7575 !! test
7576 Redirect to image page (1)
7577 !! options
7578 parsoid
7579 !! wikitext
7580 #REDIRECT [[File:Wiki.png]]
7581 !! html
7582 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7583 !! end
7584
7585 !! test
7586 Redirect to image page (2)
7587 !! options
7588 parsoid
7589 !! wikitext
7590 #REDIRECT [[Image:Wiki.png]]
7591 !! html
7592 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7593 !! end
7594
7595 !! test
7596 Redirect to language
7597 !! options
7598 parsoid
7599 !! wikitext
7600 #REDIRECT [[en:File:Wiki.png]]
7601 !! html
7602 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7603 !! end
7604
7605 !! test
7606 Redirect to interwiki
7607 !! options
7608 parsoid
7609 !! wikitext
7610 #REDIRECT [[meatball:File:Wiki.png]]
7611 !! html
7612 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7613 !! end
7614
7615 !! test
7616 Non-English #REDIRECT
7617 !! options
7618 parsoid
7619 language=is
7620 !! wikitext
7621 #TILVÍSUN [[Main Page]]
7622 !! html
7623 <link rel="mw:PageProp/redirect" href="./Main_Page">
7624 !! end
7625
7626 !! test
7627 New redirect
7628 !! options
7629 parsoid=html2wt
7630 !! html
7631 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7632 !! wikitext
7633 Foo
7634 #REDIRECT [[Foo]]
7635 !! end
7636
7637 ##
7638 ## XHTML tidiness
7639 ###
7640
7641 !! test
7642 <br> to <br />
7643 !! wikitext
7644 1<br>2<br />3
7645 !! html
7646 <p>1<br />2<br />3
7647 </p>
7648 !! end
7649
7650 !! test
7651 Broken br tag sanitization
7652 !! wikitext
7653 </br>
7654 !! html/php
7655 <p>&lt;/br&gt;
7656 </p>
7657 !! end
7658
7659 # TODO: Fix html2html mode (bug 51055)!
7660 # This </br> handling was added as part of bug 50831; but it
7661 # differs from how PHP+tidy handles this. We should investigate
7662 # this.
7663 !! test
7664 Parsoid: Broken br tag recognition
7665 !! options
7666 parsoid=wt2html
7667 !! wikitext
7668 </br>
7669
7670 <br/ >
7671 !! html/php+tidy
7672 <p>&lt;/br&gt;</p>
7673 <p><br /></p>
7674 !! html/parsoid
7675 <p><br></p>
7676 <p><br/></p>
7677 !! end
7678
7679 !! test
7680 Incorrecly removing closing slashes from correctly formed XHTML
7681 !! wikitext
7682 <br style="clear:both;" />
7683 !! html
7684 <p><br style="clear:both;" />
7685 </p>
7686 !! end
7687
7688 !! test
7689 Failing to transform badly formed HTML into correct XHTML
7690 !! wikitext
7691 <br style="clear: left;">
7692 <br style="clear: right;">
7693 <br style="clear: both;">
7694 !! html
7695 <p><br style="clear: left;" />
7696 <br style="clear: right;" />
7697 <br style="clear: both;" />
7698 </p>
7699 !!end
7700
7701 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7702 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7703 !! test
7704 Handling html with a div self-closing tag
7705 !! wikitext
7706 <div title />
7707 <div title/>
7708 <div title/ >
7709 <div title=bar />
7710 <div title=bar/>
7711 <div title=bar/ >
7712 !! html/php
7713 <p>&lt;div title /&gt;
7714 &lt;div title/&gt;
7715 </p>
7716 <div>
7717 <p>&lt;div title=bar /&gt;
7718 &lt;div title=bar/&gt;
7719 </p>
7720 <div title="bar/"></div>
7721 </div>
7722
7723 !! html/parsoid
7724 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7725 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7726 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7727 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7728 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7729 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7730 !! end
7731
7732 !! test
7733 Handling html with a br self-closing tag
7734 !! wikitext
7735 <br title />
7736 <br title/>
7737 <br title/ >
7738 <br title=bar />
7739 <br title=bar/>
7740 <br title=bar/ >
7741 !! html/php
7742 <p><br title="title" />
7743 <br title="title" />
7744 <br />
7745 <br title="bar" />
7746 <br title="bar" />
7747 <br title="bar/" />
7748 </p>
7749 !! html/parsoid
7750 <p><br title="" />
7751 <br title="" />
7752 <br title="" />
7753 <br title="bar" />
7754 <br title="bar" />
7755 <br title="bar/" />
7756 </p>
7757 !! end
7758
7759 !! test
7760 Horizontal ruler (should it add that extra space?)
7761 !! wikitext
7762 <hr>
7763 <hr >
7764 foo <hr
7765 > bar
7766 !! html+tidy
7767 <hr />
7768 <hr />
7769 <p>foo</p>
7770 <hr />
7771 <p>bar</p>
7772 !! end
7773
7774 !! test
7775 Horizontal ruler -- 4+ dashes render hr
7776 !! wikitext
7777 ----
7778 !! html
7779 <hr />
7780
7781 !! end
7782
7783 !! test
7784 Horizontal ruler -- eats additional dashes on the same line
7785 !! wikitext
7786 ---------
7787 !! html
7788 <hr />
7789
7790 !! end
7791
7792 !! test
7793 Horizontal ruler -- does not collapse dashes on consecutive lines
7794 !! wikitext
7795 ----
7796 ----
7797 !! html
7798 <hr />
7799 <hr />
7800
7801 !! end
7802
7803 !! test
7804 Horizontal ruler -- <4 dashes render as plain text
7805 !! wikitext
7806 ---
7807 !! html
7808 <p>---
7809 </p>
7810 !! end
7811
7812 !! test
7813 Horizontal ruler -- Supports content following dashes on same line
7814 !! wikitext
7815 ---- Foo
7816 !! html
7817 <hr /> Foo
7818
7819 !! html+tidy
7820 <hr />
7821 <p>Foo</p>
7822 !! end
7823
7824 ###
7825 ### Block-level elements
7826 ###
7827 !! test
7828 Common list
7829 !! wikitext
7830 *Common list
7831 * item 2
7832 *item 3
7833 !! html
7834 <ul><li>Common list</li>
7835 <li> item 2</li>
7836 <li>item 3</li></ul>
7837
7838 !! end
7839
7840 !! test
7841 Numbered list
7842 !! wikitext
7843 #Numbered list
7844 #item 2
7845 # item 3
7846 !! html
7847 <ol><li>Numbered list</li>
7848 <li>item 2</li>
7849 <li> item 3</li></ol>
7850
7851 !! end
7852
7853 !! test
7854 Mixed list
7855 !! wikitext
7856 *Mixed list
7857 *# with numbers
7858 ** and bullets
7859 *# and numbers
7860 *bullets again
7861 **bullet level 2
7862 ***bullet level 3
7863 ***#Number on level 4
7864 **bullet level 2
7865 **#Number on level 3
7866 **#Number on level 3
7867 *#number level 2
7868 *Level 1
7869 *** Level 3
7870 #** Level 3, but ordered
7871 !! html
7872 <ul><li>Mixed list
7873 <ol><li> with numbers</li></ol>
7874 <ul><li> and bullets</li></ul>
7875 <ol><li> and numbers</li></ol></li>
7876 <li>bullets again
7877 <ul><li>bullet level 2
7878 <ul><li>bullet level 3
7879 <ol><li>Number on level 4</li></ol></li></ul></li>
7880 <li>bullet level 2
7881 <ol><li>Number on level 3</li>
7882 <li>Number on level 3</li></ol></li></ul>
7883 <ol><li>number level 2</li></ol></li>
7884 <li>Level 1
7885 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7886 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7887
7888 !! end
7889
7890 !! test
7891 Nested lists 1
7892 !! wikitext
7893 *foo
7894 **bar
7895 !! html
7896 <ul><li>foo
7897 <ul><li>bar</li></ul></li></ul>
7898
7899 !! end
7900
7901 !! test
7902 Nested lists 2
7903 !! wikitext
7904 **foo
7905 *bar
7906 !! html
7907 <ul><li><ul><li>foo</li></ul></li>
7908 <li>bar</li></ul>
7909
7910 !! end
7911
7912 !! test
7913 Nested lists 3 (first element empty)
7914 !! wikitext
7915 *
7916 **bar
7917 !! html
7918 <ul><li>
7919 <ul><li>bar</li></ul></li></ul>
7920
7921 !! end
7922
7923 !! test
7924 Nested lists 4 (first element empty)
7925 !! wikitext
7926 **
7927 *bar
7928 !! html
7929 <ul><li><ul><li></li></ul></li>
7930 <li>bar</li></ul>
7931
7932 !! end
7933
7934 !! test
7935 Nested lists 5 (both elements empty)
7936 !! wikitext
7937 **
7938 *
7939 !! html
7940 <ul><li><ul><li></li></ul></li>
7941 <li></li></ul>
7942
7943 !! end
7944
7945 !! test
7946 Nested lists 6 (both elements empty)
7947 !! wikitext
7948 *
7949 **
7950 !! html
7951 <ul><li>
7952 <ul><li></li></ul></li></ul>
7953
7954 !! end
7955
7956 !! test
7957 Nested lists 7 (skip initial nesting levels)
7958 !! wikitext
7959 *** foo
7960 !! html
7961 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7962
7963 !! end
7964
7965 !! test
7966 Nested lists 8 (multiple nesting transitions)
7967 !! wikitext
7968 * foo
7969 *** bar
7970 ** baz
7971 * boo
7972 !! html
7973 <ul><li> foo
7974 <ul><li><ul><li> bar</li></ul></li>
7975 <li> baz</li></ul></li>
7976 <li> boo</li></ul>
7977
7978 !! end
7979
7980 !! test
7981 1. Lists with start-of-line-transparent tokens before bullets: Comments
7982 !! wikitext
7983 *foo
7984 *<!--cmt-->bar
7985 <!--cmt-->*baz
7986 !! html
7987 <ul><li>foo</li>
7988 <li>bar</li>
7989 <li>baz</li></ul>
7990
7991 !! end
7992
7993 !! test
7994 2. Lists with start-of-line-transparent tokens before bullets: Template close
7995 !! wikitext
7996 *foo {{echo|bar
7997 }}*baz
7998 !! html
7999 <ul><li>foo bar</li>
8000 <li>baz</li></ul>
8001
8002 !! end
8003
8004 !! test
8005 List items are not parsed correctly following a <pre> block (bug 785)
8006 !! wikitext
8007 * <pre>foo</pre>
8008 * <pre>bar</pre>
8009 * zar
8010 !! html
8011 <ul><li> <pre>foo</pre></li>
8012 <li> <pre>bar</pre></li>
8013 <li> zar</li></ul>
8014
8015 !! end
8016
8017 !! test
8018 List items from template
8019 !! wikitext
8020
8021 {{inner list}}
8022 * item 2
8023
8024 * item 0
8025 {{inner list}}
8026 * item 2
8027
8028 * item 0
8029 * notSOL{{inner list}}
8030 * item 2
8031 !! html
8032 <ul><li> item 1</li>
8033 <li> item 2</li></ul>
8034 <ul><li> item 0</li>
8035 <li> item 1</li>
8036 <li> item 2</li></ul>
8037 <ul><li> item 0</li>
8038 <li> notSOL</li>
8039 <li> item 1</li>
8040 <li> item 2</li></ul>
8041
8042 !! end
8043
8044 !! test
8045 List interrupted by empty line or heading
8046 !! wikitext
8047 * foo
8048
8049 ** bar
8050 == A heading ==
8051 * Another list item
8052 !! html
8053 <ul><li> foo</li></ul>
8054 <ul><li><ul><li> bar</li></ul></li></ul>
8055 <h2><a href="#A_heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8056 <ul><li> Another list item</li></ul>
8057
8058 !!end
8059
8060 !!test
8061 Multiple list tags generated by templates
8062 !! wikitext
8063 {{echo|<li>}}a
8064 {{echo|<li>}}b
8065 {{echo|<li>}}c
8066 !! html
8067 <li>a
8068 <li>b
8069 <li>c</li>
8070 </li>
8071 </li>
8072
8073 !! html+tidy
8074 <ul>
8075 <li>a</li>
8076 <li>b</li>
8077 <li>c</li>
8078 </ul>
8079 !!end
8080
8081 !!test
8082 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8083 !! wikitext
8084 *a
8085 <!--This line will NOT split the list-->
8086 *b
8087 <!--This line will NOT split the list either-->
8088 *c
8089 <!--foo--> <!----> <!--This line NOT split the list either-->
8090 *d
8091 !! html
8092 <ul><li>a</li>
8093 <li>b</li>
8094 <li>c</li>
8095 <li>d</li></ul>
8096
8097 !!end
8098
8099 !!test
8100 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8101 !! wikitext
8102 *a
8103 <!--This line will NOT split the list-->
8104 *b
8105 <!--This line will NOT split the list either-->
8106 *c
8107 <!--foo--> <!----> <!--This line NOT split the list
8108 either-->
8109 *d
8110 !! html
8111 <ul><li>a</li>
8112 <li>b</li>
8113 <li>c</li>
8114 <li>d</li></ul>
8115
8116 !!end
8117
8118 !!test
8119 Test the li-hack
8120 (The PHP parser relies on Tidy for the hack)
8121 !!options
8122 parsoid=wt2html,wt2wt
8123 !! wikitext
8124 * foo
8125 * <li>li-hack
8126 * {{echo|<li>templated li-hack}}
8127 * <!--foo--> <li> unsupported li-hack with preceding comments
8128
8129 <ul>
8130 <li><li>not a li-hack
8131 </li>
8132 </ul>
8133 !! html+tidy
8134 <ul>
8135 <li>foo</li>
8136 <li>li-hack</li>
8137 <li>templated li-hack</li>
8138 <li>unsupported li-hack with preceding comments</li>
8139 </ul>
8140 <ul>
8141 <li>not a li-hack</li>
8142 </ul>
8143 !!end
8144
8145 !! test
8146 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8147 !! options
8148 parsoid
8149 !! wikitext
8150 # foo
8151 ## bar
8152 * foo
8153 ** bar
8154 : foo
8155 :: bar
8156 !! html
8157 <ol>
8158 <li> foo<ol>
8159 <li> bar</li>
8160 </ol></li>
8161 </ol><ul>
8162 <li> foo<ul>
8163 <li> bar</li>
8164 </ul></li>
8165 </ul><dl>
8166 <dd> foo<dl>
8167 <dd> bar</dd>
8168 </dl></dd>
8169 </dl>
8170 !! end
8171
8172 !! test
8173 Parsoid: Test of whitespace serialization with Templated bullets
8174 !! options
8175 parsoid
8176 !! wikitext
8177 * {{bullet}}
8178 !! html
8179 <ul>
8180 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8181 </ul>
8182 !! end
8183
8184 # ------------------------------------------------------------------------
8185 # The next set of tests are about Parsoid's ability to handle badly nested
8186 # tags (parse, minimize scope of fixup, and roundtrip back)
8187 # ------------------------------------------------------------------------
8188
8189 !! test
8190 Unbalanced closing block tags break a list
8191 (php parser relies on Tidy to fix up)
8192 !! wikitext
8193 <div>
8194 *a</div><div>
8195 *b</div>
8196 !! html+tidy
8197 <div>
8198 <ul>
8199 <li>a</li>
8200 </ul>
8201 </div>
8202 <div>
8203 <ul>
8204 <li>b</li>
8205 </ul>
8206 </div>
8207 !! end
8208
8209 # Parsoid fails this test, but it might be tricky to support properly.
8210 # See bug 68395.
8211 !! test
8212 Unbalanced closing non-block tags don't break a list
8213 (php parser relies on Tidy to fix up)
8214 !! wikitext
8215 <span>
8216 *a</span><span>
8217 *b</span>
8218 !! html/php+tidy
8219 <ul>
8220 <li><span>a</span></li>
8221 <li><span>b</span></li>
8222 </ul>
8223 !! html/parsoid
8224 <span>
8225 <ul>
8226 <li>a<span></span>
8227 </li>
8228 <li>b
8229 </li>
8230 </ul>
8231 </span>
8232 !! end
8233
8234 !! test
8235 Unclosed formatting tags that straddle lists are closed and reopened
8236 (php parser relies on Tidy to fix up)
8237 !! options
8238 parsoid=wt2html,wt2wt,html2html
8239 !! wikitext
8240 # <s> a
8241 # b </s>
8242 !! html/php+tidy
8243 <ol>
8244 <li><s>a</s></li>
8245 <li><s>b</s></li>
8246 </ol>
8247 !! html/parsoid
8248 <ol><li> <s> a</s></li>
8249 <li><s> b </s></li></ol>
8250 !! end
8251
8252 # Parsoid fails this test, but it might be tricky to support properly.
8253 # See bug 68395.
8254 !!test
8255 List embedded in a non-block tag
8256 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8257 !! wikitext
8258 <small>
8259 * foo
8260 </small>
8261 !! html/php+tidy
8262 <ul>
8263 <li><small>foo</small></li>
8264 </ul>
8265 !! html/parsoid
8266 <small>
8267 <ul>
8268 <li> foo</li>
8269 </ul>
8270 </small>
8271 !!end
8272
8273 # This is a bug in the PHP parser + tidy combination.
8274 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8275 # and then fostered out of the table by tidy.)
8276 # We believe the Parsoid output to be correct.
8277 !! test
8278 Table with missing opening <tr> tag
8279 !! options
8280 parsoid=wt2html,wt2wt
8281 !! wikitext
8282 <table>
8283 <td>foo</td>
8284 </tr>
8285 </table>
8286 !! html/php+tidy
8287 <p>&lt;/tr&gt;</p>
8288 <table>
8289 <tr>
8290 <td>foo</td>
8291 </tr>
8292 </table>
8293 !! html/parsoid
8294 <table>
8295 <tr>
8296 <td>foo</td>
8297 </tr>
8298 </table>
8299 !! end
8300
8301 ###
8302 ### Magic Words
8303 ###
8304
8305 # Note that the current date is hard-coded as
8306 # 1970-01-01T00:02:03Z (a Thursday)
8307 # when running parser tests. The timezone is also fixed to GMT, so
8308 # local date will be identical to current date.
8309
8310 !! test
8311 Magic Word: {{CURRENTDAY}}
8312 !! wikitext
8313 {{CURRENTDAY}}
8314 !! html
8315 <p>1
8316 </p>
8317 !! end
8318
8319 !! test
8320 Magic Word: {{CURRENTDAY2}}
8321 !! wikitext
8322 {{CURRENTDAY2}}
8323 !! html
8324 <p>01
8325 </p>
8326 !! end
8327
8328 !! test
8329 Magic Word: {{CURRENTDAYNAME}}
8330 !! wikitext
8331 {{CURRENTDAYNAME}}
8332 !! html
8333 <p>Thursday
8334 </p>
8335 !! end
8336
8337 !! test
8338 Magic Word: {{CURRENTDOW}}
8339 !! wikitext
8340 {{CURRENTDOW}}
8341 !! html
8342 <p>4
8343 </p>
8344 !! end
8345
8346 !! test
8347 Magic Word: {{CURRENTMONTH}}
8348 !! wikitext
8349 {{CURRENTMONTH}}
8350 !! html
8351 <p>01
8352 </p>
8353 !! end
8354
8355 !! test
8356 Magic Word: {{CURRENTMONTH1}}
8357 !! wikitext
8358 {{CURRENTMONTH1}}
8359 !! html
8360 <p>1
8361 </p>
8362 !! end
8363
8364 !! test
8365 Magic Word: {{CURRENTMONTHABBREV}}
8366 !! wikitext
8367 {{CURRENTMONTHABBREV}}
8368 !! html
8369 <p>Jan
8370 </p>
8371 !! end
8372
8373 !! test
8374 Magic Word: {{CURRENTMONTHNAME}}
8375 !! wikitext
8376 {{CURRENTMONTHNAME}}
8377 !! html
8378 <p>January
8379 </p>
8380 !! end
8381
8382 !! test
8383 Magic Word: {{CURRENTMONTHNAMEGEN}}
8384 !! wikitext
8385 {{CURRENTMONTHNAMEGEN}}
8386 !! html
8387 <p>January
8388 </p>
8389 !! end
8390
8391 !! test
8392 Magic Word: {{CURRENTTIME}}
8393 !! wikitext
8394 {{CURRENTTIME}}
8395 !! html
8396 <p>00:02
8397 </p>
8398 !! end
8399
8400 !! test
8401 Magic Word: {{CURRENTHOUR}}
8402 !! wikitext
8403 {{CURRENTHOUR}}
8404 !! html
8405 <p>00
8406 </p>
8407 !! end
8408
8409 !! test
8410 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8411 !! wikitext
8412 {{CURRENTWEEK}}
8413 !! html
8414 <p>1
8415 </p>
8416 !! end
8417
8418 !! test
8419 Magic Word: {{CURRENTYEAR}}
8420 !! wikitext
8421 {{CURRENTYEAR}}
8422 !! html
8423 <p>1970
8424 </p>
8425 !! end
8426
8427 !! test
8428 Magic Word: {{CURRENTTIMESTAMP}}
8429 !! wikitext
8430 {{CURRENTTIMESTAMP}}
8431 !! html
8432 <p>19700101000203
8433 </p>
8434 !! end
8435
8436 !! test
8437 Magic Words LOCAL (UTC)
8438 !! wikitext
8439 * {{LOCALMONTH}}
8440 * {{LOCALMONTH1}}
8441 * {{LOCALMONTHNAME}}
8442 * {{LOCALMONTHNAMEGEN}}
8443 * {{LOCALMONTHABBREV}}
8444 * {{LOCALDAY}}
8445 * {{LOCALDAY2}}
8446 * {{LOCALDAYNAME}}
8447 * {{LOCALYEAR}}
8448 * {{LOCALTIME}}
8449 * {{LOCALHOUR}}
8450 * {{LOCALWEEK}}
8451 * {{LOCALDOW}}
8452 * {{LOCALTIMESTAMP}}
8453 !! html
8454 <ul><li> 01</li>
8455 <li> 1</li>
8456 <li> January</li>
8457 <li> January</li>
8458 <li> Jan</li>
8459 <li> 1</li>
8460 <li> 01</li>
8461 <li> Thursday</li>
8462 <li> 1970</li>
8463 <li> 00:02</li>
8464 <li> 00</li>
8465 <li> 1</li>
8466 <li> 4</li>
8467 <li> 19700101000203</li></ul>
8468
8469 !! end
8470
8471 !! test
8472 Magic Word: {{FULLPAGENAME}}
8473 !! options
8474 title=[[User:Ævar Arnfjörð Bjarmason]]
8475 !! wikitext
8476 {{FULLPAGENAME}}
8477 !! html
8478 <p>User:Ævar Arnfjörð Bjarmason
8479 </p>
8480 !! end
8481
8482 !! test
8483 Magic Word: {{FULLPAGENAMEE}}
8484 !! options
8485 title=[[User:Ævar Arnfjörð Bjarmason]]
8486 !! wikitext
8487 {{FULLPAGENAMEE}}
8488 !! html
8489 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8490 </p>
8491 !! end
8492
8493 !! test
8494 Magic Word: {{TALKSPACE}}
8495 !! options
8496 title=[[User:Ævar Arnfjörð Bjarmason]]
8497 !! wikitext
8498 {{TALKSPACE}}
8499 !! html
8500 <p>User talk
8501 </p>
8502 !! end
8503
8504 !! test
8505 Magic Word: {{TALKSPACE}}, same namespace
8506 !! options
8507 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8508 !! wikitext
8509 {{TALKSPACE}}
8510 !! html
8511 <p>User talk
8512 </p>
8513 !! end
8514
8515 !! test
8516 Magic Word: {{TALKSPACE}}, main namespace
8517 !! options
8518 title=[[Parser Test]]
8519 !! wikitext
8520 {{TALKSPACE}}
8521 !! html
8522 <p>Talk
8523 </p>
8524 !! end
8525
8526 !! test
8527 Magic Word: {{TALKSPACEE}}
8528 !! options
8529 title=[[User:Ævar Arnfjörð Bjarmason]]
8530 !! wikitext
8531 {{TALKSPACEE}}
8532 !! html
8533 <p>User_talk
8534 </p>
8535 !! end
8536
8537 !! test
8538 Magic Word: {{SUBJECTSPACE}}
8539 !! options
8540 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8541 !! wikitext
8542 {{SUBJECTSPACE}}
8543 !! html
8544 <p>User
8545 </p>
8546 !! end
8547
8548 !! test
8549 Magic Word: {{SUBJECTSPACE}}, same namespace
8550 !! options
8551 title=[[User:Ævar Arnfjörð Bjarmason]]
8552 !! wikitext
8553 {{SUBJECTSPACE}}
8554 !! html
8555 <p>User
8556 </p>
8557 !! end
8558
8559 !! test
8560 Magic Word: {{SUBJECTSPACE}}, main namespace
8561 !! options
8562 title=[[Parser Test]]
8563 !! wikitext
8564 {{SUBJECTSPACE}}
8565 !! html
8566
8567 !! end
8568
8569 !! test
8570 Magic Word: {{SUBJECTSPACEE}}
8571 !! options
8572 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8573 !! wikitext
8574 {{SUBJECTSPACEE}}
8575 !! html
8576 <p>User
8577 </p>
8578 !! end
8579
8580 !! test
8581 Magic Word: {{NAMESPACE}}
8582 !! options
8583 title=[[User:Ævar Arnfjörð Bjarmason]]
8584 !! wikitext
8585 {{NAMESPACE}}
8586 !! html
8587 <p>User
8588 </p>
8589 !! end
8590
8591 !! test
8592 Magic Word: {{NAMESPACEE}}
8593 !! options
8594 title=[[User:Ævar Arnfjörð Bjarmason]]
8595 !! wikitext
8596 {{NAMESPACEE}}
8597 !! html
8598 <p>User
8599 </p>
8600 !! end
8601
8602 !! test
8603 Magic Word: {{NAMESPACENUMBER}}
8604 !! options
8605 title=[[User:Ævar Arnfjörð Bjarmason]]
8606 !! wikitext
8607 {{NAMESPACENUMBER}}
8608 !! html
8609 <p>2
8610 </p>
8611 !! end
8612
8613 !! test
8614 Magic Word: {{SUBPAGENAME}}
8615 !! options
8616 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8617 !! wikitext
8618 {{SUBPAGENAME}}
8619 !! html
8620 <p>sub ö
8621 </p>
8622 !! end
8623
8624 !! test
8625 Magic Word: {{SUBPAGENAMEE}}
8626 !! options
8627 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8628 !! wikitext
8629 {{SUBPAGENAMEE}}
8630 !! html
8631 <p>sub_%C3%B6
8632 </p>
8633 !! end
8634
8635 !! test
8636 Magic Word: {{ROOTPAGENAME}}
8637 !! options
8638 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8639 !! wikitext
8640 {{ROOTPAGENAME}}
8641 !! html
8642 <p>Ævar Arnfjörð Bjarmason
8643 </p>
8644 !! end
8645
8646 !! test
8647 Magic Word: {{ROOTPAGENAMEE}}
8648 !! options
8649 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8650 !! wikitext
8651 {{ROOTPAGENAMEE}}
8652 !! html
8653 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8654 </p>
8655 !! end
8656
8657 !! test
8658 Magic Word: {{BASEPAGENAME}}
8659 !! options
8660 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8661 !! wikitext
8662 {{BASEPAGENAME}}
8663 !! html
8664 <p>Ævar Arnfjörð Bjarmason
8665 </p>
8666 !! end
8667
8668 !! test
8669 Magic Word: {{BASEPAGENAMEE}}
8670 !! options
8671 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8672 !! wikitext
8673 {{BASEPAGENAMEE}}
8674 !! html
8675 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8676 </p>
8677 !! end
8678
8679 !! test
8680 Magic Word: {{TALKPAGENAME}}
8681 !! options
8682 title=[[User:Ævar Arnfjörð Bjarmason]]
8683 !! wikitext
8684 {{TALKPAGENAME}}
8685 !! html
8686 <p>User talk:Ævar Arnfjörð Bjarmason
8687 </p>
8688 !! end
8689
8690 !! test
8691 Magic Word: {{TALKPAGENAMEE}}
8692 !! options
8693 title=[[User:Ævar Arnfjörð Bjarmason]]
8694 !! wikitext
8695 {{TALKPAGENAMEE}}
8696 !! html
8697 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8698 </p>
8699 !! end
8700
8701 !! test
8702 Magic Word: {{SUBJECTPAGENAME}}
8703 !! options
8704 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8705 !! wikitext
8706 {{SUBJECTPAGENAME}}
8707 !! html
8708 <p>User:Ævar Arnfjörð Bjarmason
8709 </p>
8710 !! end
8711
8712 !! test
8713 Magic Word: {{SUBJECTPAGENAMEE}}
8714 !! options
8715 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8716 !! wikitext
8717 {{SUBJECTPAGENAMEE}}
8718 !! html
8719 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8720 </p>
8721 !! end
8722
8723 !! test
8724 Magic Word: {{NUMBEROFFILES}}
8725 !! wikitext
8726 {{NUMBEROFFILES}}
8727 !! html
8728 <p>5
8729 </p>
8730 !! end
8731
8732 !! test
8733 Magic Word: {{PAGENAME}}
8734 !! options
8735 title=[[User:Ævar Arnfjörð Bjarmason]]
8736 !! wikitext
8737 {{PAGENAME}}
8738 !! html
8739 <p>Ævar Arnfjörð Bjarmason
8740 </p>
8741 !! end
8742
8743 !! test
8744 Magic Word: {{PAGENAME}} with metacharacters
8745 !! options
8746 title=[['foo & bar = baz']]
8747 !! wikitext
8748 ''{{PAGENAME}}''
8749 !! html/php
8750 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8751 </p>
8752 !! html+tidy
8753 <p><i>'foo &amp; bar = baz'</i></p>
8754 !! end
8755
8756 !! test
8757 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8758 !! options
8759 title=[[*RFC 1234 http://example.com/]]
8760 !! wikitext
8761 {{PAGENAME}}
8762 !! html/php
8763 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8764 </p>
8765 !! html+tidy
8766 <p>*RFC 1234 http://example.com/</p>
8767 !! end
8768
8769 !! test
8770 Magic Word: {{PAGENAMEE}}
8771 !! options
8772 title=[[User:Ævar Arnfjörð Bjarmason]]
8773 !! wikitext
8774 {{PAGENAMEE}}
8775 !! html
8776 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8777 </p>
8778 !! end
8779
8780 !! test
8781 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8782 !! options
8783 title=[[*RFC 1234 http://example.com/]]
8784 !! wikitext
8785 {{PAGENAMEE}}
8786 !! html/php
8787 <p>&#42;RFC_1234_http&#58;//example.com/
8788 </p>
8789 !! html+tidy
8790 <p>*RFC_1234_http://example.com/</p>
8791 !! end
8792
8793 !! test
8794 Magic Word: {{REVISIONID}}
8795 !! wikitext
8796 {{REVISIONID}}
8797 !! html
8798 <p>1337
8799 </p>
8800 !! end
8801
8802 !! test
8803 Magic Word: {{SCRIPTPATH}}
8804 !! wikitext
8805 {{SCRIPTPATH}}
8806 !! html
8807 <p>/
8808 </p>
8809 !! end
8810
8811 !! test
8812 Magic Word: {{STYLEPATH}}
8813 !! wikitext
8814 {{STYLEPATH}}
8815 !! html
8816 <p>/skins
8817 </p>
8818 !! end
8819
8820 !! test
8821 Magic Word: {{SERVER}}
8822 !! wikitext
8823 {{SERVER}}
8824 !! html
8825 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8826 </p>
8827 !! end
8828
8829 !! test
8830 Magic Word: {{SERVERNAME}}
8831 !! wikitext
8832 {{SERVERNAME}}
8833 !! html
8834 <p>example.org
8835 </p>
8836 !! end
8837
8838 !! test
8839 Magic Word: {{SITENAME}}
8840 !! wikitext
8841 {{SITENAME}}
8842 !! html
8843 <p>MediaWiki
8844 </p>
8845 !! end
8846
8847 !! test
8848 Case-sensitive magic words, when cased differently, should just be template transclusions
8849 !! wikitext
8850 {{CurrentMonth}}
8851 {{currentday}}
8852 {{cURreNTweEK}}
8853 {{currentHour}}
8854 !! html
8855 <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>
8856 <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>
8857 <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>
8858 <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>
8859 </p>
8860 !! end
8861
8862 !! test
8863 Case-insensitive magic words should still work with weird casing.
8864 !! wikitext
8865 {{sErVeRNaMe}}
8866 {{LCFirst:AOEU}}
8867 {{ucFIRST:aoeu}}
8868 {{SERver}}
8869 !! html
8870 <p>example.org
8871 aOEU
8872 Aoeu
8873 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8874 </p>
8875 !! end
8876
8877 # From plwiki:PLOS_ONE
8878 !! test
8879 Parsoid: Page property magic word with magic word contents
8880 !! wikitext
8881 {{DISPLAYTITLE:''{{PAGENAME}}''}}
8882 !! html/parsoid
8883 <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>"}]]}'/>
8884 !! end
8885
8886 !! test
8887 Parsoid: Template-generated DISPLAYTITLE
8888 !! wikitext
8889 {{{{echo|DISPLAYTITLE}}:Foo}}
8890 !! html/parsoid
8891 <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}}]}'/>
8892 !! end
8893
8894 !! test
8895 Namespace 1 {{ns:1}}
8896 !! wikitext
8897 {{ns:1}}
8898 !! html
8899 <p>Talk
8900 </p>
8901 !! end
8902
8903 !! test
8904 Namespace 1 {{ns:01}}
8905 !! wikitext
8906 {{ns:01}}
8907 !! html
8908 <p>Talk
8909 </p>
8910 !! end
8911
8912 !! test
8913 Namespace 0 {{ns:0}} (bug 4783)
8914 !! wikitext
8915 {{ns:0}}
8916 !! html
8917
8918 !! end
8919
8920 !! test
8921 Namespace 0 {{ns:00}} (bug 4783)
8922 !! wikitext
8923 {{ns:00}}
8924 !! html
8925
8926 !! end
8927
8928 !! test
8929 Namespace -1 {{ns:-1}}
8930 !! wikitext
8931 {{ns:-1}}
8932 !! html
8933 <p>Special
8934 </p>
8935 !! end
8936
8937 !! test
8938 Namespace User {{ns:User}}
8939 !! wikitext
8940 {{ns:User}}
8941 !! html
8942 <p>User
8943 </p>
8944 !! end
8945
8946 !! test
8947 Namespace User talk {{ns:User_talk}}
8948 !! wikitext
8949 {{ns:User_talk}}
8950 !! html
8951 <p>User talk
8952 </p>
8953 !! end
8954
8955 !! test
8956 Namespace User talk {{ns:uSeR tAlK}}
8957 !! wikitext
8958 {{ns:uSeR tAlK}}
8959 !! html
8960 <p>User talk
8961 </p>
8962 !! end
8963
8964 !! test
8965 Namespace File {{ns:File}}
8966 !! wikitext
8967 {{ns:File}}
8968 !! html
8969 <p>File
8970 </p>
8971 !! end
8972
8973 !! test
8974 Namespace File {{ns:Image}}
8975 !! wikitext
8976 {{ns:Image}}
8977 !! html
8978 <p>File
8979 </p>
8980 !! end
8981
8982 !! test
8983 Namespace (lang=de) Benutzer {{ns:User}}
8984 !! options
8985 language=de
8986 !! wikitext
8987 {{ns:User}}
8988 !! html
8989 <p>Benutzer
8990 </p>
8991 !! end
8992
8993 !! test
8994 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8995 !! options
8996 language=de
8997 !! wikitext
8998 {{ns:3}}
8999 !! html
9000 <p>Benutzer Diskussion
9001 </p>
9002 !! end
9003
9004
9005 !! test
9006 Urlencode
9007 !! wikitext
9008 {{urlencode:hi world?!}}
9009 {{urlencode:hi world?!|WIKI}}
9010 {{urlencode:hi world?!|PATH}}
9011 {{urlencode:hi world?!|QUERY}}
9012 !! html
9013 <p>hi+world%3F%21
9014 hi_world%3F!
9015 hi%20world%3F%21
9016 hi+world%3F%21
9017 </p>
9018 !! end
9019
9020 !! test
9021 Magic Word: prioritize type info over data-parsoid
9022 !! options
9023 parsoid=html2wt
9024 !! html
9025 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9026 !! wikitext
9027 __FORCETOC__
9028 !! end
9029
9030 !! test
9031 Magic Word: serialize on separate line (parsoid)
9032 !! options
9033 parsoid=wt2wt,html2wt
9034 !! wikitext
9035 foo
9036 __NOTOC__
9037 bar
9038 !! html
9039 foo<meta property="mw:PageProp/notoc"/>bar
9040 !! end
9041
9042 !! test
9043 Magic Word: rt non-english wikis
9044 !! options
9045 parsoid=wt2wt
9046 language=de
9047 !! wikitext
9048 __NOEDITSECTION__
9049 !! html
9050 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9051 !! end
9052
9053 ###
9054 ### Magic links
9055 ###
9056 !! test
9057 Magic links: internal link to RFC (bug 479)
9058 !! wikitext
9059 [[RFC 123]]
9060 !! html
9061 <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>
9062 </p>
9063 !! end
9064
9065 !! test
9066 Magic links: RFC (bug 479)
9067 !! wikitext
9068 RFC 822
9069 !! html
9070 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9071 </p>
9072 !! end
9073
9074 !! test
9075 Magic links: RFC (bug 65278)
9076 !! wikitext
9077 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9078 !! html
9079 <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.
9080 </p>
9081 !! end
9082
9083 !! test
9084 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9085 !! wikitext
9086 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9087 RFC
9088 822
9089 !! html
9090 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9091 RFC
9092 822
9093 </p>
9094 !! end
9095
9096 !! test
9097 Magic links: ISBN (bug 1937)
9098 !! wikitext
9099 ISBN 0-306-40615-2
9100 !! html
9101 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9102 </p>
9103 !! end
9104
9105 !! test
9106 Magic links: ISBN (bug 65278)
9107 !! wikitext
9108 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9109 !! html/php
9110 <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.
9111 </p>
9112 !! html/parsoid
9113 <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>
9114 !! end
9115
9116 !! test
9117 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9118 !! wikitext
9119 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9120 ISBN
9121 9780316098113
9122 ISBN 978
9123 0316098113
9124 !! html
9125 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9126 ISBN
9127 9780316098113
9128 ISBN 978
9129 0316098113
9130 </p>
9131 !! end
9132
9133 !! test
9134 Magic links: PMID incorrectly converts space to underscore
9135 !! wikitext
9136 PMID 1234
9137 !! html
9138 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9139 </p>
9140 !! end
9141
9142 !! test
9143 Magic links: PMID (bug 65278)
9144 !! wikitext
9145 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9146 !! html
9147 <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.
9148 </p>
9149 !! end
9150
9151 !! test
9152 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9153 !! wikitext
9154 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9155 PMID
9156 1234
9157 !! html
9158 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9159 PMID
9160 1234
9161 </p>
9162 !! end
9163
9164 ###
9165 ### Templates
9166 ####
9167
9168 !! test
9169 Nonexistent template
9170 !! wikitext
9171 {{thistemplatedoesnotexist}}
9172 !! html
9173 <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>
9174 </p>
9175 !! end
9176
9177 !! test
9178 Template with invalid target containing tags
9179 !! wikitext
9180 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9181 !! html
9182 <p>{{a<b>b</b>|foo|a=b|a = b}}
9183 </p>
9184 !! end
9185
9186 !! test
9187 Template with invalid target containing unclosed tag
9188 !! wikitext
9189 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9190 !! html
9191 <p>{{a<b>|foo|a=b|a = b}}</b>
9192 </p>
9193 !! end
9194
9195 !! test
9196 Template with invalid target containing wikilink
9197 !! wikitext
9198 {{[[Main Page]]}}
9199 !! html/php
9200 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9201 </p>
9202 !! html/parsoid
9203 <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>
9204 !! end
9205
9206 !! test
9207 Template with just whitespace in it, bug #68421
9208 !! wikitext
9209 {{echo|{{ }}}}
9210 !! html/parsoid
9211 <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>
9212 !! end
9213
9214 !! article
9215 Template:test
9216 !! text
9217 This is a test template
9218 !! endarticle
9219
9220 !! test
9221 Simple template
9222 !! wikitext
9223 {{test}}
9224 !! html
9225 <p>This is a test template
9226 </p>
9227 !! end
9228
9229 !! test
9230 Template with explicit namespace
9231 !! wikitext
9232 {{Template:test}}
9233 !! html
9234 <p>This is a test template
9235 </p>
9236 !! end
9237
9238
9239 !! article
9240 Template:paramtest
9241 !! text
9242 This is a test template with parameter {{{param}}}
9243 !! endarticle
9244
9245 !! test
9246 Template parameter
9247 !! wikitext
9248 {{paramtest|param=foo}}
9249 !! html
9250 <p>This is a test template with parameter foo
9251 </p>
9252 !! end
9253
9254 !! article
9255 Template:paramtestnum
9256 !! text
9257 [[{{{1}}}|{{{2}}}]]
9258 !! endarticle
9259
9260 !! test
9261 Template unnamed parameter
9262 !! wikitext
9263 {{paramtestnum|Main Page|the main page}}
9264 !! html
9265 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9266 </p>
9267 !! end
9268
9269 !! article
9270 Template:templatesimple
9271 !! text
9272 (test)
9273 !! endarticle
9274
9275 !! article
9276 Template:templateredirect
9277 !! text
9278 #redirect [[Template:templatesimple]]
9279 !! endarticle
9280
9281 !! article
9282 Template:templateasargtestnum
9283 !! text
9284 {{{{{1}}}}}
9285 !! endarticle
9286
9287 !! article
9288 Template:templateasargtest
9289 !! text
9290 {{template{{{templ}}}}}
9291 !! endarticle
9292
9293 !! article
9294 Template:templateasargtest2
9295 !! text
9296 {{{{{templ}}}}}
9297 !! endarticle
9298
9299 !! test
9300 Template with template name as unnamed argument
9301 !! wikitext
9302 {{templateasargtestnum|templatesimple}}
9303 !! html
9304 <p>(test)
9305 </p>
9306 !! end
9307
9308 !! test
9309 Template with template name as argument
9310 !! wikitext
9311 {{templateasargtest|templ=simple}}
9312 !! html
9313 <p>(test)
9314 </p>
9315 !! end
9316
9317 !! test
9318 Template with template name as argument (2)
9319 !! wikitext
9320 {{templateasargtest2|templ=templatesimple}}
9321 !! html
9322 <p>(test)
9323 </p>
9324 !! end
9325
9326 !! article
9327 Template:templateasargtestdefault
9328 !! text
9329 {{{{{templ|templatesimple}}}}}
9330 !! endarticle
9331
9332 !! article
9333 Template:templa
9334 !! text
9335 '''templ'''
9336 !! endarticle
9337
9338 !! test
9339 Template with default value
9340 !! wikitext
9341 {{templateasargtestdefault}}
9342 !! html
9343 <p>(test)
9344 </p>
9345 !! end
9346
9347 !! test
9348 Template with default value (value set)
9349 !! wikitext
9350 {{templateasargtestdefault|templ=templa}}
9351 !! html
9352 <p><b>templ</b>
9353 </p>
9354 !! end
9355
9356 !! test
9357 Template redirect
9358 !! wikitext
9359 {{templateredirect}}
9360 !! html
9361 <p>(test)
9362 </p>
9363 !! end
9364
9365 !! test
9366 Template with argument in separate line
9367 !! wikitext
9368 {{ templateasargtest |
9369 templ = simple }}
9370 !! html
9371 <p>(test)
9372 </p>
9373 !! end
9374
9375 !! test
9376 Template with complex template as argument
9377 !! wikitext
9378 {{paramtest|
9379 param ={{ templateasargtest |
9380 templ = simple }}}}
9381 !! html
9382 <p>This is a test template with parameter (test)
9383 </p>
9384 !! end
9385
9386 !! test
9387 Template with thumb image (with link in description)
9388 !! wikitext
9389 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9390 !! html/php
9391 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>
9392
9393 !! html+tidy
9394 <p>This is a test template with parameter</p>
9395 <div class="thumb tright">
9396 <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>
9397 <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>
9398 </div>
9399 </div>
9400 !! html/parsoid
9401 <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>
9402 !! end
9403
9404 !! article
9405 Template:complextemplate
9406 !! text
9407 {{{1}}} {{paramtest|
9408 param ={{{param}}}}}
9409 !! endarticle
9410
9411 !! test
9412 Template with complex arguments
9413 !! wikitext
9414 {{complextemplate|
9415 param ={{ templateasargtest |
9416 templ = simple }}|[[Template:complextemplate|link]]}}
9417 !! html
9418 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9419 </p>
9420 !! end
9421
9422 !! test
9423 BUG 553: link with two variables in a piped link
9424 !! wikitext
9425 {|
9426 |[[{{{1}}}|{{{2}}}]]
9427 |}
9428 !! html
9429 <table>
9430 <tr>
9431 <td>[[{{{1}}}|{{{2}}}]]
9432 </td></tr></table>
9433
9434 !! end
9435
9436 !! test
9437 Magic variable as template parameter
9438 !! wikitext
9439 {{paramtest|param={{SITENAME}}}}
9440 !! html
9441 <p>This is a test template with parameter MediaWiki
9442 </p>
9443 !! end
9444
9445 !! article
9446 Template:linktest
9447 !! text
9448 [[{{{param}}}|link]]
9449 !! endarticle
9450
9451 !! test
9452 Template parameter as link source
9453 !! wikitext
9454 {{linktest|param=Main Page}}
9455 !! html
9456 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9457 </p>
9458 !! end
9459
9460 !!article
9461 Template:paramtest2
9462 !! text
9463 including another template, {{paramtest|param={{{arg}}}}}
9464 !! endarticle
9465
9466 !! test
9467 Template passing argument to another template
9468 !! wikitext
9469 {{paramtest2|arg='hmm'}}
9470 !! html
9471 <p>including another template, This is a test template with parameter 'hmm'
9472 </p>
9473 !! end
9474
9475 !! article
9476 Template:Linktest2
9477 !! text
9478 Main Page
9479 !! endarticle
9480
9481 !! test
9482 Template as link source
9483 !! wikitext
9484 [[{{linktest2}}]]
9485
9486 [[{{linktest2}}|Main Page]]
9487
9488 [[{{linktest2}}]]Page
9489 !! html
9490 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9491 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9492 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9493 </p>
9494 !! end
9495
9496
9497 !! article
9498 Template:loop1
9499 !! text
9500 {{loop2}}
9501 !! endarticle
9502
9503 !! article
9504 Template:loop2
9505 !! text
9506 {{loop1}}
9507 !! endarticle
9508
9509 !! test
9510 Template infinite loop
9511 !! wikitext
9512 {{loop1}}
9513 !! html
9514 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9515 </p>
9516 !! end
9517
9518 !! test
9519 Template from main namespace
9520 !! wikitext
9521 {{:Main Page}}
9522 !! html
9523 <p>blah blah
9524 </p>
9525 !! end
9526
9527 !! article
9528 Template:table
9529 !! text
9530 {|
9531 | 1 || 2
9532 |-
9533 | 3 || 4
9534 |}
9535 !! endarticle
9536
9537 !! test
9538 BUG 529: Template with table, not included at beginning of line
9539 !! wikitext
9540 foo {{table}}
9541 !! html
9542 <p>foo
9543 </p>
9544 <table>
9545 <tr>
9546 <td> 1 </td>
9547 <td> 2
9548 </td></tr>
9549 <tr>
9550 <td> 3 </td>
9551 <td> 4
9552 </td></tr></table>
9553
9554 !! end
9555
9556 !! test
9557 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9558 !! wikitext
9559 foo
9560 {{table}}
9561 !! html
9562 <p>foo
9563 </p>
9564 <table>
9565 <tr>
9566 <td> 1 </td>
9567 <td> 2
9568 </td></tr>
9569 <tr>
9570 <td> 3 </td>
9571 <td> 4
9572 </td></tr></table>
9573
9574 !! end
9575
9576 !! test
9577 BUG 41: Template parameters shown as broken links
9578 !! wikitext
9579 {{{parameter}}}
9580 !! html
9581 <p>{{{parameter}}}
9582 </p>
9583 !! end
9584
9585 !! test
9586 Template with targets containing wikilinks
9587 !! wikitext
9588 {{[[foo]]}}
9589
9590 {{[[{{echo|foo}}]]}}
9591
9592 {{{{echo|[[foo}}]]}}
9593 !! html
9594 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9595 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9596 </p><p>{{[[foo}}]]
9597 </p>
9598 !! end
9599
9600 !! article
9601 Template:MSGNW test
9602 !! text
9603 ''None'' of '''this''' should be
9604 * interpreted
9605 but rather passed unmodified
9606 {{test}}
9607 <gallery>
9608 File:Foobar.jpg
9609 </gallery>
9610 !! endarticle
9611
9612 # hmm, fix this or just deprecate msgnw and document its behavior?
9613 !! test
9614 msgnw keyword
9615 !! wikitext
9616 {{msgnw:MSGNW test}}
9617 !! html
9618 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9619 &#42; interpreted
9620 &#32;but rather passed unmodified
9621 &#123;&#123;test&#125;&#125;
9622 &#60;gallery&#62;
9623 File:Foobar.jpg
9624 &#60;/gallery&#62;
9625 </p>
9626 !! end
9627
9628 !! test
9629 int keyword
9630 !! wikitext
9631 {{int:youhavenewmessages|lots of money|not!}}
9632 !! html
9633 <p>You have lots of money (not!).
9634 </p>
9635 !! end
9636
9637 !! article
9638 Template:Includes
9639 !! text
9640 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9641 !! endarticle
9642
9643 !! test
9644 <includeonly> and <noinclude> being included
9645 !! wikitext
9646 {{Includes}}
9647 !! html
9648 <p>Foobar
9649 </p>
9650 !! end
9651
9652 !! article
9653 Template:Includes2
9654 !! text
9655 <onlyinclude>Foo</onlyinclude>bar
9656 !! endarticle
9657
9658 !! test
9659 <onlyinclude> being included
9660 !! wikitext
9661 {{Includes2}}
9662 !! html
9663 <p>Foo
9664 </p>
9665 !! end
9666
9667
9668 !! article
9669 Template:Includes3
9670 !! text
9671 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9672 !! endarticle
9673
9674 !! test
9675 <onlyinclude> and <includeonly> being included
9676 !! wikitext
9677 {{Includes3}}
9678 !! html
9679 <p>Foo
9680 </p>
9681 !! end
9682
9683 !! test
9684 <includeonly> and <noinclude> on a page
9685 !! wikitext
9686 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9687 !! html
9688 <p>Foozar
9689 </p>
9690 !! end
9691
9692 !! test
9693 Un-closed <noinclude>
9694 !! wikitext
9695 <noinclude>
9696 !! html
9697 !! end
9698
9699 !! test
9700 <onlyinclude> on a page
9701 !! wikitext
9702 <onlyinclude>Foo</onlyinclude>bar
9703 !! html
9704 <p>Foobar
9705 </p>
9706 !! end
9707
9708 !! test
9709 Un-closed <onlyinclude>
9710 !! wikitext
9711 <onlyinclude>
9712 !! html
9713 !! end
9714
9715 !!test
9716 Self-closed noinclude, includeonly, onlyinclude tags
9717 !! wikitext
9718 <noinclude />
9719 <includeonly />
9720 <onlyinclude />
9721 !! html
9722 <p><br />
9723 </p>
9724 !!end
9725
9726 !!test
9727 Unbalanced includeonly and noinclude tags
9728 !! wikitext
9729 {|
9730 |a</noinclude>
9731 |b</noinclude></noinclude>
9732 |c</noinclude></includeonly>
9733 |d</includeonly></includeonly>
9734 |}
9735 !! html
9736 <table>
9737 <tr>
9738 <td>a
9739 </td>
9740 <td>b
9741 </td>
9742 <td>c&lt;/includeonly&gt;
9743 </td>
9744 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9745 </td></tr></table>
9746
9747 !!end
9748
9749 !! article
9750 Template:Includeonly section
9751 !! text
9752 <includeonly>
9753 ==Includeonly section==
9754 </includeonly>
9755 ==Section T-1==
9756 !!endarticle
9757
9758 !! test
9759 Bug 6563: Edit link generation for section shown by <includeonly>
9760 !! wikitext
9761 {{includeonly section}}
9762 !! html
9763 <h2><a href="#Includeonly_section" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9764 <h2><a href="#Section_T-1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9765
9766 !! end
9767
9768 # Uses same input as the contents of [[Template:Includeonly section]]
9769 !! test
9770 Bug 6563: Section extraction for section shown by <includeonly>
9771 !! options
9772 section=T-2
9773 !! wikitext
9774 <includeonly>
9775 ==Includeonly section==
9776 </includeonly>
9777 ==Section T-2==
9778 !! html
9779 ==Section T-2==
9780 !! end
9781
9782 !! test
9783 Bug 6563: Edit link generation for section suppressed by <includeonly>
9784 !! wikitext
9785 <includeonly>
9786 ==Includeonly section==
9787 </includeonly>
9788 ==Section 1==
9789 !! html
9790 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9791
9792 !! end
9793
9794 !! test
9795 Bug 6563: Section extraction for section suppressed by <includeonly>
9796 !! options
9797 section=1
9798 !! wikitext
9799 <includeonly>
9800 ==Includeonly section==
9801 </includeonly>
9802 ==Section 1==
9803 !! html
9804 ==Section 1==
9805 !! end
9806
9807 !! test
9808 Un-closed <includeonly>
9809 !! wikitext
9810 <includeonly>
9811 !! html
9812 !! end
9813
9814 !! test
9815 Includes and comments at SOL
9816 !! wikitext
9817 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9818
9819 <noinclude>
9820 some
9821 </noinclude>* stuff
9822 * here
9823
9824 <includeonly>can have stuff</includeonly>=== here ===
9825
9826 !! html/php
9827 <h2><a href="#hu" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="hu">hu</span></h2>
9828 <p>some
9829 </p>
9830 <ul><li> stuff</li>
9831 <li> here</li></ul>
9832 <h3><a href="#here" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="here">here</span></h3>
9833
9834 !! html/parsoid
9835 <!-- 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>
9836
9837 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9838 <p>some</p>
9839 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9840 <li> here</li></ul>
9841
9842 <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>
9843
9844 !! end
9845
9846 # TODO: test with DOM fragment reuse!
9847 !! test
9848 Parsoid: DOM fragment reuse
9849 !! options
9850 parsoid=wt2wt,wt2html
9851 !! wikitext
9852 a{{echo|b<table></table>c}}d
9853
9854 a{{echo|b
9855 <table></table>
9856 c}}d
9857
9858 {{echo|a
9859
9860 <table></table>
9861
9862 b}}
9863 !! html
9864 <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>
9865
9866 <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">
9867 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9868 </span><p about="#mwt2">cd</p>
9869
9870 <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">
9871
9872 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9873
9874 </span><p about="#mwt3">b</p>
9875 !! end
9876
9877 !! test
9878 Parsoid: Merge double tds (bug 50603)
9879 !! options
9880 parsoid
9881 !! wikitext
9882 {|
9883 |{{echo|{{!}} foo}}
9884 |}
9885 !! html
9886 <table><tbody>
9887 <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>
9888 </tbody></table>
9889 !! end
9890
9891 !! test
9892 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9893 !! options
9894 parsoid
9895 !! wikitext
9896 {{echo|<div>}}
9897 {|
9898 |{{echo|{{!}} foo}}
9899 |}
9900 {{echo|</div>}}
9901 !! html
9902 <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}}]}'>
9903 <table><tbody>
9904 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9905 </tbody></table>
9906 </div>
9907 !! end
9908
9909 ###
9910 ### <includeonly> and <noinclude> in attributes
9911 ###
9912 !!test
9913 0. includeonly around the entire attribute
9914 !! wikitext
9915 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9916 !! html
9917 <p><span id="v2">bar</span>
9918 </p>
9919 !!end
9920
9921 !!test
9922 1. includeonly in html attr key
9923 !! wikitext
9924 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9925 !! html
9926 <p><span id="foo">bar</span>
9927 </p>
9928 !!end
9929
9930 !!test
9931 2. includeonly in html attr value
9932 !! wikitext
9933 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9934 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9935 !! html
9936 <p><span id="v1">bar</span>
9937 <span id="v1">bar</span>
9938 </p>
9939 !!end
9940
9941 !!test
9942 3. includeonly in part of an attr value
9943 !! wikitext
9944 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9945 !! html
9946 <p><span style="color:red;">bar</span>
9947 </p>
9948 !!end
9949
9950 !!test
9951 4. includeonly in table attributes
9952 !! wikitext
9953 {|
9954 |- <noinclude>
9955 |-
9956 |a
9957 </noinclude>
9958 |- <includeonly>
9959 |-
9960 |b
9961 </includeonly>
9962 |}
9963 !! html
9964 <table>
9965
9966
9967 <tr>
9968 <td>a
9969 </td></tr>
9970 </table>
9971
9972 !!end
9973
9974 ###
9975 ### Token Stream Patcher tests
9976 ###
9977 ### These tests won't always pass wt2wt and other modes because
9978 ### on serialization, the table will be output on a new line.
9979 ### For now, we are blacklisting them, and using this to test selser.
9980 ###
9981
9982 !!test
9983 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9984 !!options
9985 parsoid=wt2html,wt2wt
9986 !!wikitext
9987 {{echo|}}{| width = '100%'
9988 |foo
9989 |}
9990 !!html/parsoid
9991 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9992 <tbody><tr><td>foo</td></tr>
9993 </tbody></table>
9994 !!end
9995
9996 !!test
9997 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9998 !!options
9999 parsoid=wt2html,wt2wt
10000 !!wikitext
10001 <includeonly>a</includeonly>{| {{{b}}}
10002 |c
10003 |}
10004 !!html/parsoid
10005 <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}}}":""}}'>
10006 <tbody><tr><td>c</td></tr>
10007 </tbody></table>
10008
10009 !!end
10010
10011 ###
10012 ### Testing parsing of templates where a template arg
10013 ### has the same name as the template itself.
10014 ###
10015
10016 !! article
10017 Template:quote
10018 !! text
10019 {{{quote|{{{1}}}}}}
10020 !! endarticle
10021
10022 !!test
10023 Templates: Template Name/Arg clash: 1. Use of positional param
10024 !! wikitext
10025 {{quote|foo}}
10026 !! html
10027 <p>foo
10028 </p>
10029 !!end
10030
10031 !!test
10032 Templates: Template Name/Arg clash: 2. Use of named param
10033 !! wikitext
10034 {{quote|quote=foo}}
10035 !! html
10036 <p>foo
10037 </p>
10038 !!end
10039
10040 !!test
10041 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10042 !! wikitext
10043 {{quote|quote}}
10044 !! html
10045 <p>quote
10046 </p>
10047 !!end
10048
10049 ###
10050 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10051 ###
10052
10053 !!test
10054 Templates: 1. Simple use
10055 !! wikitext
10056 {{echo|Foo}}
10057 !! html
10058 <p>Foo
10059 </p>
10060 !!end
10061
10062 !!test
10063 Templates: 2. Inside a block tag
10064 !! wikitext
10065 <div>{{echo|Foo}}</div>
10066 <blockquote>{{echo|Foo}}</blockquote>
10067 !! html
10068 <div>Foo</div>
10069 <blockquote>Foo</blockquote>
10070
10071 !! html+tidy
10072 <div>Foo</div>
10073 <blockquote>
10074 <p>Foo</p>
10075 </blockquote>
10076 !!end
10077
10078 !!test
10079 Templates: P-wrapping: 1a. Templates on consecutive lines
10080 !! wikitext
10081 {{echo|Foo}}
10082 {{echo|bar}}
10083 !! html
10084 <p>Foo
10085 bar
10086 </p>
10087 !!end
10088
10089 !!test
10090 Templates: P-wrapping: 1b. Templates on consecutive lines
10091 !! wikitext
10092 Foo
10093
10094 {{echo|bar}}
10095 {{echo|baz}}
10096 !! html
10097 <p>Foo
10098 </p><p>bar
10099 baz
10100 </p>
10101 !!end
10102
10103 !!test
10104 Templates: P-wrapping: 1c. Templates on consecutive lines
10105 !! wikitext
10106 {{echo|Foo}}
10107 {{echo|bar}} <div>baz</div>
10108 !! html
10109 <p>Foo
10110 </p>
10111 bar <div>baz</div>
10112
10113 !! html+tidy
10114 <p>Foo</p>
10115 <p>bar</p>
10116 <div>baz</div>
10117 !! end
10118
10119 !!test
10120 Templates: P-wrapping: 1d. Template preceded by comment-only line
10121 !!options
10122 parsoid
10123 !! wikitext
10124 <!-- foo -->
10125 {{echo|Bar}}
10126 !! html
10127 <!-- foo -->
10128
10129 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10130 !!end
10131
10132 !!test
10133 Templates: Inline Text: 1. Multiple template uses
10134 !! wikitext
10135 {{echo|Foo}}bar{{echo|baz}}
10136 !! html
10137 <p>Foobarbaz
10138 </p>
10139 !!end
10140
10141 !!test
10142 Templates: Inline Text: 2. Back-to-back template uses
10143 !! wikitext
10144 {{echo|Foo}}{{echo|bar}}
10145 !! html
10146 <p>Foobar
10147 </p>
10148 !!end
10149
10150 !!test
10151 Templates: Block Tags: 1. Multiple template uses
10152 !! wikitext
10153 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10154 !! html
10155 <div>Foo</div><div>bar</div><div>baz</div>
10156
10157 !!end
10158
10159 !!test
10160 Templates: Block Tags: 2. Back-to-back template uses
10161 !! wikitext
10162 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10163 !! html
10164 <div>Foo</div><div>bar</div>
10165
10166 !!end
10167
10168 # This is an edge case relating to paragraph wrapping.
10169 !!test
10170 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10171 !! wikitext
10172 {{echo|a
10173 b</p>}}
10174 !! html/parsoid
10175 <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
10176 b</p>
10177 !!end
10178
10179 !!test
10180 Templates: Links: 1. Simple example
10181 !! wikitext
10182 {{echo|[[Foo|bar]]}}
10183 !! html
10184 <p><a href="/wiki/Foo" title="Foo">bar</a>
10185 </p>
10186 !!end
10187
10188 !!test
10189 Templates: Links: 2. Generation of link href
10190 !! wikitext
10191 [[{{echo|Foo}}|bar]]
10192 !! html
10193 <p><a href="/wiki/Foo" title="Foo">bar</a>
10194 </p>
10195 !!end
10196
10197 !!test
10198 Templates: Links: 3. Generation of part of a link href
10199 !! wikitext
10200 [[Fo{{echo|o}}|bar]]
10201
10202 [[Foo{{echo|bar}}]]
10203
10204 [[Foo{{echo|bar}}baz]]
10205
10206 [[Foo{{echo|bar}}|bar]]
10207
10208 [[:Foo{{echo|bar}}]]
10209
10210 [[:Foo{{echo|bar}}|bar]]
10211 !! html
10212 <p><a href="/wiki/Foo" title="Foo">bar</a>
10213 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10214 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10215 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10216 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10217 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10218 </p>
10219 !!end
10220
10221 !!test
10222 Templates: Links: 4. Multiple templates generating link href
10223 !! wikitext
10224 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10225 !! html
10226 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10227 </p>
10228 !!end
10229
10230 !!test
10231 Templates: Links: 5. Generation of link text
10232 !! wikitext
10233 [[Foo|{{echo|bar}}]]
10234 !! html
10235 <p><a href="/wiki/Foo" title="Foo">bar</a>
10236 </p>
10237 !!end
10238
10239 !!test
10240 Templates: Links: 5. Nested templates (only outermost template should be marked)
10241 !! wikitext
10242 {{echo|[[{{echo|Foo}}|bar]]}}
10243 !! html
10244 <p><a href="/wiki/Foo" title="Foo">bar</a>
10245 </p>
10246 !!end
10247
10248 !!test
10249 Templates: HTML Tag: 1. Generation of HTML attr. key
10250 !! wikitext
10251 <div {{echo|style}}="color:red;">foo</div>
10252 !! html
10253 <div style="color:red;">foo</div>
10254
10255 !!end
10256
10257 !!test
10258 Templates: HTML Tag: 2. Generation of HTML attr. value
10259 !! wikitext
10260 <div style={{echo|'color:red;'}}>foo</div>
10261 !! html
10262 <div style="color:red;">foo</div>
10263
10264 !!end
10265
10266 !!test
10267 Templates: HTML Tag: 3. Generation of HTML attr key and value
10268 !! wikitext
10269 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10270 !! html
10271 <div style="color:red;">foo</div>
10272
10273 !!end
10274
10275 !!test
10276 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10277 !! wikitext
10278 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10279 !! html
10280 <div title="This is a long title with just one piece templated">foo</div>
10281
10282 !!end
10283
10284 !!test
10285 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10286 !! wikitext
10287 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10288 !! html
10289 <div title="This is a long title with just one piece templated">foo</div>
10290
10291 !!end
10292
10293 !!test
10294 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10295 !! wikitext
10296 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10297 !! html
10298 <div title="This is a long title with just one piece templated">foo</div>
10299
10300 !!end
10301
10302 # SSS FIXME: While it is great we added support for all this,
10303 # do we want to make this part of the spec? Maybe we want to
10304 # deprecate this kind of usage in the future?
10305 !!test
10306 Templates: HTML Tag: 7. Generation of partial attribute key string
10307 !! wikitext
10308 <div st{{echo|yle}}="color:red;">foo</div>
10309 !! html
10310 <div style="color:red;">foo</div>
10311
10312 !!end
10313
10314 !! test
10315 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10316 !! wikitext
10317 <div {{echo|1=id="v1"}}>bar</div>
10318 !! html
10319 <div id="v1">bar</div>
10320
10321 !!end
10322
10323 !! test
10324 Templates: HTML Tag: 9. Multiple template-generated attributes
10325 !! wikitext
10326 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10327 !! html
10328 <div id="v1" title="foo">bar</div>
10329
10330 !!end
10331
10332 !! test
10333 Templates: Support for templates generating attributes and content
10334 !! wikitext
10335 {| {{mixed_attr_content_template}}
10336 |-
10337 |bar
10338 |}
10339 !! html/php
10340 <table style="color:red;" title="T48811">
10341
10342 <tr>
10343 <td>foo
10344 </td></tr>
10345 <tr>
10346 <td>bar
10347 </td></tr></table>
10348
10349 !! html/parsoid
10350 <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|}"]}'>
10351 <tbody><tr>
10352 <td>foo</td></tr>
10353 <tr>
10354 <td>bar</td></tr>
10355 </tbody></table>
10356 !!end
10357
10358 !!test
10359 Templates: HTML Tables: 1. Generating start of a HTML table
10360 !! wikitext
10361 {{echo|<table><tr><td>foo</td>}}</tr></table>
10362 !! html
10363 <table><tr><td>foo</td></tr></table>
10364
10365 !!end
10366
10367 !!test
10368 Templates: HTML Tables: 2a. Generating middle of a HTML table
10369 !! wikitext
10370 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10371 !! html
10372 <table><tr><td>foo</td></tr></table>
10373
10374 !!end
10375
10376 !!test
10377 Templates: HTML Tables: 2b. Generating middle of a HTML table
10378 !! wikitext
10379 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10380 !! html
10381 <table><tr><td>foo</td></tr></table>
10382
10383 !!end
10384
10385 !!test
10386 Templates: HTML Tables: 3. Generating end of a HTML table
10387 !! wikitext
10388 <table><tr>{{echo|<td>foo</td></tr></table>}}
10389 !! html
10390 <table><tr><td>foo</td></tr></table>
10391
10392 !!end
10393
10394 !!test
10395 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10396 !! wikitext
10397 {{echo|<table>}}<tr><td>foo</td></tr></table>
10398 !! html
10399 <table><tr><td>foo</td></tr></table>
10400
10401 !!end
10402
10403 !!test
10404 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10405 !! wikitext
10406 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10407 !! html
10408 <table><tr><td>foo</td></tr></table>
10409
10410 !!end
10411
10412 !!test
10413 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10414 !! wikitext
10415 <table><tr>{{echo|<td>}}foo</td></tr></table>
10416 !! html
10417 <table><tr><td>foo</td></tr></table>
10418
10419 !!end
10420
10421 !!test
10422 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10423 !! wikitext
10424 <table><tr><td>foo{{echo|</td>}}</tr></table>
10425 !! html
10426 <table><tr><td>foo</td></tr></table>
10427
10428 !!end
10429
10430 !!test
10431 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10432 !! wikitext
10433 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10434 !! html
10435 <table><tr><td>foo</td></tr></table>
10436
10437 !!end
10438
10439 !!test
10440 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10441 !! wikitext
10442 <table><tr><td>foo</td></tr>{{echo|</table>}}
10443 !! html
10444 <table><tr><td>foo</td></tr></table>
10445
10446 !!end
10447
10448 !!test
10449 Templates: HTML Tables: 5. Proper fostering of categories from inside
10450 !!options
10451 parsoid=wt2html,wt2wt
10452 !! wikitext
10453 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10454 <!--Two categories (Bug 50330)-->
10455 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10456 !! html
10457 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10458 <!--Two categories (Bug 50330)-->
10459 <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>
10460 !!end
10461
10462 !!test
10463 Templates: Wiki Tables: 1a. Fostering of entire template content
10464 !! wikitext
10465 {|
10466 {{echo|a}}
10467 |}
10468 !! html
10469 <table>
10470 a
10471 <tr><td></td></tr></table>
10472
10473 !! html+tidy
10474 <p>a</p>
10475 <table>
10476 <tr>
10477 <td></td>
10478 </tr>
10479 </table>
10480 !! end
10481
10482 !!test
10483 Templates: Wiki Tables: 1b. Fostering of entire template content
10484 !! wikitext
10485 {|
10486 {{echo|<div>}}
10487 foo
10488 {{echo|</div>}}
10489 |}
10490 !! html
10491 <table>
10492 <div>
10493 <p>foo
10494 </p>
10495 </div>
10496 <tr><td></td></tr></table>
10497
10498 !! html+tidy
10499 <div>
10500 <p>foo</p>
10501 </div>
10502 <table>
10503 <tr>
10504 <td></td>
10505 </tr>
10506 </table>
10507 !! end
10508
10509 !!test
10510 Templates: Wiki Tables: 2. Fostering of partial template content
10511 !! wikitext
10512 {|
10513 {{echo|a
10514 <div>b</div>}}
10515 |}
10516 !! html
10517 <table>
10518 a
10519 <div>b</div>
10520 <tr><td></td></tr></table>
10521
10522 !! html+tidy
10523 <p>a</p>
10524 <div>b</div>
10525 <table>
10526 <tr>
10527 <td></td>
10528 </tr>
10529 </table>
10530 !! end
10531
10532 !!test
10533 Templates: Wiki Tables: 3. td-content via multiple templates
10534 !! wikitext
10535 {|
10536 {{echo|{{pipe}}a}}{{echo|b}}
10537 |}
10538 !! html
10539 <table>
10540 <tr>
10541 <td>ab
10542 </td></tr></table>
10543
10544 !!end
10545
10546 !!test
10547 Templates: Wiki Tables: 4. Templated tags, no content
10548 !! wikitext
10549 {{tbl-start}}
10550 {{tbl-end}}
10551 !! html
10552 <table>
10553 <tr><td></td></tr></table>
10554
10555 !!end
10556
10557 !!test
10558 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10559 !! wikitext
10560 {{tbl-start}}
10561 |foo
10562 {{tbl-end}}
10563 !! html
10564 <table>
10565 <tr>
10566 <td>foo
10567 </td></tr></table>
10568
10569 !!end
10570
10571 !!test
10572 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10573 !! wikitext
10574 {{tbl-start}}
10575 {{!}}foo
10576 {{tbl-end}}
10577 !! html
10578 <table>
10579 <tr>
10580 <td>foo
10581 </td></tr></table>
10582
10583 !!end
10584
10585 !!test
10586 Templates: Lists: Multi-line list-items via templates
10587 !! wikitext
10588 *{{echo|a {{nonexistent|
10589 unused}}}}
10590 *{{echo|b {{nonexistent|
10591 unused}}}}
10592 !! html
10593 <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>
10594 <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>
10595
10596 !!end
10597
10598 !!test
10599 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10600 !! wikitext
10601 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10602 !! html
10603 <p><i>ab</i>c<i>d</i>e
10604 </p>
10605 !!end
10606
10607 !!test
10608 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10609 (PHP parser generates misnested html)
10610 !! wikitext
10611 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10612 !! html/parsoid
10613 <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>
10614 !!end
10615
10616 !!test
10617 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10618 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10619 !! options
10620 parsoid=wt2html,wt2wt
10621 !! wikitext
10622 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10623 !! html
10624 <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>
10625 <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>
10626 <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>
10627 !!end
10628
10629 !!test
10630 Templates: Ugly nesting: 4. Divs opened/closed across templates
10631 !! wikitext
10632 a<div>b{{echo|c</div>d}}e
10633 !! html
10634 a<div>bc</div>de
10635
10636 !! html+tidy
10637 <p>a</p>
10638 <div>bc</div>
10639 <p>de</p>
10640 !! end
10641
10642 !!test
10643 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10644 (Parsoid-centric)
10645 !! options
10646 parsoid
10647 !! wikitext
10648 {|
10649 |{{echo|foo</table>}}
10650 |bar
10651 |}
10652 !! html
10653 <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|}"]}'>
10654
10655 <tbody>
10656 <tr>
10657 <td>foo</td></tr></tbody></table><span about="#mwt1">
10658 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10659 |}</span>
10660 !!end
10661
10662 !!test
10663 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10664 (Parsoid-centric)
10665 !! options
10666 parsoid
10667 !! wikitext
10668 <table>
10669 <tr>
10670 <td>
10671 <table>
10672 <tr>
10673 <td>1. {{echo|foo </table>}}</td>
10674 <td> bar </td>
10675 <td>2. {{echo|baz </table>}}</td>
10676 </tr>
10677 <tr>
10678 <td>abc</td>
10679 </tr>
10680 </table>
10681 </td>
10682 </tr>
10683 <tr>
10684 <td>xyz</td>
10685 </tr>
10686 </table>
10687 !! html
10688 <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>"]}'>
10689 <tbody><tr>
10690 <td>
10691 <table>
10692 <tbody><tr>
10693 <td>1. foo </td></tr></tbody></table></td>
10694 <td> bar </td>
10695 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10696 </span><span about="#mwt2">
10697 </span><span about="#mwt2">
10698 </span><span about="#mwt2">abc</span><span about="#mwt2">
10699 </span><span about="#mwt2">
10700 </span><span about="#mwt2">
10701 </span><span about="#mwt2">
10702 </span><span about="#mwt2">
10703 </span><span about="#mwt2">
10704 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10705 </span><span about="#mwt2">
10706 </span>
10707 !!end
10708
10709 !! test
10710 Templates: Ugly templates: 3. newline-only template parameter
10711 !! wikitext
10712 foo {{echo|
10713 }}
10714 !! html
10715 <p>foo
10716 </p>
10717 !! end
10718
10719 # This looks like a bug: a single newline triggers p/br for some reason.
10720 !! test
10721 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10722 !! wikitext
10723 {{echo|
10724 }}
10725 !! html
10726 <p><br />
10727 </p>
10728 !! end
10729
10730 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10731 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10732 !! test
10733 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10734 !! wikitext
10735 {{echo|<table>}}
10736 {{echo|<div>foo}}
10737 {{echo|</table>}}
10738 !! html/parsoid
10739 <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
10740 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10741 </table>
10742 !! end
10743
10744 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10745 # that are "identical" and generate nesting cycles in the algorithm
10746 !! test
10747 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10748 !! wikitext
10749 {{echo|<table><tr><td><table>}}
10750 {{echo|<div>}}
10751 {{echo|</div>}}
10752 !! html/parsoid
10753 <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"}'>
10754 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10755 </table></td></tr></tbody></table>
10756 !! end
10757
10758 !!test
10759 Parser Functions: 1. Simple example
10760 !! wikitext
10761 {{uc:foo}}
10762 !! html
10763 <p>FOO
10764 </p>
10765 !!end
10766
10767 !!test
10768 Parser Functions: 2. Nested use (only outermost should be marked up)
10769 !! wikitext
10770 {{uc:{{lc:FOO}}}}
10771 !! html
10772 <p>FOO
10773 </p>
10774 !!end
10775
10776 ###
10777 ### Pre-save transform tests
10778 ###
10779 !! test
10780 pre-save transform: subst:
10781 !! options
10782 PST
10783 !! wikitext
10784 {{subst:test}}
10785 !! html
10786 This is a test template
10787 !! end
10788
10789 !! test
10790 pre-save transform: normal template
10791 !! options
10792 PST
10793 !! wikitext
10794 {{test}}
10795 !! html
10796 {{test}}
10797 !! end
10798
10799 !! test
10800 pre-save transform: nonexistent template
10801 !! options
10802 PST
10803 !! wikitext
10804 {{thistemplatedoesnotexist}}
10805 !! html
10806 {{thistemplatedoesnotexist}}
10807 !! end
10808
10809
10810 !! test
10811 pre-save transform: subst magic variables
10812 !! options
10813 PST
10814 !! wikitext
10815 {{subst:SITENAME}}
10816 !! html
10817 MediaWiki
10818 !! end
10819
10820 # This is bug 89, which I fixed. -- wtm
10821 !! test
10822 pre-save transform: subst: templates with parameters
10823 !! options
10824 pst
10825 !! wikitext
10826 {{subst:paramtest|param="something else"}}
10827 !! html
10828 This is a test template with parameter "something else"
10829 !! end
10830
10831 !! article
10832 Template:nowikitest
10833 !! text
10834 <nowiki>'''not wiki'''</nowiki>
10835 !! endarticle
10836
10837 !! test
10838 pre-save transform: nowiki in subst (bug 1188)
10839 !! options
10840 pst
10841 !! wikitext
10842 {{subst:nowikitest}}
10843 !! html
10844 <nowiki>'''not wiki'''</nowiki>
10845 !! end
10846
10847
10848 !! article
10849 Template:commenttest
10850 !! text
10851 This template has <!-- a comment --> in it.
10852 !! endarticle
10853
10854 !! test
10855 pre-save transform: comment in subst (bug 1936)
10856 !! options
10857 pst
10858 !! wikitext
10859 {{subst:commenttest}}
10860 !! html
10861 This template has <!-- a comment --> in it.
10862 !! end
10863
10864 !! test
10865 pre-save transform: unclosed tag
10866 !! options
10867 pst noxml
10868 !! wikitext
10869 <nowiki>'''not wiki'''
10870 !! html
10871 <nowiki>'''not wiki'''
10872 !! end
10873
10874 !! test
10875 pre-save transform: mixed tag case
10876 !! options
10877 pst noxml
10878 !! wikitext
10879 <NOwiki>'''not wiki'''</noWIKI>
10880 !! html
10881 <NOwiki>'''not wiki'''</noWIKI>
10882 !! end
10883
10884 !! test
10885 pre-save transform: unclosed comment in <nowiki>
10886 !! options
10887 pst noxml
10888 !! wikitext
10889 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10890 !! html
10891 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10892 !!end
10893
10894 # Leading @ in this template definition works around a limitation
10895 # in parsoid's parserTests which otherwise strips the <span> from the
10896 # result (confusing it for a template wrapper)
10897 !! article
10898 Template:dangerous
10899 !!text
10900 @<span onmouseover="alert('crap')">Oh no</span>
10901 !!endarticle
10902
10903 !!test
10904 (confirming safety of fix for subst bug 1936)
10905 !! wikitext
10906 {{Template:dangerous}}
10907 !! html
10908 <p>@<span>Oh no</span>
10909 </p>
10910 !! end
10911
10912 !! test
10913 pre-save transform: comment containing gallery (bug 5024)
10914 !! options
10915 pst
10916 !! wikitext
10917 <!-- <gallery>data</gallery> -->
10918 !! html
10919 <!-- <gallery>data</gallery> -->
10920 !!end
10921
10922 !! test
10923 pre-save transform: comment containing extension
10924 !! options
10925 pst
10926 !! wikitext
10927 <!-- <tag>data</tag> -->
10928 !! html
10929 <!-- <tag>data</tag> -->
10930 !!end
10931
10932 !! test
10933 pre-save transform: comment containing nowiki
10934 !! options
10935 pst
10936 !! wikitext
10937 <!-- <nowiki>data</nowiki> -->
10938 !! html
10939 <!-- <nowiki>data</nowiki> -->
10940 !!end
10941
10942 !! test
10943 pre-save transform: <noinclude> in subst (bug 3298)
10944 !! options
10945 pst
10946 !! wikitext
10947 {{subst:Includes}}
10948 !! html
10949 Foobar
10950 !! end
10951
10952 !! test
10953 pre-save transform: <onlyinclude> in subst (bug 3298)
10954 !! options
10955 pst
10956 !! wikitext
10957 {{subst:Includes2}}
10958 !! html
10959 Foo
10960 !! end
10961
10962 !! article
10963 Template:SubstTest
10964 !!text
10965 {{<includeonly>subst:</includeonly>Includes}}
10966 !! endarticle
10967
10968 !! article
10969 Template:SafeSubstTest
10970 !! text
10971 {{<includeonly>safesubst:</includeonly>Includes}}
10972 !! endarticle
10973
10974 !! test
10975 bug 22297: safesubst: works during PST
10976 !! options
10977 pst
10978 !! wikitext
10979 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10980 !! html
10981 FoobarFoobar
10982 !! end
10983
10984 !! test
10985 bug 22297: safesubst: works during normal parse
10986 !! wikitext
10987 {{SafeSubstTest}}
10988 !! html
10989 <p>Foobar
10990 </p>
10991 !! end
10992
10993 !! test
10994 subst: does not work during normal parse
10995 !! wikitext
10996 {{SubstTest}}
10997 !! html
10998 <p>{{subst:Includes}}
10999 </p>
11000 !! end
11001
11002 !! test
11003 pre-save transform: context links ("pipe trick")
11004 !! options
11005 pst
11006 !! wikitext
11007 [[Article (context)|]]
11008 [[Bar:Article|]]
11009 [[:Bar:Article|]]
11010 [[Bar:Article (context)|]]
11011 [[:Bar:Article (context)|]]
11012 [[|Article]]
11013 [[|Article (context)]]
11014 [[Bar:X (Y) Z|]]
11015 [[:Bar:X (Y) Z|]]
11016 !! html
11017 [[Article (context)|Article]]
11018 [[Bar:Article|Article]]
11019 [[:Bar:Article|Article]]
11020 [[Bar:Article (context)|Article]]
11021 [[:Bar:Article (context)|Article]]
11022 [[Article]]
11023 [[Article (context)]]
11024 [[Bar:X (Y) Z|X (Y) Z]]
11025 [[:Bar:X (Y) Z|X (Y) Z]]
11026 !! end
11027
11028 !! test
11029 pre-save transform: context links ("pipe trick") with interwiki prefix
11030 !! options
11031 pst
11032 !! wikitext
11033 [[interwiki:Article|]]
11034 [[:interwiki:Article|]]
11035 [[interwiki:Bar:Article|]]
11036 [[:interwiki:Bar:Article|]]
11037 !! html
11038 [[interwiki:Article|Article]]
11039 [[:interwiki:Article|Article]]
11040 [[interwiki:Bar:Article|Bar:Article]]
11041 [[:interwiki:Bar:Article|Bar:Article]]
11042 !! end
11043
11044 !! test
11045 pre-save transform: context links ("pipe trick") with parens in title
11046 !! options
11047 pst title=[[Somearticle (context)]]
11048 !! wikitext
11049 [[|Article]]
11050 !! html
11051 [[Article (context)|Article]]
11052 !! end
11053
11054 !! test
11055 pre-save transform: context links ("pipe trick") with comma in title
11056 !! options
11057 pst title=[[Someplace, Somewhere]]
11058 !! wikitext
11059 [[|Otherplace]]
11060 [[Otherplace, Elsewhere|]]
11061 [[Otherplace, Elsewhere, Anywhere|]]
11062 !! html
11063 [[Otherplace, Somewhere|Otherplace]]
11064 [[Otherplace, Elsewhere|Otherplace]]
11065 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11066 !! end
11067
11068 !! test
11069 pre-save transform: context links ("pipe trick") with parens and comma
11070 !! options
11071 pst title=[[Someplace (IGNORED), Somewhere]]
11072 !! wikitext
11073 [[|Otherplace]]
11074 [[Otherplace (place), Elsewhere|]]
11075 !! html
11076 [[Otherplace, Somewhere|Otherplace]]
11077 [[Otherplace (place), Elsewhere|Otherplace]]
11078 !! end
11079
11080 !! test
11081 pre-save transform: context links ("pipe trick") with comma and parens
11082 !! options
11083 pst title=[[Who, me? (context)]]
11084 !! wikitext
11085 [[|Yes, you.]]
11086 [[Me, Myself, and I (1937 song)|]]
11087 !! html
11088 [[Yes, you. (context)|Yes, you.]]
11089 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11090 !! end
11091
11092 !! test
11093 pre-save transform: context links ("pipe trick") with namespace
11094 !! options
11095 pst title=[[Ns:Somearticle]]
11096 !! wikitext
11097 [[|Article]]
11098 !! html
11099 [[Ns:Article|Article]]
11100 !! end
11101
11102 !! test
11103 pre-save transform: context links ("pipe trick") with namespace and parens
11104 !! options
11105 pst title=[[Ns:Somearticle (context)]]
11106 !! wikitext
11107 [[|Article]]
11108 !! html
11109 [[Ns:Article (context)|Article]]
11110 !! end
11111
11112 !! test
11113 pre-save transform: context links ("pipe trick") with namespace and comma
11114 !! options
11115 pst title=[[Ns:Somearticle, Context, Whatever]]
11116 !! wikitext
11117 [[|Article]]
11118 !! html
11119 [[Ns:Article, Context, Whatever|Article]]
11120 !! end
11121
11122 !! test
11123 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11124 !! options
11125 pst title=[[Ns:Somearticle, Context (context)]]
11126 !! wikitext
11127 [[|Article]]
11128 !! html
11129 [[Ns:Article (context)|Article]]
11130 !! end
11131
11132 !! test
11133 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11134 !! options
11135 pst title=[[Ns:Somearticle (IGNORED), Context]]
11136 !! wikitext
11137 [[|Article]]
11138 !! html
11139 [[Ns:Article, Context|Article]]
11140 !! end
11141
11142 !! test
11143 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11144 !! options
11145 pst
11146 !! wikitext
11147 [[Article(context)|]]
11148 [[Bar:Article(context)|]]
11149 [[:Bar:Article(context)|]]
11150 [[|Article(context)]]
11151 [[Bar:X(Y)Z|]]
11152 [[:Bar:X(Y)Z|]]
11153 !! html
11154 [[Article(context)|Article]]
11155 [[Bar:Article(context)|Article]]
11156 [[:Bar:Article(context)|Article]]
11157 [[Article(context)]]
11158 [[Bar:X(Y)Z|X(Y)Z]]
11159 [[:Bar:X(Y)Z|X(Y)Z]]
11160 !! end
11161
11162 !! test
11163 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11164 !! options
11165 pst
11166 !! wikitext
11167 [[Article (context)|]]
11168 [[Bar:Article (context)|]]
11169 [[:Bar:Article (context)|]]
11170 [[|Article (context)]]
11171 [[Bar:X (Y) Z|]]
11172 [[:Bar:X (Y) Z|]]
11173 !! html
11174 [[Article (context)|Article]]
11175 [[Bar:Article (context)|Article]]
11176 [[:Bar:Article (context)|Article]]
11177 [[Article (context)]]
11178 [[Bar:X (Y) Z|X (Y) Z]]
11179 [[:Bar:X (Y) Z|X (Y) Z]]
11180 !! end
11181
11182 !! test
11183 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11184 !! options
11185 pst
11186 !! wikitext
11187 [[Article(context)|]]
11188 [[Bar:Article(context)|]]
11189 [[:Bar:Article(context)|]]
11190 [[|Article(context)]]
11191 [[Bar:X(Y)Z|]]
11192 [[:Bar:X(Y)Z|]]
11193 !! html
11194 [[Article(context)|Article]]
11195 [[Bar:Article(context)|Article]]
11196 [[:Bar:Article(context)|Article]]
11197 [[Article(context)]]
11198 [[Bar:X(Y)Z|X(Y)Z]]
11199 [[:Bar:X(Y)Z|X(Y)Z]]
11200 !! end
11201
11202 !! test
11203 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11204 !! options
11205 pst
11206 !! wikitext
11207 [[Article (context), context|]]
11208 [[Article (context),context|]]
11209 [[Bar:Article (context), context|]]
11210 [[Bar:Article (context),context|]]
11211 [[:Bar:Article (context), context|]]
11212 [[:Bar:Article (context),context|]]
11213 !! html
11214 [[Article (context), context|Article]]
11215 [[Article (context),context|Article]]
11216 [[Bar:Article (context), context|Article]]
11217 [[Bar:Article (context),context|Article]]
11218 [[:Bar:Article (context), context|Article]]
11219 [[:Bar:Article (context),context|Article]]
11220 !! end
11221
11222 !! test
11223 pre-save transform: trim trailing empty lines
11224 !! options
11225 pst
11226 !! wikitext
11227 Empty lines are trimmed
11228
11229
11230
11231
11232 !! html
11233 Empty lines are trimmed
11234 !! end
11235
11236 !! test
11237 pre-save transform: Signature expansion
11238 !! options
11239 pst
11240 !! wikitext
11241 * ~~~
11242 * <noinclude>~~~</noinclude>
11243 * <includeonly>~~~</includeonly>
11244 * <onlyinclude>~~~</onlyinclude>
11245 !! html
11246 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11247 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11248 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11249 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11250 !! end
11251
11252
11253 !! test
11254 pre-save transform: Signature expansion in nowiki tags (bug 93)
11255 !! options
11256 pst disabled
11257 !! wikitext
11258 Shall not expand:
11259
11260 <nowiki>~~~~</nowiki>
11261
11262 <includeonly><nowiki>~~~~</nowiki></includeonly>
11263
11264 <noinclude><nowiki>~~~~</nowiki></noinclude>
11265
11266 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11267
11268 {{subst:Foo}} shall be converted to FOO
11269
11270 As well as inside noinclude/onlyinclude
11271 <noinclude>{{subst:Foo}}</noinclude>
11272 <onlyinclude>{{subst:Foo}}</onlyinclude>
11273
11274 But not inside includeonly
11275 <includeonly>{{subst:Foo}}</includeonly>
11276 !! html
11277 Shall not expand:
11278
11279 <nowiki>~~~~</nowiki>
11280
11281 <includeonly><nowiki>~~~~</nowiki></includeonly>
11282
11283 <noinclude><nowiki>~~~~</nowiki></noinclude>
11284
11285 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11286
11287 FOO shall be converted to FOO
11288
11289 As well as inside noinclude/onlyinclude
11290 <noinclude>FOO</noinclude>
11291 <onlyinclude>FOO</onlyinclude>
11292
11293 But not inside includeonly
11294 <includeonly>{{subst:Foo}}</includeonly>
11295 !! end
11296
11297 !! test
11298 Parsoid: Recognize nowiki with trailing space in tags
11299 !! options
11300 parsoid=wt2html
11301 !! wikitext
11302 <nowiki ><div>[[foo]]</nowiki >
11303
11304 a<nowiki / >b
11305
11306 c<nowiki />d
11307
11308 e<nowiki/ >f
11309 !! html
11310 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11311 <p>ab</p>
11312 <p>cd</p>
11313 <p>ef</p>
11314 !! end
11315
11316 !! test
11317 Parsoid: Recognize nowiki with odd capitalization
11318 !! options
11319 parsoid=wt2html
11320 !! wikitext
11321 <noWikI ><div>[[foo]]</Nowiki >
11322 !! html
11323 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11324 !! end
11325
11326
11327 !! test
11328 Parsoid: Escape nowiki with trailing space in tags
11329 !! options
11330 parsoid=html2wt
11331 !! html
11332 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11333 <p>a&lt;nowiki /&gt;b</p>
11334 <p>c&lt;nowiki/ &gt;d</p>
11335 !! wikitext
11336 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11337
11338 a&lt;nowiki /&gt;b
11339
11340 c&lt;nowiki/ &gt;d
11341 !! end
11342
11343 !! test
11344 Parsoid: Escape weird noWikI capitalizations
11345 !! options
11346 parsoid=html2wt
11347 !! html
11348 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11349 !! wikitext
11350 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11351 !! end
11352
11353 ###
11354 ### Message transform tests
11355 ###
11356 !! test
11357 message transform: magic variables
11358 !! options
11359 msg
11360 !! wikitext
11361 {{SITENAME}}
11362 !! html
11363 MediaWiki
11364 !! end
11365
11366 !! test
11367 message transform: should not transform wiki markup
11368 !! options
11369 msg
11370 !! wikitext
11371 ''test''
11372 !! html
11373 ''test''
11374 !! end
11375
11376 !! test
11377 message transform: <noinclude> in transcluded template (bug 4926)
11378 !! options
11379 msg
11380 !! wikitext
11381 {{Includes}}
11382 !! html
11383 Foobar
11384 !! end
11385
11386 !! test
11387 message transform: <onlyinclude> in transcluded template (bug 4926)
11388 !! options
11389 msg
11390 !! wikitext
11391 {{Includes2}}
11392 !! html
11393 Foo
11394 !! end
11395
11396 !! test
11397 {{#special:}} page name, known
11398 !! options
11399 msg
11400 !! wikitext
11401 {{#special:Recentchanges}}
11402 !! html
11403 Special:RecentChanges
11404 !! end
11405
11406 !! test
11407 {{#special:}} page name with subpage, known
11408 !! options
11409 msg
11410 !! wikitext
11411 {{#special:Recentchanges/param}}
11412 !! html
11413 Special:RecentChanges/param
11414 !! end
11415
11416 !! test
11417 {{#special:}} page name, unknown
11418 !! options
11419 msg
11420 !! wikitext
11421 {{#special:foobar nonexistent}}
11422 !! html
11423 Special:Foobar nonexistent
11424 !! end
11425
11426 !! test
11427 {{#speciale:}} page name, known
11428 !! options
11429 msg
11430 !! wikitext
11431 {{#speciale:Recentchanges}}
11432 !! html
11433 Special:RecentChanges
11434 !! end
11435
11436 !! test
11437 {{#speciale:}} page name with subpage, known
11438 !! options
11439 msg
11440 !! wikitext
11441 {{#speciale:Recentchanges/param}}
11442 !! html
11443 Special:RecentChanges/param
11444 !! end
11445
11446 !! test
11447 {{#speciale:}} page name, unknown
11448 !! options
11449 msg
11450 !! wikitext
11451 {{#speciale:foobar nonexistent}}
11452 !! html
11453 Special:Foobar_nonexistent
11454 !! end
11455
11456 ###
11457 ### Images
11458 ###
11459 ### For Parsoid-specific tests, see
11460 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11461
11462 !! test
11463 Simple image
11464 !! options
11465 parsoid=wt2html,wt2wt,html2html
11466 !! wikitext
11467 [[Image:foobar.jpg]]
11468 !! html/php
11469 <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>
11470 </p>
11471 !! html/parsoid
11472 <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>
11473 !! end
11474
11475 !! test
11476 Simple image (using File: namespace, now canonical)
11477 !! wikitext
11478 [[File:Foobar.jpg]]
11479 !! html/php
11480 <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>
11481 </p>
11482 !! html/parsoid
11483 <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>
11484 !! end
11485
11486 !! test
11487 Right-aligned image
11488 !! wikitext
11489 [[File:Foobar.jpg|right]]
11490 !! html/php
11491 <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>
11492
11493 !! html/parsoid
11494 <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>
11495 !! end
11496
11497 !! test
11498 Image with caption
11499 !! wikitext
11500 [[File:Foobar.jpg|right|Caption text]]
11501 !! html/php
11502 <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>
11503
11504 !! html/parsoid
11505 <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>
11506 !! end
11507
11508 !! test
11509 Image with caption, bug 53312 #1
11510 !! wikitext
11511 [[File:Foobar.jpg|right|Caption page stuff]]
11512 !! html/php
11513 <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>
11514
11515 !! html/parsoid
11516 <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>
11517 !! end
11518
11519 !! test
11520 Image with caption, bug 53312 #2
11521 !! wikitext
11522 [[File:Foobar.jpg|right|Caption page=]]
11523 !! html/php
11524 <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>
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><figcaption>Caption page=</figcaption></figure>
11528 !! end
11529
11530 !! test
11531 Image with caption, bug 53312 #3
11532 !! wikitext
11533 [[File:Foobar.jpg|right|Caption page=stuff]]
11534 !! html/php
11535 <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>
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 page=stuff</figcaption></figure>
11539 !! end
11540
11541 !! test
11542 Allow empty links in image captions (Bug 60753)
11543 !! options
11544 thumbsize=220
11545 !! wikitext
11546 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11547 [[]]
11548 [[Link2]]
11549 ]]
11550 !! html/php
11551 <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>
11552
11553 !! html/parsoid
11554 <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>
11555 [[]]
11556 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11557 </figcaption></figure>
11558 !! end
11559
11560 !! test
11561 Titles in unlinked images (T23454)
11562 !! wikitext
11563 [[File:Foobar.jpg|link=|stuff]]
11564 !! html/php
11565 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11566 </p>
11567 !! end
11568
11569 !! test
11570 Link with empty target
11571 !! wikitext
11572 [[]]
11573 !! html
11574 <p>[[]]
11575 </p>
11576 !! end
11577
11578 !! test
11579 Image with link trail
11580 !! wikitext
11581 Linktrails should not work for images: [[File:Foobar.jpg]]s
11582 !! html/php
11583 <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
11584 </p>
11585 !! html/parsoid
11586 <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>
11587 !! end
11588
11589 !! test
11590 Image with empty attribute
11591 !! options
11592 parsoid=wt2html,wt2wt,html2html
11593 !! wikitext
11594 [[File:Foobar.jpg|right||Caption text]]
11595 !! html/php
11596 <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>
11597
11598 !! html/parsoid
11599 <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>
11600 !! end
11601
11602 !! test
11603 1. Block image with individual attributes from templates
11604 !! wikitext
11605 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11606 !! html/php
11607 <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>
11608
11609 !! html/parsoid
11610 <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>
11611 !! end
11612
11613 !! test
11614 2. Block Image with individual attributes from templates
11615 !! wikitext
11616 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11617 !! html/php
11618 <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>
11619
11620 !! html/parsoid
11621 <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>
11622 !! end
11623
11624 !! test
11625 3. Inline image with individual attributes from templates
11626 !! wikitext
11627 [[File:Foobar.jpg|{{echo|50px}}]]
11628 !! html/php
11629 <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>
11630 </p>
11631 !! html/parsoid
11632 <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>
11633 !! end
11634
11635 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11636 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11637 !! test
11638 Image with multiple attributes from the same template
11639 !! wikitext
11640 [[File:Foobar.jpg|{{image_attribs}}]]
11641 !! html/php
11642 <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>
11643
11644 !! html/parsoid
11645 <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>
11646 !! end
11647
11648 !! test
11649 Image with link tails
11650 !! options
11651 thumbsize=220
11652 !! wikitext
11653 123[[File:Foobar.jpg]]456
11654 123[[File:Foobar.jpg|right]]456
11655 123[[File:Foobar.jpg|thumb]]456
11656 !! html/php
11657 <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
11658 </p>
11659 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
11660 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
11661
11662 !! html/php+tidy
11663 <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>
11664 <p>123</p>
11665 <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>
11666 <p>456 123</p>
11667 <div class="thumb tright">
11668 <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>
11669 <div class="thumbcaption">
11670 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11671 </div>
11672 </div>
11673 </div>
11674 <p>456</p>
11675 !! html/parsoid
11676 <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>
11677 <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>
11678 <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>
11679 !! end
11680
11681 !! test
11682 Image with multiple captions -- only last one is accepted
11683 !! wikitext
11684 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11685 !! html/php
11686 <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>
11687
11688 !! html/parsoid
11689 <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>
11690 !! end
11691
11692 !! test
11693 Image with multiple widths -- use last
11694 !! wikitext
11695 [[File:Foobar.jpg|200px|300px|caption]]
11696 !! html/php
11697 <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>
11698 </p>
11699 !! html/parsoid
11700 <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>
11701 !! end
11702
11703 !! test
11704 Image with multiple alignments -- use first (bug 48664)
11705 !! options
11706 thumbsize=220
11707 !! wikitext
11708 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11709
11710 [[File:Foobar.jpg|middle|text-top|caption]]
11711 !! html/php
11712 <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>
11713 <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>
11714 </p>
11715 !! html/parsoid
11716 <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>
11717 <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>
11718 !! end
11719
11720 !! test
11721 Image with width attribute at different positions
11722 !! wikitext
11723 [[File:Foobar.jpg|200px|right|Caption]]
11724 [[File:Foobar.jpg|right|200px|Caption]]
11725 [[File:Foobar.jpg|right|Caption|200px]]
11726 !! html/php
11727 <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>
11728 <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>
11729 <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>
11730
11731 !! html/parsoid
11732 <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>
11733 <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>
11734 <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>
11735 !! end
11736
11737 # a sad bit of backward-compatibility
11738 !! test
11739 Image with size specified with pxpx (bug 13500, 51628)
11740 !! options
11741 parsoid=wt2html,wt2wt,html2html
11742 !! wikitext
11743 [[File:Foobar.jpg|20pxpx]]
11744 [[File:Foobar.jpg|200x20pxpx]]
11745 !! html/php
11746 <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>
11747 <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>
11748 </p>
11749 !! html/parsoid
11750 <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>
11751 !! end
11752
11753 !! test
11754 Image with link parameter, wiki target
11755 !! wikitext
11756 [[File:Foobar.jpg|link=Main Page]]
11757 !! html/php
11758 <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>
11759 </p>
11760 !! html/parsoid
11761 <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>
11762 !! end
11763
11764 # parsoid bug 49293 (part 1)
11765 !! test
11766 Image with link parameter, URL target
11767 !! wikitext
11768 [[File:Foobar.jpg|link=http://example.com/]]
11769 !! html/php
11770 <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>
11771 </p>
11772 !! html/parsoid
11773 <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>
11774 !! end
11775
11776 # parsoid bug 49293 (part 2)
11777 !! test
11778 Image with link parameter, protocol-less URL target
11779 !! wikitext
11780 [[File:Foobar.jpg|link=//example.com/]]
11781 !! html/php
11782 <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>
11783 </p>
11784 !! html/parsoid
11785 <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>
11786 !! end
11787
11788 !! test
11789 Image with link parameter, wgExternalLinkTarget
11790 !! wikitext
11791 [[Image:foobar.jpg|link=http://example.com/]]
11792 !! config
11793 wgExternalLinkTarget='foobar'
11794 !! html
11795 <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>
11796 </p>
11797 !! end
11798
11799 !! test
11800 Image with link parameter, wgNoFollowLinks set to false
11801 !! wikitext
11802 [[Image:foobar.jpg|link=http://example.com/]]
11803 !! config
11804 wgNoFollowLinks=false
11805 !! html
11806 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11807 </p>
11808 !! end
11809
11810 !! test
11811 Image with link parameter, wgNoFollowDomainExceptions
11812 !! wikitext
11813 [[Image:foobar.jpg|link=http://example.com/]]
11814 !! config
11815 wgNoFollowDomainExceptions='example.com'
11816 !! html
11817 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11818 </p>
11819 !! end
11820
11821 !! test
11822 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11823 !! wikitext
11824 [[Image:foobar.jpg|link=http://example.com/|Title]]
11825 !! config
11826 wgExternalLinkTarget='foobar'
11827 !! html
11828 <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>
11829 </p>
11830 !! end
11831
11832 !! test
11833 Image with empty link parameter
11834 !! wikitext
11835 [[File:Foobar.jpg|link=]]
11836 !! html/php
11837 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11838 </p>
11839 !! html/parsoid
11840 <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>
11841 !! end
11842
11843 !! test
11844 Image with link parameter (wiki target) and unnamed parameter
11845 !! wikitext
11846 [[File:Foobar.jpg|link=Main_Page|Title]]
11847 !! html/php
11848 <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>
11849 </p>
11850 !! html/parsoid
11851 <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>
11852 !! end
11853
11854 !! test
11855 Image with link parameter (URL target) and unnamed parameter
11856 !! wikitext
11857 [[File:Foobar.jpg|link=http://example.com/|Title]]
11858 !! html/php
11859 <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>
11860 </p>
11861 !! html/parsoid
11862 <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>
11863 !! end
11864
11865 !! test
11866 Thumbnail image with link parameter
11867 !! options
11868 thumbsize=220
11869 parsoid=wt2html,wt2wt,html2html
11870 !! wikitext
11871 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11872 !! html/php
11873 <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>
11874
11875 !! html/parsoid
11876 <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>
11877 !! end
11878
11879 !! test
11880 Manually-specified thumbnail image
11881 !! options
11882 thumbsize=220
11883 !! wikitext
11884 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11885 !! html/php
11886 <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>
11887
11888 !! html/parsoid
11889 <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>
11890 !! end
11891
11892 !! test
11893 Manually-specified thumbnail image with explicit link to wiki page
11894 !! options
11895 thumbsize=220
11896 parsoid=wt2html,wt2wt,html2html
11897 !! wikitext
11898 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11899 !! html/php
11900 <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>
11901
11902 !! html/parsoid
11903 <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>
11904 !! end
11905
11906 !! test
11907 Manually-specified thumbnail image with explicit link to url
11908 !! options
11909 thumbsize=220
11910 parsoid=wt2html,wt2wt,html2html
11911 !! wikitext
11912 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11913 !! html/php
11914 <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>
11915
11916 !! html/parsoid
11917 <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>
11918 !! end
11919
11920 !! test
11921 Manually-specified thumbnail image with explicit no link
11922 !! options
11923 thumbsize=220
11924 parsoid=wt2html,wt2wt,html2html
11925 !! wikitext
11926 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11927 !! html/php
11928 <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>
11929
11930 !! html/parsoid
11931 <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>
11932 !! end
11933
11934 !! test
11935 Manually-specified thumbnail image with explicit link and alt text
11936 !! options
11937 thumbsize=220
11938 parsoid=wt2html,wt2wt,html2html
11939 !! wikitext
11940 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11941 !! html/php
11942 <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>
11943
11944 !! html/parsoid
11945 <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>
11946 !! end
11947
11948 !! test
11949 Image with frame and link
11950 !! options
11951 parsoid=wt2html,wt2wt,html2html
11952 !! wikitext
11953 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11954 !! html/php
11955 <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>
11956
11957 !! html/parsoid
11958 <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>
11959 !! end
11960
11961 !! test
11962 Image with frame and link and explicit alt
11963 !! options
11964 parsoid=wt2html,wt2wt,html2html
11965 !! wikitext
11966 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11967 !! html/php
11968 <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>
11969
11970 !! html/parsoid
11971 <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>
11972 !! end
11973
11974 !! test
11975 Image with wiki markup in implicit alt
11976 !! options
11977 parsoid=wt2html,wt2wt,html2html
11978 !! wikitext
11979 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11980
11981 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11982 !! html/php
11983 <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>
11984 </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>
11985 </p>
11986 !! html/parsoid
11987 <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>
11988 <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>
11989 !! end
11990
11991 ###################
11992 # Conflicting image format options.
11993 # First option specified should 'win'.
11994 # All three cases in each test should be identical.
11995
11996 !! test
11997 Image with 'frameless' first.
11998 !! options
11999 parsoid=wt2html,wt2wt,html2html
12000 !! wikitext
12001 [[File:Foobar.jpg|frameless|caption]]
12002
12003 [[File:Foobar.jpg|frameless|frame|caption]]
12004
12005 [[File:Foobar.jpg|frameless|thumb|caption]]
12006 !! html/php
12007 <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>
12008 </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>
12009 </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>
12010 </p>
12011 !! html/parsoid
12012 <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>
12013 <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>
12014 <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>
12015 !! end
12016
12017 !! test
12018 Image with 'frame' first.
12019 !! options
12020 parsoid=wt2html,wt2wt,html2html
12021 !! wikitext
12022 [[File:Foobar.jpg|frame|caption]]
12023 [[File:Foobar.jpg|frame|frameless|caption]]
12024 [[File:Foobar.jpg|frame|thumb|caption]]
12025 !! html/php
12026 <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>
12027 <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>
12028 <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>
12029
12030 !! html/parsoid
12031 <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>
12032 <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>
12033 <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>
12034 !! end
12035
12036 !! test
12037 Image with 'thumb' first.
12038 !! options
12039 parsoid=wt2html,wt2wt,html2html
12040 !! wikitext
12041 [[File:Foobar.jpg|thumb|caption]]
12042 [[File:Foobar.jpg|thumb|frameless|caption]]
12043 [[File:Foobar.jpg|thumb|frame|caption]]
12044 !! html/php
12045 <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>
12046 <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>
12047 <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>
12048
12049 !! html/parsoid
12050 <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>
12051 <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>
12052 <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>
12053 !! end
12054
12055 ###################
12056 # Image sizing.
12057 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12058 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12059 # Foobar has actual size of 1941x220
12060 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12061 # a scalable format.
12062 # 2. Framed images always ignore size options; always render at default size.
12063 # 3. "Unspecified format" and border are the only types which can be
12064 # enlarged.
12065
12066 !! test
12067 Image: "unspecified format" and border enlarge
12068 !! options
12069 parsoid=wt2html,wt2wt,html2html
12070 !! wikitext
12071 [[File:Foobar.jpg|2000px]]
12072
12073 [[File:Foobar.jpg|border|2000px]]
12074 !! html/php
12075 <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>
12076 </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>
12077 </p>
12078 !! html/parsoid
12079 <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>
12080 <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>
12081 !! end
12082
12083 !! test
12084 Image: "unspecified format" and border reduce
12085 !! options
12086 parsoid=wt2html,wt2wt,html2html
12087 !! wikitext
12088 [[File:Foobar.jpg|1000px]]
12089
12090 [[File:Foobar.jpg|border|1000px]]
12091 !! html/php
12092 <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>
12093 </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>
12094 </p>
12095 !! html/parsoid
12096 <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>
12097 <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>
12098 !! end
12099
12100 !! test
12101 Image: thumbs reduce
12102 !! options
12103 parsoid=wt2html,wt2wt,html2html
12104 !! wikitext
12105 [[File:Foobar.jpg|thumb|50px]]
12106 !! html/php
12107 <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>
12108
12109 !! html/parsoid
12110 <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>
12111 !! end
12112
12113 !! test
12114 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12115 !! options
12116 parsoid=wt2html,wt2wt,html2html
12117 !! wikitext
12118 [[File:Foobar.jpg|thumb|2000px]]
12119
12120 [[File:Foobar.svg|thumb|2000px]]
12121 !! html/php
12122 <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>
12123 <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>
12124
12125 !! html/parsoid
12126 <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>
12127 <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>
12128 !! end
12129
12130 !! test
12131 Image: frameless can reduce in size
12132 !! options
12133 parsoid=wt2html,wt2wt,html2html
12134 !! wikitext
12135 [[File:Foobar.jpg|frameless|50px]]
12136 !! html/php
12137 <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>
12138 </p>
12139 !! html/parsoid
12140 <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>
12141 !! end
12142
12143 !! test
12144 Image: bitmap frameless can't be enlarged past original size, but vector can
12145 !! options
12146 parsoid=wt2html,wt2wt,html2html
12147 !! wikitext
12148 [[File:Foobar.jpg|frameless|2000px]]
12149
12150 [[File:Foobar.svg|frameless|2000px]]
12151 !! html/php
12152 <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>
12153 </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>
12154 </p>
12155 !! html/parsoid
12156 <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>
12157 <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>
12158 !! end
12159
12160 !! test
12161 Image: framed images are always unscaled.
12162 !! options
12163 parsoid=wt2html,wt2wt,html2html
12164 !! wikitext
12165 [[File:Foobar.jpg|frame]]
12166
12167 [[File:Foobar.jpg|frame|50px]]
12168
12169 [[File:Foobar.jpg|frame|50x50px]]
12170
12171 [[File:Foobar.jpg|frame|2000px]]
12172 !! html/php
12173 <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>
12174 <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>
12175 <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>
12176 <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>
12177
12178 !! html/parsoid
12179 <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>
12180 <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>
12181 <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>
12182 <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>
12183 !! end
12184
12185 ###################
12186
12187 !! test
12188 Link to image page- image page normally doesn't exists, hence edit link
12189 Add test with existing image page
12190 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12191 !! wikitext
12192 [[:Image:test]]
12193 !! html
12194 <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>
12195 </p>
12196 !! end
12197
12198 !! test
12199 bug 18784 Link to non-existent image page with caption should use caption as link text
12200 !! wikitext
12201 [[:Image:test|caption]]
12202 !! html
12203 <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>
12204 </p>
12205 !! end
12206
12207 !! test
12208 Frameless image caption with a free URL
12209 !! wikitext
12210 [[File:Foobar.jpg|http://example.com]]
12211 !! html/php
12212 <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>
12213 </p>
12214 !! html/parsoid
12215 <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>
12216 !! end
12217
12218 !! test
12219 Thumbnail image caption with a free URL
12220 !! options
12221 thumbsize=220
12222 !! wikitext
12223 [[File:Foobar.jpg|thumb|http://example.com]]
12224 !! html/php
12225 <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>
12226
12227 !! html/parsoid
12228 <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>
12229 !! end
12230
12231 !! test
12232 Thumbnail image caption with a free URL and explicit alt
12233 !! options
12234 thumbsize=220
12235 parsoid=wt2html,wt2wt,html2html
12236 !! wikitext
12237 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12238 !! html/php
12239 <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>
12240
12241 !! html/parsoid
12242 <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>
12243 !! end
12244
12245 !! test
12246 SVG thumbnails with no language set
12247 !! options
12248 !! wikitext
12249 [[File:Foobar.svg|thumb|caption]]
12250 !! html/php
12251 <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>
12252
12253 !! html/parsoid
12254 <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>
12255 !! end
12256
12257 !! test
12258 SVG thumbnails with language de
12259 !! options
12260 parsoid=wt2html,wt2wt,html2html
12261 !! wikitext
12262 [[File:Foobar.svg|thumb|caption|lang=de]]
12263 !! html/php
12264 <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>
12265
12266 !! html/parsoid
12267 <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>
12268 !! end
12269
12270 !! test
12271 SVG thumbnails with invalid language code
12272 !! options
12273 parsoid=wt2html,wt2wt,html2html
12274 !! wikitext
12275 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12276 !! html/php
12277 <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>
12278
12279 !! html/parsoid
12280 <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>
12281 !! end
12282
12283 !! test
12284 BUG 1887: A ISBN with a thumbnail
12285 !! wikitext
12286 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12287 !! html/php
12288 <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>
12289
12290 !! html/parsoid
12291 <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>
12292 !! end
12293
12294 !! test
12295 BUG 1887: A RFC with a thumbnail
12296 !! wikitext
12297 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12298 !! html/php
12299 <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>
12300
12301 !! html/parsoid
12302 <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>
12303 !! end
12304
12305 !! test
12306 BUG 1887: A mailto link with a thumbnail
12307 !! wikitext
12308 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12309 !! html/php
12310 <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>
12311
12312 !! html/parsoid
12313 <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>
12314 !! end
12315
12316 # Pending resolution to bug 368
12317 !! test
12318 BUG 648: Frameless image caption with a link
12319 !! wikitext
12320 [[File:Foobar.jpg|text with a [[link]] in it]]
12321 !! html/php
12322 <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>
12323 </p>
12324 !! html/parsoid
12325 <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>
12326 !! end
12327
12328 !! test
12329 BUG 648: Frameless image caption with a link (suffix)
12330 !! wikitext
12331 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12332 !! html/php
12333 <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>
12334 </p>
12335 !! html/parsoid
12336 <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>
12337 !! end
12338
12339 !! test
12340 BUG 648: Frameless image caption with an interwiki link
12341 !! wikitext
12342 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12343 !! html/php
12344 <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>
12345 </p>
12346 !! html/parsoid
12347 <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>
12348 !! end
12349
12350 !! test
12351 BUG 648: Frameless image caption with a piped interwiki link
12352 !! wikitext
12353 [[File:Foobar.jpg|text with a [[MeatBall:Link|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 [[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>
12359 !! end
12360
12361 !! test
12362 Escape HTML special chars in image alt text
12363 !! wikitext
12364 [[File:Foobar.jpg|& < > "]]
12365 !! html/php
12366 <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>
12367 </p>
12368 !! html/parsoid
12369 <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>
12370 !! end
12371
12372 !! test
12373 BUG 499: Alt text should have &#1234;, not &amp;1234;
12374 !! wikitext
12375 [[File:Foobar.jpg|&#9792;]]
12376 !! html/php
12377 <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>
12378 </p>
12379 !! html/parsoid
12380 <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>
12381 !! end
12382
12383 !! test
12384 Broken image caption with link
12385 !! options
12386 parsoid=wt2html,wt2wt,html2html
12387 !! wikitext
12388 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12389 !! html/php
12390 <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.
12391 </p>
12392 !! html/parsoid
12393 <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>
12394 !! end
12395
12396 !! test
12397 Image caption containing another image
12398 !! wikitext
12399 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12400 !! html/php
12401 <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>
12402
12403 !! html/parsoid
12404 <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>
12405 !! end
12406
12407 !! test
12408 Image: caption containing a newline
12409 !! wikitext
12410 [[File:Foobar.jpg|This
12411 *is some text]]
12412 !! html/php
12413 <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>
12414 </p>
12415 !! html/parsoid
12416 <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>
12417 !!end
12418
12419 !!test
12420 Image: caption containing leading space
12421 (The leading space should not trigger nowiki escaping in wt2wt mode)
12422 !! wikitext
12423 [[File:Foobar.jpg|thumb| bar]]
12424 !! html/php
12425 <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>
12426
12427 !! html/parsoid
12428 <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>
12429 !!end
12430
12431 !! test
12432 Image: caption containing a table
12433 !! options
12434 parsoid=wt2html,wt2wt,html2html
12435 !! wikitext
12436 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12437 {|
12438 ! Foo !! Bar
12439 |-
12440 | Foo1 || Bar1
12441 |}
12442 and some more text.]]
12443 !! html/php
12444 <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>
12445
12446 !! html/parsoid
12447 <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
12448 <table>
12449 <tbody>
12450 <tr><th>Foo </th><th>Bar</th></tr>
12451 <tr>
12452 <td>Foo1 </td>
12453 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12454 !! end
12455
12456 !! test
12457 Bug 3090: External links other than http: in image captions
12458 !! wikitext
12459 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12460 !! html/php
12461 <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>
12462
12463 !! html/parsoid
12464 <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>
12465 !! end
12466
12467 !! test
12468 Custom class
12469 !! options
12470 parsoid=wt2html,wt2wt,html2html
12471 !! wikitext
12472 [[Image:foobar.jpg|a|class=b]]
12473 !! html/php
12474 <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>
12475 </p>
12476 !! html/parsoid
12477 <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>
12478 !! end
12479
12480 !! test
12481 Localized image handling (1).
12482 !! options
12483 parsoid=wt2html,wt2wt,html2html
12484 language=es
12485 !! wikitext
12486 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12487 !! html/php
12488 <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>
12489
12490 !! html/parsoid
12491 <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>
12492 !! end
12493
12494 !! test
12495 Localized image handling (2).
12496 !! options
12497 thumbsize=220
12498 parsoid=wt2html,wt2wt,html2html
12499 language=es
12500 !! wikitext
12501 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12502 !! html/php
12503 <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>
12504
12505 !! html/parsoid
12506 <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>
12507 !! end
12508
12509 !! test
12510 "border", "frameless" and "class" attributes on an image.
12511 !! options
12512 thumbsize=220
12513 parsoid=wt2html,wt2wt,html2html
12514 !! wikitext
12515 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12516 !! html/php
12517 <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>
12518 </p>
12519 !! html/parsoid
12520 <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>
12521 !! end
12522
12523 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12524 !! test
12525 Invalid image attributes (bug 62500)
12526 !! options
12527 thumbsize=220
12528 parsoid=wt2html,wt2wt,html2html
12529 !! wikitext
12530 [[File:Foobar.jpg|thumb|float|left|caption]]
12531
12532 [[File:Foobar.jpg|thumb|righ|caption]]
12533
12534 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12535 !! html/php
12536 <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>
12537 <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>
12538 <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>
12539
12540 !! html/parsoid
12541 <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>
12542 <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>
12543 <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>
12544 !! end
12545
12546 !! article
12547 File:Barfoo.jpg
12548 !! text
12549 #REDIRECT [[File:Barfoo.jpg]]
12550 !! endarticle
12551
12552 # FIXME: Parsoid should run this test -- but we'd need to teach the
12553 # mockAPI about the redirected Barfoo.jpg image.
12554 !! test
12555 Redirected image
12556 !! wikitext
12557 [[Image:Barfoo.jpg]]
12558 !! html/php
12559 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12560 </p>
12561 !! end
12562
12563 !! test
12564 Missing image with uploads disabled
12565 !! options
12566 wgEnableUploads=0
12567 !! wikitext
12568 [[File:Foobaz.jpg]]
12569 !! html/php
12570 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12571 </p>
12572 !! html/parsoid
12573 <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>
12574 !! end
12575
12576 # Parsoid-specific testing for images
12577 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12578 # Currently imperfect due to a flaw in the Parsoid testrunner
12579 # Work in progress
12580 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12581 # image tests.
12582
12583 !! test
12584 Parsoid-specific image handling - simple image with size and middle alignment
12585 !! wikitext
12586 [[File:Foobar.jpg|middle|50px]]
12587 !! html/parsoid
12588 <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>
12589 !! end
12590
12591 !! test
12592 Parsoid-specific image handling - simple image with size, middle alignment,
12593 non-standard namespace alias
12594 !! options
12595 parsoid=wt2wt,wt2html,html2html
12596 !! wikitext
12597 [[Image:Foobar.jpg|middle|50px]]
12598 !! html/parsoid
12599 <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>
12600 !! end
12601
12602 !! test
12603 Parsoid-specific image handling - simple image with size and middle alignment
12604 (existing content)
12605 !! wikitext
12606 [[File:Foobar.jpg|50px|middle]]
12607 !! html/parsoid
12608 <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>
12609 !! end
12610
12611 !! test
12612 Parsoid-specific image handling - simple image with size and middle alignment
12613 and non-standard namespace name
12614 !! options
12615 parsoid=wt2html,wt2wt,html2html
12616 !! wikitext
12617 [[Image:Foobar.jpg|50px|middle]]
12618 !! html/parsoid
12619 <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>
12620 !! end
12621
12622 !! test
12623 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12624 !! wikitext
12625 [[File:Foobar.jpg|500x10px|baseline|caption]]
12626 !! html/parsoid
12627 <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>
12628 !! end
12629
12630 !! test
12631 Parsoid-specific image handling - simple image with border and size spec
12632 !! wikitext
12633 [[File:Foobar.jpg|50px|border|caption]]
12634 !! html/parsoid
12635 <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>
12636 !! end
12637
12638 !! test
12639 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12640 !! wikitext
12641 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12642 !! html/parsoid
12643 <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>
12644 !! end
12645
12646 !! test
12647 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12648 (existing content)
12649 !! wikitext
12650 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12651 !! html/parsoid
12652 <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>
12653 !! end
12654
12655 !! test
12656 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12657 !! wikitext
12658 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12659 !! html/parsoid
12660 <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>
12661 !! end
12662
12663 !! test
12664 Parsoid-specific image handling - thumbnail with specific size, halign,
12665 valign, and caption (existing content)
12666 !! wikitext
12667 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12668 !! html/parsoid
12669 <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>
12670 !! end
12671
12672 !! test
12673 Parsoid-specific image handling - framed image with specific size and caption
12674 (size is ignored)
12675 !! options
12676 parsoid=wt2html,wt2wt,html2html
12677 !! wikitext
12678 [[File:Foobar.jpg|frame|500x50px|caption]]
12679 !! html/parsoid
12680 <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>
12681 !! end
12682
12683 !! test
12684 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12685 (size is ignored)
12686 !! options
12687 parsoid=wt2html,wt2wt,html2html
12688 !! wikitext
12689 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12690 !! html/parsoid
12691 <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>
12692 !! end
12693
12694 !! test
12695 Parsoid-specific image handling - frameless image with specific size, border, and caption
12696 !! wikitext
12697 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12698 !! html/parsoid
12699 <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>
12700 !! end
12701
12702 !! test
12703 Parsoid-specific image handling - simple image with a formatted caption
12704 !! wikitext
12705 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12706 !! html/parsoid
12707 <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>
12708 !! end
12709
12710 !! test
12711 Parsoid-specific image handling - caption with a template in it
12712 !! wikitext
12713 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12714 !! html/parsoid
12715 <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>
12716 !! end
12717
12718 !! test
12719 Parsoid-specific image handling - caption with unbalanced tags in it
12720 !! options
12721 parsoid=wt2html,wt2wt,html2html
12722 !! wikitext
12723 foo
12724 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12725 bar
12726 !! html/parsoid
12727 <p>foo</p>
12728 <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>
12729 <p>bar</p>
12730 !! end
12731
12732 !! test
12733 Parsoid-specific image handling - empty caption (1)
12734 !! options
12735 parsoid=wt2html,wt2wt
12736 !! wikitext
12737 [[File:Foobar.jpg|thumb|]]
12738 !! html/parsoid
12739 <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>
12740 !! end
12741
12742 # empty captions don't get serialized unless we're in the "round trip" case
12743 !! test
12744 Parsoid-specific image handling - empty caption (2)
12745 !! options
12746 parsoid=html2wt
12747 !! html/parsoid
12748 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12749 <a href="File:Foobar.jpg">
12750 <img resource="./File:Foobar.jpg"
12751 src="//example.com/images/3/3a/Foobar.jpg"
12752 height="25" width="220"/>
12753 </a>
12754 <figcaption></figcaption>
12755 </figure>
12756 !! wikitext
12757 [[File:Foobar.jpg|thumb]]
12758 !! end
12759
12760 !! test
12761 Parsoid-specific image handling - whitespace caption
12762 !! wikitext
12763 [[File:Foobar.jpg|thumb| ]]
12764 !! html/parsoid
12765 <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>
12766 !! end
12767
12768 !! test
12769 Parsoid-specific image handling - lang option
12770 !! wikitext
12771 foo
12772 [[File:Foobar.svg|lang=de|caption]]
12773 bar
12774 !! html/parsoid
12775 <p>foo
12776 <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>
12777 bar</p>
12778 !! end
12779
12780
12781 ###
12782 ### Subpages
12783 ###
12784 !! article
12785 Subpage test/subpage
12786 !! text
12787 foo
12788 !! endarticle
12789
12790 !! test
12791 Subpage link
12792 !! options
12793 subpage title=[[Subpage test]]
12794 !! wikitext
12795 [[/subpage]]
12796 !! html
12797 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12798 </p>
12799 !! end
12800
12801 !! test
12802 Subpage noslash link
12803 !! options
12804 subpage title=[[Subpage test]]
12805 !! wikitext
12806 [[/subpage/]]
12807 !! html
12808 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12809 </p>
12810 !! end
12811
12812 !! article
12813 Subpage test/1/2/subpage
12814 !! text
12815 blah
12816 !! endarticle
12817
12818 !! test
12819 Relative subpage noslash link
12820 !! options
12821 parsoid=wt2wt,wt2html,html2html
12822 subpage title=[[Subpage test/1/2/3/4]]
12823 !! wikitext
12824 [[../../subpage/]]
12825
12826 [[../../subpage]]
12827 !! html/php
12828 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12829 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12830 </p>
12831 !! html/parsoid
12832 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12833 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12834 !! end
12835
12836 !! test
12837 Parsoid: dot-slash prefixed wikilinks
12838 !! wikitext
12839 [[./foo]]
12840
12841 [[././bar]]
12842
12843 [[././baz/]]
12844 !! html/php
12845 <p>[[./foo]]
12846 </p><p>[[././bar]]
12847 </p><p>[[././baz/]]
12848 </p>
12849 !! html/parsoid
12850 <p>[[./foo]]
12851 </p><p>[[././bar]]
12852 </p><p>[[././baz/]]
12853 </p>
12854 !! end
12855
12856 !! test
12857 Render invalid page names as plain text (bug 51090)
12858 !! wikitext
12859 [[./../foo|bar]]
12860 [[foo�|bar]]
12861 [[foo/.|bar]]
12862 [[foo/..|bar]]
12863 [[foo~~~bar]]
12864 [[foo>bar]]
12865 [[foo[bar]]
12866 [[.]]
12867 [[..]]
12868 [[foo././bar]]
12869
12870 [[{{echo|./../foo}}|bar]]
12871 [[{{echo|foo/.}}|bar]]
12872 [[{{echo|foo/..}}|bar]]
12873 [[{{echo|foo~~~~bar}}]]
12874 [[{{echo|foo>bar}}]]
12875 [[{{echo|foo././bar}}]]
12876 [[{{echo|foo{bar}}]]
12877 [[{{echo|foo}bar}}]]
12878 [[{{echo|foo[bar}}]]
12879 [[{{echo|foo]bar}}]]
12880 [[{{echo|foo<bar}}]]
12881 !!html/php
12882 <p>[[./../foo|bar]]
12883 [[foo�|bar]]
12884 [[foo/.|bar]]
12885 [[foo/..|bar]]
12886 [[foo~~~bar]]
12887 [[foo&gt;bar]]
12888 [[foo[bar]]
12889 [[.]]
12890 [[..]]
12891 [[foo././bar]]
12892 </p><p>[[./../foo|bar]]
12893 [[foo/.|bar]]
12894 [[foo/..|bar]]
12895 [[foo~~~~bar]]
12896 [[foo&gt;bar]]
12897 [[foo././bar]]
12898 [[foo{bar]]
12899 [[foo}bar]]
12900 [[foo[bar]]
12901 [[foo]bar]]
12902 [[foo&lt;bar]]
12903 </p>
12904 !!html/parsoid
12905 <p>[[./../foo|bar]]
12906 [[foo�|bar]]
12907 [[foo/.|bar]]
12908 [[foo/..|bar]]
12909 [[foo~~~bar]]
12910 [[foo>bar]]
12911 [[foo[bar]]
12912 [[.]]
12913 [[..]]
12914 [[foo././bar]]</p>
12915
12916 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12917 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12918 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12919 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12920 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12921 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12922 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12923 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12924 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12925 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12926 [[<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>
12927 !!end
12928
12929 !! test
12930 Disabled subpages
12931 !! wikitext
12932 [[/subpage]]
12933 !! html
12934 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12935 </p>
12936 !! end
12937
12938 !! test
12939 BUG 561: {{/Subpage}}
12940 !! options
12941 subpage title=[[Page]]
12942 !! wikitext
12943 {{/Subpage}}
12944 !! html
12945 <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>
12946 </p>
12947 !! end
12948
12949 ###
12950 ### Categories
12951 ###
12952 !! article
12953 Category:MediaWiki User's Guide
12954 !! text
12955 blah
12956 !! endarticle
12957
12958 !! test
12959 Link to category
12960 !! wikitext
12961 [[:Category:MediaWiki User's Guide]]
12962 !! html
12963 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12964 </p>
12965 !! end
12966
12967 !! test
12968 Simple category
12969 !! options
12970 cat
12971 !! wikitext
12972 [[Category:MediaWiki User's Guide]]
12973 !! html
12974 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12975 !! end
12976
12977 !! test
12978 PAGESINCATEGORY invalid title fatal (r33546 fix)
12979 !! wikitext
12980 {{PAGESINCATEGORY:<bogus>}}
12981 !! html
12982 <p>0
12983 </p>
12984 !! end
12985
12986 !! test
12987 Category with different sort key
12988 !! options
12989 cat
12990 !! wikitext
12991 [[Category:MediaWiki User's Guide|Foo]]
12992 !! html
12993 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12994 !! end
12995
12996 !! test
12997 Category with identical sort key
12998 !! options
12999 cat
13000 !! wikitext
13001 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13002 !! html
13003 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13004 !! end
13005
13006 !! test
13007 Category with empty sort key
13008 !! options
13009 cat
13010 pst
13011 !! wikitext
13012 [[Category:MediaWiki User's Guide|]]
13013 !! html
13014 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13015 !! end
13016
13017 !! test
13018 Category with empty sort key and parentheses
13019 !! options
13020 cat
13021 pst
13022 !! wikitext
13023 [[Category:Foo (bar)|]]
13024 !! html
13025 [[Category:Foo (bar)|Foo]]
13026 !! end
13027
13028 !! test
13029 Category with link tail
13030 !! options
13031 cat
13032 pst
13033 !! wikitext
13034 123[[Category:Foo]]456
13035 !! html
13036 123[[Category:Foo]]456
13037 !! end
13038
13039 !! test
13040 Category with template
13041 !! options
13042 cat
13043 pst
13044 !! wikitext
13045 [[Category:{{echo|Foo}}]]
13046 !! html
13047 [[Category:{{echo|Foo}}]]
13048 !! end
13049
13050 !! test
13051 Category with template in sort key
13052 !! options
13053 cat
13054 pst
13055 !! wikitext
13056 [[Category:Foo|{{echo|Bar}}]]
13057 !! html
13058 [[Category:Foo|{{echo|Bar}}]]
13059 !! end
13060
13061 !! test
13062 Category with template in sort key and title
13063 !! options
13064 cat
13065 pst
13066 !! wikitext
13067 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13068 !! html
13069 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13070 !! end
13071
13072 !! test
13073 Category / paragraph interactions
13074 !! wikitext
13075 Foo [[Category:Baz]] Bar
13076
13077 Foo [[Category:Baz]]
13078 Bar
13079
13080 Foo
13081 [[Category:Baz]]
13082 Bar
13083
13084 Foo
13085 [[Category:Baz]] Bar
13086
13087 Foo
13088 [[Category:Baz]]
13089 [[Category:Baz]]
13090 [[Category:Baz]]
13091 Bar
13092
13093 [[Category:Baz]]
13094 [[Category:Baz]]
13095 [[Category:Baz]]
13096
13097 [[Category:Baz]]
13098 {{echo|[[Category:Baz]]}}
13099 [[Category:Baz]]
13100 !! html
13101 <p>Foo Bar
13102 </p><p>Foo
13103 Bar
13104 </p><p>Foo
13105 Bar
13106 </p><p>Foo Bar
13107 </p><p>Foo
13108 Bar
13109 </p>
13110 !! end
13111
13112 !! test
13113 Parsoid: Serialize link to category page with colon escape
13114 !! options
13115 parsoid
13116 !! wikitext
13117
13118 [[:Category:Foo]]
13119 [[:Category:Foo|Bar]]
13120 !! html
13121 <p>
13122 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13123 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13124 </p>
13125 !! end
13126
13127 !! test
13128 Parsoid: Link prefix/suffixes aren't applied to category links
13129 !! options
13130 parsoid=wt2html,wt2wt,html2html
13131 language=is
13132 !! wikitext
13133 x[[Category:Foo]]y
13134 !! html
13135 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13136 !! end
13137
13138 !! test
13139 Parsoid: Serialize link to file page with colon escape
13140 !! options
13141 parsoid
13142 !! wikitext
13143
13144 [[:File:Foo.png]]
13145 [[:File:Foo.png|Bar]]
13146 !! html
13147 <p>
13148 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13149 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13150 </p>
13151 !! end
13152
13153 !! test
13154 Parsoid: Serialize a genuine category link without colon escape
13155 !! options
13156 parsoid
13157 !! wikitext
13158 [[Category:Foo]]
13159 [[Category:Foo|Bar]]
13160 !! html
13161 <link rel="mw:PageProp/Category" href="Category:Foo">
13162 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13163 !! end
13164
13165 !! test
13166 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13167 !! options
13168 parsoid=html2wt
13169 !! html
13170 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13171 !! wikitext
13172 [[Category:Toxine bactérienne]]
13173 !! end
13174
13175 !! test
13176 Parsoid: Defaultsort
13177 !! wikitext
13178 {{DEFAULTSORT:Foo}}
13179 !! html/parsoid
13180 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13181 !! end
13182
13183 !! test
13184 Parsoid: Defaultsort (template-generated)
13185 !! wikitext
13186 {{{{echo|DEFAULTSORT}}:Foo}}
13187 !! html/parsoid
13188 <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}}]}'/>
13189 !! end
13190
13191 ###
13192 ### Inter-language links
13193 ###
13194 !! test
13195 Interlanguage links
13196 !! options
13197 ill
13198 !! wikitext
13199 [[es:Alimento]]
13200 [[fr:Nourriture]]
13201 [[zh:食品]]
13202 !! html/php
13203 es:Alimento fr:Nourriture zh:食品
13204 !! html/parsoid
13205 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13206 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13207 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13208 !! end
13209
13210 !! test
13211 Duplicate interlanguage links (bug 24502)
13212 !! options
13213 ill
13214 !! wikitext
13215 [[es:1]]
13216 [[es:2]]
13217 [[fr:1]]
13218 [[fr:2]]
13219 !! html/php
13220 es:1 fr:1
13221 !! html/parsoid
13222 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13223 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13224 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13225 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13226 !! end
13227
13228 ###
13229 ### Sections
13230 ###
13231 !! test
13232 Basic section headings
13233 !! wikitext
13234 == Headline 1 ==
13235 Some text
13236
13237 ==Headline 2==
13238 More
13239 ===Smaller headline===
13240 Blah blah
13241 !! html
13242 <h2><a href="#Headline_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13243 <p>Some text
13244 </p>
13245 <h2><a href="#Headline_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13246 <p>More
13247 </p>
13248 <h3><a href="#Smaller_headline" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13249 <p>Blah blah
13250 </p>
13251 !! end
13252
13253 !! test
13254 Section headings with TOC
13255 !! wikitext
13256 == Headline 1 ==
13257 === Subheadline 1 ===
13258 ===== Skipping a level =====
13259 ====== Skipping a level ======
13260
13261 == Headline 2 ==
13262 Some text
13263 ===Another headline===
13264 !! html
13265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13266 <ul>
13267 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13268 <ul>
13269 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13270 <ul>
13271 <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>
13272 <ul>
13273 <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>
13274 </ul>
13275 </li>
13276 </ul>
13277 </li>
13278 </ul>
13279 </li>
13280 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13281 <ul>
13282 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13283 </ul>
13284 </li>
13285 </ul>
13286 </div>
13287
13288 <h2><a href="#Headline_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13289 <h3><a href="#Subheadline_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13290 <h5><a href="#Skipping_a_level" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
13291 <h6><a href="#Skipping_a_level_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
13292 <h2><a href="#Headline_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13293 <p>Some text
13294 </p>
13295 <h3><a href="#Another_headline" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13296
13297 !! end
13298
13299 !! test
13300 TOC anchors don't collide
13301 !! wikitext
13302 __FORCETOC__
13303 == Headline 2 ==
13304 == Headline ==
13305 == Headline 2 ==
13306 == Headline ==
13307 !! html
13308 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13309 <ul>
13310 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13311 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13312 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13313 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13314 </ul>
13315 </div>
13316
13317 <h2><a href="#Headline_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13318 <h2><a href="#Headline" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13319 <h2><a href="#Headline_2_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13320 <h2><a href="#Headline_3" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13321
13322 !! end
13323
13324 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13325 !! test
13326 Handling of sections up to level 6 and beyond
13327 !! wikitext
13328 = Level 1 Heading=
13329 == Level 2 Heading==
13330 === Level 3 Heading===
13331 ==== Level 4 Heading====
13332 ===== Level 5 Heading=====
13333 ====== Level 6 Heading======
13334 ======= Level 7 Heading=======
13335 ======== Level 8 Heading========
13336 ========= Level 9 Heading=========
13337 ========== Level 10 Heading==========
13338 !! html
13339 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13340 <ul>
13341 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13342 <ul>
13343 <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>
13344 <ul>
13345 <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>
13346 <ul>
13347 <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>
13348 <ul>
13349 <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>
13350 <ul>
13351 <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>
13352 <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>
13353 <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>
13354 <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>
13355 <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>
13356 </ul>
13357 </li>
13358 </ul>
13359 </li>
13360 </ul>
13361 </li>
13362 </ul>
13363 </li>
13364 </ul>
13365 </li>
13366 </ul>
13367 </div>
13368
13369 <h1><a href="#Level_1_Heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13370 <h2><a href="#Level_2_Heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13371 <h3><a href="#Level_3_Heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13372 <h4><a href="#Level_4_Heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
13373 <h5><a href="#Level_5_Heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
13374 <h6><a href="#Level_6_Heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
13375 <h6><a href="#.3D_Level_7_Heading.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
13376 <h6><a href="#.3D.3D_Level_8_Heading.3D.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
13377 <h6><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
13378 <h6><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
13379
13380 !! end
13381
13382 !! test
13383 TOC regression (bug 9764)
13384 !! wikitext
13385 == title 1 ==
13386 === title 1.1 ===
13387 ==== title 1.1.1 ====
13388 === title 1.2 ===
13389 == title 2 ==
13390 === title 2.1 ===
13391 !! html
13392 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13393 <ul>
13394 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13395 <ul>
13396 <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>
13397 <ul>
13398 <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>
13399 </ul>
13400 </li>
13401 <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>
13402 </ul>
13403 </li>
13404 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13405 <ul>
13406 <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>
13407 </ul>
13408 </li>
13409 </ul>
13410 </div>
13411
13412 <h2><a href="#title_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13413 <h3><a href="#title_1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13414 <h4><a href="#title_1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
13415 <h3><a href="#title_1.2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13416 <h2><a href="#title_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13417 <h3><a href="#title_2.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13418
13419 !! end
13420
13421 !! test
13422 TOC with wgMaxTocLevel=3 (bug 6204)
13423 !! options
13424 wgMaxTocLevel=3
13425 !! wikitext
13426 == title 1 ==
13427 === title 1.1 ===
13428 ==== title 1.1.1 ====
13429 === title 1.2 ===
13430 == title 2 ==
13431 === title 2.1 ===
13432 !! html
13433 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13434 <ul>
13435 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13436 <ul>
13437 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
13438 <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>
13439 </ul>
13440 </li>
13441 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13442 <ul>
13443 <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>
13444 </ul>
13445 </li>
13446 </ul>
13447 </div>
13448
13449 <h2><a href="#title_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13450 <h3><a href="#title_1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13451 <h4><a href="#title_1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
13452 <h3><a href="#title_1.2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13453 <h2><a href="#title_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13454 <h3><a href="#title_2.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13455
13456 !! end
13457
13458 !! test
13459 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13460 !! options
13461 wgMaxTocLevel=3
13462 !! wikitext
13463 ==Section 1==
13464 ===Section 1.1===
13465 ====Section 1.1.1====
13466 ====Section 1.1.1.1====
13467 ==Section 2==
13468 !! html
13469 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13470 <ul>
13471 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13472 <ul>
13473 <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>
13474 </ul>
13475 </li>
13476 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13477 </ul>
13478 </div>
13479
13480 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13481 <h3><a href="#Section_1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13482 <h4><a href="#Section_1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
13483 <h4><a href="#Section_1.1.1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
13484 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13485
13486 !! end
13487
13488
13489 !! test
13490 Resolving duplicate section names
13491 !! wikitext
13492 == Foo bar ==
13493 == Foo bar ==
13494 !! html
13495 <h2><a href="#Foo_bar" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13496 <h2><a href="#Foo_bar_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13497
13498 !! end
13499
13500 !! test
13501 Resolving duplicate section names with differing case (bug 10721)
13502 !! wikitext
13503 == Foo bar ==
13504 == Foo Bar ==
13505 !! html
13506 <h2><a href="#Foo_bar" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13507 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13508
13509 !! end
13510
13511 !! article
13512 Template:sections
13513 !! text
13514 ===Section 1===
13515 ==Section 2==
13516 !! endarticle
13517
13518 !! test
13519 Template with sections, __NOTOC__
13520 !! wikitext
13521 __NOTOC__
13522 ==Section 0==
13523 {{sections}}
13524 ==Section 4==
13525 !! html
13526 <h2><a href="#Section_0" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13527 <h3><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13528 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13529 <h2><a href="#Section_4" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13530
13531 !! end
13532
13533 !! test
13534 __NOEDITSECTION__ keyword
13535 !! wikitext
13536 __NOEDITSECTION__
13537 ==Section 1==
13538 ==Section 2==
13539 !! html
13540 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span></h2>
13541 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_2">Section 2</span></h2>
13542
13543 !! end
13544
13545 !! test
13546 Link inside a section heading
13547 !! wikitext
13548 ==Section with a [[Main Page|link]] in it==
13549 !! html
13550 <h2><a href="#Section_with_a_link_in_it" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13551
13552 !! end
13553
13554 !! test
13555 TOC regression (bug 12077)
13556 !! wikitext
13557 __TOC__
13558 == title 1 ==
13559 === title 1.1 ===
13560 == title 2 ==
13561 !! html
13562 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13563 <ul>
13564 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13565 <ul>
13566 <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>
13567 </ul>
13568 </li>
13569 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13570 </ul>
13571 </div>
13572
13573 <h2><a href="#title_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13574 <h3><a href="#title_1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
13575 <h2><a href="#title_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13576
13577 !! end
13578
13579 !! test
13580 BUG 1219 URL next to image (good)
13581 !! wikitext
13582 http://example.com [[File:Foobar.jpg]]
13583 !! html/php
13584 <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>
13585 </p>
13586 !! html/parsoid
13587 <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>
13588 !!end
13589
13590 !! test
13591 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13592 !! wikitext
13593 ===
13594 The line above must have a trailing space!
13595 === <!--
13596 --> <!-- -->
13597 But just in case it doesn't...
13598 !! html
13599 <h1><a href="#.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13600 <p>The line above must have a trailing space!
13601 </p>
13602 <h1><a href="#.3D_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13603 <p>But just in case it doesn't...
13604 </p>
13605 !! end
13606
13607 !! test
13608 Header with special characters (bug 25462)
13609 !! wikitext
13610 The tooltips shall not show entities to the user (ie. be double escaped)
13611
13612 == text > text ==
13613 section 1
13614
13615 == text < text ==
13616 section 2
13617
13618 == text & text ==
13619 section 3
13620
13621 == text ' text ==
13622 section 4
13623
13624 == text " text ==
13625 section 5
13626 !! html
13627 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13628 </p>
13629 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13630 <ul>
13631 <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>
13632 <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>
13633 <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>
13634 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13635 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13636 </ul>
13637 </div>
13638
13639 <h2><a href="#text_.3E_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13640 <p>section 1
13641 </p>
13642 <h2><a href="#text_.3C_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13643 <p>section 2
13644 </p>
13645 <h2><a href="#text_.26_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13646 <p>section 3
13647 </p>
13648 <h2><a href="#text_.27_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13649 <p>section 4
13650 </p>
13651 <h2><a href="#text_.22_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13652 <p>section 5
13653 </p>
13654 !! end
13655
13656 !! test
13657 Header with space, plus and underscore as entity
13658 !! wikitext
13659 Id should not contain + for spaces
13660
13661 == Space between Text ==
13662 section 1
13663
13664 == Space-Entity&#32;between&#32;Text ==
13665 section 2
13666
13667 == Plus+between+Text ==
13668 section 3
13669
13670 == Plus-Entity&#43;between&#43;Text ==
13671 section 4
13672
13673 == Underscore_between_Text ==
13674 section 5
13675
13676 == Underscore-Entity&#95;between&#95;Text ==
13677 section 6
13678
13679 [[#Space between Text]]
13680 [[#Space-Entity&#32;between&#32;Text]]
13681 [[#Plus+between+Text]]
13682 [[#Plus-Entity&#43;between&#43;Text]]
13683 [[#Underscore_between_Text]]
13684 [[#Underscore-Entity&#95;between&#95;Text]]
13685 !! html
13686 <p>Id should not contain + for spaces
13687 </p>
13688 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13689 <ul>
13690 <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>
13691 <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>
13692 <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>
13693 <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>
13694 <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>
13695 <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>
13696 </ul>
13697 </div>
13698
13699 <h2><a href="#Space_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13700 <p>section 1
13701 </p>
13702 <h2><a href="#Space-Entity_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13703 <p>section 2
13704 </p>
13705 <h2><a href="#Plus.2Bbetween.2BText" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13706 <p>section 3
13707 </p>
13708 <h2><a href="#Plus-Entity.2Bbetween.2BText" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13709 <p>section 4
13710 </p>
13711 <h2><a href="#Underscore_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13712 <p>section 5
13713 </p>
13714 <h2><a href="#Underscore-Entity_between_Text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13715 <p>section 6
13716 </p><p><a href="#Space_between_Text">#Space between Text</a>
13717 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13718 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13719 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13720 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13721 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13722 </p>
13723 !! end
13724
13725 !! test
13726 Headers with excess '=' characters
13727 (Are similar tests necessary beyond the 1st level?)
13728 !! wikitext
13729 =foo==
13730 ==foo=
13731 =''italic'' heading==
13732 ==''italic'' heading=
13733 !! html
13734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13735 <ul>
13736 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13737 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13738 <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>
13739 <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>
13740 </ul>
13741 </div>
13742
13743 <h1><a href="#foo.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13744 <h1><a href="#.3Dfoo" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13745 <h1><a href="#italic_heading.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13746 <h1><a href="#.3Ditalic_heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
13747
13748 !! end
13749
13750 !! test
13751 HTML headers vs TOC (bug 23393)
13752 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13753 !! wikitext
13754 <h1>Header 1</h1>
13755 == Header 1.1 ==
13756 == Header 1.2 ==
13757
13758 <h1>Header 2
13759 </h1>
13760 == Header 2.1 ==
13761 == Header 2.2 ==
13762 __NOEDITSECTION__
13763 !! html
13764 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13765 <ul>
13766 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13767 <ul>
13768 <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>
13769 <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>
13770 </ul>
13771 </li>
13772 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13773 <ul>
13774 <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>
13775 <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>
13776 </ul>
13777 </li>
13778 </ul>
13779 </div>
13780
13781 <h1><a href="#Header_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_1">Header 1</span></h1>
13782 <h2><a href="#Header_1.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13783 <h2><a href="#Header_1.2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13784 <h1><a href="#Header_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_2">Header 2</span></h1>
13785 <h2><a href="#Header_2.1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13786 <h2><a href="#Header_2.2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13787
13788 !! end
13789
13790 !! test
13791 Single-line or multiline-comments can follow headings
13792 !! options
13793 parsoid=wt2html,wt2wt
13794 !! wikitext
13795 ==foo==<!---->
13796 ==bar==<!--c1-->
13797 ==baz==<!--
13798 c2
13799 c3-->
13800 !! html
13801 <h2><a href="#foo" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="foo">foo</span></h2>
13802 <h2><a href="#bar" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="bar">bar</span></h2>
13803 <h2><a href="#baz" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="baz">baz</span></h2>
13804
13805 !! end
13806
13807 !! test
13808 BUG 1219 URL next to image (broken)
13809 !! wikitext
13810 http://example.com[[File:Foobar.jpg]]
13811 !! html/php
13812 <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>
13813 </p>
13814 !! html/parsoid
13815 <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>
13816 !!end
13817
13818 !! test
13819 Bug 1186 news: in the middle of text
13820 !! wikitext
13821 http://en.wikinews.org/wiki/Wikinews:Workplace
13822 !! html
13823 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13824 </p>
13825 !!end
13826
13827
13828 !! test
13829 Namespaced link must have a title
13830 !! wikitext
13831 [[Project:]]
13832 !! html
13833 <p>[[Project:]]
13834 </p>
13835 !!end
13836
13837 !! test
13838 Namespaced link must have a title (bad fragment version)
13839 !! wikitext
13840 [[Project:#fragment]]
13841 !! html
13842 <p>[[Project:#fragment]]
13843 </p>
13844 !!end
13845
13846
13847 ###
13848 ### HTML tags and HTML attributes
13849 ###
13850
13851 !! test
13852 div with no attributes
13853 !! wikitext
13854 <div>HTML rocks</div>
13855 !! html
13856 <div>HTML rocks</div>
13857
13858 !! end
13859
13860 !! test
13861 div with double-quoted attribute
13862 !! wikitext
13863 <div id="rock">HTML rocks</div>
13864 !! html
13865 <div id="rock">HTML rocks</div>
13866
13867 !! end
13868
13869 !! test
13870 div with single-quoted attribute
13871 !! wikitext
13872 <div id='rock'>HTML rocks</div>
13873 !! html
13874 <div id="rock">HTML rocks</div>
13875
13876 !! end
13877
13878 !! test
13879 div with unquoted attribute
13880 !! wikitext
13881 <div id=rock>HTML rocks</div>
13882 !! html
13883 <div id="rock">HTML rocks</div>
13884
13885 !! end
13886
13887 !! test
13888 div with illegal double attributes
13889 !! wikitext
13890 <div id="a" id="b">HTML rocks</div>
13891 !! html
13892 <div id="b">HTML rocks</div>
13893
13894 !!end
13895
13896 # FIXME: produce empty string instead of "class" in the PHP parser, following
13897 # the HTML5 spec.
13898 !! test
13899 div with empty attribute value, space before equals
13900 !! options
13901 parsoid
13902 !! wikitext
13903 <div class =>HTML rocks</div>
13904 !! html
13905 <div class="">HTML rocks</div>
13906
13907 !! end
13908
13909 !! test
13910 div with multiple empty attribute values
13911 !! options
13912 parsoid
13913 !! wikitext
13914 <div id= title=>HTML rocks</div>
13915 !! html
13916 <div id="" title="">HTML rocks</div>
13917
13918 !! end
13919
13920 !! test
13921 table with multiple empty attribute values
13922 !! options
13923 parsoid
13924 !! wikitext
13925 {| title= id=
13926 | hi
13927 |}
13928 !! html
13929 <table title="" id="">
13930 <tbody><tr><td> hi</td></tr>
13931 </tbody></table>
13932 !! end
13933
13934 !! test
13935 div with braces in attribute value
13936 !! wikitext
13937 <div title="{}">Foo</div>
13938 !! html/php
13939 <div title="&#123;}">Foo</div>
13940
13941 !! html/parsoid
13942 <div title="{}">Foo</div>
13943 !! end
13944
13945 # This it very inconsistent in the PHP parser: it returns
13946 # class="class" if there is a space between the name and the equal sign (see
13947 # 'div with empty attribute value, space before equals'), but strips the
13948 # attribute completely if the space is missing. We hope that not much content
13949 # depends on this, so are implementing the behavior below in Parsoid for
13950 # consistencies' sake.
13951 # FIXME: fix this behavior in the PHP parser?
13952 !! test
13953 div with empty attribute value, no space before equals
13954 !! options
13955 parsoid=wt2html,html2html
13956 !! wikitext
13957 <div class=>HTML rocks</div>
13958 !! html/php
13959 <div>HTML rocks</div>
13960
13961 !! html/parsoid
13962 <div class="">HTML rocks</div>
13963 !! end
13964
13965 !! test
13966 HTML multiple attributes correction
13967 !! wikitext
13968 <p class="error" class="awesome">Awesome!</p>
13969 !! html
13970 <p class="awesome">Awesome!</p>
13971
13972 !!end
13973
13974 !! test
13975 Table multiple attributes correction
13976 !! wikitext
13977 {|
13978 !+ class="error" class="awesome"| status
13979 |}
13980 !! html
13981 <table>
13982 <tr>
13983 <th class="awesome"> status
13984 </th></tr></table>
13985
13986 !!end
13987
13988 !! test
13989 DIV IN UPPERCASE
13990 !! wikitext
13991 <DIV ID="x">HTML ROCKS</DIV>
13992 !! html
13993 <div id="x">HTML ROCKS</div>
13994
13995 !!end
13996
13997 !! test
13998 Non-ASCII pseudo-tags are rendered as text
13999 !! wikitext
14000 <khyô>
14001 !! html
14002 <p>&lt;khyô&gt;
14003 </p>
14004 !! end
14005
14006 !! test
14007 Pseudo-tag with URL 'name' renders as url link
14008 !! wikitext
14009 <http://example.com/>
14010 !! html
14011 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14012 </p>
14013 !! end
14014
14015 !! test
14016 text with amp in the middle of nowhere
14017 !! wikitext
14018 Remember AT&T?
14019 !! html
14020 <p>Remember AT&amp;T?
14021 </p>
14022 !! end
14023
14024 !! test
14025 text with character entity: eacute
14026 !! wikitext
14027 I always thought &eacute; was a cute letter.
14028 !! html
14029 <p>I always thought &#233; was a cute letter.
14030 </p>
14031 !! html+tidy
14032 <p>I always thought é was a cute letter.</p>
14033 !! end
14034
14035 !! test
14036 text with entity-escaped character entity-like string: eacute
14037 !! wikitext
14038 I always thought &amp;eacute; was a cute letter.
14039 !! html
14040 <p>I always thought &amp;eacute; was a cute letter.
14041 </p>
14042 !! end
14043
14044 !! test
14045 text with undefined character entity: xacute
14046 !! wikitext
14047 I always thought &xacute; was a cute letter.
14048 !! html
14049 <p>I always thought &amp;xacute; was a cute letter.
14050 </p>
14051 !! end
14052
14053 # TODO: generalize to PHP parser?
14054 !! test
14055 HTML5 tags
14056 !! options
14057 parsoid
14058 !! wikitext
14059 <data value="5">five</data>
14060 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14061 <mark>This highlighted text</mark>
14062 !! html
14063 <p><data value="5">five</data>
14064 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14065 <mark>This highlighted text</mark></p>
14066 !! end
14067
14068 !! test
14069 HTML tag with leading space is parsed as text
14070 !! wikitext
14071 < div>foo< /div>
14072 !! html
14073 <p>&lt; div&gt;foo&lt; /div&gt;
14074 </p>
14075 !! end
14076
14077 ###
14078 ### Nesting tests (see bug 41545, 50604, 51081)
14079 ###
14080
14081 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14082 # Note that html2wt is considerably more difficult if we use <b> in
14083 # the test case, instead of <big>
14084 !! test
14085 Ensure that HTML adoption agency algorithm is properly implemented.
14086 !! wikitext
14087 <big>X<big>Y</big>Z</big>
14088 !! html
14089 <p><big>X<big>Y</big>Z</big>
14090 </p>
14091 !! end
14092
14093 # This was bug 41545 in the PHP parser.
14094 # Note that tidy doesn't handle this correctly.
14095 !! test
14096 Nesting of <kbd>
14097 !! wikitext
14098 <kbd>X<kbd>Y</kbd>Z</kbd>
14099 !! html
14100 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14101 </p>
14102 !! end
14103
14104 # The following cases were bug 51081 in the PHP parser.
14105 # Note that there are some other nestable tags (b, i, etc) which are
14106 # not covered; see bug 51081 for discussion.
14107
14108 # Note that tidy doesn't handle this correctly.
14109 !! test
14110 Nesting of <em>
14111 !! wikitext
14112 <em>X<em>Y</em>Z</em>
14113 !! html
14114 <p><em>X<em>Y</em>Z</em>
14115 </p>
14116 !! end
14117
14118 # Note that tidy doesn't handle this correctly.
14119 !! test
14120 Nesting of <strong>
14121 !! wikitext
14122 <strong>X<strong>Y</strong>Z</strong>
14123 !! html
14124 <p><strong>X<strong>Y</strong>Z</strong>
14125 </p>
14126 !! end
14127
14128 !! test
14129 Nesting of <q>
14130 !! wikitext
14131 <q>X<q>Y</q>Z</q>
14132 !! html+tidy
14133 <p><q>X<q>Y</q>Z</q></p>
14134 !! end
14135
14136 # Note that tidy doesn't handle this correctly.
14137 !! test
14138 Nesting of <ruby>
14139 !! wikitext
14140 <ruby>X<ruby>Y</ruby>Z</ruby>
14141 !! html
14142 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14143 </p>
14144 !! end
14145
14146 # Note that tidy doesn't handle this correctly.
14147 !! test
14148 Nesting of <bdo>
14149 !! wikitext
14150 <bdo>X<bdo>Y</bdo>Z</bdo>
14151 !! html
14152 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14153 </p>
14154 !! end
14155
14156
14157 ###
14158 ### Media links
14159 ###
14160
14161 !! test
14162 Media link
14163 !! wikitext
14164 [[Media:Foobar.jpg]]
14165 !! html
14166 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14167 </p>
14168 !! end
14169
14170 !! test
14171 Media link with text
14172 !! wikitext
14173 [[Media:Foobar.jpg|A neat file to look at]]
14174 !! html
14175 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14176 </p>
14177 !! end
14178
14179 # FIXME: this is still bad HTML tag nesting
14180 !! test
14181 Media link with nasty text
14182 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
14183 !! wikitext
14184 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14185 !! html
14186 <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>
14187
14188 !! html+tidy
14189 <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>
14190 !! end
14191
14192 !! test
14193 Media link to nonexistent file (bug 1702)
14194 !! wikitext
14195 [[Media:No such.jpg]]
14196 !! html
14197 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14198 </p>
14199 !! end
14200
14201 !! test
14202 Image link to nonexistent file (bug 1850 - good)
14203 !! wikitext
14204 [[File:No_such.jpg]]
14205 !! html/php
14206 <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>
14207 </p>
14208 !! html/parsoid
14209 <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>
14210 !! end
14211
14212 !! test
14213 :Image link to nonexistent file (bug 1850 - bad)
14214 !! wikitext
14215 [[:Image:No such.jpg]]
14216 !! html/php
14217 <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>
14218 </p>
14219 !! html/parsoid
14220 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14221 !! end
14222
14223
14224
14225 !! test
14226 Character reference normalization in link text (bug 1938)
14227 !! wikitext
14228 [[Main Page|this&that]]
14229 !! html
14230 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14231 </p>
14232 !!end
14233
14234 !! article
14235 אַ
14236 !! text
14237 Test for unicode normalization
14238
14239 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14240 !! endarticle
14241
14242 !! test
14243 (bug 19451) Links should refer to the normalized form.
14244 !! wikitext
14245 [[&#xFB2E;]]
14246 [[&#x5d0;&#x5b7;]]
14247 [[&#x5d0;ַ]]
14248 [[א&#x5b7;]]
14249 [[אַ]]
14250 !! html
14251 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14252 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14253 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14254 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14255 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14256 </p>
14257 !! end
14258
14259 !! test
14260 Empty attribute crash test (bug 2067)
14261 !! wikitext
14262 <font color="">foo</font>
14263 !! html
14264 <p><font color="">foo</font>
14265 </p>
14266 !! end
14267
14268 !! test
14269 Empty attribute crash test single-quotes (bug 2067)
14270 !! wikitext
14271 <font color=''>foo</font>
14272 !! html
14273 <p><font color="">foo</font>
14274 </p>
14275 !! end
14276
14277 !! test
14278 Attribute test: equals, then nothing
14279 !! wikitext
14280 <font color=>foo</font>
14281 !! html
14282 <p><font>foo</font>
14283 </p>
14284 !! end
14285
14286 !! test
14287 Attribute test: unquoted value
14288 !! wikitext
14289 <font color=x>foo</font>
14290 !! html
14291 <p><font color="x">foo</font>
14292 </p>
14293 !! end
14294
14295 !! test
14296 Attribute test: unquoted but illegal value (hash)
14297 !! wikitext
14298 <font color=#x>foo</font>
14299 !! html
14300 <p><font color="#x">foo</font>
14301 </p>
14302 !! end
14303
14304 !! test
14305 Attribute test: no value
14306 !! wikitext
14307 <font color>foo</font>
14308 !! html
14309 <p><font color="color">foo</font>
14310 </p>
14311 !! end
14312
14313 !! test
14314 Bug 2095: link with three closing brackets
14315 !! wikitext
14316 [[Main Page]]]
14317 !! html/php
14318 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14319 </p>
14320 !! html/parsoid
14321 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14322 !! end
14323
14324 !! test
14325 Bug 2095: link with pipe and three closing brackets
14326 !! wikitext
14327 [[Main Page|link]]]
14328 !! html/php
14329 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14330 </p>
14331 !! html/parsoid
14332 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14333 !! end
14334
14335 !! test
14336 Bug 2095: link with pipe and three closing brackets, version 2
14337 !! wikitext
14338 [[Main Page|[http://example.com/]]]
14339 !! html/php
14340 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14341 </p>
14342 !! html/parsoid
14343 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14344 !! end
14345
14346
14347 ###
14348 ### Safety
14349 ###
14350
14351 !! article
14352 Template:Dangerous attribute
14353 !! text
14354 " onmouseover="alert(document.cookie)
14355 !! endarticle
14356
14357 !! article
14358 Template:Dangerous style attribute
14359 !! text
14360 border-size: expression(alert(document.cookie))
14361 !! endarticle
14362
14363 !! article
14364 Template:Div style
14365 !! text
14366 <div style="float: right; {{{1}}}">Magic div</div>
14367 !! endarticle
14368
14369 !! test
14370 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14371 !! wikitext
14372 <div title="{{test}}"></div>
14373 !! html
14374 <div title="This is a test template"></div>
14375
14376 !! end
14377
14378 # Parsoid has enough context to handle this case
14379 !! test
14380 Bug 2304: HTML attribute safety (dangerous template; 2309)
14381 !! wikitext
14382 <div title="{{dangerous attribute}}"></div>
14383 !! html/php
14384 <div title=""></div>
14385
14386 !! html/parsoid
14387 <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>
14388 !! end
14389
14390 !! test
14391 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14392 !! wikitext
14393 <div style="{{dangerous style attribute}}"></div>
14394 !! html
14395 <div style="/* insecure input */"></div>
14396
14397 !! end
14398
14399 !! test
14400 Bug 2304: HTML attribute safety (safe parameter; 2309)
14401 !! wikitext
14402 {{div style|width: 200px}}
14403 !! html
14404 <div style="float: right; width: 200px">Magic div</div>
14405
14406 !! end
14407
14408 !! test
14409 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14410 !! wikitext
14411 {{div style|width: expression(alert(document.cookie))}}
14412 !! html
14413 <div style="/* insecure input */">Magic div</div>
14414
14415 !! end
14416
14417 !! test
14418 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14419 !! wikitext
14420 {{div style|"><script>alert(document.cookie)</script>}}
14421 !! html
14422 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14423
14424 !! end
14425
14426 !! test
14427 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14428 !! wikitext
14429 {{div style|" ><script>alert(document.cookie)</script>}}
14430 !! html
14431 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14432
14433 !! end
14434
14435 !! test
14436 Bug 2304: HTML attribute safety (link)
14437 !! wikitext
14438 <div title="[[Main Page]]"></div>
14439 !! html
14440 <div title="&#91;&#91;Main Page]]"></div>
14441
14442 !! end
14443
14444 !! test
14445 Bug 2304: HTML attribute safety (italics)
14446 !! wikitext
14447 <div title="''foobar''"></div>
14448 !! html
14449 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14450
14451 !! end
14452
14453 !! test
14454 Bug 2304: HTML attribute safety (bold)
14455 !! wikitext
14456 <div title="'''foobar'''"></div>
14457 !! html
14458 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14459
14460 !! end
14461
14462
14463 !! test
14464 Bug 2304: HTML attribute safety (ISBN)
14465 !! wikitext
14466 <div title="ISBN 1234567890"></div>
14467 !! html
14468 <div title="&#73;SBN 1234567890"></div>
14469
14470 !! end
14471
14472 !! test
14473 Bug 2304: HTML attribute safety (RFC)
14474 !! wikitext
14475 <div title="RFC 1234"></div>
14476 !! html
14477 <div title="&#82;FC 1234"></div>
14478
14479 !! end
14480
14481 !! test
14482 Bug 2304: HTML attribute safety (PMID)
14483 !! wikitext
14484 <div title="PMID 1234567890"></div>
14485 !! html
14486 <div title="&#80;MID 1234567890"></div>
14487
14488 !! end
14489
14490 !! test
14491 Bug 2304: HTML attribute safety (web link)
14492 !! wikitext
14493 <div title="http://example.com/"></div>
14494 !! html
14495 <div title="http&#58;//example.com/"></div>
14496
14497 !! end
14498
14499 !! test
14500 Bug 2304: HTML attribute safety (named web link)
14501 !! wikitext
14502 <div title="[http://example.com/ link]"></div>
14503 !! html
14504 <div title="&#91;http&#58;//example.com/ link]"></div>
14505
14506 !! end
14507
14508 !! test
14509 Bug 3244: HTML attribute safety (extension; safe)
14510 !! wikitext
14511 <div style="<nowiki>background:blue</nowiki>"></div>
14512 !! html
14513 <div style="background:blue"></div>
14514
14515 !! end
14516
14517 !! test
14518 Bug 3244: HTML attribute safety (extension; unsafe)
14519 !! wikitext
14520 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14521 !! html
14522 <div style="/* insecure input */"></div>
14523
14524 !! end
14525
14526 # More MSIE fun discovered by Tom Gilder
14527
14528 !! test
14529 MSIE CSS safety test: spurious slash
14530 !! wikitext
14531 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14532 !! html
14533 <div style="/* insecure input */">evil</div>
14534
14535 !! end
14536
14537 !! test
14538 MSIE CSS safety test: hex code
14539 !! wikitext
14540 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14541 !! html
14542 <div style="/* insecure input */">evil</div>
14543
14544 !! end
14545
14546 !! test
14547 MSIE CSS safety test: comment in url
14548 !! wikitext
14549 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14550 !! html
14551 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14552
14553 !! end
14554
14555 !! test
14556 MSIE CSS safety test: comment in expression
14557 !! wikitext
14558 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14559 !! html
14560 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14561
14562 !! end
14563
14564 !! test
14565 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14566 !! wikitext
14567 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14568 !! html
14569 <p style="/* invalid control char */">A</p>
14570
14571 !! end
14572
14573 !! test
14574 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14575 !! wikitext
14576 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14577 <div style="top:EXPRESSION(alert())">B</div>
14578 !! html
14579 <p style="/* insecure input */">A</p>
14580 <div style="/* insecure input */">B</div>
14581
14582 !! end
14583
14584 !! test
14585 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14586 !! wikitext
14587 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14588 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14589 !! html
14590 <div style="/* insecure input */">A</div>
14591 <p style="/* insecure input */">B</p>
14592
14593 !! end
14594
14595 !! test
14596 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14597 !! wikitext
14598 <div style="background-image:url⁽javascript:alert())">A</div>
14599 <div style="background-image:url₍javascript:alert())">B</div>
14600 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14601 !! html
14602 <div style="/* insecure input */">A</div>
14603 <div style="/* insecure input */">B</div>
14604 <p style="/* insecure input */">C</p>
14605
14606 !! end
14607
14608 !! test
14609 Opera -o-link CSS
14610 !! wikitext
14611 <div
14612 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;"
14613 style="-o-link:attr(title);-o-link-source:current">X</div>
14614 !! html
14615 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14616
14617 !! end
14618
14619 !! test
14620 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14621 !! wikitext
14622 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14623 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14624 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14625 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14626 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14627 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14628 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14629 !! html
14630 <p style="/* insecure input */">A</p>
14631 <p style="/* insecure input */">B</p>
14632 <p style="/* insecure input */">C</p>
14633 <p style="/* insecure input */">D</p>
14634 <p style="/* insecure input */">E</p>
14635 <p style="/* insecure input */">F</p>
14636 <p style="/* insecure input */">G</p>
14637
14638 !! end
14639
14640 !! test
14641 Table attribute legitimate extension
14642 !! wikitext
14643 {|
14644 !+ style="<nowiki>color:blue</nowiki>"| status
14645 |}
14646 !! html
14647 <table>
14648 <tr>
14649 <th style="color:blue"> status
14650 </th></tr></table>
14651
14652 !!end
14653
14654 !! test
14655 Table attribute safety
14656 !! wikitext
14657 {|
14658 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14659 |}
14660 !! html
14661 <table>
14662 <tr>
14663 <th style="/* insecure input */"> status
14664 </th></tr></table>
14665
14666 !! end
14667
14668 !! test
14669 CSS line continuation 1
14670 !! wikitext
14671 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14672 !! html
14673 <div style="/* insecure input */"></div>
14674
14675 !! end
14676
14677 !! test
14678 CSS line continuation 2
14679 !! wikitext
14680 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14681 !! html
14682 <div style="/* insecure input */"></div>
14683
14684 !! end
14685
14686 !! article
14687 Template:Identity
14688 !! text
14689 {{{1}}}
14690 !! endarticle
14691
14692 !! test
14693 Expansion of multi-line templates in attribute values (bug 6255)
14694 !! wikitext
14695 <div style="background: {{identity|#00FF00}}">-</div>
14696 !! html
14697 <div style="background: #00FF00">-</div>
14698
14699 !! end
14700
14701
14702 !! test
14703 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14704 !! wikitext
14705 <div style="background:
14706 #00FF00">-</div>
14707 !! html/php
14708 <div style="background: #00FF00">-</div>
14709
14710 !! html/parsoid
14711 <div style="background:
14712 #00FF00">-</div>
14713 !! end
14714
14715 !! test
14716 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14717 !! wikitext
14718 <div style="background: &#10;#00FF00">-</div>
14719 !! html
14720 <div style="background: &#10;#00FF00">-</div>
14721
14722 !! end
14723
14724 !! test
14725 evil <math>-wiki-tags without Extension:Math enabled
14726 !! wikitext
14727 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14728 !! html+tidy
14729 <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>
14730 !! end
14731
14732 ###
14733 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14734 ###
14735 !! test
14736 Parser hook: empty input
14737 !! wikitext
14738 <tag></tag>
14739 !! html
14740 <pre>
14741 ''
14742 array (
14743 )
14744 </pre>
14745
14746 !! end
14747
14748 !! test
14749 Parser hook: empty input using terminated empty elements
14750 !! wikitext
14751 <tag/>
14752 !! html
14753 <pre>
14754 NULL
14755 array (
14756 )
14757 </pre>
14758
14759 !! end
14760
14761 !! test
14762 Parser hook: empty input using terminated empty elements (space before)
14763 !! wikitext
14764 <tag />
14765 !! html
14766 <pre>
14767 NULL
14768 array (
14769 )
14770 </pre>
14771
14772 !! end
14773
14774 !! test
14775 Parser hook: basic input
14776 !! wikitext
14777 <tag>input</tag>
14778 !! html
14779 <pre>
14780 'input'
14781 array (
14782 )
14783 </pre>
14784
14785 !! end
14786
14787
14788 !! test
14789 Parser hook: case insensitive
14790 !! wikitext
14791 <TAG>input</TAG>
14792 !! html
14793 <pre>
14794 'input'
14795 array (
14796 )
14797 </pre>
14798
14799 !! end
14800
14801
14802 !! test
14803 Parser hook: case insensitive, redux
14804 !! wikitext
14805 <TaG>input</TAg>
14806 !! html
14807 <pre>
14808 'input'
14809 array (
14810 )
14811 </pre>
14812
14813 !! end
14814
14815 !! test
14816 Parser hook: nested tags
14817 !! options
14818 noxml
14819 !! wikitext
14820 <tag><tag></tag></tag>
14821 !! html
14822 <pre>
14823 '<tag>'
14824 array (
14825 )
14826 </pre>&lt;/tag&gt;
14827
14828 !! end
14829
14830 !! test
14831 Parser hook: basic arguments
14832 !! wikitext
14833 <tag width=200 height = "100" depth = '50' square></tag>
14834 !! html
14835 <pre>
14836 ''
14837 array (
14838 'width' => '200',
14839 'height' => '100',
14840 'depth' => '50',
14841 'square' => 'square',
14842 )
14843 </pre>
14844
14845 !! end
14846
14847 !! test
14848 Parser hook: argument containing a forward slash (bug 5344)
14849 !! wikitext
14850 <tag filename='/tmp/bla'></tag>
14851 !! html
14852 <pre>
14853 ''
14854 array (
14855 'filename' => '/tmp/bla',
14856 )
14857 </pre>
14858
14859 !! end
14860
14861 !! test
14862 Parser hook: empty input using terminated empty elements (bug 2374)
14863 !! wikitext
14864 <tag foo=bar/>text
14865 !! html
14866 <pre>
14867 NULL
14868 array (
14869 'foo' => 'bar',
14870 )
14871 </pre>text
14872
14873 !! end
14874
14875 # </tag> should be output literally since there is no matching tag that begins it
14876 !! test
14877 Parser hook: basic arguments using terminated empty elements (bug 2374)
14878 !! wikitext
14879 <tag width=200 height = "100" depth = '50' square/>
14880 other stuff
14881 </tag>
14882 !! html
14883 <pre>
14884 NULL
14885 array (
14886 'width' => '200',
14887 'height' => '100',
14888 'depth' => '50',
14889 'square' => 'square',
14890 )
14891 </pre>
14892 <p>other stuff
14893 &lt;/tag&gt;
14894 </p>
14895 !! end
14896
14897 ###
14898 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14899 ###
14900
14901 !! test
14902 Parser hook: static parser hook not inside a comment
14903 !! wikitext
14904 <statictag>hello, world</statictag>
14905 <statictag action=flush/>
14906 !! html
14907 <p>hello, world
14908 </p>
14909 !! end
14910
14911
14912 !! test
14913 Parser hook: static parser hook inside a comment
14914 !! wikitext
14915 <!-- <statictag>hello, world</statictag> -->
14916 <statictag action=flush/>
14917 !! html
14918 <p><br />
14919 </p>
14920 !! end
14921
14922 # Nested template calls; this case was broken by Parser.php rev 1.506,
14923 # since reverted.
14924
14925 !! article
14926 Template:One-parameter
14927 !! text
14928 (My parameter is: {{{1}}})
14929 !! endarticle
14930
14931 !! article
14932 Template:Map-one-parameter
14933 !! text
14934 {{{{{1}}}|{{{2}}}}}
14935 !! endarticle
14936
14937 !! test
14938 Nested template calls
14939 !! wikitext
14940 {{Map-one-parameter|One-parameter|param}}
14941 !! html
14942 <p>(My parameter is: param)
14943 </p>
14944 !! end
14945
14946
14947 ###
14948 ### Sanitizer
14949 ###
14950
14951 # HTML+Tidy effectively strips out the empty tags completely
14952 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14953 # which Tidy would have done for the PHP parser had there been content inside it.
14954 !! test
14955 Sanitizer: Closing of open tags
14956 !! wikitext
14957 <s></s><table></table>
14958 !! html
14959 <s></s><table></table>
14960
14961 !! html/parsoid
14962 <p><s></s></p><table></table>
14963 !! end
14964
14965 !! test
14966 Sanitizer: Closing of open but not closed tags
14967 !! wikitext
14968 <s>foo
14969 !! html
14970 <p><s>foo</s>
14971 </p>
14972 !! end
14973
14974 !! test
14975 Sanitizer: Closing of closed but not open tags
14976 !! wikitext
14977 </s>
14978 !! html
14979 <p>&lt;/s&gt;
14980 </p>
14981 !! end
14982
14983 !! test
14984 Sanitizer: Closing of closed but not open table tags
14985 !! wikitext
14986 Table not started</td></tr></table>
14987 !! html
14988 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14989 </p>
14990 !! end
14991
14992 !! test
14993 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14994 !! wikitext
14995 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14996 !! html
14997 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14998 </p>
14999 !! end
15000
15001 # In HTML5, the restrictions are that id must contain at least one character,
15002 # and must not contain any space characters.
15003 !! test
15004 Sanitizer: Validating the contents of the id attribute (bug 4515)
15005 !! options
15006 disabled
15007 !! wikitext
15008 <br id="" /><br id="a space" />
15009 !! html
15010 Something ...
15011 !! end
15012
15013 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15014 !! test
15015 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15016 !! options
15017 disabled
15018 !! wikitext
15019 <br id="foo" /><br id="foo" />
15020 !! html
15021 Something need to be done. foo-2 ?
15022 !! end
15023
15024 !! test
15025 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15026 !! wikitext
15027 <div itemscope>
15028 <meta itemprop="hello" content="world">
15029 <meta http-equiv="refresh" content="5">
15030 <meta itemprop="hello" http-equiv="refresh" content="5">
15031 <link itemprop="hello" href="{{SERVER}}">
15032 <link rel="stylesheet" href="{{SERVER}}">
15033 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15034 </div>
15035 !! html
15036 <div itemscope="itemscope">
15037 <p> <meta itemprop="hello" content="world" />
15038 &lt;meta http-equiv="refresh" content="5"&gt;
15039 <meta itemprop="hello" content="5" />
15040 </p>
15041 <link itemprop="hello" href="http&#58;//example.org" />
15042 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15043 <link itemprop="hello" href="http&#58;//example.org" />
15044 </div>
15045
15046 !! end
15047
15048 !! test
15049 Language converter: output gets cut off unexpectedly (bug 5757)
15050 !! options
15051 language=zh
15052 !! wikitext
15053 this bit is safe: }-
15054
15055 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15056
15057 then we get cut off here: }-
15058
15059 all additional text is vanished
15060 !! html
15061 <p>this bit is safe: }-
15062 </p><p>but if we add a conversion instance: xxx
15063 </p><p>then we get cut off here: }-
15064 </p><p>all additional text is vanished
15065 </p>
15066 !! end
15067
15068 !! test
15069 Self closed html pairs (bug 5487)
15070 !! options
15071 !! wikitext
15072 <center><font id="bug" />Centered text</center>
15073 <div><font id="bug2" />In div text</div>
15074 !! html
15075 <center>&lt;font id="bug" /&gt;Centered text</center>
15076 <div>&lt;font id="bug2" /&gt;In div text</div>
15077
15078 !! end
15079
15080 #
15081 #
15082 #
15083
15084 !! test
15085 Punctuation: nbsp before exclamation
15086 !! wikitext
15087 C'est grave !
15088 !! html
15089 <p>C'est grave&#160;!
15090 </p>
15091 !! end
15092
15093 !! test
15094 Punctuation: CSS !important (bug 11874)
15095 !! wikitext
15096 <div style="width:50% !important">important</div>
15097 !! html
15098 <div style="width:50% !important">important</div>
15099
15100 !!end
15101
15102 !! test
15103 Punctuation: CSS ! important (bug 11874; with space after)
15104 !! wikitext
15105 <div style="width:50% ! important">important</div>
15106 !! html
15107 <div style="width:50% ! important">important</div>
15108
15109 !!end
15110
15111 !! test
15112 HTML bullet list, closed tags (bug 5497)
15113 !! wikitext
15114 <ul>
15115 <li>One</li>
15116 <li>Two</li>
15117 </ul>
15118 !! html/php
15119 <ul>
15120 <li>One</li>
15121 <li>Two</li>
15122 </ul>
15123
15124 !! html/parsoid
15125 <ul data-parsoid='{"stx":"html"}'>
15126 <li data-parsoid='{"stx":"html"}'>One</li>
15127 <li data-parsoid='{"stx":"html"}'>Two</li>
15128 </ul>
15129
15130 !! end
15131
15132 !! test
15133 HTML bullet list, unclosed tags (bug 5497)
15134 !! wikitext
15135 <ul>
15136 <li>One
15137 <li>Two
15138 </ul>
15139 !! html/php+tidy
15140 <ul>
15141 <li>One</li>
15142 <li>Two</li>
15143 </ul>
15144 !! html/parsoid
15145 <ul data-parsoid='{"stx":"html"}'>
15146 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15147 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15148 </ul>
15149
15150 !! end
15151
15152 !! test
15153 HTML ordered list, closed tags (bug 5497)
15154 !! wikitext
15155 <ol>
15156 <li>One</li>
15157 <li>Two</li>
15158 </ol>
15159 !! html/php
15160 <ol>
15161 <li>One</li>
15162 <li>Two</li>
15163 </ol>
15164
15165 !! html/parsoid
15166 <ol data-parsoid='{"stx":"html"}'>
15167 <li data-parsoid='{"stx":"html"}'>One</li>
15168 <li data-parsoid='{"stx":"html"}'>Two</li>
15169 </ol>
15170
15171 !! end
15172
15173 !! test
15174 HTML ordered list, unclosed tags (bug 5497)
15175 !! options
15176 !! wikitext
15177 <ol>
15178 <li>One
15179 <li>Two
15180 </ol>
15181 !! html/php+tidy
15182 <ol>
15183 <li>One</li>
15184 <li>Two</li>
15185 </ol>
15186 !! html/parsoid
15187 <ol data-parsoid='{"stx":"html"}'>
15188 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15189 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15190 </ol>
15191
15192 !! end
15193
15194 !! test
15195 HTML nested bullet list, closed tags (bug 5497)
15196 !! wikitext
15197 <ul>
15198 <li>One</li>
15199 <li>Two:
15200 <ul>
15201 <li>Sub-one</li>
15202 <li>Sub-two</li>
15203 </ul>
15204 </li>
15205 </ul>
15206 !! html
15207 <ul>
15208 <li>One</li>
15209 <li>Two:
15210 <ul>
15211 <li>Sub-one</li>
15212 <li>Sub-two</li>
15213 </ul>
15214 </li>
15215 </ul>
15216
15217 !! end
15218
15219 !! test
15220 HTML nested bullet list, open tags (bug 5497)
15221 !! wikitext
15222 <ul>
15223 <li>One
15224 <li>Two:
15225 <ul>
15226 <li>Sub-one
15227 <li>Sub-two
15228 </ul>
15229 </ul>
15230 !! html/php+tidy
15231 <ul>
15232 <li>One</li>
15233 <li>Two:
15234 <ul>
15235 <li>Sub-one</li>
15236 <li>Sub-two</li>
15237 </ul>
15238 </li>
15239 </ul>
15240 !! html/parsoid
15241 <ul>
15242 <li>One
15243 </li>
15244 <li>Two:
15245 <ul>
15246 <li>Sub-one
15247 </li>
15248 <li>Sub-two
15249 </li>
15250 </ul>
15251 </li>
15252 </ul>
15253
15254 !! end
15255
15256 !! test
15257 HTML nested ordered list, closed tags (bug 5497)
15258 !! wikitext
15259 <ol>
15260 <li>One</li>
15261 <li>Two:
15262 <ol>
15263 <li>Sub-one</li>
15264 <li>Sub-two</li>
15265 </ol>
15266 </li>
15267 </ol>
15268 !! html
15269 <ol>
15270 <li>One</li>
15271 <li>Two:
15272 <ol>
15273 <li>Sub-one</li>
15274 <li>Sub-two</li>
15275 </ol>
15276 </li>
15277 </ol>
15278
15279 !! end
15280
15281 !! test
15282 HTML nested ordered list, open tags (bug 5497)
15283 !! wikitext
15284 <ol>
15285 <li>One
15286 <li>Two:
15287 <ol>
15288 <li>Sub-one
15289 <li>Sub-two
15290 </ol>
15291 </ol>
15292 !! html/php
15293 <ol>
15294 <li>One
15295 <li>Two:
15296 <ol>
15297 <li>Sub-one
15298 <li>Sub-two
15299 </ol>
15300 </ol>
15301
15302 !! html/parsoid
15303 <ol>
15304 <li>One
15305 </li>
15306 <li>Two:
15307 <ol>
15308 <li>Sub-one
15309 </li>
15310 <li>Sub-two
15311 </li>
15312 </ol>
15313 </li>
15314 </ol>
15315
15316 !! end
15317
15318 !! test
15319 HTML ordered list item with parameters oddity
15320 !! wikitext
15321 <ol><li id="fragment">One</li>
15322 </ol>
15323 !! html
15324 <ol><li id="fragment">One</li>
15325 </ol>
15326
15327 !! end
15328
15329 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15330 !!test
15331 bug 5918: autonumbering
15332 !! wikitext
15333 [http://first/] [http://second] [ftp://ftp]
15334
15335 ftp://inlineftp
15336
15337 [mailto:enclosed@mail.tld With target]
15338
15339 [mailto:enclosed@mail.tld]
15340
15341 mailto:inline@mail.tld
15342 !! html/php
15343 <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>
15344 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15345 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15346 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15347 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15348 </p>
15349 !! html/parsoid
15350 <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>
15351 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15352 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15353 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15354 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15355 !! end
15356
15357
15358 #
15359 # Security and HTML correctness
15360 # From Nick Jenkins' fuzz testing
15361 #
15362
15363 !! test
15364 Fuzz testing: Parser13
15365 !! wikitext
15366 {|
15367 | http://a|
15368 !! html
15369 <table>
15370 <tr>
15371 <td>
15372 </td>
15373 </tr>
15374 </table>
15375
15376 !! end
15377
15378 !! test
15379 Fuzz testing: Parser14
15380 !! wikitext
15381 == onmouseover= ==
15382 http://__TOC__
15383 !! html
15384 <h2><a href="#onmouseover.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15385 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15386 <ul>
15387 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15388 </ul>
15389 </div>
15390
15391
15392 !! html+tidy
15393 <h2><a href="#onmouseover.3D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15394 <p>http://</p>
15395 <div id="toc" class="toc">
15396 <div id="toctitle">
15397 <h2>Contents</h2>
15398 </div>
15399 <ul>
15400 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15401 </ul>
15402 </div>
15403 !! end
15404
15405 !! test
15406 Fuzz testing: Parser14-table
15407 !! wikitext
15408 ==a==
15409 {| STYLE=__TOC__
15410 !! html
15411 <h2><a href="#a" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15412 <table style="&#95;_TOC&#95;_">
15413 <tr><td></td></tr>
15414 </table>
15415
15416 !! html+tidy
15417 <h2><a href="#a" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15418 <table style="__TOC__">
15419 <tr>
15420 <td></td>
15421 </tr>
15422 </table>
15423 !! end
15424
15425 # Known to produce bogus xml (extra </td>)
15426 !! test
15427 Fuzz testing: Parser16
15428 !! options
15429 noxml
15430 !! wikitext
15431 {|
15432 !https://||||||
15433 !! html
15434 <table>
15435 <tr>
15436 <th>https://</th>
15437 <th></th>
15438 <th></th>
15439 <th>
15440 </td>
15441 </tr>
15442 </table>
15443
15444 !! html+tidy
15445 <table>
15446 <tr>
15447 <th>https://</th>
15448 <th></th>
15449 <th></th>
15450 <th></th>
15451 </tr>
15452 </table>
15453 !! end
15454
15455 !! test
15456 Fuzz testing: Parser21
15457 !! wikitext
15458 {|
15459 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15460 |
15461 !! html
15462 <table>
15463 <tr>
15464 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15465 </th>
15466 <td>
15467 </td>
15468 </tr>
15469 </table>
15470
15471 !! end
15472
15473 !! test
15474 Fuzz testing: Parser22
15475 !! wikitext
15476 http://===r:::https://b
15477
15478 {|
15479 !! html
15480 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15481 </p>
15482 <table>
15483 <tr><td></td></tr>
15484 </table>
15485
15486 !! end
15487
15488 # Known to produce bad XML for now
15489 !! test
15490 Fuzz testing: Parser24
15491 !! options
15492 noxml
15493 !! wikitext
15494 {|
15495 {{{|
15496 <u CLASS=
15497 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15498 <br style="onmouseover='alert(document.cookie);' " />
15499
15500 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15501 |
15502 !! html
15503 <table>
15504 {{{|
15505 <u class="&#124;">}}}} &gt;
15506 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15507
15508 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15509 <tr>
15510 <td></u>
15511 </td>
15512 </tr>
15513 </table>
15514
15515 !! end
15516
15517 # Note: the current result listed for this is not what the original one was,
15518 # but the original bug was JavaScript injection, which is fixed in any case.
15519 # It's not clear that the original result listed was any more correct than the
15520 # current one. Original result:
15521 # <p>{{{|
15522 # </p>
15523 # <li class="&#124;&#124;">
15524 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15525 !!test
15526 Fuzz testing: Parser25 (bug 6055)
15527 !! wikitext
15528 {{{
15529 |
15530 <LI CLASS=||
15531 >
15532 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15533 !! html
15534 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15535 </p>
15536 !! end
15537
15538 !!test
15539 Fuzz testing: URL adjacent extension (with space, clean)
15540 !! wikitext
15541 http://example.com <nowiki>junk</nowiki>
15542 !! html/php
15543 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15544 </p>
15545 !! html/parsoid
15546 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15547 !! end
15548
15549 !!test
15550 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15551 !! wikitext
15552 http://example.com<nowiki>junk</nowiki>
15553 !! html/php
15554 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15555 </p>
15556 !! html/parsoid
15557 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15558 !! end
15559
15560 !!test
15561 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15562 !! wikitext
15563 http://example.com<pre>junk</pre>
15564 !! html/php
15565 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15566
15567 !! html/php+tidy
15568 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15569 <pre>
15570 junk
15571 </pre>
15572 !! html/parsoid
15573 <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>
15574 !!end
15575
15576 !!test
15577 Fuzz testing: image with bogus manual thumbnail
15578 !! wikitext
15579 [[Image:foobar.jpg|thumbnail= ]]
15580 !! html/php
15581 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
15582
15583 !! html/parsoid
15584 <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>
15585 !!end
15586
15587 !! test
15588 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15589 !! wikitext
15590 <pre dir="&#10;"></pre>
15591 !! html
15592 <pre dir="&#10;"></pre>
15593
15594 !! end
15595
15596 !! test
15597 Parsing optional HTML elements (Bug 6171)
15598 !! options
15599 !! wikitext
15600 <table>
15601 <tr>
15602 <td> Some tabular data</td>
15603 <td> More tabular data ...
15604 <td> And yet som tabular data</td>
15605 </tr>
15606 </table>
15607 !! html
15608 <table>
15609 <tr>
15610 <td> Some tabular data</td>
15611 <td> More tabular data ...
15612 </td><td> And yet som tabular data</td>
15613 </tr>
15614 </table>
15615
15616 !! end
15617
15618 !! test
15619 Correct handling of <td>, <tr> (Bug 6171)
15620 !! options
15621 !! wikitext
15622 <table>
15623 <tr>
15624 <td> Some tabular data</td>
15625 <td> More tabular data ...</td>
15626 <td> And yet som tabular data</td>
15627 </tr>
15628 </table>
15629 !! html
15630 <table>
15631 <tr>
15632 <td> Some tabular data</td>
15633 <td> More tabular data ...</td>
15634 <td> And yet som tabular data</td>
15635 </tr>
15636 </table>
15637
15638 !! end
15639
15640
15641 !! test
15642 Parsing crashing regression (fr:JavaScript)
15643 !! wikitext
15644 </body></x>
15645 !! html
15646 <p>&lt;/body&gt;&lt;/x&gt;
15647 </p>
15648 !! end
15649
15650 !! test
15651 Inline wiki vs wiki block nesting
15652 !! wikitext
15653 '''Bold paragraph
15654
15655 New wiki paragraph
15656 !! html
15657 <p><b>Bold paragraph</b>
15658 </p><p>New wiki paragraph
15659 </p>
15660 !! end
15661
15662 # FIXME: The current php output is documented
15663 # and desired output is the parsoid target.
15664 !! test
15665 Inline HTML vs wiki block nesting
15666 !! wikitext
15667 <b>Bold paragraph
15668
15669 New wiki paragraph
15670 !! html/php
15671 <p><b>Bold paragraph
15672 </p><p>New wiki paragraph</b>
15673 </p>
15674 !! html/parsoid
15675 <p><b>Bold paragraph</b>
15676 </p><p>New wiki paragraph
15677 </p>
15678 !! end
15679
15680 # Original result was this:
15681 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15682 # </p>
15683 # While that might be marginally more intuitive, maybe, the six-apostrophe
15684 # construct is clearly pathological and the result stated here (which is what
15685 # the parser actually does) is about as reasonable as anything.
15686 !!test
15687 Mixing markup for italics and bold
15688 !! options
15689 !! wikitext
15690 '''bold''''''bold''bolditalics'''''
15691 !! html
15692 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15693 </p>
15694 !! end
15695
15696
15697 !! article
15698 Xyzzyx
15699 !! text
15700 Article for special page transclusion test
15701 !! endarticle
15702
15703 !! test
15704 Special page transclusion
15705 !! options
15706 !! wikitext
15707 {{Special:Prefixindex/Xyzzyx}}
15708 !! html
15709 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15710
15711 !! end
15712
15713 !! test
15714 Special page transclusion twice (bug 5021)
15715 !! options
15716 !! wikitext
15717 {{Special:Prefixindex/Xyzzyx}}
15718 {{Special:Prefixindex/Xyzzyx}}
15719 !! html
15720 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15721 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15722
15723 !! end
15724
15725 !! test
15726 Transclusion of default MediaWiki message
15727 !! wikitext
15728 {{MediaWiki:Mainpage}}
15729 !! html
15730 <p>Main Page
15731 </p>
15732 !! end
15733
15734 !! test
15735 Transclusion of nonexistent MediaWiki message
15736 !! wikitext
15737 {{MediaWiki:Mainpagexxx}}
15738 !! html
15739 <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>
15740 </p>
15741 !! end
15742
15743 !! test
15744 Transclusion of MediaWiki message with underscore
15745 !! wikitext
15746 {{MediaWiki:history_short}}
15747 !! html
15748 <p>History
15749 </p>
15750 !! end
15751
15752 !! test
15753 Transclusion of MediaWiki message with space
15754 !! wikitext
15755 {{MediaWiki:history short}}
15756 !! html
15757 <p>History
15758 </p>
15759 !! end
15760
15761 !! test
15762 Invalid header with following text
15763 !! wikitext
15764 = x = y
15765 !! html
15766 <p>= x = y
15767 </p>
15768 !! end
15769
15770
15771 !! test
15772 Section extraction test (section 0)
15773 !! options
15774 section=0
15775 !! wikitext
15776 start
15777 ==a==
15778 ===aa===
15779 ====aaa====
15780 ==b==
15781 ===ba===
15782 ===bb===
15783 ====bba====
15784 ===bc===
15785 ==c==
15786 ===ca===
15787 !! html
15788 start
15789 !! end
15790
15791 !! test
15792 Section extraction test (section 1)
15793 !! options
15794 section=1
15795 !! wikitext
15796 start
15797 ==a==
15798 ===aa===
15799 ====aaa====
15800 ==b==
15801 ===ba===
15802 ===bb===
15803 ====bba====
15804 ===bc===
15805 ==c==
15806 ===ca===
15807 !! html
15808 ==a==
15809 ===aa===
15810 ====aaa====
15811 !! end
15812
15813 !! test
15814 Section extraction test (section 2)
15815 !! options
15816 section=2
15817 !! wikitext
15818 start
15819 ==a==
15820 ===aa===
15821 ====aaa====
15822 ==b==
15823 ===ba===
15824 ===bb===
15825 ====bba====
15826 ===bc===
15827 ==c==
15828 ===ca===
15829 !! html
15830 ===aa===
15831 ====aaa====
15832 !! end
15833
15834 !! test
15835 Section extraction test (section 3)
15836 !! options
15837 section=3
15838 !! wikitext
15839 start
15840 ==a==
15841 ===aa===
15842 ====aaa====
15843 ==b==
15844 ===ba===
15845 ===bb===
15846 ====bba====
15847 ===bc===
15848 ==c==
15849 ===ca===
15850 !! html
15851 ====aaa====
15852 !! end
15853
15854 !! test
15855 Section extraction test (section 4)
15856 !! options
15857 section=4
15858 !! wikitext
15859 start
15860 ==a==
15861 ===aa===
15862 ====aaa====
15863 ==b==
15864 ===ba===
15865 ===bb===
15866 ====bba====
15867 ===bc===
15868 ==c==
15869 ===ca===
15870 !! html
15871 ==b==
15872 ===ba===
15873 ===bb===
15874 ====bba====
15875 ===bc===
15876 !! end
15877
15878 !! test
15879 Section extraction test (section 5)
15880 !! options
15881 section=5
15882 !! wikitext
15883 start
15884 ==a==
15885 ===aa===
15886 ====aaa====
15887 ==b==
15888 ===ba===
15889 ===bb===
15890 ====bba====
15891 ===bc===
15892 ==c==
15893 ===ca===
15894 !! html
15895 ===ba===
15896 !! end
15897
15898 !! test
15899 Section extraction test (section 6)
15900 !! options
15901 section=6
15902 !! wikitext
15903 start
15904 ==a==
15905 ===aa===
15906 ====aaa====
15907 ==b==
15908 ===ba===
15909 ===bb===
15910 ====bba====
15911 ===bc===
15912 ==c==
15913 ===ca===
15914 !! html
15915 ===bb===
15916 ====bba====
15917 !! end
15918
15919 !! test
15920 Section extraction test (section 7)
15921 !! options
15922 section=7
15923 !! wikitext
15924 start
15925 ==a==
15926 ===aa===
15927 ====aaa====
15928 ==b==
15929 ===ba===
15930 ===bb===
15931 ====bba====
15932 ===bc===
15933 ==c==
15934 ===ca===
15935 !! html
15936 ====bba====
15937 !! end
15938
15939 !! test
15940 Section extraction test (section 8)
15941 !! options
15942 section=8
15943 !! wikitext
15944 start
15945 ==a==
15946 ===aa===
15947 ====aaa====
15948 ==b==
15949 ===ba===
15950 ===bb===
15951 ====bba====
15952 ===bc===
15953 ==c==
15954 ===ca===
15955 !! html
15956 ===bc===
15957 !! end
15958
15959 !! test
15960 Section extraction test (section 9)
15961 !! options
15962 section=9
15963 !! wikitext
15964 start
15965 ==a==
15966 ===aa===
15967 ====aaa====
15968 ==b==
15969 ===ba===
15970 ===bb===
15971 ====bba====
15972 ===bc===
15973 ==c==
15974 ===ca===
15975 !! html
15976 ==c==
15977 ===ca===
15978 !! end
15979
15980 !! test
15981 Section extraction test (section 10)
15982 !! options
15983 section=10
15984 !! wikitext
15985 start
15986 ==a==
15987 ===aa===
15988 ====aaa====
15989 ==b==
15990 ===ba===
15991 ===bb===
15992 ====bba====
15993 ===bc===
15994 ==c==
15995 ===ca===
15996 !! html
15997 ===ca===
15998 !! end
15999
16000 !! test
16001 Section extraction test (nonexistent section 11)
16002 !! options
16003 section=11
16004 !! wikitext
16005 start
16006 ==a==
16007 ===aa===
16008 ====aaa====
16009 ==b==
16010 ===ba===
16011 ===bb===
16012 ====bba====
16013 ===bc===
16014 ==c==
16015 ===ca===
16016 !! html
16017 !! end
16018
16019 !! test
16020 Section extraction test with bogus heading (section 1)
16021 !! options
16022 section=1
16023 !! wikitext
16024 ==a==
16025 ==bogus== not a legal section
16026 ==b==
16027 !! html
16028 ==a==
16029 ==bogus== not a legal section
16030 !! end
16031
16032 !! test
16033 Section extraction test with bogus heading (section 2)
16034 !! options
16035 section=2
16036 !! wikitext
16037 ==a==
16038 ==bogus== not a legal section
16039 ==b==
16040 !! html
16041 ==b==
16042 !! end
16043
16044 !! test
16045 Section extraction test with comment after heading (section 1)
16046 !! options
16047 section=1
16048 !! wikitext
16049 ==a==
16050 ==b== <!-- -->
16051 ==c==
16052 !! html
16053 ==a==
16054 !! end
16055
16056 !! test
16057 Section extraction test with comment after heading (section 2)
16058 !! options
16059 section=2
16060 !! wikitext
16061 ==a==
16062 ==b== <!-- -->
16063 ==c==
16064 !! html
16065 ==b== <!-- -->
16066 !! end
16067
16068 !! test
16069 Section extraction test with bogus <nowiki> heading (section 1)
16070 !! options
16071 section=1
16072 !! wikitext
16073 ==a==
16074 ==bogus== <nowiki>not a legal section</nowiki>
16075 ==b==
16076 !! html
16077 ==a==
16078 ==bogus== <nowiki>not a legal section</nowiki>
16079 !! end
16080
16081 !! test
16082 Section extraction test with bogus <nowiki> heading (section 2)
16083 !! options
16084 section=2
16085 !! wikitext
16086 ==a==
16087 ==bogus== <nowiki>not a legal section</nowiki>
16088 ==b==
16089 !! html
16090 ==b==
16091 !! end
16092
16093
16094 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16095 # instead of respecting commented sections
16096 !! test
16097 Section extraction prefixed by comment (section 1)
16098 !! options
16099 section=1
16100 !! wikitext
16101 <!-- -->==sec1==
16102 ==sec2==
16103 !! html
16104 ==sec2==
16105 !!end
16106
16107 !! test
16108 Section extraction prefixed by comment (section 2)
16109 !! options
16110 section=2
16111 !! wikitext
16112 <!-- -->==sec1==
16113 ==sec2==
16114 !! html
16115
16116 !!end
16117
16118
16119 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16120 # instead of respecting HTML-style headings
16121 !! test
16122 Section extraction, mixed wiki and html (section 1)
16123 !! options
16124 section=1
16125 !! wikitext
16126 <h2>unmarked</h2>
16127 unmarked
16128 ==1==
16129 one
16130 ==2==
16131 two
16132 !! html
16133 ==1==
16134 one
16135 !! end
16136
16137 !! test
16138 Section extraction, mixed wiki and html (section 2)
16139 !! options
16140 section=2
16141 !! wikitext
16142 <h2>unmarked</h2>
16143 unmarked
16144 ==1==
16145 one
16146 ==2==
16147 two
16148 !! html
16149 ==2==
16150 two
16151 !! end
16152
16153
16154 # Formerly testing for bug 3342
16155 !! test
16156 Section extraction, heading surrounded by <noinclude>
16157 !! options
16158 section=1
16159 !! wikitext
16160 <noinclude>==unmarked==</noinclude>
16161 ==marked==
16162 !! html
16163 ==marked==
16164 !!end
16165
16166 # Test behavior of bug 19910
16167 !! test
16168 Sectiion with all-equals
16169 !! options
16170 section=2
16171 !! wikitext
16172 ===
16173 The line above must have a trailing space
16174 === <!--
16175 --> <!-- -->
16176 But just in case it doesn't...
16177 !! html
16178 === <!--
16179 --> <!-- -->
16180 But just in case it doesn't...
16181 !! end
16182
16183 !! test
16184 Section replacement test (section 0)
16185 !! options
16186 replace=0,"xxx"
16187 !! wikitext
16188 start
16189 ==a==
16190 ===aa===
16191 ====aaa====
16192 ==b==
16193 ===ba===
16194 ===bb===
16195 ====bba====
16196 ===bc===
16197 ==c==
16198 ===ca===
16199 !! html
16200 xxx
16201
16202 ==a==
16203 ===aa===
16204 ====aaa====
16205 ==b==
16206 ===ba===
16207 ===bb===
16208 ====bba====
16209 ===bc===
16210 ==c==
16211 ===ca===
16212 !! end
16213
16214 !! test
16215 Section replacement test (section 1)
16216 !! options
16217 replace=1,"xxx"
16218 !! wikitext
16219 start
16220 ==a==
16221 ===aa===
16222 ====aaa====
16223 ==b==
16224 ===ba===
16225 ===bb===
16226 ====bba====
16227 ===bc===
16228 ==c==
16229 ===ca===
16230 !! html
16231 start
16232 xxx
16233
16234 ==b==
16235 ===ba===
16236 ===bb===
16237 ====bba====
16238 ===bc===
16239 ==c==
16240 ===ca===
16241 !! end
16242
16243 !! test
16244 Section replacement test (section 2)
16245 !! options
16246 replace=2,"xxx"
16247 !! wikitext
16248 start
16249 ==a==
16250 ===aa===
16251 ====aaa====
16252 ==b==
16253 ===ba===
16254 ===bb===
16255 ====bba====
16256 ===bc===
16257 ==c==
16258 ===ca===
16259 !! html
16260 start
16261 ==a==
16262 xxx
16263
16264 ==b==
16265 ===ba===
16266 ===bb===
16267 ====bba====
16268 ===bc===
16269 ==c==
16270 ===ca===
16271 !! end
16272
16273 !! test
16274 Section replacement test (section 3)
16275 !! options
16276 replace=3,"xxx"
16277 !! wikitext
16278 start
16279 ==a==
16280 ===aa===
16281 ====aaa====
16282 ==b==
16283 ===ba===
16284 ===bb===
16285 ====bba====
16286 ===bc===
16287 ==c==
16288 ===ca===
16289 !! html
16290 start
16291 ==a==
16292 ===aa===
16293 xxx
16294
16295 ==b==
16296 ===ba===
16297 ===bb===
16298 ====bba====
16299 ===bc===
16300 ==c==
16301 ===ca===
16302 !! end
16303
16304 !! test
16305 Section replacement test (section 4)
16306 !! options
16307 replace=4,"xxx"
16308 !! wikitext
16309 start
16310 ==a==
16311 ===aa===
16312 ====aaa====
16313 ==b==
16314 ===ba===
16315 ===bb===
16316 ====bba====
16317 ===bc===
16318 ==c==
16319 ===ca===
16320 !! html
16321 start
16322 ==a==
16323 ===aa===
16324 ====aaa====
16325 xxx
16326
16327 ==c==
16328 ===ca===
16329 !! end
16330
16331 !! test
16332 Section replacement test (section 5)
16333 !! options
16334 replace=5,"xxx"
16335 !! wikitext
16336 start
16337 ==a==
16338 ===aa===
16339 ====aaa====
16340 ==b==
16341 ===ba===
16342 ===bb===
16343 ====bba====
16344 ===bc===
16345 ==c==
16346 ===ca===
16347 !! html
16348 start
16349 ==a==
16350 ===aa===
16351 ====aaa====
16352 ==b==
16353 xxx
16354
16355 ===bb===
16356 ====bba====
16357 ===bc===
16358 ==c==
16359 ===ca===
16360 !! end
16361
16362 !! test
16363 Section replacement test (section 6)
16364 !! options
16365 replace=6,"xxx"
16366 !! wikitext
16367 start
16368 ==a==
16369 ===aa===
16370 ====aaa====
16371 ==b==
16372 ===ba===
16373 ===bb===
16374 ====bba====
16375 ===bc===
16376 ==c==
16377 ===ca===
16378 !! html
16379 start
16380 ==a==
16381 ===aa===
16382 ====aaa====
16383 ==b==
16384 ===ba===
16385 xxx
16386
16387 ===bc===
16388 ==c==
16389 ===ca===
16390 !! end
16391
16392 !! test
16393 Section replacement test (section 7)
16394 !! options
16395 replace=7,"xxx"
16396 !! wikitext
16397 start
16398 ==a==
16399 ===aa===
16400 ====aaa====
16401 ==b==
16402 ===ba===
16403 ===bb===
16404 ====bba====
16405 ===bc===
16406 ==c==
16407 ===ca===
16408 !! html
16409 start
16410 ==a==
16411 ===aa===
16412 ====aaa====
16413 ==b==
16414 ===ba===
16415 ===bb===
16416 xxx
16417
16418 ===bc===
16419 ==c==
16420 ===ca===
16421 !! end
16422
16423 !! test
16424 Section replacement test (section 8)
16425 !! options
16426 replace=8,"xxx"
16427 !! wikitext
16428 start
16429 ==a==
16430 ===aa===
16431 ====aaa====
16432 ==b==
16433 ===ba===
16434 ===bb===
16435 ====bba====
16436 ===bc===
16437 ==c==
16438 ===ca===
16439 !! html
16440 start
16441 ==a==
16442 ===aa===
16443 ====aaa====
16444 ==b==
16445 ===ba===
16446 ===bb===
16447 ====bba====
16448 xxx
16449
16450 ==c==
16451 ===ca===
16452 !!end
16453
16454 !! test
16455 Section replacement test (section 9)
16456 !! options
16457 replace=9,"xxx"
16458 !! wikitext
16459 start
16460 ==a==
16461 ===aa===
16462 ====aaa====
16463 ==b==
16464 ===ba===
16465 ===bb===
16466 ====bba====
16467 ===bc===
16468 ==c==
16469 ===ca===
16470 !! html
16471 start
16472 ==a==
16473 ===aa===
16474 ====aaa====
16475 ==b==
16476 ===ba===
16477 ===bb===
16478 ====bba====
16479 ===bc===
16480 xxx
16481 !! end
16482
16483 !! test
16484 Section replacement test (section 10)
16485 !! options
16486 replace=10,"xxx"
16487 !! wikitext
16488 start
16489 ==a==
16490 ===aa===
16491 ====aaa====
16492 ==b==
16493 ===ba===
16494 ===bb===
16495 ====bba====
16496 ===bc===
16497 ==c==
16498 ===ca===
16499 !! html
16500 start
16501 ==a==
16502 ===aa===
16503 ====aaa====
16504 ==b==
16505 ===ba===
16506 ===bb===
16507 ====bba====
16508 ===bc===
16509 ==c==
16510 xxx
16511 !! end
16512
16513 !! test
16514 Section replacement test with initial whitespace (bug 13728)
16515 !! options
16516 replace=2,"xxx"
16517 !! wikitext
16518 Preformatted initial line
16519 ==a==
16520 ===a===
16521 !! html
16522 Preformatted initial line
16523 ==a==
16524 xxx
16525 !! end
16526
16527
16528 !! test
16529 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16530 !! options
16531 section=1
16532 !! wikitext
16533 ==a==
16534 a
16535 !! html
16536 ==a==
16537 a
16538 !! end
16539
16540 !! test
16541 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16542 !! options
16543 section=1
16544 !! wikitext
16545 ==a==
16546 a
16547 !! html
16548 ==a==
16549 a
16550 !! end
16551
16552
16553 !! test
16554 Section extraction, <pre> around bogus header (bug 10309)
16555 !! options
16556 noxml section=2
16557 !! wikitext
16558 == Section One ==
16559 <pre>
16560 =======
16561 </pre>
16562
16563 == Section Two ==
16564 stuff
16565 !! html
16566 == Section Two ==
16567 stuff
16568 !! end
16569
16570 !! test
16571 Section replacement, <pre> around bogus header (bug 10309)
16572 !! options
16573 noxml replace=2,"xxx"
16574 !! wikitext
16575 == Section One ==
16576 <pre>
16577 =======
16578 </pre>
16579
16580 == Section Two ==
16581 stuff
16582 !! html
16583 == Section One ==
16584 <pre>
16585 =======
16586 </pre>
16587
16588 xxx
16589 !! end
16590
16591
16592
16593 !! test
16594 Handling of &#x0A; in URLs
16595 !! wikitext
16596 ** irc://&#x0A;a
16597 !! html/php
16598 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16599
16600 !! html/parsoid
16601 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16602 a">irc://
16603 a</a></li></ul></li></ul>
16604 !! end
16605
16606 !! test
16607 Handling of %0A in URLs
16608 !! wikitext
16609 ** irc://%0Aa
16610 !! html/php
16611 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16612
16613 !! html/parsoid
16614 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16615 !! end
16616
16617
16618 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16619 !! test
16620 5 quotes, code coverage +1 line
16621 !! options
16622 parsoid=wt2html
16623 !! wikitext
16624 '''''
16625 !! html/php
16626 !! html/parsoid
16627 <p><b><i></i></b></p>
16628 !! end
16629
16630 # same html as previous, but wikitext adjusted to match parsoid html2wt
16631 # note that wt2html and html2html will put the <i> before the <b>
16632 !! test
16633 5 quotes, code coverage +1 line w/ nowiki (1)
16634 !! options
16635 parsoid=wt2wt,html2wt
16636 !! wikitext
16637 '''''<nowiki/>'''''
16638 !! html/php
16639 <p><i></i>
16640 </p>
16641 !! html/parsoid
16642 <p><b><i></i></b></p>
16643 !! end
16644
16645 # same as previous, just swapping the <i> and <b>
16646 !! test
16647 5 quotes, code coverage +1 line w/ nowiki (2)
16648 !! wikitext
16649 '''''<nowiki/>'''''
16650 !! html/php
16651 <p><i></i>
16652 </p>
16653 !! html/parsoid
16654 <p><i><b></b></i></p>
16655 !! end
16656
16657 !! test
16658 Special:Search page linking.
16659 !! wikitext
16660 {{Special:search}}
16661 !! html
16662 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16663 </p>
16664 !! end
16665
16666 !! test
16667 {{!}} is a magic word
16668 !! wikitext
16669 {{!}} is a magic word there and {{!}} is still a magic word here
16670 !! html/php
16671 <p>| is a magic word there and | is still a magic word here
16672 </p>
16673 !! html/parsoid
16674 <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>
16675 !! end
16676
16677 !! test
16678 Say the magic word
16679 !! options
16680 title=[[Parser test]]
16681 !! wikitext
16682 * {{PAGENAME}}
16683 * {{PAGENAMEE}}
16684 * {{FULLPAGENAME}}
16685 * {{FULLPAGENAMEE}}
16686 * {{BASEPAGENAME}}
16687 * {{BASEPAGENAMEE}}
16688 * {{SUBPAGENAME}}
16689 * {{SUBPAGENAMEE}}
16690 * {{ROOTPAGENAME}}
16691 * {{ROOTPAGENAMEE}}
16692 * {{TALKPAGENAME}}
16693 * {{TALKPAGENAMEE}}
16694 * {{SUBJECTPAGENAME}}
16695 * {{SUBJECTPAGENAMEE}}
16696 * {{NAMESPACEE}}
16697 * {{NAMESPACE}}
16698 * {{NAMESPACENUMBER}}
16699 * {{TALKSPACE}}
16700 * {{TALKSPACEE}}
16701 * {{SUBJECTSPACE}}
16702 * {{SUBJECTSPACEE}}
16703 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16704 !! html
16705 <ul><li> Parser test</li>
16706 <li> Parser_test</li>
16707 <li> Parser test</li>
16708 <li> Parser_test</li>
16709 <li> Parser test</li>
16710 <li> Parser_test</li>
16711 <li> Parser test</li>
16712 <li> Parser_test</li>
16713 <li> Parser test</li>
16714 <li> Parser_test</li>
16715 <li> Talk:Parser test</li>
16716 <li> Talk:Parser_test</li>
16717 <li> Parser test</li>
16718 <li> Parser_test</li>
16719 <li> </li>
16720 <li> </li>
16721 <li> 0</li>
16722 <li> Talk</li>
16723 <li> Talk</li>
16724 <li> </li>
16725 <li> </li>
16726 <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>
16727
16728 !! end
16729 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16730
16731 !! test
16732 Gallery
16733 !! wikitext
16734 <gallery>
16735 image1.png |
16736 image2.gif|||||
16737
16738 image3|
16739 image4 |300px| centre
16740 image5.svg| http://///////
16741 [[x|xx]]]]
16742 * image6
16743 </gallery>
16744 !! html
16745 <ul class="gallery mw-gallery-traditional">
16746 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16747 <div class="thumb" style="height: 150px;">Image1.png</div>
16748 <div class="gallerytext">
16749 </div>
16750 </div></li>
16751 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16752 <div class="thumb" style="height: 150px;">Image2.gif</div>
16753 <div class="gallerytext">
16754 <p>||||
16755 </p>
16756 </div>
16757 </div></li>
16758 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16759 <div class="thumb" style="height: 150px;">Image3</div>
16760 <div class="gallerytext">
16761 </div>
16762 </div></li>
16763 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16764 <div class="thumb" style="height: 150px;">Image4</div>
16765 <div class="gallerytext">
16766 <p>300px| centre
16767 </p>
16768 </div>
16769 </div></li>
16770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16771 <div class="thumb" style="height: 150px;">Image5.svg</div>
16772 <div class="gallerytext">
16773 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16774 </p>
16775 </div>
16776 </div></li>
16777 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16778 <div class="thumb" style="height: 150px;">* image6</div>
16779 <div class="gallerytext">
16780 </div>
16781 </div></li>
16782 </ul>
16783
16784 !! end
16785
16786 !! test
16787 Gallery (with options)
16788 !! wikitext
16789 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16790 File:Nonexistent.jpg|caption
16791 File:Nonexistent.jpg
16792 image:foobar.jpg|some '''caption''' [[Main Page]]
16793 image:foobar.jpg
16794 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16795 </gallery>
16796 !! html
16797 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16798 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16799 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16800 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16801 <div class="gallerytext">
16802 <p>caption
16803 </p>
16804 </div>
16805 </div></li>
16806 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16807 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16808 <div class="gallerytext">
16809 </div>
16810 </div></li>
16811 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16812 <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" /></a></div></div>
16813 <div class="gallerytext">
16814 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16815 </p>
16816 </div>
16817 </div></li>
16818 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16819 <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" /></a></div></div>
16820 <div class="gallerytext">
16821 </div>
16822 </div></li>
16823 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16824 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
16825 <div class="gallerytext">
16826 <p>Blabla|blabla.
16827 </p>
16828 </div>
16829 </div></li>
16830 </ul>
16831
16832 !! end
16833
16834 !! test
16835 Gallery with link that has fragment
16836 !! wikitext
16837 <gallery>
16838 image:foobar.jpg|link=Main_Page
16839 image:foobar.jpg|link=Main_Page#section
16840 image:foobar.jpg|link=Main Page#section|caption
16841 </gallery>
16842 !! html
16843 <ul class="gallery mw-gallery-traditional">
16844 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16845 <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" /></a></div></div>
16846 <div class="gallerytext">
16847 </div>
16848 </div></li>
16849 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16850 <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" /></a></div></div>
16851 <div class="gallerytext">
16852 </div>
16853 </div></li>
16854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16855 <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" /></a></div></div>
16856 <div class="gallerytext">
16857 <p>caption
16858 </p>
16859 </div>
16860 </div></li>
16861 </ul>
16862
16863 !! end
16864
16865 !! test
16866 Gallery with wikitext inside caption
16867 !! wikitext
16868 <gallery>
16869 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16870 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16871 </gallery>
16872 !! html
16873 <ul class="gallery mw-gallery-traditional">
16874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16875 <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" /></a></div></div>
16876 <div class="gallerytext">
16877 <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>
16878 </p>
16879 </div>
16880 </div></li>
16881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16882 <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" /></a></div></div>
16883 <div class="gallerytext">
16884 <p>This is a test template
16885 </p>
16886 </div>
16887 </div></li>
16888 </ul>
16889
16890 !! end
16891
16892 !! test
16893 gallery (with showfilename option)
16894 !! wikitext
16895 <gallery showfilename>
16896 File:Nonexistent.jpg|caption
16897 File:Nonexistent.jpg
16898 image:foobar.jpg|some '''caption''' [[Main Page]]
16899 File:Foobar.jpg
16900 </gallery>
16901 !! html
16902 <ul class="gallery mw-gallery-traditional">
16903 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16904 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16905 <div class="gallerytext">
16906 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16907 caption
16908 </p>
16909 </div>
16910 </div></li>
16911 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16912 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16913 <div class="gallerytext">
16914 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16915 </p>
16916 </div>
16917 </div></li>
16918 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16919 <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" /></a></div></div>
16920 <div class="gallerytext">
16921 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16922 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16923 </p>
16924 </div>
16925 </div></li>
16926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16927 <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" /></a></div></div>
16928 <div class="gallerytext">
16929 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16930 </p>
16931 </div>
16932 </div></li>
16933 </ul>
16934
16935 !! end
16936
16937 !! test
16938 Gallery (with namespace-less filenames)
16939 !! wikitext
16940 <gallery>
16941 File:Nonexistent.jpg
16942 Nonexistent.jpg
16943 image:foobar.jpg
16944 foobar.jpg
16945 </gallery>
16946 !! html
16947 <ul class="gallery mw-gallery-traditional">
16948 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16949 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16950 <div class="gallerytext">
16951 </div>
16952 </div></li>
16953 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16954 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16955 <div class="gallerytext">
16956 </div>
16957 </div></li>
16958 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16959 <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" /></a></div></div>
16960 <div class="gallerytext">
16961 </div>
16962 </div></li>
16963 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16964 <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" /></a></div></div>
16965 <div class="gallerytext">
16966 </div>
16967 </div></li>
16968 </ul>
16969
16970 !! end
16971
16972 !! test
16973 HTML Hex character encoding (spells the word "JavaScript")
16974 !! options
16975 parsoid=wt2html,wt2wt,html2html
16976 !! wikitext
16977 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16978 !! html/php
16979 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16980 </p>
16981 !! html/php+tidy
16982 <p>JavaScript</p>
16983 !! html/parsoid
16984 <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>
16985 !! end
16986
16987 !! test
16988 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16989 !! wikitext
16990 &#xsee;&#XSEE;
16991 !! html/php
16992 <p>&amp;#xsee;&amp;#XSEE;
16993 </p>
16994 !! html/parsoid
16995 <p>&amp;#xsee;&amp;#XSEE;</p>
16996 !! end
16997
16998 !! test
16999 HTML Hex character encoding mixed case
17000 !! options
17001 parsoid=wt2html,wt2wt,html2html
17002 !! wikitext
17003 &#xEE;&#Xee;
17004 !! html/php
17005 <p>&#xee;&#xee;
17006 </p>
17007 !! html/php+tidy
17008 <p>îî</p>
17009 !! html/parsoid
17010 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17011 !! end
17012
17013 !! test
17014 __FORCETOC__ override
17015 !! wikitext
17016 __NEWSECTIONLINK__
17017 __FORCETOC__
17018 !! html
17019 <p><br />
17020 </p>
17021 !! end
17022
17023 !! test
17024 ISBN code coverage
17025 !! wikitext
17026 ISBN 978-0-1234-56&#x20;789
17027 !! html
17028 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17029 </p>
17030 !! html+tidy
17031 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17032 !! html/parsoid
17033 <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>
17034 !! end
17035
17036 !! test
17037 ISBN followed by 5 spaces
17038 !! wikitext
17039 ISBN
17040 !! html
17041 <p>ISBN
17042 </p>
17043 !! end
17044
17045 !! test
17046 Double ISBN
17047 !! wikitext
17048 ISBN ISBN 1234567890
17049 !! html/php
17050 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17051 </p>
17052 !! html/parsoid
17053 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17054 !! end
17055
17056 !! test
17057 ISBN with an X
17058 !! wikitext
17059 ISBN 3-462-04561-X
17060 ISBN 080442957X
17061 ISBN 978080442957X
17062 !! html/php
17063 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17064 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17065 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17066 </p>
17067 !! html/parsoid
17068 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17069 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17070 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17071 !! end
17072
17073 !! test
17074 ISBN with empty prefix (parsoid test)
17075 !! wikitext
17076 ISBN 1234567890
17077 !! html/php
17078 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17079 </p>
17080 !! html/parsoid
17081 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17082 !! end
17083
17084 !! test
17085 Bug 22905: <abbr> followed by ISBN followed by </a>
17086 !! wikitext
17087 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17088 !! html/php
17089 <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>
17090 </p>
17091 !! html/parsoid
17092 <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>
17093 !! end
17094
17095 !! test
17096 Double RFC
17097 !! wikitext
17098 RFC RFC 1234
17099 !! html
17100 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17101 </p>
17102 !! end
17103
17104 !! test
17105 Double RFC with a wiki link
17106 !! wikitext
17107 RFC [[RFC 1234]]
17108 !! html
17109 <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>
17110 </p>
17111 !! end
17112
17113 !! test
17114 RFC code coverage
17115 !! wikitext
17116 RFC 983&#x20;987
17117 !! html
17118 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17119 </p>
17120 !! html+tidy
17121 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17122 !! end
17123
17124 !! test
17125 Centre-aligned image
17126 !! wikitext
17127 [[Image:foobar.jpg|centre]]
17128 !! html
17129 <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>
17130
17131 !!end
17132
17133 !! test
17134 None-aligned image
17135 !! wikitext
17136 [[Image:foobar.jpg|none]]
17137 !! html
17138 <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>
17139
17140 !!end
17141
17142 !! test
17143 Width + Height sized image (using px) (height is ignored)
17144 !! wikitext
17145 [[Image:foobar.jpg|640x480px]]
17146 !! html
17147 <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>
17148 </p>
17149 !!end
17150
17151 !! test
17152 Width-sized image (using px, no following whitespace)
17153 !! wikitext
17154 [[Image:foobar.jpg|640px]]
17155 !! html
17156 <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>
17157 </p>
17158 !!end
17159
17160 !! test
17161 Width-sized image (using px, with following whitespace - test regression from r39467)
17162 !! wikitext
17163 [[Image:foobar.jpg|640px ]]
17164 !! html
17165 <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>
17166 </p>
17167 !!end
17168
17169 !! test
17170 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17171 !! wikitext
17172 [[Image:foobar.jpg| 640px]]
17173 !! html
17174 <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>
17175 </p>
17176 !!end
17177
17178 !! test
17179 Image with page parameter
17180 !! options
17181 djvu
17182 !! wikitext
17183 [[File:LoremIpsum.djvu|page=2]]
17184 !! html/php
17185 <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>
17186 </p>
17187 !! html/parsoid
17188 <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>
17189 !! end
17190
17191 !! test
17192 Another italics / bold test
17193 !! wikitext
17194 ''' ''x'
17195 !! html
17196 <pre>'<i> </i>x'
17197 </pre>
17198 !!end
17199
17200 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17201 !! test
17202 dt/dd/dl test
17203 !! wikitext
17204 :;;;::
17205 !! html/php
17206 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17207
17208 !! html/parsoid
17209 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17210
17211 !!end
17212
17213
17214 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17215 !! test
17216 Images with the "|" character in the comment
17217 !! wikitext
17218 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17219 !! html/php
17220 <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>
17221
17222 !! html/parsoid
17223 <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>
17224 !! end
17225
17226 !! test
17227 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17228 !! wikitext
17229 <html><script>alert(1);</script></html>
17230 !! html
17231 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17232 </p>
17233 !! end
17234
17235 !! test
17236 HTML with raw HTML ($wgRawHtml==true)
17237 !! options
17238 wgRawHtml=1
17239 !! wikitext
17240 <html><script>alert(1);</script></html>
17241 !! html
17242 <p><script>alert(1);</script>
17243 </p>
17244 !! end
17245
17246 !! test
17247 Parents of subpages, one level up
17248 !! options
17249 subpage title=[[Subpage test/L1/L2/L3]]
17250 !! wikitext
17251 [[../|L2]]
17252 !! html
17253 <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>
17254 </p>
17255 !! end
17256
17257
17258 !! test
17259 Parents of subpages, one level up, not named
17260 !! options
17261 subpage title=[[Subpage test/L1/L2/L3]]
17262 !! wikitext
17263 [[../]]
17264 !! html
17265 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
17266 </p>
17267 !! end
17268
17269
17270
17271 !! test
17272 Parents of subpages, two levels up
17273 !! options
17274 subpage title=[[Subpage test/L1/L2/L3]]
17275 !! wikitext
17276 [[../../|L1]]2
17277
17278 [[../../|L1]]l
17279 !! html
17280 <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
17281 </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>
17282 </p>
17283 !! end
17284
17285 !! test
17286 Parents of subpages, two levels up, without trailing slash or name.
17287 !! options
17288 subpage title=[[Subpage test/L1/L2/L3]]
17289 !! wikitext
17290 [[../..]]
17291 !! html
17292 <p>[[../..]]
17293 </p>
17294 !! end
17295
17296 !! test
17297 Parents of subpages, two levels up, with lots of extra trailing slashes.
17298 !! options
17299 subpage title=[[Subpage test/L1/L2/L3]]
17300 !! wikitext
17301 [[../../////]]
17302 !! html
17303 <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>
17304 </p>
17305 !! end
17306
17307 !! article
17308 Subpage test/L1/L2/L3Sibling
17309 !! text
17310 Sibling article
17311 !! endarticle
17312
17313 !! test
17314 Transclusion of a sibling page (one level up)
17315 !! options
17316 subpage title=[[Subpage test/L1/L2/L3]]
17317 !! wikitext
17318 {{../L3Sibling}}
17319 !! html
17320 <p>Sibling article
17321 </p>
17322 !! end
17323
17324 !! test
17325 Transclusion of a child page
17326 !! options
17327 subpage title=[[Subpage test/L1/L2]]
17328 !! wikitext
17329 {{/L3Sibling}}
17330 !! html
17331 <p>Sibling article
17332 </p>
17333 !! end
17334
17335 !! test
17336 Non-transclusion because of too many up levels
17337 !! options
17338 subpage title=[[Subpage test/L1/L2/L3]]
17339 !! wikitext
17340 {{../../../../More than parent}}
17341 !! html
17342 <p>{{../../../../More than parent}}
17343 </p>
17344 !! end
17345
17346 !! test
17347 Definition list code coverage
17348 !! wikitext
17349 ; title : def
17350 ; title : def
17351 ;title: def
17352 !! html/php
17353 <dl><dt> title &#160;</dt>
17354 <dd> def</dd>
17355 <dt> title&#160;</dt>
17356 <dd> def</dd>
17357 <dt>title</dt>
17358 <dd> def</dd></dl>
17359
17360 !! html/parsoid
17361 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17362 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17363 <dt>title</dt><dd> def</dd></dl>
17364 !! end
17365
17366 !! test
17367 Don't fall for the self-closing div
17368 !! wikitext
17369 <div>hello world</div/>
17370 !! html
17371 <div>hello world</div>
17372
17373 !! end
17374
17375 !! test
17376 MSGNW magic word
17377 !! wikitext
17378 {{MSGNW:msg}}
17379 !! html
17380 <p>&#91;&#91;:Template:Msg&#93;&#93;
17381 </p>
17382 !! end
17383
17384 !! test
17385 RAW magic word
17386 !! wikitext
17387 {{RAW:QUERTY}}
17388 !! html
17389 <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>
17390 </p>
17391 !! end
17392
17393 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17394 !! test
17395 Always escape literal '>' in output, not just after '<'
17396 !! wikitext
17397 ><>
17398 !! html
17399 <p>&gt;&lt;&gt;
17400 </p>
17401 !! end
17402
17403 !! test
17404 Template caching
17405 !! wikitext
17406 {{Test}}
17407 {{Test}}
17408 !! html
17409 <p>This is a test template
17410 This is a test template
17411 </p>
17412 !! end
17413
17414
17415 !! article
17416 MediaWiki:Fake
17417 !! text
17418 ==header==
17419 !! endarticle
17420
17421 !! test
17422 Inclusion of !userCanEdit() content
17423 !! wikitext
17424 {{MediaWiki:Fake}}
17425 !! html
17426 <h2><a href="#header" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17427
17428 !! end
17429
17430
17431 !! test
17432 Out-of-order TOC heading levels
17433 !! wikitext
17434 ==2==
17435 ======6======
17436 ===3===
17437 =1=
17438 =====5=====
17439 ==2==
17440 !! html
17441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17442 <ul>
17443 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17444 <ul>
17445 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17446 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17447 </ul>
17448 </li>
17449 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17450 <ul>
17451 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17452 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17453 </ul>
17454 </li>
17455 </ul>
17456 </div>
17457
17458 <h2><a href="#2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17459 <h6><a href="#6" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
17460 <h3><a href="#3" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
17461 <h1><a href="#1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
17462 <h5><a href="#5" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
17463 <h2><a href="#2_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17464
17465 !! end
17466
17467
17468 !! test
17469 ISBN with a dummy number
17470 !! wikitext
17471 ISBN ---
17472 !! html
17473 <p>ISBN ---
17474 </p>
17475 !! end
17476
17477
17478 !! test
17479 ISBN with space-delimited number
17480 !! wikitext
17481 ISBN 92 9017 032 8
17482 !! html
17483 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17484 </p>
17485 !! end
17486
17487
17488 !! test
17489 ISBN with multiple spaces, no number
17490 !! wikitext
17491 ISBN foo
17492 !! html
17493 <p>ISBN foo
17494 </p>
17495 !! end
17496
17497
17498 !! test
17499 ISBN length
17500 !! wikitext
17501 ISBN 123456789
17502
17503 ISBN 1234567890
17504
17505 ISBN 12345678901
17506 !! html
17507 <p>ISBN 123456789
17508 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17509 </p><p>ISBN 12345678901
17510 </p>
17511 !! end
17512
17513
17514 !! test
17515 ISBN with trailing year (bug 8110)
17516 !! wikitext
17517 ISBN 1-234-56789-0 - 2006
17518
17519 ISBN 1 234 56789 0 - 2006
17520 !! html
17521 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17522 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17523 </p>
17524 !! end
17525
17526
17527 !! test
17528 anchorencode
17529 !! wikitext
17530 {{anchorencode:foo bar©#%n}}
17531 !! html
17532 <p>foo_bar.C2.A9.23.25n
17533 </p>
17534 !! end
17535
17536 !! test
17537 anchorencode trims spaces
17538 !! wikitext
17539 {{anchorencode: __pretty__please__}}
17540 !! html
17541 <p>pretty_please
17542 </p>
17543 !! end
17544
17545 !! test
17546 anchorencode deals with links
17547 !! wikitext
17548 {{anchorencode: [[hello|world]] [[hi]]}}
17549 !! html
17550 <p>world_hi
17551 </p>
17552 !! end
17553
17554 !! test
17555 anchorencode deals with templates
17556 !! wikitext
17557 {{anchorencode: {{Foo}} }}
17558 !! html
17559 <p>FOO
17560 </p>
17561 !! end
17562
17563 !! test
17564 anchorencode encodes like the TOC generator: (bug 18431)
17565 !! wikitext
17566 === _ +:.3A%3A&&amp;]] ===
17567 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17568 __NOEDITSECTION__
17569 !! html
17570 <h3><a href="#.2B:.3A.253A.26.26.5D.5D" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17571 <p>.2B:.3A.253A.26.26.5D.5D
17572 </p>
17573 !! end
17574
17575 !! test
17576 Bug 6200: blockquotes and paragraph formatting
17577 !! wikitext
17578 <blockquote>
17579 foo
17580 </blockquote>
17581
17582 bar
17583
17584 baz
17585 !! html
17586 <blockquote>
17587 <p>foo
17588 </p>
17589 </blockquote>
17590 <p>bar
17591 </p>
17592 <pre>baz
17593 </pre>
17594 !! end
17595
17596 !! test
17597 Bug 8293: Use of center tag ruins paragraph formatting
17598 !! wikitext
17599 <center>
17600 foo
17601 </center>
17602
17603 bar
17604
17605 baz
17606 !! html
17607 <center>
17608 <p>foo
17609 </p>
17610 </center>
17611 <p>bar
17612 </p>
17613 <pre>baz
17614 </pre>
17615 !! end
17616
17617 !!test
17618 Parsing of overlapping (improperly nested) inline html tags
17619 !! wikitext
17620 <span><s>x</span></s>
17621 !! html/php
17622 <p><span><s>x&lt;/span&gt;</s></span>
17623 </p>
17624 !! html/parsoid
17625 <p><span><s>x</s></span>
17626 </p>
17627 !!end
17628
17629 ###
17630 ### Language variants related tests
17631 ###
17632 !! test
17633 Self-link in language variants
17634 !! options
17635 title=[[Dunav]] language=sr
17636 !! wikitext
17637 Both [[Dunav]] and [[Дунав]] are names for this river.
17638 !! html
17639 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17640 </p>
17641 !!end
17642
17643 !! article
17644 Дуна
17645 !! text
17646 content
17647 !! endarticle
17648
17649 !! test
17650 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17651 !! options
17652 title=[[Duna]] language=sr
17653 !! wikitext
17654 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17655 !! html
17656 <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.
17657 </p>
17658 !! end
17659
17660 !! test
17661 Link to a section of a variant of this title shouldn't be parsed as self-link
17662 !! options
17663 title=[[Duna]] language=sr
17664 !! wikitext
17665 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17666 !! html
17667 <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.
17668 </p>
17669 !! end
17670
17671 !! test
17672 Link to pages in language variants
17673 !! options
17674 language=sr
17675 !! wikitext
17676 Main Page can be written as [[Маин Паге]]
17677 !! html
17678 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17679 </p>
17680 !!end
17681
17682
17683 !! test
17684 Multiple links to pages in language variants
17685 !! options
17686 language=sr
17687 !! wikitext
17688 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17689 !! html
17690 <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>.
17691 </p>
17692 !!end
17693
17694
17695 !! test
17696 Simple template in language variants
17697 !! options
17698 language=sr
17699 !! wikitext
17700 {{тест}}
17701 !! html
17702 <p>This is a test template
17703 </p>
17704 !! end
17705
17706
17707 !! test
17708 Template with explicit namespace in language variants
17709 !! options
17710 language=sr
17711 !! wikitext
17712 {{Template:тест}}
17713 !! html
17714 <p>This is a test template
17715 </p>
17716 !! end
17717
17718
17719 !! test
17720 Basic test for template parameter in language variants
17721 !! options
17722 language=sr
17723 !! wikitext
17724 {{парамтест|param=foo}}
17725 !! html
17726 <p>This is a test template with parameter foo
17727 </p>
17728 !! end
17729
17730
17731 !! test
17732 Simple category in language variants
17733 !! options
17734 language=sr cat
17735 !! wikitext
17736 [[Category:МедиаWики Усер'с Гуиде]]
17737 !! html
17738 <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>
17739 !! end
17740
17741
17742 !! article
17743 Category:分类
17744 !! text
17745 blah
17746 !! endarticle
17747
17748 !! article
17749 Category:分類
17750 !! text
17751 blah
17752 !! endarticle
17753
17754 !! test
17755 Don't convert blue categorylinks to another variant (bug 33210)
17756 !! options
17757 language=zh cat
17758 !! wikitext
17759 [[A]][[Category:分类]]
17760 !! html
17761 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17762 !! end
17763
17764
17765 !! test
17766 Stripping -{}- tags (language variants)
17767 !! options
17768 language=sr
17769 !! wikitext
17770 Latin proverb: -{Ne nuntium necare}-
17771 !! html
17772 <p>Latin proverb: Ne nuntium necare
17773 </p>
17774 !! end
17775
17776
17777 !! test
17778 Prevent conversion with -{}- tags (language variants)
17779 !! options
17780 language=sr variant=sr-ec
17781 !! wikitext
17782 Latinski: -{Ne nuntium necare}-
17783 !! html
17784 <p>Латински: Ne nuntium necare
17785 </p>
17786 !! end
17787
17788
17789 !! test
17790 Prevent conversion of text with -{}- tags (language variants)
17791 !! options
17792 language=sr variant=sr-ec
17793 !! wikitext
17794 Latinski: -{Ne nuntium necare}-
17795 !! html
17796 <p>Латински: Ne nuntium necare
17797 </p>
17798 !! end
17799
17800
17801 !! test
17802 Prevent conversion of links with -{}- tags (language variants)
17803 !! options
17804 language=sr variant=sr-ec
17805 !! wikitext
17806 -{[[Main Page]]}-
17807 !! html
17808 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17809 </p>
17810 !! end
17811
17812
17813 !! test
17814 -{}- tags within headlines (within html for parserConvert())
17815 !! options
17816 language=sr variant=sr-ec
17817 !! wikitext
17818 == -{Naslov}- ==
17819 !! html
17820 <h2><a href="#-.7BNaslov.7D-" class="mw-headline-anchor" title="Линк то тхис сецтион">§</a><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
17821
17822 !! end
17823
17824
17825 !! test
17826 Explicit definition of language variant alternatives
17827 !! options
17828 language=zh variant=zh-tw
17829 !! wikitext
17830 -{zh:China;zh-tw:Taiwan}-, not China
17831 !! html
17832 <p>Taiwan, not China
17833 </p>
17834 !! end
17835
17836
17837 !! test
17838 Conversion around HTML tags
17839 !! options
17840 language=sr variant=sr-ec
17841 !! wikitext
17842 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17843 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17844 !! html
17845 <p>
17846 <span title="ЛаCтин">ски</span>
17847 </p>
17848 !! end
17849
17850
17851 !! test
17852 Explicit session-wise language variant mapping (A flag and - flag)
17853 !! options
17854 language=zh variant=zh-tw
17855 !! wikitext
17856 Taiwan is not China.
17857 But -{A|zh:China;zh-tw:Taiwan}- is China,
17858 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17859 and -{China}- is China.
17860 !! html
17861 <p>Taiwan is not China.
17862 But Taiwan is Taiwan,
17863 (This should be stripped!)
17864 and China is China.
17865 </p>
17866 !! end
17867
17868 !! test
17869 Explicit session-wise language variant mapping (H flag for hide)
17870 !! options
17871 language=zh variant=zh-tw
17872 !! wikitext
17873 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17874 Taiwan is China.
17875 !! html
17876 <p>(This should be stripped!)
17877 Taiwan is Taiwan.
17878 </p>
17879 !! end
17880
17881 !! test
17882 Adding explicit conversion rule for title (T flag)
17883 !! options
17884 language=zh variant=zh-tw showtitle
17885 !! wikitext
17886 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17887 !! html
17888 Taiwan
17889 <p>Should be stripped!
17890 </p>
17891 !! end
17892
17893 !! test
17894 Testing that changing the language variant here in the tests actually works
17895 !! options
17896 language=zh variant=zh showtitle
17897 !! wikitext
17898 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17899 !! html
17900 China
17901 <p>Should be stripped!
17902 </p>
17903 !! end
17904
17905 !! test
17906 Recursive conversion of alt and title attrs shouldn't clear converter state
17907 !! options
17908 language=zh variant=zh-cn showtitle
17909 !! wikitext
17910 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17911 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17912 !! html
17913 China
17914 <p>
17915 Should be stripped<span title="Exclamation">!</span>
17916 </p>
17917 !! end
17918
17919 !! test
17920 Bug 24072: more test on conversion rule for title
17921 !! options
17922 language=zh variant=zh-tw showtitle
17923 !! wikitext
17924 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17925 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17926 !! html
17927 Taiwan
17928 <p>This should be stripped!
17929 This won't take interferes with the title rule.
17930 </p>
17931 !! end
17932
17933 !! test
17934 Partly disable title conversion if variant == main language code
17935 !! options
17936 language=zh variant=zh title=[[ZH]] showtitle
17937 !! wikitext
17938 -{T|zh-cn:CN;zh-tw:TW}-
17939 !! html
17940 ZH
17941 <p>
17942 </p>
17943 !! end
17944
17945 !! test
17946 Partly disable title conversion if variant == main language code, more
17947 !! options
17948 language=zh variant=zh title=[[ZH]] showtitle
17949 !! wikitext
17950 -{T|TW}-
17951 !! html
17952 ZH
17953 <p>
17954 </p>
17955 !! end
17956
17957 !! test
17958 Raw output of variant escape tags (R flag)
17959 !! options
17960 language=zh variant=zh-tw
17961 !! wikitext
17962 Raw: -{R|zh:China;zh-tw:Taiwan}-
17963 !! html
17964 <p>Raw: zh:China;zh-tw:Taiwan
17965 </p>
17966 !! end
17967
17968 !! test
17969 Nested using of manual convert syntax
17970 !! options
17971 language=zh variant=zh-hk
17972 !! wikitext
17973 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17974 !! html
17975 <p>Nested: Hello Hong Kong!
17976 </p>
17977 !! end
17978
17979 !! test
17980 Proper conversion of text in external links
17981 !! options
17982 language=sr variant=sr-ec
17983 !! wikitext
17984 http://www.google.com
17985 gopher://www.google.com
17986 [http://www.google.com http://www.google.com]
17987 [gopher://www.google.com gopher://www.google.com]
17988 [https://www.google.com irc://www.google.com]
17989 [ftp://www.google.com www.google.com/ftp://dir]
17990 [//www.google.com www.google.com]
17991 !! html
17992 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17993 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17994 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17995 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17996 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17997 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17998 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17999 </p>
18000 !! end
18001
18002 !! test
18003 Do not convert roman numbers to language variants
18004 !! options
18005 language=sr variant=sr-ec
18006 !! wikitext
18007 Fridrih IV je car.
18008 !! html
18009 <p>Фридрих IV је цар.
18010 </p>
18011 !! end
18012
18013 !! test
18014 Unclosed language converter markup "-{"
18015 !! options
18016 language=sr
18017 !! wikitext
18018 -{T|hello
18019 !! html
18020 <p>-{T|hello
18021 </p>
18022 !! end
18023
18024 !! test
18025 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18026 !! options
18027 language=sr
18028 !! wikitext
18029 -{R|=&gt;}-
18030 !! html
18031 <p>=&gt;
18032 </p>
18033 !!end
18034
18035 !! test
18036 Don't break link parsing if language converter markup is in the caption.
18037 !! options
18038 language=sr variant=sr-ec
18039 !! wikitext
18040 [[Main Page|-{R|main page}-]]
18041 !! html
18042 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18043 </p>
18044 !! end
18045
18046 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18047 !! test
18048 Don't break image parsing if language converter markup is in the caption.
18049 !! options
18050 language=sr
18051 !! wikitext
18052 [[File:Foobar.jpg|-{R|caption}-]]
18053 !! html/parsoid
18054 <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>
18055 </p>
18056 !! end
18057
18058 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18059 !! test
18060 Don't break list handling if language converter markup is in the item.
18061 !! options
18062 language=zh variant=zh-cn
18063 !! wikitext
18064 ;-{zh-cn:AAA;zh-tw:BBB}-
18065 !! html/php
18066 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18067
18068 !! html/parsoid
18069 <dl><dt>AAA
18070 </dt></dl>
18071 !! end
18072
18073 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18074 !! test
18075 Don't break table handling if language converter markup is in the cell.
18076 !! options
18077 language=sr variant=sr-ec
18078 !! wikitext
18079 {|
18080 |-
18081 | -{R|B}-
18082 |}
18083 !! html/php
18084 <table>
18085
18086 <tr>
18087 <td>Б}-
18088 </td></tr></table>
18089
18090 !! html/parsoid
18091 <table>
18092
18093 <tr>
18094 <td> B
18095 </td></tr></table>
18096
18097 !! end
18098
18099 !! test
18100 Bug 529: Uncovered bullet
18101 !! wikitext
18102 * Foo {{bullet}}
18103 !! html
18104 <ul><li> Foo </li>
18105 <li> Bar</li></ul>
18106
18107 !! end
18108
18109 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18110 # Templates in Wikipedia rely on this behavior, as tidy has always been
18111 # enabled there. These tests are normally run *without* tidy, so specify the
18112 # full output here.
18113 # To test realistic parsing behavior, apply a tidy-like transformation to both
18114 # the expected output and your parser's output.
18115 !! test
18116 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18117 !! wikitext
18118 ******* Foo {{bullet}}
18119 !! html
18120 <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>
18121 <li> Bar</li></ul>
18122
18123 !! end
18124
18125 !! test
18126 Bug 529: Uncovered table already at line-start
18127 !! wikitext
18128 x
18129
18130 {{table}}
18131 y
18132 !! html
18133 <p>x
18134 </p>
18135 <table>
18136 <tr>
18137 <td> 1 </td>
18138 <td> 2
18139 </td></tr>
18140 <tr>
18141 <td> 3 </td>
18142 <td> 4
18143 </td></tr></table>
18144 <p>y
18145 </p>
18146 !! end
18147
18148 !! test
18149 Bug 529: Uncovered bullet in parser function result
18150 !! wikitext
18151 * Foo {{lc:{{bullet}} }}
18152 !! html
18153 <ul><li> Foo </li>
18154 <li> bar</li></ul>
18155
18156 !! end
18157
18158 !! test
18159 Bug 5678: Double-parsed template argument
18160 !! wikitext
18161 {{lc:{{{1}}}|hello}}
18162 !! html
18163 <p>{{{1}}}
18164 </p>
18165 !! end
18166
18167 !! test
18168 Bug 5678: Double-parsed template invocation
18169 !! wikitext
18170 {{lc:{{paramtest {{!}} param = hello }} }}
18171 !! html
18172 <p>{{paramtest | param = hello }}
18173 </p>
18174 !! end
18175
18176 !! test
18177 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18178 !! options
18179 language=cs
18180 title=[[Main Page]]
18181 !! wikitext
18182 {{PRVNÍVELKÉ:ěščř}}
18183 {{prvnívelké:ěščř}}
18184 {{PRVNÍMALÉ:ěščř}}
18185 {{prvnímalé:ěščř}}
18186 {{MALÁ:ěščř}}
18187 {{malá:ěščř}}
18188 {{VELKÁ:ěščř}}
18189 {{velká:ěščř}}
18190 !! html
18191 <p>Ěščř
18192 Ěščř
18193 ěščř
18194 ěščř
18195 ěščř
18196 ěščř
18197 ĚŠČŘ
18198 ĚŠČŘ
18199 </p>
18200 !! end
18201
18202 !! test
18203 Morwen/13: Unclosed link followed by heading
18204 !! wikitext
18205 [[link
18206 ==heading==
18207 !! html
18208 <p>[[link
18209 </p>
18210 <h2><a href="#heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18211
18212 !! end
18213
18214 !! test
18215 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18216 !! wikitext
18217 {{foo|
18218 =heading=
18219 !! html
18220 <p>{{foo|
18221 </p>
18222 <h1><a href="#heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="heading">heading</span></h1>
18223
18224 !! end
18225
18226 !! test
18227 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18228 !! wikitext
18229 {{foo|
18230 ==heading==
18231 !! html
18232 <p>{{foo|
18233 </p>
18234 <h2><a href="#heading" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18235
18236 !! end
18237
18238 !! test
18239 Tildes in comments
18240 !! options
18241 pst
18242 !! wikitext
18243 <!-- ~~~~ -->
18244 !! html
18245 <!-- ~~~~ -->
18246 !! end
18247
18248 !! test
18249 Paragraphs inside divs (no extra line breaks)
18250 !! wikitext
18251 <div>Line one
18252
18253 Line two</div>
18254 !! html
18255 <div>Line one
18256 Line two</div>
18257
18258 !! end
18259
18260 !! test
18261 Paragraphs inside divs (extra line break on open)
18262 !! wikitext
18263 <div>
18264 Line one
18265
18266 Line two</div>
18267 !! html
18268 <div>
18269 <p>Line one
18270 </p>
18271 Line two</div>
18272
18273 !! end
18274
18275 !! test
18276 Paragraphs inside divs (extra line break on close)
18277 !! wikitext
18278 <div>Line one
18279
18280 Line two
18281 </div>
18282 !! html
18283 <div>Line one
18284 <p>Line two
18285 </p>
18286 </div>
18287
18288 !! end
18289
18290 !! test
18291 Paragraphs inside divs (extra line break on open and close)
18292 !! wikitext
18293 <div>
18294 Line one
18295
18296 Line two
18297 </div>
18298 !! html
18299 <div>
18300 <p>Line one
18301 </p><p>Line two
18302 </p>
18303 </div>
18304
18305 !! end
18306
18307 !! test
18308 Nesting tags, paragraphs on lines which begin with <div>
18309 !! wikitext
18310 <div></div><strong>A
18311 B</strong>
18312 !! html/php+tidy
18313 <p><strong>A</strong></p>
18314 <p><strong>B</strong></p>
18315 !! html/parsoid
18316 <div></div>
18317 <p><strong>A
18318 B</strong>
18319 </p>
18320 !! end
18321
18322 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18323 !! test
18324 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18325 !! wikitext
18326 <blockquote>Line one
18327
18328 Line two</blockquote>
18329 !! html
18330 <blockquote>Line one
18331 Line two</blockquote>
18332
18333 !! html+tidy
18334 <blockquote>
18335 <p>Line one Line two</p>
18336 </blockquote>
18337 !! end
18338
18339 !! test
18340 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18341 !! wikitext
18342 <blockquote>
18343 Line one
18344
18345 Line two</blockquote>
18346 !! html
18347 <blockquote>
18348 <p>Line one
18349 </p>
18350 Line two</blockquote>
18351
18352 !! html+tidy
18353 <blockquote>
18354 <p>Line one</p>
18355 Line two</blockquote>
18356 !! end
18357
18358 !! test
18359 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18360 !! wikitext
18361 <blockquote>Line one
18362
18363 Line two
18364 </blockquote>
18365 !! html
18366 <blockquote>Line one
18367 <p>Line two
18368 </p>
18369 </blockquote>
18370
18371 !! html+tidy
18372 <blockquote>
18373 <p>Line one</p>
18374 <p>Line two</p>
18375 </blockquote>
18376 !! end
18377
18378 !! test
18379 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18380 !! wikitext
18381 <blockquote>
18382 Line one
18383
18384 Line two
18385 </blockquote>
18386 !! html
18387 <blockquote>
18388 <p>Line one
18389 </p><p>Line two
18390 </p>
18391 </blockquote>
18392
18393 !! html+tidy
18394 <blockquote>
18395 <p>Line one</p>
18396 <p>Line two</p>
18397 </blockquote>
18398 !! end
18399
18400 !! test
18401 Paragraphs inside blockquotes/divs (no extra line breaks)
18402 !! wikitext
18403 <blockquote><div>Line one
18404
18405 Line two</div></blockquote>
18406 !! html
18407 <blockquote><div>Line one
18408 Line two</div></blockquote>
18409
18410 !! end
18411
18412 !! test
18413 Paragraphs inside blockquotes/divs (extra line break on open)
18414 !! wikitext
18415 <blockquote><div>
18416 Line one
18417
18418 Line two</div></blockquote>
18419 !! html
18420 <blockquote><div>
18421 <p>Line one
18422 </p>
18423 Line two</div></blockquote>
18424
18425 !! end
18426
18427 !! test
18428 Paragraphs inside blockquotes/divs (extra line break on close)
18429 !! wikitext
18430 <blockquote><div>Line one
18431
18432 Line two
18433 </div></blockquote>
18434 !! html
18435 <blockquote><div>Line one
18436 <p>Line two
18437 </p>
18438 </div></blockquote>
18439
18440 !! end
18441
18442 !! test
18443 Paragraphs inside blockquotes/divs (extra line break on open and close)
18444 !! wikitext
18445 <blockquote><div>
18446 Line one
18447
18448 Line two
18449 </div></blockquote>
18450 !! html
18451 <blockquote><div>
18452 <p>Line one
18453 </p><p>Line two
18454 </p>
18455 </div></blockquote>
18456
18457 !! end
18458
18459 !! test
18460 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18461 !! options
18462 wgLinkHolderBatchSize=0
18463 !! wikitext
18464 [[meatball:1]]
18465 [[meatball:2]]
18466 [[meatball:3]]
18467 !! html
18468 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18469 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18470 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18471 </p>
18472 !! end
18473
18474 !! test
18475 Free external link invading image caption
18476 !! wikitext
18477 [[Image:Foobar.jpg|thumb|http://x|hello]]
18478 !! html
18479 <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>
18480
18481 !! end
18482
18483 !! test
18484 Bug 15196: localised external link numbers
18485 !! options
18486 language=fa
18487 !! wikitext
18488 [http://en.wikipedia.org/]
18489 !! html/php
18490 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18491 </p>
18492 !! html/parsoid
18493 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18494 !! end
18495
18496 !! test
18497 Multibyte character in padleft
18498 !! wikitext
18499 {{padleft:-Hello|7|Æ}}
18500 !! html
18501 <p>Æ-Hello
18502 </p>
18503 !! end
18504
18505 !! test
18506 Multibyte character in padright
18507 !! wikitext
18508 {{padright:Hello-|7|Æ}}
18509 !! html
18510 <p>Hello-Æ
18511 </p>
18512 !! end
18513
18514 !!test
18515 formatdate parser function
18516 !! wikitext
18517 {{#formatdate:2009-03-24}}
18518 !! html
18519 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18520 </p>
18521 !! end
18522
18523 !!test
18524 formatdate parser function, with default format
18525 !! wikitext
18526 {{#formatdate:2009-03-24|mdy}}
18527 !! html
18528 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18529 </p>
18530 !! end
18531
18532 !! test
18533 Spacing of numbers in formatted dates
18534 !! wikitext
18535 {{#formatdate:January 15}}
18536 !! html
18537 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18538 </p>
18539 !! end
18540
18541 !! test
18542 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
18543 !! options
18544 language=nl title=[[MediaWiki:Common.css]]
18545 !! wikitext
18546 {{#formatdate:2009-03-24|dmy}}
18547 !! html
18548 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18549 </p>
18550 !! end
18551
18552 #
18553 #
18554 #
18555
18556 #
18557 # Edit comments
18558 #
18559
18560 !! test
18561 Edit comment with link
18562 !! options
18563 comment
18564 !! wikitext
18565 I like the [[Main Page]] a lot
18566 !! html
18567 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18568 !!end
18569
18570 !! test
18571 Edit comment with link and link text
18572 !! options
18573 comment
18574 !! wikitext
18575 I like the [[Main Page|best pages]] a lot
18576 !! html
18577 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18578 !!end
18579
18580 !! test
18581 Edit comment with link and link text with suffix
18582 !! options
18583 comment
18584 !! wikitext
18585 I like the [[Main Page|best page]]s a lot
18586 !! html
18587 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18588 !!end
18589
18590 !! test
18591 Edit comment with section link (non-local, eg in history list)
18592 !! options
18593 comment title=[[Main Page]]
18594 !! wikitext
18595 /* External links */ removed bogus entries
18596 !! html
18597 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18598 !!end
18599
18600 !! test
18601 Edit comment with section link and text before it (non-local, eg in history list)
18602 !! options
18603 comment title=[[Main Page]]
18604 !! wikitext
18605 pre-comment text /* External links */ removed bogus entries
18606 !! html
18607 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>
18608 !!end
18609
18610 !! test
18611 Edit comment with section link (local, eg in diff view)
18612 !! options
18613 comment local title=[[Main Page]]
18614 !! wikitext
18615 /* External links */ removed bogus entries
18616 !! html
18617 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18618 !!end
18619
18620 !! test
18621 Edit comment with subpage link (bug 14080)
18622 !! options
18623 comment
18624 subpage
18625 title=[[Subpage test]]
18626 !! wikitext
18627 Poked at a [[/subpage]] here...
18628 !! html
18629 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18630 !!end
18631
18632 !! test
18633 Edit comment with subpage link and link text (bug 14080)
18634 !! options
18635 comment
18636 subpage
18637 title=[[Subpage test]]
18638 !! wikitext
18639 Poked at a [[/subpage|neat little page]] here...
18640 !! html
18641 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18642 !!end
18643
18644 !! test
18645 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18646 !! options
18647 comment
18648 title=[[Subpage test]]
18649 !! wikitext
18650 Poked at a [[/subpage]] here...
18651 !! html
18652 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...
18653 !!end
18654
18655 !! test
18656 Edit comment with bare anchor link (local, as on diff)
18657 !! options
18658 comment
18659 local
18660 title=[[Main Page]]
18661 !! wikitext
18662 [[#section]]
18663 !! html
18664 <a href="#section">#section</a>
18665 !! end
18666
18667 !! test
18668 Edit comment with bare anchor link (non-local, as on history)
18669 !! options
18670 comment
18671 title=[[Main Page]]
18672 !! wikitext
18673 [[#section]]
18674 !! html
18675 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18676 !! end
18677
18678 !! test
18679 Anchor starting with underscore
18680 !! wikitext
18681 [[#_ref|One]]
18682 !! html
18683 <p><a href="#_ref">One</a>
18684 </p>
18685 !! end
18686
18687 !! test
18688 Id starting with underscore
18689 !! wikitext
18690 <div id="_ref"></div>
18691 !! html
18692 <div id="_ref"></div>
18693
18694 !! end
18695
18696 !! test
18697 Space normalisation on autocomment (bug 22784)
18698 !! options
18699 comment
18700 title=[[Main Page]]
18701 !! wikitext
18702 /* __hello__world__ */
18703 !! html
18704 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18705 !! end
18706
18707 !! test
18708 percent-encoding and + signs in comments (Bug 26410)
18709 !! options
18710 comment
18711 !! wikitext
18712 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18713 !! html
18714 <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>
18715 !! end
18716
18717 # Parsoid doesn't support this yet: see bug 73581
18718 # but it *should* omit the 'src' attribute if the image is bad.
18719 # PHP side of tests was disabled in
18720 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18721 # because of issues in the PHP parserTests infrastructure
18722 # (but the output below is indeed what the PHP side emits)
18723 !! test
18724 Bad images - basic functionality
18725 !! wikitext
18726 [[File:Bad.jpg]]
18727 !! DISABLED/html/php
18728 !! html/parsoid
18729 <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>
18730 !! end
18731
18732 !! test
18733 Bad images - bug 16039: text after bad image disappears
18734 !! wikitext
18735 Foo bar
18736 [[File:Bad.jpg]]
18737 Bar foo
18738 !! DISABLED/html/php
18739 <p>Foo bar
18740 </p><p>Bar foo
18741 </p>
18742 !! html/parsoid
18743 <p>Foo bar
18744 <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>
18745 Bar foo</p>
18746 !! end
18747
18748 !! test
18749 Verify that displaytitle works (bug #22501) no displaytitle
18750 !! options
18751 showtitle
18752 !! config
18753 wgAllowDisplayTitle=true
18754 wgRestrictDisplayTitle=false
18755 !! wikitext
18756 this is not the the title
18757 !! html
18758 Parser test
18759 <p>this is not the the title
18760 </p>
18761 !! end
18762
18763 !! test
18764 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18765 !! options
18766 showtitle
18767 title=[[Screen]]
18768 !! config
18769 wgAllowDisplayTitle=true
18770 wgRestrictDisplayTitle=false
18771 !! wikitext
18772 this is not the the title
18773 {{DISPLAYTITLE:whatever}}
18774 !! html
18775 whatever
18776 <p>this is not the the title
18777 </p>
18778 !! end
18779
18780 !! test
18781 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18782 !! options
18783 showtitle
18784 title=[[Screen]]
18785 !! config
18786 wgAllowDisplayTitle=true
18787 wgRestrictDisplayTitle=true
18788 !! wikitext
18789 this is not the the title
18790 {{DISPLAYTITLE:whatever}}
18791 !! html
18792 Screen
18793 <p>this is not the the title
18794 </p>
18795 !! end
18796
18797 !! test
18798 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18799 !! options
18800 showtitle
18801 title=[[Screen]]
18802 !! config
18803 wgAllowDisplayTitle=true
18804 wgRestrictDisplayTitle=true
18805 !! wikitext
18806 this is not the the title
18807 {{DISPLAYTITLE:screen}}
18808 !! html
18809 screen
18810 <p>this is not the the title
18811 </p>
18812 !! end
18813
18814 !! test
18815 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18816 !! options
18817 showtitle
18818 title=[[Screen]]
18819 !! config
18820 wgAllowDisplayTitle=false
18821 !! wikitext
18822 this is not the the title
18823 {{DISPLAYTITLE:screen}}
18824 !! html
18825 Screen
18826 <p>this is not the the title
18827 <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>
18828 </p>
18829 !! end
18830
18831 !! test
18832 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18833 !! options
18834 showtitle
18835 title=[[Screen]]
18836 !! config
18837 wgAllowDisplayTitle=false
18838 !! wikitext
18839 this is not the the title
18840 !! html
18841 Screen
18842 <p>this is not the the title
18843 </p>
18844 !! end
18845
18846 !! test
18847 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18848 !! options
18849 showtitle
18850 title=[[Screen]]
18851 !! config
18852 wgAllowDisplayTitle=true
18853 wgRestrictDisplayTitle=true
18854 !! wikitext
18855 this is not the the title
18856 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18857 !! html
18858 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18859 <p>this is not the the title
18860 </p>
18861 !! end
18862
18863 !! test
18864 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18865 !! options
18866 showtitle
18867 title=[[Screen]]
18868 !! config
18869 wgAllowDisplayTitle=true
18870 wgRestrictDisplayTitle=true
18871 !! wikitext
18872 this is not the the title
18873 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18874 !! html
18875 <span style="color: red;">s</span>creen
18876 <p>this is not the the title
18877 </p>
18878 !! end
18879
18880 !! test
18881 preload: check <noinclude> and <includeonly>
18882 !! options
18883 preload
18884 !! wikitext
18885 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18886 !! html
18887 Hello kind world.
18888 !! end
18889
18890 !! test
18891 preload: check <onlyinclude>
18892 !! options
18893 preload
18894 !! wikitext
18895 Goodbye <onlyinclude>Hello world</onlyinclude>
18896 !! html
18897 Hello world
18898 !! end
18899
18900 !! test
18901 preload: can pass tags through if we want to
18902 !! options
18903 preload
18904 !! wikitext
18905 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18906 !! html
18907 <includeonly>Hello world</includeonly>
18908 !! end
18909
18910 !! test
18911 preload: check that it doesn't try to do tricks
18912 !! options
18913 preload
18914 !! wikitext
18915 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18916 !! html
18917 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18918 !! end
18919
18920 !! test
18921 Play a bit with r67090 and bug 3158
18922 !! wikitext
18923 <div style="width:50% !important">&nbsp;</div>
18924 <div style="width:50%&nbsp;!important">&nbsp;</div>
18925 <div style="width:50%&#160;!important">&nbsp;</div>
18926 <div style="border : solid;">&nbsp;</div>
18927 !! html/php
18928 <div style="width:50% !important">&#160;</div>
18929 <div style="width:50% !important">&#160;</div>
18930 <div style="width:50% !important">&#160;</div>
18931 <div style="border&#160;: solid;">&#160;</div>
18932
18933 !! html/parsoid
18934 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18935 <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>
18936 <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>
18937 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18938
18939 !! end
18940
18941 !! test
18942 HTML5 data attributes
18943 !! wikitext
18944 <span data-foo="bar">Baz</span>
18945 <p data-abc-def_hij="">Quuz</p>
18946 !! html
18947 <p><span data-foo="bar">Baz</span>
18948 </p>
18949 <p data-abc-def_hij="">Quuz</p>
18950
18951 !! end
18952
18953 !! test
18954 percent-encoding and + signs in internal links (Bug 26410)
18955 !! wikitext
18956 [[User:+%]] [[Page+title%]]
18957 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18958 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18959 [[%33%45]] [[%33%45+]]
18960 !! html/php
18961 <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>
18962 <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>
18963 <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>
18964 <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>
18965 </p>
18966 !! html/parsoid
18967 <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>
18968 !! end
18969
18970 !! test
18971 Special characters in embedded file links (bug 27679)
18972 !! wikitext
18973 [[File:Contains & ampersand.jpg]]
18974 [[File:Does not exist.jpg|Title with & ampersand]]
18975 !! html/php
18976 <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>
18977 <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>
18978 </p>
18979 !! html/parsoid
18980 <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>
18981 <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>
18982 !! end
18983
18984 !! test
18985 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18986 !! wikitext
18987 Text&apos;s been normalized?
18988 !! html
18989 <p>Text&#39;s been normalized?
18990 </p>
18991 !! end
18992
18993 !! test
18994 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18995 !! wikitext
18996 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18997 !! html
18998 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18999 </p>
19000 !! end
19001
19002 !! test
19003 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
19004 !! wikitext
19005 [http://www.example.org/ ideograms]
19006 !! html
19007 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
19008 </p>
19009 !! end
19010
19011 !! test
19012 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
19013 !! wikitext
19014 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
19015 !! html
19016 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
19017 </p>
19018 !! end
19019
19020 !! article
19021 Mediawiki:loop1
19022 !! text
19023 {{Identical|A}}
19024 !! endarticle
19025
19026 !! article
19027 Mediawiki:loop2
19028 !! text
19029 {{Identical|B}}
19030 !! endarticle
19031
19032 !! article
19033 Template:Identical
19034 !! text
19035 {{int:loop1}}
19036 {{int:loop2}}
19037 !! endarticle
19038
19039 !! test
19040 Bug 31098 Template which includes system messages which includes the template
19041 !! wikitext
19042 {{Identical}}
19043 !! html
19044 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19045 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
19046 </p>
19047 !! end
19048
19049 !! test
19050 Bug31490 Turkish: ucfirst 'blah'
19051 !! options
19052 language=tr
19053 !! wikitext
19054 {{ucfirst:blah}}
19055 !! html
19056 <p>Blah
19057 </p>
19058 !! end
19059
19060 !! test
19061 Bug31490 Turkish: ucfirst 'ix'
19062 !! options
19063 language=tr
19064 !! wikitext
19065 {{ucfirst:ix}}
19066 !! html
19067 <p>İx
19068 </p>
19069 !! end
19070
19071 !! test
19072 Bug31490 Turkish: lcfirst 'BLAH'
19073 !! options
19074 language=tr
19075 !! wikitext
19076 {{lcfirst:BLAH}}
19077 !! html
19078 <p>bLAH
19079 </p>
19080 !! end
19081
19082 !! test
19083 Bug31490 Turkish: ucfırst (with a dotless i)
19084 !! options
19085 language=tr
19086 !! wikitext
19087 {{ucfırst:blah}}
19088 !! html
19089 <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>
19090 </p>
19091 !! end
19092
19093 !! test
19094 Bug31490 ucfırst (with a dotless i) with English language
19095 !! options
19096 language=en
19097 !! wikitext
19098 {{ucfırst:blah}}
19099 !! html
19100 <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>
19101 </p>
19102 !! end
19103
19104 !! test
19105 Bug 26375: TOC with italics
19106 !! options
19107 title=[[Main Page]]
19108 !! wikitext
19109 __TOC__
19110 == ''Lost'' episodes ==
19111 !! html
19112 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19113 <ul>
19114 <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>
19115 </ul>
19116 </div>
19117
19118 <h2><a href="#Lost_episodes" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19119
19120 !! end
19121
19122 !! test
19123 Bug 26375: TOC with bold
19124 !! options
19125 title=[[Main Page]]
19126 !! wikitext
19127 __TOC__
19128 == '''should be bold''' then normal text ==
19129 !! html
19130 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19131 <ul>
19132 <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>
19133 </ul>
19134 </div>
19135
19136 <h2><a href="#should_be_bold_then_normal_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19137
19138 !! end
19139
19140 !! test
19141 Bug 33845: Headings become cursive in TOC when they contain an image
19142 !! options
19143 title=[[Main Page]]
19144 !! wikitext
19145 __TOC__
19146 == Image [[Image:foobar.jpg]] ==
19147 !! html
19148 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19149 <ul>
19150 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19151 </ul>
19152 </div>
19153
19154 <h2><a href="#Image" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19155
19156 !! end
19157
19158 !! test
19159 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19160 !! options
19161 title=[[Main Page]]
19162 !! wikitext
19163 __TOC__
19164 == <blockquote>Quote</blockquote> ==
19165 !! html
19166 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19167 <ul>
19168 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19169 </ul>
19170 </div>
19171
19172 <h2><a href="#Quote" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19173
19174 !! html+tidy
19175 <div id="toc" class="toc">
19176 <div id="toctitle">
19177 <h2>Contents</h2>
19178 </div>
19179 <ul>
19180 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19181 </ul>
19182 </div>
19183 <h2><a href="#Quote" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Quote"></span></h2>
19184 <blockquote>
19185 <p><span class="mw-headline" id="Quote">Quote</span></p>
19186 </blockquote>
19187 <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>
19188 !! end
19189
19190 !! test
19191 Unclosed tags in TOC
19192 !! options
19193 title=[[Main Page]]
19194 !! wikitext
19195 __TOC__
19196 == Proof: 2 < 3 ==
19197 <small>Hanc marginis exiguitas non caperet.</small>
19198 QED
19199 !! html
19200 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19201 <ul>
19202 <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>
19203 </ul>
19204 </div>
19205
19206 <h2><a href="#Proof:_2_.3C_3" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19207 <p><small>Hanc marginis exiguitas non caperet.</small>
19208 QED
19209 </p>
19210 !! end
19211
19212 !! test
19213 Multiple tags in TOC
19214 !! wikitext
19215 __TOC__
19216 == <i>Foo</i> <b>Bar</b> ==
19217
19218 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19219 !! html
19220 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19221 <ul>
19222 <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>
19223 <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>
19224 </ul>
19225 </div>
19226
19227 <h2><a href="#Foo_Bar" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19228 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19229
19230 !! html+tidy
19231 <div id="toc" class="toc">
19232 <div id="toctitle">
19233 <h2>Contents</h2>
19234 </div>
19235 <ul>
19236 <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>
19237 <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>
19238 </ul>
19239 </div>
19240 <h2><a href="#Foo_Bar" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19241 <h2><a href="#Foo_Bar_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19242 <blockquote>
19243 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19244 </blockquote>
19245 <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>
19246 !! end
19247
19248 !! test
19249 Tags with parameters in TOC
19250 !! wikitext
19251 __TOC__
19252 == <sup class="in-h2">Hello</sup> ==
19253
19254 == <sup class="a > b">Evilbye</sup> ==
19255 !! html
19256 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19257 <ul>
19258 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19259 <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>
19260 </ul>
19261 </div>
19262
19263 <h2><a href="#Hello" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19264 <h2><a href="#b.22.3EEvilbye" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19265
19266 !! end
19267
19268 !! test
19269 span tags with directionality in TOC
19270 !! wikitext
19271 __TOC__
19272 == <span dir="ltr">C++</span> ==
19273
19274 == <span dir="rtl">זבנג!</span> ==
19275
19276 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19277
19278 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19279
19280 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19281 !! html
19282 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19283 <ul>
19284 <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>
19285 <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>
19286 <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>
19287 <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>
19288 <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>
19289 </ul>
19290 </div>
19291
19292 <h2><a href="#C.2B.2B" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19293 <h2><a href="#.D7.96.D7.91.D7.A0.D7.92.21" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19294 <h2><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19295 <h2><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19296 <h2><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19297
19298 !! end
19299
19300 !! test
19301 Bug 72884: bdi element in ToC
19302 !! wikitext
19303 __TOC__
19304 == <bdi>test</bdi> ==
19305 !! html
19306 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19307 <ul>
19308 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19309 </ul>
19310 </div>
19311
19312 <h2><a href="#test" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19313
19314 !! end
19315
19316 !! article
19317 MediaWiki:Bug32057
19318 !! text
19319 == {{int:headline_sample}} ==
19320 !! endarticle
19321
19322 !! test
19323 Bug 32057: Title needed when expanding <h> nodes.
19324 !! options
19325 title=[[Main Page]]
19326 !! wikitext
19327 {{int:Bug32057}}
19328 !! html
19329 <h2><a href="#Headline_text" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19330
19331 !! end
19332
19333 !! test
19334 Strip marker in urlencode
19335 !! wikitext
19336 {{urlencode:x<nowiki/>y}}
19337 {{urlencode:x<nowiki/>y|wiki}}
19338 {{urlencode:x<nowiki/>y|path}}
19339 !! html
19340 <p>xy
19341 xy
19342 xy
19343 </p>
19344 !! end
19345
19346 !! test
19347 Strip marker in lc
19348 !! wikitext
19349 {{lc:x<nowiki/>y}}
19350 !! html
19351 <p>xy
19352 </p>
19353 !! end
19354
19355 !! test
19356 Strip marker in uc
19357 !! wikitext
19358 {{uc:x<nowiki/>y}}
19359 !! html
19360 <p>XY
19361 </p>
19362 !! end
19363
19364 !! test
19365 Strip marker in formatNum
19366 !! wikitext
19367 {{formatnum:1<nowiki/>2}}
19368 {{formatnum:1<nowiki/>2|R}}
19369 !! html
19370 <p>12
19371 12
19372 </p>
19373 !! end
19374
19375 !! test
19376 Check noCommafy in formatNum
19377 !! options
19378 language=be-tarask
19379 !! wikitext
19380 {{formatnum:123456.78}}
19381 {{formatnum:123456.78|NOSEP}}
19382 !! html
19383 <p>123 456,78
19384 123456.78
19385 </p>
19386 !! end
19387
19388 !! test
19389 Wrong option for formatNum (bug 56199)
19390 !! wikitext
19391 {{formatnum:1,234.56|Random}}
19392 {{formatnum:1,234.56|EVERYTHING}}
19393 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19394 !! html
19395 <p>1,234.56
19396 1,234.56
19397 1,234.56
19398 </p>
19399 !! end
19400
19401 !! test
19402 Strip marker in grammar
19403 !! options
19404 language=fi
19405 !! wikitext
19406 {{grammar:elative|foo<nowiki/>bar}}
19407 !! html
19408 <p>foobarista
19409 </p>
19410 !! end
19411
19412 !! test
19413 Strip marker in padleft
19414 !! wikitext
19415 {{padleft:|2|x<nowiki/>y}}
19416 !! html
19417 <p>xy
19418 </p>
19419 !! end
19420
19421 !! test
19422 Strip marker in padright
19423 !! wikitext
19424 {{padright:|2|x<nowiki/>y}}
19425 !! html
19426 <p>xy
19427 </p>
19428 !! end
19429
19430 !! test
19431 Strip marker in anchorencode
19432 !! wikitext
19433 {{anchorencode:x<nowiki/>y}}
19434 !! html
19435 <p>xy
19436 </p>
19437 !! end
19438
19439 !! test
19440 nowiki inside link inside heading (bug 18295)
19441 !! wikitext
19442 ==[[foo|x<nowiki>y</nowiki>z]]==
19443 !! html
19444 <h2><a href="#xyz" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19445
19446 !! end
19447
19448 !! test
19449 new support for bdi element (bug 31817)
19450 !! wikitext
19451 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19452 !! html
19453 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19454
19455 !!end
19456
19457 !! test
19458 Ignore pipe between table row attributes
19459 !! wikitext
19460 {|
19461 | quux
19462 |- id=foo | style='color: red'
19463 | bar
19464 |}
19465 !! html
19466 <table>
19467 <tr>
19468 <td> quux
19469 </td></tr>
19470 <tr id="foo" style="color: red">
19471 <td> bar
19472 </td></tr></table>
19473
19474 !! end
19475
19476 !!test
19477 Gallery override link with WikiLink (bug 34852)
19478 !! wikitext
19479 <gallery>
19480 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19481 </gallery>
19482 !! html
19483 <ul class="gallery mw-gallery-traditional">
19484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19485 <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" /></a></div></div>
19486 <div class="gallerytext">
19487 <p>caption
19488 </p>
19489 </div>
19490 </div></li>
19491 </ul>
19492
19493 !! end
19494
19495 !!test
19496 Gallery override link with absolute external link (bug 34852)
19497 !! wikitext
19498 <gallery>
19499 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19500 </gallery>
19501 !! html
19502 <ul class="gallery mw-gallery-traditional">
19503 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19504 <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" /></a></div></div>
19505 <div class="gallerytext">
19506 <p>caption
19507 </p>
19508 </div>
19509 </div></li>
19510 </ul>
19511
19512 !! end
19513
19514 !!test
19515 Gallery override link with malicious javascript (bug 34852)
19516 !! wikitext
19517 <gallery>
19518 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19519 </gallery>
19520 !! html
19521 <ul class="gallery mw-gallery-traditional">
19522 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19523 <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" /></a></div></div>
19524 <div class="gallerytext">
19525 <p>caption
19526 </p>
19527 </div>
19528 </div></li>
19529 </ul>
19530
19531 !! end
19532
19533 !!test
19534 Gallery with invalid title as link (bug 43964)
19535 !! wikitext
19536 <gallery>
19537 File:foobar.jpg|link=<
19538 </gallery>
19539 !! html
19540 <ul class="gallery mw-gallery-traditional">
19541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19542 <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" /></a></div></div>
19543 <div class="gallerytext">
19544 </div>
19545 </div></li>
19546 </ul>
19547
19548 !! end
19549
19550 !!test
19551 Language parser function
19552 !! wikitext
19553 {{#language:ar}}
19554 !! html
19555 <p>العربية
19556 </p>
19557 !! end
19558
19559 !!test
19560 Padleft and padright as substr
19561 !! wikitext
19562 {{padleft:|3|abcde}}
19563 {{padright:|3|abcde}}
19564 !! html
19565 <p>abc
19566 abc
19567 </p>
19568 !! end
19569
19570 !!test
19571 Special parser function
19572 !! wikitext
19573 {{#special:RandomPage}}
19574 {{#special:BaDtItLe}}
19575 {{#special:Foobar}}
19576 !! html
19577 <p>Special:Random
19578 Special:Badtitle
19579 Special:Foobar
19580 </p>
19581 !! end
19582
19583 !!test
19584 Bug 34939 - Case insensitive link parsing ([HttP://])
19585 !! wikitext
19586 [HttP://MediaWiki.Org/]
19587 !! html/php
19588 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19589 </p>
19590 !! html/parsoid
19591 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19592 !! end
19593
19594 !!test
19595 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19596 !! wikitext
19597 [HttP://MediaWiki.Org/ MediaWiki]
19598 !! html
19599 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19600 </p>
19601 !! end
19602
19603 !!test
19604 Bug 34939 - Case insensitive link parsing (HttP://)
19605 !! wikitext
19606 HttP://MediaWiki.Org/
19607 !! html/php
19608 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19609 </p>
19610 !! html/parsoid
19611 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19612 !! end
19613
19614 !!test
19615 Disable TOC
19616 !! options
19617 notoc
19618 !! wikitext
19619 Lead
19620 == Section 1 ==
19621 == Section 2 ==
19622 == Section 3 ==
19623 == Section 4 ==
19624 == Section 5 ==
19625 !! html
19626 <p>Lead
19627 </p>
19628
19629 <h2><a href="#Section_1" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19630 <h2><a href="#Section_2" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19631 <h2><a href="#Section_3" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19632 <h2><a href="#Section_4" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19633 <h2><a href="#Section_5" class="mw-headline-anchor" title="Link to this section">§</a><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19634
19635 !! end
19636
19637
19638 ###
19639 ### Parsoid-specific tests
19640 ### Parsoid-PHP parser incompatibilities
19641 ###
19642 !!test
19643 1. SOL-sensitive wikitext tokens as template-args
19644 !!options
19645 parsoid=wt2html,wt2wt
19646 !! wikitext
19647 {{echo|*a}}
19648 {{echo|#a}}
19649 {{echo|:a}}
19650 !! html
19651 <span about="#mwt1" typeof="mw:Transclusion">
19652 </span><ul about="#mwt1"><li>a</li>
19653 </ul>
19654 <span about="#mwt2" typeof="mw:Transclusion">
19655 </span><ol about="#mwt2"><li>a</li>
19656 </ol>
19657 <span about="#mwt3" typeof="mw:Transclusion">
19658 </span><dl about="#mwt3"><dd>a</dd>
19659 </dl>
19660 !!end
19661
19662 #### -----------------------------------------------------------------
19663 #### Parsoid-specific functionality tests
19664 #### -----------------------------------------------------------------
19665
19666 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19667 # We know wt2wt will fail, but we expect selser to pass.
19668 # Due to the nature of our testing, wt2wt and selser tests will enter the
19669 # blacklist and we'll catch selser regressions based on changes to the
19670 # blacklist entries for selser tests.
19671 !! test
19672 1. Bad treebuilder fixup of formatting elt is cleaned up
19673 !! options
19674 parsoid=wt2html,wt2wt
19675 !! wikitext
19676 {|
19677 |
19678 <small>
19679 [[Image:Foobar.jpg|right|Test]]
19680 </small>
19681 |}
19682 !! html/parsoid
19683 <table>
19684 <tbody><tr><td>
19685 <small>
19686 <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>
19687 </small>
19688 </td></tr>
19689 </tbody></table>
19690 !! end
19691
19692 !! test
19693 2. Bad treebuilder fixup of formatting elt is cleaned up
19694 !! options
19695 parsoid=wt2html,wt2wt
19696 !! wikitext
19697 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19698
19699 <small>[[Image:Foobar.jpg|right|300px]]</small>
19700 !! html/parsoid
19701 <p><b>foo</b></p>
19702 <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>
19703 <p><b>bar</b></p>
19704 <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>
19705 !! end
19706
19707 #### ----------------------------------------------------------------
19708 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19709 #### tags. Parsoid's output for these tags differs from that of the
19710 #### PHP parser.
19711 #### ----------------------------------------------------------------
19712
19713 !!test
19714 Ref: 1. ref-location should be replaced with an index span
19715 !!options
19716 parsoid
19717 !! wikitext
19718 A <ref>foo</ref>
19719 B <ref name="x">foo</ref>
19720 C <ref name="y" />
19721 <references />
19722 !! html
19723 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19724 B <span about="#mwt4" class="reference" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19725 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>
19726 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19727 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19728 <li id="cite_note-x-2"><span rel="mw:referencedBy"><a href="#cite_ref-x_2-0">↑</a></span> foo</li>
19729 <li id="cite_note-y-3"><span rel="mw:referencedBy"><a href="#cite_ref-y_3-0">↑</a></span></li>
19730 </ol>
19731 !!end
19732
19733 !!test
19734 Ref: 2. ref-tags with identical names should all get the same index
19735 !!options
19736 parsoid
19737 !! wikitext
19738 A <ref name="x">foo</ref>
19739 B <ref name="x" />
19740 <references />
19741 !! html
19742 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19743 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>
19744 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19745 <li id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a></span> foo</li>
19746 </ol>
19747 !!end
19748
19749 !!test
19750 Ref: 3. spaces in ref-names should be ignored
19751 !!options
19752 parsoid
19753 !! wikitext
19754 A <ref name="x">foo</ref>
19755 B <ref name=" x " />
19756 C <ref name= x />
19757 <references />
19758 !! html
19759 <p>A <span about="#mwt2" class="reference" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19760 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>
19761 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>
19762 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19763 <li id="cite_note-x-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-x_1-0">1.0</a> <a href="#cite_ref-x_1-1">1.1</a> <a href="#cite_ref-x_1-2">1.2</a></span> foo</li>
19764 </ol>
19765 !!end
19766
19767 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19768 !!test
19769 Ref: 4. 'constructor' should be accepted as a valid ref-name
19770 !!options
19771 parsoid
19772 !! wikitext
19773 A <ref name="constructor">foo</ref>
19774 <references />
19775 !! html
19776 <p>A <span about="#mwt2" class="reference" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19777 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19778 <li id="cite_note-constructor-1"><span rel="mw:referencedBy"><a href="#cite_ref-constructor_1-0">↑</a></span> foo</li>
19779 </ol>
19780 !!end
19781
19782 !!test
19783 Ref: 5. body should accept generic wikitext
19784 !!options
19785 parsoid
19786 !! wikitext
19787 A <ref>
19788 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19789 </ref>
19790
19791 <references />
19792 !! html
19793 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19794
19795 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19796 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
19797 </li>
19798 </ol>
19799 !!end
19800
19801 !!test
19802 Ref: 6. indent-pres should not be output in ref-body
19803 !!options
19804 parsoid
19805 !! wikitext
19806 A <ref>
19807 foo
19808 bar
19809 baz
19810 </ref>
19811
19812 <references />
19813 !! html
19814 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19815
19816 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19817 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19818 bar
19819 baz
19820 </li>
19821 </ol>
19822 !!end
19823
19824 !!test
19825 Ref: 7. No p-wrapping in ref-body
19826 !!options
19827 parsoid
19828 !! wikitext
19829 A <ref>
19830 foo
19831
19832 bar
19833
19834
19835 baz
19836
19837
19838
19839 booz
19840 </ref>
19841
19842 <references />
19843 !! html
19844 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19845
19846 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19847 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19848
19849 bar
19850
19851
19852 baz
19853
19854
19855
19856 booz
19857 </li>
19858 </ol>
19859 !!end
19860
19861 !!test
19862 Ref: 8. transclusion wikitext has lower precedence
19863 !!options
19864 parsoid
19865 !! wikitext
19866 A <ref> foo {{echo|</ref> B C}}
19867
19868 <references />
19869 !! html
19870 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"src\":\"{{\",\"dsr\":[12,14,0,0]}&#39;>{{&lt;/span>echo|"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19871 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19872 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19873 </ol>
19874 !!end
19875
19876 !!test
19877 Ref: 9. unclosed comments should not leak out of ref-body
19878 !!options
19879 parsoid
19880 !! wikitext
19881 A <ref> foo <!--</ref> B C
19882 <references />
19883 !! html
19884 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19885 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19886 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <!----></li>
19887 </ol>
19888 !!end
19889
19890 !!test
19891 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19892 !!options
19893 parsoid
19894 !! wikitext
19895 A <ref> <b> foo </ref> B C
19896
19897 <references />
19898 !! html
19899 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19900
19901
19902 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19903 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19904 </ol>
19905 !!end
19906
19907 !!test
19908 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19909 !!options
19910 parsoid
19911 !! wikitext
19912 A <ref>foo</ref> B
19913 C <ref>bar</ref> D
19914 <references />
19915 !! html
19916 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19917 C <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19918 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19919 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19920 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
19921 </ol>
19922 !!end
19923
19924 !!test
19925 Ref: 12. ref-tags act as trailing newline migration barrier
19926 !!options
19927 parsoid
19928 !! wikitext
19929 <!--the newline at the end of this line moves out of the p-tag-->a
19930
19931 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19932 <ref />
19933
19934 c
19935 <references />
19936 !! html
19937 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19938
19939
19940 <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>
19941 <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>
19942
19943 <p>c</p>
19944 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19945 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span></li>
19946 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span></li>
19947 </ol>
19948 !!end
19949
19950 !!test
19951 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19952 !!options
19953 parsoid
19954 !! wikitext
19955 <ref>foo</ref> A
19956 <ref>bar
19957 </ref> B
19958 <references />
19959 !! html
19960 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19961 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
19962 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19963 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
19964 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
19965 </ol>
19966 !!end
19967
19968 !!test
19969 Ref: 14. A nested ref-tag should be emitted as plain text
19970 !!options
19971 parsoid
19972 !! wikitext
19973 <ref>foo <ref>bar</ref> baz</ref>
19974
19975 <references />
19976 !! html
19977 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19978
19979 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19980 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19981 </ol>
19982 !!end
19983
19984 !!test
19985 Ref: 15. ref-tags with identical names should get identical indexes
19986 !!options
19987 parsoid
19988 !! wikitext
19989 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19990 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19991
19992 <references />
19993 !! html
19994 <p>A1 <span about="#mwt3" class="reference" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
19995 B1 <span about="#mwt7" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19996
19997 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_1-0">1.0</a> <a href="#cite_ref-a_1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b_2-0">2.0</a> <a href="#cite_ref-b_2-1">2.1</a></span> bar</li>
19998 </ol>
19999 !!end
20000
20001 ## We don't bother wt2wt-ing non-standard whitespace
20002 !!test
20003 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
20004 !!options
20005 parsoid=wt2html
20006 !! wikitext
20007 A <ref >foo</ref >
20008
20009 <references />
20010 !! html
20011 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20012
20013 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20014 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20015 !!end
20016
20017 !!test
20018 Ref: 17. Generate valid HTML5 id/about attributes
20019 !!options
20020 parsoid
20021 !!wikitext
20022 <ref name="a b">foo</ref>
20023
20024 <references />
20025 !!html
20026 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
20027 </p>
20028
20029 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20030 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> foo</li>
20031 !!end
20032
20033 !!test
20034 Ref: 18. T58916: Extension attributes should be parsed as plain text
20035 !!options
20036 parsoid
20037 !!wikitext
20038 <ref name="{{echo|a}}">foo</ref>
20039
20040 <references />
20041 !!html
20042 <p><span class="reference" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
20043 </p>
20044
20045 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20046 <li id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> foo</li>
20047 !!end
20048
20049 !!test
20050 Ref: 19. ref-tags with identical name encodings should get identical indexes
20051 !!options
20052 parsoid
20053 !! wikitext
20054 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
20055
20056 <references />
20057 !! html
20058 <p>1 <span about="#mwt3" class="reference" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> 2 <span about="#mwt4" class="reference" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span>
20059
20060 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_.26_b_1-0">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> foo</li>
20061 </ol>
20062 !!end
20063
20064 !!test
20065 References: 1. references tag without any refs should be handled properly
20066 !!options
20067 parsoid
20068 !! wikitext
20069 <references />
20070 !! html
20071 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
20072 !!end
20073
20074 !!test
20075 References: 2. references tag with group only outputs references from that group
20076 !!options
20077 parsoid
20078 !! wikitext
20079 A <ref group="a">foo</ref>
20080 B <ref group="b">bar</ref>
20081 C <ref>baz</ref>
20082
20083 <references group="a" />
20084 <references />
20085 <references group="b" />
20086 !! html
20087 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20088 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span>
20089 C <span class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"baz"},"attrs":{}}'><a href="#cite_note-3">[1]</a></span></p>
20090
20091 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
20092 </ol>
20093 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> baz</li>
20094 </ol>
20095 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"b"}}'>
20096 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
20097 </ol>
20098 !!end
20099
20100 !!test
20101 References: 3. ref list should be cleared after processing references
20102 !!options
20103 parsoid
20104 !! wikitext
20105 A <ref>foo</ref>
20106
20107 <references />
20108
20109 B <ref>bar</ref>
20110
20111 <references />
20112 !! html
20113 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20114
20115 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
20116 </ol>
20117
20118 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20119
20120 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
20121 </ol>
20122 !!end
20123
20124 !!test
20125 References: 4. only referenced group should be cleared after processing references
20126 !!options
20127 parsoid
20128 !! wikitext
20129 A <ref group="a">afoo</ref>
20130 B <ref>bfoo</ref>
20131
20132 <references group="a" />
20133
20134 C <ref>cfoo</ref>
20135
20136 <references />
20137 !! html
20138 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
20139 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20140
20141 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> afoo</li>
20142 </ol>
20143
20144 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
20145
20146 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> cfoo</li>
20147 </ol>
20148 !!end
20149
20150 !!test
20151 References: 5. ref tags in references should be processed while ignoring all other content
20152 !!options
20153 parsoid
20154 !! wikitext
20155 A <ref name="a" />
20156 B <ref name="b">bar</ref>
20157
20158 <references>
20159 <ref name="a">foo</ref>
20160 This should just get lost.
20161 </references>
20162 !! html
20163 <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>
20164 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
20165
20166
20167 <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;{\"src\":\"&amp;lt;ref name=\\\"a\\\">foo&amp;lt;/ref>\",\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> bar</li>
20168 </ol>
20169 !!end
20170
20171 !!test
20172 References: 6. <references /> from a transclusion
20173 !!options
20174 parsoid
20175 !! wikitext
20176 <ref>Foo</ref> {{echo|<references />}}
20177 !! html
20178 <p><span about="#mwt3" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> Foo</li></ol>
20179 !!end
20180
20181 !! test
20182 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20183 !! options
20184 parsoid
20185 !! wikitext
20186 A <ref>foo bar for a</ref>
20187 B <ref group="X" name="b" />
20188
20189 <references />
20190
20191 <references group="X">
20192 <ref name="b">foo</ref>
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":{"html":"foo bar for a"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
20196 B <span about="#mwt4" class="reference" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2">[X 1]</a></span></p>
20197
20198 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo bar for a</li></ol>
20199
20200 <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;{\"src\":\"&amp;lt;ref name=\\\"b\\\">foo&amp;lt;/ref>\",\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0">↑</a></span> foo</li></ol>
20201 !! end
20202
20203 !! test
20204 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
20205 !! options
20206 parsoid
20207 !! wikitext
20208 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
20209 <references />
20210 !! html
20211 <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>
20212 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</li></ol>
20213 !!end
20214
20215 # This test only works in wt2html now as the <references /> are always generated
20216 # unless selser is active. Once T72722 is fixed, we should add a changes test
20217 # here to ensure that unrelated changes don't add the new <references /> in
20218 # wt2wt.
20219 !! test
20220 References: 9. Generate missing references list at the end
20221 !! options
20222 parsoid
20223 !! wikitext
20224 A <ref>foo</ref>
20225 B <ref group="inexistent">bar</ref>
20226 !! html
20227 <p>A <span class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B <span class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2">[inexistent 1]</a></span></</p>
20228 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20229 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li>
20230 </ol>
20231 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
20232 <li id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2">↑</a></span> bar</li>
20233 </ol>
20234 !! end
20235
20236 !! test
20237 Entities in ref name
20238 !! options
20239 parsoid
20240 !! wikitext
20241 <ref name="test &amp; me">hi</ref>
20242 <references />
20243 !! html
20244 <p><span about="#mwt2" class="reference" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20245 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
20246 <li id="cite_note-test_.26_me-1"><span rel="mw:referencedBy"><a href="#cite_ref-test_.26_me_1-0">↑</a></span> hi</li>
20247 </ol>
20248 !! end
20249
20250 # This test is wt2html only because we're permitting the serializer to produce
20251 # dirty diffs, normalizing the unclosed references to the self-closed version.
20252 !! test
20253 Generate references for unclosed references tag
20254 !! options
20255 parsoid=wt2html
20256 !! wikitext
20257 a<ref>foo</ref>
20258
20259 <references>
20260 !! html
20261 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20262
20263
20264 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20265 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20266 !! end
20267
20268 !! test
20269 New reference serializes on its own line
20270 !! options
20271 parsoid=wt2wt,html2wt
20272 !! wikitext
20273 foo
20274 <references />
20275 !! html
20276 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20277 !! end
20278
20279 #--------- Test stripping of empty nodes in template content ----------
20280 !!test
20281 Empty LI and TR nodes should be stripped from template content
20282 !!wikitext
20283 {{EmptyLITest}}
20284 {{EmptyTRTest}}
20285 !!html/parsoid
20286 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20287 <li>a</li>
20288 <li>b</li>
20289 </ul>
20290 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20291 <tbody>
20292 <tr>
20293 <td>foo</td>
20294 </tr>
20295 <tr>
20296 <td>bar</td>
20297 </tr>
20298 </tbody>
20299 </table>
20300 !!end
20301
20302 !!test
20303 Empty LI and TR nodes should not be stripped from top-level content
20304 !!wikitext
20305 * a
20306 *
20307 * b
20308 {|
20309 |-
20310 |-
20311 |foo
20312 |}
20313 !!html/parsoid
20314 <ul>
20315 <li> a</li>
20316 <li></li>
20317 <li> b</li>
20318 </ul>
20319 <table>
20320 <tbody>
20321 <tr></tr>
20322 <tr>
20323 <td>foo</td>
20324 </tr>
20325 </tbody>
20326 </table>
20327 !!end
20328
20329 !!test
20330 Empty TR nodes should not be stripped if they have any attributes set
20331 !!wikitext
20332 {{EmptyTRWithHTMLAttrTest}}
20333 !!html/parsoid
20334 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20335 <tr align="center"></tr>
20336 <tr><td>foo</td></tr>
20337 <tr align="center"></tr>
20338 <tr><td>bar</td></tr>
20339 </table>
20340 !!end
20341
20342 #### ----------------------------------------------------------------
20343 #### The following section of tests are primarily to test
20344 #### wikitext escaping capabilities of Parsoid. Given that
20345 #### escaping can be done any number of ways, the wikitext (input)
20346 #### is always adjusted to reflect how Parsoid adds nowiki
20347 #### escape tags.
20348 ####
20349 #### We are marking several tests as parsoid-only since the
20350 #### HTML in the result section is different from what the
20351 #### PHP parser generates for it.
20352 #### ----------------------------------------------------------------
20353
20354
20355 #### --------------- Headings ---------------
20356 #### 0. Unnested
20357 #### 1. Nested inside html <h1>=foo=</h1>
20358 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20359 #### 3. Nested inside html with wikitext split by html tags
20360 #### 4. No escape needed
20361 #### 5. Empty headings <h1></h1>
20362 #### 6. Heading chars in SOL context
20363 #### ----------------------------------------
20364 !! test
20365 Headings: 0. Unnested
20366 !! options
20367 parsoid
20368 !! wikitext
20369 <nowiki>=foo=</nowiki>
20370
20371 <nowiki> =foo= </nowiki>
20372 <!--cmt-->
20373 <nowiki>=foo=</nowiki>
20374
20375 =foo''a''<nowiki>=</nowiki>
20376 !! html
20377 <p><span typeof="mw:Nowiki">=foo=</span></p>
20378
20379 <p><span typeof="mw:Nowiki"> =foo= </span>
20380 <!--cmt-->
20381 <span typeof="mw:Nowiki">=foo=</span></p>
20382
20383 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20384 !!end
20385
20386 # New headings and existing headings are handled differently
20387 !! test
20388 Headings: 1. Nested inside html
20389 !! options
20390 parsoid=html2wt
20391 !! html
20392 <h1>=foo=</h1>
20393 <h2>=foo=</h2>
20394 <h3>=foo=</h3>
20395
20396 <h1 data-parsoid=''>=foo=</h1>
20397 <h2 data-parsoid=''>=foo=</h2>
20398 <h3 data-parsoid=''>=foo=</h3>
20399 <h4 data-parsoid=''>=foo=</h4>
20400 <h5 data-parsoid=''>=foo=</h5>
20401 <h6 data-parsoid=''>=foo=</h6>
20402 !! wikitext
20403 = =foo= =
20404
20405 == =foo= ==
20406
20407 === =foo= ===
20408
20409 =<nowiki>=foo=</nowiki>=
20410 ==<nowiki>=foo=</nowiki>==
20411 ===<nowiki>=foo=</nowiki>===
20412 ====<nowiki>=foo=</nowiki>====
20413 =====<nowiki>=foo=</nowiki>=====
20414 ======<nowiki>=foo=</nowiki>======
20415
20416 !!end
20417
20418 !! test
20419 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20420 !! options
20421 parsoid=html2wt
20422 !! html
20423 <h1>foo</h1>*bar
20424 <h1>foo</h1>=bar
20425 <h1>foo</h1>=bar=
20426 !! wikitext
20427 = foo =
20428 <nowiki>*</nowiki>bar
20429
20430 = foo =
20431 =bar
20432
20433 = foo =
20434 <nowiki>=bar=</nowiki>
20435 !!end
20436
20437 !! test
20438 Headings: 3. Nested inside html with wikitext split by html tags
20439 !! options
20440 parsoid=html2wt,wt2wt
20441 !! wikitext
20442 = ='''bold'''<nowiki>foo=</nowiki> =
20443 !! html/parsoid
20444 <h1>=<b>bold</b>foo=</h1>
20445 !!end
20446
20447 !! test
20448 Headings: 4a. No escaping needed (testing just h1 and h2)
20449 !! wikitext
20450 = =foo =
20451
20452 = foo= =
20453
20454 = =foo= =
20455
20456 = =foo= bar =
20457
20458 == =foo ==
20459
20460 == foo= ==
20461
20462 = = =
20463
20464 = ''=''foo= =
20465 !! html/parsoid
20466 <h1>=foo</h1>
20467 <h1>foo=</h1>
20468 <h1> =foo= </h1>
20469 <h1>=foo= bar</h1>
20470 <h2>=foo</h2>
20471 <h2>foo=</h2>
20472 <h1>=</h1>
20473 <h1><i>=</i>foo=</h1>
20474 !!end
20475
20476 !! test
20477 Headings: 4b. No escaping needed (inside p-tags)
20478 !! options
20479 parsoid=html2wt
20480 !! html
20481 <p>===
20482 =foo= x
20483 =foo= <s></s>
20484 </p>
20485 !! wikitext
20486 ===
20487 =foo= x
20488 =foo= <s></s>
20489 !!end
20490
20491 !! test
20492 Headings: 5. Empty headings
20493 !! options
20494 parsoid
20495 !! wikitext
20496 =<nowiki/>=
20497
20498 ==<nowiki/>==
20499
20500 ===<nowiki/>===
20501
20502 ====<nowiki/>====
20503
20504 =====<nowiki/>=====
20505
20506 ======<nowiki/>======
20507 !! html
20508 <h1></h1>
20509 <h2></h2>
20510 <h3></h3>
20511 <h4></h4>
20512 <h5></h5>
20513 <h6></h6>
20514 !!end
20515
20516 !! test
20517 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20518 !! options
20519 parsoid
20520 !! wikitext
20521 <nowiki>=a=</nowiki>
20522
20523 <nowiki>=a=</nowiki>
20524
20525 <nowiki>=a=</nowiki>
20526
20527 <nowiki>=a=</nowiki>
20528 !! html
20529 <p>=a=</p>
20530 <p>=a= </p>
20531 <p>=a= </p>
20532 <p>=a= </p>
20533 !!end
20534
20535 !! test
20536 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20537 !! options
20538 parsoid
20539 !! wikitext
20540 <nowiki>=a=
20541 b</nowiki>
20542
20543 <nowiki>=a=
20544 b</nowiki>
20545
20546 <nowiki>=a=
20547 b</nowiki>
20548
20549 <nowiki>=a=
20550 b</nowiki>
20551 !! html
20552 <p>=a=
20553 b</p>
20554 <p>=a=
20555 b</p>
20556 <p>=a=
20557 b</p>
20558 <p>=a=
20559 b</p>
20560 </p>
20561 !!end
20562
20563 !! test
20564 Headings: 6c. Heading chars in SOL context (leading newline break)
20565 !! options
20566 parsoid
20567 !! wikitext
20568 a
20569 <nowiki>=b=</nowiki>
20570 !! html
20571 <p>a
20572 =b=</p>
20573 !!end
20574
20575 !! test
20576 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20577 !! options
20578 parsoid
20579 !! wikitext
20580 <!--c0--><nowiki>=a=</nowiki>
20581
20582 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
20583 !! html
20584 <p><!--c0-->=a=</p>
20585 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
20586 !!end
20587
20588 !! test
20589 Headings: 6d. Heading chars in SOL context (No escaping needed)
20590 !! options
20591 parsoid=html2wt
20592 !! html
20593 =a=<div>b</div>
20594 !! wikitext
20595 =a=<div>b</div>
20596 !!end
20597
20598 !! test
20599 Headings: 7. Insert a newline between new content and headings
20600 !! options
20601 parsoid=html2wt
20602 !! html
20603 <h2>NEW</h2>
20604 <p>new</p>
20605 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20606 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20607 !! wikitext
20608 == NEW ==
20609 new
20610
20611 ==A==
20612 a
20613
20614 !! end
20615
20616 #### --------------- Lists ---------------
20617 #### 0. Outside nests (*foo, etc.)
20618 #### 1. Nested inside html <ul><li>*foo</li></ul>
20619 #### 2. Inside definition lists
20620 #### 3. Only bullets at start should be escaped
20621 #### 4. No escapes needed
20622 #### 5. No unnecessary escapes
20623 #### 6. Escape bullets in SOL position
20624 #### 7. Escape bullets in a multi-line context
20625 #### ----------------------------------------
20626
20627 !! test
20628 Lists: 0. Outside nests
20629 !! wikitext
20630 <nowiki>*</nowiki>foo
20631
20632 <nowiki>#</nowiki>foo
20633
20634 <nowiki>;Foo:</nowiki>bar
20635 !! html
20636 <p>*foo
20637 </p><p>#foo
20638 </p><p>;Foo:bar
20639 </p>
20640 !!end
20641
20642 !! test
20643 Lists: 1. Nested inside html
20644 !! wikitext
20645 *<nowiki>*foo</nowiki>
20646
20647 *<nowiki>#foo</nowiki>
20648
20649 *<nowiki>:foo</nowiki>
20650
20651 *<nowiki>;foo</nowiki>
20652
20653 #<nowiki>*foo</nowiki>
20654
20655 #<nowiki>#foo</nowiki>
20656
20657 #<nowiki>:foo</nowiki>
20658
20659 #<nowiki>;foo</nowiki>
20660 !! html
20661 <ul><li>*foo</li></ul>
20662 <ul><li>#foo</li></ul>
20663 <ul><li>:foo</li></ul>
20664 <ul><li>;foo</li></ul>
20665 <ol><li>*foo</li></ol>
20666 <ol><li>#foo</li></ol>
20667 <ol><li>:foo</li></ol>
20668 <ol><li>;foo</li></ol>
20669
20670 !!end
20671
20672 !! test
20673 Lists: 2. Inside definition lists
20674 !! wikitext
20675 ;<nowiki>;foo</nowiki>
20676
20677 ;<nowiki>:foo</nowiki>
20678
20679 ;<nowiki>:foo</nowiki>
20680 :bar
20681
20682 :<nowiki>:foo</nowiki>
20683 !! html
20684 <dl><dt>;foo</dt></dl>
20685 <dl><dt>:foo</dt></dl>
20686 <dl><dt>:foo</dt>
20687 <dd>bar</dd></dl>
20688 <dl><dd>:foo</dd></dl>
20689
20690 !!end
20691
20692 !! test
20693 Lists: 3. Only bullets at start of text should be escaped
20694 !! wikitext
20695 *<nowiki>*foo*bar</nowiki>
20696
20697 *<nowiki>*foo</nowiki>''it''*bar
20698 !! html
20699 <ul><li>*foo*bar</li></ul>
20700 <ul><li>*foo<i>it</i>*bar</li></ul>
20701
20702 !!end
20703
20704 !! test
20705 Lists: 4. No escapes needed
20706 !! options
20707 parsoid
20708 !! wikitext
20709 *foo*bar
20710
20711 *''foo''*bar
20712
20713 *[[Foo]]: bar
20714
20715 *[[Foo]]*bar
20716 !! html
20717 <ul>
20718 <li>foo*bar
20719 </li>
20720 </ul>
20721 <ul>
20722 <li><i>foo</i>*bar
20723 </li>
20724 </ul>
20725 <ul>
20726 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20727 </li>
20728 </ul>
20729 <ul>
20730 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20731 </li>
20732 </ul>
20733 !!end
20734
20735 !! test
20736 Lists: 5. No unnecessary escapes
20737 !! wikitext
20738 * bar <span><nowiki>[[foo]]</nowiki></span>
20739
20740 * =bar <span><nowiki>[[foo]]</nowiki></span>
20741
20742 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20743
20744 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20745
20746 * =bar <span>foo]]</span>=
20747
20748 * <s></s>: a
20749
20750 * ''* foo''
20751 !! html
20752 <ul><li> bar <span>[[foo]]</span></li></ul>
20753 <ul><li> =bar <span>[[foo]]</span></li></ul>
20754 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20755 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20756 <ul><li> =bar <span>foo]]</span>=</li></ul>
20757 <ul><li> <s></s>: a</li></ul>
20758 <ul><li> <i>* foo</i></li></ul>
20759
20760 !!end
20761
20762 !! test
20763 Lists: 6. Escape bullets in SOL position
20764 !! options
20765 parsoid=html2wt
20766 !! html
20767 <p><!--cmt-->*foo</p>
20768 !! wikitext
20769 <!--cmt--><nowiki>*</nowiki>foo
20770 !!end
20771
20772 !! test
20773 Lists: 7. Escape bullets in a multi-line context
20774 !! wikitext
20775 a
20776 <nowiki>*</nowiki>b
20777 !! html
20778 <p>a
20779 *b
20780 </p>
20781 !!end
20782
20783 !! test
20784 Lists: 8. Escape colons only if not present in tags
20785 !! options
20786 parsoid=html2wt
20787 !! html
20788 <dl><dt>a:b<i>c:d</i></dt></dl>
20789 !! wikitext
20790 ; <nowiki>a:b</nowiki>''c:d''
20791 !! end
20792
20793 #### --------------- HRs ---------------
20794 #### 1. Single line
20795 #### -----------------------------------
20796
20797 !! test
20798 HRs: 1. Single line
20799 !! wikitext
20800 ----<nowiki>----</nowiki>
20801 ----=foo=
20802 ----*foo
20803 !! html+tidy
20804 <hr />
20805 <p>----</p>
20806 <hr />
20807 <p>=foo=</p>
20808 <hr />
20809 <p>*foo</p>
20810 !! end
20811
20812 #### --------------- Tables ---------------
20813 #### 1a. Simple example
20814 #### 1b. No escaping needed (!foo)
20815 #### 1c. No escaping needed (|foo)
20816 #### 1d. No escaping needed (|}foo)
20817 ####
20818 #### 2a. Nested in td (<td>foo|bar</td>)
20819 #### 2b. Nested in td (<td>foo||bar</td>)
20820 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20821 ####
20822 #### 3a. Nested in th (<th>foo!bar</th>)
20823 #### 3b. Nested in th (<th>foo!!bar</th>)
20824 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20825 ####
20826 #### 4a. Escape -
20827 #### 4b. Escape +
20828 #### 4c. No escaping needed
20829 #### --------------------------------------
20830
20831 !! test
20832 Tables: 1a. Simple example
20833 !! wikitext
20834 <nowiki>{|
20835 |}</nowiki>
20836 !! html
20837 <p>{|
20838 |}
20839 </p>
20840 !! end
20841
20842 !! test
20843 Tables: 1b. No escaping needed
20844 !! wikitext
20845 !foo
20846 !! html
20847 <p>!foo
20848 </p>
20849 !! end
20850
20851 !! test
20852 Tables: 1c. No escaping needed
20853 !! wikitext
20854 |foo
20855 !! html
20856 <p>|foo
20857 </p>
20858 !! end
20859
20860 !! test
20861 Tables: 1d. No escaping needed
20862 !! wikitext
20863 |}foo
20864 !! html
20865 <p>|}foo
20866 </p>
20867 !! end
20868
20869 !! test
20870 Tables: 2a. Nested in td
20871 !! options
20872 parsoid=html2wt
20873 !! html/parsoid
20874 <table><tbody><tr>
20875 <td>foo|bar</td></tr>
20876 <tr><td>x<div>a|b</div></td>
20877 </tbody></table>
20878 !! wikitext
20879 {|
20880 |<nowiki>foo|bar</nowiki>
20881 |-
20882 |x<div><nowiki>a|b</nowiki></div>
20883 |}
20884 !! html/php+tidy
20885 <table>
20886 <tr>
20887 <td>foo|bar</td>
20888 </tr>
20889 <tr>
20890 <td>x
20891 <div>a|b</div>
20892 </td>
20893 </tr>
20894 </table>
20895 !! end
20896
20897 !! test
20898 Tables: 2b. Nested in td
20899 !! options
20900 parsoid=html2wt
20901 !! html/parsoid
20902 <table><tbody><tr>
20903 <td>foo||bar</td>
20904 <td>a<i>b||c</i></td>
20905 <td>a<i><div>b||c</div></i></td>
20906 </tr></tbody></table>
20907 !! wikitext
20908 {|
20909 |<nowiki>foo||bar</nowiki>
20910 |a''<nowiki>b||c</nowiki>''
20911 |a''<div><nowiki>b||c</nowiki></div>''
20912 |}
20913 !! html/php
20914 <table>
20915 <tr>
20916 <td>foo||bar
20917 </td>
20918 <td>a<i>b||c</i>
20919 </td>
20920 <td>a<i><div>b||c</div></i>
20921 </td></tr></table>
20922
20923 !! end
20924
20925 !! test
20926 Tables: 2c. Nested in td -- no escaping needed
20927 !! wikitext
20928 {|
20929
20930 |foo!!bar
20931 |}
20932 !! html/*
20933 <table>
20934
20935 <tr>
20936 <td>foo!!bar
20937 </td></tr></table>
20938
20939 !! end
20940
20941 !! test
20942 Tables: 3a. Nested in th
20943 !! wikitext
20944 {|
20945
20946 !foo!bar
20947 |}
20948 !! html/*
20949 <table>
20950
20951 <tr>
20952 <th>foo!bar
20953 </th></tr></table>
20954
20955 !! end
20956
20957 !! test
20958 Tables: 3b. Nested in th
20959 !! options
20960 parsoid=html2wt
20961 !! html/parsoid
20962 <table><tbody>
20963 <tr><th>foo!!bar</th>
20964 <th><i>foo|bar</i></th>
20965 <th><i>foo!!bar</i></th>
20966 <th><i><span>foo!!bar</span></i></th>
20967 </tr></tbody></table>
20968 !! wikitext
20969 {|
20970 !<nowiki>foo!!bar</nowiki>
20971 !''<nowiki>foo|bar</nowiki>''
20972 !''<nowiki>foo!!bar</nowiki>''
20973 !''<span><nowiki>foo!!bar</nowiki></span>''
20974 |}
20975 !! html/php
20976 <table>
20977 <tr>
20978 <th>foo!!bar
20979 </th>
20980 <th><i>foo|bar</i>
20981 </th>
20982 <th><i>foo!!bar</i>
20983 </th>
20984 <th><i><span>foo!!bar</span></i>
20985 </th></tr></table>
20986
20987 !! end
20988
20989 !! test
20990 Tables: 3c. Nested in th
20991 !! options
20992 parsoid=html2wt
20993 !! html/parsoid
20994 <table><tbody>
20995 <tr><th>foo||bar</th>
20996 <th><span typeof="mw:Nowiki">foo||bar</span></th>
20997 </tr></tbody></table>
20998 !! wikitext
20999 {|
21000 !<nowiki>foo||bar</nowiki>
21001 !<nowiki>foo||bar</nowiki>
21002 |}
21003 !! html/php
21004 <table>
21005 <tr>
21006 <th>foo||bar
21007 </th>
21008 <th>foo||bar
21009 </th></tr></table>
21010
21011 !! end
21012
21013 !! test
21014 Tables: 4a. Escape -
21015 !! options
21016 parsoid=html2wt
21017 !! html/*
21018 <table>
21019
21020 <tr>
21021 <th>-bar
21022 </th></tr>
21023 <tr>
21024 <td>-bar
21025 </td></tr></table>
21026
21027 !! wikitext
21028 {|
21029
21030 !-bar
21031
21032 |-
21033 |<nowiki>-bar</nowiki>
21034 |}
21035 !! end
21036
21037 !! test
21038 Tables: 4b. Escape +
21039 !! options
21040 parsoid=html2wt
21041 !! html/*
21042 <table>
21043
21044 <tr>
21045 <th>+bar
21046 </th></tr>
21047 <tr>
21048 <td>+bar
21049 </td></tr></table>
21050
21051 !! wikitext
21052 {|
21053
21054 !+bar
21055
21056 |-
21057 |<nowiki>+bar</nowiki>
21058 |}
21059 !! end
21060
21061 !! test
21062 Tables: 4c. No escaping needed
21063 !! wikitext
21064 {|
21065 |foo-bar
21066 |foo+bar
21067 |-
21068 |''foo''-bar
21069 |''foo''+bar
21070 |-
21071 |foo
21072 bar|baz
21073 +bar
21074 -bar
21075 |-
21076 |x
21077 <div>a|b</div>
21078 |}
21079 !! html/php
21080 <table>
21081 <tr>
21082 <td>foo-bar
21083 </td>
21084 <td>foo+bar
21085 </td></tr>
21086 <tr>
21087 <td><i>foo</i>-bar
21088 </td>
21089 <td><i>foo</i>+bar
21090 </td></tr>
21091 <tr>
21092 <td>foo
21093 <p>bar|baz
21094 +bar
21095 -bar
21096 </p>
21097 </td></tr>
21098 <tr>
21099 <td>x
21100 <div>a|b</div>
21101 </td></tr></table>
21102
21103 !! html/parsoid
21104 <table><tbody>
21105 <tr><td>foo-bar</td><td>foo+bar</td></tr>
21106 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
21107 <tr><td>foo
21108 <p>bar|baz
21109 +bar
21110 -bar</p></td></tr>
21111 <tr><td>x
21112 <div>a|b</div></td>
21113 </tbody></table>
21114 !! end
21115
21116 !! test
21117 Tables: 4d. No escaping needed
21118 !! wikitext
21119 {|
21120 |[[Foo]]-bar
21121 ||+1
21122 ||-2
21123 |}
21124 !! html/php
21125 <table>
21126 <tr>
21127 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
21128 </td>
21129 <td>+1
21130 </td>
21131 <td>-2
21132 </td></tr></table>
21133
21134 !! html/parsoid
21135 <table>
21136 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
21137 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
21138 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21139 </tbody></table>
21140 !! end
21141
21142 !! test
21143 Tables: Digest broken attributes on table and tr tag
21144 !! options
21145 parsoid=wt2html
21146 !! wikitext
21147 {| || |} ++
21148 |- || || ++ --
21149 |- > [
21150 |}
21151 !! html
21152 <table>
21153 <tbody>
21154 <tr></tr>
21155 <tr></tr>
21156 </tbody></table>
21157 !! end
21158
21159 #### --------------- Links ----------------
21160 #### 1. Quote marks in link text
21161 #### 2. Wikilinks: Escapes needed
21162 #### 3. Wikilinks: No escapes needed
21163 #### 4. Extlinks: Escapes needed
21164 #### 5. Extlinks: No escapes needed
21165 #### --------------------------------------
21166 !! test
21167 Links 1. WikiLinks: No escapes needed
21168 !! wikitext
21169 [[Foo|Foo''boo'']]
21170 [[Foo|[Foobar]]]
21171 [[Foo|x [Foobar] x]]
21172 !! html/php
21173 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21174 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21175 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21176 </p>
21177 !! html/parsoid
21178 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21179 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21180 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21181 !! end
21182
21183 !! test
21184 Links 2. WikiLinks: Escapes needed
21185 !! options
21186 parsoid=html2wt
21187 !! html/parsoid
21188 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21189 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21190 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21191 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21192 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21193 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21194 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21195 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21196 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21197 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21198 !! wikitext
21199 [[Foo|<nowiki>Foobar]</nowiki>]]
21200 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21201 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21202 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21203 [[Foo|<nowiki>|Bar</nowiki>]]
21204 [[Foo|<nowiki>]]bar</nowiki>]]
21205 [[Foo|<nowiki>[[bar</nowiki>]]
21206 [[Foo|<nowiki>x [[ y</nowiki>]]
21207 [[Foo|<nowiki>x ]] y</nowiki>]]
21208 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21209 !! html/php
21210 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21211 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21212 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21213 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21214 <a href="/wiki/Foo" title="Foo">|Bar</a>
21215 <a href="/wiki/Foo" title="Foo">]]bar</a>
21216 <a href="/wiki/Foo" title="Foo">[[bar</a>
21217 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21218 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21219 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21220 </p>
21221 !! end
21222
21223 !! test
21224 Links 3. WikiLinks: No escapes needed
21225 !! wikitext
21226 [[Foo|[Foobar]]
21227 [[Foo|foo|bar]]
21228 !! html/php
21229 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21230 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21231 </p>
21232 !! html/parsoid
21233 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21234 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21235 !! end
21236
21237 !! test
21238 Links 4. ExtLinks: Escapes needed
21239 !! options
21240 parsoid=html2wt
21241 !! html/parsoid
21242 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21243 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21244 <p>[http://google.com]</p>
21245 <p>[http://google.com google]</p>
21246 !! wikitext
21247 [http://google.com <nowiki>[google]</nowiki>]
21248 [http://google.com <nowiki>google]</nowiki>]
21249
21250 <nowiki>[http://google.com]</nowiki>
21251
21252 <nowiki>[http://google.com google]</nowiki>
21253
21254 !! html/php
21255 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21256 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21257 </p><p>[http://google.com]
21258 </p><p>[http://google.com google]
21259 </p>
21260 !! end
21261
21262 !! test
21263 Links 5. ExtLinks: No escapes needed
21264 !! wikitext
21265 [http://google.com [google]
21266 !! html/php
21267 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21268 </p>
21269 !! html/parsoid
21270 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21271 !! end
21272
21273 !! test
21274 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21275 !! html/parsoid
21276 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21277 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21278 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21279 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21280 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21281 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21282 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21283 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21284 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21285 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21286 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21287 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21288 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21289 </p>
21290 !! wikitext
21291 x<nowiki/>http://example.com<nowiki/>y
21292 http://example.com<nowiki/>?x
21293 http://example.com<nowiki/>&x
21294 http://example.com<nowiki/>'x
21295 http://example.com<nowiki/>,x
21296 http://example.com<nowiki/>.x
21297 http://example.com<nowiki/>;x
21298 http://example.com<nowiki/>:x
21299 http://example.com<nowiki/>;x
21300 http://example.com<nowiki/>!x
21301 http://example.com<nowiki/>=x
21302 http://example.com<nowiki/>(x)
21303 http://example.com(x<nowiki/>)
21304 !! end
21305
21306 !! test
21307 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21308 !! html/parsoid
21309 <p>x
21310 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21311 y
21312 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21313 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21314 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21315 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21316 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21317 </p>
21318 !! wikitext
21319 x
21320 http://example.com
21321 y
21322 "http://example.com"
21323 (http://example.com)
21324 (http://example.com) foo
21325 http://example.com,
21326 http://example.com, foo
21327 !! html/php
21328 <p>x
21329 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21330 y
21331 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21332 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21333 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21334 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21335 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21336 </p>
21337 !! end
21338
21339 !! test
21340 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21341 !! html/parsoid
21342 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21343 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21344 !! wikitext
21345 http://example.com.,;:!?\
21346 -http://example.com:
21347 !! html/php
21348 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21349 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21350 </p>
21351 !! end
21352
21353 !! test
21354 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21355 !! html/parsoid
21356 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21357 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21358 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21359 !! wikitext
21360 RFC 123<nowiki/>4
21361 RFC 123<nowiki/>y
21362 X<nowiki/>RFC 123<nowiki/>y
21363 !! end
21364
21365 !! test
21366 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21367 !! html/parsoid
21368 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21369 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21370 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21371 </p>
21372 !! wikitext
21373 RFC 123?foo
21374 RFC 123&foo
21375 -RFC 123-
21376 !! html/php
21377 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21378 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21379 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21380 </p>
21381 !! end
21382
21383 !! test
21384 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21385 !! html/parsoid
21386 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21387 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21388 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21389 !! wikitext
21390 PMID 123<nowiki/>4
21391 PMID 123<nowiki/>y
21392 X<nowiki/>PMID 123<nowiki/>y
21393 !! end
21394
21395 !! test
21396 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21397 !! html/parsoid
21398 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21399 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21400 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21401 </p>
21402 !! wikitext
21403 PMID 123?foo
21404 PMID 123&foo
21405 -PMID 123-
21406 !! html/php
21407 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21408 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21409 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21410 </p>
21411 !! end
21412
21413 !! test
21414 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21415 !! html/parsoid
21416 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21417 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21418 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21419 </p>
21420 !! wikitext
21421 ISBN 1234567890<nowiki/>1
21422 ISBN 1234567890<nowiki/>x
21423 a<nowiki/>ISBN 1234567890<nowiki/>b
21424 !! end
21425
21426 !! test
21427 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21428 !! html/parsoid
21429 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21430 !! wikitext
21431 -ISBN 1234567890's
21432 !! html/php
21433 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21434 </p>
21435 !! end
21436
21437 !! test
21438 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21439 !! options
21440 parsoid=html2wt
21441 !! html/*
21442 <p>this is not a link: http://example.com
21443 </p>
21444 !! wikitext
21445 this is not a link: <nowiki>http://example.com</nowiki>
21446 !! end
21447
21448 !! test
21449 Links 15. Link trails can't become link prefixes.
21450 !! options
21451 language=is
21452 !! wikitext
21453 [[Söfnuður]]-[[00]]
21454 !! html/php
21455 <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>
21456 </p>
21457 !! html/parsoid
21458 <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>
21459 !! end
21460
21461 #### --------------- Quotes ---------------
21462 #### 1. Quotes inside <b> and <i>
21463 #### 2. Link fragments separated by <i> and <b> tags
21464 #### 3. Link fragments inside <i> and <b>
21465 #### 4. No escaping needed
21466 #### --------------------------------------
21467 !! test
21468 1a. Quotes inside <b> and <i>
21469 !! options
21470 parsoid=html2wt,wt2wt
21471 !! wikitext
21472 ''<nowiki/>'foo'''
21473 ''<nowiki>''foo''</nowiki>''
21474 ''<nowiki>'''foo'''</nowiki>''
21475 ''foo''<nowiki/>'s
21476 '''<nowiki/>'foo''''
21477 '''<nowiki>''foo''</nowiki>'''
21478 '''<nowiki>'''foo'''</nowiki>'''
21479 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21480 '''foo'''<nowiki/>'s
21481 '''foo''
21482 ''foo''<nowiki/>'
21483 ''foo'''<nowiki/>'
21484 '''foo''<nowiki/>'
21485 ''''foo'''
21486 '''foo'''<nowiki/>'
21487 ''''foo'''<nowiki/>'
21488 ''fools'<span> errand</span>''
21489 ''<span>fool</span>'s errand''
21490 '<nowiki/>''foo'' bar '''baz''
21491 a|!*#-:;+-~[]{}b'''x''
21492 !! html/*
21493 <p><i>'foo'</i>
21494 <i>''foo''</i>
21495 <i>'''foo'''</i>
21496 <i>foo</i>'s
21497 <b>'foo'</b>
21498 <b>''foo''</b>
21499 <b>'''foo'''</b>
21500 <b>foo'<i>bar'</i>baz</b>
21501 <b>foo</b>'s
21502 '<i>foo</i>
21503 <i>foo</i>'
21504 <i>foo'</i>'
21505 '<i>foo</i>'
21506 '<b>foo</b>
21507 <b>foo</b>'
21508 '<b>foo</b>'
21509 <i>fools'<span> errand</span></i>
21510 <i><span>fool</span>'s errand</i>
21511 '<i>foo</i> bar '<i>baz</i>
21512 a|!*#-:;+-~[]{}b'<i>x</i>
21513 </p>
21514 !! end
21515
21516 !! test
21517 1b. Quotes inside <b> and <i> with other tags on same line
21518 !! options
21519 parsoid=html2wt,wt2wt
21520 !! wikitext
21521 '''a'' foo ''[[bar]]''
21522 ''a''' foo ''[[bar]]''
21523 ''a''' foo '''{{echo|[[bar]]}}'''
21524 [[foo]] x'''[[bar]]''
21525 '''foo'' <ref>test</ref>
21526 '''foo'' <div title="name">test</div>
21527 '''foo'' and <br> bar
21528 <references />
21529 !! html
21530 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21531 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21532 <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>
21533 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21534 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"test"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
21535 '<i>foo</i> <div title="name">test</div>
21536 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21537 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
21538 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> test</li>
21539 </ol>
21540 !! end
21541
21542 !! test
21543 2. Link fragments separated by <i> and <b> tags
21544 !! wikitext
21545 [[''foo''<nowiki>hello]]</nowiki>
21546
21547 [['''foo'''<nowiki>hello]]</nowiki>
21548 !! html
21549 <p>[[<i>foo</i>hello]]
21550 </p><p>[[<b>foo</b>hello]]
21551 </p>
21552 !! end
21553
21554 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21555 # this is one of the shortcomings of this format
21556 !! test
21557 3. Link fragments inside <i> and <b>
21558 !! wikitext
21559 ''[[foo''<nowiki>]]</nowiki>
21560
21561 '''[[foo'''<nowiki>]]</nowiki>
21562 !! html
21563 <p><i>[[foo</i>]]
21564 </p><p><b>[[foo</b>]]
21565 </p>
21566 !! end
21567
21568 !! test
21569 4. No escaping needed
21570 !! wikitext
21571 '<span>''bar''</span>'
21572 '<span>'''bar'''</span>'
21573 'a:b'foo
21574 !! html
21575 <p>'<span><i>bar</i></span>'
21576 '<span><b>bar</b></span>'
21577 'a:b'foo
21578 </p>
21579 !! end
21580
21581 #### ----------- Paragraphs ---------------
21582 #### 1. No unnecessary escapes
21583 #### --------------------------------------
21584
21585 !! test
21586 1. No unnecessary escapes
21587 !! wikitext
21588 bar <span><nowiki>[[foo]]</nowiki></span>
21589
21590 =bar <span><nowiki>[[foo]]</nowiki></span>
21591
21592 [[bar <span><nowiki>[[foo]]</nowiki></span>
21593
21594 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21595
21596 =bar <span>foo]]</span><nowiki>=</nowiki>
21597 !! html
21598 <p>bar <span>[[foo]]</span>
21599 </p><p>=bar <span>[[foo]]</span>
21600 </p><p>[[bar <span>[[foo]]</span>
21601 </p><p>]]bar <span>[[foo]]</span>
21602 </p><p>=bar <span>foo]]</span>=
21603 </p>
21604 !!end
21605
21606 #### ----------------------- PRE --------------------------
21607 #### 1. Leading whitespace in SOL context should be escaped
21608 #### ------------------------------------------------------
21609 !! test
21610 1. Leading whitespace in SOL context should be escaped
21611 !! options
21612 parsoid
21613 !! wikitext
21614 <nowiki> </nowiki>a
21615
21616 <nowiki> </nowiki> a
21617
21618 <nowiki> </nowiki>a(tab)
21619
21620 <nowiki> </nowiki> a
21621 <!--cmt-->
21622 <nowiki> </nowiki> a
21623
21624 a
21625 <nowiki> </nowiki>b
21626
21627 a
21628 <nowiki> </nowiki>b
21629
21630 a
21631 <nowiki> </nowiki> b
21632 !! html
21633 <p> a</p>
21634 <p> a</p>
21635 <p> a(tab)</p>
21636 <p> a</p>
21637 <p><!--cmt--> a</p>
21638 <p>a
21639 b</p>
21640 <p>a
21641 b</p>
21642 <p>a
21643 b</p>
21644 !! end
21645
21646 !! test
21647 2. Leading whitespace in non-indent-pre contexts should not be escaped
21648 !! options
21649 parsoid
21650 !! wikitext
21651 foo <ref>''a''
21652 b</ref>
21653 <references />
21654 !! html
21655 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21656 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
21657 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <i>a</i> b</li>
21658 </ol>
21659 !! end
21660
21661 !! test
21662 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21663 !! options
21664 parsoid
21665 !! wikitext
21666 <blockquote>
21667 a
21668 <span>b</span>
21669 c
21670 </blockquote>
21671 !! html
21672 <blockquote>
21673 <p>
21674 a
21675 <span>b</span>
21676 c</p>
21677 </blockquote>
21678 !! end
21679
21680 !! test
21681 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21682 !! options
21683 parsoid
21684 !! wikitext
21685 [[File:Foobar.jpg|thumb|caption]]
21686 !! html
21687 !! html/parsoid
21688 <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>
21689 !! end
21690
21691 !! test
21692 5. Nowiki escaping should account for indent-pres
21693 !! options
21694 parsoid=html2wt
21695 !! html
21696 <pre>==foo==</pre>
21697 !! wikitext
21698 ==foo==
21699 !! end
21700
21701 #### --------------- Behavior Switches --------------------
21702 !! test
21703 1. Valid behavior switches should be escaped
21704 !! options
21705 parsoid=html2wt
21706 !! html
21707 __TOC__
21708 <i>__TOC__</i>
21709 !! wikitext
21710 <nowiki>__TOC__</nowiki>
21711 ''<nowiki>__TOC__</nowiki>''
21712 !! end
21713
21714 !! test
21715 2. Invalid behavior switches should not be escaped
21716 !! options
21717 parsoid=html2wt
21718 !! html
21719 __TOO__
21720 __|__
21721 !! wikitext
21722 __TOO__
21723 __|__
21724 !! end
21725
21726 #### --------------- HTML tags ---------------
21727 #### 1. a tags
21728 #### 2. other tags
21729 #### 3. multi-line html tag
21730 #### 4. extension tags
21731 #### -----------------------------------------
21732 !! test
21733 1. a tags
21734 !! options
21735 parsoid
21736 !! wikitext
21737 <a href="http://google.com">google</a>
21738 !! html
21739 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21740 !! end
21741
21742 !! test
21743 2. other tags
21744 !! wikitext
21745 <nowiki><div>foo</div>
21746 <div style="color:red">foo</div></nowiki>
21747 !! html
21748 <p>&lt;div&gt;foo&lt;/div&gt;
21749 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21750 </p>
21751 !! end
21752
21753 !! test
21754 3. multi-line html tag
21755 !! wikitext
21756 <nowiki><div
21757 >foo</div
21758 ></nowiki>
21759 !! html
21760 <p>&lt;div
21761 &gt;foo&lt;/div
21762 &gt;
21763 </p>
21764 !! end
21765
21766 !! test
21767 4. extension tags
21768 !! wikitext
21769 <nowiki><ref>foo</ref></nowiki>
21770
21771 <nowiki><ref>bar</nowiki>
21772
21773 baz<nowiki></ref></nowiki>
21774 !! html
21775 <p>&lt;ref&gt;foo&lt;/ref&gt;
21776 </p><p>&lt;ref&gt;bar
21777 </p><p>baz&lt;/ref&gt;
21778 </p>
21779 !! end
21780
21781 #### --------------- Others ---------------
21782 !! test
21783 Escaping nowikis
21784 !! wikitext
21785 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21786 !! html
21787 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21788 </p>
21789 !! end
21790
21791 ## The quote-char in the input is necessary for triggering the bug
21792 !! test
21793 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21794 !! options
21795 parsoid=wt2wt,html2wt
21796 !! wikitext
21797 foo's bar :
21798 !! html
21799 <p>foo's bar :</p>
21800 !! end
21801
21802 !! test
21803
21804 Tag-like HTML structures are passed through as text
21805 !! wikitext
21806 <x y>
21807
21808 <x.y>
21809
21810 <x-y>
21811
21812 1>2
21813
21814 x<y
21815
21816 a>b
21817
21818 1<d e>f
21819 !! html
21820 <p>&lt;x y&gt;
21821 </p><p>&lt;x.y&gt;
21822 </p><p>&lt;x-y&gt;
21823 </p><p>1&gt;2
21824 </p><p>x&lt;y
21825 </p><p>a&gt;b
21826 </p><p>1&lt;d e&gt;f
21827 </p>
21828 !! end
21829
21830
21831 # This was a bug in the PHP parser (see bug 17663 and its dups,
21832 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21833 !! test
21834 Tag names followed by punctuation should not be recognized as tags
21835 !! wikitext
21836 <s.ome> text
21837 !! html
21838 <p>&lt;s.ome&gt; text
21839 </p>
21840 !! end
21841
21842 !! test
21843 HTML tag with necessary entities in attributes
21844 !! wikitext
21845 <span title="&amp;amp;">foo</span>
21846 !! html
21847 <p><span title="&amp;amp;">foo</span>
21848 </p>
21849 !! end
21850
21851 !! test
21852 HTML tag with 'unnecessary' entity encoding in attributes
21853 !! wikitext
21854 <span title="&amp;">foo</span>
21855 !! html
21856 <p><span title="&amp;">foo</span>
21857 </p>
21858 !! end
21859
21860 !! test
21861 HTML tag with broken attribute value quoting
21862 !! wikitext
21863 <span title="Hello world>Foo</span>
21864 !! html/php
21865 <p><span>Foo</span>
21866 </p>
21867 !! html/parsoid
21868 <p><span title="Hello world">Foo</span>
21869 </p>
21870 !! end
21871
21872 !! test
21873 Parsoid-only: HTML tag with broken attribute value quoting
21874 !! options
21875 parsoid
21876 !! wikitext
21877 <span title="Hello world>Foo</span>
21878 !! html
21879 <p><span title="Hello world">Foo</span>
21880 </p>
21881 !! end
21882
21883 !! test
21884 Table with broken attribute value quoting
21885 !! wikitext
21886 {|
21887 | title="Hello world|Foo
21888 |}
21889 !! html/php
21890 <table>
21891 <tr>
21892 <td>Foo
21893 </td></tr></table>
21894
21895 !! html/parsoid
21896 <table>
21897 <tr>
21898 <td title="Hello world">Foo
21899 </td></tr></table>
21900
21901 !! end
21902
21903 !! test
21904 Table with broken attribute value quoting on consecutive lines
21905 !! wikitext
21906 {|
21907 | title="Hello world|Foo
21908 | style="color:red|Bar
21909 |}
21910 !! html/php
21911 <table>
21912 <tr>
21913 <td>Foo
21914 </td>
21915 <td>Bar
21916 </td></tr></table>
21917
21918 !! html/parsoid
21919 <table><tbody>
21920 <tr>
21921 <td title="Hello world">Foo
21922 </td><td style="color: red">Bar
21923 </td></tr></tbody></table>
21924
21925 !! end
21926
21927 !! test
21928 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21929 !! options
21930 parsoid
21931 !! wikitext
21932 {{}}
21933 !! html
21934 {{}}
21935 !! end
21936
21937 !! test
21938 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21939 !! options
21940 parsoid
21941 !! wikitext
21942 }}{{
21943 !! html
21944 }}{{
21945 !! end
21946
21947 !!test
21948 Accept empty td cell attribute
21949 !! wikitext
21950 {|
21951 | align="center" | foo || |
21952 |}
21953 !! html
21954 <table>
21955 <tr>
21956 <td align="center"> foo </td>
21957 <td>
21958 </td></tr></table>
21959
21960 !!end
21961
21962 !!test
21963 Non-empty attributes in th-cells
21964 !! wikitext
21965 {|
21966 ! Foo !! style="color: red" | Bar
21967 |}
21968 !! html
21969 <table>
21970 <tr>
21971 <th> Foo </th>
21972 <th style="color: red"> Bar
21973 </th></tr></table>
21974
21975 !!end
21976
21977 !!test
21978 Accept empty attributes in th-cells
21979 !! wikitext
21980 {|
21981 !| foo !!| bar
21982 |}
21983 !! html
21984 <table>
21985 <tr>
21986 <th> foo </th>
21987 <th> bar
21988 </th></tr></table>
21989
21990 !!end
21991
21992 !!test
21993 Empty table rows go away
21994 !! wikitext
21995 {|
21996 | Hello
21997 | there
21998 |- class="foo"
21999 |-
22000 |}
22001 !! html
22002 <table>
22003 <tr>
22004 <td> Hello
22005 </td>
22006 <td> there
22007 </td></tr>
22008
22009 </table>
22010
22011 !! end
22012
22013 ###
22014 ### Parsoid-centric tests for testing RTing of inter-element separators
22015 ### Edge cases not tested by existing parser tests and specific to
22016 ### Parsoid-specific serialization strategies.
22017 ###
22018
22019 !!test
22020 RT-ed inter-element separators should be valid separators
22021 !! wikitext
22022 {|
22023 |- [[foo]]
22024 |}
22025 !! html
22026 <table>
22027
22028 </table>
22029
22030 !!end
22031
22032 # Parsoid-only since PHP parser relies on Tidy for correct output
22033 !!test
22034 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
22035 !!options
22036 parsoid
22037 !! wikitext
22038 {|
22039 |<small>foo
22040 bar
22041 |}
22042
22043 {|
22044 |<small>foo<small>
22045 |}
22046 !! html
22047 <table>
22048 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
22049 <p>bar</p></small></td></tr>
22050 </tbody></table>
22051
22052 <table>
22053 <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>
22054 </tbody></table>
22055 !!end
22056
22057 !!test
22058 Empty TD followed by TD with tpl-generated attribute
22059 !! wikitext
22060 {|
22061 |-
22062 |
22063 |{{echo|style='color:red'}}|foo
22064 |}
22065 !! html
22066 <table>
22067
22068 <tr>
22069 <td>
22070 </td>
22071 <td>foo
22072 </td></tr></table>
22073
22074 !!end
22075
22076 !!test
22077 Indented table with an empty td
22078 !! wikitext
22079 {|
22080 |-
22081 |
22082 |foo
22083 |}
22084 !! html
22085 <table>
22086
22087 <tr>
22088 <td>
22089 </td>
22090 <td>foo
22091 </td></tr></table>
22092
22093 !!end
22094
22095 ## We have some newline diffs RT-ing this edge case
22096 ## and it is not important enough -- we seem to be emitting
22097 ## at most 2 newlines after a </tr> and this is unrelated to
22098 ## the issue from T85627 that this is testing.
22099 !!test
22100 Indented table with blank lines in between (T85627)
22101 !! options
22102 parsoid=wt2html
22103 !! wikitext
22104 {|
22105 |foo
22106
22107
22108 |}
22109 !! html
22110 <table>
22111
22112 <tr>
22113 <td>foo
22114 </td></tr></table>
22115
22116 !!end
22117
22118 !!test
22119 Indented block & table
22120 !! wikitext
22121 <div>foo</div>
22122 {|
22123 |foo
22124 |}
22125 !! html/php
22126 <div>foo</div>
22127 <table>
22128 <tr>
22129 <td>foo
22130 </td></tr></table>
22131
22132 !! html/parsoid
22133 <div data-parsoid='{"stx":"html"}'>foo</div>
22134 <table><tbody>
22135 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
22136 </tbody></table>
22137 !!end
22138
22139 !! test
22140 Indent and comment before table row
22141 !! wikitext
22142 {|
22143 <!--hi-->|-
22144 | there
22145 |}
22146 !! html/php
22147 <table>
22148
22149 <tr>
22150 <td> there
22151 </td></tr></table>
22152
22153 !! html/parsoid
22154 <table>
22155 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22156 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22157 </tbody></table>
22158 !! end
22159
22160 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22161 !!test
22162 Empty TR followed by a template-generated TR
22163 !!options
22164 parsoid
22165 !! wikitext
22166 {|
22167 |-
22168 {{echo|<tr><td>foo</td></tr>}}
22169 |}
22170 !! html
22171 <table>
22172 <tbody>
22173 <tr></tr>
22174 <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}}]}'>
22175 <td>foo</td></tr>
22176 </tbody></table>
22177 !!end
22178
22179 ## PHP and parsoid output differ for this, and since this is primarily
22180 ## for testing Parsoid's serializer, marking this Parsoid only
22181 !!test
22182 Empty TR followed by mixed-ws-comment line should RT correctly
22183 !!options
22184 parsoid
22185 !! wikitext
22186 {|
22187 |-
22188 <!--c-->
22189 |-
22190 <!--c--> <!--d-->
22191 |}
22192 !! html
22193 <table>
22194 <tbody>
22195 <tr></tr>
22196 <!--c-->
22197 <tr>
22198 <!--c--> </tr><!--d-->
22199 </tbody></table>
22200
22201 !!end
22202
22203 !!test
22204 Multi-line image caption generated by templates with/without trailing newlines
22205 !! wikitext
22206 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22207 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22208 !! html/parsoid
22209 <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>
22210 <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>
22211 !!end
22212
22213 !! test
22214 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22215 !! options
22216 parsoid=html2wt
22217 !! html
22218 <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>
22219
22220 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22221 !! wikitext
22222 <includeonly>foo</includeonly>
22223 new para
22224
22225 [[./Category:Foo]]
22226
22227 = new heading =
22228 !! end
22229
22230 ## PHP emits broken html for this, and since this is primarily
22231 ## a Parsoid serializer test, marking this Parsoid only
22232 !!test
22233 Improperly nested inline or quotes tags with whitespace in between
22234 !!options
22235 parsoid
22236 !! wikitext
22237 <span> <s>x</span> </s>
22238 ''' ''x''' ''
22239 !! html
22240 <p><span> <s>x</s></span><s> </s>
22241 <b> <i>x</i></b><i> </i>
22242 </p>
22243 !!end
22244
22245 !!test
22246 Encapsulate protected attributes from wt
22247 !!options
22248 parsoid
22249 !! wikitext
22250 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22251 !! html
22252 <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>
22253 </body>
22254 !!end
22255
22256 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22257 ## Having nested or stray pre tags results in the attempt to add duplicates,
22258 ## causing an assertion fail. This test tries to prevent that situation.
22259 !!test
22260 Ensure ParagraphWrapper can deal with stray closing pre tags
22261 !!options
22262 parsoid=wt2html
22263 !! wikitext
22264 plain text</pre>
22265 !! html
22266 plain text
22267 !!end
22268
22269 !!test
22270 1. Ensure fostered text content is wrapped in element nodes
22271 !!options
22272 parsoid=wt2html
22273 !! wikitext
22274 <table>hi</table><table>ho</table>
22275 !! html
22276 <p>hi</p>
22277 <table></table>
22278 <p>ho</p>
22279 <table></table>
22280 !!end
22281
22282 !!test
22283 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22284 !!options
22285 parsoid=wt2html,wt2wt
22286 !! wikitext
22287 <table>
22288 <tr> || ||
22289 <td> a
22290 </table>
22291 !! html
22292 <p> || ||
22293 </p><table>
22294 <tbody><tr><td> a</td></tr>
22295 </tbody></table>
22296 !!end
22297
22298 !!test
22299 Encapsulation properly handles null DSR information from foster box
22300 !!options
22301 parsoid=wt2html,wt2wt
22302 !! wikitext
22303 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22304 !! html
22305 <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>
22306 !!end
22307
22308 !!test
22309 1. Encapsulate foster-parented transclusion content
22310 !!options
22311 parsoid=wt2wt,wt2html
22312 !! wikitext
22313 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22314 !! html
22315 <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>
22316 <tbody>
22317 <tr>
22318 <td>bar</td>
22319 </tr>
22320 </tbody>
22321 </table>
22322 !!end
22323
22324 !!test
22325 2. Encapsulate foster-parented transclusion content
22326 !!options
22327 parsoid=wt2wt,wt2html
22328 !! wikitext
22329 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22330 !! html
22331 <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>
22332 <table>
22333 <tbody>
22334 <tr>
22335 <td>bar</td>
22336 </tr>
22337 </tbody>
22338 </table>
22339 !!end
22340
22341 !!test
22342 3. Encapsulate foster-parented transclusion content
22343 !!options
22344 parsoid=wt2wt,wt2html
22345 !! wikitext
22346 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22347 !! html
22348 <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;]}">
22349 <p>foo</p>
22350 </div>
22351 <table>
22352 <tbody>
22353 <tr>
22354 <td>bar</td>
22355 </tr>
22356 </tbody>
22357 </table>
22358 !!end
22359
22360 !!test
22361 4. Encapsulate foster-parented transclusion content
22362 !!options
22363 parsoid=wt2wt,wt2html
22364 !! wikitext
22365 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22366 !! html
22367 <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;]}">
22368 <p>foo</p>
22369 </div>
22370 <table>
22371 <tbody>
22372 <tr>
22373 <td>bar</td>
22374 </tr>
22375 </tbody>
22376 </table>
22377 !!end
22378
22379 !!test
22380 5. Encapsulate foster-parented transclusion content
22381 !!options
22382 parsoid=wt2wt,wt2html
22383 !! wikitext
22384 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22385 !! html
22386 <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>
22387 <table>
22388 <tbody>
22389 <tr>
22390 <td>
22391 <div>
22392 <p>foo</p>
22393 </div>
22394 </td>
22395 </tr>
22396 </tbody>
22397 </table>
22398 !!end
22399
22400 !!test
22401 6. Encapsulate foster-parented transclusion content
22402 !!options
22403 parsoid=wt2wt,wt2html
22404 !! wikitext
22405 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22406 !! html
22407 <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>
22408 <table>
22409 <tbody>
22410 <tr>
22411 <td>
22412 <div>
22413 <p>foo</p>
22414 </div>
22415 </td>
22416 </tr>
22417 </tbody>
22418 </table>
22419 <p>ok</p>
22420 !!end
22421
22422 !!test
22423 7. Encapsulate foster-parented transclusion content
22424 !!options
22425 parsoid=wt2wt,wt2html
22426 !! wikitext
22427 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22428 !! html
22429 <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>
22430 <table>
22431 <tbody>
22432 <tr>
22433 <td>bar</td>
22434 </tr>
22435 </tbody>
22436 </table>
22437 !!end
22438
22439 !!test
22440 8. Encapsulate foster-parented transclusion content
22441 !!options
22442 parsoid=wt2wt,wt2html
22443 !! wikitext
22444 {{echo|a
22445 }}{|{{echo|style='color:red'}}
22446 |-
22447 |b
22448 |}
22449 !! html
22450 <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>
22451 <tbody>
22452 <tr>
22453 <td>b</td>
22454 </tr>
22455 </tbody>
22456 </table>
22457 !!end
22458
22459 !!test
22460 9. Encapsulate foster-parented transclusion content
22461 !!options
22462 parsoid=wt2wt,wt2html
22463 !! wikitext
22464 <table>{{echo|hi</table>hello}}
22465 !! html
22466 <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>
22467 !!end
22468
22469 !!test
22470 Table in fosterable position
22471 !!options
22472 parsoid=wt2html,wt2wt
22473 !! wikitext
22474 {{OpenTable}}
22475 <div>
22476 {|
22477 |}
22478 </div>
22479 |}
22480 !! html
22481 <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">
22482 </span>
22483 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22484
22485 <table>
22486 </table>
22487 !!end
22488
22489 # Parsoid only for bug 64747
22490 !! test
22491 Properly encapsulate empty-content transclusions in fosterable positions
22492 !! wikitext
22493 <table>
22494 {{#if:|
22495 <td>foo</td>
22496 }}
22497 </table>
22498 !! html/parsoid
22499 <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":["","","",""]}]]}'>
22500
22501 </table>
22502 !! end
22503
22504 !!test
22505 Support <object> element with .data attribute
22506 !!options
22507 parsoid=html2wt
22508 !! html
22509 <object data="test.swf"></object>
22510 !! wikitext
22511 <object data="test.swf"></object>
22512 !!end
22513
22514 !! test
22515 Don't block XML namespace declaration
22516 !! wikitext
22517 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22518 !! html/php
22519 <p><span>MediaWiki</span>
22520 </p>
22521 !! html/parsoid
22522 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22523 !! end
22524
22525 # -----------------------------------------------------------------
22526 # The following section of tests are primarily to spec requirements
22527 # around serialization of new/edited content.
22528 #
22529 # All these tests are marked Parsoid html2wt and html2html only
22530 # ----------------------------------------------------------------
22531
22532 # 'mi' is a localinterwiki prefix as well as a language
22533 !! test
22534 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22535 !! options
22536 parsoid=html2wt
22537 !! html
22538 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22539 !! wikitext
22540 [[Foo]]
22541 !! end
22542
22543 !! test
22544 New wiki links (href variations)
22545 !! options
22546 parsoid=html2wt
22547 !! html
22548 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22549 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22550 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22551 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22552 !! wikitext
22553 [[Foo_bar]]
22554 [[Foo_bar]]
22555 [[Foo_bar]]
22556 [[Toxine bactérienne]]
22557 !! end
22558
22559 !! test
22560 New wiki links (content string variations)
22561 !! options
22562 parsoid=html2wt
22563 !! html
22564 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22565 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22566 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22567 !! wikitext
22568 [[Foo_bar]]
22569 [[Foo bar]]
22570 [[Foo_bar|./Foo_bar]]
22571 !! end
22572
22573 !! test
22574 New category links (href variations)
22575 !! options
22576 parsoid=html2wt
22577 !! html
22578 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22579 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22580 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22581 !! wikitext
22582 [[Category:Toxine bactérienne]]
22583 [[Category:Toxine bactérienne]]
22584 [[Category:Toxine bactérienne]]
22585 !! end
22586
22587 !! test
22588 New sol transparent links don't need indent-pre nowiki protection
22589 !! options
22590 parsoid=html2wt
22591 language=de
22592 !! html
22593 <link rel="mw:PageProp/redirect" href="./Main_Page">
22594 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
22595 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
22596 !! wikitext
22597 #WEITERLEITUNG [[Main Page]]
22598 <!-- this is good --> [[Category:Good]]
22599 <!-- this is great --> [[Kategorie:Great]]
22600 !! end
22601
22602 !! test
22603 New interlanguage links (href variations)
22604 !! options
22605 parsoid=html2wt
22606 !! html
22607 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22608 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22609 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22610 !! wikitext
22611 [[es:Toxine bactérienne]]
22612 [[es:Toxine_bactérienne]]
22613 [[es:Toxine_bactérienne]]
22614 !! end
22615
22616 !! test
22617 Image: Modifying size of an image (1)
22618 !! options
22619 parsoid={
22620 "modes": ["wt2wt"],
22621 "changes": [
22622 ["img[height]", "attr", "height", "22"],
22623 ["img[width]", "attr", "width", "200"]
22624 ]
22625 }
22626 !! wikitext
22627 [[Image:Foobar.jpg|230x230px]]
22628 !! wikitext/edited
22629 [[Image:Foobar.jpg|200x200px]]
22630 !!end
22631
22632 !! test
22633 Image: Modifying size of an image (2)
22634 !! options
22635 parsoid={
22636 "modes": ["wt2wt"],
22637 "changes": [
22638 ["img[height]", "attr", "height", "100"],
22639 ["img[width]", "attr", "width", "500"]
22640 ]
22641 }
22642 !! wikitext
22643 [[Image:Foobar.jpg|230x230px]]
22644 !! wikitext/edited
22645 [[Image:Foobar.jpg|500x500px]]
22646 !!end
22647
22648 # Change in size is ignored so long as class='mw-default-size'
22649 !! test
22650 Image: Modifying size of an image (3)
22651 !! options
22652 parsoid={
22653 "modes": ["wt2wt"],
22654 "changes": [
22655 ["figure[class]", "removeClass", "mw-default-size"],
22656 ["figure img", "attr", "height", "19"],
22657 ["figure img", "attr", "width", "170"]
22658 ]
22659 }
22660 !! wikitext
22661 [[Image:Foobar.jpg|thumb]]
22662 !! wikitext/edited
22663 [[Image:Foobar.jpg|thumb|170x170px]]
22664 !!end
22665
22666 !! test
22667 Image: Modifying alignment of an image (bug 48665)
22668 !! options
22669 parsoid={
22670 "modes": ["wt2wt"],
22671 "changes": [
22672 ["figure[class]", "removeClass", "mw-halign-right"],
22673 ["figure[class]", "addClass", "mw-halign-left"]
22674 ]
22675 }
22676 !! wikitext
22677 [[Image:Foobar.jpg|thumb|caption|right]]
22678 !! wikitext/edited
22679 [[Image:Foobar.jpg|thumb|caption|left]]
22680 !! end
22681
22682 !! test
22683 Image: Modifying mw-default-size of an frameless image (bug 62805)
22684 !! options
22685 parsoid={
22686 "modes": ["wt2wt"],
22687 "changes": [
22688 ["figure.mw-default-size", "removeClass", "mw-default-size"]
22689 ]
22690 }
22691 !! wikitext
22692 [[Image:Foobar.jpg|frameless|right]]
22693 !! wikitext/edited
22694 [[Image:Foobar.jpg|frameless|right|220x220px]]
22695 !! end
22696
22697 !! test
22698 Image: Modifying valign of an image (bug 49221)
22699 !! options
22700 parsoid={
22701 "modes": ["wt2wt"],
22702 "changes": [
22703 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22704 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22705 ]
22706 }
22707 !! wikitext
22708 [[File:Foobar.jpg|20px|middle]]
22709 !! wikitext/edited
22710 [[File:Foobar.jpg|20px|text-top]]
22711 !! end
22712
22713 !! test
22714 Image: Modifying alt attribute of an image (bug 56400)
22715 !! options
22716 parsoid={
22717 "modes": ["wt2wt"],
22718 "changes": [
22719 ["img[alt]", "attr", "alt", "some alternate edited text"]
22720 ]
22721 }
22722 !! wikitext
22723 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22724 !! wikitext/edited
22725 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22726 !!end
22727
22728 !! test
22729 Image: Modifying caption of an image
22730 !! options
22731 parsoid={
22732 "modes": ["wt2wt"],
22733 "changes": [
22734 ["figcaption", "text", "new caption"]
22735 ]
22736 }
22737 !! wikitext
22738 [[Image:Foobar.jpg|thumb|original caption]]
22739 !! wikitext/edited
22740 [[Image:Foobar.jpg|thumb|new caption]]
22741 !!end
22742
22743 !! test
22744 Image: empty alt attribute (bug 48924)
22745 !! options
22746 parsoid
22747 !! wikitext
22748 [[File:Foobar.jpg|thumb|alt=|bar]]
22749 !! html
22750 <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>
22751 !! end
22752
22753 #!! test
22754 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22755 #!! options
22756 #parsoid=html2wt
22757 #language=ar
22758 #!! html
22759 #<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>
22760 #!! wikitext
22761 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22762 #!! end
22763
22764 !! test
22765 Image: Block level image should have \n before and after
22766 !! wikitext
22767 123
22768 [[File:Foobar.jpg|right|thumb|150x150px]]
22769 456
22770 !! html/parsoid
22771 <p>123</p>
22772 <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>
22773 <p>456</p>
22774 !!end
22775
22776 !! test
22777 Image: New block level image should have \n before and after (existing content)
22778 !! wikitext
22779 123
22780 [[File:Foobar.jpg|right|thumb|150x150px]]
22781 456
22782 !! html/parsoid
22783 <p>123</p>
22784 <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>
22785 <p>456</p>
22786 !!end
22787
22788 !! test
22789 Image: upright option (parsoid)
22790 !! options
22791 parsoid
22792 !! wikitext
22793 [[File:Foobar.jpg|thumb|upright|caption]]
22794 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22795 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22796 !! html
22797 <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>
22798 <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>
22799 <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>
22800 !!end
22801
22802 !! test
22803 Image: upright option is ignored on inline and frame images (parsoid)
22804 !! options
22805 parsoid
22806 !! wikitext
22807 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22808 !! html
22809 <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>
22810 !!end
22811
22812 !! test
22813 Image: from basic HTML (1)
22814 !! options
22815 parsoid=html2wt
22816 !! html/parsoid
22817 <span typeof="mw:Image">
22818 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22819 </span>
22820 !! wikitext
22821 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22822 !! end
22823
22824 !! test
22825 Image: from basic HTML (2)
22826 !! options
22827 parsoid=html2wt
22828 !! html/parsoid
22829 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22830 !! wikitext
22831 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22832 !! end
22833
22834 !! test
22835 Image: from basic HTML (3)
22836 !! options
22837 parsoid=html2wt
22838 !! html/parsoid
22839 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22840 !! wikitext
22841 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22842 !! end
22843
22844 !! test
22845 Image: from basic HTML (4)
22846 !! options
22847 parsoid=html2wt
22848 !! html/parsoid
22849 <img src="File:Foobar.jpg">
22850 !! wikitext
22851 [[File:Foobar.jpg|link=]]
22852 !! end
22853
22854 !! test
22855 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22856 !! options
22857 parsoid=html2wt
22858 !! html
22859 <ul>
22860 <li><p>foo</p></li>
22861 </ul>
22862 !! wikitext
22863 * foo
22864 !! end
22865
22866 !! test
22867 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22868 !! options
22869 parsoid=html2wt
22870 !! html
22871 <ul> <li>foo</li></ul>
22872 !! wikitext
22873 * foo
22874 !! end
22875
22876 !! test
22877 Don't strip leading whitespace when handling indent-pre suppressing tags
22878 !! options
22879 parsoid=html2wt
22880 !! html
22881 <table>
22882 <tr><td> indented row</td></tr>
22883 </table>
22884 <blockquote><p>
22885 <b>This is very bold of you!</b>
22886 </p>
22887 <table><tr><td>
22888 indented cell (no pre-wrapping!)
22889 </td></tr></table>
22890 </blockquote>
22891 <p>foo</p>
22892 <div>bar</div>
22893 !! wikitext
22894 {|
22895 | indented row
22896 |}
22897 <blockquote>
22898 '''This is very bold of you!'''
22899
22900 {|
22901 |
22902 indented cell (no pre-wrapping!)
22903 |}
22904 </blockquote>
22905 foo
22906 <div>bar</div>
22907 !! end
22908
22909 !! test
22910 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22911 !! options
22912 parsoid=html2wt
22913 !! wikitext
22914 foo
22915 <nowiki> </nowiki><span>bar</span>
22916
22917 <span>foo2
22918 <nowiki> </nowiki></span>bar2
22919
22920 <div>foo</div>
22921 <nowiki> </nowiki><span>bar</span>
22922
22923 <div>
22924 <nowiki> </nowiki><span>foo</span>
22925 </div>
22926 !! html
22927 <p>foo</p>
22928 <span>bar</span>
22929
22930 <span>foo2
22931 </span>bar2
22932
22933 <div>foo</div>
22934 <span>bar</span>
22935
22936 <div>
22937 <span>foo</span>
22938 </div>
22939 !! end
22940
22941 !! test
22942 Lists: Add space after bullets
22943 !! options
22944 parsoid=html2wt
22945 !! html
22946 <ul>
22947 <li>foo</li>
22948 <li> bar</li>
22949 <li><span> baz</span></li>
22950 </ul>
22951 !! wikitext
22952 * foo
22953 * bar
22954 * <span> baz</span>
22955 !! end
22956
22957 !! test
22958 Lists: Dont insert newlines in a serialized list item.
22959 !! options
22960 parsoid=html2wt
22961 !! html
22962 <ul><li>a<br>b</li><li>c</li></ul>
22963 !! wikitext
22964 * a<br>b
22965 * c
22966 !! end
22967
22968 !! test
22969 Headings: Add space before/after == (Bug 51744)
22970 !! options
22971 parsoid=html2wt
22972 !! html
22973 <h2>foo</h2>
22974 <h2> bar</h2>
22975 <h2>baz </h2>
22976 <h2><span> baz</span></h2>
22977 !! wikitext
22978 == foo ==
22979
22980 == bar ==
22981
22982 == baz ==
22983
22984 == <span> baz</span> ==
22985 !! end
22986
22987 !! test
22988 Headings: Force metas to serialize before/after
22989 !! options
22990 parsoid=html2wt
22991 !! html
22992 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
22993 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
22994
22995 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
22996 !! wikitext
22997 == hello there ==
22998 [[Category:A1]]
22999
23000 [[Category:A2]]
23001 == hi pal ==
23002
23003 <!--foo--> [[Category:A3]]
23004 == how goes it ==
23005 !! end
23006
23007 !! test
23008 Parsoid: Serialize positional parameters with = in them as named parameter
23009 !! options
23010 parsoid=html2wt
23011 !! html
23012 <p about="#mwt1" typeof="mw:Transclusion"
23013 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
23014
23015 <p about="#mwt1" typeof="mw:Transclusion"
23016 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
23017
23018 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23019 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23020 <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>
23021 !! wikitext
23022 {{echo|1 = f=oo}}
23023
23024 {{echo|1 = f=oo|2 = bar}}
23025
23026 <!--Orig params with data-parsoid has heuristics for handling = chars-->
23027 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
23028 {{echo|<nowiki>f=oo</nowiki>|bar}}
23029 !! end
23030
23031 !! test
23032 Parsoid: Serialize positional parameters with = in extlink as named parameter
23033 !! options
23034 parsoid=html2wt
23035 !! html
23036 <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>
23037 !! wikitext
23038 {{echo|1 = http://stuff?is=ok}}
23039 !! end
23040
23041 !! test
23042 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
23043 !! options
23044 parsoid=html2wt
23045 !! html
23046 <div>a<p>b</p></div>
23047 <div>a
23048 <p>b</p></div>
23049 <div>
23050 a
23051 <p>b</p></div>
23052 !! wikitext
23053 <div>a
23054 b
23055 </div>
23056 <div>a
23057 b
23058 </div>
23059 <div>
23060 a
23061
23062 b
23063 </div>
23064 !! end
23065
23066 !! test
23067 Substrings resembling wikitext in hrefs should not get nowiki escapes
23068 !! options
23069 parsoid=html2wt
23070 !! html
23071 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
23072 !! wikitext
23073 [[Foo''bar''baz]]
23074 !! end
23075
23076 #-----------------------------
23077 # I/B quote minimization tests
23078 #-----------------------------
23079
23080 !! test
23081 1. I/B quote minimization: wikitext-only tags should be combined
23082 !! options
23083 parsoid=html2wt
23084 !! html
23085 <p><i>A</i><i>B</i></p>
23086 <p><b>A</b><b>B</b></p>
23087 <p><i>A</i><b><i>B</i></b></p>
23088 <p><b>A</b><i><b>B</b></i></p>
23089 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
23090 <p><i><b>A</b></i><i><b>B</b></i></p>
23091 <p><i><b>A</b></i><b><i>B</i></b></p>
23092 <p><b><i>A</i></b><i><b>B</b></i></p>
23093 !! wikitext
23094 ''AB''
23095
23096 '''AB'''
23097
23098 ''A'''B'''''
23099
23100 '''A''B'''''
23101
23102 '''A''BC''D'''
23103
23104 '''''AB'''''
23105
23106 '''''AB'''''
23107
23108 '''''AB'''''
23109 !! end
23110
23111 !! test
23112 2. I/B quote minimization: wikitext and html tags should not be combined
23113 !! options
23114 parsoid=html2wt
23115 !! html
23116 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
23117 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
23118 !! wikitext
23119 ''A''<i>B</i>
23120
23121 ''A''<nowiki/>'''<i>B</i>'''
23122 !! end
23123
23124 !! test
23125 3. I/B quote minimization: templated content stops minimization
23126 !! options
23127 parsoid=html2wt
23128 !! html
23129 <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>
23130 <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>
23131 !! wikitext
23132 ''A''{{echo|''B''}}
23133
23134 ''A''{{echo|'''''B'''''}}
23135 !! end
23136
23137 !! test
23138 4. I/B quote minimization: new content should be mimimized with adjacent old content
23139 !! options
23140 parsoid=html2wt
23141 !! html
23142 <p><i>A</i><i>B</i></p>
23143 <p><b>A</b><b>B</b></p>
23144 <p><i>A</i><b><i>B</i></b></p>
23145 !! wikitext
23146 ''AB''
23147
23148 '''AB'''
23149
23150 ''A'''B'''''
23151 !! end
23152
23153 !! test
23154 5a. Merge adjacent quote nodes if they've been edited
23155 !! options
23156 parsoid={
23157 "modes": ["wt2wt"],
23158 "changes": [
23159 ["p", "contents", "remove", ":contains('b')"]
23160 ]
23161 }
23162 !! wikitext
23163 ''a''b''c''
23164 !! wikitext/edited
23165 ''ac''
23166 !! end
23167
23168 !! test
23169 5b. Merge adjacent quote nodes if they've been edited
23170 !! options
23171 parsoid={
23172 "modes": ["wt2wt"],
23173 "changes": [
23174 ["#x", "remove"]
23175 ]
23176 }
23177 !! wikitext
23178 ''a''<span id="x">b</span>''c''
23179 !! wikitext/edited
23180 ''ac''
23181 !! end
23182
23183 #------------------------------------
23184 # End of I/B quote minimization tests
23185 #------------------------------------
23186
23187 !!test
23188 Bug 54262: New entities
23189 !! options
23190 parsoid=html2wt
23191 !! wikitext
23192 &nbsp;
23193 !! html
23194 <span typeof="mw:Entity">&nbsp;</span>
23195 !! end
23196
23197 ## Note that there is no wikitext output for 'unknownproperty' ##
23198 ## Unknown magic words are silently dropped ##
23199
23200 !! test
23201 Magic words
23202 !! options
23203 parsoid=html2wt
23204 !! html
23205 <meta property='mw:PageProp/toc' />
23206 <meta property='mw:PageProp/notoc' />
23207 <meta property='mw:PageProp/forcetoc' />
23208 <meta property='mw:PageProp/index' />
23209 <meta property='mw:PageProp/noindex' />
23210 <meta property='mw:PageProp/nogallery' />
23211 <meta property='mw:PageProp/noeditsection' />
23212 <meta property='mw:PageProp/notitleconvert' />
23213 <meta property='mw:PageProp/nocontentconvert' />
23214 <meta property='mw:PageProp/unknownproperty' />
23215 !! wikitext
23216 __TOC__
23217 __NOTOC__
23218 __FORCETOC__
23219 __INDEX__
23220 __NOINDEX__
23221 __NOGALLERY__
23222 __NOEDITSECTION__
23223 __NOTITLECONVERT__
23224 __NOCONTENTCONVERT__
23225 !! end
23226
23227 !! test
23228 Consecutive <pre>s should not get merged
23229 !! options
23230 parsoid=html2wt,html2html
23231 !! html
23232 <pre>a</pre><pre>b</pre>
23233
23234 <pre>c
23235 </pre><pre>
23236 d</pre>
23237
23238 <pre>e
23239
23240 </pre><pre>
23241
23242 f</pre>
23243 !! wikitext
23244 a
23245
23246 b
23247
23248 c
23249
23250 d
23251
23252 e
23253
23254
23255
23256 f
23257 !! end
23258
23259 !! test
23260 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23261 !! options
23262 parsoid=html2wt
23263 !! html
23264 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23265 !! wikitext
23266 [[Special:BookSources/1234567890|ISBN 1234567895]]
23267 !! end
23268
23269 !! test
23270 Edited RFC links not serializable as RFC links should serialize as extlinks
23271 !! options
23272 parsoid=html2wt
23273 !! html
23274 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23275 !! wikitext
23276 [//tools.ietf.org/html/rfc123 New RFC]
23277 !! end
23278
23279 !! test
23280 Edited PMID links not serializable as PMID links should serialize as extlinks
23281 !! options
23282 parsoid=html2wt
23283 !! html
23284 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23285 !! wikitext
23286 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23287 !! end
23288
23289 !! test
23290 WTS of autolinks with trailing/surrounding context
23291 !! options
23292 parsoid=html2wt
23293 !! html/parsoid
23294 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23295 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23296 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23297 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23298 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23299 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23300 !! wikitext
23301 http://cscott.net<nowiki/>'''foo'''
23302
23303 http://cscott.net<b>foo</b>
23304
23305 '''http://cscott.net<nowiki/>'''
23306
23307 '''http://cscott.net '''
23308
23309 '''http://cscott.net<nowiki/>x'''
23310
23311 http://cscott.net<nowiki/>x
23312 !! end
23313
23314 !! test
23315 WTS of autolinks with nowikis (round-trip)
23316 !! wikitext
23317 x<nowiki/>http://cscott.net<nowiki/>x
23318 !! html/parsoid
23319 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23320 !! end
23321
23322 # this is the "easy" test because it leaves in place all the
23323 # data-parsoid information indicating this is an autolink
23324 !! test
23325 WTS of autolinks with escapes (editing)
23326 !! options
23327 parsoid={
23328 "modes": ["wt2wt"],
23329 "changes": [
23330 [ "meta", "remove" ]
23331 ]
23332 }
23333 !! wikitext
23334 x<nowiki/>http://cscott.net<nowiki/>x
23335 !! wikitext/edited
23336 x<nowiki/>http://cscott.net<nowiki/>x
23337 !! end
23338
23339 !! test
23340 Edited Redirect link should emit a non-piped wikitext link
23341 !! options
23342 parsoid=html2wt
23343 !! html
23344 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23345 !! wikitext
23346 #REDIRECT [[Bar]]
23347 !! end
23348
23349 !! test
23350 T75121: Infer extension name from typeOf if data-mw is not present
23351 !! options
23352 parsoid=html2wt
23353 !! html
23354 <div typeOf="mw:Extension/foo"></div>
23355 !! wikitext
23356 <foo />
23357 !! end
23358
23359 # -----------------------------------------------------------------
23360 # End of section for Parsoid-only html2wt tests for serialization
23361 # of new content
23362 # -----------------------------------------------------------------
23363
23364 TODO:
23365 more images
23366 more tables
23367 character entities
23368 and much more
23369 Try for 100% code coverage