Show the revision list immediately on "umerge" log action links
[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 formdness
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:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 ###
159 ### Basic tests
160 ###
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
166
167
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
180 foo
181
182 bar
183
184
185 baz
186
187
188
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
194 baz
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
199
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
204 a
205 <!--foo-->
206 b
207 ----
208 a
209 <!--foo--><!--More than 1 comment, still stripped-->
210 b
211 ----
212 a
213 <!--foo--> <!----> <!-- bar -->
214 b
215 ----
216 a
217 <!--foo-->
218
219 b
220 ----
221 a
222
223 <!--foo-->
224 b
225 ----
226 a
227 <!--foo-->
228
229
230 b
231 ----
232 a
233
234
235 <!--foo-->
236 b
237 ----
238 !! html
239 <hr />
240 <p>a
241 b
242 </p>
243 <hr />
244 <p>a
245 b
246 </p>
247 <hr />
248 <p>a
249 b
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
262 b
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
267 b
268 </p>
269 <hr />
270
271 !! end
272
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
277 a
278
279 b
280 ----
281 a
282
283
284 b
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br />
294 b
295 </p>
296 <hr />
297
298 !! end
299
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
304 a
305 <!--foo-->
306 b
307 ----
308 a
309 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316 b
317 ----
318 a
319
320 <!--foo-->
321 <!--bar-->
322
323 b
324 ----
325 !! html
326 <hr />
327 <p>a
328 b
329 </p>
330 <hr />
331 <p>a
332 b
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br />
341 b
342 </p>
343 <hr />
344
345 !! end
346
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
350 a
351
352 <!--boo-->
353
354 b
355 !! html
356 <p>a
357 </p><p><br />
358 b
359 </p>
360 !!end
361
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
365 a
366
367
368
369 =b=
370 [[a]]
371
372
373 =b=
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
383
384 !! end
385
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
389 =b=
390
391
392
393 [[a]]
394 !! html
395 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
399
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
409
410 # Note that the html+tidy output removes the spaces after the <li>,
411 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
412 # This is an issue for all tests with lists. We intentionally do
413 # *not* add html+tidy clauses for these, as we don't want to
414 # document/test the broken behavior. (Parsoid matches the non-tidy
415 # output in these cases.)
416
417 !! test
418 Simple list
419 !! wikitext
420 * Item 1
421 * Item 2
422 !! html
423 <ul><li> Item 1</li>
424 <li> Item 2</li></ul>
425
426 !! end
427
428 !! test
429 Italics and bold
430 !! wikitext
431 * plain
432 * plain''italic''plain
433 * plain''italic''plain''italic''plain
434 * plain'''bold'''plain
435 * plain'''bold'''plain'''bold'''plain
436 * plain''italic''plain'''bold'''plain
437 * plain'''bold'''plain''italic''plain
438 * plain''italic'''bold-italic'''italic''plain
439 * plain'''bold''bold-italic''bold'''plain
440 * plain'''''bold-italic'''italic''plain
441 * plain'''''bold-italic''bold'''plain
442 * plain''italic'''bold-italic'''''plain
443 * plain'''bold''bold-italic'''''plain
444 * plain l'''italic''plain
445 * plain l''''bold''' plain
446 !! html
447 <ul><li> plain</li>
448 <li> plain<i>italic</i>plain</li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
450 <li> plain<b>bold</b>plain</li>
451 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
453 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
454 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
455 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
456 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
457 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
458 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
459 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
460 <li> plain l'<i>italic</i>plain</li>
461 <li> plain l'<b>bold</b> plain</li></ul>
462
463 !! end
464
465 # this example taken from the [[simple:Moon]] article (bug 47326)
466 !! test
467 Italics and possessives (1)
468 !! wikitext
469 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
470 !! html
471 <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
472 </p>
473 !! end
474
475 # this example taken from [[en:Flaming Pie]] (bug 49926)
476 !! test
477 Italics and possessives (2)
478 !! wikitext
479 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
480 !! html
481 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
482 </p>
483 !! end
484
485 # this example taken from [[en:Dictionary]] (bug 49926)
486 !! test
487 Italics and possessives (3)
488 !! wikitext
489 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''.
490 !! html
491 <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>.
492 </p>
493 !! end
494
495
496 ###
497 ### 2-quote opening sequence tests
498 ###
499 !! test
500 Italics and bold: 2-quote opening sequence: (2,2)
501 !! wikitext
502 ''foo''
503 !! html
504 <p><i>foo</i>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3)
511 !! options
512 parsoid=wt2html
513 !! wikitext
514 ''foo'''
515 !! html/*
516 <p><i>foo'</i>
517 </p>
518 !!end
519
520
521 # same html as previous, but wikitext adjusted to match parsoid html2wt
522 !! test
523 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
524 !! wikitext
525 ''<nowiki>foo'</nowiki>''
526 !! html
527 <p><i>foo'</i>
528 </p>
529 !! end
530
531
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4)
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 ''foo''''
538 !! html/*
539 <p><i>foo''</i>
540 </p>
541 !!end
542
543
544 # same html as previous, but wikitext adjusted to match parsoid html2wt
545 !! test
546 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
547 !! wikitext
548 ''<nowiki>foo''</nowiki>''
549 !! html
550 <p><i>foo''</i>
551 </p>
552 !! end
553
554
555 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
556 !! test
557 Italics and bold: 2-quote opening sequence: (2,5)
558 !! options
559 parsoid=wt2html
560 !! wikitext
561 ''foo'''''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !!end
569
570 # same html as previous, but wikitext adjusted to match parsoid html2wt
571 !! test
572 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
573 !! wikitext
574 ''foo'''''<nowiki/>'''
575 !! html/php
576 <p><i>foo</i>
577 </p>
578 !! html/parsoid
579 <p><i>foo</i><b></b>
580 </p>
581 !! end
582
583
584 ###
585 ### 3-quote opening sequence tests
586 ###
587
588 !! test
589 Italics and bold: 3-quote opening sequence: (3,2)
590 !! wikitext
591 '''foo''
592 !! html
593 <p>'<i>foo</i>
594 </p>
595 !!end
596
597
598 !! test
599 Italics and bold: 3-quote opening sequence: (3,3)
600 !! wikitext
601 '''foo'''
602 !! html
603 <p><b>foo</b>
604 </p>
605 !!end
606
607
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4)
610 !! options
611 parsoid=wt2html
612 !! wikitext
613 '''foo''''
614 !! html/*
615 <p><b>foo'</b>
616 </p>
617 !!end
618
619
620 # same html as previous, but wikitext adjusted to match parsoid html2wt
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
623 !! wikitext
624 '''<nowiki>foo'</nowiki>'''
625 !! html
626 <p><b>foo'</b>
627 </p>
628 !! end
629
630
631 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
632 !! test
633 Italics and bold: 3-quote opening sequence: (3,5)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 '''foo'''''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !!end
645
646 # same html as previous, but wikitext adjusted to match parsoid html2wt
647 !! test
648 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
649 !! wikitext
650 '''foo'''''<nowiki/>''
651 !! html/php
652 <p><b>foo</b>
653 </p>
654 !! html/parsoid
655 <p><b>foo</b><i></i>
656 </p>
657 !! end
658
659
660 ###
661 ### 4-quote opening sequence tests
662 ###
663
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''''foo''
670 !! html/*
671 <p>''<i>foo</i>
672 </p>
673 !!end
674
675
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
679 !! wikitext
680 <nowiki>''</nowiki>''foo''
681 !! html
682 <p>''<i>foo</i>
683 </p>
684 !! end
685
686
687 !! test
688 Italics and bold: 4-quote opening sequence: (4,3)
689 !! wikitext
690 ''''foo'''
691 !! html
692 <p>'<b>foo</b>
693 </p>
694 !!end
695
696
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''''
703 !! html/*
704 <p>'<b>foo'</b>
705 </p>
706 !!end
707
708
709 # same html as previous, but wikitext adjusted to match parsoid html2wt
710 !! test
711 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
712 !! wikitext
713 ''''<nowiki>foo'</nowiki>'''
714 !! html
715 <p>'<b>foo'</b>
716 </p>
717 !! end
718
719
720 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,5)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !!end
734
735 # same html as previous, but wikitext adjusted to match parsoid html2wt
736 !! test
737 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
738 !! wikitext
739 ''''foo'''''<nowiki/>''
740 !! html/php
741 <p>'<b>foo</b>
742 </p>
743 !! html/parsoid
744 <p>'<b>foo</b><i></i>
745 </p>
746 !! end
747
748
749 ###
750 ### 5-quote opening sequence tests
751 ###
752
753 !! test
754 Italics and bold: 5-quote opening sequence: (5,2)
755 !! options
756 parsoid=wt2html
757 !! wikitext
758 '''''foo''
759 !! html/*
760 <p><b><i>foo</i></b>
761 </p>
762 !!end
763
764
765 # same html as previous, but wikitext adjusted to match parsoid html2wt
766 # skipping wt2html and html2html because it wants to put <i> before <b>
767 !! test
768 Italics and bold: 5-quote opening sequence: (5,2+3)
769 !! options
770 parsoid=wt2wt,html2wt
771 !! wikitext
772 '''''foo'''''
773 !! html
774 <p><b><i>foo</i></b>
775 </p>
776 !! end
777
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 '''''foo'''
784 !! html/*
785 <p><i><b>foo</b></i>
786 </p>
787 !!end
788
789
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 5-quote opening sequence: (5,3+2)
793 !! wikitext
794 '''''foo'''''
795 !! html
796 <p><i><b>foo</b></i>
797 </p>
798 !! end
799
800
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4)
803 !! options
804 parsoid=wt2html
805 !! wikitext
806 '''''foo''''
807 !! html/*
808 <p><i><b>foo'</b></i>
809 </p>
810 !!end
811
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
816 !! wikitext
817 '''''<nowiki>foo'</nowiki>'''''
818 !! html
819 <p><i><b>foo'</b></i>
820 </p>
821 !! end
822
823
824 !! test
825 Italics and bold: 5-quote opening sequence: (5,5)
826 !! wikitext
827 '''''foo'''''
828 !! html
829 <p><i><b>foo</b></i>
830 </p>
831 !!end
832
833 ###
834 ### multiple quote sequences in a line
835 ###
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2)
838 !! options
839 parsoid=wt2html
840 !! wikitext
841 ''foo''''bar''
842 !! html/*
843 <p><i>foo'<b>bar</b></i>
844 </p>
845 !!end
846
847
848 # same html as previous, but wikitext adjusted to match parsoid html2wt
849 !! test
850 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
851 !! wikitext
852 ''<nowiki>foo'</nowiki>'''bar'''''
853 !! html
854 <p><i>foo'<b>bar</b></i>
855 </p>
856 !! end
857
858
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3)
861 !! options
862 parsoid=wt2html
863 !! wikitext
864 ''foo''''bar'''
865 !! html/*
866 <p><i>foo'<b>bar</b></i>
867 </p>
868 !!end
869
870
871 # same html as previous, but wikitext adjusted to match parsoid html2wt
872 !! test
873 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
874 !! wikitext
875 ''<nowiki>foo'</nowiki>'''bar'''''
876 !! html
877 <p><i>foo'<b>bar</b></i>
878 </p>
879 !! end
880
881
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4)
884 !! options
885 parsoid=wt2html
886 !! wikitext
887 ''foo''''bar''''
888 !! html/*
889 <p><i>foo'<b>bar'</b></i>
890 </p>
891 !!end
892
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
897 !! wikitext
898 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
899 !! html
900 <p><i>foo'<b>bar'</b></i>
901 </p>
902 !! end
903
904
905 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
906 !! test
907 Italics and bold: multiple quote sequences: (3,4,2)
908 !! options
909 parsoid=wt2html
910 !! wikitext
911 '''foo''''bar''
912 !! html/php
913 <p><b>foo'</b>bar
914 </p>
915 !! html/parsoid
916 <p><b>foo'</b>bar<i></i>
917 </p>
918 !!end
919
920 # same html as previous, but wikitext adjusted to match parsoid html2wt
921 !! test
922 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
923 !! options
924 parsoid
925 !! wikitext
926 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
927 !! html/php
928 <p><b>foo'</b>bar
929 </p>
930 !! html/parsoid
931 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
932 </p>
933 !! end
934
935
936 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
937 !! test
938 Italics and bold: multiple quote sequences: (3,4,3)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 '''foo''''bar'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b>foo'</b>bar<b></b>
948 </p>
949 !!end
950
951 # same html as previous, but wikitext adjusted to match parsoid html2wt
952 !! test
953 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
954 !! wikitext
955 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
956 !! html/php
957 <p><b>foo'</b>bar
958 </p>
959 !! html/parsoid
960 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
961 </p>
962 !! end
963
964 ###
965 ### other quote tests
966 ###
967 !! test
968 Italics and bold: other quote tests: (2,3,5)
969 !! wikitext
970 ''this is about '''foo's family'''''
971 !! html
972 <p><i>this is about <b>foo's family</b></i>
973 </p>
974 !!end
975
976
977 !! test
978 Italics and bold: other quote tests: (2,(3,3),2)
979 !! wikitext
980 ''this is about '''foo's''' family''
981 !! html
982 <p><i>this is about <b>foo's</b> family</i>
983 </p>
984 !!end
985
986
987 !! test
988 Italics and bold: other quote tests: (3,2,3,2)
989 !! options
990 parsoid=wt2html
991 !! wikitext
992 '''this is about ''foo'''s family''
993 !! html/*
994 <p><b>this is about <i>foo</i></b><i>s family</i>
995 </p>
996 !!end
997
998
999 # same html as previous, but wikitext adjusted to match parsoid html2wt
1000 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1001 !! test
1002 Italics and bold: other quote tests: (3,2,3+2+2,2)
1003 !! options
1004 parsoid
1005 !! wikitext
1006 '''this is about ''foo'''''<nowiki/>''s family''
1007 !! html/*
1008 <p><b>this is about <i>foo</i></b><i>s family</i>
1009 </p>
1010 !! end
1011
1012
1013 !! test
1014 Italics and bold: other quote tests: (3,2,3,3)
1015 !! options
1016 !! wikitext
1017 '''this is about ''foo'''s family'''
1018 !! html
1019 <p>'<i>this is about </i>foo<b>s family</b>
1020 </p>
1021 !!end
1022
1023
1024 !! test
1025 Italics and bold: other quote tests: (3,(2,2),3)
1026 !! wikitext
1027 '''this is about ''foo's'' family'''
1028 !! html
1029 <p><b>this is about <i>foo's</i> family</b>
1030 </p>
1031 !!end
1032
1033
1034 !! test
1035 Italicized possessive
1036 !! wikitext
1037 The ''[[Main Page]]'''s talk page.
1038 !! html
1039 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1040 </p>
1041 !! end
1042
1043 !! test
1044 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1045 (Requires tidy for PHP parser output to be fixed up)
1046 !! options
1047 parsoid=wt2html,wt2wt
1048 !! wikitext
1049 {|
1050 !''a!!''b
1051 |''a||''b
1052 |}
1053 !! html/php+tidy
1054 <table>
1055 <tr>
1056 <th><i>a</i></th>
1057 <th><i>b</i></th>
1058 <td><i>a</i></td>
1059 <td><i>b</i></td>
1060 </tr>
1061 </table>
1062 !! html/parsoid
1063 <table>
1064 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1065 <td><i>a</i></td><td><i>b</i></td></tr>
1066 </tbody></table>
1067 !! end
1068
1069 ###
1070 ### Non-html5 tags
1071 ###
1072
1073 !! test
1074 Non-html5 tags should be accepted
1075 !! wikitext
1076 <center>''foo''</center>
1077 <big>''foo''</big>
1078 <font>''foo''</font>
1079 <strike>''foo''</strike>
1080 <tt>''foo''</tt>
1081 !! html
1082 <center><i>foo</i></center>
1083 <p><big><i>foo</i></big>
1084 <font><i>foo</i></font>
1085 <strike><i>foo</i></strike>
1086 <tt><i>foo</i></tt>
1087 </p>
1088 !! end
1089
1090 !! test
1091 <wbr> is valid wikitext (bug 52468)
1092 !! wikitext
1093 <wbr>
1094 !! html
1095 <p><wbr />
1096 </p>
1097 !! end
1098
1099 # <strike> is HTML4, <s> is HTML4/5.
1100 !! test
1101 <s> or <strike> for strikethrough
1102 !! wikitext
1103 <strike>strike</strike>
1104
1105 <s>s</s>
1106 !! html
1107 <p><strike>strike</strike>
1108 </p><p><s>s</s>
1109 </p>
1110 !! end
1111
1112 ## a not permitted
1113 ## i,b,br omitted
1114 !! test
1115 Text-level semantic html elements in wikitext
1116 !! wikitext
1117 <em>text</em>
1118 <strong>text</strong>
1119 <small>text</small>
1120 <s>text</s>
1121 <cite>text</cite>
1122 <q>text</q>
1123 <dfn>text</dfn>
1124 <abbr>text</abbr>
1125 <data>text</data>
1126 <time>text</time>
1127 <code>text</code>
1128 <var>text</var>
1129 <samp>text</samp>
1130 <kbd>text</kbd>
1131 <sub>text</sub>
1132 <u>text</u>
1133 <mark>text</mark>
1134 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1135 <bdi>text</bdi>
1136 <bdo>text</bdo>
1137 <span>text</span>
1138 <wbr />
1139 !! html
1140 <p><em>text</em>
1141 <strong>text</strong>
1142 <small>text</small>
1143 <s>text</s>
1144 <cite>text</cite>
1145 <q>text</q>
1146 <dfn>text</dfn>
1147 <abbr>text</abbr>
1148 <data>text</data>
1149 <time>text</time>
1150 <code>text</code>
1151 <var>text</var>
1152 <samp>text</samp>
1153 <kbd>text</kbd>
1154 <sub>text</sub>
1155 <u>text</u>
1156 <mark>text</mark>
1157 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1158 <bdi>text</bdi>
1159 <bdo>text</bdo>
1160 <span>text</span>
1161 <wbr />
1162 </p>
1163 !! end
1164
1165 # test cases taken from
1166 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1167 !! test
1168 Ruby markup (W3C-style)
1169 !! wikitext
1170 ; Mono-ruby for individual base characters
1171 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1172 ; Group ruby
1173 : <ruby>今日<rt>きょう</rt></ruby>
1174 ; Jukugo ruby
1175 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1176 ; Inline ruby
1177 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1178 ; Double-sided ruby
1179 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1180 <ruby>
1181 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1182 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1183 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1184 </ruby>
1185 !! html
1186 <dl><dt> Mono-ruby for individual base characters</dt>
1187 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1188 <dt> Group ruby</dt>
1189 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1190 <dt> Jukugo ruby</dt>
1191 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1192 <dt> Inline ruby</dt>
1193 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1194 <dt> Double-sided ruby</dt>
1195 <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>
1196 <p><ruby>
1197 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1198 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1199 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1200 </ruby>
1201 </p>
1202 !! end
1203
1204 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1205 !! test
1206 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1207 !! wikitext
1208 <b→> doesn't work! </b→>
1209
1210 <bä> doesn't work! </bä>
1211
1212 <boo> works fine </boo>
1213
1214 <s.foo>s.foo</s.foo>
1215
1216 <sub-ID#1>
1217 !! html
1218 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1219 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1220 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1221 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1222 </p><p>&lt;sub-ID#1&gt;
1223 </p>
1224 !! end
1225
1226 !! test
1227 Isolated close tags should be treated as literal text (bug 52760)
1228 !! wikitext
1229 </b>
1230
1231 <s.foo>s</s>
1232 !! html
1233 <p>&lt;/b&gt;
1234 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1235 </p>
1236 !! end
1237
1238 ###
1239 ### Special characters
1240 ###
1241
1242 !! test
1243 Bare pipe character (bug 52363)
1244 !! wikitext
1245 |
1246 !! html
1247 <p>|
1248 </p>
1249 !! end
1250
1251 !! test
1252 Bare pipe character from a template (bug 52363)
1253 !! wikitext
1254 {{pipe}}
1255 !! html
1256 <p>|
1257 </p>
1258 !! end
1259
1260 ###
1261 ### <nowiki> test cases
1262 ###
1263
1264 !! test
1265 <nowiki> unordered list
1266 !! wikitext
1267 <nowiki>* This is not an unordered list item.</nowiki>
1268 !! html
1269 <p>* This is not an unordered list item.
1270 </p>
1271 !! end
1272
1273 !! test
1274 <nowiki> spacing
1275 !! wikitext
1276 <nowiki>Lorem ipsum dolor
1277
1278 sed abit.
1279 sed nullum.
1280
1281 :and a colon
1282 </nowiki>
1283 !! html
1284 <p>Lorem ipsum dolor
1285
1286 sed abit.
1287 sed nullum.
1288
1289 :and a colon
1290
1291 </p>
1292 !! end
1293
1294 !! test
1295 nowiki 3
1296 !! wikitext
1297 :There is not nowiki.
1298 :There is <nowiki>nowiki</nowiki>.
1299
1300 #There is not nowiki.
1301 #There is <nowiki>nowiki</nowiki>.
1302
1303 *There is not nowiki.
1304 *There is <nowiki>nowiki</nowiki>.
1305 !! html
1306 <dl><dd>There is not nowiki.</dd>
1307 <dd>There is nowiki.</dd></dl>
1308 <ol><li>There is not nowiki.</li>
1309 <li>There is nowiki.</li></ol>
1310 <ul><li>There is not nowiki.</li>
1311 <li>There is nowiki.</li></ul>
1312
1313 !! end
1314
1315 !! test
1316 Entities inside <nowiki>
1317 !! wikitext
1318 <nowiki>&lt;</nowiki>
1319 !! html
1320 <p>&lt;
1321 </p>
1322 !! end
1323
1324 !! test
1325 Entities inside template parameters
1326 !! options
1327 parsoid
1328 !! wikitext
1329 {{echo|&ndash;}}
1330 !! html
1331 <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>
1332 </p>
1333 !! end
1334
1335 !! test
1336 Properly escape nowiki when combined with other wiki markup
1337 !! options
1338 parsoid=html2wt
1339 !! wikitext
1340 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1341 !! html
1342 <p>* &lt;/nowiki&gt; tag</p>
1343 !! end
1344
1345 ###
1346 ### Comments
1347 ###
1348 !! test
1349 Comments and Indent-Pre
1350 !! wikitext
1351 <!-- comment 1 --> asdf
1352
1353 <!-- comment 1 --> asdf
1354 <!-- comment 2 -->
1355
1356 <!-- comment 1 --> asdf
1357 <!-- comment 2 -->xyz
1358
1359 <!-- comment 1 --> asdf
1360 <!-- comment 2 --> xyz
1361 !! html
1362 <pre>asdf
1363 </pre>
1364 <pre>asdf
1365 </pre>
1366 <pre>asdf
1367 </pre>
1368 <p>xyz
1369 </p>
1370 <pre>asdf
1371 xyz
1372 </pre>
1373 !! end
1374
1375 !! test
1376 Comment test 2a
1377 !! wikitext
1378 asdf
1379 <!-- comment 1 -->
1380 jkl
1381 !! html
1382 <p>asdf
1383 jkl
1384 </p>
1385 !! end
1386
1387 !! test
1388 Comment test 2b
1389 !! wikitext
1390 asdf
1391 <!-- comment 1 -->
1392
1393 jkl
1394 !! html
1395 <p>asdf
1396 </p><p>jkl
1397 </p>
1398 !! end
1399
1400 !! test
1401 Comment test 3
1402 !! wikitext
1403 asdf
1404 <!-- comment 1 -->
1405 <!-- comment 2 -->
1406 jkl
1407 !! html
1408 <p>asdf
1409 jkl
1410 </p>
1411 !! end
1412
1413 !! test
1414 Comment test 4
1415 !! wikitext
1416 asdf<!-- comment 1 -->jkl
1417 !! html
1418 <p>asdfjkl
1419 </p>
1420 !! end
1421
1422 !! test
1423 Comment spacing
1424 !! wikitext
1425 a
1426 <!-- foo --> b <!-- bar -->
1427 c
1428 !! html
1429 <p>a
1430 </p>
1431 <pre> b
1432 </pre>
1433 <p>c
1434 </p>
1435 !! end
1436
1437 !! test
1438 Comment whitespace
1439 !! wikitext
1440 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1441 !! html
1442
1443 !! end
1444
1445 !! test
1446 Comment semantics and delimiters
1447 !! wikitext
1448 <!-- --><!----><!-----><!------>
1449 !! html
1450
1451 !! end
1452
1453 !! test
1454 Comment semantics and delimiters, redux
1455 !! wikitext
1456 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1457 -- foo -- funky huh? ... -->
1458 !! html
1459
1460 !! end
1461
1462 !! test
1463 Comment semantics and delimiters: directors cut
1464 !! wikitext
1465 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1466 everything starting with < followed by !-- until the first -- and > we see,
1467 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1468 -->-->
1469 !! html
1470 <p>--&gt;
1471 </p>
1472 !! end
1473
1474 !! test
1475 Comment semantics: nesting
1476 !! wikitext
1477 <!--<!-- no, we're not going to do anything fancy here -->-->
1478 !! html
1479 <p>--&gt;
1480 </p>
1481 !! end
1482
1483 !! test
1484 Comment semantics: unclosed comment at end
1485 !! wikitext
1486 <!--This comment will run out to the end of the document
1487 !! html
1488
1489 !! end
1490
1491 !! test
1492 Comment in template title
1493 !! wikitext
1494 {{f<!---->oo}}
1495 !! html
1496 <p>FOO
1497 </p>
1498 !! end
1499
1500 !! test
1501 Comment on its own line post-expand
1502 !! wikitext
1503 a
1504 {{blank}}<!---->
1505 b
1506 !! html
1507 <p>a
1508 </p><p>b
1509 </p>
1510 !! end
1511
1512 !! test
1513 Comment on its own line post-expand with non-significant whitespace
1514 !! wikitext
1515 a
1516 {{blank}} <!---->
1517 b
1518 !! html
1519 <p>a
1520 </p><p>b
1521 </p>
1522 !! end
1523
1524 !! test
1525 Multiple comments should still parse as SOL-transparent
1526 !! options
1527 parsoid=wt2html,wt2wt
1528 !! wikitext
1529 <!--c1-->*a
1530 <!--c2--><!--c3--><!--c4-->*b
1531 !! html
1532 <ul>
1533 <li>a
1534 </li>
1535 <li>b
1536 </li>
1537 </ul>
1538 !! end
1539
1540 ###
1541 ### paragraph wrapping tests
1542 ###
1543 !! test
1544 No block tags
1545 !! wikitext
1546 a
1547
1548 b
1549 !! html
1550 <p>a
1551 </p><p>b
1552 </p>
1553 !! end
1554
1555 !! test
1556 Block tag on one line (<div>)
1557 !! wikitext
1558 a <div>foo</div>
1559
1560 b
1561 !! html
1562 a <div>foo</div>
1563 <p>b
1564 </p>
1565 !! html+tidy
1566 <p>a</p>
1567 <div>foo</div>
1568 <p>b</p>
1569 !! end
1570
1571 !! test
1572 Block tag on one line (<blockquote>)
1573 !! wikitext
1574 a <blockquote>foo</blockquote>
1575
1576 b
1577 !! html
1578 a <blockquote>foo</blockquote>
1579 <p>b
1580 </p>
1581 !! html+tidy
1582 <p>a</p>
1583 <blockquote>
1584 <p>foo</p>
1585 </blockquote>
1586 <p>b</p>
1587 !! end
1588
1589 !! test
1590 Block tag on both lines (<div>)
1591 !! wikitext
1592 a <div>foo</div>
1593
1594 b <div>foo</div>
1595 !! html
1596 a <div>foo</div>
1597 b <div>foo</div>
1598
1599 !! html+tidy
1600 <p>a</p>
1601 <div>foo</div>
1602 <p>b</p>
1603 <div>foo</div>
1604 !! end
1605
1606 !! test
1607 Block tag on both lines (<blockquote>)
1608 !! wikitext
1609 a <blockquote>foo</blockquote>
1610
1611 b <blockquote>foo</blockquote>
1612 !! html
1613 a <blockquote>foo</blockquote>
1614 b <blockquote>foo</blockquote>
1615
1616 !! html+tidy
1617 <p>a</p>
1618 <blockquote>
1619 <p>foo</p>
1620 </blockquote>
1621 <p>b</p>
1622 <blockquote>
1623 <p>foo</p>
1624 </blockquote>
1625 !! end
1626
1627 !! test
1628 Multiple lines without block tags
1629 !! wikitext
1630 <div>foo</div> a
1631 b
1632 c
1633 d<!--foo--> e
1634 x <div>foo</div> z
1635 !! html
1636 <div>foo</div> a
1637 <p>b
1638 c
1639 d e
1640 </p>
1641 x <div>foo</div> z
1642
1643 !! html+tidy
1644 <div>foo</div>
1645 <p>a</p>
1646 <p>b c d e</p>
1647 <p>x</p>
1648 <div>foo</div>
1649 <p>z</p>
1650 !! end
1651
1652 !! test
1653 Empty lines between lines with block tags
1654 !! wikitext
1655 <div></div>
1656
1657
1658 <div></div>a
1659
1660 b
1661 <div>a</div>b
1662
1663 <div>b</div>d
1664
1665
1666 <div>e</div>
1667 !! html
1668 <div></div>
1669 <p><br />
1670 </p>
1671 <div></div>a
1672 <p>b
1673 </p>
1674 <div>a</div>b
1675 <div>b</div>d
1676 <p><br />
1677 </p>
1678 <div>e</div>
1679
1680 !! html+tidy
1681 <p><br /></p>
1682 <p>a</p>
1683 <p>b</p>
1684 <div>a</div>
1685 <p>b</p>
1686 <div>b</div>
1687 <p>d</p>
1688 <p><br /></p>
1689 <div>e</div>
1690 !! end
1691
1692 ## PHP parser emits output which is broken
1693 ## XXX The parsoid output doesn't match the tidy output.
1694 !! test
1695 Unclosed HTML p-tags should be handled properly
1696 !! wikitext
1697 <div><p>foo</div>
1698 a
1699
1700 b
1701 !! html/php+tidy
1702 <div>
1703 <p>foo&lt;/div&gt;</p>
1704 <p>a</p>
1705 b</div>
1706 !! html/parsoid
1707 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1708 <p>a</p>
1709 <p>b</p>
1710 !! end
1711
1712 ###
1713 ### Preformatted text
1714 ###
1715 !! test
1716 Preformatted text
1717 !! wikitext
1718 This is some
1719 Preformatted text
1720 With ''italic''
1721 And '''bold'''
1722 And a [[Main Page|link]]
1723 !! html
1724 <pre>This is some
1725 Preformatted text
1726 With <i>italic</i>
1727 And <b>bold</b>
1728 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1729 </pre>
1730 !! end
1731
1732 !! test
1733 Tabs don't trigger preformatted text
1734 !! wikitext
1735 This is not
1736 preformatted text.
1737 This is preformatted text.
1738 So is this.
1739 !! html
1740 <p> This is not
1741 preformatted text.
1742 </p>
1743 <pre>This is preformatted text.
1744 So is this.
1745 </pre>
1746 !! end
1747
1748 !! test
1749 Ident preformatting with inline content
1750 !! wikitext
1751 a
1752 ''b''
1753 !! html
1754 <pre>a
1755 <i>b</i>
1756 </pre>
1757 !! end
1758
1759 !! test
1760 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1761 !! wikitext
1762 <pre><nowiki>
1763 <b>
1764 <cite>
1765 <em>
1766 </nowiki></pre>
1767 !! html
1768 <pre>
1769 &lt;b&gt;
1770 &lt;cite&gt;
1771 &lt;em&gt;
1772 </pre>
1773
1774 !! end
1775
1776 !! test
1777 Regression with preformatted in <center>
1778 !! wikitext
1779 <center>
1780 Blah
1781 </center>
1782 !! html
1783 <center>
1784 <pre>Blah
1785 </pre>
1786 </center>
1787
1788 !! end
1789
1790 !! test
1791 Bug 52763: Preformatted in <blockquote>
1792 !! wikitext
1793 <blockquote>
1794 Blah
1795 {|
1796 |
1797 indented cell (no pre-wrapping!)
1798 |}
1799 </blockquote>
1800 !! html
1801 <blockquote>
1802 <p> Blah
1803 </p>
1804 <table>
1805 <tr>
1806 <td>
1807 <p> indented cell (no pre-wrapping!)
1808 </p>
1809 </td></tr></table>
1810 </blockquote>
1811
1812 !! end
1813
1814 !! test
1815 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1816 !! wikitext
1817 <blockquote>
1818 Foo
1819
1820 Bar
1821 </blockquote>
1822 !! html
1823 <blockquote>
1824 <p>Foo
1825 </p><p>Bar
1826 </p>
1827 </blockquote>
1828
1829 !! end
1830
1831 !! test
1832 Bug 15491: <ins>/<del> in blockquote
1833 !! wikitext
1834 <blockquote>
1835 Foo <del>bar</del> <ins>baz</ins> quux
1836 </blockquote>
1837 !! html
1838 <blockquote>
1839 <p>Foo <del>bar</del> <ins>baz</ins> quux
1840 </p>
1841 </blockquote>
1842
1843 !! end
1844
1845 # Note that the p-wrapping is newline sensitive, which could be
1846 # considered a bug: tidy will wrap only the 'Foo' in the example
1847 # below in a <p> tag. (see comment 23-25 of bug #6200)
1848 !! test
1849 Bug 15491: <ins>/<del> in blockquote (2)
1850 !! wikitext
1851 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1852 </blockquote>
1853 !! html
1854 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1855 </blockquote>
1856
1857 !! html+tidy
1858 <blockquote>
1859 <p>Foo</p>
1860 <del>bar</del> <ins>baz</ins> quux</blockquote>
1861 !! end
1862
1863 !! test
1864 <pre> with attributes (bug 3202)
1865 !! wikitext
1866 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1867 !! html
1868 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1869
1870 !! end
1871
1872 !! test
1873 <pre> with width attribute (bug 3202)
1874 !! wikitext
1875 <pre width="8">Narrow screen goodies</pre>
1876 !! html
1877 <pre width="8">Narrow screen goodies</pre>
1878
1879 !! end
1880
1881 !! test
1882 <pre> with forbidden attribute (bug 3202)
1883 !! wikitext
1884 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1885 !! html
1886 <pre width="8">Narrow screen goodies</pre>
1887
1888 !! end
1889
1890 !! test
1891 Entities inside <pre>
1892 !! wikitext
1893 <pre>&lt;</pre>
1894 !! html
1895 <pre>&lt;</pre>
1896
1897 !! end
1898
1899 !! test
1900 <pre> with forbidden attribute values (bug 3202)
1901 !! wikitext
1902 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1903 !! html
1904 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1905
1906 !! end
1907
1908 !! test
1909 <nowiki> inside <pre> (bug 13238)
1910 !! wikitext
1911 <pre>
1912 <nowiki>
1913 </pre>
1914 <pre>
1915 <nowiki></nowiki>
1916 </pre>
1917 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1918 !! html
1919 <pre>
1920 &lt;nowiki&gt;
1921 </pre>
1922 <pre>
1923
1924 </pre>
1925 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1926
1927 !! end
1928
1929 !! test
1930 <nowiki> and <pre> preference (first one wins)
1931 !! wikitext
1932 <pre>
1933 <nowiki>
1934 </pre>
1935 </nowiki>
1936 </pre>
1937
1938 <nowiki>
1939 <pre>
1940 <nowiki>
1941 </pre>
1942 </nowiki>
1943 </pre>
1944
1945 !! html
1946 <pre>
1947 &lt;nowiki&gt;
1948 </pre>
1949 <p>&lt;/nowiki&gt;
1950 &lt;/pre&gt;
1951 </p><p>
1952 &lt;pre&gt;
1953 &lt;nowiki&gt;
1954 &lt;/pre&gt;
1955
1956 &lt;/pre&gt;
1957 </p>
1958 !! end
1959
1960 !! test
1961 </pre> inside nowiki
1962 !! wikitext
1963 <nowiki></pre></nowiki>
1964 !! html
1965 <p>&lt;/pre&gt;
1966 </p>
1967 !! end
1968
1969 !! test
1970 Empty pre; pre inside other HTML tags (bug 54946)
1971 !! wikitext
1972 a
1973
1974 <div><pre>
1975 foo
1976 </pre></div>
1977 <pre></pre>
1978 !! html
1979 <p>a
1980 </p>
1981 <div><pre>
1982 foo
1983 </pre></div>
1984 <pre></pre>
1985
1986 !! html+tidy
1987 <p>a</p>
1988 <div>
1989 <pre>
1990 foo
1991 </pre></div>
1992 !! end
1993
1994 !! test
1995 HTML pre followed by indent-pre
1996 !! wikitext
1997 <pre>foo</pre>
1998 bar
1999 !! html
2000 <pre>foo</pre>
2001 <pre>bar
2002 </pre>
2003 !! end
2004
2005 !!test
2006 Block tag pre
2007 !!options
2008 parsoid
2009 !! wikitext
2010 <p><pre>foo</pre></p>
2011 !! html
2012 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2013 !!end
2014
2015 !!test
2016 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2017 !! wikitext
2018 {{echo|}}
2019 !! html
2020
2021 !!end
2022
2023 !!test
2024 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2025 !! wikitext
2026 {{echo|
2027 foo}}
2028 !! html
2029 <p>foo
2030 </p>
2031 !!end
2032
2033 !! test
2034 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2035 !! wikitext
2036 {{echo|a
2037 b}}
2038 !! html
2039 <pre>a
2040 </pre>
2041 <p>b
2042 </p>
2043 !!end
2044
2045 !! test
2046 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2047 !! wikitext
2048 {{echo|a
2049 b
2050 c
2051 d
2052 e
2053 }}
2054 !! html
2055 <pre>a
2056 </pre>
2057 <p>b
2058 c
2059 </p>
2060 <pre>d
2061 </pre>
2062 <p>e
2063 </p>
2064 !!end
2065
2066 !!test
2067 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2068 !! wikitext
2069 {{echo| foo}}
2070
2071 {{echo| foo}}{{echo| bar}}
2072
2073 {{echo| foo}}
2074 {{echo| bar}}
2075
2076 {{echo|<!--cmt--> foo}}
2077
2078 <!--cmt-->{{echo| foo}}
2079
2080 {{echo|{{echo| }}bar}}
2081 !! html
2082 <pre>foo
2083 </pre>
2084 <pre>foo bar
2085 </pre>
2086 <pre>foo
2087 bar
2088 </pre>
2089 <pre>foo
2090 </pre>
2091 <pre>foo
2092 </pre>
2093 <pre>bar
2094 </pre>
2095 !!end
2096
2097 !! test
2098 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2099 !! wikitext
2100 {{echo| }}a
2101
2102 {{echo|
2103 }}a
2104
2105 {{echo|
2106 b}}
2107
2108 {{echo|a
2109 }}b
2110
2111 {{echo|a
2112 }} b
2113 !! html
2114 <pre>a
2115 </pre>
2116 <p><br />
2117 </p>
2118 <pre>a
2119 </pre>
2120 <p><br />
2121 </p>
2122 <pre>b
2123 </pre>
2124 <p>a
2125 </p>
2126 <pre>b
2127 </pre>
2128 <p>a
2129 </p>
2130 <pre>b
2131 </pre>
2132 !!end
2133
2134 !! test
2135 Things that look like <pre> tags aren't treated as such
2136 !! wikitext
2137 Barack Obama <President> of the United States
2138 <President></President>
2139 !! html
2140 <p>Barack Obama &lt;President&gt; of the United States
2141 &lt;President&gt;&lt;/President&gt;
2142 </p>
2143 !! end
2144
2145 ## PHP parser discards the "<pre " string
2146 !! test
2147 Handle broken pre-like tags (bug 64025)
2148 !! options
2149 parsoid=wt2html
2150 !! wikitext
2151 {{echo|<pre <pre>x</pre>}}
2152
2153 <table><pre </table>
2154 !! html/php
2155 <pre>x</pre>
2156 <table><pre></pre></table>
2157
2158 !! html/parsoid
2159 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
2160 <pre>x</pre>
2161
2162 <span>&lt;pre </span>
2163 <table></table>
2164 !! end
2165
2166 !! test
2167 Parsoid: handle pre with space after attribute
2168 !! options
2169 parsoid=wt2html
2170 !! wikitext
2171 <pre style="width:50%;" >{{echo|foo}}</pre>
2172 !! html
2173 <pre style="width:50%;">{{echo|foo}}</pre>
2174 !! end
2175
2176 # TODO / maybe: fix wt2wt for this
2177 !! test
2178 Parsoid: Don't paragraph-wrap fosterable content
2179 !! options
2180 parsoid=wt2html
2181 !! wikitext
2182 {|
2183 <td></td>
2184 <td></td>
2185
2186
2187
2188 |}
2189 !! html
2190 <table>
2191
2192 <tbody>
2193 <tr>
2194 <td></td>
2195
2196 <td></td></tr>
2197
2198
2199
2200 </tbody></table>
2201 !! end
2202
2203 !! test
2204 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2205 !! options
2206 parsoid=wt2html
2207 !! wikitext
2208 {|
2209 <td>
2210 <td>
2211 </td>
2212
2213
2214
2215 |}
2216 !! html
2217 <table>
2218
2219 <tbody>
2220 <tr>
2221 <td></td>
2222
2223 <td>
2224 </td></tr>
2225
2226
2227
2228 </tbody></table>
2229 !! end
2230
2231
2232 #--------------------------------------------------------------------
2233 # Transclusion parameter whitespace stripping tests
2234 # Behavior is different for positional and named parameters
2235 #--------------------------------------------------------------------
2236 !! test
2237 Templates: Strip leading and trailing whitespace from named-param values
2238 !! wikitext
2239 {{echo|1= a }}
2240
2241 {{echo|1= {{echo|b}} }}
2242
2243 {{echo| 1 =
2244 c }}
2245
2246 {{echo| 1 =
2247 * d
2248 }}
2249 !! html
2250 <p>a
2251 </p><p>b
2252 </p><p>c
2253 </p>
2254 <ul><li> d</li></ul>
2255
2256 !! end
2257
2258 !! test
2259 Templates: Don't strip whitespace from positional-param values
2260 !! wikitext
2261 {{echo|a }}
2262
2263 {{echo|{{echo|b}} }}
2264
2265 {{echo| c
2266 }}
2267
2268 {{echo| {{echo|d}}
2269 }}
2270
2271 {{echo|
2272 e}}
2273
2274 {{echo|
2275 * f}}
2276
2277 {{echo|
2278 }}g
2279 !! html
2280 <p>a
2281 </p><p>b
2282 </p>
2283 <pre>c
2284 </pre>
2285 <p><br />
2286 </p>
2287 <pre>d
2288 </pre>
2289 <p><br />
2290 </p>
2291 <pre>e
2292 </pre>
2293 <p><br />
2294 </p>
2295 <ul><li> f</li></ul>
2296 <p><br />
2297 </p>
2298 <pre>g
2299 </pre>
2300 !! end
2301
2302 !! test
2303 Templates: Handle empty comment-and-ws-only lines correctly
2304 !! wikitext
2305 {{echo|foo
2306 <!--should be ignored-->
2307 <!--should be ignored as well-->
2308 bar}}
2309 !! html
2310 <p>foo
2311 bar
2312 </p>
2313 !! end
2314
2315 !! test
2316 Templates: Handle comments in the target
2317 !! wikitext
2318 {{echo
2319 <!-- should be ignored -->
2320 |foo}}
2321
2322 {{echo<!-- should be ignored -->
2323 |foo}}
2324
2325 {{echo<!-- should be ignored -->|foo}}
2326
2327 {{<!-- should be ignored -->echo|foo}}
2328 !!html/parsoid
2329 <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>
2330
2331 <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>
2332
2333 <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>
2334
2335 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2336 !!end
2337
2338 #--------------------------------------------------------------------
2339 # Transclusion parameter escaping tests
2340 #--------------------------------------------------------------------
2341 !! test
2342 Templates: Parsoid parameter escaping test 1
2343 !! options
2344 parsoid
2345 !! wikitext
2346 {{echo|[foo]|{{echo|[bar]}}}}
2347 !! html
2348 <p about="#mwt1" typeof="mw:Transclusion"
2349 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2350 !! end
2351
2352 !! test
2353 Parsoid: Pipes in external links in template parameter
2354 !! options
2355 parsoid
2356 !! wikitext
2357 {{echo|[{{echo|http://example.com}} link]}}
2358 !! html
2359 <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>
2360 !! end
2361
2362 !! test
2363 Parsoid: pipe in transclusion parameter
2364 !! options
2365 parsoid
2366 !! wikitext
2367 {{echo|http://foo.com/a&#124;b}}
2368 !! html
2369 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2370 typeof="mw:Transclusion"
2371 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>
2372 !! end
2373
2374 !! test
2375 Parsoid: Pipe in external link target and content in template parameter
2376 !! options
2377 parsoid=html2wt,wt2wt
2378 !! wikitext
2379 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2380 !! html
2381 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2382 typeof="mw:Transclusion"
2383 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2384 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2385 !! end
2386
2387 !! test
2388 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2389 !! options
2390 parsoid
2391 !! wikitext
2392 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2393 !! html
2394 <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>
2395 !! end
2396
2397 !! test
2398 Templates: Don't escape already nowiki-escaped text in template parameters
2399 !! options
2400 parsoid=html2wt,wt2wt
2401 !! wikitext
2402 {{echo|foo<nowiki>|</nowiki>bar}}
2403 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2404 {{echo|<nowiki></nowiki>}}
2405 !! html
2406 <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>
2407 <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>
2408 <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>
2409 </p>
2410 !! end
2411
2412 ## Bug 52824
2413 !! test
2414 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2415 !! options
2416 parsoid=html2wt,wt2wt
2417 !! wikitext
2418 {{echo|{{echo|1=bar}}}}
2419 !! html
2420 <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>
2421 !! end
2422
2423 ## Bug 56733
2424 !! test
2425 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2426 !! options
2427 parsoid
2428 !! wikitext
2429 {{echo|a : b}}
2430 !! html
2431 <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>
2432 !! end
2433
2434 ###
2435 ### Parsoid-centric tests for testing RT edge cases for pre
2436 ###
2437
2438 !!test
2439 1a. Indent-Pre and Comments
2440 !! wikitext
2441 a
2442 <!--a-->
2443 c
2444 !! html
2445 <pre>a
2446 </pre>
2447 <p>c
2448 </p>
2449 !!end
2450
2451 !!test
2452 1b. Indent-Pre and Comments
2453 !! wikitext
2454 a
2455 <!--a-->
2456 c
2457 !! html
2458 <pre>a
2459 </pre>
2460 <p>c
2461 </p>
2462 !!end
2463
2464 !!test
2465 1c. Indent-Pre and Comments
2466 !! wikitext
2467 <!--a--> a
2468
2469 <!--a--> a
2470 !! html
2471 <pre> a
2472 </pre>
2473 <pre> a
2474 </pre>
2475 !!end
2476
2477 !!test
2478 1d. Indent-Pre and Comments
2479 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2480 !! wikitext
2481 <!--a--> a
2482
2483 <!--b-->b
2484 !! html
2485 <pre>a
2486 </pre>
2487 <pre>b
2488 </pre>
2489 !!end
2490
2491 !!test
2492 2a. Indent-Pre and tables
2493 !! wikitext
2494 {|
2495 |-
2496 !h1!!h2
2497 |foo||bar
2498 |}
2499 !! html
2500 <table>
2501
2502 <tr>
2503 <th>h1</th>
2504 <th>h2
2505 </th>
2506 <td>foo</td>
2507 <td>bar
2508 </td></tr></table>
2509
2510 !!end
2511
2512 !!test
2513 2b. Indent-Pre and tables
2514 !! wikitext
2515 {|
2516 |-
2517 |foo
2518 |}
2519 !! html
2520 <table>
2521
2522 <tr>
2523 <td>foo
2524 </td></tr></table>
2525
2526 !!end
2527
2528 !!test
2529 2c. Indent-Pre and tables (bug 42252)
2530 !! wikitext
2531 {|
2532 |+ foo
2533 ! | bar
2534 |}
2535 !! html
2536 <table>
2537 <caption> foo
2538 </caption>
2539 <tr>
2540 <th> bar
2541 </th></tr></table>
2542
2543 !!end
2544
2545 !!test
2546 2d. Indent-Pre and tables
2547 !! wikitext
2548 a
2549 {|
2550 | b
2551 |}
2552 !! html/php
2553 <pre>a
2554 </pre>
2555 <table>
2556 <tr>
2557 <td> b
2558 </td></tr></table>
2559
2560 !! html/parsoid
2561 <pre>a</pre>
2562
2563 <table>
2564
2565 <tbody>
2566 <tr>
2567 <td> b</td></tr>
2568 </tbody></table>
2569 !!end
2570
2571 !!test
2572 2e. Indent-Pre and table-line syntax
2573 !! wikitext
2574 a
2575 | b
2576 | c
2577 !! html/php
2578 <pre>a
2579 | b
2580 | c
2581 </pre>
2582 !!end
2583
2584 !!test
2585 2f. Indent-pre started by table-line syntax
2586 !! wikitext
2587 a
2588 | b
2589 | c
2590 !! html/php
2591 <p>a
2592 </p>
2593 <pre>| b
2594 | c
2595 </pre>
2596 !! html/parsoid
2597 <p>a</p>
2598 <pre>
2599 | b
2600 | c</pre>
2601 !!end
2602
2603 !!test
2604 3a. Indent-Pre and block tags (single-line html)
2605 !! wikitext
2606 a <p> foo </p>
2607 b <div> foo </div>
2608 c <blockquote> foo </blockquote>
2609 <span> foo </span>
2610 !! html
2611 a <p> foo </p>
2612 b <div> foo </div>
2613 c <blockquote> foo </blockquote>
2614 <pre><span> foo </span>
2615 </pre>
2616 !! html+tidy
2617 <p>a</p>
2618 <p>foo</p>
2619 <p>b</p>
2620 <div>foo</div>
2621 <p>c</p>
2622 <blockquote>
2623 <p>foo</p>
2624 </blockquote>
2625 <pre>
2626 <span> foo </span>
2627 </pre>
2628 !! end
2629
2630 !!test
2631 3b. Indent-Pre and block tags (multi-line html)
2632 !! wikitext
2633 a <span>foo</span>
2634 b <div> foo </div>
2635 !! html
2636 <pre>a <span>foo</span>
2637 </pre>
2638 b <div> foo </div>
2639
2640 !! html+tidy
2641 <pre>
2642 a <span>foo</span>
2643 </pre>
2644 <p>b</p>
2645 <div>foo</div>
2646 !!end
2647
2648 !!test
2649 3c. Indent-Pre and block tags (pre-content on separate line)
2650 !! wikitext
2651 <p>
2652 foo
2653 </p>
2654
2655 <div>
2656 foo
2657 </div>
2658
2659 <center>
2660 foo
2661 </center>
2662
2663 <blockquote>
2664 foo
2665 </blockquote>
2666
2667 <blockquote>
2668 <pre>
2669 foo
2670 </pre>
2671 </blockquote>
2672
2673 <table><tr><td>
2674 foo
2675 </td></tr></table>
2676
2677 <ul><li>
2678 foo
2679 </li></ul>
2680
2681 !! html
2682 <p>
2683 foo
2684 </p>
2685 <div>
2686 <pre>foo
2687 </pre>
2688 </div>
2689 <center>
2690 <pre>foo
2691 </pre>
2692 </center>
2693 <blockquote>
2694 <p> foo
2695 </p>
2696 </blockquote>
2697 <blockquote>
2698 <pre>
2699 foo
2700 </pre>
2701 </blockquote>
2702 <table><tr><td>
2703 <pre>foo
2704 </pre>
2705 </td></tr></table>
2706 <ul><li>
2707 foo
2708 </li></ul>
2709
2710 !!end
2711
2712 !!test
2713 4. Indent-Pre and extension tags
2714 !! wikitext
2715 a <gallery>
2716 File:foobar.jpg
2717 </gallery>
2718 !! html
2719 a <ul class="gallery mw-gallery-traditional">
2720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2721 <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>
2722 <div class="gallerytext">
2723 </div>
2724 </div></li>
2725 </ul>
2726
2727 !! html+tidy
2728 <p>a</p>
2729 <ul class="gallery mw-gallery-traditional">
2730 <li class="gallerybox" style="width: 155px">
2731 <div style="width: 155px">
2732 <div class="thumb" style="width: 150px;">
2733 <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>
2734 </div>
2735 <div class="gallerytext"></div>
2736 </div>
2737 </li>
2738 </ul>
2739 !!end
2740
2741 !! test
2742 Table wikitext syntax outside wiki-tables
2743 !! wikitext
2744 a
2745 ! not a table heading
2746 |- not a table row
2747 | not a table cell
2748 | class="foo bar" | baz
2749 b
2750 |}
2751 |-
2752 c
2753 !! html
2754 <p>a
2755 ! not a table heading
2756 |- not a table row
2757 | not a table cell
2758 | class="foo bar" | baz
2759 b
2760 |}
2761 |-
2762 c
2763 </p>
2764 !! end
2765
2766 !!test
2767 Render paragraphs when indent-pre is suppressed in blocklevels
2768 !! wikitext
2769 <blockquote>
2770 foo
2771
2772 bar
2773 </blockquote>
2774 !! html
2775 <blockquote>
2776 <p> foo
2777 </p><p> bar
2778 </p>
2779 </blockquote>
2780
2781 !!end
2782
2783 !!test
2784 4. Multiple spaces at start-of-line
2785 !! wikitext
2786 <p> foo </p>
2787 foo
2788 {|
2789 |foo
2790 |}
2791 !! html
2792 <p> foo </p>
2793 <pre> foo
2794 </pre>
2795 <table>
2796 <tr>
2797 <td>foo
2798 </td></tr></table>
2799
2800 !!end
2801
2802 ## NOTE: the leading white-space chars on empty line are significant
2803 !! test
2804 5a. White-space in indent-pre
2805 !! wikitext
2806 a<br />
2807
2808 b
2809 !! html
2810 <pre>a<br />
2811
2812 b
2813 </pre>
2814 !! end
2815
2816 ## NOTE: the leading white-space chars on empty line are significant
2817 !! test
2818 5b. White-space in indent-pre
2819 !! wikitext
2820 a
2821
2822 b
2823
2824
2825 c
2826 !! html
2827 <pre>a
2828
2829 b
2830
2831
2832 c
2833 </pre>
2834 !! end
2835
2836 !! test
2837 5c. White-space in indent-pre
2838 !! wikitext
2839 ''a''
2840 ''b''
2841 ''c''
2842 !! html
2843 <pre><i>a</i>
2844 <i>b</i>
2845 <i>c</i>
2846 </pre>
2847 !! end
2848
2849 !! test
2850 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2851 !! wikitext
2852 a
2853
2854 <!-- continue -->
2855 b
2856
2857 c
2858
2859 d
2860 !! html
2861 <pre>a
2862
2863 b
2864 </pre>
2865 <pre>c
2866
2867 </pre>
2868 <p>d
2869 </p>
2870 !! end
2871
2872 !! test
2873 7a. Indent-pre and category links
2874 !! options
2875 parsoid=wt2html,wt2wt
2876 !! wikitext
2877 [[Category:foo]] <!-- No pre-wrapping -->
2878 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2879 !! html
2880 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2881 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2882 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2883 !! end
2884
2885 !! test
2886 7b. Indent-pre and category links
2887 !! options
2888 parsoid=wt2html,wt2wt
2889 !! wikitext
2890 [[Category:foo]] a
2891 [[Category:foo]] {{echo|b}}
2892 !! html
2893 <pre>
2894 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2895
2896 <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>
2897 !! end
2898
2899 ###
2900 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2901 ###
2902
2903 !!test
2904 HTML-pre: 1. embedded newlines
2905 !! wikitext
2906 <pre>foo</pre>
2907
2908 <pre>
2909 foo
2910 </pre>
2911
2912 <pre>
2913
2914 foo
2915 </pre>
2916
2917 <pre>
2918
2919
2920 foo
2921 </pre>
2922 !! html
2923 <pre>foo</pre>
2924 <pre>
2925 foo
2926 </pre>
2927 <pre>
2928
2929 foo
2930 </pre>
2931 <pre>
2932
2933
2934 foo
2935 </pre>
2936
2937 !! html/parsoid
2938 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2939
2940 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2941 foo
2942 </pre>
2943
2944 <pre data-parsoid='{"stx":"html"}'>
2945
2946 foo
2947 </pre>
2948
2949 <pre data-parsoid='{"stx":"html"}'>
2950
2951
2952 foo
2953 </pre>
2954 !!end
2955
2956 !! test
2957 HTML-pre: big spaces
2958 !! wikitext
2959 <pre>
2960
2961
2962
2963
2964 haha
2965
2966
2967
2968
2969 haha
2970
2971
2972
2973
2974 </pre>
2975 !! html
2976 <pre>
2977
2978
2979
2980
2981 haha
2982
2983
2984
2985
2986 haha
2987
2988
2989
2990
2991 </pre>
2992
2993 !! html/parsoid
2994 <pre data-parsoid='{"stx":"html"}'>
2995
2996
2997
2998
2999 haha
3000
3001
3002
3003
3004 haha
3005
3006
3007
3008
3009 </pre>
3010 !! end
3011
3012 !!test
3013 HTML-pre: 2: indented text
3014 !! wikitext
3015 <pre>
3016 foo
3017 </pre>
3018 !! html
3019 <pre>
3020 foo
3021 </pre>
3022
3023 !!end
3024
3025 !!test
3026 HTML-pre: 3: other wikitext
3027 !! wikitext
3028 <pre>
3029 * foo
3030 # bar
3031 = no-h =
3032 '' no-italic ''
3033 [[ NoLink ]]
3034 </pre>
3035 !! html
3036 <pre>
3037 * foo
3038 # bar
3039 = no-h =
3040 '' no-italic ''
3041 [[ NoLink ]]
3042 </pre>
3043
3044 !!end
3045
3046 ###
3047 ### Definition lists
3048 ###
3049 !! test
3050 Simple definition
3051 !! wikitext
3052 ; name : Definition
3053 !! html
3054 <dl><dt> name&#160;</dt>
3055 <dd> Definition</dd></dl>
3056
3057 !! end
3058
3059 !! test
3060 Definition list for indentation only
3061 !! wikitext
3062 : Indented text
3063 !! html
3064 <dl><dd> Indented text</dd></dl>
3065
3066 !! end
3067
3068 !! test
3069 Definition list with no space
3070 !! wikitext
3071 ;name:Definition
3072 !! html
3073 <dl><dt>name</dt>
3074 <dd>Definition</dd></dl>
3075
3076 !!end
3077
3078 !! test
3079 Definition list with URL link
3080 !! wikitext
3081 ; http://example.com/ : definition
3082 !! html
3083 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3084 <dd> definition</dd></dl>
3085
3086 !! end
3087
3088 !! test
3089 Definition list with bracketed URL link
3090 !! wikitext
3091 ;[http://www.example.com/ Example]:Something about it
3092 !! html
3093 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3094 <dd>Something about it</dd></dl>
3095
3096 !! end
3097
3098 !! test
3099 Definition list with wikilink containing colon
3100 !! wikitext
3101 ; [[Help:FAQ]]: The least-read page on Wikipedia
3102 !! html
3103 <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>
3104 <dd> The least-read page on Wikipedia</dd></dl>
3105
3106 !! end
3107
3108 # At Brion's and JeLuF's insistence... :)
3109 !! test
3110 Definition list with news link containing colon
3111 !! wikitext
3112 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3113 !! html
3114 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3115 <dd> This isn't even a real newsgroup!</dd></dl>
3116
3117 !! end
3118
3119 !! test
3120 Malformed definition list with colon
3121 !! wikitext
3122 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3123 !! html
3124 <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>
3125
3126 !! end
3127
3128 !! test
3129 Definition lists: colon in external link text
3130 !! wikitext
3131 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3132 !! html
3133 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3134 <dd> OK, I made that up</dd></dl>
3135
3136 !! end
3137
3138 !! test
3139 Definition lists: colon in HTML attribute
3140 !! wikitext
3141 ;<b style="display: inline">bold</b>
3142 !! html
3143 <dl><dt><b style="display: inline">bold</b></dt></dl>
3144
3145 !! end
3146
3147 !! test
3148 Definition lists: self-closed tag
3149 !! wikitext
3150 ;one<br/>two : two-line fun
3151 !! html
3152 <dl><dt>one<br />two&#160;</dt>
3153 <dd> two-line fun</dd></dl>
3154
3155 !! end
3156
3157 !! test
3158 Bug 11748: Literal closing tags
3159 !! wikitext
3160 <dl>
3161 <dt>test 1</dt>
3162 <dd>test test test test test</dd>
3163 <dt>test 2</dt>
3164 <dd>test test test test test</dd>
3165 </dl>
3166 !! html
3167 <dl>
3168 <dt>test 1</dt>
3169 <dd>test test test test test</dd>
3170 <dt>test 2</dt>
3171 <dd>test test test test test</dd>
3172 </dl>
3173
3174 !! end
3175
3176 !! test
3177 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3178 !! wikitext
3179 <ul><li>
3180 ; term : description
3181 * unordered
3182 </li></ul>
3183 !! html
3184 <ul><li>
3185 <dl><dt> term&#160;</dt>
3186 <dd> description</dd></dl>
3187 <ul><li> unordered</li></ul>
3188 </li></ul>
3189
3190 !! end
3191
3192 !! test
3193
3194 Definition list with empty definition and following paragraph
3195 !! wikitext
3196 ; term:
3197 Paragraph text
3198 !! html
3199 <dl><dt> term</dt>
3200 <dd></dd></dl>
3201 <p>Paragraph text
3202 </p>
3203 !! end
3204
3205 !! test
3206 Nested definition lists using html syntax
3207 !! wikitext
3208 <dl><dt>x</dt>
3209 <dd>a</dd>
3210 <dd>b</dd></dl>
3211
3212 !! end
3213
3214 !! test
3215 Definition Lists: No nesting: Multiple dd's
3216 !! wikitext
3217 ;x
3218 :a
3219 :b
3220 !! html
3221 <dl><dt>x</dt>
3222 <dd>a</dd>
3223 <dd>b</dd></dl>
3224
3225 !! end
3226
3227 !! test
3228 Definition Lists: Indentation: Regular
3229 !! wikitext
3230 :i1
3231 ::i2
3232 :::i3
3233 !! html
3234 <dl><dd>i1
3235 <dl><dd>i2
3236 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3237
3238 !! end
3239
3240 !! test
3241 Definition Lists: Indentation: Missing 1st level
3242 !! wikitext
3243 ::i2
3244 :::i3
3245 !! html
3246 <dl><dd><dl><dd>i2
3247 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3248
3249 !! end
3250
3251 !! test
3252 Definition Lists: Indentation: Multi-level indent
3253 !! wikitext
3254 :::i3
3255 !! html
3256 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3257
3258 !! end
3259
3260 !! test
3261 Definition Lists: Hacky use to indent tables
3262 !! wikitext
3263 ::{|
3264 |foo
3265 |bar
3266 |}
3267 this text
3268 should be left alone
3269 !! html
3270 <dl><dd><dl><dd><table>
3271 <tr>
3272 <td>foo
3273 </td>
3274 <td>bar
3275 </td></tr></table></dd></dl></dd></dl>
3276 <p>this text
3277 should be left alone
3278 </p>
3279 !! end
3280
3281 !! test
3282 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3283 !! wikitext
3284 <!-- foo -->
3285 ::{|
3286 |foo
3287 |bar
3288 |}<!-- bar -->
3289 this text
3290 should be left alone
3291 !! html/parsoid
3292 <!-- foo -->
3293 <dl><dd><dl><dd><table><tr>
3294 <td>foo</td>
3295 <td>bar</td>
3296 </tr></table><!-- bar --></dd></dl></dd></dl>
3297 <p>this text
3298 should be left alone</p>
3299 !! end
3300
3301 !! test
3302 Definition Lists: Hacky use to indent tables, with comment before table
3303 !! wikitext
3304 ::<!-- foo -->{|
3305 |foo
3306 |}
3307 !! html/parsoid
3308 <dl><dd><dl><dd><!-- foo --><table><tr>
3309 <td>foo</td>
3310 </tr></table></dd></dl></dd></dl>
3311 !! end
3312
3313 # Bug 52473
3314 !! test
3315 Definition Lists: Hacky use to indent tables (WS-insensitive)
3316 !! options
3317 parsoid
3318 !! wikitext
3319 : {|
3320 |a
3321 |}
3322 !! html
3323 <dl>
3324 <dd> <table><tr><td>a</td></tr></table> </dd>
3325 </dl>
3326 !! end
3327 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3328 ## as an empty dt item. It also ignores all but the last ";" when followed
3329 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3330 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3331 ## ";"s.
3332 ##
3333 ## Ex: ";;t2 ::d2" is transformed into:
3334 ##
3335 ## <dl>
3336 ## <dt>t2 </dt>
3337 ## <dd>
3338 ## <dl>
3339 ## <dt></dt>
3340 ## <dd>d2</dd>
3341 ## </dl>
3342 ## </dd>
3343 ## </dl>
3344 ##
3345 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3346 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3347 ##
3348 ## <dl>
3349 ## <dt>
3350 ## <dl>
3351 ## <dt>t2 </dt>
3352 ## <dd>:d2</dd>
3353 ## </dl>
3354 ## </dt>
3355 ## </dl>
3356 ##
3357 ## All Parsoid only definition list tests have this difference.
3358 ##
3359 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3360 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3361
3362 !! test
3363 Table / list interaction: indented table with lists in table contents
3364 !! wikitext
3365 :{|
3366 |-
3367 | a
3368 * b
3369 |-
3370 | c
3371 * d
3372 |}
3373 !! html
3374 <dl><dd><table>
3375
3376 <tr>
3377 <td> a
3378 <ul><li> b</li></ul>
3379 </td></tr>
3380 <tr>
3381 <td> c
3382 <ul><li> d</li></ul>
3383 </td></tr></table></dd></dl>
3384
3385 !! end
3386
3387 !!test
3388 Table / list interaction: lists nested in tables nested in indented lists
3389 !! wikitext
3390 :{|
3391 |
3392 :a
3393 :b
3394 |
3395 *c
3396 *d
3397 |}
3398
3399 *e
3400 *f
3401 !! html
3402 <dl><dd><table>
3403 <tr>
3404 <td>
3405 <dl><dd>a</dd>
3406 <dd>b</dd></dl>
3407 </td>
3408 <td>
3409 <ul><li>c</li>
3410 <li>d</li></ul>
3411 </td></tr></table></dd></dl>
3412 <ul><li>e</li>
3413 <li>f</li></ul>
3414
3415 !!end
3416
3417 !! test
3418 Definition Lists: Nesting: Multi-level (Parsoid only)
3419 !! options
3420 parsoid
3421 !! wikitext
3422 ;t1 :d1
3423 ;;t2 ::d2
3424 ;;;t3 :::d3
3425 !! html
3426 <dl>
3427 <dt>t1 </dt>
3428 <dd>d1</dd>
3429 <dt>
3430 <dl>
3431 <dt>t2 </dt>
3432 <dd>:d2</dd>
3433 <dt>
3434 <dl>
3435 <dt>t3 </dt>
3436 <dd>::d3</dd>
3437 </dl>
3438 </dt>
3439 </dl>
3440 </dt>
3441 </dl>
3442
3443
3444 !! end
3445
3446
3447 !! test
3448 Definition Lists: Nesting: Test 2 (Parsoid only)
3449 !! options
3450 parsoid
3451 !! wikitext
3452 ;t1
3453 ::d2
3454 !! html
3455 <dl>
3456 <dt>t1</dt>
3457 <dd>
3458 <dl>
3459 <dd>d2</dd>
3460 </dl>
3461 </dd>
3462 </dl>
3463
3464 !! end
3465
3466
3467 !! test
3468 Definition Lists: Nesting: Test 3 (Parsoid only)
3469 !! options
3470 parsoid
3471 !! wikitext
3472 :;t1
3473 ::::d2
3474 !! html
3475 <dl>
3476 <dd>
3477 <dl>
3478 <dt>t1</dt>
3479 <dd>
3480 <dl>
3481 <dd>
3482 <dl>
3483 <dd>d2</dd>
3484 </dl>
3485 </dd>
3486 </dl>
3487 </dd>
3488 </dl>
3489 </dd>
3490 </dl>
3491
3492 !! end
3493
3494
3495 !! test
3496 Definition Lists: Nesting: Test 4
3497 !! wikitext
3498 ::;t3
3499 :::d3
3500 !! html
3501 <dl><dd><dl><dd><dl><dt>t3</dt>
3502 <dd>d3</dd></dl></dd></dl></dd></dl>
3503
3504 !! end
3505
3506
3507 ## The Parsoid team believes the following three test exposes a
3508 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3509 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3510 ## It also exposes a "misfeature" in tidy, which doesn't like
3511 ## <dl> tags with a single <dt> child; it converts the <dt> into
3512 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3513 !! test
3514 Definition Lists: Mixed Lists: Test 1
3515 !! wikitext
3516 :;* foo
3517 ::* bar
3518 :; baz
3519 !! html/php
3520 <dl><dd><dl><dt><ul><li> foo</li>
3521 <li> bar</li></ul></dt></dl>
3522 <dl><dt> baz</dt></dl></dd></dl>
3523
3524 !! html/php+tidy
3525 <dl>
3526 <dd>
3527 <dl>
3528 <dd>
3529 <ul>
3530 <li>foo</li>
3531 <li>bar</li>
3532 </ul>
3533 </dd>
3534 </dl>
3535 <dl>
3536 <dt>baz</dt>
3537 </dl>
3538 </dd>
3539 </dl>
3540 !! html/parsoid
3541 <dl>
3542 <dd><dl>
3543 <dt><ul>
3544 <li> foo
3545 </li>
3546 </ul></dt>
3547 <dd><ul>
3548 <li> bar
3549 </li>
3550 </ul></dd>
3551 <dt> baz</dt>
3552 </dl></dd>
3553 </dl>
3554 !! end
3555
3556 !! test
3557 Definition Lists: Mixed Lists: Test 2
3558 !! wikitext
3559 *: d1
3560 *: d2
3561 !! html
3562 <ul><li><dl><dd> d1</dd>
3563 <dd> d2</dd></dl></li></ul>
3564
3565 !! end
3566
3567
3568 !! test
3569 Definition Lists: Mixed Lists: Test 3
3570 !! wikitext
3571 *::: d1
3572 *::: d2
3573 !! html
3574 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3575 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3576
3577 !! end
3578
3579
3580 !! test
3581 Definition Lists: Mixed Lists: Test 4
3582 !! wikitext
3583 *;d1 :d2
3584 *;d3 :d4
3585 !! html
3586 <ul><li><dl><dt>d1&#160;</dt>
3587 <dd>d2</dd>
3588 <dt>d3&#160;</dt>
3589 <dd>d4</dd></dl></li></ul>
3590
3591 !! end
3592
3593
3594 !! test
3595 Definition Lists: Mixed Lists: Test 5
3596 !! wikitext
3597 *:d1
3598 *:: d2
3599 !! html
3600 <ul><li><dl><dd>d1
3601 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3602
3603 !! end
3604
3605
3606 !! test
3607 Definition Lists: Mixed Lists: Test 6
3608 !! wikitext
3609 #*:d1
3610 #*::: d3
3611 !! html
3612 <ol><li><ul><li><dl><dd>d1
3613 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3614
3615 !! end
3616
3617
3618 !! test
3619 Definition Lists: Mixed Lists: Test 7
3620 !! wikitext
3621 :* d1
3622 :* d2
3623 !! html
3624 <dl><dd><ul><li> d1</li>
3625 <li> d2</li></ul></dd></dl>
3626
3627 !! end
3628
3629
3630 !! test
3631 Definition Lists: Mixed Lists: Test 8
3632 !! wikitext
3633 :* d1
3634 ::* d2
3635 !! html
3636 <dl><dd><ul><li> d1</li></ul>
3637 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3638
3639 !! end
3640
3641
3642 !! test
3643 Definition Lists: Mixed Lists: Test 9
3644 !! wikitext
3645 *;foo :bar
3646 !! html
3647 <ul><li><dl><dt>foo&#160;</dt>
3648 <dd>bar</dd></dl></li></ul>
3649
3650 !! end
3651
3652
3653 !! test
3654 Definition Lists: Mixed Lists: Test 10
3655 !! wikitext
3656 *#;foo :bar
3657 !! html
3658 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3659 <dd>bar</dd></dl></li></ol></li></ul>
3660
3661 !! end
3662
3663 # The Parsoid team disagrees with the PHP parser's seemingly-random
3664 # rules regarding dd/dt on the next two tests. Parsoid is more
3665 # consistent, and recognizes the shared nesting and keeps the
3666 # still-open tags around until the nesting is complete.
3667 # (And tidy again converts <dt> to <dd> before 'bar'.)
3668
3669 !! test
3670 Definition Lists: Mixed Lists: Test 11
3671 !! wikitext
3672 *#*#;*;;foo :bar
3673 *#*#;boo :baz
3674 !! html/php
3675 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3676 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3677 <dl><dt>boo&#160;</dt>
3678 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3679
3680 !! html/php+tidy
3681 <ul>
3682 <li>
3683 <ol>
3684 <li>
3685 <ul>
3686 <li>
3687 <ol>
3688 <li>
3689 <dl>
3690 <dt>foo&#160;</dt>
3691 <dd>
3692 <ul>
3693 <li>
3694 <dl>
3695 <dd>
3696 <dl>
3697 <dt>bar</dt>
3698 </dl>
3699 </dd>
3700 </dl>
3701 </li>
3702 </ul>
3703 </dd>
3704 </dl>
3705 <dl>
3706 <dt>boo&#160;</dt>
3707 <dd>baz</dd>
3708 </dl>
3709 </li>
3710 </ol>
3711 </li>
3712 </ul>
3713 </li>
3714 </ol>
3715 </li>
3716 </ul>
3717 !! html/parsoid
3718 <ul>
3719 <li>
3720 <ol>
3721 <li>
3722 <ul>
3723 <li>
3724 <ol>
3725 <li>
3726 <dl>
3727 <dt>
3728 <ul>
3729 <li>
3730 <dl>
3731 <dt>
3732 <dl>
3733 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3734 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3735 </dl></dt>
3736 </dl></li>
3737 </ul></dt>
3738 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3739 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3740 </dl></li>
3741 </ol></li>
3742 </ul></li>
3743 </ol></li>
3744 </ul>
3745 !! end
3746
3747
3748 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3749 !! test
3750 Definition Lists: Weird Ones: Test 1
3751 !! wikitext
3752 *#;*::;; foo : bar (who uses this?)
3753 !! html/php
3754 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3755 <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>
3756
3757 !! html/php+tidy
3758 <ul>
3759 <li>
3760 <ol>
3761 <li>
3762 <dl>
3763 <dt>foo&#160;</dt>
3764 <dd>
3765 <ul>
3766 <li>
3767 <dl>
3768 <dd>
3769 <dl>
3770 <dd>
3771 <dl>
3772 <dd>
3773 <dl>
3774 <dt>bar (who uses this?)</dt>
3775 </dl>
3776 </dd>
3777 </dl>
3778 </dd>
3779 </dl>
3780 </dd>
3781 </dl>
3782 </li>
3783 </ul>
3784 </dd>
3785 </dl>
3786 </li>
3787 </ol>
3788 </li>
3789 </ul>
3790 !! html/parsoid
3791 <ul>
3792 <li>
3793 <ol>
3794 <li>
3795 <dl>
3796 <dt>
3797 <ul>
3798 <li>
3799 <dl>
3800 <dd>
3801 <dl>
3802 <dd>
3803 <dl>
3804 <dt>
3805 <dl>
3806 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3807 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3808 </dl></dt>
3809 </dl></dd>
3810 </dl></dd>
3811 </dl></li>
3812 </ul></dt>
3813 </dl></li>
3814 </ol></li>
3815 </ul>
3816 !! end
3817
3818 ###
3819 ### External links
3820 ###
3821 !! test
3822 External links: non-bracketed
3823 !! wikitext
3824 Non-bracketed: http://example.com
3825 !! html
3826 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3827 </p>
3828 !! end
3829
3830 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3831 !! test
3832 External links: numbered
3833 !! wikitext
3834 Numbered: [http://example.com]
3835 Numbered: [http://example.net]
3836 Numbered: [http://example.com]
3837 !! html/php
3838 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3839 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3840 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3841 </p>
3842 !! html/parsoid
3843 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3844 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3845 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3846 !!end
3847
3848 !! test
3849 External links: specified text
3850 !! wikitext
3851 Specified text: [http://example.com link]
3852 !! html
3853 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3854 </p>
3855 !!end
3856
3857 !! test
3858 External links: trail
3859 !! wikitext
3860 Linktrails should not work for external links: [http://example.com link]s
3861 !! html
3862 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3863 </p>
3864 !! end
3865
3866 !! test
3867 External links: dollar sign in URL
3868 !! wikitext
3869 http://example.com/1$2345
3870 !! html
3871 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3872 </p>
3873 !! end
3874
3875 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3876 !! test
3877 External links: dollar sign in URL (autonumber)
3878 !! wikitext
3879 [http://example.com/1$2345]
3880 !! html/php
3881 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3882 </p>
3883 !! html/parsoid
3884 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3885 !!end
3886
3887 !! test
3888 External links: open square bracket forbidden in URL (bug 4377)
3889 !! options
3890 parsoid=wt2html,wt2wt,html2html
3891 !! wikitext
3892 http://example.com/1[2345
3893 !! html/php
3894 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3895 </p>
3896 !! html/parsoid
3897 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3898 !! end
3899
3900 !! test
3901 External links: open square bracket forbidden in URL (named) (bug 4377)
3902 !! options
3903 parsoid=wt2html,html2html
3904 !! wikitext
3905 [http://example.com/1[2345]
3906 !! html/php
3907 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3908 </p>
3909 !! html/parsoid
3910 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3911 !!end
3912
3913 # parsoid adds a space before the link name
3914 !! test
3915 External links: open square bracket forbidden in URL (named) (bug 4377)
3916 Parsoid variant.
3917 !! wikitext
3918 [http://example.com/1 [2345]
3919 !! html
3920 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3921 </p>
3922 !!end
3923
3924 !! test
3925 External links: nowiki in URL link text (bug 6230)
3926 !! wikitext
3927 [http://example.com/ <nowiki>''example site''</nowiki>]
3928 !! html
3929 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 External links: newline forbidden in text (bug 6230 regression check)
3935 !! wikitext
3936 [http://example.com/ first
3937 second]
3938 !! html
3939 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3940 second]
3941 </p>
3942 !!end
3943
3944 !! test
3945 External links: Pipe char between url and text
3946 !! wikitext
3947 [http://example.com | link]
3948 !! html
3949 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3950 </p>
3951 !!end
3952
3953 !! test
3954 External links: protocol-relative URL in brackets
3955 !! wikitext
3956 [//example.com/ Test]
3957 !! html
3958 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3959 </p>
3960 !! end
3961
3962 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3963 !! test
3964 External links: protocol-relative URL in brackets without text
3965 !! wikitext
3966 [//example.com]
3967 !! html/php
3968 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3969 </p>
3970 !! html/parsoid
3971 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3972 !! end
3973
3974 !! test
3975 External links: protocol-relative URL in free text is left alone
3976 !! wikitext
3977 //example.com/Foo
3978 !! html
3979 <p>//example.com/Foo
3980 </p>
3981 !!end
3982
3983 !! test
3984 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3985 !! wikitext
3986 foo//example.com/Foo
3987 !! html
3988 <p>foo//example.com/Foo
3989 </p>
3990 !! end
3991
3992 !! test
3993 External links: with no contents
3994 !! wikitext
3995 [http://en.wikipedia.org/wiki/Foo]
3996
3997 [[wikipedia:Foo|Bar]]
3998
3999 [[wikipedia:Foo|<span>Bar</span>]]
4000 !! html/php
4001 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4002 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4003 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4004 </p>
4005 !! html/parsoid
4006 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4007 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
4008 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
4009 !! end
4010
4011 !! test
4012 External image
4013 !! wikitext
4014 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4015 !! html
4016 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4017 </p>
4018 !! end
4019
4020 !! test
4021 External image from https
4022 !! wikitext
4023 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4024 !! html
4025 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4026 </p>
4027 !! end
4028
4029 !! test
4030 External image (when not allowed)
4031 !! options
4032 wgAllowExternalImages=0
4033 !! wikitext
4034 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4035 !! html
4036 <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>
4037 </p>
4038 !! end
4039
4040 !! test
4041 Link to non-http image, no img tag
4042 !! wikitext
4043 Link to non-http image, no img tag: ftp://example.com/test.jpg
4044 !! html
4045 <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>
4046 </p>
4047 !! end
4048
4049 !! test
4050 External links: terminating separator
4051 !! wikitext
4052 Terminating separator: http://example.com/thing,
4053 !! html
4054 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4055 </p>
4056 !! end
4057
4058 !! test
4059 External links: intervening separator
4060 !! wikitext
4061 Intervening separator: http://example.com/1,2,3
4062 !! html
4063 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4064 </p>
4065 !! end
4066
4067 !! test
4068 External links: old bug with URL in query
4069 !! wikitext
4070 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4071 !! html
4072 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4073 </p>
4074 !! end
4075
4076 !! test
4077 External links: old URL-in-URL bug, mixed protocols
4078 !! wikitext
4079 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4080 !! html
4081 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4082 </p>
4083 !!end
4084
4085 !! test
4086 External links: URL in text
4087 !! wikitext
4088 URL in text: [http://example.com http://example.com]
4089 !! html
4090 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4091 </p>
4092 !! end
4093
4094 !! test
4095 External links: Clickable images
4096 !! wikitext
4097 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4098 !! html
4099 <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>
4100 </p>
4101 !!end
4102
4103 !! test
4104 External links: raw ampersand
4105 !! wikitext
4106 Old &amp; use: http://x&y
4107 !! html
4108 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4109 </p>
4110 !! end
4111
4112 !! test
4113 External links: encoded ampersand
4114 !! wikitext
4115 Old &amp; use: http://x&amp;y
4116 !! html/php
4117 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4118 </p>
4119 !! html/parsoid
4120 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4121 !! end
4122
4123 !! test
4124 External links: encoded equals (bug 6102)
4125 !! wikitext
4126 http://example.com/?foo&#61;bar
4127 !! html/php
4128 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4129 </p>
4130 !! html/parsoid
4131 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4132 !! end
4133
4134 ##
4135 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4136 ## does it number them. As discussed in bug 53505, we can identify
4137 ## autonumbered links via CSS.
4138 ##
4139
4140 !! test
4141 External links: [raw ampersand]
4142 !! wikitext
4143 Old &amp; use: [http://x&y]
4144 !! html/php
4145 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4146 </p>
4147 !! html/parsoid
4148 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4149 !! end
4150
4151 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4152 # mode will return the [raw ampersand] wikitext
4153 !! test
4154 External links: [encoded ampersand]
4155 !! options
4156 parsoid=wt2html,wt2wt,html2html
4157 !! wikitext
4158 Old &amp; use: [http://x&amp;y]
4159 !! html/php
4160 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4161 </p>
4162 !! html/parsoid
4163 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4164 !! end
4165
4166 !! test
4167 External links: [raw equals]
4168 !! wikitext
4169 [http://example.com/?foo=bar]
4170 !! html/php
4171 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4172 </p>
4173 !! html/parsoid
4174 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4175 !! end
4176
4177 # note that parsoid html is identical to [raw equals] case; so html2wt
4178 # mode will return the [raw equals] wikitext
4179 !! test
4180 External links: [encoded equals] (bug 6102)
4181 !! options
4182 parsoid=wt2html,wt2wt,html2html
4183 !! wikitext
4184 [http://example.com/?foo&#61;bar]
4185 !! html/php
4186 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4187 </p>
4188 !! html/parsoid
4189 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4190 !! end
4191
4192 # xxx parsoid strips the IDN character, so the round-trip tests will
4193 # obviously fail and are disabled. --cscott
4194 !! test
4195 External links: [IDN ignored character reference in hostname; strip it right off]
4196 !! options
4197 parsoid=wt2html,wt2wt,html2html
4198 !! wikitext
4199 [http://e&zwnj;xample.com/]
4200 !! html/php
4201 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4205 !! end
4206
4207 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4208 # Where an external link could easily circumvent the sanitization of the text of
4209 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4210 # test demands a higher standard. That's a bit strange.
4211 #
4212 # Example:
4213 #
4214 # http://e‌xample.com -> [http://example.com|http://example.com]
4215 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4216 #
4217 # The first example is sanitized, but the second is not. Any security benefits
4218 # from this production are trivial to circumvent. Either remove this test and
4219 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4220 # the test accordingly.
4221 #
4222 # All our love,
4223 # The Parsoid team.
4224 # xxx parsoid strips the IDN character, so the round-trip tests will
4225 # obviously fail and are disabled. --cscott
4226 !! test
4227 External links: IDN ignored character reference in hostname; strip it right off
4228 !! options
4229 parsoid=wt2html,html2html
4230 !! wikitext
4231 http://e&zwnj;xample.com/
4232 !! html/php
4233 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4234 </p>
4235 !! html/parsoid
4236 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4237 !! end
4238
4239 !! test
4240 External links: www.jpeg.org (bug 554)
4241 !! wikitext
4242 http://www.jpeg.org
4243 !! html
4244 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4245 </p>
4246 !! end
4247
4248 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4249 !! test
4250 External links: URL within URL (original bug 2)
4251 !! wikitext
4252 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4253 !! html/php
4254 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4255 </p>
4256 !! html/parsoid
4257 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4258 !! end
4259
4260 !! test
4261 BUG 361: URL inside bracketed URL
4262 !! wikitext
4263 [http://www.example.com/foo http://www.example.com/bar]
4264 !! html
4265 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4266 </p>
4267 !! end
4268
4269 !! test
4270 BUG 361: URL within URL, not bracketed
4271 !! wikitext
4272 http://www.example.com/foo?=http://www.example.com/bar
4273 !! html
4274 <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>
4275 </p>
4276 !! end
4277
4278 !! test
4279 BUG 289: ">"-token in URL-tail
4280 !! wikitext
4281 http://www.example.com/<hello>
4282 !! html
4283 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4284 </p>
4285 !!end
4286
4287 !! test
4288 BUG 289: literal ">"-token in URL-tail
4289 !! wikitext
4290 http://www.example.com/<b>html</b>
4291 !! html
4292 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4293 </p>
4294 !!end
4295
4296 !! test
4297 BUG 289: ">"-token in bracketed URL
4298 !! wikitext
4299 [http://www.example.com/<hello> stuff]
4300 !! html
4301 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4302 </p>
4303 !!end
4304
4305 !! test
4306 BUG 289: literal ">"-token in bracketed URL
4307 !! wikitext
4308 [http://www.example.com/<b>html</b> stuff]
4309 !! html
4310 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4311 </p>
4312 !!end
4313
4314 !! test
4315 BUG 289: literal double quote at end of URL
4316 !! wikitext
4317 http://www.example.com/"hello"
4318 !! html
4319 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4320 </p>
4321 !!end
4322
4323 !! test
4324 BUG 289: literal double quote in bracketed URL
4325 !! wikitext
4326 [http://www.example.com/"hello" stuff]
4327 !! html
4328 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4329 </p>
4330 !!end
4331
4332 !! test
4333 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4334 !! wikitext
4335 [http://www.example.com test]
4336 !! html
4337 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4338 </p>
4339 !! end
4340
4341 !! test
4342 External links: link text with spaces
4343 !! wikitext
4344 [http://www.example.com a b c]
4345 [http://www.example.com ''a'' ''b'']
4346 !! html
4347 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4348 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4349 </p>
4350 !! end
4351
4352 !! test
4353 External links: wiki links within external link (Bug 3695)
4354 !! wikitext
4355 [http://example.com [[wikilink]] embedded in ext link]
4356 !! html/php
4357 <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>
4358 </p>
4359 !! html/parsoid
4360 <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>
4361 !! end
4362
4363 !! test
4364 BUG 787: Links with one slash after the url protocol are invalid
4365 !! wikitext
4366 http:/example.com
4367
4368 [http:/example.com title]
4369 !! html
4370 <p>http:/example.com
4371 </p><p>[http:/example.com title]
4372 </p>
4373 !! end
4374
4375 !! test
4376 Bracketed external links with template-generated invalid target
4377 !! wikitext
4378 [{{echo|http:/example.com}} title]
4379 !! html
4380 <p>[http:/example.com title]
4381 </p>
4382 !! end
4383
4384 !! test
4385 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4386 !! wikitext
4387 ''[http://example.com text'']
4388 [http://example.com '''text]'''
4389 ''Something [http://example.com in italic'']
4390 ''Something [http://example.com mixed''''', even bold]'''
4391 '''''Now [http://example.com both''''']
4392 !! html
4393 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4394 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4395 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4396 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4397 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4398 </p>
4399 !! end
4400
4401
4402 !! test
4403 Bug 4781: %26 in URL
4404 !! wikitext
4405 http://www.example.com/?title=AT%26T
4406 !! html/php
4407 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4408 </p>
4409 !! html/parsoid
4410 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4411 !! end
4412
4413 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4414 # % is actually legal in HTML5. Any change in output would need testing though.
4415 !! test
4416 Bug 4781, 5267: %25 in URL
4417 !! wikitext
4418 http://www.example.com/?title=100%25_Bran
4419 !! html/php
4420 <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>
4421 </p>
4422 !! html/parsoid
4423 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4424 !! end
4425
4426 !! test
4427 Bug 4781, 5267: %28, %29 in URL
4428 !! wikitext
4429 http://www.example.com/?title=Ben-Hur_%281959_film%29
4430 !! html/php
4431 <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>
4432 </p>
4433 !! html/parsoid
4434 <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>
4435 !! end
4436
4437
4438 !! test
4439 Bug 4781: %26 in autonumber URL
4440 !! wikitext
4441 [http://www.example.com/?title=AT%26T]
4442 !! html/php
4443 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4447 !! end
4448
4449 !! test
4450 Bug 4781, 5267: %26 in autonumber URL
4451 !! wikitext
4452 [http://www.example.com/?title=100%25_Bran]
4453 !! html/php
4454 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4455 </p>
4456 !! html/parsoid
4457 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4458 !! end
4459
4460 !! test
4461 Bug 4781, 5267: %28, %29 in autonumber URL
4462 !! wikitext
4463 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4464 !! html/php
4465 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4466 </p>
4467 !! html/parsoid
4468 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4469 !! end
4470
4471
4472 !! test
4473 Bug 4781: %26 in bracketed URL
4474 !! wikitext
4475 [http://www.example.com/?title=AT%26T link]
4476 !! html/php
4477 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4478 </p>
4479 !! html/parsoid
4480 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4481 !! end
4482
4483 !! test
4484 Bug 4781, 5267: %25 in bracketed URL
4485 !! wikitext
4486 [http://www.example.com/?title=100%25_Bran link]
4487 !! html
4488 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4489 </p>
4490 !! end
4491
4492 !! test
4493 Bug 4781, 5267: %28, %29 in bracketed URL
4494 !! wikitext
4495 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4496 !! html/php
4497 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4498 </p>
4499 !! html/parsoid
4500 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4501 !! end
4502
4503 !! test
4504 External link containing a period in the anchor. (bug 63947)
4505 !! wikitext
4506 [//foo.org/bar#baz. bang]
4507
4508 [//foo.org/bar. bang]
4509 !! html/php
4510 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4511 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4512 </p>
4513 !! html/parsoid
4514 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4515 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4516 !! end
4517
4518 !! test
4519 External link containing a single quote. (bug 63947)
4520 !! wikitext
4521 [//foo.org/bar'baz]
4522
4523 [//foo.org/bar'baz bang]
4524 !! html/php
4525 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4526 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4530 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4531 !! end
4532
4533
4534 !! test
4535 External link containing a period in the anchor. (bug 63947)
4536 !! wikitext
4537 [//foo.org/bar#baz. bang]
4538
4539 [//foo.org/bar. bang]
4540 !! html/php
4541 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4542 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4543 </p>
4544 !! html/parsoid
4545 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4546 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4547 !! end
4548
4549 !! test
4550 External link containing a single quote. (bug 63947)
4551 !! wikitext
4552 [//foo.org/bar'baz]
4553
4554 [//foo.org/bar'baz bang]
4555 !! html/php
4556 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4557 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4558 </p>
4559 !! html/parsoid
4560 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4561 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4562 !! end
4563
4564
4565 !! test
4566 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4567 !! wikitext
4568 Some [http://example.com/ pretty ''italics'' and stuff]!
4569 !! html
4570 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4571 </p>
4572 !! end
4573
4574 !! test
4575 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4576 !! wikitext
4577 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4578 !! html
4579 <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>
4580 </p>
4581 !! end
4582
4583 !! test
4584 External link containing double-single-quotes with no space separating the url from text in italics
4585 !! wikitext
4586 [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]].]
4587 !! html/php
4588 <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>
4589 </p>
4590 !! html/php+tidy
4591 <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>
4592 !! html/parsoid
4593 <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>
4594 !! end
4595
4596 !! test
4597 External link with comments in link text
4598 !! wikitext
4599 [http://www.google.com Google <!-- comment -->]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4602 </p>
4603 !! end
4604
4605 !! test
4606 URL-encoding in URL functions (single parameter)
4607 !! wikitext
4608 {{localurl:Some page|amp=&}}
4609 !! html
4610 <p>/index.php?title=Some_page&amp;amp=&amp;
4611 </p>
4612 !! end
4613
4614 !! test
4615 URL-encoding in URL functions (multiple parameters)
4616 !! wikitext
4617 {{localurl:Some page|q=?&amp=&}}
4618 !! html
4619 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4620 </p>
4621 !! end
4622
4623 !! test
4624 Brackets in urls
4625 !! wikitext
4626 http://example.com/index.php?foozoid%5B%5D=bar
4627
4628 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4629 !! html/php
4630 <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>
4631 </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>
4632 </p>
4633 !! html/parsoid
4634 <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>
4635
4636 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4637 !! end
4638
4639 !! test
4640 IPv6 urls (bug 21261)
4641 !! options
4642 disabled
4643 !! wikitext
4644 http://[2404:130:0:1000::187:2]/index.php
4645 !! html
4646 <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>
4647 </p>
4648 !! end
4649
4650 !! test
4651 Non-extlinks in brackets
4652 !! wikitext
4653 [foo]
4654 [foo bar]
4655 [foo ''bar'']
4656 [fool's] errand
4657 [fool's errand]
4658 [{{echo|foo}}]
4659 [{{echo|foo}} bar]
4660 [{{echo|foo}} ''bar'']
4661 [{{echo|foo}}l's] errand
4662 [{{echo|foo}}l's errand]
4663 [url={{echo|foo}}]
4664 [url=http://example.com]
4665 !! html
4666 <p>[foo]
4667 [foo bar]
4668 [foo <i>bar</i>]
4669 [fool's] errand
4670 [fool's errand]
4671 [foo]
4672 [foo bar]
4673 [foo <i>bar</i>]
4674 [fool's] errand
4675 [fool's errand]
4676 [url=foo]
4677 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4678 </p>
4679 !! end
4680
4681 !! test
4682 Percent encoding in external links
4683 !! wikitext
4684 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4685 !! html/php
4686 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4687 </p>
4688 !! html/parsoid
4689 <p><a rel="mw:ExtLink"
4690 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4691 !! end
4692
4693 !! test
4694 Use url link syntax for links where the content is equal the link target
4695 !! wikitext
4696 http://example.com
4697 !! html/php
4698 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4702 !! end
4703
4704 !! test
4705 Parenthesis in external links, especially URL links
4706 !! wikitext
4707 http://example.com)
4708
4709 http://example.com/test)
4710
4711 http://example.com/(test)
4712
4713 http://example.com/((test)
4714
4715 (http://example.com/(test))
4716
4717 (http://example.com/(test)))))
4718
4719 http://example.com/a)b
4720
4721 [http://example.com) foo]
4722 !! html/php
4723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4724 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4725 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4726 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4727 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4728 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4729 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4730 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4734 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4735 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4736 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4737 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4738 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4739 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4740 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4741 !! end
4742
4743 !! test
4744 Parenthesis in external links, w/ transclusion or comment
4745 !! wikitext
4746 (http://example.com/{{echo|hi}})
4747
4748 (http://example.com<!-- hi -->)
4749 !! html/php
4750 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4751 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4752 </p>
4753 !! html/parsoid
4754 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">hi&lt;/span>"}]]}' 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}}"}}'>http://example.com/hi</a>)</p>
4755
4756 <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>
4757 !! end
4758
4759 !! test
4760 Replace invalid link targets when serializing
4761 !! options
4762 parsoid=html2wt
4763 !! html
4764 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4765 !! wikitext
4766 [[MediaWiki:Badtitletext|Manual]]
4767 !! end
4768
4769 ###
4770 ### Quotes
4771 ###
4772
4773 !! test
4774 Quotes
4775 !! wikitext
4776 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4777
4778 Normal text. '''''Bold italic text.''''' Normal text.
4779 !! html
4780 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4781 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4782 </p>
4783 !! end
4784
4785
4786 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4787 # parser strips. The wikitext contains just the first half of the bold
4788 # quote pair.
4789 !! test
4790 Unclosed and unmatched quotes
4791 !! wikitext
4792 '''''Bold italic text '''with bold deactivated''' in between.'''''
4793
4794 '''''Bold italic text ''with italic deactivated'' in between.'''''
4795
4796 '''Bold text..
4797
4798 ..spanning two paragraphs (should not work).'''
4799
4800 '''Bold tag left open
4801
4802 ''Italic tag left open
4803
4804 Normal text.
4805
4806 <!-- Unmatching number of opening, closing tags: -->
4807 '''This year''''s election ''should'' beat '''last year''''s.
4808
4809 ''Tom'''s car is bigger than ''Susan'''s.
4810
4811 Plain ''italic'''s plain
4812 !! html/php
4813 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4814 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4815 </p><p><b>Bold text..</b>
4816 </p><p>..spanning two paragraphs (should not work).
4817 </p><p><b>Bold tag left open</b>
4818 </p><p><i>Italic tag left open</i>
4819 </p><p>Normal text.
4820 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4821 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4822 </p><p>Plain <i>italic'</i>s plain
4823 </p>
4824 !! html/parsoid
4825 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4826 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4827 </p><p><b>Bold text..</b>
4828 </p><p>..spanning two paragraphs (should not work).<b></b>
4829 </p><p><b>Bold tag left open</b>
4830 </p><p><i>Italic tag left open</i>
4831 </p><p>Normal text.
4832 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4834 </p><p>Plain <i>italic'</i>s plain
4835 </p>
4836 !! end
4837
4838 ###
4839 ### Tables
4840 ###
4841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4842 ###
4843
4844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4845 # is the bare minimum required by the spec, see:
4846 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4847 # Parsoid team replies: empty table tags are legal in HTML5
4848 !! test
4849 A table with no data.
4850 !! options
4851 parsoid=wt2html
4852 !! wikitext
4853 {||}
4854 !! html/php
4855
4856 !! html/parsoid
4857 <table></table>
4858
4859 !! end
4860
4861 !! test
4862 A table with stray table end tags on start tag line (wt2html)
4863 !! options
4864 parsoid=wt2html
4865 !! wikitext
4866 {|style="color: red;"|}
4867
4868 {|style="color: red;" |}
4869 |foo
4870 |}
4871
4872 {|style="color: red;"|} id="foo"
4873 |foo
4874 |}
4875
4876 {|style="color: red;" |} id="foo"
4877 |foo
4878 |}
4879 !! html
4880 <table style="color: red;"></table>
4881
4882 <table style="color: red;">
4883 <tbody><tr>
4884 <td>foo</td>
4885 </tr></tbody>
4886 </table>
4887
4888 <table style="color: red;" id="foo">
4889 <tbody><tr>
4890 <td>foo</td>
4891 </tr></tbody>
4892 </table>
4893
4894 <table style="color: red;" id="foo">
4895 <tbody><tr>
4896 <td>foo</td>
4897 </tr></tbody>
4898 </table>
4899
4900 !! end
4901
4902 !! test
4903 A table with no data (take 2)
4904 !! wikitext
4905 {|
4906 |}
4907 !! html/parsoid
4908 <table></table>
4909 !! end
4910
4911 # A table with nothing but a caption is invalid XHTML, we might want to render
4912 # this as <p>caption</p>
4913 # Parsoid team replies: table with only a caption is legal in HTML5
4914 !! test
4915 A table with nothing but a caption
4916 !! wikitext
4917 {|
4918 |+ caption
4919 |}
4920 !! html/php
4921 <table>
4922 <caption> caption
4923 </caption><tr><td></td></tr></table>
4924
4925 !! html/parsoid
4926 <table><caption> caption</caption></table>
4927 !! end
4928
4929 !! test
4930 A table with caption with default-spaced attributes and a table row
4931 !! wikitext
4932 {|
4933 |+ style="color: red;" | caption1
4934 |-
4935 | foo
4936 |}
4937 !! html
4938 <table>
4939 <caption style="color: red;"> caption1
4940 </caption>
4941 <tr>
4942 <td> foo
4943 </td></tr></table>
4944
4945 !! end
4946
4947 !! test
4948 A table with captions with non-default spaced attributes and a table row
4949 !! wikitext
4950 {|
4951 |+style="color: red;"|caption2
4952 |+ style="color: red;"| caption3
4953 |-
4954 | foo
4955 |}
4956 !! html
4957 <table>
4958 <caption style="color: red;">caption2
4959 </caption>
4960 <caption style="color: red;"> caption3
4961 </caption>
4962 <tr>
4963 <td> foo
4964 </td></tr></table>
4965
4966 !! end
4967
4968 !! test
4969 Table td-cell syntax variations
4970 !! wikitext
4971 {|
4972 | foo bar foo | baz
4973 | foo bar foo || baz
4974 | style='color:red;' | baz
4975 | style='color:red;' || baz
4976 |}
4977 !! html
4978 <table>
4979 <tr>
4980 <td> baz
4981 </td>
4982 <td> foo bar foo </td>
4983 <td> baz
4984 </td>
4985 <td style="color:red;"> baz
4986 </td>
4987 <td> style='color:red;' </td>
4988 <td> baz
4989 </td></tr></table>
4990
4991 !! end
4992
4993 !! test
4994 Simple table
4995 !! wikitext
4996 {|
4997 | 1 || 2
4998 |-
4999 | 3 || 4
5000 |}
5001 !! html
5002 <table>
5003 <tr>
5004 <td> 1 </td>
5005 <td> 2
5006 </td></tr>
5007 <tr>
5008 <td> 3 </td>
5009 <td> 4
5010 </td></tr></table>
5011
5012 !! end
5013
5014 !! test
5015 Simple table but with multiple dashes for row wikitext
5016 !! wikitext
5017 {|
5018 | foo
5019 |-----
5020 | bar
5021 |}
5022 !! html
5023 <table>
5024 <tr>
5025 <td> foo
5026 </td></tr>
5027 <tr>
5028 <td> bar
5029 </td></tr></table>
5030
5031 !! end
5032 !! test
5033 Multiplication table
5034 !! wikitext
5035 {| border="1" cellpadding="2"
5036 |+Multiplication table
5037 |-
5038 ! &times; !! 1 !! 2 !! 3
5039 |-
5040 ! 1
5041 | 1 || 2 || 3
5042 |-
5043 ! 2
5044 | 2 || 4 || 6
5045 |-
5046 ! 3
5047 | 3 || 6 || 9
5048 |-
5049 ! 4
5050 | 4 || 8 || 12
5051 |-
5052 ! 5
5053 | 5 || 10 || 15
5054 |}
5055 !! html
5056 <table border="1" cellpadding="2">
5057 <caption>Multiplication table
5058 </caption>
5059 <tr>
5060 <th> &#215; </th>
5061 <th> 1 </th>
5062 <th> 2 </th>
5063 <th> 3
5064 </th></tr>
5065 <tr>
5066 <th> 1
5067 </th>
5068 <td> 1 </td>
5069 <td> 2 </td>
5070 <td> 3
5071 </td></tr>
5072 <tr>
5073 <th> 2
5074 </th>
5075 <td> 2 </td>
5076 <td> 4 </td>
5077 <td> 6
5078 </td></tr>
5079 <tr>
5080 <th> 3
5081 </th>
5082 <td> 3 </td>
5083 <td> 6 </td>
5084 <td> 9
5085 </td></tr>
5086 <tr>
5087 <th> 4
5088 </th>
5089 <td> 4 </td>
5090 <td> 8 </td>
5091 <td> 12
5092 </td></tr>
5093 <tr>
5094 <th> 5
5095 </th>
5096 <td> 5 </td>
5097 <td> 10 </td>
5098 <td> 15
5099 </td></tr></table>
5100
5101 !! end
5102
5103 !! test
5104 Accept "||" in table headings
5105 !! wikitext
5106 {|
5107 !h1 || h2
5108 |}
5109 !! html
5110 <table>
5111 <tr>
5112 <th>h1 </th>
5113 <th> h2
5114 </th></tr></table>
5115
5116 !! end
5117
5118 !! test
5119 Accept "!!" in table data
5120 !! wikitext
5121 {|
5122 | Foo!! ||
5123 |}
5124 !! html
5125 <table>
5126 <tr>
5127 <td> Foo!! </td>
5128 <td>
5129 </td></tr></table>
5130
5131 !! html/parsoid
5132 <table data-parsoid='{}'>
5133 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5134 </tbody></table>
5135 !! end
5136
5137 !! test
5138 Accept "||" in indented table headings
5139 !! wikitext
5140 :{|
5141 !h1 || h2
5142 |}
5143 !! html
5144 <dl><dd><table>
5145 <tr>
5146 <th>h1 </th>
5147 <th> h2
5148 </th></tr></table></dd></dl>
5149
5150 !! end
5151
5152 !! test
5153 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5154 !! wikitext
5155 {|
5156 !| h1
5157 || a
5158 |}
5159 !! html
5160 <table>
5161 <tr>
5162 <th> h1
5163 </th>
5164 <td> a
5165 </td></tr></table>
5166
5167 !! end
5168
5169 !!test
5170 Accept "| !" at start of line in tables (ignore !-attribute)
5171 !! wikitext
5172 {|
5173 |-
5174 | !style="color:red" | bar
5175 |}
5176 !! html
5177 <table>
5178
5179 <tr>
5180 <td> bar
5181 </td></tr></table>
5182
5183 !!end
5184
5185 !!test
5186 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 +/-
5187 !! wikitext
5188 {|
5189 |-
5190 |style='color:red;'|+1
5191 |style='color:blue;'|-1
5192 |-
5193 | 1 || 2 || 3
5194 | 1 ||+2 ||-3
5195 |-
5196 | +1
5197 | -1
5198 |}
5199 !! html
5200 <table>
5201
5202 <tr>
5203 <td style="color:red;">+1
5204 </td>
5205 <td style="color:blue;">-1
5206 </td></tr>
5207 <tr>
5208 <td> 1 </td>
5209 <td> 2 </td>
5210 <td> 3
5211 </td>
5212 <td> 1 </td>
5213 <td>+2 </td>
5214 <td>-3
5215 </td></tr>
5216 <tr>
5217 <td> +1
5218 </td>
5219 <td> -1
5220 </td></tr></table>
5221
5222 !!end
5223
5224 !! test
5225 Table rowspan
5226 !! wikitext
5227 {| border=1
5228 | Cell 1, row 1
5229 |rowspan=2| Cell 2, row 1 (and 2)
5230 | Cell 3, row 1
5231 |-
5232 | Cell 1, row 2
5233 | Cell 3, row 2
5234 |}
5235 !! html
5236 <table border="1">
5237 <tr>
5238 <td> Cell 1, row 1
5239 </td>
5240 <td rowspan="2"> Cell 2, row 1 (and 2)
5241 </td>
5242 <td> Cell 3, row 1
5243 </td></tr>
5244 <tr>
5245 <td> Cell 1, row 2
5246 </td>
5247 <td> Cell 3, row 2
5248 </td></tr></table>
5249
5250 !! end
5251
5252 !! test
5253 Nested table
5254 !! wikitext
5255 {| border=1
5256 | &alpha;
5257 |
5258 {| bgcolor=#ABCDEF border=2
5259 |nested
5260 |-
5261 |table
5262 |}
5263 |the original table again
5264 |}
5265 !! html
5266 <table border="1">
5267 <tr>
5268 <td> &#945;
5269 </td>
5270 <td>
5271 <table bgcolor="#ABCDEF" border="2">
5272 <tr>
5273 <td>nested
5274 </td></tr>
5275 <tr>
5276 <td>table
5277 </td></tr></table>
5278 </td>
5279 <td>the original table again
5280 </td></tr></table>
5281
5282 !! end
5283
5284 !! test
5285 Invalid attributes in table cell (bug 1830)
5286 !! wikitext
5287 {|
5288 |Cell:|broken
5289 |}
5290 !! html
5291 <table>
5292 <tr>
5293 <td>broken
5294 </td></tr></table>
5295
5296 !! end
5297
5298
5299 # The "|}" to close the table is missing from the input, so parsoid's
5300 # *2wt modes will fail.
5301 !! test
5302 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5303 !! options
5304 parsoid=wt2html,html2html
5305 !! wikitext
5306 {|
5307 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5308 !! html/php
5309 <table>
5310 <tr>
5311 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5312 <td>]" onmouseover="alert(document.cookie)"&gt;test
5313 </td>
5314 </tr>
5315 </table>
5316
5317 !! html/parsoid
5318 <table><tbody>
5319 <tr>
5320 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5321 !! end
5322
5323
5324 !! test
5325 Indented table markup mixed with indented pre content (proposed in bug 6200)
5326 !! wikitext
5327 <table>
5328 <tr>
5329 <td>
5330 Text that should be rendered preformatted
5331 </td>
5332 </tr>
5333 </table>
5334 !! html
5335 <table>
5336 <tr>
5337 <td>
5338 <pre>Text that should be rendered preformatted
5339 </pre>
5340 </td>
5341 </tr>
5342 </table>
5343
5344 !! end
5345
5346 !! test
5347 Template-generated table cell attributes and cell content
5348 !! wikitext
5349 {|
5350 |{{table_attribs}}
5351 | {{table_attribs}}
5352 |}
5353 !! html
5354 <table>
5355 <tr>
5356 <td style="color: red"> Foo
5357 </td>
5358 <td style="color: red"> Foo
5359 </td></tr></table>
5360
5361 !! end
5362
5363 !! test
5364 Template-generated table cell attributes and cell content (2)
5365 !! wikitext
5366 {|
5367 |align=center {{table_attribs}}
5368 |}
5369 !! html
5370 <table>
5371 <tr>
5372 <td align="center" style="color: red"> Foo
5373 </td></tr></table>
5374
5375 !! end
5376
5377 !! test
5378 Template-generated table cell attributes and cell content (3)
5379 !! wikitext
5380 {|
5381 |align=center {{table_cells}}
5382 |}
5383 !! html
5384 <table>
5385 <tr>
5386 <td align="center" style="color: red"> Foo </td>
5387 <td> Bar </td>
5388 <td> Baz
5389 </td></tr></table>
5390
5391 !! end
5392
5393 !! test
5394 Table with row followed by newlines and table heading
5395 !! wikitext
5396 {|
5397 |-
5398
5399 ! foo
5400 |}
5401 !! html
5402 <table>
5403
5404
5405 <tr>
5406 <th> foo
5407 </th></tr></table>
5408
5409 !! end
5410
5411 !! test
5412 Table with empty line following the start tag
5413 !! wikitext
5414 {|
5415
5416 |-
5417 | foo
5418 |}
5419 !! html
5420 <table>
5421
5422
5423 <tr>
5424 <td> foo
5425 </td></tr></table>
5426
5427 !! end
5428
5429 # FIXME: Preserve the attribute properly (with an empty string as value) in
5430 # the PHP parser. Parsoid implements the behavior below.
5431 !! test
5432 Table attributes with empty value
5433 !! wikitext
5434 {|
5435 | style=| hello
5436 |}
5437 !! html/parsoid
5438 <table>
5439 <tbody>
5440 <tr>
5441 <td style=""> hello
5442 </td></tr></tbody></table>
5443
5444 !! end
5445
5446 !! test
5447 Wikitext table with a lot of comments
5448 !! wikitext
5449 {|
5450 <!-- c0 -->
5451 | foo
5452 <!-- c1 -->
5453 |- <!-- c2 -->
5454 <!-- c3 -->
5455 |<!-- c4 -->
5456 <!-- c5 -->
5457 |}
5458 !! html
5459 <table>
5460 <tr>
5461 <td> foo
5462 </td></tr>
5463 <tr>
5464 <td>
5465 </td></tr></table>
5466
5467 !! end
5468
5469 !! test
5470 Wikitext table with double-line table cell
5471 !! wikitext
5472 {|
5473 |a
5474 b
5475 |}
5476 !! html
5477 <table>
5478 <tr>
5479 <td>a
5480 <p>b
5481 </p>
5482 </td></tr></table>
5483
5484 !! end
5485
5486 !! test
5487 Table cell with a single comment
5488 !! wikitext
5489 {|
5490 | <!-- c1 -->
5491 | a
5492 |}
5493 !! html
5494 <table>
5495 <tr>
5496 <td>
5497 </td>
5498 <td> a
5499 </td></tr></table>
5500
5501 !! end
5502
5503 !! test
5504 Table-cell after a comment-only-empty-line
5505 !! wikitext
5506 {|
5507 |a
5508 <!--c1-->
5509 <!--c2-->| b
5510 |}
5511 !! html
5512 <table>
5513 <tr>
5514 <td>a
5515 </td>
5516 <td> b
5517 </td></tr></table>
5518
5519 !! html/parsoid
5520 <table>
5521 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5522 <!--c1-->
5523 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5524 </tbody></table>
5525
5526 !! end
5527
5528 # The expected HTML structure in this test is debatable. The PHP parser does
5529 # not parse this kind of table at all. The main focus for Parsoid is on
5530 # round-tripping, so this output is ok for now. TODO: revisit!
5531 !! test
5532 Wikitext table with html-syntax row
5533 !! wikitext
5534 {|
5535 |-
5536 <td>foo</td>
5537 |}
5538 !! html/parsoid
5539 <table>
5540 <tbody>
5541 <tr>
5542 <td>foo</td></tr></tbody></table>
5543 !! end
5544
5545 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5546 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5547 ## PHP parser, which tidy then compounds by fostering the content
5548 ## entirely out of the table. Parsoid recognizes the table context
5549 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5550 ## depends on PHP's treatment of broken table markup!
5551 !! test
5552 Implicit <td> after a |-
5553 !! options
5554 parsoid=wt2html,wt2wt
5555 !! wikitext
5556 {|
5557 |-
5558 a
5559 |}
5560 !! html/php
5561 <table>
5562
5563 a
5564 </table>
5565
5566 !! html/php+tidy
5567 <p>a</p>
5568 !! html/parsoid
5569 <table>
5570 <tr><td>a</td></tr>
5571 </table>
5572 !! end
5573
5574 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5575 !! test
5576 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5577 !! options
5578 parsoid=wt2html,wt2wt
5579 !! wikitext
5580 {|
5581 |-
5582 |
5583 a
5584 |-
5585 b
5586 |}
5587 !! html/php
5588 <table>
5589
5590 <tr>
5591 <td>
5592 <pre>a
5593 </pre>
5594 </td></tr>
5595 b
5596 </table>
5597
5598 !! html/php+tidy
5599 <p>b</p>
5600 <table>
5601 <tr>
5602 <td>
5603 <pre>
5604 a
5605 </pre></td>
5606 </tr>
5607 </table>
5608 !! html/parsoid
5609 <table>
5610 <tbody>
5611 <tr><td><pre>a</pre></td></tr>
5612 <tr><td> b</td></tr>
5613 </tbody>
5614 </table>
5615 !! end
5616
5617 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5618 !! test
5619 Lists should be recognized in an implicit <td> context
5620 !! options
5621 parsoid=wt2html,wt2wt
5622 !! wikitext
5623 {|
5624 |-
5625 *a
5626 |}
5627 !! html/php
5628 <table>
5629
5630 <ul><li>a</li></ul>
5631 </table>
5632
5633 !! html/php+tidy
5634 <ul>
5635 <li>a</li>
5636 </ul>
5637 !! html/parsoid
5638 <table>
5639 <tr>
5640 <td><ul>
5641 <li>a</li>
5642 </ul></td>
5643 </tr>
5644 </table>
5645 !! end
5646
5647 !! test
5648 Parsoid: Round-trip tables directly followed by content (bug 51219)
5649 !! options
5650 parsoid=wt2html,wt2wt
5651 !! wikitext
5652 {|
5653 |foo
5654 |} bar
5655
5656 {|
5657 |baz
5658 |}<b>quux</b>
5659 !! html
5660 <table><tbody>
5661 <tr>
5662 <td>foo</td></tr></tbody></table> bar
5663 <table>
5664 <tbody>
5665 <tr>
5666 <td>baz</td></tr></tbody></table><b>quux</b>
5667 !! end
5668
5669 !! test
5670 Parsoid: Default to a newline after tables in new content (bug 51219)
5671 !! options
5672 parsoid=html2wt
5673 !! wikitext
5674 {|
5675 |foo
5676 |}
5677 <nowiki> </nowiki>bar
5678 {|
5679 |baz
5680 |}
5681 '''quux'''
5682 !! html
5683 <table><tbody>
5684 <tr><td>foo</td></tr></tbody></table> bar
5685 <table><tbody>
5686 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5687 !! end
5688
5689 !! test
5690 Parsoid: newline inducing block nodes don't suppress <nowiki>
5691 !! options
5692 parsoid=html2wt
5693 !! wikitext
5694 <nowiki> </nowiki>a
5695
5696 = foo =
5697 !! html
5698 a<h1>foo</h1>
5699 !! end
5700
5701 !! test
5702 Parsoid: Row-syntax table headings followed by comment & table cells
5703 !! options
5704 parsoid=wt2html,wt2wt
5705 !! wikitext
5706 {|
5707 ! foo || bar
5708 <!-- foo --> || baz || quux
5709 |}
5710 !! html/php
5711 <table>
5712 <tr>
5713 <th> foo </th>
5714 <th> bar
5715 </th>
5716 <td> baz </td>
5717 <td> quux
5718 </td></tr></table>
5719
5720 !! html/parsoid
5721 <table>
5722 <tbody><tr><th> foo </th><th> bar
5723 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5724 </tbody></table>
5725 !! end
5726
5727
5728 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5729 # preserves it.
5730 !!test
5731 Parsoid: Recover better from broken table attributes
5732 !!options
5733 parsoid=wt2html
5734 !!wikitext
5735 {| class="foo
5736 | class="bar" |
5737 foo
5738 |}
5739 !!html/php+tidy
5740 <table>
5741 <tr>
5742 <td class="bar">
5743 <p>foo</p>
5744 </td>
5745 </tr>
5746 </table>
5747 !!html/parsoid
5748 <table class="foo">
5749 <tr>
5750 <td class="bar">
5751 <p>foo</p></td></tr>
5752 </tbody></table>
5753 !!end
5754
5755 !! test
5756 Strip unsupported table tags
5757 !! options
5758 parsoid=html2wt
5759 !! html
5760 <table>
5761 <thead>
5762 <tr>
5763 <th>Month</th>
5764 <th>Savings</th>
5765 </tr>
5766 </thead>
5767 <tbody>
5768 <tr>
5769 <td>January</td>
5770 <td>$100</td>
5771 </tr>
5772 <tr>
5773 <td>February</td>
5774 <td>$80</td>
5775 </tr>
5776 </tbody>
5777 <tfoot>
5778 <tr>
5779 <td>Sum</td>
5780 <td>$180</td>
5781 </tr>
5782 </tfoot>
5783 </table>
5784 !! wikitext
5785 {|
5786
5787 !Month
5788 !Savings
5789
5790 |January
5791 |$100
5792
5793 |-
5794 |February
5795 |$80
5796
5797 |Sum
5798 |$180
5799
5800 |}
5801 !! end
5802
5803 ###
5804 ### Internal links
5805 ###
5806 !! test
5807 Plain link, capitalized
5808 !! wikitext
5809 [[Main Page]]
5810 !! html
5811 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5812 </p>
5813 !! end
5814
5815 !! test
5816 Plain link, uncapitalized
5817 !! wikitext
5818 [[main Page]]
5819 !! html
5820 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5821 </p>
5822 !! end
5823
5824 !! test
5825 Piped link
5826 !! wikitext
5827 [[Main Page|The Main Page]]
5828 !! html
5829 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5830 </p>
5831 !! end
5832
5833 !! test
5834 Piped link with comment in link text
5835 !! wikitext
5836 [[Main Page|The Main<!--front--> Page]]
5837 !! html
5838 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5839 </p>
5840 !! end
5841
5842 !! test
5843 Piped link with multiple pipe characters in link text
5844 !! wikitext
5845 [[Main Page||The|Main|Page|]]
5846 !! html/php
5847 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5848 </p>
5849 !! html/parsoid
5850 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
5851 !! end
5852
5853 !! test
5854 Broken link
5855 !! wikitext
5856 [[Zigzagzogzagzig]]
5857 !! html
5858 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5859 </p>
5860 !! end
5861
5862 !! test
5863 Broken link with fragment
5864 !! wikitext
5865 [[Zigzagzogzagzig#zug]]
5866 !! html
5867 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5868 </p>
5869 !! end
5870
5871 !! test
5872 Special page link with fragment
5873 !! wikitext
5874 [[Special:Version#anchor]]
5875 !! html
5876 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5877 </p>
5878 !! end
5879
5880 !! test
5881 Nonexistent special page link with fragment
5882 !! wikitext
5883 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5884 !! html
5885 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5886 </p>
5887 !! end
5888
5889 !! test
5890 Link with prefix
5891 !! wikitext
5892 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5893 !! html
5894 <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>
5895 </p>
5896 !! end
5897
5898 !! test
5899 Link with suffix
5900 !! wikitext
5901 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5902 !! html
5903 <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>!!!
5904 </p>
5905 !! end
5906
5907 !! article
5908 prefixed article
5909 !! text
5910 Some text
5911 !! endarticle
5912
5913 !! test
5914 Bug 43661: Piped links with identical prefixes
5915 !! wikitext
5916 [[prefixed article|prefixed articles with spaces]]
5917
5918 [[prefixed article|prefixed articlesaoeu]]
5919
5920 [[Main Page|Main Page test]]
5921 !! html
5922 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5923 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5924 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5925 </p>
5926 !! end
5927
5928
5929 !! test
5930 Link with HTML entity in suffix / tail
5931 !! wikitext
5932 [[Main Page]]&quot;, [[Main Page]]&#97;
5933 !! html
5934 <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;
5935 </p>
5936 !! end
5937
5938 !! test
5939 Link with 3 brackets
5940 !! wikitext
5941 [[[Main Page]]]
5942 !! html
5943 <p>[[[Main Page]]]
5944 </p>
5945 !! end
5946
5947 !! test
5948 Link with 4 brackets
5949 !! wikitext
5950 [[[[Main Page]]]]
5951 !! html
5952 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5953 </p>
5954 !! end
5955
5956 !! test
5957 Piped link with 3 brackets
5958 !! wikitext
5959 [[[main page|the main page]]]
5960 !! html
5961 <p>[[[main page|the main page]]]
5962 </p>
5963 !! end
5964
5965 !! test
5966 Piped link with extlink-like text
5967 !! wikitext
5968 [[Main Page|[bar]]]
5969 [[Main Page|This is a [bar]]]
5970 !! html
5971 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5972 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5973 </p>
5974 !! end
5975
5976 !! test
5977 Link with multiple pipes
5978 !! wikitext
5979 [[Main Page|The|Main|Page]]
5980 !! html
5981 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5982 </p>
5983 !! end
5984
5985 # Note that parsoid does not munge anchor text; all non-space
5986 # characters are valid in HTML5 ids.
5987 !! test
5988 Anchor containing a #. (bug 63430)
5989 !! wikitext
5990 [[Main Page#And#Link]]
5991 !! html/php
5992 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5993 </p>
5994 !! html/parsoid
5995 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
5996 !! end
5997
5998 !! test
5999 Link to namespaces
6000 !! wikitext
6001 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6002 !! html
6003 <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>
6004 </p>
6005 !! end
6006
6007 !! test
6008 Link with space in namespace
6009 !! wikitext
6010 [[User talk:Foo bar]]
6011 !! html
6012 <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>
6013 </p>
6014 !! end
6015
6016 !! article
6017 MemoryAlpha:AlphaTest
6018 !! text
6019 This is an article in the MemoryAlpha namespace
6020 (which shadows the memoryalpha interwiki link).
6021 !! endarticle
6022
6023 !! test
6024 Namespace takes precedence over interwiki link (bug 51680)
6025 !! wikitext
6026 [[MemoryAlpha:AlphaTest]]
6027 !! html
6028 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6029 </p>
6030 !! end
6031
6032 # The previous test doesn't work correctly in html2*, due to not recognizing the
6033 # link as an internal one. This one checks for the correct behavior.
6034 !! test
6035 Link to namespace preferred over interwiki with correct rel attribute
6036 !! options
6037 parsoid=html2wt,html2html
6038 !! wikitext
6039 [[MemoryAlpha:AlphaTest]]
6040 !! html
6041 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6042 </p>
6043 !! end
6044
6045 !! test
6046 Piped link to namespace
6047 !! wikitext
6048 [[Meta:Disclaimers|The disclaimers]]
6049 !! html
6050 <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>
6051 </p>
6052 !! end
6053
6054 !! test
6055 Link containing }
6056 !! wikitext
6057 [[Usually caused by a typo (oops}]]
6058 !! html
6059 <p>[[Usually caused by a typo (oops}]]
6060 </p>
6061 !! end
6062
6063 !! article
6064 7% Solution
6065 !! text
6066 Just a test of an article title containing a percent.
6067 !! endarticle
6068
6069 !! test
6070 Link containing % (not as a hex sequence)
6071 !! wikitext
6072 [[7% Solution]]
6073 !! html/php
6074 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6075 </p>
6076 !! html/parsoid
6077 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6078 !! end
6079
6080 # note that the parsoid HTML is identical to the previous test output,
6081 # so the previous test ensures that the html2wt mode will generate the
6082 # "not as a hex sequence" wikitext.
6083 !! test
6084 Link containing % as a single hex sequence interpreted to char
6085 !! options
6086 parsoid=wt2wt,wt2html,html2html
6087 !! wikitext
6088 [[7%25 Solution]]
6089 !! html/php
6090 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6091 </p>
6092 !! html/parsoid
6093 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6094 !!end
6095
6096 !! test
6097 Link containing % as a double hex sequence interpreted to hex sequence
6098 !! wikitext
6099 [[7%2525 Solution]]
6100 !! html
6101 <p>[[7%2525 Solution]]
6102 </p>
6103 !!end
6104
6105 # note that parsoid does not munge anchor text; all non-space
6106 # characters are valid in HTML5 anchors.
6107 !! test
6108 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6109 Example for such a section: == < ==
6110 !! wikitext
6111 [[%23%3c]][[%23%3e]]
6112 !! html/php
6113 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6114 </p>
6115 !! html/parsoid
6116 <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>
6117 !! end
6118
6119 !! test
6120 Link containing "<#" and ">#" as a hex sequences
6121 !! wikitext
6122 [[%3c%23]][[%3e%23]]
6123 !! html
6124 <p>[[%3c%23]][[%3e%23]]
6125 </p>
6126 !! end
6127
6128 !! test
6129 Link containing an equals sign
6130 !! wikitext
6131 [[Special:BookSources/isbn=4-00-026157-6]]
6132 !! html/php
6133 <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>
6134 </p>
6135 !! html/parsoid
6136 <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>
6137 !! end
6138
6139 !! article
6140 Foo~bar
6141 !! text
6142 Just a test of an article title containing a tilde.
6143 !! endarticle
6144
6145 # note that links containing signatures, like [[Foo~~~~]], are
6146 # massaged by the pre-save transform (PST) and so the tildes are never
6147 # seen by the parser.
6148 !! test
6149 Link containing a tilde
6150 !! wikitext
6151 [[Foo~bar]]
6152 !! html/php
6153 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6154 </p>
6155 !! html/parsoid
6156 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6157 !! end
6158
6159 !! test
6160 Link containing double-single-quotes '' (bug 4598)
6161 !! wikitext
6162 [[Lista d''e paise d''o munno]]
6163 !! html/php
6164 <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>
6165 </p>
6166 !! html/parsoid
6167 <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>
6168 !! end
6169
6170 !! test
6171 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6172 !! wikitext
6173 Some [[Link|pretty ''italics'' and stuff]]!
6174 !! html/php
6175 <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>!
6176 </p>
6177 !! html/parsoid
6178 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6179 !! end
6180
6181 !! test
6182 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6183 !! wikitext
6184 ''Some [[Link|pretty ''italics'' and stuff]]!''
6185 !! html
6186 <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>
6187 </p>
6188 !! end
6189
6190 !! test
6191 Link with double quotes in title part (literal) and alternate part (interpreted)
6192 !! wikitext
6193 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6194
6195 [[''Pentecoste'']]
6196
6197 [[''Pentecoste''|Pentecoste]]
6198
6199 [[''Pentecoste''|''Pentecoste'']]
6200 !! html/php
6201 <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>
6202 </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>
6203 </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>
6204 </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>
6205 </p>
6206 !! html/parsoid
6207 <meta typeof="mw:Placeholder"/>
6208 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6209 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6210 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6211 !! end
6212
6213 !! test
6214 Broken image links with HTML captions (bug 39700)
6215 !! wikitext
6216 [[File:Nonexistent|<script></script>]]
6217 [[File:Nonexistent|100px|<script></script>]]
6218 [[File:Nonexistent|&lt;]]
6219 [[File:Nonexistent|a<i>b</i>c]]
6220 !! html
6221 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6222 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6223 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6224 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6225 </p>
6226 !! end
6227
6228 !! test
6229 Plain link to URL
6230 !! wikitext
6231 [[http://www.example.com]]
6232 !! html/php
6233 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6234 </p>
6235 !! html/parsoid
6236 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6237 !! end
6238
6239 !! test
6240 Plain link to URL with link text
6241 !! wikitext
6242 [[http://www.example.com Link text]]
6243 !! html
6244 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6245 </p>
6246 !! end
6247
6248 !! test
6249 Plain link to protocol-relative URL
6250 !! wikitext
6251 [[//www.example.com]]
6252 !! html/php
6253 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6254 </p>
6255 !! html/parsoid
6256 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6257 !! end
6258
6259 !! test
6260 Plain link to protocol-relative URL with link text
6261 !! wikitext
6262 [[//www.example.com Link text]]
6263 !! html
6264 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6265 </p>
6266 !! end
6267
6268 !! test
6269 Plain link to page with question mark in title
6270 !! wikitext
6271 [[A?b]]
6272
6273 [[A?b|Baz]]
6274 !! html
6275 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6276 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6277 </p>
6278 !! end
6279
6280
6281 # I'm fairly sure the expected result here is wrong.
6282 # We want these to be URL links, not pseudo-pages with URLs for titles....
6283 # However the current output is also pretty screwy.
6284 #
6285 # ----
6286 # I'm changing it to match the current output--it arguably makes more
6287 # sense in the light of the test above. Old expected result was:
6288 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6289 #</p>
6290 # But I think this test is bordering on "garbage in, garbage out" anyway.
6291 # -- wtm
6292 !! test
6293 Piped link to URL
6294 !! wikitext
6295 Piped link to URL: [[http://www.example.com|an example URL]]
6296 !! html/php
6297 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6298 </p>
6299 !! html/parsoid
6300 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6301 !! end
6302
6303 !! test
6304 BUG 2: [[page|http://url/]] should link to page, not http://url/
6305 !! wikitext
6306 [[Main Page|http://url/]]
6307 !! html/php
6308 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6309 </p>
6310 !! html/parsoid
6311 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6312 !! end
6313
6314 # Parsoid does not mark self-links, by design.
6315 !! test
6316 BUG 337: Escaped self-links should be bold
6317 !! options
6318 title=[[Bug462]]
6319 !! wikitext
6320 [[Bu&#103;462]] [[Bug462]]
6321 !! html/php
6322 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6323 </p>
6324 !! html/php+tidy
6325 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6326 !! html/parsoid
6327 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6328 !! end
6329
6330 !! test
6331 Self-link to section should not be bold
6332 !! options
6333 title=[[Main Page]]
6334 !! wikitext
6335 [[Main Page#section]]
6336 !! html
6337 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6338 </p>
6339 !! end
6340
6341 !! article
6342 00
6343 !! text
6344 This is 00.
6345 !! endarticle
6346
6347 !!test
6348 Self-link to numeric title
6349 !!options
6350 title=[[0]]
6351 !! wikitext
6352 [[0]]
6353 !! html
6354 <p><strong class="selflink">0</strong>
6355 </p>
6356 !!end
6357
6358 !!test
6359 Link to numeric-equivalent title
6360 !!options
6361 title=[[0]]
6362 !! wikitext
6363 [[00]]
6364 !! html
6365 <p><a href="/wiki/00" title="00">00</a>
6366 </p>
6367 !!end
6368
6369 !! test
6370 <nowiki> inside a link
6371 !! wikitext
6372 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6373 !! html
6374 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6375 </p>
6376 !! end
6377
6378 !! test
6379 Non-breaking spaces in title
6380 !! wikitext
6381 [[&nbsp; Main &nbsp; Page &nbsp;]]
6382 !! html
6383 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6384 </p>
6385 !!end
6386
6387 !! test
6388 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6389 !! options
6390 language=ca
6391 !! wikitext
6392 '''[[Main Page]]'''
6393 !! html
6394 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6395 </p>
6396 !! end
6397
6398 !! test
6399 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6400 !! options
6401 language=ca
6402 !! wikitext
6403 ''[[Main Page]]''
6404 !! html
6405 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6406 </p>
6407 !! end
6408
6409 !! test
6410 Internal link with en linktrail: no apostrophes (bug 27473)
6411 !! options
6412 language=en
6413 !! wikitext
6414 [[Something]]'nice
6415 !! html
6416 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6417 </p>
6418 !! end
6419
6420 !! test
6421 Internal link with ca linktrail with apostrophes (bug 27473)
6422 !! options
6423 language=ca
6424 !! wikitext
6425 [[Something]]'nice
6426 !! html
6427 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6428 </p>
6429 !! end
6430
6431 !! test
6432 Internal link with kaa linktrail with apostrophes (bug 27473)
6433 !! options
6434 language=kaa
6435 !! wikitext
6436 [[Something]]'nice
6437 !! html
6438 <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>
6439 </p>
6440 !! end
6441
6442 !! test
6443 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6444 !! wikitext
6445 [[User:Foo/Test/63636:Bar|Test]]
6446 !! html/php
6447 <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>
6448 </p>
6449 !! html/parsoid
6450 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6451 !! end
6452
6453 !! test
6454 Purely hash wikilink
6455 !! options
6456 title=[[User:test/123]]
6457 !! wikitext
6458 [[#a|b]]
6459 !! html/php
6460 <p><a href="#a">b</a>
6461 </p>
6462 !! html/parsoid
6463 <p data-parsoid='{}'><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>
6464 !! end
6465
6466 !! test
6467 1. Interaction of linktrail and template encapsulation
6468 !! options
6469 parsoid
6470 !! wikitext
6471 {{echo|[[Foo]]}}l
6472 !! html
6473 <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>
6474 !! end
6475
6476 !! test
6477 2. Interaction of linktrail and template encapsulation
6478 !! options
6479 parsoid
6480 !! wikitext
6481 {{echo|Some [[Fool]]}}s
6482 !! html
6483 <p data-parsoid='{}'><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>
6484 !! end
6485
6486 !! test
6487 3. Interaction of linktrail and template encapsulation
6488 !! options
6489 parsoid
6490 !! wikitext
6491 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6492 !! html
6493 <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 data-parsoid="{}">bold and foolish</b></p>
6494 !! end
6495
6496 !! article
6497 Söfnuður
6498 !! text
6499 Test.
6500 !! endarticle
6501
6502 !! test
6503 Internal link with is link prefix
6504 !! options
6505 language=is
6506 !! wikitext
6507 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6508 !! html
6509 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6510 </p>
6511 !! end
6512
6513 !! article
6514 Mótmælendatrú
6515 !! text
6516 Test.
6517 !! endarticle
6518
6519 !! test
6520 Internal link with is link trail and link prefix
6521 !! options
6522 language=is
6523 !! wikitext
6524 [[mótmælendatrú|xxx]]ar
6525 [[mótmælendatrú]]ar
6526 mótmælenda[[söfnuður]]
6527 mótmælenda[[söfnuður|söfnuðir]]
6528 mótmælenda[[söfnuður|söfnuðir]]xxx
6529 !! html
6530 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6531 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6532 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6533 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6534 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6535 </p>
6536 !! end
6537
6538 !! test
6539 Parsoid link trail escaping
6540 !! options
6541 parsoid=html2wt,html2html
6542 !! wikitext
6543 [[apple]]<nowiki/>s
6544 !! html
6545 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6546 !! end
6547
6548 !! test
6549 Parsoid link prefix escaping
6550 !! options
6551 language=is
6552 parsoid=html2wt,html2html
6553 !! wikitext
6554 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6555 !! html
6556 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6557 !! end
6558
6559 !! test
6560 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6561 !! wikitext
6562 [[Foo| bar]]
6563
6564 [[Foo| ''bar'']]
6565
6566 [http://wp.org foo]
6567
6568 [http://wp.org ''foo'']
6569 !! html
6570 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6571 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6572 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6573 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6574 </p>
6575 !! end
6576
6577 !! test
6578 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6579 !! options
6580 parsoid
6581 !! wikitext
6582 [[Foo|{{echo|a}} b {{echo|c}}]]
6583 !! html
6584 <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>
6585 !! end
6586
6587 !! test
6588 Link with angle bracket after anchor
6589 !! wikitext
6590 [[Foo#<bar>]]
6591 !! html/php
6592 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6593 </p>
6594 !! html/parsoid
6595 <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>
6596 !! end
6597
6598 ###
6599 ### Interwiki links (see maintenance/interwiki.sql)
6600 ###
6601
6602 !! test
6603 Inline interwiki link
6604 !! wikitext
6605 [[MeatBall:SoftSecurity]]
6606 !! html
6607 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6608 </p>
6609 !! end
6610
6611 !! test
6612 Inline interwiki link with empty title (bug 2372)
6613 !! wikitext
6614 [[MeatBall:]]
6615 !! html
6616 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6617 </p>
6618 !! end
6619
6620 !! test
6621 Interwiki link encoding conversion (bug 1636)
6622 !! wikitext
6623 *[[Wikipedia:ro:Olteni&#0355;a]]
6624 *[[Wikipedia:ro:Olteni&#355;a]]
6625 !! html
6626 <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>
6627 <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>
6628
6629 !! html+tidy
6630 <ul>
6631 <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>
6632 <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>
6633 </ul>
6634 !! end
6635
6636 !! test
6637 Interwiki link with fragment (bug 2130)
6638 !! wikitext
6639 [[MeatBall:SoftSecurity#foo]]
6640 !! html
6641 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6642 </p>
6643 !! end
6644
6645 # Ideally the wikipedia: prefix here should be proto-relative too
6646 !! test
6647 Different interwiki prefixes mapping to the same URL
6648 !! wikitext
6649 [[:en:Foo]]
6650
6651 [[:en:Foo|Foo]]
6652
6653 [[wikipedia:Foo]]
6654
6655 [[:wikipedia:Foo|Foo]]
6656
6657 [[wikipedia:en:Foo]]
6658
6659 [[:wikipedia:en:Foo]]
6660
6661 [[ wikiPEdia :Foo]]
6662 !! html/parsoid
6663 <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}'>en:Foo</a></p>
6664
6665 <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}'>Foo</a></p>
6666
6667 <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}'>wikipedia:Foo</a></p>
6668
6669 <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}'>Foo</a></p>
6670
6671 <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}'>wikipedia:en:Foo</a></p>
6672
6673 <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}'>wikipedia:en:Foo</a></p>
6674
6675 <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}'> wikiPEdia :Foo</a></p>
6676 !! end
6677
6678 !! test
6679 Interwiki links that cannot be represented in wiki syntax
6680 !! wikitext
6681 [[meatball:ok]]
6682 [[meatball:ok#foo|ok with fragment]]
6683 [[meatball:ok_as_well?|ok ending with ? mark]]
6684 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6685 [http://de.wikipedia.org/wiki/#foo is just fragment]
6686
6687 !! html/parsoid
6688 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6689 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6690 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6691 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6692 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6693 !! end
6694
6695 !! test
6696 Interwiki links: trail
6697 !! options
6698 parsoid
6699 !! wikitext
6700 [[wikipedia:Foo|Ba]]r
6701 !! html
6702 <p data-parsoid='{}'><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"}'>Bar</a></p>
6703 !! end
6704
6705 !! test
6706 Local interwiki link
6707 !! wikitext
6708 [[local:Template:Foo]]
6709 !! html
6710 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6711 </p>
6712 !! end
6713
6714 !! test
6715 Local interwiki link: self-link to current page
6716 !! options
6717 title=[[Main Page]]
6718 !! wikitext
6719 [[local:Main Page]]
6720 !! html
6721 <p><strong class="selflink">local:Main Page</strong>
6722 </p>
6723 !! end
6724
6725 !! test
6726 Local interwiki link: prefix only (bug 64167)
6727 !! wikitext
6728 [[local:]]
6729 !! html
6730 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6731 </p>
6732 !! end
6733
6734 !! test
6735 Local interwiki link: with additional interwiki prefix (bug 61357)
6736 !! wikitext
6737 [[local:meatball:Hello]]
6738 !! html
6739 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6740 </p>
6741 !! end
6742
6743 ###
6744 ### Interlanguage links
6745 ### Language links (so that searching for '### language' matches..)
6746 ###
6747
6748 !! test
6749 Interlanguage link
6750 !! wikitext
6751 Blah blah blah
6752 [[zh:Chinese]]
6753 !! html/php
6754 <p>Blah blah blah
6755 </p>
6756 !! html/parsoid
6757 <p>Blah blah blah
6758 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6759 !! end
6760
6761 !! test
6762 Interlanguage link with spacing
6763 !! wikitext
6764 Blah blah blah
6765 [[ zh : Chinese ]]
6766 !! html/php
6767 <p>Blah blah blah
6768 </p>
6769 !! html/parsoid
6770 <p>Blah blah blah
6771 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6772 !! end
6773
6774 !! test
6775 Double interlanguage link
6776 !! wikitext
6777 Blah blah blah
6778 [[es:Spanish]]
6779 [[zh:Chinese]]
6780 !! html/php
6781 <p>Blah blah blah
6782 </p>
6783 !! html/parsoid
6784 <p>Blah blah blah
6785 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6786 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6787 !! end
6788
6789 !! test
6790 Interlanguage link variations
6791 !! wikitext
6792 Blah blah blah
6793 [[ es :Spanish]]
6794 [[ ZH :Chinese]]
6795 !! html/php
6796 <p>Blah blah blah
6797 </p>
6798 !! html/parsoid
6799 <p>Blah blah blah
6800 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish" data-parsoid='{"stx":"simple","a":{"href":"//es.wikipedia.org/wiki/Spanish"},"sa":{"href":" es :Spanish"}}'/>
6801 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese" data-parsoid='{"stx":"simple","a":{"href":"//zh.wikipedia.org/wiki/Chinese"},"sa":{"href":" ZH :Chinese"}}'/>
6802 !! end
6803
6804 !! test
6805 Interlanguage link, with prefix links
6806 !! options
6807 language=ln
6808 !! wikitext
6809 Blah blah blah
6810 [[zh:Chinese]]
6811 !! html/php
6812 <p>Blah blah blah
6813 </p>
6814 !! html/parsoid
6815 <p>Blah blah blah
6816 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6817 !! end
6818
6819 !! test
6820 Double interlanguage link, with prefix links (bug 8897)
6821 !! options
6822 language=ln
6823 !! wikitext
6824 Blah blah blah
6825 [[es:Spanish]]
6826 [[zh:Chinese]]
6827 !! html/php
6828 <p>Blah blah blah
6829 </p>
6830 !! html/parsoid
6831 <p>Blah blah blah
6832 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6833 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6834 !! end
6835
6836 !! test
6837 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6838 !! wikitext
6839 Blah blah blah
6840 [[mul:Article]]
6841 !! html/php
6842 <p>Blah blah blah
6843 </p>
6844 !! html/parsoid
6845 <p>Blah blah blah
6846 <link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p>
6847 !! end
6848
6849 !! test
6850 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6851 !! options
6852 language=ln
6853 !! wikitext
6854 [[WW&nbsp;II]]
6855 !! html
6856 <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>
6857 </p>
6858 !! end
6859
6860 !! test
6861 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6862 !! options
6863 parsoid=html2wt
6864 !! wikitext
6865 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6866
6867 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6868 !! html
6869 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6870 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6871 !! end
6872
6873 !! test
6874 Parsoid: handle constructor well
6875 !! options
6876 parsoid
6877 !! wikitext
6878 [[constructor]]
6879
6880 [[constructor:foo]]
6881 !! html
6882 <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>
6883
6884 <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>
6885 !! end
6886
6887 !! test
6888 Parsoid: recognize interlanguage links without a target page
6889 !! options
6890 parsoid
6891 !! wikitext
6892 [[ko:]]
6893 !! html
6894 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6895 !! end
6896
6897 !! test
6898 Parsoid: recognize interwiki links without a target page
6899 !! options
6900 parsoid
6901 !! wikitext
6902 [[:ko:]]
6903 !! html
6904 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6905 !! end
6906
6907 !! test
6908 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6909 !! options
6910 parsoid
6911 !! wikitext
6912 [[en:Foo]]
6913 !! html
6914 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6915 !! end
6916
6917 !! test
6918 Interlanguage link with preceding local interwiki link (bug 68085)
6919 !! wikitext
6920 Blah blah blah
6921 [[local:es:Spanish]]
6922 !! html
6923 <p>Blah blah blah
6924 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
6925 </p>
6926 !! end
6927
6928 !! test
6929 Looks like an interlanguage link, but is actually a local interwiki
6930 !! wikitext
6931 Blah blah blah
6932 [[mi:Template:Foo]]
6933 !! html
6934 <p>Blah blah blah
6935 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
6936 </p>
6937 !! end
6938
6939 ###
6940 ### Redirects, Parsoid-only
6941 ###
6942 !! test
6943 1. Simple redirect to page
6944 !! options
6945 parsoid
6946 !! wikitext
6947 #REDIRECT [[Main Page]]
6948 !! html
6949 <link rel="mw:PageProp/redirect" href="./Main_Page">
6950 !! end
6951
6952 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6953 !! test
6954 2. Other redirect variants
6955 !! options
6956 parsoid=wt2html,wt2wt
6957 !! wikitext
6958 #REDIRECT [[Main_Page]]
6959 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6960 !! html
6961 <link rel="mw:PageProp/redirect" href="./Main_Page">
6962 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6963 !! end
6964
6965 !! test
6966 Empty redirect
6967 !! options
6968 parsoid=wt2html,wt2wt
6969 !! wikitext
6970 #REDIRECT [[]]
6971 !! html
6972 <ol>
6973 <li>REDIRECT [[]]</li></ol>
6974 !! end
6975
6976 !! test
6977 Optional colon in #REDIRECT
6978 !! options
6979 # the colon is archaic syntax. we support it for wt2html, but we
6980 # don't care that it roundtrips back to the modern syntax.
6981 parsoid=wt2html,html2html
6982 !! wikitext
6983 #REDIRECT:[[Main Page]]
6984 !! html
6985 <link rel="mw:PageProp/redirect" href="./Main_Page">
6986 !! end
6987
6988 !! test
6989 Whitespace in #REDIRECT with optional colon
6990 !! options
6991 # the colon and gratuitous whitespace is archaic syntax. we support
6992 # it for wt2html, but we don't care that it roundtrips back to the
6993 # modern syntax (without extra whitespace)
6994 parsoid=wt2html,html2html
6995 !! wikitext
6996
6997 #REDIRECT
6998 :
6999 [[Main Page]]
7000 !! html
7001 <link rel="mw:PageProp/redirect" href="./Main_Page">
7002 !! end
7003
7004 !! test
7005 Piped link in #REDIRECT
7006 !! options
7007 # content after piped link is ignored. we support this syntax,
7008 # but don't care that the piped link is lost when we roundtrip this.
7009 parsoid=wt2html
7010 !! wikitext
7011 #REDIRECT [[Main Page|bar]]
7012 !! html
7013 <link rel="mw:PageProp/redirect" href="./Main_Page">
7014 !! end
7015
7016 !! test
7017 Redirect to category
7018 !! options
7019 parsoid=wt2html
7020 !! wikitext
7021 #REDIRECT [[Category:Foo]]
7022 !! html
7023 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7024 !! end
7025
7026 !! test
7027 Redirect to category with URL encoding
7028 !! options
7029 parsoid=wt2html
7030 !! wikitext
7031 #REDIRECT [[Category%3AFoo]]
7032 !! html
7033 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7034 !! end
7035
7036 !! test
7037 Redirect to category page
7038 !! options
7039 parsoid=wt2html,html2html
7040 !! wikitext
7041 #REDIRECT [[:Category:Foo]]
7042 !! html
7043 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7044 !! end
7045
7046 !! test
7047 Redirect to image page (1)
7048 !! options
7049 parsoid
7050 !! wikitext
7051 #REDIRECT [[File:Wiki.png]]
7052 !! html
7053 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7054 !! end
7055
7056 !! test
7057 Redirect to image page (2)
7058 !! options
7059 parsoid
7060 !! wikitext
7061 #REDIRECT [[Image:Wiki.png]]
7062 !! html
7063 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7064 !! end
7065
7066 !! test
7067 Redirect to language
7068 !! options
7069 parsoid
7070 !! wikitext
7071 #REDIRECT [[en:File:Wiki.png]]
7072 !! html
7073 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7074 !! end
7075
7076 !! test
7077 Redirect to interwiki
7078 !! options
7079 parsoid
7080 !! wikitext
7081 #REDIRECT [[meatball:File:Wiki.png]]
7082 !! html
7083 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7084 !! end
7085
7086 !! test
7087 Non-English #REDIRECT
7088 !! options
7089 parsoid
7090 language=is
7091 !! wikitext
7092 #TILVÍSUN [[Main Page]]
7093 !! html
7094 <link rel="mw:PageProp/redirect" href="./Main_Page">
7095 !! end
7096
7097 !! test
7098 New redirect
7099 !! options
7100 parsoid=html2wt
7101 !! wikitext
7102 Foo
7103 #REDIRECT [[Foo]]
7104 !! html
7105 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7106 !! end
7107
7108 ##
7109 ## XHTML tidiness
7110 ###
7111
7112 !! test
7113 <br> to <br />
7114 !! wikitext
7115 1<br>2<br />3
7116 !! html
7117 <p>1<br />2<br />3
7118 </p>
7119 !! end
7120
7121 !! test
7122 Broken br tag sanitization
7123 !! wikitext
7124 </br>
7125 !! html/php
7126 <p>&lt;/br&gt;
7127 </p>
7128 !! end
7129
7130 # TODO: Fix html2html mode (bug 51055)!
7131 # This </br> handling was added as part of bug 50831; but it
7132 # differs from how PHP+tidy handles this. We should investigate
7133 # this.
7134 !! test
7135 Parsoid: Broken br tag recognition
7136 !! options
7137 parsoid=wt2html
7138 !! wikitext
7139 </br>
7140
7141 <br/ >
7142 !! html/php+tidy
7143 <p>&lt;/br&gt;</p>
7144 <p><br /></p>
7145 !! html/parsoid
7146 <p><br></p>
7147 <p><br/></p>
7148 !! end
7149
7150 !! test
7151 Incorrecly removing closing slashes from correctly formed XHTML
7152 !! wikitext
7153 <br style="clear:both;" />
7154 !! html
7155 <p><br style="clear:both;" />
7156 </p>
7157 !! end
7158
7159 !! test
7160 Failing to transform badly formed HTML into correct XHTML
7161 !! wikitext
7162 <br style="clear: left;">
7163 <br style="clear: right;">
7164 <br style="clear: both;">
7165 !! html
7166 <p><br style="clear: left;" />
7167 <br style="clear: right;" />
7168 <br style="clear: both;" />
7169 </p>
7170 !!end
7171
7172 !! test
7173 Handling html with a div self-closing tag
7174 !! wikitext
7175 <div title />
7176 <div title/>
7177 <div title/ >
7178 <div title=bar />
7179 <div title=bar/>
7180 <div title=bar/ >
7181 !! html
7182 <p>&lt;div title /&gt;
7183 &lt;div title/&gt;
7184 </p>
7185 <div>
7186 <p>&lt;div title=bar /&gt;
7187 &lt;div title=bar/&gt;
7188 </p>
7189 <div title="bar/"></div>
7190 </div>
7191
7192 !! end
7193
7194 !! test
7195 Handling html with a br self-closing tag
7196 !! wikitext
7197 <br title />
7198 <br title/>
7199 <br title/ >
7200 <br title=bar />
7201 <br title=bar/>
7202 <br title=bar/ >
7203 !! html/php
7204 <p><br title="title" />
7205 <br title="title" />
7206 <br />
7207 <br title="bar" />
7208 <br title="bar" />
7209 <br title="bar/" />
7210 </p>
7211 !! html/parsoid
7212 <p><br title="" />
7213 <br title="" />
7214 <br />
7215 <br title="bar" />
7216 <br title="bar" />
7217 <br title="bar/" />
7218 </p>
7219 !! end
7220
7221 !! test
7222 Horizontal ruler (should it add that extra space?)
7223 !! wikitext
7224 <hr>
7225 <hr >
7226 foo <hr
7227 > bar
7228 !! html
7229 <hr />
7230 <hr />
7231 foo <hr /> bar
7232
7233 !! end
7234
7235 !! test
7236 Horizontal ruler -- 4+ dashes render hr
7237 !! wikitext
7238 ----
7239 !! html
7240 <hr />
7241
7242 !! end
7243
7244 !! test
7245 Horizontal ruler -- eats additional dashes on the same line
7246 !! wikitext
7247 ---------
7248 !! html
7249 <hr />
7250
7251 !! end
7252
7253 !! test
7254 Horizontal ruler -- does not collapse dashes on consecutive lines
7255 !! wikitext
7256 ----
7257 ----
7258 !! html
7259 <hr />
7260 <hr />
7261
7262 !! end
7263
7264 !! test
7265 Horizontal ruler -- <4 dashes render as plain text
7266 !! wikitext
7267 ---
7268 !! html
7269 <p>---
7270 </p>
7271 !! end
7272
7273 !! test
7274 Horizontal ruler -- Supports content following dashes on same line
7275 !! wikitext
7276 ---- Foo
7277 !! html
7278 <hr /> Foo
7279
7280 !! html+tidy
7281 <hr />
7282 <p>Foo</p>
7283 !! end
7284
7285 ###
7286 ### Block-level elements
7287 ###
7288 !! test
7289 Common list
7290 !! wikitext
7291 *Common list
7292 * item 2
7293 *item 3
7294 !! html
7295 <ul><li>Common list</li>
7296 <li> item 2</li>
7297 <li>item 3</li></ul>
7298
7299 !! end
7300
7301 !! test
7302 Numbered list
7303 !! wikitext
7304 #Numbered list
7305 #item 2
7306 # item 3
7307 !! html
7308 <ol><li>Numbered list</li>
7309 <li>item 2</li>
7310 <li> item 3</li></ol>
7311
7312 !! end
7313
7314 !! test
7315 Mixed list
7316 !! wikitext
7317 *Mixed list
7318 *# with numbers
7319 ** and bullets
7320 *# and numbers
7321 *bullets again
7322 **bullet level 2
7323 ***bullet level 3
7324 ***#Number on level 4
7325 **bullet level 2
7326 **#Number on level 3
7327 **#Number on level 3
7328 *#number level 2
7329 *Level 1
7330 *** Level 3
7331 #** Level 3, but ordered
7332 !! html
7333 <ul><li>Mixed list
7334 <ol><li> with numbers</li></ol>
7335 <ul><li> and bullets</li></ul>
7336 <ol><li> and numbers</li></ol></li>
7337 <li>bullets again
7338 <ul><li>bullet level 2
7339 <ul><li>bullet level 3
7340 <ol><li>Number on level 4</li></ol></li></ul></li>
7341 <li>bullet level 2
7342 <ol><li>Number on level 3</li>
7343 <li>Number on level 3</li></ol></li></ul>
7344 <ol><li>number level 2</li></ol></li>
7345 <li>Level 1
7346 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7347 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7348
7349 !! end
7350
7351 !! test
7352 Nested lists 1
7353 !! wikitext
7354 *foo
7355 **bar
7356 !! html
7357 <ul><li>foo
7358 <ul><li>bar</li></ul></li></ul>
7359
7360 !! end
7361
7362 !! test
7363 Nested lists 2
7364 !! wikitext
7365 **foo
7366 *bar
7367 !! html
7368 <ul><li><ul><li>foo</li></ul></li>
7369 <li>bar</li></ul>
7370
7371 !! end
7372
7373 !! test
7374 Nested lists 3 (first element empty)
7375 !! wikitext
7376 *
7377 **bar
7378 !! html
7379 <ul><li>
7380 <ul><li>bar</li></ul></li></ul>
7381
7382 !! end
7383
7384 !! test
7385 Nested lists 4 (first element empty)
7386 !! wikitext
7387 **
7388 *bar
7389 !! html
7390 <ul><li><ul><li></li></ul></li>
7391 <li>bar</li></ul>
7392
7393 !! end
7394
7395 !! test
7396 Nested lists 5 (both elements empty)
7397 !! wikitext
7398 **
7399 *
7400 !! html
7401 <ul><li><ul><li></li></ul></li>
7402 <li></li></ul>
7403
7404 !! end
7405
7406 !! test
7407 Nested lists 6 (both elements empty)
7408 !! wikitext
7409 *
7410 **
7411 !! html
7412 <ul><li>
7413 <ul><li></li></ul></li></ul>
7414
7415 !! end
7416
7417 !! test
7418 Nested lists 7 (skip initial nesting levels)
7419 !! wikitext
7420 *** foo
7421 !! html
7422 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7423
7424 !! end
7425
7426 !! test
7427 Nested lists 8 (multiple nesting transitions)
7428 !! wikitext
7429 * foo
7430 *** bar
7431 ** baz
7432 * boo
7433 !! html
7434 <ul><li> foo
7435 <ul><li><ul><li> bar</li></ul></li>
7436 <li> baz</li></ul></li>
7437 <li> boo</li></ul>
7438
7439 !! end
7440
7441 !! test
7442 1. Lists with start-of-line-transparent tokens before bullets: Comments
7443 !! wikitext
7444 *foo
7445 *<!--cmt-->bar
7446 <!--cmt-->*baz
7447 !! html
7448 <ul><li>foo</li>
7449 <li>bar</li>
7450 <li>baz</li></ul>
7451
7452 !! end
7453
7454 !! test
7455 2. Lists with start-of-line-transparent tokens before bullets: Template close
7456 !! wikitext
7457 *foo {{echo|bar
7458 }}*baz
7459 !! html
7460 <ul><li>foo bar</li>
7461 <li>baz</li></ul>
7462
7463 !! end
7464
7465 !! test
7466 List items are not parsed correctly following a <pre> block (bug 785)
7467 !! wikitext
7468 * <pre>foo</pre>
7469 * <pre>bar</pre>
7470 * zar
7471 !! html
7472 <ul><li> <pre>foo</pre></li>
7473 <li> <pre>bar</pre></li>
7474 <li> zar</li></ul>
7475
7476 !! end
7477
7478 !! test
7479 List items from template
7480 !! wikitext
7481
7482 {{inner list}}
7483 * item 2
7484
7485 * item 0
7486 {{inner list}}
7487 * item 2
7488
7489 * item 0
7490 * notSOL{{inner list}}
7491 * item 2
7492 !! html
7493 <ul><li> item 1</li>
7494 <li> item 2</li></ul>
7495 <ul><li> item 0</li>
7496 <li> item 1</li>
7497 <li> item 2</li></ul>
7498 <ul><li> item 0</li>
7499 <li> notSOL</li>
7500 <li> item 1</li>
7501 <li> item 2</li></ul>
7502
7503 !! end
7504
7505 !! test
7506 List interrupted by empty line or heading
7507 !! wikitext
7508 * foo
7509
7510 ** bar
7511 == A heading ==
7512 * Another list item
7513 !! html
7514 <ul><li> foo</li></ul>
7515 <ul><li><ul><li> bar</li></ul></li></ul>
7516 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
7517 <ul><li> Another list item</li></ul>
7518
7519 !!end
7520
7521 !!test
7522 Multiple list tags generated by templates
7523 !! wikitext
7524 {{echo|<li>}}a
7525 {{echo|<li>}}b
7526 {{echo|<li>}}c
7527 !! html
7528 <li>a
7529 <li>b
7530 <li>c</li>
7531 </li>
7532 </li>
7533
7534 !! html+tidy
7535 <ul>
7536 <li>a</li>
7537 <li>b</li>
7538 <li>c</li>
7539 </ul>
7540 !!end
7541
7542 !!test
7543 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7544 !! wikitext
7545 *a
7546 <!--This line will NOT split the list-->
7547 *b
7548 <!--This line will NOT split the list either-->
7549 *c
7550 <!--foo--> <!----> <!--This line NOT split the list either-->
7551 *d
7552 !! html
7553 <ul><li>a</li>
7554 <li>b</li>
7555 <li>c</li>
7556 <li>d</li></ul>
7557
7558 !!end
7559
7560 !!test
7561 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7562 !! wikitext
7563 *a
7564 <!--This line will NOT split the list-->
7565 *b
7566 <!--This line will NOT split the list either-->
7567 *c
7568 <!--foo--> <!----> <!--This line NOT split the list
7569 either-->
7570 *d
7571 !! html
7572 <ul><li>a</li>
7573 <li>b</li>
7574 <li>c</li>
7575 <li>d</li></ul>
7576
7577 !!end
7578
7579 !!test
7580 Test the li-hack
7581 (The PHP parser relies on Tidy for the hack)
7582 !!options
7583 parsoid=wt2html,wt2wt
7584 !! wikitext
7585 * foo
7586 * <li>li-hack
7587 * {{echo|<li>templated li-hack}}
7588 * <!--foo--> <li> unsupported li-hack with preceding comments
7589
7590 <ul>
7591 <li><li>not a li-hack
7592 </li>
7593 </ul>
7594 !! html+tidy
7595 <ul>
7596 <li>foo</li>
7597 <li>li-hack</li>
7598 <li>templated li-hack</li>
7599 <li>unsupported li-hack with preceding comments</li>
7600 </ul>
7601 <ul>
7602 <li>not a li-hack</li>
7603 </ul>
7604 !!end
7605
7606 !! test
7607 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7608 !! options
7609 parsoid
7610 !! wikitext
7611 # foo
7612 ## bar
7613 * foo
7614 ** bar
7615 : foo
7616 :: bar
7617 !! html
7618 <ol>
7619 <li> foo<ol>
7620 <li> bar</li>
7621 </ol></li>
7622 </ol><ul>
7623 <li> foo<ul>
7624 <li> bar</li>
7625 </ul></li>
7626 </ul><dl>
7627 <dd> foo<dl>
7628 <dd> bar</dd>
7629 </dl></dd>
7630 </dl>
7631 !! end
7632
7633 !! test
7634 Parsoid: Test of whitespace serialization with Templated bullets
7635 !! options
7636 parsoid
7637 !! wikitext
7638 * {{bullet}}
7639 !! html
7640 <ul>
7641 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7642 </ul>
7643 !! end
7644
7645 # ------------------------------------------------------------------------
7646 # The next set of tests are about Parsoid's ability to handle badly nested
7647 # tags (parse, minimize scope of fixup, and roundtrip back)
7648 # ------------------------------------------------------------------------
7649
7650 !! test
7651 Unbalanced closing block tags break a list
7652 (php parser relies on Tidy to fix up)
7653 !! wikitext
7654 <div>
7655 *a</div><div>
7656 *b</div>
7657 !! html+tidy
7658 <div>
7659 <ul>
7660 <li>a</li>
7661 </ul>
7662 </div>
7663 <div>
7664 <ul>
7665 <li>b</li>
7666 </ul>
7667 </div>
7668 !! end
7669
7670 # Parsoid fails this test, but it might be tricky to support properly.
7671 # See bug 68395.
7672 !! test
7673 Unbalanced closing non-block tags don't break a list
7674 (php parser relies on Tidy to fix up)
7675 !! wikitext
7676 <span>
7677 *a</span><span>
7678 *b</span>
7679 !! html/php+tidy
7680 <ul>
7681 <li><span>a</span></li>
7682 <li><span>b</span></li>
7683 </ul>
7684 !! html/parsoid
7685 <span>
7686 <ul>
7687 <li>a<span></span>
7688 </li>
7689 <li>b
7690 </li>
7691 </ul>
7692 </span>
7693 !! end
7694
7695 !! test
7696 Unclosed formatting tags that straddle lists are closed and reopened
7697 (php parser relies on Tidy to fix up)
7698 !! wikitext
7699 # <s> a
7700 # b </s>
7701 !! html/php+tidy
7702 <ol>
7703 <li><s>a</s></li>
7704 <li><s>b</s></li>
7705 </ol>
7706 !! html/parsoid
7707 <ol>
7708 <li> <s> a </s>
7709 </li>
7710 <li> <s> b </s>
7711 </li>
7712 </ol>
7713 !! end
7714
7715 # Parsoid fails this test, but it might be tricky to support properly.
7716 # See bug 68395.
7717 !!test
7718 List embedded in a non-block tag
7719 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
7720 !! wikitext
7721 <small>
7722 * foo
7723 </small>
7724 !! html/php+tidy
7725 <ul>
7726 <li><small>foo</small></li>
7727 </ul>
7728 !! html/parsoid
7729 <small>
7730 <ul>
7731 <li> foo</li>
7732 </ul>
7733 </small>
7734 !!end
7735
7736 # This is a bug in the PHP parser + tidy combination.
7737 # (The </tr> tag gets parsed as text and html-escaped by PHP,
7738 # and then fostered out of the table by tidy.)
7739 # We believe the Parsoid output to be correct.
7740 !! test
7741 Table with missing opening <tr> tag
7742 !! options
7743 parsoid=wt2html,wt2wt
7744 !! wikitext
7745 <table>
7746 <td>foo</td>
7747 </tr>
7748 </table>
7749 !! html/php+tidy
7750 <p>&lt;/tr&gt;</p>
7751 <table>
7752 <tr>
7753 <td>foo</td>
7754 </tr>
7755 </table>
7756 !! html/parsoid
7757 <table>
7758 <tr>
7759 <td>foo</td>
7760 </tr>
7761 </table>
7762 !! end
7763
7764 ###
7765 ### Magic Words
7766 ###
7767
7768 # Note that the current date is hard-coded as
7769 # 1970-01-01T00:02:03Z (a Thursday)
7770 # when running parser tests. The timezone is also fixed to GMT, so
7771 # local date will be identical to current date.
7772
7773 !! test
7774 Magic Word: {{CURRENTDAY}}
7775 !! wikitext
7776 {{CURRENTDAY}}
7777 !! html
7778 <p>1
7779 </p>
7780 !! end
7781
7782 !! test
7783 Magic Word: {{CURRENTDAY2}}
7784 !! wikitext
7785 {{CURRENTDAY2}}
7786 !! html
7787 <p>01
7788 </p>
7789 !! end
7790
7791 !! test
7792 Magic Word: {{CURRENTDAYNAME}}
7793 !! wikitext
7794 {{CURRENTDAYNAME}}
7795 !! html
7796 <p>Thursday
7797 </p>
7798 !! end
7799
7800 !! test
7801 Magic Word: {{CURRENTDOW}}
7802 !! wikitext
7803 {{CURRENTDOW}}
7804 !! html
7805 <p>4
7806 </p>
7807 !! end
7808
7809 !! test
7810 Magic Word: {{CURRENTMONTH}}
7811 !! wikitext
7812 {{CURRENTMONTH}}
7813 !! html
7814 <p>01
7815 </p>
7816 !! end
7817
7818 !! test
7819 Magic Word: {{CURRENTMONTH1}}
7820 !! wikitext
7821 {{CURRENTMONTH1}}
7822 !! html
7823 <p>1
7824 </p>
7825 !! end
7826
7827 !! test
7828 Magic Word: {{CURRENTMONTHABBREV}}
7829 !! wikitext
7830 {{CURRENTMONTHABBREV}}
7831 !! html
7832 <p>Jan
7833 </p>
7834 !! end
7835
7836 !! test
7837 Magic Word: {{CURRENTMONTHNAME}}
7838 !! wikitext
7839 {{CURRENTMONTHNAME}}
7840 !! html
7841 <p>January
7842 </p>
7843 !! end
7844
7845 !! test
7846 Magic Word: {{CURRENTMONTHNAMEGEN}}
7847 !! wikitext
7848 {{CURRENTMONTHNAMEGEN}}
7849 !! html
7850 <p>January
7851 </p>
7852 !! end
7853
7854 !! test
7855 Magic Word: {{CURRENTTIME}}
7856 !! wikitext
7857 {{CURRENTTIME}}
7858 !! html
7859 <p>00:02
7860 </p>
7861 !! end
7862
7863 !! test
7864 Magic Word: {{CURRENTHOUR}}
7865 !! wikitext
7866 {{CURRENTHOUR}}
7867 !! html
7868 <p>00
7869 </p>
7870 !! end
7871
7872 !! test
7873 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7874 !! wikitext
7875 {{CURRENTWEEK}}
7876 !! html
7877 <p>1
7878 </p>
7879 !! end
7880
7881 !! test
7882 Magic Word: {{CURRENTYEAR}}
7883 !! wikitext
7884 {{CURRENTYEAR}}
7885 !! html
7886 <p>1970
7887 </p>
7888 !! end
7889
7890 !! test
7891 Magic Word: {{CURRENTTIMESTAMP}}
7892 !! wikitext
7893 {{CURRENTTIMESTAMP}}
7894 !! html
7895 <p>19700101000203
7896 </p>
7897 !! end
7898
7899 !! test
7900 Magic Words LOCAL (UTC)
7901 !! wikitext
7902 * {{LOCALMONTH}}
7903 * {{LOCALMONTH1}}
7904 * {{LOCALMONTHNAME}}
7905 * {{LOCALMONTHNAMEGEN}}
7906 * {{LOCALMONTHABBREV}}
7907 * {{LOCALDAY}}
7908 * {{LOCALDAY2}}
7909 * {{LOCALDAYNAME}}
7910 * {{LOCALYEAR}}
7911 * {{LOCALTIME}}
7912 * {{LOCALHOUR}}
7913 * {{LOCALWEEK}}
7914 * {{LOCALDOW}}
7915 * {{LOCALTIMESTAMP}}
7916 !! html
7917 <ul><li> 01</li>
7918 <li> 1</li>
7919 <li> January</li>
7920 <li> January</li>
7921 <li> Jan</li>
7922 <li> 1</li>
7923 <li> 01</li>
7924 <li> Thursday</li>
7925 <li> 1970</li>
7926 <li> 00:02</li>
7927 <li> 00</li>
7928 <li> 1</li>
7929 <li> 4</li>
7930 <li> 19700101000203</li></ul>
7931
7932 !! end
7933
7934 !! test
7935 Magic Word: {{FULLPAGENAME}}
7936 !! options
7937 title=[[User:Ævar Arnfjörð Bjarmason]]
7938 !! wikitext
7939 {{FULLPAGENAME}}
7940 !! html
7941 <p>User:Ævar Arnfjörð Bjarmason
7942 </p>
7943 !! end
7944
7945 !! test
7946 Magic Word: {{FULLPAGENAMEE}}
7947 !! options
7948 title=[[User:Ævar Arnfjörð Bjarmason]]
7949 !! wikitext
7950 {{FULLPAGENAMEE}}
7951 !! html
7952 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7953 </p>
7954 !! end
7955
7956 !! test
7957 Magic Word: {{TALKSPACE}}
7958 !! options
7959 title=[[User:Ævar Arnfjörð Bjarmason]]
7960 !! wikitext
7961 {{TALKSPACE}}
7962 !! html
7963 <p>User talk
7964 </p>
7965 !! end
7966
7967 !! test
7968 Magic Word: {{TALKSPACE}}, same namespace
7969 !! options
7970 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7971 !! wikitext
7972 {{TALKSPACE}}
7973 !! html
7974 <p>User talk
7975 </p>
7976 !! end
7977
7978 !! test
7979 Magic Word: {{TALKSPACE}}, main namespace
7980 !! options
7981 title=[[Parser Test]]
7982 !! wikitext
7983 {{TALKSPACE}}
7984 !! html
7985 <p>Talk
7986 </p>
7987 !! end
7988
7989 !! test
7990 Magic Word: {{TALKSPACEE}}
7991 !! options
7992 title=[[User:Ævar Arnfjörð Bjarmason]]
7993 !! wikitext
7994 {{TALKSPACEE}}
7995 !! html
7996 <p>User_talk
7997 </p>
7998 !! end
7999
8000 !! test
8001 Magic Word: {{SUBJECTSPACE}}
8002 !! options
8003 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8004 !! wikitext
8005 {{SUBJECTSPACE}}
8006 !! html
8007 <p>User
8008 </p>
8009 !! end
8010
8011 !! test
8012 Magic Word: {{SUBJECTSPACE}}, same namespace
8013 !! options
8014 title=[[User:Ævar Arnfjörð Bjarmason]]
8015 !! wikitext
8016 {{SUBJECTSPACE}}
8017 !! html
8018 <p>User
8019 </p>
8020 !! end
8021
8022 !! test
8023 Magic Word: {{SUBJECTSPACE}}, main namespace
8024 !! options
8025 title=[[Parser Test]]
8026 !! wikitext
8027 {{SUBJECTSPACE}}
8028 !! html
8029
8030 !! end
8031
8032 !! test
8033 Magic Word: {{SUBJECTSPACEE}}
8034 !! options
8035 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8036 !! wikitext
8037 {{SUBJECTSPACEE}}
8038 !! html
8039 <p>User
8040 </p>
8041 !! end
8042
8043 !! test
8044 Magic Word: {{NAMESPACE}}
8045 !! options
8046 title=[[User:Ævar Arnfjörð Bjarmason]]
8047 !! wikitext
8048 {{NAMESPACE}}
8049 !! html
8050 <p>User
8051 </p>
8052 !! end
8053
8054 !! test
8055 Magic Word: {{NAMESPACEE}}
8056 !! options
8057 title=[[User:Ævar Arnfjörð Bjarmason]]
8058 !! wikitext
8059 {{NAMESPACEE}}
8060 !! html
8061 <p>User
8062 </p>
8063 !! end
8064
8065 !! test
8066 Magic Word: {{NAMESPACENUMBER}}
8067 !! options
8068 title=[[User:Ævar Arnfjörð Bjarmason]]
8069 !! wikitext
8070 {{NAMESPACENUMBER}}
8071 !! html
8072 <p>2
8073 </p>
8074 !! end
8075
8076 !! test
8077 Magic Word: {{SUBPAGENAME}}
8078 !! options
8079 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8080 !! wikitext
8081 {{SUBPAGENAME}}
8082 !! html
8083 <p>sub ö
8084 </p>
8085 !! end
8086
8087 !! test
8088 Magic Word: {{SUBPAGENAMEE}}
8089 !! options
8090 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8091 !! wikitext
8092 {{SUBPAGENAMEE}}
8093 !! html
8094 <p>sub_%C3%B6
8095 </p>
8096 !! end
8097
8098 !! test
8099 Magic Word: {{ROOTPAGENAME}}
8100 !! options
8101 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8102 !! wikitext
8103 {{ROOTPAGENAME}}
8104 !! html
8105 <p>Ævar Arnfjörð Bjarmason
8106 </p>
8107 !! end
8108
8109 !! test
8110 Magic Word: {{ROOTPAGENAMEE}}
8111 !! options
8112 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8113 !! wikitext
8114 {{ROOTPAGENAMEE}}
8115 !! html
8116 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8117 </p>
8118 !! end
8119
8120 !! test
8121 Magic Word: {{BASEPAGENAME}}
8122 !! options
8123 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8124 !! wikitext
8125 {{BASEPAGENAME}}
8126 !! html
8127 <p>Ævar Arnfjörð Bjarmason
8128 </p>
8129 !! end
8130
8131 !! test
8132 Magic Word: {{BASEPAGENAMEE}}
8133 !! options
8134 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8135 !! wikitext
8136 {{BASEPAGENAMEE}}
8137 !! html
8138 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8139 </p>
8140 !! end
8141
8142 !! test
8143 Magic Word: {{TALKPAGENAME}}
8144 !! options
8145 title=[[User:Ævar Arnfjörð Bjarmason]]
8146 !! wikitext
8147 {{TALKPAGENAME}}
8148 !! html
8149 <p>User talk:Ævar Arnfjörð Bjarmason
8150 </p>
8151 !! end
8152
8153 !! test
8154 Magic Word: {{TALKPAGENAMEE}}
8155 !! options
8156 title=[[User:Ævar Arnfjörð Bjarmason]]
8157 !! wikitext
8158 {{TALKPAGENAMEE}}
8159 !! html
8160 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8161 </p>
8162 !! end
8163
8164 !! test
8165 Magic Word: {{SUBJECTPAGENAME}}
8166 !! options
8167 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8168 !! wikitext
8169 {{SUBJECTPAGENAME}}
8170 !! html
8171 <p>User:Ævar Arnfjörð Bjarmason
8172 </p>
8173 !! end
8174
8175 !! test
8176 Magic Word: {{SUBJECTPAGENAMEE}}
8177 !! options
8178 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8179 !! wikitext
8180 {{SUBJECTPAGENAMEE}}
8181 !! html
8182 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8183 </p>
8184 !! end
8185
8186 !! test
8187 Magic Word: {{NUMBEROFFILES}}
8188 !! wikitext
8189 {{NUMBEROFFILES}}
8190 !! html
8191 <p>5
8192 </p>
8193 !! end
8194
8195 !! test
8196 Magic Word: {{PAGENAME}}
8197 !! options
8198 title=[[User:Ævar Arnfjörð Bjarmason]]
8199 !! wikitext
8200 {{PAGENAME}}
8201 !! html
8202 <p>Ævar Arnfjörð Bjarmason
8203 </p>
8204 !! end
8205
8206 !! test
8207 Magic Word: {{PAGENAME}} with metacharacters
8208 !! options
8209 title=[['foo & bar = baz']]
8210 !! wikitext
8211 ''{{PAGENAME}}''
8212 !! html/php
8213 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8214 </p>
8215 !! html+tidy
8216 <p><i>'foo &amp; bar = baz'</i></p>
8217 !! end
8218
8219 !! test
8220 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8221 !! options
8222 title=[[*RFC 1234 http://example.com/]]
8223 !! wikitext
8224 {{PAGENAME}}
8225 !! html/php
8226 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8227 </p>
8228 !! html+tidy
8229 <p>*RFC 1234 http://example.com/</p>
8230 !! end
8231
8232 !! test
8233 Magic Word: {{PAGENAMEE}}
8234 !! options
8235 title=[[User:Ævar Arnfjörð Bjarmason]]
8236 !! wikitext
8237 {{PAGENAMEE}}
8238 !! html
8239 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8240 </p>
8241 !! end
8242
8243 !! test
8244 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8245 !! options
8246 title=[[*RFC 1234 http://example.com/]]
8247 !! wikitext
8248 {{PAGENAMEE}}
8249 !! html/php
8250 <p>&#42;RFC_1234_http&#58;//example.com/
8251 </p>
8252 !! html+tidy
8253 <p>*RFC_1234_http://example.com/</p>
8254 !! end
8255
8256 !! test
8257 Magic Word: {{REVISIONID}}
8258 !! wikitext
8259 {{REVISIONID}}
8260 !! html
8261 <p>1337
8262 </p>
8263 !! end
8264
8265 !! test
8266 Magic Word: {{SCRIPTPATH}}
8267 !! wikitext
8268 {{SCRIPTPATH}}
8269 !! html
8270 <p>/
8271 </p>
8272 !! end
8273
8274 !! test
8275 Magic Word: {{STYLEPATH}}
8276 !! wikitext
8277 {{STYLEPATH}}
8278 !! html
8279 <p>/skins
8280 </p>
8281 !! end
8282
8283 !! test
8284 Magic Word: {{SERVER}}
8285 !! wikitext
8286 {{SERVER}}
8287 !! html
8288 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Magic Word: {{SERVERNAME}}
8294 !! wikitext
8295 {{SERVERNAME}}
8296 !! html
8297 <p>example.org
8298 </p>
8299 !! end
8300
8301 !! test
8302 Magic Word: {{SITENAME}}
8303 !! wikitext
8304 {{SITENAME}}
8305 !! html
8306 <p>MediaWiki
8307 </p>
8308 !! end
8309
8310 !! test
8311 Case-sensitive magic words, when cased differently, should just be template transclusions
8312 !! wikitext
8313 {{CurrentMonth}}
8314 {{currentday}}
8315 {{cURreNTweEK}}
8316 {{currentHour}}
8317 !! html
8318 <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>
8319 <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>
8320 <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>
8321 <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>
8322 </p>
8323 !! end
8324
8325 !! test
8326 Case-insensitive magic words should still work with weird casing.
8327 !! wikitext
8328 {{sErVeRNaMe}}
8329 {{LCFirst:AOEU}}
8330 {{ucFIRST:aoeu}}
8331 {{SERver}}
8332 !! html
8333 <p>example.org
8334 aOEU
8335 Aoeu
8336 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8337 </p>
8338 !! end
8339
8340 !! test
8341 Namespace 1 {{ns:1}}
8342 !! wikitext
8343 {{ns:1}}
8344 !! html
8345 <p>Talk
8346 </p>
8347 !! end
8348
8349 !! test
8350 Namespace 1 {{ns:01}}
8351 !! wikitext
8352 {{ns:01}}
8353 !! html
8354 <p>Talk
8355 </p>
8356 !! end
8357
8358 !! test
8359 Namespace 0 {{ns:0}} (bug 4783)
8360 !! wikitext
8361 {{ns:0}}
8362 !! html
8363
8364 !! end
8365
8366 !! test
8367 Namespace 0 {{ns:00}} (bug 4783)
8368 !! wikitext
8369 {{ns:00}}
8370 !! html
8371
8372 !! end
8373
8374 !! test
8375 Namespace -1 {{ns:-1}}
8376 !! wikitext
8377 {{ns:-1}}
8378 !! html
8379 <p>Special
8380 </p>
8381 !! end
8382
8383 !! test
8384 Namespace User {{ns:User}}
8385 !! wikitext
8386 {{ns:User}}
8387 !! html
8388 <p>User
8389 </p>
8390 !! end
8391
8392 !! test
8393 Namespace User talk {{ns:User_talk}}
8394 !! wikitext
8395 {{ns:User_talk}}
8396 !! html
8397 <p>User talk
8398 </p>
8399 !! end
8400
8401 !! test
8402 Namespace User talk {{ns:uSeR tAlK}}
8403 !! wikitext
8404 {{ns:uSeR tAlK}}
8405 !! html
8406 <p>User talk
8407 </p>
8408 !! end
8409
8410 !! test
8411 Namespace File {{ns:File}}
8412 !! wikitext
8413 {{ns:File}}
8414 !! html
8415 <p>File
8416 </p>
8417 !! end
8418
8419 !! test
8420 Namespace File {{ns:Image}}
8421 !! wikitext
8422 {{ns:Image}}
8423 !! html
8424 <p>File
8425 </p>
8426 !! end
8427
8428 !! test
8429 Namespace (lang=de) Benutzer {{ns:User}}
8430 !! options
8431 language=de
8432 !! wikitext
8433 {{ns:User}}
8434 !! html
8435 <p>Benutzer
8436 </p>
8437 !! end
8438
8439 !! test
8440 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8441 !! options
8442 language=de
8443 !! wikitext
8444 {{ns:3}}
8445 !! html
8446 <p>Benutzer Diskussion
8447 </p>
8448 !! end
8449
8450
8451 !! test
8452 Urlencode
8453 !! wikitext
8454 {{urlencode:hi world?!}}
8455 {{urlencode:hi world?!|WIKI}}
8456 {{urlencode:hi world?!|PATH}}
8457 {{urlencode:hi world?!|QUERY}}
8458 !! html
8459 <p>hi+world%3F%21
8460 hi_world%3F!
8461 hi%20world%3F%21
8462 hi+world%3F%21
8463 </p>
8464 !! end
8465
8466 !! test
8467 Magic Word: prioritize type info over data-parsoid
8468 !! options
8469 parsoid=html2wt
8470 !! wikitext
8471 __FORCETOC__
8472 !! html
8473 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8474 !! end
8475
8476 !! test
8477 Magic Word: serialize on separate line (parsoid)
8478 !! options
8479 parsoid=wt2wt,html2wt
8480 !! wikitext
8481 foo
8482 __NOTOC__
8483 bar
8484 !! html
8485 foo<meta property="mw:PageProp/notoc"/>bar
8486 !! end
8487
8488 !! test
8489 Magic Word: rt non-english wikis
8490 !! options
8491 parsoid=wt2wt
8492 language=de
8493 !! wikitext
8494 __NOEDITSECTION__
8495 !! html
8496 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8497 !! end
8498
8499 ###
8500 ### Magic links
8501 ###
8502 !! test
8503 Magic links: internal link to RFC (bug 479)
8504 !! wikitext
8505 [[RFC 123]]
8506 !! html
8507 <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>
8508 </p>
8509 !! end
8510
8511 !! test
8512 Magic links: RFC (bug 479)
8513 !! wikitext
8514 RFC 822
8515 !! html
8516 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8517 </p>
8518 !! end
8519
8520 !! test
8521 Magic links: ISBN (bug 1937)
8522 !! wikitext
8523 ISBN 0-306-40615-2
8524 !! html
8525 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8526 </p>
8527 !! end
8528
8529 !! test
8530 Magic links: PMID incorrectly converts space to underscore
8531 !! wikitext
8532 PMID 1234
8533 !! html
8534 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8535 </p>
8536 !! end
8537
8538 ###
8539 ### Templates
8540 ####
8541
8542 !! test
8543 Nonexistent template
8544 !! wikitext
8545 {{thistemplatedoesnotexist}}
8546 !! html
8547 <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>
8548 </p>
8549 !! end
8550
8551 !! test
8552 Template with invalid target containing tags
8553 !! wikitext
8554 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8555 !! html
8556 <p>{{a<b>b</b>|foo|a=b|a = b}}
8557 </p>
8558 !! end
8559
8560 !! test
8561 Template with invalid target containing unclosed tag
8562 !! wikitext
8563 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8564 !! html
8565 <p>{{a<b>|foo|a=b|a = b}}</b>
8566 </p>
8567 !! end
8568
8569 !! test
8570 Template with invalid target containing wikilink
8571 !! wikitext
8572 {{[[Main Page]]}}
8573 !! html/php
8574 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8575 </p>
8576 !! html/parsoid
8577 <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>
8578 !! end
8579
8580 !! test
8581 Template with just whitespace in it, bug #68421
8582 !! wikitext
8583 {{echo|{{ }}}}
8584 !! html/parsoid
8585 <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>
8586 !! end
8587
8588 !! article
8589 Template:test
8590 !! text
8591 This is a test template
8592 !! endarticle
8593
8594 !! test
8595 Simple template
8596 !! wikitext
8597 {{test}}
8598 !! html
8599 <p>This is a test template
8600 </p>
8601 !! end
8602
8603 !! test
8604 Template with explicit namespace
8605 !! wikitext
8606 {{Template:test}}
8607 !! html
8608 <p>This is a test template
8609 </p>
8610 !! end
8611
8612
8613 !! article
8614 Template:paramtest
8615 !! text
8616 This is a test template with parameter {{{param}}}
8617 !! endarticle
8618
8619 !! test
8620 Template parameter
8621 !! wikitext
8622 {{paramtest|param=foo}}
8623 !! html
8624 <p>This is a test template with parameter foo
8625 </p>
8626 !! end
8627
8628 !! article
8629 Template:paramtestnum
8630 !! text
8631 [[{{{1}}}|{{{2}}}]]
8632 !! endarticle
8633
8634 !! test
8635 Template unnamed parameter
8636 !! wikitext
8637 {{paramtestnum|Main Page|the main page}}
8638 !! html
8639 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8640 </p>
8641 !! end
8642
8643 !! article
8644 Template:templatesimple
8645 !! text
8646 (test)
8647 !! endarticle
8648
8649 !! article
8650 Template:templateredirect
8651 !! text
8652 #redirect [[Template:templatesimple]]
8653 !! endarticle
8654
8655 !! article
8656 Template:templateasargtestnum
8657 !! text
8658 {{{{{1}}}}}
8659 !! endarticle
8660
8661 !! article
8662 Template:templateasargtest
8663 !! text
8664 {{template{{{templ}}}}}
8665 !! endarticle
8666
8667 !! article
8668 Template:templateasargtest2
8669 !! text
8670 {{{{{templ}}}}}
8671 !! endarticle
8672
8673 !! test
8674 Template with template name as unnamed argument
8675 !! wikitext
8676 {{templateasargtestnum|templatesimple}}
8677 !! html
8678 <p>(test)
8679 </p>
8680 !! end
8681
8682 !! test
8683 Template with template name as argument
8684 !! wikitext
8685 {{templateasargtest|templ=simple}}
8686 !! html
8687 <p>(test)
8688 </p>
8689 !! end
8690
8691 !! test
8692 Template with template name as argument (2)
8693 !! wikitext
8694 {{templateasargtest2|templ=templatesimple}}
8695 !! html
8696 <p>(test)
8697 </p>
8698 !! end
8699
8700 !! article
8701 Template:templateasargtestdefault
8702 !! text
8703 {{{{{templ|templatesimple}}}}}
8704 !! endarticle
8705
8706 !! article
8707 Template:templa
8708 !! text
8709 '''templ'''
8710 !! endarticle
8711
8712 !! test
8713 Template with default value
8714 !! wikitext
8715 {{templateasargtestdefault}}
8716 !! html
8717 <p>(test)
8718 </p>
8719 !! end
8720
8721 !! test
8722 Template with default value (value set)
8723 !! wikitext
8724 {{templateasargtestdefault|templ=templa}}
8725 !! html
8726 <p><b>templ</b>
8727 </p>
8728 !! end
8729
8730 !! test
8731 Template redirect
8732 !! wikitext
8733 {{templateredirect}}
8734 !! html
8735 <p>(test)
8736 </p>
8737 !! end
8738
8739 !! test
8740 Template with argument in separate line
8741 !! wikitext
8742 {{ templateasargtest |
8743 templ = simple }}
8744 !! html
8745 <p>(test)
8746 </p>
8747 !! end
8748
8749 !! test
8750 Template with complex template as argument
8751 !! wikitext
8752 {{paramtest|
8753 param ={{ templateasargtest |
8754 templ = simple }}}}
8755 !! html
8756 <p>This is a test template with parameter (test)
8757 </p>
8758 !! end
8759
8760 !! test
8761 Template with thumb image (with link in description)
8762 !! wikitext
8763 {{paramtest|
8764 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8765 !! html/php
8766 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>
8767
8768 !! html+tidy
8769 <p>This is a test template with parameter</p>
8770 <div class="thumb tright">
8771 <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>
8772 <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>
8773 </div>
8774 </div>
8775 !! end
8776
8777 !! article
8778 Template:complextemplate
8779 !! text
8780 {{{1}}} {{paramtest|
8781 param ={{{param}}}}}
8782 !! endarticle
8783
8784 !! test
8785 Template with complex arguments
8786 !! wikitext
8787 {{complextemplate|
8788 param ={{ templateasargtest |
8789 templ = simple }}|[[Template:complextemplate|link]]}}
8790 !! html
8791 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8792 </p>
8793 !! end
8794
8795 !! test
8796 BUG 553: link with two variables in a piped link
8797 !! wikitext
8798 {|
8799 |[[{{{1}}}|{{{2}}}]]
8800 |}
8801 !! html
8802 <table>
8803 <tr>
8804 <td>[[{{{1}}}|{{{2}}}]]
8805 </td></tr></table>
8806
8807 !! end
8808
8809 !! test
8810 Magic variable as template parameter
8811 !! wikitext
8812 {{paramtest|param={{SITENAME}}}}
8813 !! html
8814 <p>This is a test template with parameter MediaWiki
8815 </p>
8816 !! end
8817
8818 !! article
8819 Template:linktest
8820 !! text
8821 [[{{{param}}}|link]]
8822 !! endarticle
8823
8824 !! test
8825 Template parameter as link source
8826 !! wikitext
8827 {{linktest|param=Main Page}}
8828 !! html
8829 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8830 </p>
8831 !! end
8832
8833 !!test
8834 Template-generated attribute string (k='v')
8835 !! wikitext
8836 <span {{attr_str|id|v1}}>bar</span>
8837 !! html
8838 <p><span id="v1">bar</span>
8839 </p>
8840 !!end
8841
8842 !!article
8843 Template:paramtest2
8844 !! text
8845 including another template, {{paramtest|param={{{arg}}}}}
8846 !! endarticle
8847
8848 !! test
8849 Template passing argument to another template
8850 !! wikitext
8851 {{paramtest2|arg='hmm'}}
8852 !! html
8853 <p>including another template, This is a test template with parameter 'hmm'
8854 </p>
8855 !! end
8856
8857 !! article
8858 Template:Linktest2
8859 !! text
8860 Main Page
8861 !! endarticle
8862
8863 !! test
8864 Template as link source
8865 !! wikitext
8866 [[{{linktest2}}]]
8867
8868 [[{{linktest2}}|Main Page]]
8869
8870 [[{{linktest2}}]]Page
8871 !! html
8872 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8873 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8874 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8875 </p>
8876 !! end
8877
8878
8879 !! article
8880 Template:loop1
8881 !! text
8882 {{loop2}}
8883 !! endarticle
8884
8885 !! article
8886 Template:loop2
8887 !! text
8888 {{loop1}}
8889 !! endarticle
8890
8891 !! test
8892 Template infinite loop
8893 !! wikitext
8894 {{loop1}}
8895 !! html
8896 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8897 </p>
8898 !! end
8899
8900 !! test
8901 Template from main namespace
8902 !! wikitext
8903 {{:Main Page}}
8904 !! html
8905 <p>blah blah
8906 </p>
8907 !! end
8908
8909 !! article
8910 Template:table
8911 !! text
8912 {|
8913 | 1 || 2
8914 |-
8915 | 3 || 4
8916 |}
8917 !! endarticle
8918
8919 !! test
8920 BUG 529: Template with table, not included at beginning of line
8921 !! wikitext
8922 foo {{table}}
8923 !! html
8924 <p>foo
8925 </p>
8926 <table>
8927 <tr>
8928 <td> 1 </td>
8929 <td> 2
8930 </td></tr>
8931 <tr>
8932 <td> 3 </td>
8933 <td> 4
8934 </td></tr></table>
8935
8936 !! end
8937
8938 !! test
8939 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8940 !! wikitext
8941 foo
8942 {{table}}
8943 !! html
8944 <p>foo
8945 </p>
8946 <table>
8947 <tr>
8948 <td> 1 </td>
8949 <td> 2
8950 </td></tr>
8951 <tr>
8952 <td> 3 </td>
8953 <td> 4
8954 </td></tr></table>
8955
8956 !! end
8957
8958 !! test
8959 BUG 41: Template parameters shown as broken links
8960 !! wikitext
8961 {{{parameter}}}
8962 !! html
8963 <p>{{{parameter}}}
8964 </p>
8965 !! end
8966
8967 !! test
8968 Template with targets containing wikilinks
8969 !! wikitext
8970 {{[[foo]]}}
8971
8972 {{[[{{echo|foo}}]]}}
8973
8974 {{{{echo|[[foo}}]]}}
8975 !! html
8976 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
8977 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
8978 </p><p>{{[[foo}}]]
8979 </p>
8980 !! end
8981
8982 !! article
8983 Template:MSGNW test
8984 !! text
8985 ''None'' of '''this''' should be
8986 * interpreted
8987 but rather passed unmodified
8988 {{test}}
8989 <gallery>
8990 File:Foobar.jpg
8991 </gallery>
8992 !! endarticle
8993
8994 # hmm, fix this or just deprecate msgnw and document its behavior?
8995 !! test
8996 msgnw keyword
8997 !! wikitext
8998 {{msgnw:MSGNW test}}
8999 !! html
9000 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9001 &#42; interpreted
9002 &#32;but rather passed unmodified
9003 &#123;&#123;test&#125;&#125;
9004 &#60;gallery&#62;
9005 File:Foobar.jpg
9006 &#60;/gallery&#62;
9007 </p>
9008 !! end
9009
9010 !! test
9011 int keyword
9012 !! wikitext
9013 {{int:youhavenewmessages|lots of money|not!}}
9014 !! html
9015 <p>You have lots of money (not!).
9016 </p>
9017 !! end
9018
9019 !! article
9020 Template:Includes
9021 !! text
9022 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9023 !! endarticle
9024
9025 !! test
9026 <includeonly> and <noinclude> being included
9027 !! wikitext
9028 {{Includes}}
9029 !! html
9030 <p>Foobar
9031 </p>
9032 !! end
9033
9034 !! article
9035 Template:Includes2
9036 !! text
9037 <onlyinclude>Foo</onlyinclude>bar
9038 !! endarticle
9039
9040 !! test
9041 <onlyinclude> being included
9042 !! wikitext
9043 {{Includes2}}
9044 !! html
9045 <p>Foo
9046 </p>
9047 !! end
9048
9049
9050 !! article
9051 Template:Includes3
9052 !! text
9053 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9054 !! endarticle
9055
9056 !! test
9057 <onlyinclude> and <includeonly> being included
9058 !! wikitext
9059 {{Includes3}}
9060 !! html
9061 <p>Foo
9062 </p>
9063 !! end
9064
9065 !! test
9066 <includeonly> and <noinclude> on a page
9067 !! wikitext
9068 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9069 !! html
9070 <p>Foozar
9071 </p>
9072 !! end
9073
9074 !! test
9075 Un-closed <noinclude>
9076 !! wikitext
9077 <noinclude>
9078 !! html
9079 !! end
9080
9081 !! test
9082 <onlyinclude> on a page
9083 !! wikitext
9084 <onlyinclude>Foo</onlyinclude>bar
9085 !! html
9086 <p>Foobar
9087 </p>
9088 !! end
9089
9090 !! test
9091 Un-closed <onlyinclude>
9092 !! wikitext
9093 <onlyinclude>
9094 !! html
9095 !! end
9096
9097 !!test
9098 Self-closed noinclude, includeonly, onlyinclude tags
9099 !! wikitext
9100 <noinclude />
9101 <includeonly />
9102 <onlyinclude />
9103 !! html
9104 <p><br />
9105 </p>
9106 !!end
9107
9108 !!test
9109 Unbalanced includeonly and noinclude tags
9110 !! wikitext
9111 {|
9112 |a</noinclude>
9113 |b</noinclude></noinclude>
9114 |c</noinclude></includeonly>
9115 |d</includeonly></includeonly>
9116 |}
9117 !! html
9118 <table>
9119 <tr>
9120 <td>a
9121 </td>
9122 <td>b
9123 </td>
9124 <td>c&lt;/includeonly&gt;
9125 </td>
9126 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9127 </td></tr></table>
9128
9129 !!end
9130
9131 !! article
9132 Template:Includeonly section
9133 !! text
9134 <includeonly>
9135 ==Includeonly section==
9136 </includeonly>
9137 ==Section T-1==
9138 !!endarticle
9139
9140 !! test
9141 Bug 6563: Edit link generation for section shown by <includeonly>
9142 !! wikitext
9143 {{includeonly section}}
9144 !! html
9145 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9146 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9147
9148 !! end
9149
9150 # Uses same input as the contents of [[Template:Includeonly section]]
9151 !! test
9152 Bug 6563: Section extraction for section shown by <includeonly>
9153 !! options
9154 section=T-2
9155 !! wikitext
9156 <includeonly>
9157 ==Includeonly section==
9158 </includeonly>
9159 ==Section T-2==
9160 !! html
9161 ==Section T-2==
9162 !! end
9163
9164 !! test
9165 Bug 6563: Edit link generation for section suppressed by <includeonly>
9166 !! wikitext
9167 <includeonly>
9168 ==Includeonly section==
9169 </includeonly>
9170 ==Section 1==
9171 !! html
9172 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9173
9174 !! end
9175
9176 !! test
9177 Bug 6563: Section extraction for section suppressed by <includeonly>
9178 !! options
9179 section=1
9180 !! wikitext
9181 <includeonly>
9182 ==Includeonly section==
9183 </includeonly>
9184 ==Section 1==
9185 !! html
9186 ==Section 1==
9187 !! end
9188
9189 !! test
9190 Un-closed <includeonly>
9191 !! wikitext
9192 <includeonly>
9193 !! html
9194 !! end
9195
9196 !! test
9197 Includes and comments at SOL
9198 !! wikitext
9199 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9200
9201 <noinclude>
9202 some
9203 </noinclude>* stuff
9204 * here
9205
9206 <includeonly>can have stuff</includeonly>=== here ===
9207
9208 !! html/php
9209 <h2><span class="mw-headline" id="hu">hu</span></h2>
9210 <p>some
9211 </p>
9212 <ul><li> stuff</li>
9213 <li> here</li></ul>
9214 <h3><span class="mw-headline" id="here">here</span></h3>
9215
9216 !! html/parsoid
9217 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment -->
9218 <h2 data-parsoid='{}'> hu </h2>
9219
9220 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9221
9222 <p data-parsoid='{}'>some</p>
9223 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
9224 <ul data-parsoid='{}'>
9225 <li data-parsoid='{}'> stuff</li>
9226
9227 <li data-parsoid='{}'> here</li></ul>
9228
9229 <h3 data-parsoid='{}'> here </h3>
9230 !! end
9231
9232 # TODO: test with DOM fragment reuse!
9233 !! test
9234 Parsoid: DOM fragment reuse
9235 !! options
9236 parsoid=wt2wt,wt2html
9237 !! wikitext
9238 a{{echo|b<table></table>c}}d
9239
9240 a{{echo|b
9241 <table></table>
9242 c}}d
9243
9244 {{echo|a
9245
9246 <table></table>
9247
9248 b}}
9249 !! html
9250 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
9251 <table></table>c"}},"i":0}}]}'>b</span>
9252 <table about="#mwt1"></table><span about="#mwt1">c</span>d
9253
9254
9255 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
9256 </span>
9257 <table about="#mwt2"></table><span about="#mwt2">
9258 </span>
9259 <p about="#mwt2">cd</p>
9260
9261
9262 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
9263
9264 </span>
9265 <table about="#mwt3"></table><span about="#mwt3">
9266
9267 </span>
9268 <p about="#mwt3">b</p>
9269 !! end
9270
9271 !! test
9272 Parsoid: Merge double tds (bug 50603)
9273 !! options
9274 parsoid
9275 !! wikitext
9276 {|
9277 |{{echo|{{!}} foo}}
9278 |}
9279 !! html
9280 <table><tbody>
9281 <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>
9282 </tbody></table>
9283 !! end
9284
9285 !! test
9286 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9287 !! options
9288 parsoid
9289 !! wikitext
9290 {{echo|<div>}}
9291 {|
9292 |{{echo|{{!}} foo}}
9293 |}
9294 {{echo|</div>}}
9295 !! html
9296 <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}}]}'>
9297 <table><tbody>
9298 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9299 </tbody></table>
9300 </div>
9301 !! end
9302
9303 ###
9304 ### <includeonly> and <noinclude> in attributes
9305 ###
9306 !!test
9307 0. includeonly around the entire attribute
9308 !! wikitext
9309 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9310 !! html
9311 <p><span id="v2">bar</span>
9312 </p>
9313 !!end
9314
9315 !!test
9316 1. includeonly in html attr key
9317 !! wikitext
9318 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9319 !! html
9320 <p><span id="foo">bar</span>
9321 </p>
9322 !!end
9323
9324 !!test
9325 2. includeonly in html attr value
9326 !! wikitext
9327 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9328 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9329 !! html
9330 <p><span id="v1">bar</span>
9331 <span id="v1">bar</span>
9332 </p>
9333 !!end
9334
9335 !!test
9336 3. includeonly in part of an attr value
9337 !! wikitext
9338 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9339 !! html
9340 <p><span style="color:red;">bar</span>
9341 </p>
9342 !!end
9343
9344 !!test
9345 4. includeonly in table attributes
9346 !! wikitext
9347 {|
9348 |- <noinclude>
9349 |-
9350 |a
9351 </noinclude>
9352 |- <includeonly>
9353 |-
9354 |b
9355 </includeonly>
9356 |}
9357 !! html
9358 <table>
9359
9360
9361 <tr>
9362 <td>a
9363 </td></tr>
9364 </table>
9365
9366 !!end
9367
9368 ###
9369 ### Token Stream Patcher tests
9370 ###
9371 ### These tests won't always pass wt2wt and other modes because
9372 ### on serialization, the table will be output on a new line.
9373 ### For now, we are blacklisting them, and using this to test selser.
9374 ###
9375
9376 !!test
9377 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9378 !!options
9379 parsoid=wt2html,wt2wt
9380 !!wikitext
9381 {{echo|}}{| width = '100%'
9382 |foo
9383 |}
9384 !!html/parsoid
9385 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
9386 <table width="100%">
9387 <tbody>
9388 <tr>
9389 <td>foo</td></tr></tbody></table>
9390 !!end
9391
9392 !!test
9393 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9394 !!options
9395 parsoid=wt2html,wt2wt
9396 !!wikitext
9397 <includeonly>a</includeonly>{| {{{b}}}
9398 |c
9399 |}
9400 !!html/parsoid
9401 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-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}}}":""}}'>
9402 <tbody><tr><td>c</td></tr>
9403 </tbody></table>
9404
9405 !!end
9406
9407 ###
9408 ### Testing parsing of templates where a template arg
9409 ### has the same name as the template itself.
9410 ###
9411
9412 !! article
9413 Template:quote
9414 !! text
9415 {{{quote|{{{1}}}}}}
9416 !! endarticle
9417
9418 !!test
9419 Templates: Template Name/Arg clash: 1. Use of positional param
9420 !! wikitext
9421 {{quote|foo}}
9422 !! html
9423 <p>foo
9424 </p>
9425 !!end
9426
9427 !!test
9428 Templates: Template Name/Arg clash: 2. Use of named param
9429 !! wikitext
9430 {{quote|quote=foo}}
9431 !! html
9432 <p>foo
9433 </p>
9434 !!end
9435
9436 !!test
9437 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9438 !! wikitext
9439 {{quote|quote}}
9440 !! html
9441 <p>quote
9442 </p>
9443 !!end
9444
9445 ###
9446 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9447 ###
9448
9449 !!test
9450 Templates: 1. Simple use
9451 !! wikitext
9452 {{echo|Foo}}
9453 !! html
9454 <p>Foo
9455 </p>
9456 !!end
9457
9458 !!test
9459 Templates: 2. Inside a block tag
9460 !! wikitext
9461 <div>{{echo|Foo}}</div>
9462 <blockquote>{{echo|Foo}}</blockquote>
9463 !! html
9464 <div>Foo</div>
9465 <blockquote>Foo</blockquote>
9466
9467 !! html+tidy
9468 <div>Foo</div>
9469 <blockquote>
9470 <p>Foo</p>
9471 </blockquote>
9472 !!end
9473
9474 !!test
9475 Templates: P-wrapping: 1a. Templates on consecutive lines
9476 !! wikitext
9477 {{echo|Foo}}
9478 {{echo|bar}}
9479 !! html
9480 <p>Foo
9481 bar
9482 </p>
9483 !!end
9484
9485 !!test
9486 Templates: P-wrapping: 1b. Templates on consecutive lines
9487 !! wikitext
9488 Foo
9489
9490 {{echo|bar}}
9491 {{echo|baz}}
9492 !! html
9493 <p>Foo
9494 </p><p>bar
9495 baz
9496 </p>
9497 !!end
9498
9499 !!test
9500 Templates: P-wrapping: 1c. Templates on consecutive lines
9501 !! wikitext
9502 {{echo|Foo}}
9503 {{echo|bar}} <div>baz</div>
9504 !! html
9505 <p>Foo
9506 </p>
9507 bar <div>baz</div>
9508
9509 !! html+tidy
9510 <p>Foo</p>
9511 <p>bar</p>
9512 <div>baz</div>
9513 !! end
9514
9515 !!test
9516 Templates: P-wrapping: 1d. Template preceded by comment-only line
9517 !!options
9518 parsoid
9519 !! wikitext
9520 <!-- foo -->
9521 {{echo|Bar}}
9522 !! html
9523 <!-- foo -->
9524
9525 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9526 !!end
9527
9528 !!test
9529 Templates: Inline Text: 1. Multiple template uses
9530 !! wikitext
9531 {{echo|Foo}}bar{{echo|baz}}
9532 !! html
9533 <p>Foobarbaz
9534 </p>
9535 !!end
9536
9537 !!test
9538 Templates: Inline Text: 2. Back-to-back template uses
9539 !! wikitext
9540 {{echo|Foo}}{{echo|bar}}
9541 !! html
9542 <p>Foobar
9543 </p>
9544 !!end
9545
9546 !!test
9547 Templates: Block Tags: 1. Multiple template uses
9548 !! wikitext
9549 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9550 !! html
9551 <div>Foo</div><div>bar</div><div>baz</div>
9552
9553 !!end
9554
9555 !!test
9556 Templates: Block Tags: 2. Back-to-back template uses
9557 !! wikitext
9558 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9559 !! html
9560 <div>Foo</div><div>bar</div>
9561
9562 !!end
9563
9564 # This is an edge case relating to paragraph wrapping.
9565 !!test
9566 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9567 !! wikitext
9568 {{echo|a
9569 b</p>}}
9570 !! html/parsoid
9571 <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
9572 b</p><p></p>
9573 !!end
9574
9575 !!test
9576 Templates: Links: 1. Simple example
9577 !! wikitext
9578 {{echo|[[Foo|bar]]}}
9579 !! html
9580 <p><a href="/wiki/Foo" title="Foo">bar</a>
9581 </p>
9582 !!end
9583
9584 !!test
9585 Templates: Links: 2. Generation of link href
9586 !! wikitext
9587 [[{{echo|Foo}}|bar]]
9588 !! html
9589 <p><a href="/wiki/Foo" title="Foo">bar</a>
9590 </p>
9591 !!end
9592
9593 !!test
9594 Templates: Links: 3. Generation of part of a link href
9595 !! wikitext
9596 [[Fo{{echo|o}}|bar]]
9597
9598 [[Foo{{echo|bar}}]]
9599
9600 [[Foo{{echo|bar}}baz]]
9601
9602 [[Foo{{echo|bar}}|bar]]
9603
9604 [[:Foo{{echo|bar}}]]
9605
9606 [[:Foo{{echo|bar}}|bar]]
9607 !! html
9608 <p><a href="/wiki/Foo" title="Foo">bar</a>
9609 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9610 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9611 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9612 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9613 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9614 </p>
9615 !!end
9616
9617 !!test
9618 Templates: Links: 4. Multiple templates generating link href
9619 !! wikitext
9620 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9621 !! html
9622 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9623 </p>
9624 !!end
9625
9626 !!test
9627 Templates: Links: 5. Generation of link text
9628 !! wikitext
9629 [[Foo|{{echo|bar}}]]
9630 !! html
9631 <p><a href="/wiki/Foo" title="Foo">bar</a>
9632 </p>
9633 !!end
9634
9635 !!test
9636 Templates: Links: 5. Nested templates (only outermost template should be marked)
9637 !! wikitext
9638 {{echo|[[{{echo|Foo}}|bar]]}}
9639 !! html
9640 <p><a href="/wiki/Foo" title="Foo">bar</a>
9641 </p>
9642 !!end
9643
9644 !!test
9645 Templates: HTML Tag: 1. Generation of HTML attr. key
9646 !! wikitext
9647 <div {{echo|style}}="color:red;">foo</div>
9648 !! html
9649 <div style="color:red;">foo</div>
9650
9651 !!end
9652
9653 !!test
9654 Templates: HTML Tag: 2. Generation of HTML attr. value
9655 !! wikitext
9656 <div style={{echo|'color:red;'}}>foo</div>
9657 !! html
9658 <div style="color:red;">foo</div>
9659
9660 !!end
9661
9662 !!test
9663 Templates: HTML Tag: 3. Generation of HTML attr key and value
9664 !! wikitext
9665 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9666 !! html
9667 <div style="color:red;">foo</div>
9668
9669 !!end
9670
9671 !!test
9672 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9673 !! wikitext
9674 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9675 !! html
9676 <div title="This is a long title with just one piece templated">foo</div>
9677
9678 !!end
9679
9680 !!test
9681 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9682 !! wikitext
9683 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9684 !! html
9685 <div title="This is a long title with just one piece templated">foo</div>
9686
9687 !!end
9688
9689 !!test
9690 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9691 !! wikitext
9692 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9693 !! html
9694 <div title="This is a long title with just one piece templated">foo</div>
9695
9696 !!end
9697
9698 !!test
9699 Templates: HTML Tag: 7. Generation of partial attribute key string
9700 !! wikitext
9701 <div st{{echo|yle}}="color:red;">foo</div>
9702 !! html
9703 <div style="color:red;">foo</div>
9704
9705 !!end
9706
9707 !!test
9708 Templates: HTML Tables: 1. Generating start of a HTML table
9709 !! wikitext
9710 {{echo|<table><tr><td>foo</td>}}</tr></table>
9711 !! html
9712 <table><tr><td>foo</td></tr></table>
9713
9714 !!end
9715
9716 !!test
9717 Templates: HTML Tables: 2a. Generating middle of a HTML table
9718 !! wikitext
9719 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9720 !! html
9721 <table><tr><td>foo</td></tr></table>
9722
9723 !!end
9724
9725 !!test
9726 Templates: HTML Tables: 2b. Generating middle of a HTML table
9727 !! wikitext
9728 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9729 !! html
9730 <table><tr><td>foo</td></tr></table>
9731
9732 !!end
9733
9734 !!test
9735 Templates: HTML Tables: 3. Generating end of a HTML table
9736 !! wikitext
9737 <table><tr>{{echo|<td>foo</td></tr></table>}}
9738 !! html
9739 <table><tr><td>foo</td></tr></table>
9740
9741 !!end
9742
9743 !!test
9744 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9745 !! wikitext
9746 {{echo|<table>}}<tr><td>foo</td></tr></table>
9747 !! html
9748 <table><tr><td>foo</td></tr></table>
9749
9750 !!end
9751
9752 !!test
9753 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9754 !! wikitext
9755 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9756 !! html
9757 <table><tr><td>foo</td></tr></table>
9758
9759 !!end
9760
9761 !!test
9762 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9763 !! wikitext
9764 <table><tr>{{echo|<td>}}foo</td></tr></table>
9765 !! html
9766 <table><tr><td>foo</td></tr></table>
9767
9768 !!end
9769
9770 !!test
9771 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9772 !! wikitext
9773 <table><tr><td>foo{{echo|</td>}}</tr></table>
9774 !! html
9775 <table><tr><td>foo</td></tr></table>
9776
9777 !!end
9778
9779 !!test
9780 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9781 !! wikitext
9782 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9783 !! html
9784 <table><tr><td>foo</td></tr></table>
9785
9786 !!end
9787
9788 !!test
9789 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9790 !! wikitext
9791 <table><tr><td>foo</td></tr>{{echo|</table>}}
9792 !! html
9793 <table><tr><td>foo</td></tr></table>
9794
9795 !!end
9796
9797 !!test
9798 Templates: HTML Tables: 5. Proper fostering of categories from inside
9799 !!options
9800 parsoid=wt2html,wt2wt
9801 !! wikitext
9802 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9803 <!--Two categories (Bug 50330)-->
9804 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9805 !! html
9806 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9807 <!--Two categories (Bug 50330)-->
9808 <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>
9809 !!end
9810
9811 !!test
9812 Templates: Wiki Tables: 1a. Fostering of entire template content
9813 !! wikitext
9814 {|
9815 {{echo|a}}
9816 |}
9817 !! html
9818 <table>
9819 a
9820 <tr><td></td></tr></table>
9821
9822 !! html+tidy
9823 <p>a</p>
9824 <table>
9825 <tr>
9826 <td></td>
9827 </tr>
9828 </table>
9829 !! end
9830
9831 !!test
9832 Templates: Wiki Tables: 1b. Fostering of entire template content
9833 !! wikitext
9834 {|
9835 {{echo|<div>}}
9836 foo
9837 {{echo|</div>}}
9838 |}
9839 !! html
9840 <table>
9841 <div>
9842 <p>foo
9843 </p>
9844 </div>
9845 <tr><td></td></tr></table>
9846
9847 !! html+tidy
9848 <div>
9849 <p>foo</p>
9850 </div>
9851 <table>
9852 <tr>
9853 <td></td>
9854 </tr>
9855 </table>
9856 !! end
9857
9858 !!test
9859 Templates: Wiki Tables: 2. Fostering of partial template content
9860 !! wikitext
9861 {|
9862 {{echo|a
9863 <div>b</div>}}
9864 |}
9865 !! html
9866 <table>
9867 a
9868 <div>b</div>
9869 <tr><td></td></tr></table>
9870
9871 !! html+tidy
9872 <p>a</p>
9873 <div>b</div>
9874 <table>
9875 <tr>
9876 <td></td>
9877 </tr>
9878 </table>
9879 !! end
9880
9881 !!test
9882 Templates: Wiki Tables: 3. td-content via multiple templates
9883 !! wikitext
9884 {|
9885 {{echo|{{pipe}}a}}{{echo|b}}
9886 |}
9887 !! html
9888 <table>
9889 <tr>
9890 <td>ab
9891 </td></tr></table>
9892
9893 !!end
9894
9895 !!test
9896 Templates: Wiki Tables: 4. Templated tags, no content
9897 !! wikitext
9898 {{tbl-start}}
9899 {{tbl-end}}
9900 !! html
9901 <table>
9902 <tr><td></td></tr></table>
9903
9904 !!end
9905
9906 !!test
9907 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9908 !! wikitext
9909 {{tbl-start}}
9910 |foo
9911 {{tbl-end}}
9912 !! html
9913 <table>
9914 <tr>
9915 <td>foo
9916 </td></tr></table>
9917
9918 !!end
9919
9920 !!test
9921 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9922 !! wikitext
9923 {{tbl-start}}
9924 {{!}}foo
9925 {{tbl-end}}
9926 !! html
9927 <table>
9928 <tr>
9929 <td>foo
9930 </td></tr></table>
9931
9932 !!end
9933
9934 !!test
9935 Templates: Lists: Multi-line list-items via templates
9936 !! wikitext
9937 *{{echo|a {{nonexistent|
9938 unused}}}}
9939 *{{echo|b {{nonexistent|
9940 unused}}}}
9941 !! html
9942 <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>
9943 <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>
9944
9945 !!end
9946
9947 !!test
9948 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9949 !! wikitext
9950 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9951 !! html
9952 <p><i>ab</i>c<i>d</i>e
9953 </p>
9954 !!end
9955
9956 !!test
9957 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9958 (PHP parser generates misnested html)
9959 !! wikitext
9960 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9961 !! html/parsoid
9962 <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>
9963 !!end
9964
9965 !!test
9966 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9967 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9968 !! options
9969 parsoid=wt2html,wt2wt
9970 !! wikitext
9971 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9972 !! html
9973 <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>
9974 <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>
9975 <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>
9976 !!end
9977
9978 !!test
9979 Templates: Ugly nesting: 4. Divs opened/closed across templates
9980 !! wikitext
9981 a<div>b{{echo|c</div>d}}e
9982 !! html
9983 a<div>bc</div>de
9984
9985 !! html+tidy
9986 <p>a</p>
9987 <div>bc</div>
9988 <p>de</p>
9989 !! end
9990
9991 !!test
9992 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9993 (Parsoid-centric)
9994 !! options
9995 parsoid
9996 !! wikitext
9997 {|
9998 |{{echo|foo</table>}}
9999 |bar
10000 |}
10001 !! html
10002 <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|}"]}'>
10003
10004 <tbody>
10005 <tr>
10006 <td>foo</td></tr></tbody></table><span about="#mwt1">
10007 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10008 |}</span>
10009 !!end
10010
10011 !!test
10012 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10013 (Parsoid-centric)
10014 !! options
10015 parsoid
10016 !! wikitext
10017 <table>
10018 <tr>
10019 <td>
10020 <table>
10021 <tr>
10022 <td>1. {{echo|foo </table>}}</td>
10023 <td> bar </td>
10024 <td>2. {{echo|baz </table>}}</td>
10025 </tr>
10026 <tr>
10027 <td>abc</td>
10028 </tr>
10029 </table>
10030 </td>
10031 </tr>
10032 <tr>
10033 <td>xyz</td>
10034 </tr>
10035 </table>
10036 !! html
10037 <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>"]}'>
10038 <tbody><tr>
10039 <td>
10040 <table>
10041 <tbody><tr>
10042 <td>1. foo </td></tr></tbody></table></td>
10043 <td> bar </td>
10044 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10045 </span><span about="#mwt2">
10046 </span><span about="#mwt2">
10047 </span><span about="#mwt2">abc</span><span about="#mwt2">
10048 </span><span about="#mwt2">
10049 </span><span about="#mwt2">
10050 </span><span about="#mwt2">
10051 </span><span about="#mwt2">
10052 </span><span about="#mwt2">
10053 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10054 </span><span about="#mwt2">
10055 </span>
10056 !!end
10057
10058 !! test
10059 Templates: Ugly templates: 3. newline-only template parameter
10060 !! wikitext
10061 foo {{echo|
10062 }}
10063 !! html
10064 <p>foo
10065 </p>
10066 !! end
10067
10068 # This looks like a bug: a single newline triggers p/br for some reason.
10069 !! test
10070 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10071 !! wikitext
10072 {{echo|
10073 }}
10074 !! html
10075 <p><br />
10076 </p>
10077 !! end
10078
10079 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10080 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10081 !! test
10082 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10083 !! wikitext
10084 {{echo|<table>}}
10085 {{echo|<div>foo}}
10086 {{echo|</table>}}
10087 !! html/parsoid
10088 <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
10089 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10090 </table>
10091 !! end
10092
10093 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10094 # that are "identical" and generate nesting cycles in the algorithm
10095 !! test
10096 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10097 !! wikitext
10098 {{echo|<table><tr><td><table>}}
10099 {{echo|<div>}}
10100 {{echo|</div>}}
10101 !! html/parsoid
10102 <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"}'>
10103 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10104 </table></td></tr></tbody></table>
10105 !! end
10106
10107 !!test
10108 Parser Functions: 1. Simple example
10109 !! wikitext
10110 {{uc:foo}}
10111 !! html
10112 <p>FOO
10113 </p>
10114 !!end
10115
10116 !!test
10117 Parser Functions: 2. Nested use (only outermost should be marked up)
10118 !! wikitext
10119 {{uc:{{lc:FOO}}}}
10120 !! html
10121 <p>FOO
10122 </p>
10123 !!end
10124
10125 ###
10126 ### Pre-save transform tests
10127 ###
10128 !! test
10129 pre-save transform: subst:
10130 !! options
10131 PST
10132 !! wikitext
10133 {{subst:test}}
10134 !! html
10135 This is a test template
10136 !! end
10137
10138 !! test
10139 pre-save transform: normal template
10140 !! options
10141 PST
10142 !! wikitext
10143 {{test}}
10144 !! html
10145 {{test}}
10146 !! end
10147
10148 !! test
10149 pre-save transform: nonexistent template
10150 !! options
10151 PST
10152 !! wikitext
10153 {{thistemplatedoesnotexist}}
10154 !! html
10155 {{thistemplatedoesnotexist}}
10156 !! end
10157
10158
10159 !! test
10160 pre-save transform: subst magic variables
10161 !! options
10162 PST
10163 !! wikitext
10164 {{subst:SITENAME}}
10165 !! html
10166 MediaWiki
10167 !! end
10168
10169 # This is bug 89, which I fixed. -- wtm
10170 !! test
10171 pre-save transform: subst: templates with parameters
10172 !! options
10173 pst
10174 !! wikitext
10175 {{subst:paramtest|param="something else"}}
10176 !! html
10177 This is a test template with parameter "something else"
10178 !! end
10179
10180 !! article
10181 Template:nowikitest
10182 !! text
10183 <nowiki>'''not wiki'''</nowiki>
10184 !! endarticle
10185
10186 !! test
10187 pre-save transform: nowiki in subst (bug 1188)
10188 !! options
10189 pst
10190 !! wikitext
10191 {{subst:nowikitest}}
10192 !! html
10193 <nowiki>'''not wiki'''</nowiki>
10194 !! end
10195
10196
10197 !! article
10198 Template:commenttest
10199 !! text
10200 This template has <!-- a comment --> in it.
10201 !! endarticle
10202
10203 !! test
10204 pre-save transform: comment in subst (bug 1936)
10205 !! options
10206 pst
10207 !! wikitext
10208 {{subst:commenttest}}
10209 !! html
10210 This template has <!-- a comment --> in it.
10211 !! end
10212
10213 !! test
10214 pre-save transform: unclosed tag
10215 !! options
10216 pst noxml
10217 !! wikitext
10218 <nowiki>'''not wiki'''
10219 !! html
10220 <nowiki>'''not wiki'''
10221 !! end
10222
10223 !! test
10224 pre-save transform: mixed tag case
10225 !! options
10226 pst noxml
10227 !! wikitext
10228 <NOwiki>'''not wiki'''</noWIKI>
10229 !! html
10230 <NOwiki>'''not wiki'''</noWIKI>
10231 !! end
10232
10233 !! test
10234 pre-save transform: unclosed comment in <nowiki>
10235 !! options
10236 pst noxml
10237 !! wikitext
10238 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10239 !! html
10240 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10241 !!end
10242
10243 # Leading @ in this template definition works around a limitation
10244 # in parsoid's parserTests which otherwise strips the <span> from the
10245 # result (confusing it for a template wrapper)
10246 !! article
10247 Template:dangerous
10248 !!text
10249 @<span onmouseover="alert('crap')">Oh no</span>
10250 !!endarticle
10251
10252 !!test
10253 (confirming safety of fix for subst bug 1936)
10254 !! wikitext
10255 {{Template:dangerous}}
10256 !! html
10257 <p>@<span>Oh no</span>
10258 </p>
10259 !! end
10260
10261 !! test
10262 pre-save transform: comment containing gallery (bug 5024)
10263 !! options
10264 pst
10265 !! wikitext
10266 <!-- <gallery>data</gallery> -->
10267 !! html
10268 <!-- <gallery>data</gallery> -->
10269 !!end
10270
10271 !! test
10272 pre-save transform: comment containing extension
10273 !! options
10274 pst
10275 !! wikitext
10276 <!-- <tag>data</tag> -->
10277 !! html
10278 <!-- <tag>data</tag> -->
10279 !!end
10280
10281 !! test
10282 pre-save transform: comment containing nowiki
10283 !! options
10284 pst
10285 !! wikitext
10286 <!-- <nowiki>data</nowiki> -->
10287 !! html
10288 <!-- <nowiki>data</nowiki> -->
10289 !!end
10290
10291 !! test
10292 pre-save transform: <noinclude> in subst (bug 3298)
10293 !! options
10294 pst
10295 !! wikitext
10296 {{subst:Includes}}
10297 !! html
10298 Foobar
10299 !! end
10300
10301 !! test
10302 pre-save transform: <onlyinclude> in subst (bug 3298)
10303 !! options
10304 pst
10305 !! wikitext
10306 {{subst:Includes2}}
10307 !! html
10308 Foo
10309 !! end
10310
10311 !! article
10312 Template:SubstTest
10313 !!text
10314 {{<includeonly>subst:</includeonly>Includes}}
10315 !! endarticle
10316
10317 !! article
10318 Template:SafeSubstTest
10319 !! text
10320 {{<includeonly>safesubst:</includeonly>Includes}}
10321 !! endarticle
10322
10323 !! test
10324 bug 22297: safesubst: works during PST
10325 !! options
10326 pst
10327 !! wikitext
10328 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10329 !! html
10330 FoobarFoobar
10331 !! end
10332
10333 !! test
10334 bug 22297: safesubst: works during normal parse
10335 !! wikitext
10336 {{SafeSubstTest}}
10337 !! html
10338 <p>Foobar
10339 </p>
10340 !! end
10341
10342 !! test
10343 subst: does not work during normal parse
10344 !! wikitext
10345 {{SubstTest}}
10346 !! html
10347 <p>{{subst:Includes}}
10348 </p>
10349 !! end
10350
10351 !! test
10352 pre-save transform: context links ("pipe trick")
10353 !! options
10354 pst
10355 !! wikitext
10356 [[Article (context)|]]
10357 [[Bar:Article|]]
10358 [[:Bar:Article|]]
10359 [[Bar:Article (context)|]]
10360 [[:Bar:Article (context)|]]
10361 [[|Article]]
10362 [[|Article (context)]]
10363 [[Bar:X (Y) Z|]]
10364 [[:Bar:X (Y) Z|]]
10365 !! html
10366 [[Article (context)|Article]]
10367 [[Bar:Article|Article]]
10368 [[:Bar:Article|Article]]
10369 [[Bar:Article (context)|Article]]
10370 [[:Bar:Article (context)|Article]]
10371 [[Article]]
10372 [[Article (context)]]
10373 [[Bar:X (Y) Z|X (Y) Z]]
10374 [[:Bar:X (Y) Z|X (Y) Z]]
10375 !! end
10376
10377 !! test
10378 pre-save transform: context links ("pipe trick") with interwiki prefix
10379 !! options
10380 pst
10381 !! wikitext
10382 [[interwiki:Article|]]
10383 [[:interwiki:Article|]]
10384 [[interwiki:Bar:Article|]]
10385 [[:interwiki:Bar:Article|]]
10386 !! html
10387 [[interwiki:Article|Article]]
10388 [[:interwiki:Article|Article]]
10389 [[interwiki:Bar:Article|Bar:Article]]
10390 [[:interwiki:Bar:Article|Bar:Article]]
10391 !! end
10392
10393 !! test
10394 pre-save transform: context links ("pipe trick") with parens in title
10395 !! options
10396 pst title=[[Somearticle (context)]]
10397 !! wikitext
10398 [[|Article]]
10399 !! html
10400 [[Article (context)|Article]]
10401 !! end
10402
10403 !! test
10404 pre-save transform: context links ("pipe trick") with comma in title
10405 !! options
10406 pst title=[[Someplace, Somewhere]]
10407 !! wikitext
10408 [[|Otherplace]]
10409 [[Otherplace, Elsewhere|]]
10410 [[Otherplace, Elsewhere, Anywhere|]]
10411 !! html
10412 [[Otherplace, Somewhere|Otherplace]]
10413 [[Otherplace, Elsewhere|Otherplace]]
10414 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10415 !! end
10416
10417 !! test
10418 pre-save transform: context links ("pipe trick") with parens and comma
10419 !! options
10420 pst title=[[Someplace (IGNORED), Somewhere]]
10421 !! wikitext
10422 [[|Otherplace]]
10423 [[Otherplace (place), Elsewhere|]]
10424 !! html
10425 [[Otherplace, Somewhere|Otherplace]]
10426 [[Otherplace (place), Elsewhere|Otherplace]]
10427 !! end
10428
10429 !! test
10430 pre-save transform: context links ("pipe trick") with comma and parens
10431 !! options
10432 pst title=[[Who, me? (context)]]
10433 !! wikitext
10434 [[|Yes, you.]]
10435 [[Me, Myself, and I (1937 song)|]]
10436 !! html
10437 [[Yes, you. (context)|Yes, you.]]
10438 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10439 !! end
10440
10441 !! test
10442 pre-save transform: context links ("pipe trick") with namespace
10443 !! options
10444 pst title=[[Ns:Somearticle]]
10445 !! wikitext
10446 [[|Article]]
10447 !! html
10448 [[Ns:Article|Article]]
10449 !! end
10450
10451 !! test
10452 pre-save transform: context links ("pipe trick") with namespace and parens
10453 !! options
10454 pst title=[[Ns:Somearticle (context)]]
10455 !! wikitext
10456 [[|Article]]
10457 !! html
10458 [[Ns:Article (context)|Article]]
10459 !! end
10460
10461 !! test
10462 pre-save transform: context links ("pipe trick") with namespace and comma
10463 !! options
10464 pst title=[[Ns:Somearticle, Context, Whatever]]
10465 !! wikitext
10466 [[|Article]]
10467 !! html
10468 [[Ns:Article, Context, Whatever|Article]]
10469 !! end
10470
10471 !! test
10472 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10473 !! options
10474 pst title=[[Ns:Somearticle, Context (context)]]
10475 !! wikitext
10476 [[|Article]]
10477 !! html
10478 [[Ns:Article (context)|Article]]
10479 !! end
10480
10481 !! test
10482 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10483 !! options
10484 pst title=[[Ns:Somearticle (IGNORED), Context]]
10485 !! wikitext
10486 [[|Article]]
10487 !! html
10488 [[Ns:Article, Context|Article]]
10489 !! end
10490
10491 !! test
10492 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10493 !! options
10494 pst
10495 !! wikitext
10496 [[Article(context)|]]
10497 [[Bar:Article(context)|]]
10498 [[:Bar:Article(context)|]]
10499 [[|Article(context)]]
10500 [[Bar:X(Y)Z|]]
10501 [[:Bar:X(Y)Z|]]
10502 !! html
10503 [[Article(context)|Article]]
10504 [[Bar:Article(context)|Article]]
10505 [[:Bar:Article(context)|Article]]
10506 [[Article(context)]]
10507 [[Bar:X(Y)Z|X(Y)Z]]
10508 [[:Bar:X(Y)Z|X(Y)Z]]
10509 !! end
10510
10511 !! test
10512 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10513 !! options
10514 pst
10515 !! wikitext
10516 [[Article (context)|]]
10517 [[Bar:Article (context)|]]
10518 [[:Bar:Article (context)|]]
10519 [[|Article (context)]]
10520 [[Bar:X (Y) Z|]]
10521 [[:Bar:X (Y) Z|]]
10522 !! html
10523 [[Article (context)|Article]]
10524 [[Bar:Article (context)|Article]]
10525 [[:Bar:Article (context)|Article]]
10526 [[Article (context)]]
10527 [[Bar:X (Y) Z|X (Y) Z]]
10528 [[:Bar:X (Y) Z|X (Y) Z]]
10529 !! end
10530
10531 !! test
10532 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10533 !! options
10534 pst
10535 !! wikitext
10536 [[Article(context)|]]
10537 [[Bar:Article(context)|]]
10538 [[:Bar:Article(context)|]]
10539 [[|Article(context)]]
10540 [[Bar:X(Y)Z|]]
10541 [[:Bar:X(Y)Z|]]
10542 !! html
10543 [[Article(context)|Article]]
10544 [[Bar:Article(context)|Article]]
10545 [[:Bar:Article(context)|Article]]
10546 [[Article(context)]]
10547 [[Bar:X(Y)Z|X(Y)Z]]
10548 [[:Bar:X(Y)Z|X(Y)Z]]
10549 !! end
10550
10551 !! test
10552 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10553 !! options
10554 pst
10555 !! wikitext
10556 [[Article (context), context|]]
10557 [[Article (context),context|]]
10558 [[Bar:Article (context), context|]]
10559 [[Bar:Article (context),context|]]
10560 [[:Bar:Article (context), context|]]
10561 [[:Bar:Article (context),context|]]
10562 !! html
10563 [[Article (context), context|Article]]
10564 [[Article (context),context|Article]]
10565 [[Bar:Article (context), context|Article]]
10566 [[Bar:Article (context),context|Article]]
10567 [[:Bar:Article (context), context|Article]]
10568 [[:Bar:Article (context),context|Article]]
10569 !! end
10570
10571 !! test
10572 pre-save transform: trim trailing empty lines
10573 !! options
10574 pst
10575 !! wikitext
10576 Empty lines are trimmed
10577
10578
10579
10580
10581 !! html
10582 Empty lines are trimmed
10583 !! end
10584
10585 !! test
10586 pre-save transform: Signature expansion
10587 !! options
10588 pst
10589 !! wikitext
10590 * ~~~
10591 * <noinclude>~~~</noinclude>
10592 * <includeonly>~~~</includeonly>
10593 * <onlyinclude>~~~</onlyinclude>
10594 !! html
10595 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10596 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10597 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10598 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10599 !! end
10600
10601
10602 !! test
10603 pre-save transform: Signature expansion in nowiki tags (bug 93)
10604 !! options
10605 pst disabled
10606 !! wikitext
10607 Shall not expand:
10608
10609 <nowiki>~~~~</nowiki>
10610
10611 <includeonly><nowiki>~~~~</nowiki></includeonly>
10612
10613 <noinclude><nowiki>~~~~</nowiki></noinclude>
10614
10615 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10616
10617 {{subst:Foo}} shall be converted to FOO
10618
10619 As well as inside noinclude/onlyinclude
10620 <noinclude>{{subst:Foo}}</noinclude>
10621 <onlyinclude>{{subst:Foo}}</onlyinclude>
10622
10623 But not inside includeonly
10624 <includeonly>{{subst:Foo}}</includeonly>
10625 !! html
10626 Shall not expand:
10627
10628 <nowiki>~~~~</nowiki>
10629
10630 <includeonly><nowiki>~~~~</nowiki></includeonly>
10631
10632 <noinclude><nowiki>~~~~</nowiki></noinclude>
10633
10634 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10635
10636 FOO shall be converted to FOO
10637
10638 As well as inside noinclude/onlyinclude
10639 <noinclude>FOO</noinclude>
10640 <onlyinclude>FOO</onlyinclude>
10641
10642 But not inside includeonly
10643 <includeonly>{{subst:Foo}}</includeonly>
10644 !! end
10645
10646 !! test
10647 Parsoid: Recognize nowiki with trailing space in tags
10648 !! options
10649 parsoid=wt2html
10650 !! wikitext
10651 <nowiki ><div>[[foo]]</nowiki >
10652
10653 a<nowiki / >b
10654
10655 c<nowiki />d
10656
10657 e<nowiki/ >f
10658 !! html
10659 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10660 <p>ab</p>
10661 <p>cd</p>
10662 <p>ef</p>
10663 !! end
10664
10665 !! test
10666 Parsoid: Recognize nowiki with odd capitalization
10667 !! options
10668 parsoid=wt2html
10669 !! wikitext
10670 <noWikI ><div>[[foo]]</Nowiki >
10671 !! html
10672 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10673 !! end
10674
10675
10676 !! test
10677 Parsoid: Escape nowiki with trailing space in tags
10678 !! options
10679 parsoid=html2wt
10680 !! wikitext
10681 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10682
10683 a&lt;nowiki /&gt;b
10684
10685 c&lt;nowiki/ &gt;d
10686 !! html
10687 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10688 <p>a&lt;nowiki /&gt;b</p>
10689 <p>c&lt;nowiki/ &gt;d</p>
10690 !! end
10691
10692 !! test
10693 Parsoid: Escape weird noWikI capitalizations
10694 !! options
10695 parsoid=html2wt
10696 !! wikitext
10697 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10698 !! html
10699 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10700 !! end
10701
10702 ###
10703 ### Message transform tests
10704 ###
10705 !! test
10706 message transform: magic variables
10707 !! options
10708 msg
10709 !! wikitext
10710 {{SITENAME}}
10711 !! html
10712 MediaWiki
10713 !! end
10714
10715 !! test
10716 message transform: should not transform wiki markup
10717 !! options
10718 msg
10719 !! wikitext
10720 ''test''
10721 !! html
10722 ''test''
10723 !! end
10724
10725 !! test
10726 message transform: <noinclude> in transcluded template (bug 4926)
10727 !! options
10728 msg
10729 !! wikitext
10730 {{Includes}}
10731 !! html
10732 Foobar
10733 !! end
10734
10735 !! test
10736 message transform: <onlyinclude> in transcluded template (bug 4926)
10737 !! options
10738 msg
10739 !! wikitext
10740 {{Includes2}}
10741 !! html
10742 Foo
10743 !! end
10744
10745 !! test
10746 {{#special:}} page name, known
10747 !! options
10748 msg
10749 !! wikitext
10750 {{#special:Recentchanges}}
10751 !! html
10752 Special:RecentChanges
10753 !! end
10754
10755 !! test
10756 {{#special:}} page name with subpage, known
10757 !! options
10758 msg
10759 !! wikitext
10760 {{#special:Recentchanges/param}}
10761 !! html
10762 Special:RecentChanges/param
10763 !! end
10764
10765 !! test
10766 {{#special:}} page name, unknown
10767 !! options
10768 msg
10769 !! wikitext
10770 {{#special:foobar nonexistent}}
10771 !! html
10772 Special:Foobar nonexistent
10773 !! end
10774
10775 !! test
10776 {{#speciale:}} page name, known
10777 !! options
10778 msg
10779 !! wikitext
10780 {{#speciale:Recentchanges}}
10781 !! html
10782 Special:RecentChanges
10783 !! end
10784
10785 !! test
10786 {{#speciale:}} page name with subpage, known
10787 !! options
10788 msg
10789 !! wikitext
10790 {{#speciale:Recentchanges/param}}
10791 !! html
10792 Special:RecentChanges/param
10793 !! end
10794
10795 !! test
10796 {{#speciale:}} page name, unknown
10797 !! options
10798 msg
10799 !! wikitext
10800 {{#speciale:foobar nonexistent}}
10801 !! html
10802 Special:Foobar_nonexistent
10803 !! end
10804
10805 ###
10806 ### Images
10807 ###
10808 ### For Parsoid-specific tests, see
10809 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10810
10811 !! test
10812 Simple image
10813 !! options
10814 parsoid=wt2html,wt2wt,html2html
10815 !! wikitext
10816 [[Image:foobar.jpg]]
10817 !! html/php
10818 <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>
10819 </p>
10820 !! html/parsoid
10821 <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>
10822 </p>
10823 !! end
10824
10825 !! test
10826 Simple image (using File: namespace, now canonical)
10827 !! wikitext
10828 [[File:Foobar.jpg]]
10829 !! html/php
10830 <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>
10831 </p>
10832 !! html/parsoid
10833 <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>
10834 </p>
10835 !! end
10836
10837 !! test
10838 Right-aligned image
10839 !! wikitext
10840 [[File:Foobar.jpg|right]]
10841 !! html/php
10842 <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>
10843
10844 !! html/parsoid
10845 <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>
10846 !! end
10847
10848 !! test
10849 Image with caption
10850 !! wikitext
10851 [[File:Foobar.jpg|right|Caption text]]
10852 !! html/php
10853 <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>
10854
10855 !! html/parsoid
10856 <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>
10857 !! end
10858
10859 !! test
10860 Image with caption, bug 53312 #1
10861 !! wikitext
10862 [[File:Foobar.jpg|right|Caption page stuff]]
10863 !! html/php
10864 <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>
10865
10866 !! html/parsoid
10867 <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>
10868 !! end
10869
10870 !! test
10871 Image with caption, bug 53312 #2
10872 !! wikitext
10873 [[File:Foobar.jpg|right|Caption page=]]
10874 !! html/php
10875 <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>
10876
10877 !! html/parsoid
10878 <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>
10879 !! end
10880
10881 !! test
10882 Image with caption, bug 53312 #3
10883 !! wikitext
10884 [[File:Foobar.jpg|right|Caption page=stuff]]
10885 !! html/php
10886 <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>
10887
10888 !! html/parsoid
10889 <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>
10890 !! end
10891
10892 !! test
10893 Allow empty links in image captions (Bug 60753)
10894 !! options
10895 thumbsize=220
10896 !! wikitext
10897 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10898 [[]]
10899 [[Link2]]
10900 ]]
10901 !! html/php
10902 <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>
10903
10904 !! html/parsoid
10905 <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"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><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 data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
10906 [[]]
10907 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10908 </figcaption></figure>
10909 !! end
10910
10911 !! test
10912 Link with empty target
10913 !! wikitext
10914 [[]]
10915 !! html
10916 <p>[[]]
10917 </p>
10918 !! end
10919
10920 !! test
10921 Image with empty attribute
10922 !! options
10923 parsoid=wt2html,wt2wt,html2html
10924 !! wikitext
10925 [[File:Foobar.jpg|right||Caption text]]
10926 !! html/php
10927 <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>
10928
10929 !! html/parsoid
10930 <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>
10931 !! end
10932
10933 !! test
10934 1. Block image with individual attributes from templates
10935 !! wikitext
10936 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10937 !! html/php
10938 <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>
10939
10940 !! html/parsoid
10941 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10942 !! end
10943
10944 !! test
10945 2. Block Image with individual attributes from templates
10946 !! wikitext
10947 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10948 !! html/php
10949 <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>
10950
10951 !! html/parsoid
10952 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10953 !! end
10954
10955 !! test
10956 3. Inline image with individual attributes from templates
10957 !! wikitext
10958 [[File:Foobar.jpg|{{echo|50px}}]]
10959 !! html/php
10960 <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>
10961 </p>
10962 !! html/parsoid
10963 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><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>
10964 !! end
10965
10966 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10967 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10968 !! test
10969 Image with multiple attributes from the same template
10970 !! wikitext
10971 [[File:Foobar.jpg|{{image_attribs}}]]
10972 !! html/php
10973 <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>
10974
10975 !! html/parsoid
10976 <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>
10977 !! end
10978
10979 # Parsoid's output here is broken (incorrect p-wrapping); see bug 64901.
10980 !! test
10981 Image with link tails
10982 !! options
10983 thumbsize=220
10984 !! wikitext
10985 123[[File:Foobar.jpg]]456
10986 123[[File:Foobar.jpg|right]]456
10987 123[[File:Foobar.jpg|thumb]]456
10988 !! html/php
10989 <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
10990 </p>
10991 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
10992 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
10993
10994 !! html/php+tidy
10995 <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>
10996 <p>123</p>
10997 <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>
10998 <p>456 123</p>
10999 <div class="thumb tright">
11000 <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>
11001 <div class="thumbcaption">
11002 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11003 </div>
11004 </div>
11005 </div>
11006 <p>456</p>
11007 !! html/parsoid
11008 <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>
11009 123<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>456
11010 123<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>456
11011 !! end
11012
11013 !! test
11014 Image with multiple captions -- only last one is accepted
11015 !! wikitext
11016 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11017 !! html/php
11018 <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>
11019
11020 !! html/parsoid
11021 <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>
11022 !! end
11023
11024 !! test
11025 Image with multiple widths -- use last
11026 !! wikitext
11027 [[File:Foobar.jpg|200px|300px|caption]]
11028 !! html/php
11029 <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>
11030 </p>
11031 !! html/parsoid
11032 <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>
11033 !! end
11034
11035 !! test
11036 Image with multiple alignments -- use first (bug 48664)
11037 !! options
11038 thumbsize=220
11039 !! wikitext
11040 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11041
11042 [[File:Foobar.jpg|middle|text-top|caption]]
11043 !! html/php
11044 <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>
11045 <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>
11046 </p>
11047 !! html/parsoid
11048 <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>
11049 <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>
11050 !! end
11051
11052 !! test
11053 Image with width attribute at different positions
11054 !! wikitext
11055 [[File:Foobar.jpg|200px|right|Caption]]
11056 [[File:Foobar.jpg|right|200px|Caption]]
11057 [[File:Foobar.jpg|right|Caption|200px]]
11058 !! html/php
11059 <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>
11060 <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>
11061 <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>
11062
11063 !! html/parsoid
11064 <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>
11065 <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>
11066 <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>
11067 !! end
11068
11069 # a sad bit of backward-compatibility
11070 !! test
11071 Image with size specified with pxpx (bug 13500, 51628)
11072 !! options
11073 parsoid=wt2html,wt2wt,html2html
11074 !! wikitext
11075 [[File:Foobar.jpg|20pxpx]]
11076 [[File:Foobar.jpg|200x20pxpx]]
11077 !! html/php
11078 <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>
11079 <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>
11080 </p>
11081 !! html/parsoid
11082 <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>
11083 !! end
11084
11085 !! test
11086 Image with link parameter, wiki target
11087 !! wikitext
11088 [[File:Foobar.jpg|link=Main Page]]
11089 !! html/php
11090 <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>
11091 </p>
11092 !! html/parsoid
11093 <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>
11094 !! end
11095
11096 # parsoid bug 49293 (part 1)
11097 !! test
11098 Image with link parameter, URL target
11099 !! wikitext
11100 [[File:Foobar.jpg|link=http://example.com/]]
11101 !! html/php
11102 <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>
11103 </p>
11104 !! html/parsoid
11105 <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>
11106 !! end
11107
11108 # parsoid bug 49293 (part 2)
11109 !! test
11110 Image with link parameter, protocol-less URL target
11111 !! wikitext
11112 [[File:Foobar.jpg|link=//example.com/]]
11113 !! html/php
11114 <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>
11115 </p>
11116 !! html/parsoid
11117 <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>
11118 !! end
11119
11120 !! test
11121 Image with link parameter, wgExternalLinkTarget
11122 !! wikitext
11123 [[Image:foobar.jpg|link=http://example.com/]]
11124 !! config
11125 wgExternalLinkTarget='foobar'
11126 !! html
11127 <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>
11128 </p>
11129 !! end
11130
11131 !! test
11132 Image with link parameter, wgNoFollowLinks set to false
11133 !! wikitext
11134 [[Image:foobar.jpg|link=http://example.com/]]
11135 !! config
11136 wgNoFollowLinks=false
11137 !! html
11138 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11139 </p>
11140 !! end
11141
11142 !! test
11143 Image with link parameter, wgNoFollowDomainExceptions
11144 !! wikitext
11145 [[Image:foobar.jpg|link=http://example.com/]]
11146 !! config
11147 wgNoFollowDomainExceptions='example.com'
11148 !! html
11149 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11150 </p>
11151 !! end
11152
11153 !! test
11154 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11155 !! wikitext
11156 [[Image:foobar.jpg|link=http://example.com/|Title]]
11157 !! config
11158 wgExternalLinkTarget='foobar'
11159 !! html
11160 <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>
11161 </p>
11162 !! end
11163
11164 !! test
11165 Image with empty link parameter
11166 !! wikitext
11167 [[File:Foobar.jpg|link=]]
11168 !! html/php
11169 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11170 </p>
11171 !! html/parsoid
11172 <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>
11173 !! end
11174
11175 !! test
11176 Image with link parameter (wiki target) and unnamed parameter
11177 !! wikitext
11178 [[File:Foobar.jpg|link=Main_Page|Title]]
11179 !! html/php
11180 <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>
11181 </p>
11182 !! html/parsoid
11183 <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>
11184 !! end
11185
11186 !! test
11187 Image with link parameter (URL target) and unnamed parameter
11188 !! wikitext
11189 [[File:Foobar.jpg|link=http://example.com/|Title]]
11190 !! html/php
11191 <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>
11192 </p>
11193 !! html/parsoid
11194 <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>
11195 !! end
11196
11197 !! test
11198 Thumbnail image with link parameter
11199 !! options
11200 thumbsize=220
11201 parsoid=wt2html,wt2wt,html2html
11202 !! wikitext
11203 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11204 !! html/php
11205 <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>
11206
11207 !! html/parsoid
11208 <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>
11209 !! end
11210
11211 !! test
11212 Manually-specified thumbnail image
11213 !! options
11214 thumbsize=220
11215 !! wikitext
11216 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11217 !! html/php
11218 <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>
11219
11220 !! html/parsoid
11221 <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>
11222 !! end
11223
11224 !! test
11225 Manually-specified thumbnail image with explicit link to wiki page
11226 !! options
11227 thumbsize=220
11228 parsoid=wt2html,wt2wt,html2html
11229 !! wikitext
11230 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11231 !! html/php
11232 <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>
11233
11234 !! html/parsoid
11235 <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>
11236 !! end
11237
11238 !! test
11239 Manually-specified thumbnail image with explicit link to url
11240 !! options
11241 thumbsize=220
11242 parsoid=wt2html,wt2wt,html2html
11243 !! wikitext
11244 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11245 !! html/php
11246 <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>
11247
11248 !! html/parsoid
11249 <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>
11250 !! end
11251
11252 !! test
11253 Manually-specified thumbnail image with explicit no link
11254 !! options
11255 thumbsize=220
11256 parsoid=wt2html,wt2wt,html2html
11257 !! wikitext
11258 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11259 !! html/php
11260 <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>
11261
11262 !! html/parsoid
11263 <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>
11264 !! end
11265
11266 !! test
11267 Manually-specified thumbnail image with explicit link and alt text
11268 !! options
11269 thumbsize=220
11270 parsoid=wt2html,wt2wt,html2html
11271 !! wikitext
11272 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11273 !! html/php
11274 <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>
11275
11276 !! html/parsoid
11277 <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>
11278 !! end
11279
11280 !! test
11281 Image with frame and link
11282 !! options
11283 parsoid=wt2html,wt2wt,html2html
11284 !! wikitext
11285 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11286 !! html/php
11287 <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>
11288
11289 !! html/parsoid
11290 <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>
11291 !! end
11292
11293 !! test
11294 Image with frame and link and explicit alt
11295 !! options
11296 parsoid=wt2html,wt2wt,html2html
11297 !! wikitext
11298 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11299 !! html/php
11300 <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>
11301
11302 !! html/parsoid
11303 <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>
11304 !! end
11305
11306 !! test
11307 Image with wiki markup in implicit alt
11308 !! options
11309 parsoid=wt2html,wt2wt,html2html
11310 !! wikitext
11311 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11312
11313 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11314 !! html/php
11315 <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>
11316 </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>
11317 </p>
11318 !! html/parsoid
11319 <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>
11320 <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>
11321 !! end
11322
11323 ###################
11324 # Conflicting image format options.
11325 # First option specified should 'win'.
11326 # All three cases in each test should be identical.
11327
11328 !! test
11329 Image with 'frameless' first.
11330 !! options
11331 parsoid=wt2html,wt2wt,html2html
11332 !! wikitext
11333 [[File:Foobar.jpg|frameless|caption]]
11334
11335 [[File:Foobar.jpg|frameless|frame|caption]]
11336
11337 [[File:Foobar.jpg|frameless|thumb|caption]]
11338 !! html/php
11339 <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>
11340 </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>
11341 </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>
11342 </p>
11343 !! html/parsoid
11344 <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>
11345 <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>
11346 <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>
11347 !! end
11348
11349 !! test
11350 Image with 'frame' first.
11351 !! options
11352 parsoid=wt2html,wt2wt,html2html
11353 !! wikitext
11354 [[File:Foobar.jpg|frame|caption]]
11355 [[File:Foobar.jpg|frame|frameless|caption]]
11356 [[File:Foobar.jpg|frame|thumb|caption]]
11357 !! html/php
11358 <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>
11359 <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>
11360 <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>
11361
11362 !! html/parsoid
11363 <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><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><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>
11364 !! end
11365
11366 !! test
11367 Image with 'thumb' first.
11368 !! options
11369 parsoid=wt2html,wt2wt,html2html
11370 !! wikitext
11371 [[File:Foobar.jpg|thumb|caption]]
11372 [[File:Foobar.jpg|thumb|frameless|caption]]
11373 [[File:Foobar.jpg|thumb|frame|caption]]
11374 !! html/php
11375 <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>
11376 <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>
11377 <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>
11378
11379 !! html/parsoid
11380 <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><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><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>
11381 !! end
11382
11383 ###################
11384 # Image sizing.
11385 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11386 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11387 # Foobar has actual size of 1941x220
11388 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11389 # a scalable format.
11390 # 2. Framed images always ignore size options; always render at default size.
11391 # 3. "Unspecified format" and border are the only types which can be
11392 # enlarged.
11393
11394 !! test
11395 Image: "unspecified format" and border enlarge
11396 !! options
11397 parsoid=wt2html,wt2wt,html2html
11398 !! wikitext
11399 [[File:Foobar.jpg|2000px]]
11400
11401 [[File:Foobar.jpg|border|2000px]]
11402 !! html/php
11403 <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>
11404 </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>
11405 </p>
11406 !! html/parsoid
11407 <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>
11408 <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>
11409 !! end
11410
11411 !! test
11412 Image: "unspecified format" and border reduce
11413 !! options
11414 parsoid=wt2html,wt2wt,html2html
11415 !! wikitext
11416 [[File:Foobar.jpg|1000px]]
11417
11418 [[File:Foobar.jpg|border|1000px]]
11419 !! html/php
11420 <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>
11421 </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>
11422 </p>
11423 !! html/parsoid
11424 <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>
11425 <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>
11426 !! end
11427
11428 !! test
11429 Image: thumbs reduce
11430 !! options
11431 parsoid=wt2html,wt2wt,html2html
11432 !! wikitext
11433 [[File:Foobar.jpg|thumb|50px]]
11434 !! html/php
11435 <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>
11436
11437 !! html/parsoid
11438 <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>
11439 !! end
11440
11441 !! test
11442 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11443 !! options
11444 parsoid=wt2html,wt2wt,html2html
11445 !! wikitext
11446 [[File:Foobar.jpg|thumb|2000px]]
11447
11448 [[File:Foobar.svg|thumb|2000px]]
11449 !! html/php
11450 <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>
11451 <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>
11452
11453 !! html/parsoid
11454 <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>
11455 <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>
11456 !! end
11457
11458 !! test
11459 Image: frameless can reduce in size
11460 !! options
11461 parsoid=wt2html,wt2wt,html2html
11462 !! wikitext
11463 [[File:Foobar.jpg|frameless|50px]]
11464 !! html/php
11465 <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>
11466 </p>
11467 !! html/parsoid
11468 <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>
11469 !! end
11470
11471 !! test
11472 Image: bitmap frameless can't be enlarged past original size, but vector can
11473 !! options
11474 parsoid=wt2html,wt2wt,html2html
11475 !! wikitext
11476 [[File:Foobar.jpg|frameless|2000px]]
11477
11478 [[File:Foobar.svg|frameless|2000px]]
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><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>
11482 </p>
11483 !! html/parsoid
11484 <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>
11485 <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>
11486 !! end
11487
11488 !! test
11489 Image: framed images are always unscaled.
11490 !! options
11491 parsoid=wt2html,wt2wt,html2html
11492 !! wikitext
11493 [[File:Foobar.jpg|frame]]
11494
11495 [[File:Foobar.jpg|frame|50px]]
11496
11497 [[File:Foobar.jpg|frame|50x50px]]
11498
11499 [[File:Foobar.jpg|frame|2000px]]
11500 !! html/php
11501 <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>
11502 <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>
11503 <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>
11504 <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>
11505
11506 !! html/parsoid
11507 <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><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><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><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>
11508 !! end
11509
11510 ###################
11511
11512 !! test
11513 Link to image page- image page normally doesn't exists, hence edit link
11514 Add test with existing image page
11515 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11516 !! wikitext
11517 [[:Image:test]]
11518 !! html
11519 <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>
11520 </p>
11521 !! end
11522
11523 !! test
11524 bug 18784 Link to non-existent image page with caption should use caption as link text
11525 !! wikitext
11526 [[:Image:test|caption]]
11527 !! html
11528 <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>
11529 </p>
11530 !! end
11531
11532 !! test
11533 Frameless image caption with a free URL
11534 !! wikitext
11535 [[File:Foobar.jpg|http://example.com]]
11536 !! html/php
11537 <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>
11538 </p>
11539 !! html/parsoid
11540 <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>
11541 !! end
11542
11543 !! test
11544 Thumbnail image caption with a free URL
11545 !! options
11546 thumbsize=220
11547 !! wikitext
11548 [[File:Foobar.jpg|thumb|http://example.com]]
11549 !! html/php
11550 <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>
11551
11552 !! html/parsoid
11553 <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>
11554 !! end
11555
11556 !! test
11557 Thumbnail image caption with a free URL and explicit alt
11558 !! options
11559 thumbsize=220
11560 parsoid=wt2html,wt2wt,html2html
11561 !! wikitext
11562 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11563 !! html/php
11564 <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>
11565
11566 !! html/parsoid
11567 <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>
11568 !! end
11569
11570 !! test
11571 SVG thumbnails with no language set
11572 !! options
11573 !! wikitext
11574 [[File:Foobar.svg|thumb|caption]]
11575 !! html/php
11576 <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>
11577
11578 !! html/parsoid
11579 <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>
11580 !! end
11581
11582 !! test
11583 SVG thumbnails with language de
11584 !! options
11585 parsoid=wt2html,wt2wt,html2html
11586 !! wikitext
11587 [[File:Foobar.svg|thumb|caption|lang=de]]
11588 !! html/php
11589 <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>
11590
11591 !! html/parsoid
11592 <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>
11593 !! end
11594
11595 !! test
11596 SVG thumbnails with invalid language code
11597 !! options
11598 parsoid=wt2html,wt2wt,html2html
11599 !! wikitext
11600 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11601 !! html/php
11602 <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>
11603
11604 !! html/parsoid
11605 <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>
11606 !! end
11607
11608 !! test
11609 BUG 1887: A ISBN with a thumbnail
11610 !! wikitext
11611 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11612 !! html/php
11613 <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>
11614
11615 !! html/parsoid
11616 <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>
11617 !! end
11618
11619 !! test
11620 BUG 1887: A RFC with a thumbnail
11621 !! wikitext
11622 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11623 !! html/php
11624 <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>
11625
11626 !! html/parsoid
11627 <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>
11628 !! end
11629
11630 !! test
11631 BUG 1887: A mailto link with a thumbnail
11632 !! wikitext
11633 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11634 !! html/php
11635 <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>
11636
11637 !! html/parsoid
11638 <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>
11639 !! end
11640
11641 # Pending resolution to bug 368
11642 !! test
11643 BUG 648: Frameless image caption with a link
11644 !! wikitext
11645 [[File:Foobar.jpg|text with a [[link]] in it]]
11646 !! html/php
11647 <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>
11648 </p>
11649 !! html/parsoid
11650 <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>
11651 !! end
11652
11653 !! test
11654 BUG 648: Frameless image caption with a link (suffix)
11655 !! wikitext
11656 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11657 !! html/php
11658 <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>
11659 </p>
11660 !! html/parsoid
11661 <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>
11662 !! end
11663
11664 !! test
11665 BUG 648: Frameless image caption with an interwiki link
11666 !! wikitext
11667 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11668 !! html/php
11669 <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>
11670 </p>
11671 !! html/parsoid
11672 <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>
11673 !! end
11674
11675 !! test
11676 BUG 648: Frameless image caption with a piped interwiki link
11677 !! wikitext
11678 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11679 !! html/php
11680 <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>
11681 </p>
11682 !! html/parsoid
11683 <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>
11684 !! end
11685
11686 !! test
11687 Escape HTML special chars in image alt text
11688 !! wikitext
11689 [[File:Foobar.jpg|& < > "]]
11690 !! html/php
11691 <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>
11692 </p>
11693 !! html/parsoid
11694 <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>
11695 !! end
11696
11697 !! test
11698 BUG 499: Alt text should have &#1234;, not &amp;1234;
11699 !! wikitext
11700 [[File:Foobar.jpg|&#9792;]]
11701 !! html/php
11702 <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>
11703 </p>
11704 !! html/parsoid
11705 <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>
11706 !! end
11707
11708 !! test
11709 Broken image caption with link
11710 !! options
11711 parsoid=wt2html,wt2wt,html2html
11712 !! wikitext
11713 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11714 !! html/php
11715 <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.
11716 </p>
11717 !! html/parsoid
11718 <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>
11719 !! end
11720
11721 !! test
11722 Image caption containing another image
11723 !! wikitext
11724 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11725 !! html/php
11726 <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>
11727
11728 !! html/parsoid
11729 <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>
11730 !! end
11731
11732 !! test
11733 Image: caption containing a newline
11734 !! wikitext
11735 [[File:Foobar.jpg|This
11736 *is some text]]
11737 !! html/php
11738 <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>
11739 </p>
11740 !! html/parsoid
11741 <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>
11742 !!end
11743
11744 !!test
11745 Image: caption containing leading space
11746 (The leading space should not trigger nowiki escaping in wt2wt mode)
11747 !! wikitext
11748 [[File:Foobar.jpg|thumb| bar]]
11749 !! html/php
11750 <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>
11751
11752 !! html/parsoid
11753 <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>
11754 !!end
11755
11756 !! test
11757 Image: caption containing a table
11758 !! options
11759 parsoid=wt2html,wt2wt,html2html
11760 !! wikitext
11761 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11762 {|
11763 ! Foo !! Bar
11764 |-
11765 | Foo1 || Bar1
11766 |}
11767 and some more text.]]
11768 !! html/php
11769 <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>
11770
11771 !! html/parsoid
11772 <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
11773 <table>
11774 <tbody>
11775 <tr><th>Foo </th><th>Bar</th></tr>
11776 <tr>
11777 <td>Foo1 </td>
11778 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11779 !! end
11780
11781 !! test
11782 Bug 3090: External links other than http: in image captions
11783 !! wikitext
11784 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11785 !! html/php
11786 <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>
11787
11788 !! html/parsoid
11789 <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>
11790 !! end
11791
11792 !! test
11793 Custom class
11794 !! options
11795 parsoid=wt2html,wt2wt,html2html
11796 !! wikitext
11797 [[Image:foobar.jpg|a|class=b]]
11798 !! html/php
11799 <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>
11800 </p>
11801 !! html/parsoid
11802 <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>
11803 !! end
11804
11805 !! test
11806 Localized image handling (1).
11807 !! options
11808 parsoid=wt2html,wt2wt,html2html
11809 language=es
11810 !! wikitext
11811 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11812 !! html/php
11813 <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>
11814
11815 !! html/parsoid
11816 <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>
11817 !! end
11818
11819 !! test
11820 Localized image handling (2).
11821 !! options
11822 thumbsize=220
11823 parsoid=wt2html,wt2wt,html2html
11824 language=es
11825 !! wikitext
11826 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11827 !! html/php
11828 <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>
11829
11830 !! html/parsoid
11831 <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>
11832 !! end
11833
11834 !! test
11835 "border", "frameless" and "class" attributes on an image.
11836 !! options
11837 thumbsize=220
11838 parsoid=wt2html,wt2wt,html2html
11839 !! wikitext
11840 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11841 !! html/php
11842 <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>
11843 </p>
11844 !! html/parsoid
11845 <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>
11846 !! end
11847
11848 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11849 !! test
11850 Invalid image attributes (bug 62500)
11851 !! options
11852 thumbsize=220
11853 parsoid=wt2html,wt2wt,html2html
11854 !! wikitext
11855 [[File:Foobar.jpg|thumb|float|left|caption]]
11856
11857 [[File:Foobar.jpg|thumb|righ|caption]]
11858
11859 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11860 !! html/php
11861 <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>
11862 <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>
11863 <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>
11864
11865 !! html/parsoid
11866 <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><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><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>
11867 !! end
11868
11869 !! article
11870 File:Barfoo.jpg
11871 !! text
11872 #REDIRECT [[File:Barfoo.jpg]]
11873 !! endarticle
11874
11875 !! test
11876 Redirected image
11877 !! wikitext
11878 [[Image:Barfoo.jpg]]
11879 !! html
11880 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11881 </p>
11882 !! end
11883
11884 !! test
11885 Missing image with uploads disabled
11886 !! options
11887 wgEnableUploads=0
11888 !! wikitext
11889 [[Image:Foobaz.jpg]]
11890 !! html
11891 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11892 </p>
11893 !! end
11894
11895 # Parsoid-specific testing for images
11896 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11897 # Currently imperfect due to a flaw in the Parsoid testrunner
11898 # Work in progress
11899 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11900 # image tests.
11901
11902 !! test
11903 Parsoid-specific image handling - simple image with size and middle alignment
11904 !! wikitext
11905 [[File:Foobar.jpg|middle|50px]]
11906 !! html/parsoid
11907 <p><span class="mw-valign-middle" typeof="mw:Image">
11908 <a href="File:Foobar.jpg">
11909 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11910 </a>
11911 </span>
11912 </p>
11913 !! end
11914
11915 !! test
11916 Parsoid-specific image handling - simple image with size, middle alignment,
11917 non-standard namespace alias
11918 !! options
11919 parsoid=wt2wt,wt2html,html2html
11920 !! wikitext
11921 [[Image:Foobar.jpg|middle|50px]]
11922 !! html/parsoid
11923 <p><span class="mw-valign-middle" typeof="mw:Image">
11924 <a href="File:Foobar.jpg">
11925 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11926 </a>
11927 </span>
11928 </p>
11929 !! end
11930
11931 !! test
11932 Parsoid-specific image handling - simple image with size and middle alignment
11933 (existing content)
11934 !! wikitext
11935 [[File:Foobar.jpg|50px|middle]]
11936 !! html/parsoid
11937 <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>
11938 !! end
11939
11940 !! test
11941 Parsoid-specific image handling - simple image with size and middle alignment
11942 and non-standard namespace name
11943 !! options
11944 parsoid=wt2html,wt2wt,html2html
11945 !! wikitext
11946 [[Image:Foobar.jpg|50px|middle]]
11947 !! html/parsoid
11948 <p><span class="mw-valign-middle" typeof="mw:Image">
11949 <a href="File:Foobar.jpg">
11950 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11951 </a>
11952 </span>
11953 </p>
11954 !! end
11955
11956 !! test
11957 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11958 !! wikitext
11959 [[File:Foobar.jpg|500x10px|baseline|caption]]
11960 !! html/parsoid
11961 <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>
11962 !! end
11963
11964 !! test
11965 Parsoid-specific image handling - simple image with border and size spec
11966 !! wikitext
11967 [[File:Foobar.jpg|50px|border|caption]]
11968 !! html/parsoid
11969 <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>
11970 !! end
11971
11972 !! test
11973 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11974 !! wikitext
11975 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11976 !! html/parsoid
11977 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11978 <a href="File:Foobar.jpg">
11979 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11980 </a>
11981 <figcaption>caption content</figcaption>
11982 </figure>
11983 !! end
11984
11985 !! test
11986 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11987 (existing content)
11988 !! wikitext
11989 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11990 !! html/parsoid
11991 <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>
11992 !! end
11993
11994 !! test
11995 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11996 !! wikitext
11997 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11998 !! html/parsoid
11999 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
12000 <a href="File:Foobar.jpg">
12001 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
12002 </a>
12003 <figcaption>caption</figcaption>
12004 </figure>
12005 !! end
12006
12007 !! test
12008 Parsoid-specific image handling - thumbnail with specific size, halign,
12009 valign, and caption (existing content)
12010 !! wikitext
12011 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12012 !! html/parsoid
12013 <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>
12014 !! end
12015
12016 !! test
12017 Parsoid-specific image handling - framed image with specific size and caption
12018 (size is ignored)
12019 !! options
12020 parsoid=wt2html,wt2wt,html2html
12021 !! wikitext
12022 [[File:Foobar.jpg|frame|500x50px|caption]]
12023 !! html/parsoid
12024 <figure typeof="mw:Image/Frame">
12025 <a href="File:Foobar.jpg">
12026 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
12027 </a>
12028 <figcaption>caption</figcaption>
12029 </figure>
12030 !! end
12031
12032 !! test
12033 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12034 (size is ignored)
12035 !! options
12036 parsoid=wt2html,wt2wt,html2html
12037 !! wikitext
12038 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12039 !! html/parsoid
12040 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
12041 <a href="File:Foobar.jpg">
12042 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
12043 </a>
12044 <figcaption>caption</figcaption>
12045 </figure>
12046 !! end
12047
12048 !! test
12049 Parsoid-specific image handling - frameless image with specific size, border, and caption
12050 !! wikitext
12051 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12052 !! html/parsoid
12053 <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>
12054 !! end
12055
12056 !! test
12057 Parsoid-specific image handling - simple image with a formatted caption
12058 !! wikitext
12059 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12060 !! html/parsoid
12061 <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>"}'>
12062 <a href="File:Foobar.jpg">
12063 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
12064 </a></span></p>
12065 !! end
12066
12067 !! test
12068 Parsoid-specific image handling - caption with a template in it
12069 !! wikitext
12070 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12071 !! html/parsoid
12072 <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>
12073 !! end
12074
12075 !! test
12076 Parsoid-specific image handling - caption with unbalanced tags in it
12077 !! options
12078 parsoid=wt2html,wt2wt,html2html
12079 !! wikitext
12080 foo
12081 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12082 bar
12083 !! html/parsoid
12084 <p>foo</p>
12085 <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>
12086 <p>bar</p>
12087 !! end
12088
12089 !! test
12090 Parsoid-specific image handling - empty caption (1)
12091 !! options
12092 parsoid=wt2html,wt2wt
12093 !! wikitext
12094 [[File:Foobar.jpg|thumb|]]
12095 !! html/parsoid
12096 <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>
12097 !! end
12098
12099 # empty captions don't get serialized unless we're in the "round trip" case
12100 !! test
12101 Parsoid-specific image handling - empty caption (2)
12102 !! options
12103 parsoid=html2wt
12104 !! html/parsoid
12105 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12106 <a href="File:Foobar.jpg">
12107 <img resource="./File:Foobar.jpg"
12108 src="//example.com/images/3/3a/Foobar.jpg"
12109 height="25" width="220"/>
12110 </a>
12111 <figcaption></figcaption>
12112 </figure>
12113 !! wikitext
12114 [[File:Foobar.jpg|thumb]]
12115 !! end
12116
12117 !! test
12118 Parsoid-specific image handling - whitespace caption
12119 !! wikitext
12120 [[File:Foobar.jpg|thumb| ]]
12121 !! html/parsoid
12122 <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>
12123 !! end
12124
12125 !! test
12126 Parsoid-specific image handling - lang option
12127 !! wikitext
12128 foo
12129 [[File:Foobar.svg|lang=de|caption]]
12130 bar
12131 !! html/parsoid
12132 <p>foo
12133 <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>
12134 bar</p>
12135 !! end
12136
12137
12138 ###
12139 ### Subpages
12140 ###
12141 !! article
12142 Subpage test/subpage
12143 !! text
12144 foo
12145 !! endarticle
12146
12147 !! test
12148 Subpage link
12149 !! options
12150 subpage title=[[Subpage test]]
12151 !! wikitext
12152 [[/subpage]]
12153 !! html
12154 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12155 </p>
12156 !! end
12157
12158 !! test
12159 Subpage noslash link
12160 !! options
12161 subpage title=[[Subpage test]]
12162 !! wikitext
12163 [[/subpage/]]
12164 !! html
12165 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12166 </p>
12167 !! end
12168
12169 # TODO: make this PHP-parser compatible!
12170 !! test
12171 Relative subpage noslash link
12172 !! options
12173 parsoid=wt2wt,wt2html,html2html
12174 subpage title=[[Subpage test/1/2/3/4]]
12175 !! wikitext
12176 [[../../subpage/]]
12177
12178 [[../../subpage]]
12179 !! html
12180 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p>
12181 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12182 !! end
12183
12184 !! test
12185 Parsoid: dot-slash prefixed wikilinks
12186 !! wikitext
12187 [[./foo]]
12188
12189 [[././bar]]
12190
12191 [[././baz/]]
12192 !! html/php
12193 <p>[[./foo]]
12194 </p><p>[[././bar]]
12195 </p><p>[[././baz/]]
12196 </p>
12197 !! html/parsoid
12198 <p>[[./foo]]
12199 </p><p>[[././bar]]
12200 </p><p>[[././baz/]]
12201 </p>
12202 !! end
12203
12204 !! test
12205 Render invalid page names as plain text (bug 51090)
12206 !! wikitext
12207 [[./../foo|bar]]
12208 [[foo�|bar]]
12209 [[foo/.|bar]]
12210 [[foo/..|bar]]
12211 [[foo~~~bar]]
12212 [[foo>bar]]
12213 [[foo[bar]]
12214 [[.]]
12215 [[..]]
12216 [[foo././bar]]
12217
12218 [[{{echo|./../foo}}|bar]]
12219 [[{{echo|foo/.}}|bar]]
12220 [[{{echo|foo/..}}|bar]]
12221 [[{{echo|foo~~~~bar}}]]
12222 [[{{echo|foo>bar}}]]
12223 [[{{echo|foo././bar}}]]
12224 [[{{echo|foo{bar}}]]
12225 [[{{echo|foo}bar}}]]
12226 [[{{echo|foo[bar}}]]
12227 [[{{echo|foo]bar}}]]
12228 [[{{echo|foo<bar}}]]
12229 !!html/php
12230 <p>[[./../foo|bar]]
12231 [[foo�|bar]]
12232 [[foo/.|bar]]
12233 [[foo/..|bar]]
12234 [[foo~~~bar]]
12235 [[foo&gt;bar]]
12236 [[foo[bar]]
12237 [[.]]
12238 [[..]]
12239 [[foo././bar]]
12240 </p><p>[[./../foo|bar]]
12241 [[foo/.|bar]]
12242 [[foo/..|bar]]
12243 [[foo~~~~bar]]
12244 [[foo&gt;bar]]
12245 [[foo././bar]]
12246 [[foo{bar]]
12247 [[foo}bar]]
12248 [[foo[bar]]
12249 [[foo]bar]]
12250 [[foo&lt;bar]]
12251 </p>
12252 !!html/parsoid
12253 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
12254 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]][[<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>
12255 !!end
12256
12257 !! test
12258 Disabled subpages
12259 !! wikitext
12260 [[/subpage]]
12261 !! html
12262 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12263 </p>
12264 !! end
12265
12266 !! test
12267 BUG 561: {{/Subpage}}
12268 !! options
12269 subpage title=[[Page]]
12270 !! wikitext
12271 {{/Subpage}}
12272 !! html
12273 <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>
12274 </p>
12275 !! end
12276
12277 ###
12278 ### Categories
12279 ###
12280 !! article
12281 Category:MediaWiki User's Guide
12282 !! text
12283 blah
12284 !! endarticle
12285
12286 !! test
12287 Link to category
12288 !! wikitext
12289 [[:Category:MediaWiki User's Guide]]
12290 !! html
12291 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12292 </p>
12293 !! end
12294
12295 !! test
12296 Simple category
12297 !! options
12298 cat
12299 !! wikitext
12300 [[Category:MediaWiki User's Guide]]
12301 !! html
12302 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12303 !! end
12304
12305 !! test
12306 PAGESINCATEGORY invalid title fatal (r33546 fix)
12307 !! wikitext
12308 {{PAGESINCATEGORY:<bogus>}}
12309 !! html
12310 <p>0
12311 </p>
12312 !! end
12313
12314 !! test
12315 Category with different sort key
12316 !! options
12317 cat
12318 !! wikitext
12319 [[Category:MediaWiki User's Guide|Foo]]
12320 !! html
12321 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12322 !! end
12323
12324 !! test
12325 Category with identical sort key
12326 !! options
12327 cat
12328 !! wikitext
12329 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12330 !! html
12331 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12332 !! end
12333
12334 !! test
12335 Category with empty sort key
12336 !! options
12337 cat
12338 pst
12339 !! wikitext
12340 [[Category:MediaWiki User's Guide|]]
12341 !! html
12342 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12343 !! end
12344
12345 !! test
12346 Category with empty sort key and parentheses
12347 !! options
12348 cat
12349 pst
12350 !! wikitext
12351 [[Category:Foo (bar)|]]
12352 !! html
12353 [[Category:Foo (bar)|Foo]]
12354 !! end
12355
12356 !! test
12357 Category with link tail
12358 !! options
12359 cat
12360 pst
12361 !! wikitext
12362 123[[Category:Foo]]456
12363 !! html
12364 123[[Category:Foo]]456
12365 !! end
12366
12367 !! test
12368 Category with template
12369 !! options
12370 cat
12371 pst
12372 !! wikitext
12373 [[Category:{{echo|Foo}}]]
12374 !! html
12375 [[Category:{{echo|Foo}}]]
12376 !! end
12377
12378 !! test
12379 Category with template in sort key
12380 !! options
12381 cat
12382 pst
12383 !! wikitext
12384 [[Category:Foo|{{echo|Bar}}]]
12385 !! html
12386 [[Category:Foo|{{echo|Bar}}]]
12387 !! end
12388
12389 !! test
12390 Category with template in sort key and title
12391 !! options
12392 cat
12393 pst
12394 !! wikitext
12395 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12396 !! html
12397 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12398 !! end
12399
12400 !! test
12401 Category / paragraph interactions
12402 !! wikitext
12403 Foo [[Category:Baz]] Bar
12404
12405 Foo [[Category:Baz]]
12406 Bar
12407
12408 Foo
12409 [[Category:Baz]]
12410 Bar
12411
12412 Foo
12413 [[Category:Baz]] Bar
12414
12415 Foo
12416 [[Category:Baz]]
12417 [[Category:Baz]]
12418 [[Category:Baz]]
12419 Bar
12420
12421 [[Category:Baz]]
12422 [[Category:Baz]]
12423 [[Category:Baz]]
12424
12425 [[Category:Baz]]
12426 {{echo|[[Category:Baz]]}}
12427 [[Category:Baz]]
12428 !! html
12429 <p>Foo Bar
12430 </p><p>Foo
12431 Bar
12432 </p><p>Foo
12433 Bar
12434 </p><p>Foo Bar
12435 </p><p>Foo
12436 Bar
12437 </p>
12438 !! end
12439
12440 !! test
12441 Parsoid: Serialize link to category page with colon escape
12442 !! options
12443 parsoid
12444 !! wikitext
12445
12446 [[:Category:Foo]]
12447 [[:Category:Foo|Bar]]
12448 !! html
12449 <p>
12450 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12451 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12452 </p>
12453 !! end
12454
12455 !! test
12456 Parsoid: Link prefix/suffixes aren't applied to category links
12457 !! options
12458 parsoid=wt2html,wt2wt,html2html
12459 language=is
12460 !! wikitext
12461 x[[Category:Foo]]y
12462 !! html
12463 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12464 !! end
12465
12466 !! test
12467 Parsoid: Serialize link to file page with colon escape
12468 !! options
12469 parsoid
12470 !! wikitext
12471
12472 [[:File:Foo.png]]
12473 [[:File:Foo.png|Bar]]
12474 !! html
12475 <p>
12476 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12477 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12478 </p>
12479 !! end
12480
12481 !! test
12482 Parsoid: Serialize a genuine category link without colon escape
12483 !! options
12484 parsoid
12485 !! wikitext
12486 [[Category:Foo]]
12487 [[Category:Foo|Bar]]
12488 !! html
12489 <link rel="mw:PageProp/Category" href="Category:Foo">
12490 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12491 !! end
12492
12493 !! test
12494 Parsoid: Defaultsort
12495 !! options
12496 parsoid
12497 !! wikitext
12498 {{DEFAULTSORT:Foo}}
12499 !! html
12500 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12501 !! end
12502
12503 ###
12504 ### Inter-language links
12505 ###
12506 !! test
12507 Interlanguage links
12508 !! options
12509 ill
12510 !! wikitext
12511 [[es:Alimento]]
12512 [[fr:Nourriture]]
12513 [[zh:食品]]
12514 !! html/php
12515 es:Alimento fr:Nourriture zh:食品
12516 !! html/parsoid
12517 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/>
12518 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/>
12519 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p>
12520 !! end
12521
12522 !! test
12523 Duplicate interlanguage links (bug 24502)
12524 !! options
12525 ill
12526 !! wikitext
12527 [[es:1]]
12528 [[es:2]]
12529 [[fr:1]]
12530 [[fr:2]]
12531 !! html/php
12532 es:1 fr:1
12533 !! html/parsoid
12534 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/>
12535 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/>
12536 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/>
12537 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p>
12538 !! end
12539
12540 ###
12541 ### Sections
12542 ###
12543 !! test
12544 Basic section headings
12545 !! wikitext
12546 == Headline 1 ==
12547 Some text
12548
12549 ==Headline 2==
12550 More
12551 ===Smaller headline===
12552 Blah blah
12553 !! html
12554 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12555 <p>Some text
12556 </p>
12557 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12558 <p>More
12559 </p>
12560 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12561 <p>Blah blah
12562 </p>
12563 !! end
12564
12565 !! test
12566 Section headings with TOC
12567 !! wikitext
12568 == Headline 1 ==
12569 === Subheadline 1 ===
12570 ===== Skipping a level =====
12571 ====== Skipping a level ======
12572
12573 == Headline 2 ==
12574 Some text
12575 ===Another headline===
12576 !! html
12577 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12578 <ul>
12579 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12580 <ul>
12581 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12582 <ul>
12583 <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>
12584 <ul>
12585 <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>
12586 </ul>
12587 </li>
12588 </ul>
12589 </li>
12590 </ul>
12591 </li>
12592 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12593 <ul>
12594 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12595 </ul>
12596 </li>
12597 </ul>
12598 </div>
12599
12600 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12601 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12602 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
12603 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12604 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12605 <p>Some text
12606 </p>
12607 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12608
12609 !! end
12610
12611 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12612 !! test
12613 Handling of sections up to level 6 and beyond
12614 !! wikitext
12615 = Level 1 Heading=
12616 == Level 2 Heading==
12617 === Level 3 Heading===
12618 ==== Level 4 Heading====
12619 ===== Level 5 Heading=====
12620 ====== Level 6 Heading======
12621 ======= Level 7 Heading=======
12622 ======== Level 8 Heading========
12623 ========= Level 9 Heading=========
12624 ========== Level 10 Heading==========
12625 !! html
12626 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12627 <ul>
12628 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12629 <ul>
12630 <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>
12631 <ul>
12632 <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>
12633 <ul>
12634 <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>
12635 <ul>
12636 <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>
12637 <ul>
12638 <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>
12639 <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>
12640 <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>
12641 <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>
12642 <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>
12643 </ul>
12644 </li>
12645 </ul>
12646 </li>
12647 </ul>
12648 </li>
12649 </ul>
12650 </li>
12651 </ul>
12652 </li>
12653 </ul>
12654 </div>
12655
12656 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12657 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12658 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12659 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
12660 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
12661 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12662 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12663 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12664 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12665 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12666
12667 !! end
12668
12669 !! test
12670 TOC regression (bug 9764)
12671 !! wikitext
12672 == title 1 ==
12673 === title 1.1 ===
12674 ==== title 1.1.1 ====
12675 === title 1.2 ===
12676 == title 2 ==
12677 === title 2.1 ===
12678 !! html
12679 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12680 <ul>
12681 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12682 <ul>
12683 <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>
12684 <ul>
12685 <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>
12686 </ul>
12687 </li>
12688 <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>
12689 </ul>
12690 </li>
12691 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12692 <ul>
12693 <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>
12694 </ul>
12695 </li>
12696 </ul>
12697 </div>
12698
12699 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12700 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12701 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
12702 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12703 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12704 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12705
12706 !! end
12707
12708 !! test
12709 TOC with wgMaxTocLevel=3 (bug 6204)
12710 !! options
12711 wgMaxTocLevel=3
12712 !! wikitext
12713 == title 1 ==
12714 === title 1.1 ===
12715 ==== title 1.1.1 ====
12716 === title 1.2 ===
12717 == title 2 ==
12718 === title 2.1 ===
12719 !! html
12720 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12721 <ul>
12722 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12723 <ul>
12724 <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>
12725 <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>
12726 </ul>
12727 </li>
12728 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12729 <ul>
12730 <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>
12731 </ul>
12732 </li>
12733 </ul>
12734 </div>
12735
12736 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12737 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12738 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
12739 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12740 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12741 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12742
12743 !! end
12744
12745 !! test
12746 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12747 !! options
12748 wgMaxTocLevel=3
12749 !! wikitext
12750 ==Section 1==
12751 ===Section 1.1===
12752 ====Section 1.1.1====
12753 ====Section 1.1.1.1====
12754 ==Section 2==
12755 !! html
12756 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12757 <ul>
12758 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12759 <ul>
12760 <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>
12761 </ul>
12762 </li>
12763 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12764 </ul>
12765 </div>
12766
12767 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12768 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12769 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
12770 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
12771 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12772
12773 !! end
12774
12775
12776 !! test
12777 Resolving duplicate section names
12778 !! wikitext
12779 == Foo bar ==
12780 == Foo bar ==
12781 !! html
12782 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12783 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12784
12785 !! end
12786
12787 !! test
12788 Resolving duplicate section names with differing case (bug 10721)
12789 !! wikitext
12790 == Foo bar ==
12791 == Foo Bar ==
12792 !! html
12793 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12794 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12795
12796 !! end
12797
12798 !! article
12799 Template:sections
12800 !! text
12801 ===Section 1===
12802 ==Section 2==
12803 !! endarticle
12804
12805 !! test
12806 Template with sections, __NOTOC__
12807 !! wikitext
12808 __NOTOC__
12809 ==Section 0==
12810 {{sections}}
12811 ==Section 4==
12812 !! html
12813 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12814 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12815 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12816 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12817
12818 !! end
12819
12820 !! test
12821 __NOEDITSECTION__ keyword
12822 !! wikitext
12823 __NOEDITSECTION__
12824 ==Section 1==
12825 ==Section 2==
12826 !! html
12827 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12828 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12829
12830 !! end
12831
12832 !! test
12833 Link inside a section heading
12834 !! wikitext
12835 ==Section with a [[Main Page|link]] in it==
12836 !! html
12837 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12838
12839 !! end
12840
12841 !! test
12842 TOC regression (bug 12077)
12843 !! wikitext
12844 __TOC__
12845 == title 1 ==
12846 === title 1.1 ===
12847 == title 2 ==
12848 !! html
12849 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12850 <ul>
12851 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12852 <ul>
12853 <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>
12854 </ul>
12855 </li>
12856 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12857 </ul>
12858 </div>
12859
12860 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12861 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12862 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12863
12864 !! end
12865
12866 !! test
12867 BUG 1219 URL next to image (good)
12868 !! wikitext
12869 http://example.com [[Image:foobar.jpg]]
12870 !! html
12871 <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>
12872 </p>
12873 !!end
12874
12875 !! test
12876 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12877 !! wikitext
12878 ===
12879 The line above must have a trailing space!
12880 === <!--
12881 --> <!-- -->
12882 But just in case it doesn't...
12883 !! html
12884 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12885 <p>The line above must have a trailing space!
12886 </p>
12887 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12888 <p>But just in case it doesn't...
12889 </p>
12890 !! end
12891
12892 !! test
12893 Header with special characters (bug 25462)
12894 !! wikitext
12895 The tooltips shall not show entities to the user (ie. be double escaped)
12896
12897 == text > text ==
12898 section 1
12899
12900 == text < text ==
12901 section 2
12902
12903 == text & text ==
12904 section 3
12905
12906 == text ' text ==
12907 section 4
12908
12909 == text " text ==
12910 section 5
12911 !! html
12912 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12913 </p>
12914 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12915 <ul>
12916 <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>
12917 <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>
12918 <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>
12919 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12920 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12921 </ul>
12922 </div>
12923
12924 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12925 <p>section 1
12926 </p>
12927 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12928 <p>section 2
12929 </p>
12930 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12931 <p>section 3
12932 </p>
12933 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12934 <p>section 4
12935 </p>
12936 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12937 <p>section 5
12938 </p>
12939 !! end
12940
12941 !! test
12942 Headers with excess '=' characters
12943 (Are similar tests necessary beyond the 1st level?)
12944 !! wikitext
12945 =foo==
12946 ==foo=
12947 =''italic'' heading==
12948 ==''italic'' heading=
12949 !! html
12950 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12951 <ul>
12952 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12953 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12954 <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>
12955 <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>
12956 </ul>
12957 </div>
12958
12959 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12960 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12961 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12962 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12963
12964 !! end
12965
12966 !! test
12967 HTML headers vs TOC (bug 23393)
12968 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12969 !! wikitext
12970 <h1>Header 1</h1>
12971 == Header 1.1 ==
12972 == Header 1.2 ==
12973
12974 <h1>Header 2
12975 </h1>
12976 == Header 2.1 ==
12977 == Header 2.2 ==
12978 __NOEDITSECTION__
12979 !! html
12980 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12981 <ul>
12982 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12983 <ul>
12984 <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>
12985 <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>
12986 </ul>
12987 </li>
12988 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12989 <ul>
12990 <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>
12991 <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>
12992 </ul>
12993 </li>
12994 </ul>
12995 </div>
12996
12997 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12998 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12999 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13000 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13001 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13002 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13003
13004 !! end
13005
13006 !! test
13007 Single-line or multiline-comments can follow headings
13008 !! options
13009 parsoid=wt2html,wt2wt
13010 !! wikitext
13011 ==foo==<!---->
13012 ==bar==<!--c1-->
13013 ==baz==<!--
13014 c2
13015 c3-->
13016 !! html
13017 <h2><span class="mw-headline" id="foo">foo</span></h2>
13018 <h2><span class="mw-headline" id="bar">bar</span></h2>
13019 <h2><span class="mw-headline" id="baz">baz</span></h2>
13020
13021 !! end
13022
13023 !! test
13024 BUG 1219 URL next to image (broken)
13025 !! wikitext
13026 http://example.com[[Image:foobar.jpg]]
13027 !! html
13028 <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>
13029 </p>
13030 !!end
13031
13032 !! test
13033 Bug 1186 news: in the middle of text
13034 !! wikitext
13035 http://en.wikinews.org/wiki/Wikinews:Workplace
13036 !! html
13037 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13038 </p>
13039 !!end
13040
13041
13042 !! test
13043 Namespaced link must have a title
13044 !! wikitext
13045 [[Project:]]
13046 !! html
13047 <p>[[Project:]]
13048 </p>
13049 !!end
13050
13051 !! test
13052 Namespaced link must have a title (bad fragment version)
13053 !! wikitext
13054 [[Project:#fragment]]
13055 !! html
13056 <p>[[Project:#fragment]]
13057 </p>
13058 !!end
13059
13060
13061 ###
13062 ### HTML tags and HTML attributes
13063 ###
13064
13065 !! test
13066 div with no attributes
13067 !! wikitext
13068 <div>HTML rocks</div>
13069 !! html
13070 <div>HTML rocks</div>
13071
13072 !! end
13073
13074 !! test
13075 div with double-quoted attribute
13076 !! wikitext
13077 <div id="rock">HTML rocks</div>
13078 !! html
13079 <div id="rock">HTML rocks</div>
13080
13081 !! end
13082
13083 !! test
13084 div with single-quoted attribute
13085 !! wikitext
13086 <div id='rock'>HTML rocks</div>
13087 !! html
13088 <div id="rock">HTML rocks</div>
13089
13090 !! end
13091
13092 !! test
13093 div with unquoted attribute
13094 !! wikitext
13095 <div id=rock>HTML rocks</div>
13096 !! html
13097 <div id="rock">HTML rocks</div>
13098
13099 !! end
13100
13101 !! test
13102 div with illegal double attributes
13103 !! wikitext
13104 <div id="a" id="b">HTML rocks</div>
13105 !! html
13106 <div id="b">HTML rocks</div>
13107
13108 !!end
13109
13110 # FIXME: produce empty string instead of "class" in the PHP parser, following
13111 # the HTML5 spec.
13112 !! test
13113 div with empty attribute value, space before equals
13114 !! options
13115 parsoid
13116 !! wikitext
13117 <div class =>HTML rocks</div>
13118 !! html
13119 <div class="">HTML rocks</div>
13120
13121 !! end
13122
13123 !! test
13124 div with multiple empty attribute values
13125 !! options
13126 parsoid
13127 !! wikitext
13128 <div id= title=>HTML rocks</div>
13129 !! html
13130 <div id="" title="">HTML rocks</div>
13131
13132 !! end
13133
13134 !! test
13135 table with multiple empty attribute values
13136 !! options
13137 parsoid
13138 !! wikitext
13139 {| title= id=
13140 | hi
13141 |}
13142 !! html
13143 <table title="" id="">
13144 <tbody><tr><td> hi</td></tr>
13145 </tbody></table>
13146 !! end
13147
13148 # The PHP parser escapes the opening brace to &#123; for some reason, so
13149 # disabled this test for it.
13150 !! test
13151 div with braces in attribute value
13152 !! options
13153 parsoid
13154 !! wikitext
13155 <div title="{}">Foo</div>
13156 !! html
13157 <div title="{}">Foo</div>
13158 !! end
13159
13160 # This it very inconsistent in the PHP parser: it returns
13161 # class="class" if there is a space between the name and the equal sign (see
13162 # 'div with empty attribute value, space before equals'), but strips the
13163 # attribute completely if the space is missing. We hope that not much content
13164 # depends on this, so are implementing the behavior below in Parsoid for
13165 # consistencies' sake. Disabled for the PHP parser.
13166 # FIXME: fix this behavior in the PHP parser?
13167 !! test
13168 div with empty attribute value, no space before equals
13169 !! options
13170 parsoid
13171 !! wikitext
13172 <div class=>HTML rocks</div>
13173 !! html
13174 <div class="">HTML rocks</div>
13175
13176 !! end
13177
13178 !! test
13179 HTML multiple attributes correction
13180 !! wikitext
13181 <p class="error" class="awesome">Awesome!</p>
13182 !! html
13183 <p class="awesome">Awesome!</p>
13184
13185 !!end
13186
13187 !! test
13188 Table multiple attributes correction
13189 !! wikitext
13190 {|
13191 !+ class="error" class="awesome"| status
13192 |}
13193 !! html
13194 <table>
13195 <tr>
13196 <th class="awesome"> status
13197 </th></tr></table>
13198
13199 !!end
13200
13201 !! test
13202 DIV IN UPPERCASE
13203 !! wikitext
13204 <DIV ID="x">HTML ROCKS</DIV>
13205 !! html
13206 <div id="x">HTML ROCKS</div>
13207
13208 !!end
13209
13210 !! test
13211 Non-ASCII pseudo-tags are rendered as text
13212 !! wikitext
13213 <khyô>
13214 !! html
13215 <p>&lt;khyô&gt;
13216 </p>
13217 !! end
13218
13219 !! test
13220 Pseudo-tag with URL 'name' renders as url link
13221 !! wikitext
13222 <http://example.com/>
13223 !! html
13224 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13225 </p>
13226 !! end
13227
13228 !! test
13229 text with amp in the middle of nowhere
13230 !! wikitext
13231 Remember AT&T?
13232 !! html
13233 <p>Remember AT&amp;T?
13234 </p>
13235 !! end
13236
13237 !! test
13238 text with character entity: eacute
13239 !! wikitext
13240 I always thought &eacute; was a cute letter.
13241 !! html
13242 <p>I always thought &#233; was a cute letter.
13243 </p>
13244 !! html+tidy
13245 <p>I always thought é was a cute letter.</p>
13246 !! end
13247
13248 !! test
13249 text with entity-escaped character entity-like string: eacute
13250 !! wikitext
13251 I always thought &amp;eacute; was a cute letter.
13252 !! html
13253 <p>I always thought &amp;eacute; was a cute letter.
13254 </p>
13255 !! end
13256
13257 !! test
13258 text with undefined character entity: xacute
13259 !! wikitext
13260 I always thought &xacute; was a cute letter.
13261 !! html
13262 <p>I always thought &amp;xacute; was a cute letter.
13263 </p>
13264 !! end
13265
13266 # TODO: generalize to PHP parser?
13267 !! test
13268 HTML5 tags
13269 !! options
13270 parsoid
13271 !! wikitext
13272 <data value="5">five</data>
13273 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13274 <mark>This highlighted text</mark>
13275 !! html
13276 <p><data value="5">five</data>
13277 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13278 <mark>This highlighted text</mark></p>
13279 !! end
13280
13281 !! test
13282 HTML tag with leading space is parsed as text
13283 !! wikitext
13284 < div>foo< /div>
13285 !! html
13286 <p>&lt; div&gt;foo&lt; /div&gt;
13287 </p>
13288 !! end
13289
13290 ###
13291 ### Nesting tests (see bug 41545, 50604, 51081)
13292 ###
13293
13294 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13295 # Note that html2wt is considerably more difficult if we use <b> in
13296 # the test case, instead of <big>
13297 !! test
13298 Ensure that HTML adoption agency algorithm is properly implemented.
13299 !! wikitext
13300 <big>X<big>Y</big>Z</big>
13301 !! html
13302 <p><big>X<big>Y</big>Z</big>
13303 </p>
13304 !! end
13305
13306 # This was bug 41545 in the PHP parser.
13307 # Note that tidy doesn't handle this correctly.
13308 !! test
13309 Nesting of <kbd>
13310 !! wikitext
13311 <kbd>X<kbd>Y</kbd>Z</kbd>
13312 !! html
13313 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13314 </p>
13315 !! end
13316
13317 # The following cases were bug 51081 in the PHP parser.
13318 # Note that there are some other nestable tags (b, i, etc) which are
13319 # not covered; see bug 51081 for discussion.
13320
13321 # Note that tidy doesn't handle this correctly.
13322 !! test
13323 Nesting of <em>
13324 !! wikitext
13325 <em>X<em>Y</em>Z</em>
13326 !! html
13327 <p><em>X<em>Y</em>Z</em>
13328 </p>
13329 !! end
13330
13331 # Note that tidy doesn't handle this correctly.
13332 !! test
13333 Nesting of <strong>
13334 !! wikitext
13335 <strong>X<strong>Y</strong>Z</strong>
13336 !! html
13337 <p><strong>X<strong>Y</strong>Z</strong>
13338 </p>
13339 !! end
13340
13341 !! test
13342 Nesting of <q>
13343 !! wikitext
13344 <q>X<q>Y</q>Z</q>
13345 !! html+tidy
13346 <p><q>X<q>Y</q>Z</q></p>
13347 !! end
13348
13349 # Note that tidy doesn't handle this correctly.
13350 !! test
13351 Nesting of <ruby>
13352 !! wikitext
13353 <ruby>X<ruby>Y</ruby>Z</ruby>
13354 !! html
13355 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13356 </p>
13357 !! end
13358
13359 # Note that tidy doesn't handle this correctly.
13360 !! test
13361 Nesting of <bdo>
13362 !! wikitext
13363 <bdo>X<bdo>Y</bdo>Z</bdo>
13364 !! html
13365 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13366 </p>
13367 !! end
13368
13369
13370 ###
13371 ### Media links
13372 ###
13373
13374 !! test
13375 Media link
13376 !! wikitext
13377 [[Media:Foobar.jpg]]
13378 !! html
13379 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13380 </p>
13381 !! end
13382
13383 !! test
13384 Media link with text
13385 !! wikitext
13386 [[Media:Foobar.jpg|A neat file to look at]]
13387 !! html
13388 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13389 </p>
13390 !! end
13391
13392 # FIXME: this is still bad HTML tag nesting
13393 !! test
13394 Media link with nasty text
13395 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13396 !! wikitext
13397 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13398 !! html
13399 <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>
13400
13401 !! html+tidy
13402 <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>
13403 !! end
13404
13405 !! test
13406 Media link to nonexistent file (bug 1702)
13407 !! wikitext
13408 [[Media:No such.jpg]]
13409 !! html
13410 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13411 </p>
13412 !! end
13413
13414 !! test
13415 Image link to nonexistent file (bug 1850 - good)
13416 !! wikitext
13417 [[Image:No such.jpg]]
13418 !! html
13419 <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>
13420 </p>
13421 !! end
13422
13423 !! test
13424 :Image link to nonexistent file (bug 1850 - bad)
13425 !! wikitext
13426 [[:Image:No such.jpg]]
13427 !! html
13428 <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>
13429 </p>
13430 !! end
13431
13432
13433
13434 !! test
13435 Character reference normalization in link text (bug 1938)
13436 !! wikitext
13437 [[Main Page|this&that]]
13438 !! html
13439 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13440 </p>
13441 !!end
13442
13443 !! article
13444 אַ
13445 !! text
13446 Test for unicode normalization
13447
13448 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13449 !! endarticle
13450
13451 !! test
13452 (bug 19451) Links should refer to the normalized form.
13453 !! wikitext
13454 [[&#xFB2E;]]
13455 [[&#x5d0;&#x5b7;]]
13456 [[&#x5d0;ַ]]
13457 [[א&#x5b7;]]
13458 [[אַ]]
13459 !! html
13460 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13461 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13462 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13463 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13464 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13465 </p>
13466 !! end
13467
13468 !! test
13469 Empty attribute crash test (bug 2067)
13470 !! wikitext
13471 <font color="">foo</font>
13472 !! html
13473 <p><font color="">foo</font>
13474 </p>
13475 !! end
13476
13477 !! test
13478 Empty attribute crash test single-quotes (bug 2067)
13479 !! wikitext
13480 <font color=''>foo</font>
13481 !! html
13482 <p><font color="">foo</font>
13483 </p>
13484 !! end
13485
13486 !! test
13487 Attribute test: equals, then nothing
13488 !! wikitext
13489 <font color=>foo</font>
13490 !! html
13491 <p><font>foo</font>
13492 </p>
13493 !! end
13494
13495 !! test
13496 Attribute test: unquoted value
13497 !! wikitext
13498 <font color=x>foo</font>
13499 !! html
13500 <p><font color="x">foo</font>
13501 </p>
13502 !! end
13503
13504 !! test
13505 Attribute test: unquoted but illegal value (hash)
13506 !! wikitext
13507 <font color=#x>foo</font>
13508 !! html
13509 <p><font color="#x">foo</font>
13510 </p>
13511 !! end
13512
13513 !! test
13514 Attribute test: no value
13515 !! wikitext
13516 <font color>foo</font>
13517 !! html
13518 <p><font color="color">foo</font>
13519 </p>
13520 !! end
13521
13522 !! test
13523 Bug 2095: link with three closing brackets
13524 !! wikitext
13525 [[Main Page]]]
13526 !! html/php
13527 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13528 </p>
13529 !! html/parsoid
13530 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13531 !! end
13532
13533 !! test
13534 Bug 2095: link with pipe and three closing brackets
13535 !! wikitext
13536 [[Main Page|link]]]
13537 !! html/php
13538 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13539 </p>
13540 !! html/parsoid
13541 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13542 !! end
13543
13544 !! test
13545 Bug 2095: link with pipe and three closing brackets, version 2
13546 !! wikitext
13547 [[Main Page|[http://example.com/]]]
13548 !! html/php
13549 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13550 </p>
13551 !! html/parsoid
13552 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13553 !! end
13554
13555
13556 ###
13557 ### Safety
13558 ###
13559
13560 !! article
13561 Template:Dangerous attribute
13562 !! text
13563 " onmouseover="alert(document.cookie)
13564 !! endarticle
13565
13566 !! article
13567 Template:Dangerous style attribute
13568 !! text
13569 border-size: expression(alert(document.cookie))
13570 !! endarticle
13571
13572 !! article
13573 Template:Div style
13574 !! text
13575 <div style="float: right; {{{1}}}">Magic div</div>
13576 !! endarticle
13577
13578 !! test
13579 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13580 !! wikitext
13581 <div title="{{test}}"></div>
13582 !! html
13583 <div title="This is a test template"></div>
13584
13585 !! end
13586
13587 # Parsoid has enough context to handle this case
13588 !! test
13589 Bug 2304: HTML attribute safety (dangerous template; 2309)
13590 !! wikitext
13591 <div title="{{dangerous attribute}}"></div>
13592 !! html/php
13593 <div title=""></div>
13594
13595 !! html/parsoid
13596 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}' data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}'></div>
13597 !! end
13598
13599 !! test
13600 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13601 !! wikitext
13602 <div style="{{dangerous style attribute}}"></div>
13603 !! html
13604 <div style="/* insecure input */"></div>
13605
13606 !! end
13607
13608 !! test
13609 Bug 2304: HTML attribute safety (safe parameter; 2309)
13610 !! wikitext
13611 {{div style|width: 200px}}
13612 !! html
13613 <div style="float: right; width: 200px">Magic div</div>
13614
13615 !! end
13616
13617 !! test
13618 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13619 !! wikitext
13620 {{div style|width: expression(alert(document.cookie))}}
13621 !! html
13622 <div style="/* insecure input */">Magic div</div>
13623
13624 !! end
13625
13626 !! test
13627 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13628 !! wikitext
13629 {{div style|"><script>alert(document.cookie)</script>}}
13630 !! html
13631 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13632
13633 !! end
13634
13635 !! test
13636 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13637 !! wikitext
13638 {{div style|" ><script>alert(document.cookie)</script>}}
13639 !! html
13640 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13641
13642 !! end
13643
13644 !! test
13645 Bug 2304: HTML attribute safety (link)
13646 !! wikitext
13647 <div title="[[Main Page]]"></div>
13648 !! html
13649 <div title="&#91;&#91;Main Page]]"></div>
13650
13651 !! end
13652
13653 !! test
13654 Bug 2304: HTML attribute safety (italics)
13655 !! wikitext
13656 <div title="''foobar''"></div>
13657 !! html
13658 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13659
13660 !! end
13661
13662 !! test
13663 Bug 2304: HTML attribute safety (bold)
13664 !! wikitext
13665 <div title="'''foobar'''"></div>
13666 !! html
13667 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13668
13669 !! end
13670
13671
13672 !! test
13673 Bug 2304: HTML attribute safety (ISBN)
13674 !! wikitext
13675 <div title="ISBN 1234567890"></div>
13676 !! html
13677 <div title="&#73;SBN 1234567890"></div>
13678
13679 !! end
13680
13681 !! test
13682 Bug 2304: HTML attribute safety (RFC)
13683 !! wikitext
13684 <div title="RFC 1234"></div>
13685 !! html
13686 <div title="&#82;FC 1234"></div>
13687
13688 !! end
13689
13690 !! test
13691 Bug 2304: HTML attribute safety (PMID)
13692 !! wikitext
13693 <div title="PMID 1234567890"></div>
13694 !! html
13695 <div title="&#80;MID 1234567890"></div>
13696
13697 !! end
13698
13699 !! test
13700 Bug 2304: HTML attribute safety (web link)
13701 !! wikitext
13702 <div title="http://example.com/"></div>
13703 !! html
13704 <div title="http&#58;//example.com/"></div>
13705
13706 !! end
13707
13708 !! test
13709 Bug 2304: HTML attribute safety (named web link)
13710 !! wikitext
13711 <div title="[http://example.com/ link]"></div>
13712 !! html
13713 <div title="&#91;http&#58;//example.com/ link]"></div>
13714
13715 !! end
13716
13717 !! test
13718 Bug 3244: HTML attribute safety (extension; safe)
13719 !! wikitext
13720 <div style="<nowiki>background:blue</nowiki>"></div>
13721 !! html
13722 <div style="background:blue"></div>
13723
13724 !! end
13725
13726 !! test
13727 Bug 3244: HTML attribute safety (extension; unsafe)
13728 !! wikitext
13729 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13730 !! html
13731 <div style="/* insecure input */"></div>
13732
13733 !! end
13734
13735 # More MSIE fun discovered by Tom Gilder
13736
13737 !! test
13738 MSIE CSS safety test: spurious slash
13739 !! wikitext
13740 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13741 !! html
13742 <div style="/* insecure input */">evil</div>
13743
13744 !! end
13745
13746 !! test
13747 MSIE CSS safety test: hex code
13748 !! wikitext
13749 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13750 !! html
13751 <div style="/* insecure input */">evil</div>
13752
13753 !! end
13754
13755 !! test
13756 MSIE CSS safety test: comment in url
13757 !! wikitext
13758 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13759 !! html
13760 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13761
13762 !! end
13763
13764 !! test
13765 MSIE CSS safety test: comment in expression
13766 !! wikitext
13767 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13768 !! html
13769 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13770
13771 !! end
13772
13773 !! test
13774 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13775 !! wikitext
13776 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13777 !! html
13778 <p style="/* invalid control char */">A</p>
13779
13780 !! end
13781
13782 !! test
13783 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13784 !! wikitext
13785 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13786 <div style="top:EXPRESSION(alert())">B</div>
13787 !! html
13788 <p style="/* insecure input */">A</p>
13789 <div style="/* insecure input */">B</div>
13790
13791 !! end
13792
13793 !! test
13794 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13795 !! wikitext
13796 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13797 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13798 !! html
13799 <div style="/* insecure input */">A</div>
13800 <p style="/* insecure input */">B</p>
13801
13802 !! end
13803
13804 !! test
13805 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13806 !! wikitext
13807 <div style="background-image:url⁽javascript:alert())">A</div>
13808 <div style="background-image:url₍javascript:alert())">B</div>
13809 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13810 !! html
13811 <div style="/* insecure input */">A</div>
13812 <div style="/* insecure input */">B</div>
13813 <p style="/* insecure input */">C</p>
13814
13815 !! end
13816
13817 !! test
13818 Opera -o-link CSS
13819 !! wikitext
13820 <div
13821 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;"
13822 style="-o-link:attr(title);-o-link-source:current">X</div>
13823 !! html
13824 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13825
13826 !! end
13827
13828 !! test
13829 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13830 !! wikitext
13831 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13832 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13833 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13834 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13835 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13836 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13837 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13838 !! html
13839 <p style="/* insecure input */">A</p>
13840 <p style="/* insecure input */">B</p>
13841 <p style="/* insecure input */">C</p>
13842 <p style="/* insecure input */">D</p>
13843 <p style="/* insecure input */">E</p>
13844 <p style="/* insecure input */">F</p>
13845 <p style="/* insecure input */">G</p>
13846
13847 !! end
13848
13849 !! test
13850 Table attribute legitimate extension
13851 !! wikitext
13852 {|
13853 !+ style="<nowiki>color:blue</nowiki>"| status
13854 |}
13855 !! html
13856 <table>
13857 <tr>
13858 <th style="color:blue"> status
13859 </th></tr></table>
13860
13861 !!end
13862
13863 !! test
13864 Table attribute safety
13865 !! wikitext
13866 {|
13867 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13868 |}
13869 !! html
13870 <table>
13871 <tr>
13872 <th style="/* insecure input */"> status
13873 </th></tr></table>
13874
13875 !! end
13876
13877 !! test
13878 CSS line continuation 1
13879 !! wikitext
13880 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13881 !! html
13882 <div style="/* insecure input */"></div>
13883
13884 !! end
13885
13886 !! test
13887 CSS line continuation 2
13888 !! wikitext
13889 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13890 !! html
13891 <div style="/* insecure input */"></div>
13892
13893 !! end
13894
13895 !! article
13896 Template:Identity
13897 !! text
13898 {{{1}}}
13899 !! endarticle
13900
13901 !! test
13902 Expansion of multi-line templates in attribute values (bug 6255)
13903 !! wikitext
13904 <div style="background: {{identity|#00FF00}}">-</div>
13905 !! html
13906 <div style="background: #00FF00">-</div>
13907
13908 !! end
13909
13910
13911 !! test
13912 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13913 !! wikitext
13914 <div style="background:
13915 #00FF00">-</div>
13916 !! html
13917 <div style="background: #00FF00">-</div>
13918
13919 !! end
13920
13921 !! test
13922 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13923 !! wikitext
13924 <div style="background: &#10;#00FF00">-</div>
13925 !! html
13926 <div style="background: &#10;#00FF00">-</div>
13927
13928 !! end
13929
13930 !! test
13931 evil <math>-wiki-tags without Extension:Math enabled
13932 !! wikitext
13933 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
13934 !! html+tidy
13935 <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>
13936 !! end
13937
13938 ###
13939 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13940 ###
13941 !! test
13942 Parser hook: empty input
13943 !! wikitext
13944 <tag></tag>
13945 !! html
13946 <pre>
13947 ''
13948 array (
13949 )
13950 </pre>
13951
13952 !! end
13953
13954 !! test
13955 Parser hook: empty input using terminated empty elements
13956 !! wikitext
13957 <tag/>
13958 !! html
13959 <pre>
13960 NULL
13961 array (
13962 )
13963 </pre>
13964
13965 !! end
13966
13967 !! test
13968 Parser hook: empty input using terminated empty elements (space before)
13969 !! wikitext
13970 <tag />
13971 !! html
13972 <pre>
13973 NULL
13974 array (
13975 )
13976 </pre>
13977
13978 !! end
13979
13980 !! test
13981 Parser hook: basic input
13982 !! wikitext
13983 <tag>input</tag>
13984 !! html
13985 <pre>
13986 'input'
13987 array (
13988 )
13989 </pre>
13990
13991 !! end
13992
13993
13994 !! test
13995 Parser hook: case insensitive
13996 !! wikitext
13997 <TAG>input</TAG>
13998 !! html
13999 <pre>
14000 'input'
14001 array (
14002 )
14003 </pre>
14004
14005 !! end
14006
14007
14008 !! test
14009 Parser hook: case insensitive, redux
14010 !! wikitext
14011 <TaG>input</TAg>
14012 !! html
14013 <pre>
14014 'input'
14015 array (
14016 )
14017 </pre>
14018
14019 !! end
14020
14021 !! test
14022 Parser hook: nested tags
14023 !! options
14024 noxml
14025 !! wikitext
14026 <tag><tag></tag></tag>
14027 !! html
14028 <pre>
14029 '<tag>'
14030 array (
14031 )
14032 </pre>&lt;/tag&gt;
14033
14034 !! end
14035
14036 !! test
14037 Parser hook: basic arguments
14038 !! wikitext
14039 <tag width=200 height = "100" depth = '50' square></tag>
14040 !! html
14041 <pre>
14042 ''
14043 array (
14044 'width' => '200',
14045 'height' => '100',
14046 'depth' => '50',
14047 'square' => 'square',
14048 )
14049 </pre>
14050
14051 !! end
14052
14053 !! test
14054 Parser hook: argument containing a forward slash (bug 5344)
14055 !! wikitext
14056 <tag filename='/tmp/bla'></tag>
14057 !! html
14058 <pre>
14059 ''
14060 array (
14061 'filename' => '/tmp/bla',
14062 )
14063 </pre>
14064
14065 !! end
14066
14067 !! test
14068 Parser hook: empty input using terminated empty elements (bug 2374)
14069 !! wikitext
14070 <tag foo=bar/>text
14071 !! html
14072 <pre>
14073 NULL
14074 array (
14075 'foo' => 'bar',
14076 )
14077 </pre>text
14078
14079 !! end
14080
14081 # </tag> should be output literally since there is no matching tag that begins it
14082 !! test
14083 Parser hook: basic arguments using terminated empty elements (bug 2374)
14084 !! wikitext
14085 <tag width=200 height = "100" depth = '50' square/>
14086 other stuff
14087 </tag>
14088 !! html
14089 <pre>
14090 NULL
14091 array (
14092 'width' => '200',
14093 'height' => '100',
14094 'depth' => '50',
14095 'square' => 'square',
14096 )
14097 </pre>
14098 <p>other stuff
14099 &lt;/tag&gt;
14100 </p>
14101 !! end
14102
14103 ###
14104 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14105 ###
14106
14107 !! test
14108 Parser hook: static parser hook not inside a comment
14109 !! wikitext
14110 <statictag>hello, world</statictag>
14111 <statictag action=flush/>
14112 !! html
14113 <p>hello, world
14114 </p>
14115 !! end
14116
14117
14118 !! test
14119 Parser hook: static parser hook inside a comment
14120 !! wikitext
14121 <!-- <statictag>hello, world</statictag> -->
14122 <statictag action=flush/>
14123 !! html
14124 <p><br />
14125 </p>
14126 !! end
14127
14128 # Nested template calls; this case was broken by Parser.php rev 1.506,
14129 # since reverted.
14130
14131 !! article
14132 Template:One-parameter
14133 !! text
14134 (My parameter is: {{{1}}})
14135 !! endarticle
14136
14137 !! article
14138 Template:Map-one-parameter
14139 !! text
14140 {{{{{1}}}|{{{2}}}}}
14141 !! endarticle
14142
14143 !! test
14144 Nested template calls
14145 !! wikitext
14146 {{Map-one-parameter|One-parameter|param}}
14147 !! html
14148 <p>(My parameter is: param)
14149 </p>
14150 !! end
14151
14152
14153 ###
14154 ### Sanitizer
14155 ###
14156 !! test
14157 Sanitizer: Closing of open tags
14158 !! wikitext
14159 <s></s><table></table>
14160 !! html
14161 <s></s><table></table>
14162
14163 !! end
14164
14165 !! test
14166 Sanitizer: Closing of open but not closed tags
14167 !! wikitext
14168 <s>foo
14169 !! html
14170 <p><s>foo</s>
14171 </p>
14172 !! end
14173
14174 !! test
14175 Sanitizer: Closing of closed but not open tags
14176 !! wikitext
14177 </s>
14178 !! html
14179 <p>&lt;/s&gt;
14180 </p>
14181 !! end
14182
14183 !! test
14184 Sanitizer: Closing of closed but not open table tags
14185 !! wikitext
14186 Table not started</td></tr></table>
14187 !! html
14188 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14189 </p>
14190 !! end
14191
14192 !! test
14193 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14194 !! wikitext
14195 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14196 !! html
14197 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14198 </p>
14199 !! end
14200
14201 !! test
14202 Sanitizer: Validating the contents of the id attribute (bug 4515)
14203 !! options
14204 disabled
14205 !! wikitext
14206 <br id=9 />
14207 !! html
14208 Something, but definitely not <br id="9" />...
14209 !! end
14210
14211 !! test
14212 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14213 !! options
14214 disabled
14215 !! wikitext
14216 <br id="foo" /><br id="foo" />
14217 !! html
14218 Something need to be done. foo-2 ?
14219 !! end
14220
14221 !! test
14222 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14223 !! wikitext
14224 <div itemscope>
14225 <meta itemprop="hello" content="world">
14226 <meta http-equiv="refresh" content="5">
14227 <meta itemprop="hello" http-equiv="refresh" content="5">
14228 <link itemprop="hello" href="{{SERVER}}">
14229 <link rel="stylesheet" href="{{SERVER}}">
14230 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14231 </div>
14232 !! html
14233 <div itemscope="itemscope">
14234 <p> <meta itemprop="hello" content="world" />
14235 &lt;meta http-equiv="refresh" content="5"&gt;
14236 <meta itemprop="hello" content="5" />
14237 </p>
14238 <link itemprop="hello" href="http&#58;//example.org" />
14239 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14240 <link itemprop="hello" href="http&#58;//example.org" />
14241 </div>
14242
14243 !! end
14244
14245 !! test
14246 Language converter: output gets cut off unexpectedly (bug 5757)
14247 !! options
14248 language=zh
14249 !! wikitext
14250 this bit is safe: }-
14251
14252 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14253
14254 then we get cut off here: }-
14255
14256 all additional text is vanished
14257 !! html
14258 <p>this bit is safe: }-
14259 </p><p>but if we add a conversion instance: xxx
14260 </p><p>then we get cut off here: }-
14261 </p><p>all additional text is vanished
14262 </p>
14263 !! end
14264
14265 !! test
14266 Self closed html pairs (bug 5487)
14267 !! options
14268 !! wikitext
14269 <center><font id="bug" />Centered text</center>
14270 <div><font id="bug2" />In div text</div>
14271 !! html
14272 <center>&lt;font id="bug" /&gt;Centered text</center>
14273 <div>&lt;font id="bug2" /&gt;In div text</div>
14274
14275 !! end
14276
14277 #
14278 #
14279 #
14280
14281 !! test
14282 Punctuation: nbsp before exclamation
14283 !! wikitext
14284 C'est grave !
14285 !! html
14286 <p>C'est grave&#160;!
14287 </p>
14288 !! end
14289
14290 !! test
14291 Punctuation: CSS !important (bug 11874)
14292 !! wikitext
14293 <div style="width:50% !important">important</div>
14294 !! html
14295 <div style="width:50% !important">important</div>
14296
14297 !!end
14298
14299 !! test
14300 Punctuation: CSS ! important (bug 11874; with space after)
14301 !! wikitext
14302 <div style="width:50% ! important">important</div>
14303 !! html
14304 <div style="width:50% ! important">important</div>
14305
14306 !!end
14307
14308
14309 !! test
14310 HTML bullet list, closed tags (bug 5497)
14311 !! wikitext
14312 <ul>
14313 <li>One</li>
14314 <li>Two</li>
14315 </ul>
14316 !! html
14317 <ul>
14318 <li>One</li>
14319 <li>Two</li>
14320 </ul>
14321
14322 !! end
14323
14324 !! test
14325 HTML bullet list, unclosed tags (bug 5497)
14326 !! options
14327 disabled
14328 !! wikitext
14329 <ul>
14330 <li>One
14331 <li>Two
14332 </ul>
14333 !! html
14334 <ul>
14335 <li>One
14336 </li>
14337 <li>Two
14338 </li>
14339 </ul>
14340
14341 !! end
14342
14343 !! test
14344 HTML ordered list, closed tags (bug 5497)
14345 !! wikitext
14346 <ol>
14347 <li>One</li>
14348 <li>Two</li>
14349 </ol>
14350 !! html
14351 <ol>
14352 <li>One</li>
14353 <li>Two</li>
14354 </ol>
14355
14356 !! end
14357
14358 !! test
14359 HTML ordered list, unclosed tags (bug 5497)
14360 !! options
14361 disabled
14362 !! wikitext
14363 <ol>
14364 <li>One
14365 <li>Two
14366 </ol>
14367 !! html
14368 <ol>
14369 <li>One
14370 </li>
14371 <li>Two
14372 </li>
14373 </ol>
14374
14375 !! end
14376
14377 !! test
14378 HTML nested bullet list, closed tags (bug 5497)
14379 !! wikitext
14380 <ul>
14381 <li>One</li>
14382 <li>Two:
14383 <ul>
14384 <li>Sub-one</li>
14385 <li>Sub-two</li>
14386 </ul>
14387 </li>
14388 </ul>
14389 !! html
14390 <ul>
14391 <li>One</li>
14392 <li>Two:
14393 <ul>
14394 <li>Sub-one</li>
14395 <li>Sub-two</li>
14396 </ul>
14397 </li>
14398 </ul>
14399
14400 !! end
14401
14402 !! test
14403 HTML nested bullet list, open tags (bug 5497)
14404 !! options
14405 disabled
14406 !! wikitext
14407 <ul>
14408 <li>One
14409 <li>Two:
14410 <ul>
14411 <li>Sub-one
14412 <li>Sub-two
14413 </ul>
14414 </ul>
14415 !! html
14416 <ul>
14417 <li>One
14418 </li>
14419 <li>Two:
14420 <ul>
14421 <li>Sub-one
14422 </li>
14423 <li>Sub-two
14424 </li>
14425 </ul>
14426 </li>
14427 </ul>
14428
14429 !! end
14430
14431 !! test
14432 HTML nested ordered list, closed tags (bug 5497)
14433 !! wikitext
14434 <ol>
14435 <li>One</li>
14436 <li>Two:
14437 <ol>
14438 <li>Sub-one</li>
14439 <li>Sub-two</li>
14440 </ol>
14441 </li>
14442 </ol>
14443 !! html
14444 <ol>
14445 <li>One</li>
14446 <li>Two:
14447 <ol>
14448 <li>Sub-one</li>
14449 <li>Sub-two</li>
14450 </ol>
14451 </li>
14452 </ol>
14453
14454 !! end
14455
14456 !! test
14457 HTML nested ordered list, open tags (bug 5497)
14458 !! options
14459 disabled
14460 !! wikitext
14461 <ol>
14462 <li>One
14463 <li>Two:
14464 <ol>
14465 <li>Sub-one
14466 <li>Sub-two
14467 </ol>
14468 </ol>
14469 !! html
14470 <ol>
14471 <li>One
14472 </li>
14473 <li>Two:
14474 <ol>
14475 <li>Sub-one
14476 </li>
14477 <li>Sub-two
14478 </li>
14479 </ol>
14480 </li>
14481 </ol>
14482
14483 !! end
14484
14485 !! test
14486 HTML ordered list item with parameters oddity
14487 !! wikitext
14488 <ol><li id="fragment">One</li>
14489 </ol>
14490 !! html
14491 <ol><li id="fragment">One</li>
14492 </ol>
14493
14494 !! end
14495
14496 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14497 !!test
14498 bug 5918: autonumbering
14499 !! wikitext
14500 [http://first/] [http://second] [ftp://ftp]
14501
14502 ftp://inlineftp
14503
14504 [mailto:enclosed@mail.tld With target]
14505
14506 [mailto:enclosed@mail.tld]
14507
14508 mailto:inline@mail.tld
14509 !! html/php
14510 <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>
14511 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14512 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14513 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14514 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14515 </p>
14516 !! html/parsoid
14517 <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>
14518 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14519 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14520 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14521 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14522 !! end
14523
14524
14525 #
14526 # Security and HTML correctness
14527 # From Nick Jenkins' fuzz testing
14528 #
14529
14530 !! test
14531 Fuzz testing: Parser13
14532 !! wikitext
14533 {|
14534 | http://a|
14535 !! html
14536 <table>
14537 <tr>
14538 <td>
14539 </td>
14540 </tr>
14541 </table>
14542
14543 !! end
14544
14545 !! test
14546 Fuzz testing: Parser14
14547 !! wikitext
14548 == onmouseover= ==
14549 http://__TOC__
14550 !! html
14551 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14552 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14553 <ul>
14554 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14555 </ul>
14556 </div>
14557
14558
14559 !! html+tidy
14560 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14561 <p>http://</p>
14562 <div id="toc" class="toc">
14563 <div id="toctitle">
14564 <h2>Contents</h2>
14565 </div>
14566 <ul>
14567 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14568 </ul>
14569 </div>
14570 !! end
14571
14572 !! test
14573 Fuzz testing: Parser14-table
14574 !! wikitext
14575 ==a==
14576 {| STYLE=__TOC__
14577 !! html
14578 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14579 <table style="&#95;_TOC&#95;_">
14580 <tr><td></td></tr>
14581 </table>
14582
14583 !! html+tidy
14584 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14585 <table style="__TOC__">
14586 <tr>
14587 <td></td>
14588 </tr>
14589 </table>
14590 !! end
14591
14592 # Known to produce bogus xml (extra </td>)
14593 !! test
14594 Fuzz testing: Parser16
14595 !! options
14596 noxml
14597 !! wikitext
14598 {|
14599 !https://||||||
14600 !! html
14601 <table>
14602 <tr>
14603 <th>https://</th>
14604 <th></th>
14605 <th></th>
14606 <th>
14607 </td>
14608 </tr>
14609 </table>
14610
14611 !! html+tidy
14612 <table>
14613 <tr>
14614 <th>https://</th>
14615 <th></th>
14616 <th></th>
14617 <th></th>
14618 </tr>
14619 </table>
14620 !! end
14621
14622 !! test
14623 Fuzz testing: Parser21
14624 !! wikitext
14625 {|
14626 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14627 |
14628 !! html
14629 <table>
14630 <tr>
14631 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14632 </th>
14633 <td>
14634 </td>
14635 </tr>
14636 </table>
14637
14638 !! end
14639
14640 !! test
14641 Fuzz testing: Parser22
14642 !! wikitext
14643 http://===r:::https://b
14644
14645 {|
14646 !! html
14647 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14648 </p>
14649 <table>
14650 <tr><td></td></tr>
14651 </table>
14652
14653 !! end
14654
14655 # Known to produce bad XML for now
14656 !! test
14657 Fuzz testing: Parser24
14658 !! options
14659 noxml
14660 !! wikitext
14661 {|
14662 {{{|
14663 <u CLASS=
14664 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14665 <br style="onmouseover='alert(document.cookie);' " />
14666
14667 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14668 |
14669 !! html
14670 <table>
14671 {{{|
14672 <u class="&#124;">}}}} &gt;
14673 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14674
14675 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14676 <tr>
14677 <td></u>
14678 </td>
14679 </tr>
14680 </table>
14681
14682 !! end
14683
14684 # Note: the current result listed for this is not what the original one was,
14685 # but the original bug was JavaScript injection, which is fixed in any case.
14686 # It's not clear that the original result listed was any more correct than the
14687 # current one. Original result:
14688 # <p>{{{|
14689 # </p>
14690 # <li class="&#124;&#124;">
14691 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14692 !!test
14693 Fuzz testing: Parser25 (bug 6055)
14694 !! wikitext
14695 {{{
14696 |
14697 <LI CLASS=||
14698 >
14699 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14700 !! html
14701 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14702 </p>
14703 !! end
14704
14705 !!test
14706 Fuzz testing: URL adjacent extension (with space, clean)
14707 !! wikitext
14708 http://example.com <nowiki>junk</nowiki>
14709 !! html
14710 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14711 </p>
14712 !!end
14713
14714 !!test
14715 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14716 !! wikitext
14717 http://example.com<nowiki>junk</nowiki>
14718 !! html
14719 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14720 </p>
14721 !!end
14722
14723 !!test
14724 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14725 !! wikitext
14726 http://example.com<pre>junk</pre>
14727 !! html
14728 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14729
14730 !! html+tidy
14731 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
14732 <pre>
14733 junk
14734 </pre>
14735 !!end
14736
14737 !!test
14738 Fuzz testing: image with bogus manual thumbnail
14739 !! wikitext
14740 [[Image:foobar.jpg|thumbnail= ]]
14741 !! html/php
14742 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14743
14744 !! html/parsoid
14745 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14746 !!end
14747
14748 !! test
14749 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14750 !! wikitext
14751 <pre dir="&#10;"></pre>
14752 !! html
14753 <pre dir="&#10;"></pre>
14754
14755 !! end
14756
14757 !! test
14758 Parsing optional HTML elements (Bug 6171)
14759 !! options
14760 !! wikitext
14761 <table>
14762 <tr>
14763 <td> Some tabular data</td>
14764 <td> More tabular data ...
14765 <td> And yet som tabular data</td>
14766 </tr>
14767 </table>
14768 !! html
14769 <table>
14770 <tr>
14771 <td> Some tabular data</td>
14772 <td> More tabular data ...
14773 </td><td> And yet som tabular data</td>
14774 </tr>
14775 </table>
14776
14777 !! end
14778
14779 !! test
14780 Correct handling of <td>, <tr> (Bug 6171)
14781 !! options
14782 !! wikitext
14783 <table>
14784 <tr>
14785 <td> Some tabular data</td>
14786 <td> More tabular data ...</td>
14787 <td> And yet som tabular data</td>
14788 </tr>
14789 </table>
14790 !! html
14791 <table>
14792 <tr>
14793 <td> Some tabular data</td>
14794 <td> More tabular data ...</td>
14795 <td> And yet som tabular data</td>
14796 </tr>
14797 </table>
14798
14799 !! end
14800
14801
14802 !! test
14803 Parsing crashing regression (fr:JavaScript)
14804 !! wikitext
14805 </body></x>
14806 !! html
14807 <p>&lt;/body&gt;&lt;/x&gt;
14808 </p>
14809 !! end
14810
14811 !! test
14812 Inline wiki vs wiki block nesting
14813 !! wikitext
14814 '''Bold paragraph
14815
14816 New wiki paragraph
14817 !! html
14818 <p><b>Bold paragraph</b>
14819 </p><p>New wiki paragraph
14820 </p>
14821 !! end
14822
14823 !! test
14824 Inline HTML vs wiki block nesting
14825 !! options
14826 disabled
14827 !! wikitext
14828 <b>Bold paragraph
14829
14830 New wiki paragraph
14831 !! html
14832 <p><b>Bold paragraph</b>
14833 </p><p>New wiki paragraph
14834 </p>
14835 !! end
14836
14837 # Original result was this:
14838 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14839 # </p>
14840 # While that might be marginally more intuitive, maybe, the six-apostrophe
14841 # construct is clearly pathological and the result stated here (which is what
14842 # the parser actually does) is about as reasonable as anything.
14843 !!test
14844 Mixing markup for italics and bold
14845 !! options
14846 !! wikitext
14847 '''bold''''''bold''bolditalics'''''
14848 !! html
14849 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14850 </p>
14851 !! end
14852
14853
14854 !! article
14855 Xyzzyx
14856 !! text
14857 Article for special page transclusion test
14858 !! endarticle
14859
14860 !! test
14861 Special page transclusion
14862 !! options
14863 !! wikitext
14864 {{Special:Prefixindex/Xyzzyx}}
14865 !! html
14866 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14867
14868 !! end
14869
14870 !! test
14871 Special page transclusion twice (bug 5021)
14872 !! options
14873 !! wikitext
14874 {{Special:Prefixindex/Xyzzyx}}
14875 {{Special:Prefixindex/Xyzzyx}}
14876 !! html
14877 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14878 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14879
14880 !! end
14881
14882 !! test
14883 Transclusion of default MediaWiki message
14884 !! wikitext
14885 {{MediaWiki:Mainpage}}
14886 !! html
14887 <p>Main Page
14888 </p>
14889 !! end
14890
14891 !! test
14892 Transclusion of nonexistent MediaWiki message
14893 !! wikitext
14894 {{MediaWiki:Mainpagexxx}}
14895 !! html
14896 <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>
14897 </p>
14898 !! end
14899
14900 !! test
14901 Transclusion of MediaWiki message with underscore
14902 !! wikitext
14903 {{MediaWiki:history_short}}
14904 !! html
14905 <p>History
14906 </p>
14907 !! end
14908
14909 !! test
14910 Transclusion of MediaWiki message with space
14911 !! wikitext
14912 {{MediaWiki:history short}}
14913 !! html
14914 <p>History
14915 </p>
14916 !! end
14917
14918 !! test
14919 Invalid header with following text
14920 !! wikitext
14921 = x = y
14922 !! html
14923 <p>= x = y
14924 </p>
14925 !! end
14926
14927
14928 !! test
14929 Section extraction test (section 0)
14930 !! options
14931 section=0
14932 !! wikitext
14933 start
14934 ==a==
14935 ===aa===
14936 ====aaa====
14937 ==b==
14938 ===ba===
14939 ===bb===
14940 ====bba====
14941 ===bc===
14942 ==c==
14943 ===ca===
14944 !! html
14945 start
14946 !! end
14947
14948 !! test
14949 Section extraction test (section 1)
14950 !! options
14951 section=1
14952 !! wikitext
14953 start
14954 ==a==
14955 ===aa===
14956 ====aaa====
14957 ==b==
14958 ===ba===
14959 ===bb===
14960 ====bba====
14961 ===bc===
14962 ==c==
14963 ===ca===
14964 !! html
14965 ==a==
14966 ===aa===
14967 ====aaa====
14968 !! end
14969
14970 !! test
14971 Section extraction test (section 2)
14972 !! options
14973 section=2
14974 !! wikitext
14975 start
14976 ==a==
14977 ===aa===
14978 ====aaa====
14979 ==b==
14980 ===ba===
14981 ===bb===
14982 ====bba====
14983 ===bc===
14984 ==c==
14985 ===ca===
14986 !! html
14987 ===aa===
14988 ====aaa====
14989 !! end
14990
14991 !! test
14992 Section extraction test (section 3)
14993 !! options
14994 section=3
14995 !! wikitext
14996 start
14997 ==a==
14998 ===aa===
14999 ====aaa====
15000 ==b==
15001 ===ba===
15002 ===bb===
15003 ====bba====
15004 ===bc===
15005 ==c==
15006 ===ca===
15007 !! html
15008 ====aaa====
15009 !! end
15010
15011 !! test
15012 Section extraction test (section 4)
15013 !! options
15014 section=4
15015 !! wikitext
15016 start
15017 ==a==
15018 ===aa===
15019 ====aaa====
15020 ==b==
15021 ===ba===
15022 ===bb===
15023 ====bba====
15024 ===bc===
15025 ==c==
15026 ===ca===
15027 !! html
15028 ==b==
15029 ===ba===
15030 ===bb===
15031 ====bba====
15032 ===bc===
15033 !! end
15034
15035 !! test
15036 Section extraction test (section 5)
15037 !! options
15038 section=5
15039 !! wikitext
15040 start
15041 ==a==
15042 ===aa===
15043 ====aaa====
15044 ==b==
15045 ===ba===
15046 ===bb===
15047 ====bba====
15048 ===bc===
15049 ==c==
15050 ===ca===
15051 !! html
15052 ===ba===
15053 !! end
15054
15055 !! test
15056 Section extraction test (section 6)
15057 !! options
15058 section=6
15059 !! wikitext
15060 start
15061 ==a==
15062 ===aa===
15063 ====aaa====
15064 ==b==
15065 ===ba===
15066 ===bb===
15067 ====bba====
15068 ===bc===
15069 ==c==
15070 ===ca===
15071 !! html
15072 ===bb===
15073 ====bba====
15074 !! end
15075
15076 !! test
15077 Section extraction test (section 7)
15078 !! options
15079 section=7
15080 !! wikitext
15081 start
15082 ==a==
15083 ===aa===
15084 ====aaa====
15085 ==b==
15086 ===ba===
15087 ===bb===
15088 ====bba====
15089 ===bc===
15090 ==c==
15091 ===ca===
15092 !! html
15093 ====bba====
15094 !! end
15095
15096 !! test
15097 Section extraction test (section 8)
15098 !! options
15099 section=8
15100 !! wikitext
15101 start
15102 ==a==
15103 ===aa===
15104 ====aaa====
15105 ==b==
15106 ===ba===
15107 ===bb===
15108 ====bba====
15109 ===bc===
15110 ==c==
15111 ===ca===
15112 !! html
15113 ===bc===
15114 !! end
15115
15116 !! test
15117 Section extraction test (section 9)
15118 !! options
15119 section=9
15120 !! wikitext
15121 start
15122 ==a==
15123 ===aa===
15124 ====aaa====
15125 ==b==
15126 ===ba===
15127 ===bb===
15128 ====bba====
15129 ===bc===
15130 ==c==
15131 ===ca===
15132 !! html
15133 ==c==
15134 ===ca===
15135 !! end
15136
15137 !! test
15138 Section extraction test (section 10)
15139 !! options
15140 section=10
15141 !! wikitext
15142 start
15143 ==a==
15144 ===aa===
15145 ====aaa====
15146 ==b==
15147 ===ba===
15148 ===bb===
15149 ====bba====
15150 ===bc===
15151 ==c==
15152 ===ca===
15153 !! html
15154 ===ca===
15155 !! end
15156
15157 !! test
15158 Section extraction test (nonexistent section 11)
15159 !! options
15160 section=11
15161 !! wikitext
15162 start
15163 ==a==
15164 ===aa===
15165 ====aaa====
15166 ==b==
15167 ===ba===
15168 ===bb===
15169 ====bba====
15170 ===bc===
15171 ==c==
15172 ===ca===
15173 !! html
15174 !! end
15175
15176 !! test
15177 Section extraction test with bogus heading (section 1)
15178 !! options
15179 section=1
15180 !! wikitext
15181 ==a==
15182 ==bogus== not a legal section
15183 ==b==
15184 !! html
15185 ==a==
15186 ==bogus== not a legal section
15187 !! end
15188
15189 !! test
15190 Section extraction test with bogus heading (section 2)
15191 !! options
15192 section=2
15193 !! wikitext
15194 ==a==
15195 ==bogus== not a legal section
15196 ==b==
15197 !! html
15198 ==b==
15199 !! end
15200
15201 !! test
15202 Section extraction test with comment after heading (section 1)
15203 !! options
15204 section=1
15205 !! wikitext
15206 ==a==
15207 ==b== <!-- -->
15208 ==c==
15209 !! html
15210 ==a==
15211 !! end
15212
15213 !! test
15214 Section extraction test with comment after heading (section 2)
15215 !! options
15216 section=2
15217 !! wikitext
15218 ==a==
15219 ==b== <!-- -->
15220 ==c==
15221 !! html
15222 ==b== <!-- -->
15223 !! end
15224
15225 !! test
15226 Section extraction test with bogus <nowiki> heading (section 1)
15227 !! options
15228 section=1
15229 !! wikitext
15230 ==a==
15231 ==bogus== <nowiki>not a legal section</nowiki>
15232 ==b==
15233 !! html
15234 ==a==
15235 ==bogus== <nowiki>not a legal section</nowiki>
15236 !! end
15237
15238 !! test
15239 Section extraction test with bogus <nowiki> heading (section 2)
15240 !! options
15241 section=2
15242 !! wikitext
15243 ==a==
15244 ==bogus== <nowiki>not a legal section</nowiki>
15245 ==b==
15246 !! html
15247 ==b==
15248 !! end
15249
15250
15251 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15252 # instead of respecting commented sections
15253 !! test
15254 Section extraction prefixed by comment (section 1)
15255 !! options
15256 section=1
15257 !! wikitext
15258 <!-- -->==sec1==
15259 ==sec2==
15260 !! html
15261 ==sec2==
15262 !!end
15263
15264 !! test
15265 Section extraction prefixed by comment (section 2)
15266 !! options
15267 section=2
15268 !! wikitext
15269 <!-- -->==sec1==
15270 ==sec2==
15271 !! html
15272
15273 !!end
15274
15275
15276 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15277 # instead of respecting HTML-style headings
15278 !! test
15279 Section extraction, mixed wiki and html (section 1)
15280 !! options
15281 section=1
15282 !! wikitext
15283 <h2>unmarked</h2>
15284 unmarked
15285 ==1==
15286 one
15287 ==2==
15288 two
15289 !! html
15290 ==1==
15291 one
15292 !! end
15293
15294 !! test
15295 Section extraction, mixed wiki and html (section 2)
15296 !! options
15297 section=2
15298 !! wikitext
15299 <h2>unmarked</h2>
15300 unmarked
15301 ==1==
15302 one
15303 ==2==
15304 two
15305 !! html
15306 ==2==
15307 two
15308 !! end
15309
15310
15311 # Formerly testing for bug 3342
15312 !! test
15313 Section extraction, heading surrounded by <noinclude>
15314 !! options
15315 section=1
15316 !! wikitext
15317 <noinclude>==unmarked==</noinclude>
15318 ==marked==
15319 !! html
15320 ==marked==
15321 !!end
15322
15323 # Test behavior of bug 19910
15324 !! test
15325 Sectiion with all-equals
15326 !! options
15327 section=2
15328 !! wikitext
15329 ===
15330 The line above must have a trailing space
15331 === <!--
15332 --> <!-- -->
15333 But just in case it doesn't...
15334 !! html
15335 === <!--
15336 --> <!-- -->
15337 But just in case it doesn't...
15338 !! end
15339
15340 !! test
15341 Section replacement test (section 0)
15342 !! options
15343 replace=0,"xxx"
15344 !! wikitext
15345 start
15346 ==a==
15347 ===aa===
15348 ====aaa====
15349 ==b==
15350 ===ba===
15351 ===bb===
15352 ====bba====
15353 ===bc===
15354 ==c==
15355 ===ca===
15356 !! html
15357 xxx
15358
15359 ==a==
15360 ===aa===
15361 ====aaa====
15362 ==b==
15363 ===ba===
15364 ===bb===
15365 ====bba====
15366 ===bc===
15367 ==c==
15368 ===ca===
15369 !! end
15370
15371 !! test
15372 Section replacement test (section 1)
15373 !! options
15374 replace=1,"xxx"
15375 !! wikitext
15376 start
15377 ==a==
15378 ===aa===
15379 ====aaa====
15380 ==b==
15381 ===ba===
15382 ===bb===
15383 ====bba====
15384 ===bc===
15385 ==c==
15386 ===ca===
15387 !! html
15388 start
15389 xxx
15390
15391 ==b==
15392 ===ba===
15393 ===bb===
15394 ====bba====
15395 ===bc===
15396 ==c==
15397 ===ca===
15398 !! end
15399
15400 !! test
15401 Section replacement test (section 2)
15402 !! options
15403 replace=2,"xxx"
15404 !! wikitext
15405 start
15406 ==a==
15407 ===aa===
15408 ====aaa====
15409 ==b==
15410 ===ba===
15411 ===bb===
15412 ====bba====
15413 ===bc===
15414 ==c==
15415 ===ca===
15416 !! html
15417 start
15418 ==a==
15419 xxx
15420
15421 ==b==
15422 ===ba===
15423 ===bb===
15424 ====bba====
15425 ===bc===
15426 ==c==
15427 ===ca===
15428 !! end
15429
15430 !! test
15431 Section replacement test (section 3)
15432 !! options
15433 replace=3,"xxx"
15434 !! wikitext
15435 start
15436 ==a==
15437 ===aa===
15438 ====aaa====
15439 ==b==
15440 ===ba===
15441 ===bb===
15442 ====bba====
15443 ===bc===
15444 ==c==
15445 ===ca===
15446 !! html
15447 start
15448 ==a==
15449 ===aa===
15450 xxx
15451
15452 ==b==
15453 ===ba===
15454 ===bb===
15455 ====bba====
15456 ===bc===
15457 ==c==
15458 ===ca===
15459 !! end
15460
15461 !! test
15462 Section replacement test (section 4)
15463 !! options
15464 replace=4,"xxx"
15465 !! wikitext
15466 start
15467 ==a==
15468 ===aa===
15469 ====aaa====
15470 ==b==
15471 ===ba===
15472 ===bb===
15473 ====bba====
15474 ===bc===
15475 ==c==
15476 ===ca===
15477 !! html
15478 start
15479 ==a==
15480 ===aa===
15481 ====aaa====
15482 xxx
15483
15484 ==c==
15485 ===ca===
15486 !! end
15487
15488 !! test
15489 Section replacement test (section 5)
15490 !! options
15491 replace=5,"xxx"
15492 !! wikitext
15493 start
15494 ==a==
15495 ===aa===
15496 ====aaa====
15497 ==b==
15498 ===ba===
15499 ===bb===
15500 ====bba====
15501 ===bc===
15502 ==c==
15503 ===ca===
15504 !! html
15505 start
15506 ==a==
15507 ===aa===
15508 ====aaa====
15509 ==b==
15510 xxx
15511
15512 ===bb===
15513 ====bba====
15514 ===bc===
15515 ==c==
15516 ===ca===
15517 !! end
15518
15519 !! test
15520 Section replacement test (section 6)
15521 !! options
15522 replace=6,"xxx"
15523 !! wikitext
15524 start
15525 ==a==
15526 ===aa===
15527 ====aaa====
15528 ==b==
15529 ===ba===
15530 ===bb===
15531 ====bba====
15532 ===bc===
15533 ==c==
15534 ===ca===
15535 !! html
15536 start
15537 ==a==
15538 ===aa===
15539 ====aaa====
15540 ==b==
15541 ===ba===
15542 xxx
15543
15544 ===bc===
15545 ==c==
15546 ===ca===
15547 !! end
15548
15549 !! test
15550 Section replacement test (section 7)
15551 !! options
15552 replace=7,"xxx"
15553 !! wikitext
15554 start
15555 ==a==
15556 ===aa===
15557 ====aaa====
15558 ==b==
15559 ===ba===
15560 ===bb===
15561 ====bba====
15562 ===bc===
15563 ==c==
15564 ===ca===
15565 !! html
15566 start
15567 ==a==
15568 ===aa===
15569 ====aaa====
15570 ==b==
15571 ===ba===
15572 ===bb===
15573 xxx
15574
15575 ===bc===
15576 ==c==
15577 ===ca===
15578 !! end
15579
15580 !! test
15581 Section replacement test (section 8)
15582 !! options
15583 replace=8,"xxx"
15584 !! wikitext
15585 start
15586 ==a==
15587 ===aa===
15588 ====aaa====
15589 ==b==
15590 ===ba===
15591 ===bb===
15592 ====bba====
15593 ===bc===
15594 ==c==
15595 ===ca===
15596 !! html
15597 start
15598 ==a==
15599 ===aa===
15600 ====aaa====
15601 ==b==
15602 ===ba===
15603 ===bb===
15604 ====bba====
15605 xxx
15606
15607 ==c==
15608 ===ca===
15609 !!end
15610
15611 !! test
15612 Section replacement test (section 9)
15613 !! options
15614 replace=9,"xxx"
15615 !! wikitext
15616 start
15617 ==a==
15618 ===aa===
15619 ====aaa====
15620 ==b==
15621 ===ba===
15622 ===bb===
15623 ====bba====
15624 ===bc===
15625 ==c==
15626 ===ca===
15627 !! html
15628 start
15629 ==a==
15630 ===aa===
15631 ====aaa====
15632 ==b==
15633 ===ba===
15634 ===bb===
15635 ====bba====
15636 ===bc===
15637 xxx
15638 !! end
15639
15640 !! test
15641 Section replacement test (section 10)
15642 !! options
15643 replace=10,"xxx"
15644 !! wikitext
15645 start
15646 ==a==
15647 ===aa===
15648 ====aaa====
15649 ==b==
15650 ===ba===
15651 ===bb===
15652 ====bba====
15653 ===bc===
15654 ==c==
15655 ===ca===
15656 !! html
15657 start
15658 ==a==
15659 ===aa===
15660 ====aaa====
15661 ==b==
15662 ===ba===
15663 ===bb===
15664 ====bba====
15665 ===bc===
15666 ==c==
15667 xxx
15668 !! end
15669
15670 !! test
15671 Section replacement test with initial whitespace (bug 13728)
15672 !! options
15673 replace=2,"xxx"
15674 !! wikitext
15675 Preformatted initial line
15676 ==a==
15677 ===a===
15678 !! html
15679 Preformatted initial line
15680 ==a==
15681 xxx
15682 !! end
15683
15684
15685 !! test
15686 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15687 !! options
15688 section=1
15689 !! wikitext
15690 ==a==
15691 a
15692 !! html
15693 ==a==
15694 a
15695 !! end
15696
15697 !! test
15698 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15699 !! options
15700 section=1
15701 !! wikitext
15702 ==a==
15703 a
15704 !! html
15705 ==a==
15706 a
15707 !! end
15708
15709
15710 !! test
15711 Section extraction, <pre> around bogus header (bug 10309)
15712 !! options
15713 noxml section=2
15714 !! wikitext
15715 == Section One ==
15716 <pre>
15717 =======
15718 </pre>
15719
15720 == Section Two ==
15721 stuff
15722 !! html
15723 == Section Two ==
15724 stuff
15725 !! end
15726
15727 !! test
15728 Section replacement, <pre> around bogus header (bug 10309)
15729 !! options
15730 noxml replace=2,"xxx"
15731 !! wikitext
15732 == Section One ==
15733 <pre>
15734 =======
15735 </pre>
15736
15737 == Section Two ==
15738 stuff
15739 !! html
15740 == Section One ==
15741 <pre>
15742 =======
15743 </pre>
15744
15745 xxx
15746 !! end
15747
15748
15749
15750 !! test
15751 Handling of &#x0A; in URLs
15752 !! wikitext
15753 ** irc://&#x0A;a
15754 !! html/php
15755 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15756
15757 !! html/parsoid
15758 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15759 a">irc://
15760 a</a></li></ul></li></ul>
15761 !! end
15762
15763 !! test
15764 Handling of %0A in URLs
15765 !! wikitext
15766 ** irc://%0Aa
15767 !! html/php
15768 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15769
15770 !! html/parsoid
15771 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15772 !! end
15773
15774
15775 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15776 !! test
15777 5 quotes, code coverage +1 line
15778 !! options
15779 parsoid=wt2html
15780 !! wikitext
15781 '''''
15782 !! html/php
15783 !! html/parsoid
15784 <p><b><i></i></b></p>
15785 !! end
15786
15787 # same html as previous, but wikitext adjusted to match parsoid html2wt
15788 # note that wt2html and html2html will put the <i> before the <b>
15789 !! test
15790 5 quotes, code coverage +1 line w/ nowiki (1)
15791 !! options
15792 parsoid=wt2wt,html2wt
15793 !! wikitext
15794 '''''<nowiki/>'''''
15795 !! html/php
15796 <p><i></i>
15797 </p>
15798 !! html/parsoid
15799 <p><b><i></i></b></p>
15800 !! end
15801
15802 # same as previous, just swapping the <i> and <b>
15803 !! test
15804 5 quotes, code coverage +1 line w/ nowiki (2)
15805 !! wikitext
15806 '''''<nowiki/>'''''
15807 !! html/php
15808 <p><i></i>
15809 </p>
15810 !! html/parsoid
15811 <p><i><b></b></i></p>
15812 !! end
15813
15814 !! test
15815 Special:Search page linking.
15816 !! wikitext
15817 {{Special:search}}
15818 !! html
15819 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15820 </p>
15821 !! end
15822
15823 !! test
15824 Say the magic word
15825 !! options
15826 title=[[Parser test]]
15827 !! wikitext
15828 * {{PAGENAME}}
15829 * {{PAGENAMEE}}
15830 * {{FULLPAGENAME}}
15831 * {{FULLPAGENAMEE}}
15832 * {{BASEPAGENAME}}
15833 * {{BASEPAGENAMEE}}
15834 * {{SUBPAGENAME}}
15835 * {{SUBPAGENAMEE}}
15836 * {{ROOTPAGENAME}}
15837 * {{ROOTPAGENAMEE}}
15838 * {{TALKPAGENAME}}
15839 * {{TALKPAGENAMEE}}
15840 * {{SUBJECTPAGENAME}}
15841 * {{SUBJECTPAGENAMEE}}
15842 * {{NAMESPACEE}}
15843 * {{NAMESPACE}}
15844 * {{NAMESPACENUMBER}}
15845 * {{TALKSPACE}}
15846 * {{TALKSPACEE}}
15847 * {{SUBJECTSPACE}}
15848 * {{SUBJECTSPACEE}}
15849 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15850 !! html
15851 <ul><li> Parser test</li>
15852 <li> Parser_test</li>
15853 <li> Parser test</li>
15854 <li> Parser_test</li>
15855 <li> Parser test</li>
15856 <li> Parser_test</li>
15857 <li> Parser test</li>
15858 <li> Parser_test</li>
15859 <li> Parser test</li>
15860 <li> Parser_test</li>
15861 <li> Talk:Parser test</li>
15862 <li> Talk:Parser_test</li>
15863 <li> Parser test</li>
15864 <li> Parser_test</li>
15865 <li> </li>
15866 <li> </li>
15867 <li> 0</li>
15868 <li> Talk</li>
15869 <li> Talk</li>
15870 <li> </li>
15871 <li> </li>
15872 <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>
15873
15874 !! end
15875 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15876
15877 !! test
15878 Gallery
15879 !! wikitext
15880 <gallery>
15881 image1.png |
15882 image2.gif|||||
15883
15884 image3|
15885 image4 |300px| centre
15886 image5.svg| http://///////
15887 [[x|xx]]]]
15888 * image6
15889 </gallery>
15890 !! html
15891 <ul class="gallery mw-gallery-traditional">
15892 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15893 <div class="thumb" style="height: 150px;">Image1.png</div>
15894 <div class="gallerytext">
15895 </div>
15896 </div></li>
15897 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15898 <div class="thumb" style="height: 150px;">Image2.gif</div>
15899 <div class="gallerytext">
15900 <p>||||
15901 </p>
15902 </div>
15903 </div></li>
15904 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15905 <div class="thumb" style="height: 150px;">Image3</div>
15906 <div class="gallerytext">
15907 </div>
15908 </div></li>
15909 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15910 <div class="thumb" style="height: 150px;">Image4</div>
15911 <div class="gallerytext">
15912 <p>300px| centre
15913 </p>
15914 </div>
15915 </div></li>
15916 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15917 <div class="thumb" style="height: 150px;">Image5.svg</div>
15918 <div class="gallerytext">
15919 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15920 </p>
15921 </div>
15922 </div></li>
15923 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15924 <div class="thumb" style="height: 150px;">* image6</div>
15925 <div class="gallerytext">
15926 </div>
15927 </div></li>
15928 </ul>
15929
15930 !! end
15931
15932 !! test
15933 Gallery (with options)
15934 !! wikitext
15935 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15936 File:Nonexistant.jpg|caption
15937 File:Nonexistant.jpg
15938 image:foobar.jpg|some '''caption''' [[Main Page]]
15939 image:foobar.jpg
15940 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15941 </gallery>
15942 !! html
15943 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15944 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15945 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15946 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15947 <div class="gallerytext">
15948 <p>caption
15949 </p>
15950 </div>
15951 </div></li>
15952 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15953 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15954 <div class="gallerytext">
15955 </div>
15956 </div></li>
15957 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15958 <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>
15959 <div class="gallerytext">
15960 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15961 </p>
15962 </div>
15963 </div></li>
15964 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15965 <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>
15966 <div class="gallerytext">
15967 </div>
15968 </div></li>
15969 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15970 <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>
15971 <div class="gallerytext">
15972 <p>Blabla|blabla.
15973 </p>
15974 </div>
15975 </div></li>
15976 </ul>
15977
15978 !! end
15979
15980 !! test
15981 Gallery with link that has fragment
15982 !! wikitext
15983 <gallery>
15984 image:foobar.jpg|link=Main_Page
15985 image:foobar.jpg|link=Main_Page#section
15986 image:foobar.jpg|link=Main Page#section|caption
15987 </gallery>
15988 !! html
15989 <ul class="gallery mw-gallery-traditional">
15990 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15991 <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>
15992 <div class="gallerytext">
15993 </div>
15994 </div></li>
15995 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15996 <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>
15997 <div class="gallerytext">
15998 </div>
15999 </div></li>
16000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16001 <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>
16002 <div class="gallerytext">
16003 <p>caption
16004 </p>
16005 </div>
16006 </div></li>
16007 </ul>
16008
16009 !! end
16010
16011 !! test
16012 Gallery with wikitext inside caption
16013 !! wikitext
16014 <gallery>
16015 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16016 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16017 </gallery>
16018 !! html
16019 <ul class="gallery mw-gallery-traditional">
16020 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16021 <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>
16022 <div class="gallerytext">
16023 <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>
16024 </p>
16025 </div>
16026 </div></li>
16027 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16028 <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>
16029 <div class="gallerytext">
16030 <p>This is a test template
16031 </p>
16032 </div>
16033 </div></li>
16034 </ul>
16035
16036 !! end
16037
16038 !! test
16039 gallery (with showfilename option)
16040 !! wikitext
16041 <gallery showfilename>
16042 File:Nonexistant.jpg|caption
16043 File:Nonexistant.jpg
16044 image:foobar.jpg|some '''caption''' [[Main Page]]
16045 File:Foobar.jpg
16046 </gallery>
16047 !! html
16048 <ul class="gallery mw-gallery-traditional">
16049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16050 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16051 <div class="gallerytext">
16052 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16053 caption
16054 </p>
16055 </div>
16056 </div></li>
16057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16058 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16059 <div class="gallerytext">
16060 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16061 </p>
16062 </div>
16063 </div></li>
16064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16065 <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>
16066 <div class="gallerytext">
16067 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16068 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16069 </p>
16070 </div>
16071 </div></li>
16072 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16073 <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>
16074 <div class="gallerytext">
16075 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16076 </p>
16077 </div>
16078 </div></li>
16079 </ul>
16080
16081 !! end
16082
16083 !! test
16084 Gallery (with namespace-less filenames)
16085 !! wikitext
16086 <gallery>
16087 File:Nonexistant.jpg
16088 Nonexistant.jpg
16089 image:foobar.jpg
16090 foobar.jpg
16091 </gallery>
16092 !! html
16093 <ul class="gallery mw-gallery-traditional">
16094 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16095 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16096 <div class="gallerytext">
16097 </div>
16098 </div></li>
16099 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16100 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16101 <div class="gallerytext">
16102 </div>
16103 </div></li>
16104 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16105 <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>
16106 <div class="gallerytext">
16107 </div>
16108 </div></li>
16109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16110 <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>
16111 <div class="gallerytext">
16112 </div>
16113 </div></li>
16114 </ul>
16115
16116 !! end
16117
16118 !! test
16119 HTML Hex character encoding (spells the word "JavaScript")
16120 !! options
16121 parsoid=wt2html,wt2wt,html2html
16122 !! wikitext
16123 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16124 !! html/php
16125 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16126 </p>
16127 !! html/php+tidy
16128 <p>JavaScript</p>
16129 !! html/parsoid
16130 <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>
16131 !! end
16132
16133 !! test
16134 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16135 !! wikitext
16136 &#xsee;&#XSEE;
16137 !! html/php
16138 <p>&amp;#xsee;&amp;#XSEE;
16139 </p>
16140 !! html/parsoid
16141 <p>&amp;#xsee;&amp;#XSEE;</p>
16142 !! end
16143
16144 !! test
16145 HTML Hex character encoding mixed case
16146 !! options
16147 parsoid=wt2html,wt2wt,html2html
16148 !! wikitext
16149 &#xEE;&#Xee;
16150 !! html/php
16151 <p>&#xee;&#xee;
16152 </p>
16153 !! html/php+tidy
16154 <p>îî</p>
16155 !! html/parsoid
16156 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16157 !! end
16158
16159 !! test
16160 __FORCETOC__ override
16161 !! wikitext
16162 __NEWSECTIONLINK__
16163 __FORCETOC__
16164 !! html
16165 <p><br />
16166 </p>
16167 !! end
16168
16169 !! test
16170 ISBN code coverage
16171 !! wikitext
16172 ISBN 978-0-1234-56&#x20;789
16173 !! html
16174 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16175 </p>
16176 !! html+tidy
16177 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16178 !! end
16179
16180 !! test
16181 ISBN followed by 5 spaces
16182 !! wikitext
16183 ISBN
16184 !! html
16185 <p>ISBN
16186 </p>
16187 !! end
16188
16189 !! test
16190 Double ISBN
16191 !! wikitext
16192 ISBN ISBN 1234567890
16193 !! html
16194 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16195 </p>
16196 !! end
16197
16198 !! test
16199 ISBN with an X
16200 !! wikitext
16201 ISBN 3-462-04561-X
16202 !! html
16203 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16204 </p>
16205 !! end
16206
16207 !! test
16208 ISBN with empty prefix (parsoid test)
16209 !! wikitext
16210 ISBN 1234567890
16211 !! html/parsoid
16212 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16213 !! end
16214
16215 !! test
16216 Bug 22905: <abbr> followed by ISBN followed by </a>
16217 !! wikitext
16218 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16219 !! html
16220 <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>
16221 </p>
16222 !! end
16223
16224 !! test
16225 Double RFC
16226 !! wikitext
16227 RFC RFC 1234
16228 !! html
16229 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16230 </p>
16231 !! end
16232
16233 !! test
16234 Double RFC with a wiki link
16235 !! wikitext
16236 RFC [[RFC 1234]]
16237 !! html
16238 <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>
16239 </p>
16240 !! end
16241
16242 !! test
16243 RFC code coverage
16244 !! wikitext
16245 RFC 983&#x20;987
16246 !! html
16247 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16248 </p>
16249 !! html+tidy
16250 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16251 !! end
16252
16253 !! test
16254 Centre-aligned image
16255 !! wikitext
16256 [[Image:foobar.jpg|centre]]
16257 !! html
16258 <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>
16259
16260 !!end
16261
16262 !! test
16263 None-aligned image
16264 !! wikitext
16265 [[Image:foobar.jpg|none]]
16266 !! html
16267 <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>
16268
16269 !!end
16270
16271 !! test
16272 Width + Height sized image (using px) (height is ignored)
16273 !! wikitext
16274 [[Image:foobar.jpg|640x480px]]
16275 !! html
16276 <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>
16277 </p>
16278 !!end
16279
16280 !! test
16281 Width-sized image (using px, no following whitespace)
16282 !! wikitext
16283 [[Image:foobar.jpg|640px]]
16284 !! html
16285 <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>
16286 </p>
16287 !!end
16288
16289 !! test
16290 Width-sized image (using px, with following whitespace - test regression from r39467)
16291 !! wikitext
16292 [[Image:foobar.jpg|640px ]]
16293 !! html
16294 <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>
16295 </p>
16296 !!end
16297
16298 !! test
16299 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16300 !! wikitext
16301 [[Image:foobar.jpg| 640px]]
16302 !! html
16303 <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>
16304 </p>
16305 !!end
16306
16307 !! test
16308 Image with page parameter
16309 !! options
16310 djvu
16311 !! wikitext
16312 [[File:LoremIpsum.djvu|page=2]]
16313 !! html
16314 <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>
16315 </p>
16316 !! end
16317
16318 !! test
16319 Another italics / bold test
16320 !! wikitext
16321 ''' ''x'
16322 !! html
16323 <pre>'<i> </i>x'
16324 </pre>
16325 !!end
16326
16327 # Note the results may be incorrect, as parserTest output included this:
16328 # XML error: Mismatched tag at byte 6120:
16329 # ...<dd> </dt></dl> </dd...
16330 !! test
16331 dt/dd/dl test
16332 !! options
16333 disabled
16334 !! wikitext
16335 :;;;::
16336 !! html
16337 <dl>
16338 <dd><dl>
16339 <dt><dl>
16340 <dt><dl>
16341 <dt><dl>
16342 <dd><dl>
16343 <dd>
16344 </dd>
16345 </dl>
16346 </dd>
16347 </dl>
16348 </dt>
16349 </dl>
16350 </dt>
16351 </dl>
16352 </dt>
16353 </dl>
16354 </dd>
16355 </dl>
16356
16357 !!end
16358
16359
16360 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16361 !! test
16362 Images with the "|" character in the comment
16363 !! wikitext
16364 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16365 !! html/php
16366 <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>
16367
16368 !! html/parsoid
16369 <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>
16370 !! end
16371
16372 !! test
16373 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16374 !! wikitext
16375 <html><script>alert(1);</script></html>
16376 !! html
16377 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16378 </p>
16379 !! end
16380
16381 !! test
16382 HTML with raw HTML ($wgRawHtml==true)
16383 !! options
16384 wgRawHtml=1
16385 !! wikitext
16386 <html><script>alert(1);</script></html>
16387 !! html
16388 <p><script>alert(1);</script>
16389 </p>
16390 !! end
16391
16392 !! test
16393 Parents of subpages, one level up
16394 !! options
16395 subpage title=[[Subpage test/L1/L2/L3]]
16396 !! wikitext
16397 [[../|L2]]
16398 !! html
16399 <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>
16400 </p>
16401 !! end
16402
16403
16404 !! test
16405 Parents of subpages, one level up, not named
16406 !! options
16407 subpage title=[[Subpage test/L1/L2/L3]]
16408 !! wikitext
16409 [[../]]
16410 !! html
16411 <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>
16412 </p>
16413 !! end
16414
16415
16416
16417 !! test
16418 Parents of subpages, two levels up
16419 !! options
16420 subpage title=[[Subpage test/L1/L2/L3]]
16421 !! wikitext
16422 [[../../|L1]]2
16423
16424 [[../../|L1]]l
16425 !! html
16426 <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
16427 </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>
16428 </p>
16429 !! end
16430
16431 !! test
16432 Parents of subpages, two levels up, without trailing slash or name.
16433 !! options
16434 subpage title=[[Subpage test/L1/L2/L3]]
16435 !! wikitext
16436 [[../..]]
16437 !! html
16438 <p>[[../..]]
16439 </p>
16440 !! end
16441
16442 !! test
16443 Parents of subpages, two levels up, with lots of extra trailing slashes.
16444 !! options
16445 subpage title=[[Subpage test/L1/L2/L3]]
16446 !! wikitext
16447 [[../../////]]
16448 !! html
16449 <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)">///</a>
16450 </p>
16451 !! end
16452
16453 !! article
16454 Subpage test/L1/L2/L3Sibling
16455 !! text
16456 Sibling article
16457 !! endarticle
16458
16459 !! test
16460 Transclusion of a sibling page (one level up)
16461 !! options
16462 subpage title=[[Subpage test/L1/L2/L3]]
16463 !! wikitext
16464 {{../L3Sibling}}
16465 !! html
16466 <p>Sibling article
16467 </p>
16468 !! end
16469
16470 !! test
16471 Transclusion of a child page
16472 !! options
16473 subpage title=[[Subpage test/L1/L2]]
16474 !! wikitext
16475 {{/L3Sibling}}
16476 !! html
16477 <p>Sibling article
16478 </p>
16479 !! end
16480
16481 !! test
16482 Non-transclusion because of too many up levels
16483 !! options
16484 subpage title=[[Subpage test/L1/L2/L3]]
16485 !! wikitext
16486 {{../../../../More than parent}}
16487 !! html
16488 <p>{{../../../../More than parent}}
16489 </p>
16490 !! end
16491
16492 !! test
16493 Definition list code coverage
16494 !! wikitext
16495 ; title : def
16496 ; title : def
16497 ;title: def
16498 !! html
16499 <dl><dt> title &#160;</dt>
16500 <dd> def</dd>
16501 <dt> title&#160;</dt>
16502 <dd> def</dd>
16503 <dt>title</dt>
16504 <dd> def</dd></dl>
16505
16506 !! end
16507
16508 !! test
16509 Don't fall for the self-closing div
16510 !! wikitext
16511 <div>hello world</div/>
16512 !! html
16513 <div>hello world</div>
16514
16515 !! end
16516
16517 !! test
16518 MSGNW magic word
16519 !! wikitext
16520 {{MSGNW:msg}}
16521 !! html
16522 <p>&#91;&#91;:Template:Msg&#93;&#93;
16523 </p>
16524 !! end
16525
16526 !! test
16527 RAW magic word
16528 !! wikitext
16529 {{RAW:QUERTY}}
16530 !! html
16531 <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>
16532 </p>
16533 !! end
16534
16535 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16536 !! test
16537 Always escape literal '>' in output, not just after '<'
16538 !! wikitext
16539 ><>
16540 !! html
16541 <p>&gt;&lt;&gt;
16542 </p>
16543 !! end
16544
16545 !! test
16546 Template caching
16547 !! wikitext
16548 {{Test}}
16549 {{Test}}
16550 !! html
16551 <p>This is a test template
16552 This is a test template
16553 </p>
16554 !! end
16555
16556
16557 !! article
16558 MediaWiki:Fake
16559 !! text
16560 ==header==
16561 !! endarticle
16562
16563 !! test
16564 Inclusion of !userCanEdit() content
16565 !! wikitext
16566 {{MediaWiki:Fake}}
16567 !! html
16568 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16569
16570 !! end
16571
16572
16573 !! test
16574 Out-of-order TOC heading levels
16575 !! wikitext
16576 ==2==
16577 ======6======
16578 ===3===
16579 =1=
16580 =====5=====
16581 ==2==
16582 !! html
16583 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16584 <ul>
16585 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16586 <ul>
16587 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16588 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16589 </ul>
16590 </li>
16591 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16592 <ul>
16593 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16594 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16595 </ul>
16596 </li>
16597 </ul>
16598 </div>
16599
16600 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16601 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
16602 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
16603 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
16604 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
16605 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
16606
16607 !! end
16608
16609
16610 !! test
16611 ISBN with a dummy number
16612 !! wikitext
16613 ISBN ---
16614 !! html
16615 <p>ISBN ---
16616 </p>
16617 !! end
16618
16619
16620 !! test
16621 ISBN with space-delimited number
16622 !! wikitext
16623 ISBN 92 9017 032 8
16624 !! html
16625 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16626 </p>
16627 !! end
16628
16629
16630 !! test
16631 ISBN with multiple spaces, no number
16632 !! wikitext
16633 ISBN foo
16634 !! html
16635 <p>ISBN foo
16636 </p>
16637 !! end
16638
16639
16640 !! test
16641 ISBN length
16642 !! wikitext
16643 ISBN 123456789
16644
16645 ISBN 1234567890
16646
16647 ISBN 12345678901
16648 !! html
16649 <p>ISBN 123456789
16650 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16651 </p><p>ISBN 12345678901
16652 </p>
16653 !! end
16654
16655
16656 !! test
16657 ISBN with trailing year (bug 8110)
16658 !! wikitext
16659 ISBN 1-234-56789-0 - 2006
16660
16661 ISBN 1 234 56789 0 - 2006
16662 !! html
16663 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16664 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16665 </p>
16666 !! end
16667
16668
16669 !! test
16670 anchorencode
16671 !! wikitext
16672 {{anchorencode:foo bar©#%n}}
16673 !! html
16674 <p>foo_bar.C2.A9.23.25n
16675 </p>
16676 !! end
16677
16678 !! test
16679 anchorencode trims spaces
16680 !! wikitext
16681 {{anchorencode: __pretty__please__}}
16682 !! html
16683 <p>pretty_please
16684 </p>
16685 !! end
16686
16687 !! test
16688 anchorencode deals with links
16689 !! wikitext
16690 {{anchorencode: [[hello|world]] [[hi]]}}
16691 !! html
16692 <p>world_hi
16693 </p>
16694 !! end
16695
16696 !! test
16697 anchorencode deals with templates
16698 !! wikitext
16699 {{anchorencode: {{Foo}} }}
16700 !! html
16701 <p>FOO
16702 </p>
16703 !! end
16704
16705 !! test
16706 anchorencode encodes like the TOC generator: (bug 18431)
16707 !! wikitext
16708 === _ +:.3A%3A&&amp;]] ===
16709 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16710 __NOEDITSECTION__
16711 !! html
16712 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16713 <p>.2B:.3A.253A.26.26.5D.5D
16714 </p>
16715 !! end
16716
16717 !! test
16718 Bug 6200: blockquotes and paragraph formatting
16719 !! wikitext
16720 <blockquote>
16721 foo
16722 </blockquote>
16723
16724 bar
16725
16726 baz
16727 !! html
16728 <blockquote>
16729 <p>foo
16730 </p>
16731 </blockquote>
16732 <p>bar
16733 </p>
16734 <pre>baz
16735 </pre>
16736 !! end
16737
16738 !! test
16739 Bug 8293: Use of center tag ruins paragraph formatting
16740 !! wikitext
16741 <center>
16742 foo
16743 </center>
16744
16745 bar
16746
16747 baz
16748 !! html
16749 <center>
16750 <p>foo
16751 </p>
16752 </center>
16753 <p>bar
16754 </p>
16755 <pre>baz
16756 </pre>
16757 !! end
16758
16759 !!test
16760 Parsing of overlapping (improperly nested) inline html tags
16761 !! wikitext
16762 <span><s>x</span></s>
16763 !! html/php
16764 <p><span><s>x&lt;/span&gt;</s></span>
16765 </p>
16766 !! html/parsoid
16767 <p><span><s>x</s></span>
16768 </p>
16769 !!end
16770
16771 ###
16772 ### Language variants related tests
16773 ###
16774 !! test
16775 Self-link in language variants
16776 !! options
16777 title=[[Dunav]] language=sr
16778 !! wikitext
16779 Both [[Dunav]] and [[Дунав]] are names for this river.
16780 !! html
16781 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16782 </p>
16783 !!end
16784
16785 !! article
16786 Дуна
16787 !! text
16788 content
16789 !! endarticle
16790
16791 !! test
16792 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16793 !! options
16794 title=[[Duna]] language=sr
16795 !! wikitext
16796 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16797 !! html
16798 <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.
16799 </p>
16800 !! end
16801
16802 !! test
16803 Link to a section of a variant of this title shouldn't be parsed as self-link
16804 !! options
16805 title=[[Duna]] language=sr
16806 !! wikitext
16807 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16808 !! html
16809 <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.
16810 </p>
16811 !! end
16812
16813 !! test
16814 Link to pages in language variants
16815 !! options
16816 language=sr
16817 !! wikitext
16818 Main Page can be written as [[Маин Паге]]
16819 !! html
16820 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16821 </p>
16822 !!end
16823
16824
16825 !! test
16826 Multiple links to pages in language variants
16827 !! options
16828 language=sr
16829 !! wikitext
16830 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16831 !! html
16832 <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>.
16833 </p>
16834 !!end
16835
16836
16837 !! test
16838 Simple template in language variants
16839 !! options
16840 language=sr
16841 !! wikitext
16842 {{тест}}
16843 !! html
16844 <p>This is a test template
16845 </p>
16846 !! end
16847
16848
16849 !! test
16850 Template with explicit namespace in language variants
16851 !! options
16852 language=sr
16853 !! wikitext
16854 {{Template:тест}}
16855 !! html
16856 <p>This is a test template
16857 </p>
16858 !! end
16859
16860
16861 !! test
16862 Basic test for template parameter in language variants
16863 !! options
16864 language=sr
16865 !! wikitext
16866 {{парамтест|param=foo}}
16867 !! html
16868 <p>This is a test template with parameter foo
16869 </p>
16870 !! end
16871
16872
16873 !! test
16874 Simple category in language variants
16875 !! options
16876 language=sr cat
16877 !! wikitext
16878 [[Category:МедиаWики Усер'с Гуиде]]
16879 !! html
16880 <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>
16881 !! end
16882
16883
16884 !! article
16885 Category:分类
16886 !! text
16887 blah
16888 !! endarticle
16889
16890 !! article
16891 Category:分類
16892 !! text
16893 blah
16894 !! endarticle
16895
16896 !! test
16897 Don't convert blue categorylinks to another variant (bug 33210)
16898 !! options
16899 language=zh cat
16900 !! wikitext
16901 [[A]][[Category:分类]]
16902 !! html
16903 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16904 !! end
16905
16906
16907 !! test
16908 Stripping -{}- tags (language variants)
16909 !! options
16910 language=sr
16911 !! wikitext
16912 Latin proverb: -{Ne nuntium necare}-
16913 !! html
16914 <p>Latin proverb: Ne nuntium necare
16915 </p>
16916 !! end
16917
16918
16919 !! test
16920 Prevent conversion with -{}- tags (language variants)
16921 !! options
16922 language=sr variant=sr-ec
16923 !! wikitext
16924 Latinski: -{Ne nuntium necare}-
16925 !! html
16926 <p>Латински: Ne nuntium necare
16927 </p>
16928 !! end
16929
16930
16931 !! test
16932 Prevent conversion of text with -{}- tags (language variants)
16933 !! options
16934 language=sr variant=sr-ec
16935 !! wikitext
16936 Latinski: -{Ne nuntium necare}-
16937 !! html
16938 <p>Латински: Ne nuntium necare
16939 </p>
16940 !! end
16941
16942
16943 !! test
16944 Prevent conversion of links with -{}- tags (language variants)
16945 !! options
16946 language=sr variant=sr-ec
16947 !! wikitext
16948 -{[[Main Page]]}-
16949 !! html
16950 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16951 </p>
16952 !! end
16953
16954
16955 !! test
16956 -{}- tags within headlines (within html for parserConvert())
16957 !! options
16958 language=sr variant=sr-ec
16959 !! wikitext
16960 == -{Naslov}- ==
16961 !! html
16962 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
16963
16964 !! end
16965
16966
16967 !! test
16968 Explicit definition of language variant alternatives
16969 !! options
16970 language=zh variant=zh-tw
16971 !! wikitext
16972 -{zh:China;zh-tw:Taiwan}-, not China
16973 !! html
16974 <p>Taiwan, not China
16975 </p>
16976 !! end
16977
16978
16979 !! test
16980 Conversion around HTML tags
16981 !! options
16982 language=sr variant=sr-ec
16983 !! wikitext
16984 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16985 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16986 !! html
16987 <p>
16988 <span title="ЛаCтин">ски</span>
16989 </p>
16990 !! end
16991
16992
16993 !! test
16994 Explicit session-wise language variant mapping (A flag and - flag)
16995 !! options
16996 language=zh variant=zh-tw
16997 !! wikitext
16998 Taiwan is not China.
16999 But -{A|zh:China;zh-tw:Taiwan}- is China,
17000 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17001 and -{China}- is China.
17002 !! html
17003 <p>Taiwan is not China.
17004 But Taiwan is Taiwan,
17005 (This should be stripped!)
17006 and China is China.
17007 </p>
17008 !! end
17009
17010 !! test
17011 Explicit session-wise language variant mapping (H flag for hide)
17012 !! options
17013 language=zh variant=zh-tw
17014 !! wikitext
17015 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17016 Taiwan is China.
17017 !! html
17018 <p>(This should be stripped!)
17019 Taiwan is Taiwan.
17020 </p>
17021 !! end
17022
17023 !! test
17024 Adding explicit conversion rule for title (T flag)
17025 !! options
17026 language=zh variant=zh-tw showtitle
17027 !! wikitext
17028 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17029 !! html
17030 Taiwan
17031 <p>Should be stripped!
17032 </p>
17033 !! end
17034
17035 !! test
17036 Testing that changing the language variant here in the tests actually works
17037 !! options
17038 language=zh variant=zh showtitle
17039 !! wikitext
17040 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17041 !! html
17042 China
17043 <p>Should be stripped!
17044 </p>
17045 !! end
17046
17047 !! test
17048 Recursive conversion of alt and title attrs shouldn't clear converter state
17049 !! options
17050 language=zh variant=zh-cn showtitle
17051 !! wikitext
17052 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17053 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17054 !! html
17055 China
17056 <p>
17057 Should be stripped<span title="Exclamation">!</span>
17058 </p>
17059 !! end
17060
17061 !! test
17062 Bug 24072: more test on conversion rule for title
17063 !! options
17064 language=zh variant=zh-tw showtitle
17065 !! wikitext
17066 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17067 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17068 !! html
17069 Taiwan
17070 <p>This should be stripped!
17071 This won't take interferes with the title rule.
17072 </p>
17073 !! end
17074
17075 !! test
17076 Partly disable title conversion if variant == main language code
17077 !! options
17078 language=zh variant=zh title=[[ZH]] showtitle
17079 !! wikitext
17080 -{T|zh-cn:CN;zh-tw:TW}-
17081 !! html
17082 ZH
17083 <p>
17084 </p>
17085 !! end
17086
17087 !! test
17088 Partly disable title conversion if variant == main language code, more
17089 !! options
17090 language=zh variant=zh title=[[ZH]] showtitle
17091 !! wikitext
17092 -{T|TW}-
17093 !! html
17094 ZH
17095 <p>
17096 </p>
17097 !! end
17098
17099 !! test
17100 Raw output of variant escape tags (R flag)
17101 !! options
17102 language=zh variant=zh-tw
17103 !! wikitext
17104 Raw: -{R|zh:China;zh-tw:Taiwan}-
17105 !! html
17106 <p>Raw: zh:China;zh-tw:Taiwan
17107 </p>
17108 !! end
17109
17110 !! test
17111 Nested using of manual convert syntax
17112 !! options
17113 language=zh variant=zh-hk
17114 !! wikitext
17115 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17116 !! html
17117 <p>Nested: Hello Hong Kong!
17118 </p>
17119 !! end
17120
17121 !! test
17122 Proper conversion of text in external links
17123 !! options
17124 language=sr variant=sr-ec
17125 !! wikitext
17126 http://www.google.com
17127 gopher://www.google.com
17128 [http://www.google.com http://www.google.com]
17129 [gopher://www.google.com gopher://www.google.com]
17130 [https://www.google.com irc://www.google.com]
17131 [ftp://www.google.com www.google.com/ftp://dir]
17132 [//www.google.com www.google.com]
17133 !! html
17134 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17135 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17136 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17137 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17138 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17139 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17140 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17141 </p>
17142 !! end
17143
17144 !! test
17145 Do not convert roman numbers to language variants
17146 !! options
17147 language=sr variant=sr-ec
17148 !! wikitext
17149 Fridrih IV je car.
17150 !! html
17151 <p>Фридрих IV је цар.
17152 </p>
17153 !! end
17154
17155 !! test
17156 Unclosed language converter markup "-{"
17157 !! options
17158 language=sr
17159 !! wikitext
17160 -{T|hello
17161 !! html
17162 <p>-{T|hello
17163 </p>
17164 !! end
17165
17166 !! test
17167 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17168 !! options
17169 language=sr
17170 !! wikitext
17171 -{R|=&gt;}-
17172 !! html
17173 <p>=&gt;
17174 </p>
17175 !!end
17176
17177 !! test
17178 Don't break link parsing if language converter markup is in the caption.
17179 !! options
17180 language=sr variant=sr-ec
17181 !! wikitext
17182 [[Main Page|-{R|main page}-]]
17183 !! html
17184 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17185 </p>
17186 !! end
17187
17188 # This test is currently broken in the PHP parser (bug 52661)
17189 !! test
17190 Don't break image parsing if language converter markup is in the caption.
17191 !! options
17192 language=sr
17193 disabled
17194 !! wikitext
17195 [[File:Foobar.jpg|-{R|caption}-]]
17196 !! html
17197 <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>
17198 </p>
17199 !! end
17200
17201 # This test is currently broken in the PHP parser (bug 52661)
17202 !! test
17203 Don't break list handling if language converter markup is in the item.
17204 !! options
17205 language=zh variant=zh-cn
17206 disabled
17207 !! wikitext
17208 ;-{zh-cn:AAA;zh-tw:BBB}-
17209 !! html
17210 <dl><dt>AAA
17211 </dt></dl>
17212
17213 !! end
17214
17215 # This test is currently broken in the PHP parser (bug 52661)
17216 !! test
17217 Don't break table handling if language converter markup is in the cell.
17218 !! options
17219 language=sr variant=sr-ec
17220 disabled
17221 !! wikitext
17222 {|
17223 |-
17224 | -{R|B}-
17225 |}
17226 !! html
17227 <table>
17228
17229 <tr>
17230 <td> B
17231 </td></tr></table>
17232
17233 !! end
17234
17235 !! test
17236 Bug 529: Uncovered bullet
17237 !! wikitext
17238 * Foo {{bullet}}
17239 !! html
17240 <ul><li> Foo </li>
17241 <li> Bar</li></ul>
17242
17243 !! end
17244
17245 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17246 # Templates in Wikipedia rely on this behavior, as tidy has always been
17247 # enabled there. These tests are normally run *without* tidy, so specify the
17248 # full output here.
17249 # To test realistic parsing behavior, apply a tidy-like transformation to both
17250 # the expected output and your parser's output.
17251 !! test
17252 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17253 !! wikitext
17254 ******* Foo {{bullet}}
17255 !! html
17256 <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>
17257 <li> Bar</li></ul>
17258
17259 !! end
17260
17261 !! test
17262 Bug 529: Uncovered table already at line-start
17263 !! wikitext
17264 x
17265
17266 {{table}}
17267 y
17268 !! html
17269 <p>x
17270 </p>
17271 <table>
17272 <tr>
17273 <td> 1 </td>
17274 <td> 2
17275 </td></tr>
17276 <tr>
17277 <td> 3 </td>
17278 <td> 4
17279 </td></tr></table>
17280 <p>y
17281 </p>
17282 !! end
17283
17284 !! test
17285 Bug 529: Uncovered bullet in parser function result
17286 !! wikitext
17287 * Foo {{lc:{{bullet}} }}
17288 !! html
17289 <ul><li> Foo </li>
17290 <li> bar</li></ul>
17291
17292 !! end
17293
17294 !! test
17295 Bug 5678: Double-parsed template argument
17296 !! wikitext
17297 {{lc:{{{1}}}|hello}}
17298 !! html
17299 <p>{{{1}}}
17300 </p>
17301 !! end
17302
17303 !! test
17304 Bug 5678: Double-parsed template invocation
17305 !! wikitext
17306 {{lc:{{paramtest {{!}} param = hello }} }}
17307 !! html
17308 <p>{{paramtest | param = hello }}
17309 </p>
17310 !! end
17311
17312 !! test
17313 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17314 !! options
17315 language=cs
17316 title=[[Main Page]]
17317 !! wikitext
17318 {{PRVNÍVELKÉ:ěščř}}
17319 {{prvnívelké:ěščř}}
17320 {{PRVNÍMALÉ:ěščř}}
17321 {{prvnímalé:ěščř}}
17322 {{MALÁ:ěščř}}
17323 {{malá:ěščř}}
17324 {{VELKÁ:ěščř}}
17325 {{velká:ěščř}}
17326 !! html
17327 <p>Ěščř
17328 Ěščř
17329 ěščř
17330 ěščř
17331 ěščř
17332 ěščř
17333 ĚŠČŘ
17334 ĚŠČŘ
17335 </p>
17336 !! end
17337
17338 !! test
17339 Morwen/13: Unclosed link followed by heading
17340 !! wikitext
17341 [[link
17342 ==heading==
17343 !! html
17344 <p>[[link
17345 </p>
17346 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17347
17348 !! end
17349
17350 !! test
17351 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17352 !! wikitext
17353 {{foo|
17354 =heading=
17355 !! html
17356 <p>{{foo|
17357 </p>
17358 <h1><span class="mw-headline" id="heading">heading</span></h1>
17359
17360 !! end
17361
17362 !! test
17363 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17364 !! wikitext
17365 {{foo|
17366 ==heading==
17367 !! html
17368 <p>{{foo|
17369 </p>
17370 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17371
17372 !! end
17373
17374 !! test
17375 Tildes in comments
17376 !! options
17377 pst
17378 !! wikitext
17379 <!-- ~~~~ -->
17380 !! html
17381 <!-- ~~~~ -->
17382 !! end
17383
17384 !! test
17385 Paragraphs inside divs (no extra line breaks)
17386 !! wikitext
17387 <div>Line one
17388
17389 Line two</div>
17390 !! html
17391 <div>Line one
17392 Line two</div>
17393
17394 !! end
17395
17396 !! test
17397 Paragraphs inside divs (extra line break on open)
17398 !! wikitext
17399 <div>
17400 Line one
17401
17402 Line two</div>
17403 !! html
17404 <div>
17405 <p>Line one
17406 </p>
17407 Line two</div>
17408
17409 !! end
17410
17411 !! test
17412 Paragraphs inside divs (extra line break on close)
17413 !! wikitext
17414 <div>Line one
17415
17416 Line two
17417 </div>
17418 !! html
17419 <div>Line one
17420 <p>Line two
17421 </p>
17422 </div>
17423
17424 !! end
17425
17426 !! test
17427 Paragraphs inside divs (extra line break on open and close)
17428 !! wikitext
17429 <div>
17430 Line one
17431
17432 Line two
17433 </div>
17434 !! html
17435 <div>
17436 <p>Line one
17437 </p><p>Line two
17438 </p>
17439 </div>
17440
17441 !! end
17442
17443 !! test
17444 Nesting tags, paragraphs on lines which begin with <div>
17445 !! options
17446 disabled
17447 !! wikitext
17448 <div></div><strong>A
17449 B</strong>
17450 !! html
17451 <div></div>
17452 <p><strong>A
17453 B</strong>
17454 </p>
17455 !! end
17456
17457 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17458 !! test
17459 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17460 !! wikitext
17461 <blockquote>Line one
17462
17463 Line two</blockquote>
17464 !! html
17465 <blockquote>Line one
17466 Line two</blockquote>
17467
17468 !! html+tidy
17469 <blockquote>
17470 <p>Line one Line two</p>
17471 </blockquote>
17472 !! end
17473
17474 !! test
17475 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17476 !! wikitext
17477 <blockquote>
17478 Line one
17479
17480 Line two</blockquote>
17481 !! html
17482 <blockquote>
17483 <p>Line one
17484 </p>
17485 Line two</blockquote>
17486
17487 !! html+tidy
17488 <blockquote>
17489 <p>Line one</p>
17490 Line two</blockquote>
17491 !! end
17492
17493 !! test
17494 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17495 !! wikitext
17496 <blockquote>Line one
17497
17498 Line two
17499 </blockquote>
17500 !! html
17501 <blockquote>Line one
17502 <p>Line two
17503 </p>
17504 </blockquote>
17505
17506 !! html+tidy
17507 <blockquote>
17508 <p>Line one</p>
17509 <p>Line two</p>
17510 </blockquote>
17511 !! end
17512
17513 !! test
17514 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17515 !! wikitext
17516 <blockquote>
17517 Line one
17518
17519 Line two
17520 </blockquote>
17521 !! html
17522 <blockquote>
17523 <p>Line one
17524 </p><p>Line two
17525 </p>
17526 </blockquote>
17527
17528 !! html+tidy
17529 <blockquote>
17530 <p>Line one</p>
17531 <p>Line two</p>
17532 </blockquote>
17533 !! end
17534
17535 !! test
17536 Paragraphs inside blockquotes/divs (no extra line breaks)
17537 !! wikitext
17538 <blockquote><div>Line one
17539
17540 Line two</div></blockquote>
17541 !! html
17542 <blockquote><div>Line one
17543 Line two</div></blockquote>
17544
17545 !! end
17546
17547 !! test
17548 Paragraphs inside blockquotes/divs (extra line break on open)
17549 !! wikitext
17550 <blockquote><div>
17551 Line one
17552
17553 Line two</div></blockquote>
17554 !! html
17555 <blockquote><div>
17556 <p>Line one
17557 </p>
17558 Line two</div></blockquote>
17559
17560 !! end
17561
17562 !! test
17563 Paragraphs inside blockquotes/divs (extra line break on close)
17564 !! wikitext
17565 <blockquote><div>Line one
17566
17567 Line two
17568 </div></blockquote>
17569 !! html
17570 <blockquote><div>Line one
17571 <p>Line two
17572 </p>
17573 </div></blockquote>
17574
17575 !! end
17576
17577 !! test
17578 Paragraphs inside blockquotes/divs (extra line break on open and close)
17579 !! wikitext
17580 <blockquote><div>
17581 Line one
17582
17583 Line two
17584 </div></blockquote>
17585 !! html
17586 <blockquote><div>
17587 <p>Line one
17588 </p><p>Line two
17589 </p>
17590 </div></blockquote>
17591
17592 !! end
17593
17594 !! test
17595 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17596 !! options
17597 wgLinkHolderBatchSize=0
17598 !! wikitext
17599 [[meatball:1]]
17600 [[meatball:2]]
17601 [[meatball:3]]
17602 !! html
17603 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17604 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17605 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17606 </p>
17607 !! end
17608
17609 !! test
17610 Free external link invading image caption
17611 !! wikitext
17612 [[Image:Foobar.jpg|thumb|http://x|hello]]
17613 !! html
17614 <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>
17615
17616 !! end
17617
17618 !! test
17619 Bug 15196: localised external link numbers
17620 !! options
17621 language=fa
17622 !! wikitext
17623 [http://en.wikipedia.org/]
17624 !! html/php
17625 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17626 </p>
17627 !! html/parsoid
17628 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17629 !! end
17630
17631 !! test
17632 Multibyte character in padleft
17633 !! wikitext
17634 {{padleft:-Hello|7|Æ}}
17635 !! html
17636 <p>Æ-Hello
17637 </p>
17638 !! end
17639
17640 !! test
17641 Multibyte character in padright
17642 !! wikitext
17643 {{padright:Hello-|7|Æ}}
17644 !! html
17645 <p>Hello-Æ
17646 </p>
17647 !! end
17648
17649 !!test
17650 formatdate parser function
17651 !! wikitext
17652 {{#formatdate:2009-03-24}}
17653 !! html
17654 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17655 </p>
17656 !! end
17657
17658 !!test
17659 formatdate parser function, with default format
17660 !! wikitext
17661 {{#formatdate:2009-03-24|mdy}}
17662 !! html
17663 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17664 </p>
17665 !! end
17666
17667 !! test
17668 Spacing of numbers in formatted dates
17669 !! wikitext
17670 {{#formatdate:January 15}}
17671 !! html
17672 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17673 </p>
17674 !! end
17675
17676 !! test
17677 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
17678 !! options
17679 language=nl title=[[MediaWiki:Common.css]]
17680 !! wikitext
17681 {{#formatdate:2009-03-24|dmy}}
17682 !! html
17683 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17684 </p>
17685 !! end
17686
17687 #
17688 #
17689 #
17690
17691 #
17692 # Edit comments
17693 #
17694
17695 !! test
17696 Edit comment with link
17697 !! options
17698 comment
17699 !! wikitext
17700 I like the [[Main Page]] a lot
17701 !! html
17702 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17703 !!end
17704
17705 !! test
17706 Edit comment with link and link text
17707 !! options
17708 comment
17709 !! wikitext
17710 I like the [[Main Page|best pages]] a lot
17711 !! html
17712 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17713 !!end
17714
17715 !! test
17716 Edit comment with link and link text with suffix
17717 !! options
17718 comment
17719 !! wikitext
17720 I like the [[Main Page|best page]]s a lot
17721 !! html
17722 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17723 !!end
17724
17725 !! test
17726 Edit comment with section link (non-local, eg in history list)
17727 !! options
17728 comment title=[[Main Page]]
17729 !! wikitext
17730 /* External links */ removed bogus entries
17731 !! html
17732 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17733 !!end
17734
17735 !! test
17736 Edit comment with section link and text before it (non-local, eg in history list)
17737 !! options
17738 comment title=[[Main Page]]
17739 !! wikitext
17740 pre-comment text /* External links */ removed bogus entries
17741 !! html
17742 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>
17743 !!end
17744
17745 !! test
17746 Edit comment with section link (local, eg in diff view)
17747 !! options
17748 comment local title=[[Main Page]]
17749 !! wikitext
17750 /* External links */ removed bogus entries
17751 !! html
17752 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17753 !!end
17754
17755 !! test
17756 Edit comment with subpage link (bug 14080)
17757 !! options
17758 comment
17759 subpage
17760 title=[[Subpage test]]
17761 !! wikitext
17762 Poked at a [[/subpage]] here...
17763 !! html
17764 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17765 !!end
17766
17767 !! test
17768 Edit comment with subpage link and link text (bug 14080)
17769 !! options
17770 comment
17771 subpage
17772 title=[[Subpage test]]
17773 !! wikitext
17774 Poked at a [[/subpage|neat little page]] here...
17775 !! html
17776 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17777 !!end
17778
17779 !! test
17780 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17781 !! options
17782 comment
17783 title=[[Subpage test]]
17784 !! wikitext
17785 Poked at a [[/subpage]] here...
17786 !! html
17787 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...
17788 !!end
17789
17790 !! test
17791 Edit comment with bare anchor link (local, as on diff)
17792 !! options
17793 comment
17794 local
17795 title=[[Main Page]]
17796 !! wikitext
17797 [[#section]]
17798 !! html
17799 <a href="#section">#section</a>
17800 !! end
17801
17802 !! test
17803 Edit comment with bare anchor link (non-local, as on history)
17804 !! options
17805 comment
17806 title=[[Main Page]]
17807 !! wikitext
17808 [[#section]]
17809 !! html
17810 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17811 !! end
17812
17813 !! test
17814 Anchor starting with underscore
17815 !! wikitext
17816 [[#_ref|One]]
17817 !! html
17818 <p><a href="#_ref">One</a>
17819 </p>
17820 !! end
17821
17822 !! test
17823 Id starting with underscore
17824 !! wikitext
17825 <div id="_ref"></div>
17826 !! html
17827 <div id="_ref"></div>
17828
17829 !! end
17830
17831 !! test
17832 Space normalisation on autocomment (bug 22784)
17833 !! options
17834 comment
17835 title=[[Main Page]]
17836 !! wikitext
17837 /* __hello__world__ */
17838 !! html
17839 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17840 !! end
17841
17842 !! test
17843 percent-encoding and + signs in comments (Bug 26410)
17844 !! options
17845 comment
17846 !! wikitext
17847 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17848 !! html
17849 <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>
17850 !! end
17851
17852 !! test
17853 Bad images - basic functionality
17854 !! options
17855 disabled
17856 !! wikitext
17857 [[File:Bad.jpg]]
17858 !! html
17859 !! end
17860
17861 !! test
17862 Bad images - bug 16039: text after bad image disappears
17863 !! options
17864 disabled
17865 !! wikitext
17866 Foo bar
17867 [[File:Bad.jpg]]
17868 Bar foo
17869 !! html
17870 <p>Foo bar
17871 </p><p>Bar foo
17872 </p>
17873 !! end
17874
17875 !! test
17876 Verify that displaytitle works (bug #22501) no displaytitle
17877 !! options
17878 showtitle
17879 !! config
17880 wgAllowDisplayTitle=true
17881 wgRestrictDisplayTitle=false
17882 !! wikitext
17883 this is not the the title
17884 !! html
17885 Parser test
17886 <p>this is not the the title
17887 </p>
17888 !! end
17889
17890 !! test
17891 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17892 !! options
17893 showtitle
17894 title=[[Screen]]
17895 !! config
17896 wgAllowDisplayTitle=true
17897 wgRestrictDisplayTitle=false
17898 !! wikitext
17899 this is not the the title
17900 {{DISPLAYTITLE:whatever}}
17901 !! html
17902 whatever
17903 <p>this is not the the title
17904 </p>
17905 !! end
17906
17907 !! test
17908 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17909 !! options
17910 showtitle
17911 title=[[Screen]]
17912 !! config
17913 wgAllowDisplayTitle=true
17914 wgRestrictDisplayTitle=true
17915 !! wikitext
17916 this is not the the title
17917 {{DISPLAYTITLE:whatever}}
17918 !! html
17919 Screen
17920 <p>this is not the the title
17921 </p>
17922 !! end
17923
17924 !! test
17925 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17926 !! options
17927 showtitle
17928 title=[[Screen]]
17929 !! config
17930 wgAllowDisplayTitle=true
17931 wgRestrictDisplayTitle=true
17932 !! wikitext
17933 this is not the the title
17934 {{DISPLAYTITLE:screen}}
17935 !! html
17936 screen
17937 <p>this is not the the title
17938 </p>
17939 !! end
17940
17941 !! test
17942 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17943 !! options
17944 showtitle
17945 title=[[Screen]]
17946 !! config
17947 wgAllowDisplayTitle=false
17948 !! wikitext
17949 this is not the the title
17950 {{DISPLAYTITLE:screen}}
17951 !! html
17952 Screen
17953 <p>this is not the the title
17954 <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>
17955 </p>
17956 !! end
17957
17958 !! test
17959 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17960 !! options
17961 showtitle
17962 title=[[Screen]]
17963 !! config
17964 wgAllowDisplayTitle=false
17965 !! wikitext
17966 this is not the the title
17967 !! html
17968 Screen
17969 <p>this is not the the title
17970 </p>
17971 !! end
17972
17973 !! test
17974 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17975 !! options
17976 showtitle
17977 title=[[Screen]]
17978 !! config
17979 wgAllowDisplayTitle=true
17980 wgRestrictDisplayTitle=true
17981 !! wikitext
17982 this is not the the title
17983 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17984 !! html
17985 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17986 <p>this is not the the title
17987 </p>
17988 !! end
17989
17990 !! test
17991 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17992 !! options
17993 showtitle
17994 title=[[Screen]]
17995 !! config
17996 wgAllowDisplayTitle=true
17997 wgRestrictDisplayTitle=true
17998 !! wikitext
17999 this is not the the title
18000 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18001 !! html
18002 <span style="color: red;">s</span>creen
18003 <p>this is not the the title
18004 </p>
18005 !! end
18006
18007 !! test
18008 preload: check <noinclude> and <includeonly>
18009 !! options
18010 preload
18011 !! wikitext
18012 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18013 !! html
18014 Hello kind world.
18015 !! end
18016
18017 !! test
18018 preload: check <onlyinclude>
18019 !! options
18020 preload
18021 !! wikitext
18022 Goodbye <onlyinclude>Hello world</onlyinclude>
18023 !! html
18024 Hello world
18025 !! end
18026
18027 !! test
18028 preload: can pass tags through if we want to
18029 !! options
18030 preload
18031 !! wikitext
18032 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18033 !! html
18034 <includeonly>Hello world</includeonly>
18035 !! end
18036
18037 !! test
18038 preload: check that it doesn't try to do tricks
18039 !! options
18040 preload
18041 !! wikitext
18042 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18043 !! html
18044 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18045 !! end
18046
18047 !! test
18048 Play a bit with r67090 and bug 3158
18049 !! options
18050 disabled
18051 !! wikitext
18052 <div style="width:50% !important">&nbsp;</div>
18053 <div style="width:50%&nbsp;!important">&nbsp;</div>
18054 <div style="width:50%&#160;!important">&nbsp;</div>
18055 <div style="border : solid;">&nbsp;</div>
18056 !! html
18057 <div style="width:50% !important">&nbsp;</div>
18058 <div style="width:50% !important">&nbsp;</div>
18059 <div style="width:50% !important">&nbsp;</div>
18060 <div style="border&#160;: solid;">&nbsp;</div>
18061
18062 !! end
18063
18064 !! test
18065 HTML5 data attributes
18066 !! wikitext
18067 <span data-foo="bar">Baz</span>
18068 <p data-abc-def_hij="">Quuz</p>
18069 !! html
18070 <p><span data-foo="bar">Baz</span>
18071 </p>
18072 <p data-abc-def_hij="">Quuz</p>
18073
18074 !! end
18075
18076 !! test
18077 percent-encoding and + signs in internal links (Bug 26410)
18078 !! wikitext
18079 [[User:+%]] [[Page+title%]]
18080 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18081 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18082 [[%33%45]] [[%33%45+]]
18083 !! html
18084 <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>
18085 <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>
18086 <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>
18087 <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>
18088 </p>
18089 !! end
18090
18091 !! test
18092 Special characters in embedded file links (bug 27679)
18093 !! wikitext
18094 [[File:Contains & ampersand.jpg]]
18095 [[File:Does not exist.jpg|Title with & ampersand]]
18096 !! html
18097 <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>
18098 <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>
18099 </p>
18100 !! end
18101
18102
18103 !! test
18104 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18105 !! wikitext
18106 Text&apos;s been normalized?
18107 !! html
18108 <p>Text&#39;s been normalized?
18109 </p>
18110 !! end
18111
18112 !! test
18113 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18114 !! wikitext
18115 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18116 !! html
18117 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18118 </p>
18119 !! end
18120
18121 !! test
18122 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18123 !! wikitext
18124 [http://www.example.org/ ideograms]
18125 !! html
18126 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18127 </p>
18128 !! end
18129
18130 !! test
18131 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18132 !! wikitext
18133 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18134 !! html
18135 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18136 </p>
18137 !! end
18138
18139 !! article
18140 Mediawiki:loop1
18141 !! text
18142 {{Identical|A}}
18143 !! endarticle
18144
18145 !! article
18146 Mediawiki:loop2
18147 !! text
18148 {{Identical|B}}
18149 !! endarticle
18150
18151 !! article
18152 Template:Identical
18153 !! text
18154 {{int:loop1}}
18155 {{int:loop2}}
18156 !! endarticle
18157
18158 !! test
18159 Bug 31098 Template which includes system messages which includes the template
18160 !! wikitext
18161 {{Identical}}
18162 !! html
18163 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18164 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18165 </p>
18166 !! end
18167
18168 !! test
18169 Bug31490 Turkish: ucfirst 'blah'
18170 !! options
18171 language=tr
18172 !! wikitext
18173 {{ucfirst:blah}}
18174 !! html
18175 <p>Blah
18176 </p>
18177 !! end
18178
18179 !! test
18180 Bug31490 Turkish: ucfirst 'ix'
18181 !! options
18182 language=tr
18183 !! wikitext
18184 {{ucfirst:ix}}
18185 !! html
18186 <p>İx
18187 </p>
18188 !! end
18189
18190 !! test
18191 Bug31490 Turkish: lcfirst 'BLAH'
18192 !! options
18193 language=tr
18194 !! wikitext
18195 {{lcfirst:BLAH}}
18196 !! html
18197 <p>bLAH
18198 </p>
18199 !! end
18200
18201 !! test
18202 Bug31490 Turkish: ucfırst (with a dotless i)
18203 !! options
18204 language=tr
18205 !! wikitext
18206 {{ucfırst:blah}}
18207 !! html
18208 <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>
18209 </p>
18210 !! end
18211
18212 !! test
18213 Bug31490 ucfırst (with a dotless i) with English language
18214 !! options
18215 language=en
18216 !! wikitext
18217 {{ucfırst:blah}}
18218 !! html
18219 <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>
18220 </p>
18221 !! end
18222
18223 !! test
18224 Bug 26375: TOC with italics
18225 !! options
18226 title=[[Main Page]]
18227 !! wikitext
18228 __TOC__
18229 == ''Lost'' episodes ==
18230 !! html
18231 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18232 <ul>
18233 <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>
18234 </ul>
18235 </div>
18236
18237 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18238
18239 !! end
18240
18241 !! test
18242 Bug 26375: TOC with bold
18243 !! options
18244 title=[[Main Page]]
18245 !! wikitext
18246 __TOC__
18247 == '''should be bold''' then normal text ==
18248 !! html
18249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18250 <ul>
18251 <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>
18252 </ul>
18253 </div>
18254
18255 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18256
18257 !! end
18258
18259 !! test
18260 Bug 33845: Headings become cursive in TOC when they contain an image
18261 !! options
18262 title=[[Main Page]]
18263 !! wikitext
18264 __TOC__
18265 == Image [[Image:foobar.jpg]] ==
18266 !! html
18267 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18268 <ul>
18269 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18270 </ul>
18271 </div>
18272
18273 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18274
18275 !! end
18276
18277 !! test
18278 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18279 !! options
18280 title=[[Main Page]]
18281 !! wikitext
18282 __TOC__
18283 == <blockquote>Quote</blockquote> ==
18284 !! html
18285 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18286 <ul>
18287 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18288 </ul>
18289 </div>
18290
18291 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18292
18293 !! html+tidy
18294 <div id="toc" class="toc">
18295 <div id="toctitle">
18296 <h2>Contents</h2>
18297 </div>
18298 <ul>
18299 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18300 </ul>
18301 </div>
18302 <h2><span class="mw-headline" id="Quote"></span></h2>
18303 <blockquote>
18304 <p><span class="mw-headline" id="Quote">Quote</span></p>
18305 </blockquote>
18306 <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>
18307 !! end
18308
18309 !! test
18310 Unclosed tags in TOC
18311 !! options
18312 title=[[Main Page]]
18313 !! wikitext
18314 __TOC__
18315 == Proof: 2 < 3 ==
18316 <small>Hanc marginis exiguitas non caperet.</small>
18317 QED
18318 !! html
18319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18320 <ul>
18321 <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>
18322 </ul>
18323 </div>
18324
18325 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18326 <p><small>Hanc marginis exiguitas non caperet.</small>
18327 QED
18328 </p>
18329 !! end
18330
18331 !! test
18332 Multiple tags in TOC
18333 !! wikitext
18334 __TOC__
18335 == <i>Foo</i> <b>Bar</b> ==
18336
18337 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18338 !! html
18339 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18340 <ul>
18341 <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>
18342 <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>
18343 </ul>
18344 </div>
18345
18346 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18347 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18348
18349 !! html+tidy
18350 <div id="toc" class="toc">
18351 <div id="toctitle">
18352 <h2>Contents</h2>
18353 </div>
18354 <ul>
18355 <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>
18356 <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>
18357 </ul>
18358 </div>
18359 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18360 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18361 <blockquote>
18362 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18363 </blockquote>
18364 <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>
18365 !! end
18366
18367 !! test
18368 Tags with parameters in TOC
18369 !! wikitext
18370 __TOC__
18371 == <sup class="in-h2">Hello</sup> ==
18372
18373 == <sup class="a > b">Evilbye</sup> ==
18374 !! html
18375 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18376 <ul>
18377 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18378 <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>
18379 </ul>
18380 </div>
18381
18382 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18383 <h2><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>
18384
18385 !! end
18386
18387 !! test
18388 span tags with directionality in TOC
18389 !! wikitext
18390 __TOC__
18391 == <span dir="ltr">C++</span> ==
18392
18393 == <span dir="rtl">זבנג!</span> ==
18394
18395 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18396
18397 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18398
18399 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18400 !! html
18401 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18402 <ul>
18403 <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>
18404 <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>
18405 <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>
18406 <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>
18407 <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>
18408 </ul>
18409 </div>
18410
18411 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18412 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18413 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18414 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18415 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18416
18417 !! end
18418
18419 !! article
18420 MediaWiki:Bug32057
18421 !! text
18422 == {{int:headline_sample}} ==
18423 !! endarticle
18424
18425 !! test
18426 Bug 32057: Title needed when expanding <h> nodes.
18427 !! options
18428 title=[[Main Page]]
18429 !! wikitext
18430 {{int:Bug32057}}
18431 !! html
18432 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18433
18434 !! end
18435
18436 !! test
18437 Strip marker in urlencode
18438 !! wikitext
18439 {{urlencode:x<nowiki/>y}}
18440 {{urlencode:x<nowiki/>y|wiki}}
18441 {{urlencode:x<nowiki/>y|path}}
18442 !! html
18443 <p>xy
18444 xy
18445 xy
18446 </p>
18447 !! end
18448
18449 !! test
18450 Strip marker in lc
18451 !! wikitext
18452 {{lc:x<nowiki/>y}}
18453 !! html
18454 <p>xy
18455 </p>
18456 !! end
18457
18458 !! test
18459 Strip marker in uc
18460 !! wikitext
18461 {{uc:x<nowiki/>y}}
18462 !! html
18463 <p>XY
18464 </p>
18465 !! end
18466
18467 !! test
18468 Strip marker in formatNum
18469 !! wikitext
18470 {{formatnum:1<nowiki/>2}}
18471 {{formatnum:1<nowiki/>2|R}}
18472 !! html
18473 <p>12
18474 12
18475 </p>
18476 !! end
18477
18478 !! test
18479 Check noCommafy in formatNum
18480 !! options
18481 language=be-tarask
18482 !! wikitext
18483 {{formatnum:123456.78}}
18484 {{formatnum:123456.78|NOSEP}}
18485 !! html
18486 <p>123 456,78
18487 123456.78
18488 </p>
18489 !! end
18490
18491 !! test
18492 Wrong option for formatNum (bug 56199)
18493 !! wikitext
18494 {{formatnum:1,234.56|Random}}
18495 {{formatnum:1,234.56|EVERYTHING}}
18496 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18497 !! html
18498 <p>1,234.56
18499 1,234.56
18500 1,234.56
18501 </p>
18502 !! end
18503
18504 !! test
18505 Strip marker in grammar
18506 !! options
18507 language=fi
18508 !! wikitext
18509 {{grammar:elative|foo<nowiki/>bar}}
18510 !! html
18511 <p>foobarista
18512 </p>
18513 !! end
18514
18515 !! test
18516 Strip marker in padleft
18517 !! wikitext
18518 {{padleft:|2|x<nowiki/>y}}
18519 !! html
18520 <p>xy
18521 </p>
18522 !! end
18523
18524 !! test
18525 Strip marker in padright
18526 !! wikitext
18527 {{padright:|2|x<nowiki/>y}}
18528 !! html
18529 <p>xy
18530 </p>
18531 !! end
18532
18533 !! test
18534 Strip marker in anchorencode
18535 !! wikitext
18536 {{anchorencode:x<nowiki/>y}}
18537 !! html
18538 <p>xy
18539 </p>
18540 !! end
18541
18542 !! test
18543 nowiki inside link inside heading (bug 18295)
18544 !! wikitext
18545 ==[[foo|x<nowiki>y</nowiki>z]]==
18546 !! html
18547 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18548
18549 !! end
18550
18551 !! test
18552 new support for bdi element (bug 31817)
18553 !! wikitext
18554 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18555 !! html
18556 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18557
18558 !!end
18559
18560 !! test
18561 Ignore pipe between table row attributes
18562 !! wikitext
18563 {|
18564 | quux
18565 |- id=foo | style='color: red'
18566 | bar
18567 |}
18568 !! html
18569 <table>
18570 <tr>
18571 <td> quux
18572 </td></tr>
18573 <tr id="foo" style="color: red">
18574 <td> bar
18575 </td></tr></table>
18576
18577 !! end
18578
18579 !!test
18580 Gallery override link with WikiLink (bug 34852)
18581 !! wikitext
18582 <gallery>
18583 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18584 </gallery>
18585 !! html
18586 <ul class="gallery mw-gallery-traditional">
18587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18588 <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>
18589 <div class="gallerytext">
18590 <p>caption
18591 </p>
18592 </div>
18593 </div></li>
18594 </ul>
18595
18596 !! end
18597
18598 !!test
18599 Gallery override link with absolute external link (bug 34852)
18600 !! wikitext
18601 <gallery>
18602 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18603 </gallery>
18604 !! html
18605 <ul class="gallery mw-gallery-traditional">
18606 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18607 <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>
18608 <div class="gallerytext">
18609 <p>caption
18610 </p>
18611 </div>
18612 </div></li>
18613 </ul>
18614
18615 !! end
18616
18617 !!test
18618 Gallery override link with malicious javascript (bug 34852)
18619 !! wikitext
18620 <gallery>
18621 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18622 </gallery>
18623 !! html
18624 <ul class="gallery mw-gallery-traditional">
18625 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18626 <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>
18627 <div class="gallerytext">
18628 <p>caption
18629 </p>
18630 </div>
18631 </div></li>
18632 </ul>
18633
18634 !! end
18635
18636 !!test
18637 Gallery with invalid title as link (bug 43964)
18638 !! wikitext
18639 <gallery>
18640 File:foobar.jpg|link=<
18641 </gallery>
18642 !! html
18643 <ul class="gallery mw-gallery-traditional">
18644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18645 <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>
18646 <div class="gallerytext">
18647 </div>
18648 </div></li>
18649 </ul>
18650
18651 !! end
18652
18653 !!test
18654 Language parser function
18655 !! wikitext
18656 {{#language:ar}}
18657 !! html
18658 <p>العربية
18659 </p>
18660 !! end
18661
18662 !!test
18663 Padleft and padright as substr
18664 !! wikitext
18665 {{padleft:|3|abcde}}
18666 {{padright:|3|abcde}}
18667 !! html
18668 <p>abc
18669 abc
18670 </p>
18671 !! end
18672
18673 !!test
18674 Special parser function
18675 !! wikitext
18676 {{#special:RandomPage}}
18677 {{#special:BaDtItLe}}
18678 {{#special:Foobar}}
18679 !! html
18680 <p>Special:Random
18681 Special:Badtitle
18682 Special:Foobar
18683 </p>
18684 !! end
18685
18686 !!test
18687 Bug 34939 - Case insensitive link parsing ([HttP://])
18688 !! wikitext
18689 [HttP://MediaWiki.Org/]
18690 !! html/php
18691 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18692 </p>
18693 !! html/parsoid
18694 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18695 !! end
18696
18697 !!test
18698 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18699 !! wikitext
18700 [HttP://MediaWiki.Org/ MediaWiki]
18701 !! html
18702 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18703 </p>
18704 !! end
18705
18706 !!test
18707 Bug 34939 - Case insensitive link parsing (HttP://)
18708 !! wikitext
18709 HttP://MediaWiki.Org/
18710 !! html/php
18711 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18712 </p>
18713 !! html/parsoid
18714 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18715 !! end
18716
18717 !!test
18718 Disable TOC
18719 !! options
18720 notoc
18721 !! wikitext
18722 Lead
18723 == Section 1 ==
18724 == Section 2 ==
18725 == Section 3 ==
18726 == Section 4 ==
18727 == Section 5 ==
18728 !! html
18729 <p>Lead
18730 </p>
18731
18732 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18733 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18734 <h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18735 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18736 <h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18737
18738 !! end
18739
18740
18741 ###
18742 ### Parsoid-specific tests
18743 ### Parsoid-PHP parser incompatibilities
18744 ###
18745 !!test
18746 1. SOL-sensitive wikitext tokens as template-args
18747 !!options
18748 parsoid=wt2html,wt2wt
18749 !! wikitext
18750 {{echo|*a}}
18751 {{echo|#a}}
18752 {{echo|:a}}
18753 !! html
18754 <span about="#mwt1" typeof="mw:Transclusion">
18755 </span><ul about="#mwt1"><li>a</li>
18756 </ul>
18757 <span about="#mwt2" typeof="mw:Transclusion">
18758 </span><ol about="#mwt2"><li>a</li>
18759 </ol>
18760 <span about="#mwt3" typeof="mw:Transclusion">
18761 </span><dl about="#mwt3"><dd>a</dd>
18762 </dl>
18763 !!end
18764
18765 #### -----------------------------------------------------------------
18766 #### Parsoid-specific functionality tests
18767 #### -----------------------------------------------------------------
18768
18769 # Bug 63642: Formatting elt fixup is cleaned up.
18770 # We know wt2wt will fail, but we expect selser to pass.
18771 # Due to the nature of our testing, wt2wt and selser tests will enter the
18772 # blacklist and we'll catch selser regressions based on changes to the
18773 # blacklist entries for selser tests.
18774 !! test
18775 Bad treebuilder fixup of formatting elt is cleaned up
18776 !! options
18777 parsoid=wt2html,wt2wt
18778 !! wikitext
18779 {|
18780 |
18781 <small>
18782 [[Image:Foobar.jpg|right|Test]]
18783 </small>
18784 |}
18785 !! html/parsoid
18786 <table>
18787 <tbody><tr><td>
18788 <p><small></small></p>
18789 <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><small>Test</small></figcaption></figure>
18790 <p></p></td></tr>
18791 </tbody></table>
18792 !! end
18793
18794 #### ----------------------------------------------------------------
18795 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18796 #### tags. Parsoid's output for these tags differs from that of the
18797 #### PHP parser.
18798 #### ----------------------------------------------------------------
18799
18800 !!test
18801 Ref: 1. ref-location should be replaced with an index span
18802 !!options
18803 parsoid
18804 !! wikitext
18805 A <ref>foo</ref>
18806 B <ref name="x">foo</ref>
18807 C <ref name="y" />
18808 !! html
18809 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
18810 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
18811 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
18812 !!end
18813
18814 !!test
18815 Ref: 2. ref-tags with identical names should all get the same index
18816 !!options
18817 parsoid
18818 !! wikitext
18819 A <ref name="x">foo</ref>
18820 B <ref name="x" />
18821 !! html
18822 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18823 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
18824 !!end
18825
18826 !!test
18827 Ref: 3. spaces in ref-names should be ignored
18828 !!options
18829 parsoid
18830 !! wikitext
18831 A <ref name="x">foo</ref>
18832 B <ref name=" x " />
18833 C <ref name= x />
18834 !! html
18835 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18836 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18837 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
18838 !!end
18839
18840 !!test
18841 Ref: 4. 'constructor' should be accepted as a valid ref-name
18842 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18843 !!options
18844 parsoid
18845 !! wikitext
18846 A <ref name="constructor">foo</ref>
18847 !! html
18848 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
18849 !!end
18850
18851 !!test
18852 Ref: 5. body should accept generic wikitext
18853 !!options
18854 parsoid
18855 !! wikitext
18856 A <ref>
18857 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18858 </ref>
18859
18860 <references />
18861 !! html
18862 <p>A <span about="#mwt2" class="reference" 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-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18863
18864 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18865 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</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>
18866 </li>
18867 </ol>
18868 !!end
18869
18870 !!test
18871 Ref: 6. indent-pres should not be output in ref-body
18872 !!options
18873 parsoid
18874 !! wikitext
18875 A <ref>
18876 foo
18877 bar
18878 baz
18879 </ref>
18880
18881 <references />
18882 !! html
18883 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18884
18885 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18886 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18887 bar
18888 baz
18889 </li>
18890 </ol>
18891 !!end
18892
18893 !!test
18894 Ref: 7. No p-wrapping in ref-body
18895 !!options
18896 parsoid
18897 !! wikitext
18898 A <ref>
18899 foo
18900
18901 bar
18902
18903
18904 baz
18905
18906
18907
18908 booz
18909 </ref>
18910
18911 <references />
18912 !! html
18913 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18914
18915 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18916 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18917
18918 bar
18919
18920
18921 baz
18922
18923
18924
18925 booz
18926 </li>
18927 </ol>
18928 !!end
18929
18930 !!test
18931 Ref: 8. transclusion wikitext has lower precedence
18932 !!options
18933 parsoid
18934 !! wikitext
18935 A <ref> foo {{echo|</ref> B C}}
18936
18937 <references />
18938 !! html
18939 <p>A <span class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo <span typeof=\&quot;mw:Nowiki\&quot; data-parsoid='{\&quot;src\&quot;:\&quot;{{\&quot;,\&quot;dsr\&quot;:[12,14,0,0]}'>{{</span>echo|&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
18940 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18941 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
18942 </ol>
18943 !!end
18944
18945 !!test
18946 Ref: 9. unclosed comments should not leak out of ref-body
18947 !!options
18948 parsoid
18949 !! wikitext
18950 A <ref> foo <!--</ref> B C
18951 <references />
18952 !! html
18953 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
18954 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18955 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18956 </ol>
18957 !!end
18958
18959 !!test
18960 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18961 !!options
18962 parsoid
18963 !! wikitext
18964 A <ref> <b> foo </ref> B C
18965
18966 <references />
18967 !! html
18968 <p>A <span about="#mwt2" class="reference" 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":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref> &lt;b> foo &lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B C</p>
18969
18970
18971 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18972 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
18973 </ol>
18974 !!end
18975
18976 !!test
18977 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18978 !!options
18979 parsoid
18980 !! wikitext
18981 A <ref>foo</ref> B
18982 C <ref>bar</ref> D
18983 !! html
18984 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B
18985 C <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>bar&lt;/ref>"}'><a href="#cite_note-2">[2]</a></span> D</p>
18986 !!end
18987
18988 !!test
18989 Ref: 12. ref-tags act as trailing newline migration barrier
18990 !!options
18991 parsoid
18992 !! wikitext
18993 <!--the newline at the end of this line moves out of the p-tag-->a
18994
18995 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18996 <ref />
18997
18998 c
18999 !! html
19000 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19001
19002
19003 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
19004 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
19005
19006
19007 <p>c</p>
19008 !!end
19009
19010 !!test
19011 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19012 !!options
19013 parsoid
19014 !! wikitext
19015 <ref>foo</ref> A
19016 <ref>bar
19017 </ref> B
19018 !! html
19019 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
19020 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
19021 !!end
19022
19023 !!test
19024 Ref: 14. A nested ref-tag should be emitted as plain text
19025 !!options
19026 parsoid
19027 !! wikitext
19028 <ref>foo <ref>bar</ref> baz</ref>
19029
19030 <references />
19031 !! html
19032 <p><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo &lt;ref>bar&lt;/ref> baz&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span></p>
19033
19034 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
19035 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19036 </ol>
19037 !!end
19038
19039 !!test
19040 Ref: 15. ref-tags with identical names should get identical indexes
19041 !!options
19042 parsoid
19043 !! wikitext
19044 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19045 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19046
19047 <references />
19048 !! html
19049 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
19050 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
19051
19052 <ol about="#mwt10" class="references" typeof="mw:Extension/references" 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>
19053 </ol>
19054 !!end
19055
19056 ## We don't bother wt2wt-ing non-standard whitespace
19057 !!test
19058 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19059 !!options
19060 parsoid=wt2html
19061 !! wikitext
19062 A <ref >foo</ref >
19063
19064 <references />
19065 !! html
19066 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19067
19068 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19069 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19070 !!end
19071
19072 !!test
19073 References: 1. references tag without any refs should be handled properly
19074 !!options
19075 parsoid
19076 !! wikitext
19077 <references />
19078 !! html
19079 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19080 !!end
19081
19082 !!test
19083 References: 2. references tag with group only outputs references from that group
19084 !!options
19085 parsoid
19086 !! wikitext
19087 A <ref group="a">foo</ref>
19088 B <ref group="b">bar</ref>
19089
19090 <references group="a" />
19091 !! html
19092 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
19093 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[b 1]</a></span></p>
19094
19095 <ol about="#mwt6" class="references" typeof="mw:Extension/references" 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-0">↑</a></span> foo</li>
19096 </ol>
19097 !!end
19098
19099 !!test
19100 References: 3. ref list should be cleared after processing references
19101 !!options
19102 parsoid
19103 !! wikitext
19104 A <ref>foo</ref>
19105
19106 <references />
19107
19108 B <ref>bar</ref>
19109
19110 <references />
19111 !! html
19112 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19113
19114 <ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
19115 </ol>
19116
19117 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[1]</a></span></p>
19118
19119 <ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bar</li>
19120 </ol>
19121 !!end
19122
19123 !!test
19124 References: 4. only referenced group should be cleared after processing references
19125 !!options
19126 parsoid
19127 !! wikitext
19128 A <ref group="a">afoo</ref>
19129 B <ref>bfoo</ref>
19130
19131 <references group="a" />
19132
19133 C <ref>cfoo</ref>
19134
19135 <references />
19136 !! html
19137 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
19138 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>"}'><a href="#cite_note-2">[1]</a></span></p>
19139
19140 <ol about="#mwt6" class="references" typeof="mw:Extension/references" 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-0">↑</a></span> afoo</li>
19141 </ol>
19142
19143 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-3">[2]</a></span></p>
19144
19145 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3-0">↑</a></span> cfoo</li>
19146 </ol>
19147 !!end
19148
19149 !!test
19150 References: 5. ref tags in references should be processed while ignoring all other content
19151 !!options
19152 parsoid
19153 !! wikitext
19154 A <ref name="a" />
19155 B <ref name="b">bar</ref>
19156
19157 <references>
19158 <ref name="a">foo</ref>
19159 This should just get lost.
19160 </references>
19161 !! html
19162 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"a\" />"}'><a href="#cite_note-a-1">[1]</a></span>
19163 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\">bar&lt;/ref>"}'><a href="#cite_note-b-2">[2]</a></span></p>
19164
19165
19166 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references>\n&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.\n&lt;/references>"}' 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\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
19167 <li about="#cite_note-a-1" id="cite_note-a-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li>
19168 <li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
19169 </ol>
19170 !!end
19171
19172 !!test
19173 References: 6. <references /> from a transclusion
19174 !!options
19175 parsoid
19176 !! wikitext
19177 <ref>Foo</ref> {{echo|<references />}}
19178 !! html
19179 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> <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-0">↑</a></span> Foo</li></ol>
19180 !!end
19181
19182 !! test
19183 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19184 !! options
19185 parsoid
19186 !! wikitext
19187 A <ref>foo bar for a</ref>
19188 B <ref group="X" name="b" />
19189
19190 <references />
19191
19192 <references group="X">
19193 <ref name="b">foo</ref>
19194 </references>
19195 !! html
19196 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span>
19197 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref group=\"X\" name=\"b\" />"}'><a href="#cite_note-b-2" data-parsoid="{}">[X 1]</a></span></p>
19198
19199 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
19200
19201 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&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" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-2-0" data-parsoid="{}">↑</a></span> foo</li></ol>
19202 !! end
19203
19204 !! test
19205 Entities in ref name
19206 !! options
19207 parsoid
19208 !! wikitext
19209 <ref name="test &amp; me">hi</ref>
19210 !! html
19211 <p data-parsoid='{}'><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp; me"}}' id="cite_ref-test &amp; me-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"test &amp;amp; me\">hi&lt;/ref>"}'><a href="#cite_note-test &amp; me-1" data-parsoid="{}">[1]</a></span></p>
19212 !! end
19213
19214 # This test is wt2html only because we're permitting the serializer to produce
19215 # dirty diffs, normalizing the unclosed references to the self-closed version.
19216 !! test
19217 Generate references for unclosed references tag
19218 !! options
19219 parsoid=wt2html
19220 !! wikitext
19221 a<ref>foo</ref>
19222
19223 <references>
19224 !! html
19225 <p data-parsoid='{}'>a<span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span></p>
19226
19227
19228 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
19229 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo</li></ol>
19230 !! end
19231
19232 !! test
19233 New reference serializes on its own line
19234 !! options
19235 parsoid=wt2wt,html2wt
19236 !! wikitext
19237 foo
19238 <references />
19239 !! html
19240 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19241 !! end
19242
19243 #### ----------------------------------------------------------------
19244 #### The following section of tests are primarily to test
19245 #### wikitext escaping capabilities of Parsoid. Given that
19246 #### escaping can be done any number of ways, the wikitext (input)
19247 #### is always adjusted to reflect how Parsoid adds nowiki
19248 #### escape tags.
19249 ####
19250 #### We are marking several tests as parsoid-only since the
19251 #### HTML in the result section is different from what the
19252 #### PHP parser generates for it.
19253 #### ----------------------------------------------------------------
19254
19255
19256 #### --------------- Headings ---------------
19257 #### 0. Unnested
19258 #### 1. Nested inside html <h1>=foo=</h1>
19259 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19260 #### 3. Nested inside html with wikitext split by html tags
19261 #### 4. No escape needed
19262 #### 5. Empty headings <h1></h1>
19263 #### 6. Heading chars in SOL context
19264 #### ----------------------------------------
19265 !! test
19266 Headings: 0. Unnested
19267 !! options
19268 parsoid
19269 !! wikitext
19270 <nowiki>=foo=</nowiki>
19271
19272 <nowiki> =foo= </nowiki>
19273 <!--cmt-->
19274 <nowiki>=foo=</nowiki>
19275
19276 =foo''a''<nowiki>=</nowiki>
19277 !! html
19278 <p><span typeof="mw:Nowiki">=foo=</span></p>
19279
19280 <p><span typeof="mw:Nowiki"> =foo= </span>
19281 <!--cmt-->
19282 <span typeof="mw:Nowiki">=foo=</span></p>
19283
19284 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19285 !!end
19286
19287 !! test
19288 Headings: 1. Nested inside html
19289 (New headings and existing headings are handled differently)
19290 !! options
19291 parsoid=html2wt
19292 !! wikitext
19293 = =foo= =
19294
19295 == =foo= ==
19296
19297 === =foo= ===
19298
19299 =<nowiki>=foo=</nowiki>=
19300 ==<nowiki>=foo=</nowiki>==
19301 ===<nowiki>=foo=</nowiki>===
19302 ====<nowiki>=foo=</nowiki>====
19303 =====<nowiki>=foo=</nowiki>=====
19304 ======<nowiki>=foo=</nowiki>======
19305
19306 !! html
19307 <h1>=foo=</h1>
19308 <h2>=foo=</h2>
19309 <h3>=foo=</h3>
19310
19311 <h1 data-parsoid='{}'>=foo=</h1>
19312 <h2 data-parsoid='{}'>=foo=</h2>
19313 <h3 data-parsoid='{}'>=foo=</h3>
19314 <h4 data-parsoid='{}'>=foo=</h4>
19315 <h5 data-parsoid='{}'>=foo=</h5>
19316 <h6 data-parsoid='{}'>=foo=</h6>
19317 !!end
19318
19319 !! test
19320 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19321 !! options
19322 parsoid=html2wt
19323 !! wikitext
19324 = foo =
19325 <nowiki>*</nowiki>bar
19326
19327 = foo =
19328 =bar
19329
19330 = foo =
19331 <nowiki>=bar=</nowiki>
19332 !! html
19333 <h1>foo</h1>*bar
19334 <h1>foo</h1>=bar
19335 <h1>foo</h1>=bar=
19336 !!end
19337
19338 !! test
19339 Headings: 3. Nested inside html with wikitext split by html tags
19340 !! options
19341 parsoid=html2wt
19342 !! wikitext
19343 = ='''bold'''<nowiki>foo=</nowiki> =
19344 !! html
19345 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19346 !!end
19347
19348 !! test
19349 Headings: 4a. No escaping needed (testing just h1 and h2)
19350 !! options
19351 parsoid=html2wt
19352 !! wikitext
19353 = =foo =
19354
19355 = foo= =
19356
19357 = =foo= =
19358
19359 = =foo= bar =
19360
19361 == =foo ==
19362
19363 == foo= ==
19364
19365 = ''=''foo= =
19366
19367 = <nowiki>=</nowiki> =
19368 !! html
19369 <h1>=foo</h1>
19370 <h1>foo=</h1>
19371 <h1> =foo= </h1>
19372 <h1>=foo= bar</h1>
19373 <h2>=foo</h2>
19374 <h2>foo=</h2>
19375 <h1><i>=</i>foo=</h1>
19376 <h1><span typeof="mw:Nowiki">=</span></h1>
19377 !!end
19378
19379 !! test
19380 Headings: 4b. No escaping needed (inside p-tags)
19381 !! options
19382 parsoid=html2wt
19383 !! wikitext
19384 ===
19385 =foo= x
19386 =foo= <s></s>
19387 !! html
19388 <p>===
19389 =foo= x
19390 =foo= <s></s>
19391 </p>
19392 !!end
19393
19394 !! test
19395 Headings: 5. Empty headings
19396 !! options
19397 parsoid
19398 !! wikitext
19399 =<nowiki/>=
19400
19401 ==<nowiki/>==
19402
19403 ===<nowiki/>===
19404
19405 ====<nowiki/>====
19406
19407 =====<nowiki/>=====
19408
19409 ======<nowiki/>======
19410 !! html
19411 <h1></h1>
19412 <h2></h2>
19413 <h3></h3>
19414 <h4></h4>
19415 <h5></h5>
19416 <h6></h6>
19417 !!end
19418
19419 !! test
19420 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19421 !! options
19422 parsoid
19423 !! wikitext
19424 <nowiki>=a=</nowiki>
19425
19426 <nowiki>=a=</nowiki>
19427
19428 <nowiki>=a=</nowiki>
19429
19430 <nowiki>=a=</nowiki>
19431 !! html
19432 <p>=a=</p>
19433 <p>=a= </p>
19434 <p>=a= </p>
19435 <p>=a= </p>
19436 !!end
19437
19438 !! test
19439 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19440 !! options
19441 parsoid
19442 !! wikitext
19443 <nowiki>=a=
19444 b</nowiki>
19445
19446 <nowiki>=a=
19447 b</nowiki>
19448
19449 <nowiki>=a=
19450 b</nowiki>
19451
19452 <nowiki>=a=
19453 b</nowiki>
19454 !! html
19455 <p>=a=
19456 b</p>
19457 <p>=a=
19458 b</p>
19459 <p>=a=
19460 b</p>
19461 <p>=a=
19462 b</p>
19463 </p>
19464 !!end
19465
19466 !! test
19467 Headings: 6c. Heading chars in SOL context (leading newline break)
19468 !! options
19469 parsoid
19470 !! wikitext
19471 a
19472 <nowiki>=b=</nowiki>
19473 !! html
19474 <p>a
19475 =b=</p>
19476 !!end
19477
19478 !! test
19479 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19480 !! options
19481 parsoid
19482 !! wikitext
19483 <!--c0--><nowiki>=a=</nowiki>
19484
19485 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19486 !! html
19487 <p><!--c0-->=a=</p>
19488 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19489 !!end
19490
19491 !! test
19492 Headings: 6d. Heading chars in SOL context (No escaping needed)
19493 !! options
19494 parsoid=html2wt
19495 !! wikitext
19496 =a=<div>b</div>
19497 !! html
19498 =a=<div>b</div>
19499 !!end
19500
19501 #### --------------- Lists ---------------
19502 #### 0. Outside nests (*foo, etc.)
19503 #### 1. Nested inside html <ul><li>*foo</li></ul>
19504 #### 2. Inside definition lists
19505 #### 3. Only bullets at start should be escaped
19506 #### 4. No escapes needed
19507 #### 5. No unnecessary escapes
19508 #### 6. Escape bullets in SOL position
19509 #### 7. Escape bullets in a multi-line context
19510 #### ----------------------------------------
19511
19512 !! test
19513 Lists: 0. Outside nests
19514 !! wikitext
19515 <nowiki>*</nowiki>foo
19516
19517 <nowiki>#</nowiki>foo
19518
19519 <nowiki>;Foo:</nowiki>bar
19520 !! html
19521 <p>*foo
19522 </p><p>#foo
19523 </p><p>;Foo:bar
19524 </p>
19525 !!end
19526
19527 !! test
19528 Lists: 1. Nested inside html
19529 !! wikitext
19530 *<nowiki>*foo</nowiki>
19531
19532 *<nowiki>#foo</nowiki>
19533
19534 *<nowiki>:foo</nowiki>
19535
19536 *<nowiki>;foo</nowiki>
19537
19538 #<nowiki>*foo</nowiki>
19539
19540 #<nowiki>#foo</nowiki>
19541
19542 #<nowiki>:foo</nowiki>
19543
19544 #<nowiki>;foo</nowiki>
19545 !! html
19546 <ul><li>*foo</li></ul>
19547 <ul><li>#foo</li></ul>
19548 <ul><li>:foo</li></ul>
19549 <ul><li>;foo</li></ul>
19550 <ol><li>*foo</li></ol>
19551 <ol><li>#foo</li></ol>
19552 <ol><li>:foo</li></ol>
19553 <ol><li>;foo</li></ol>
19554
19555 !!end
19556
19557 !! test
19558 Lists: 2. Inside definition lists
19559 !! wikitext
19560 ;<nowiki>;foo</nowiki>
19561
19562 ;<nowiki>:foo</nowiki>
19563
19564 ;<nowiki>:foo</nowiki>
19565 :bar
19566
19567 :<nowiki>:foo</nowiki>
19568 !! html
19569 <dl><dt>;foo</dt></dl>
19570 <dl><dt>:foo</dt></dl>
19571 <dl><dt>:foo</dt>
19572 <dd>bar</dd></dl>
19573 <dl><dd>:foo</dd></dl>
19574
19575 !!end
19576
19577 !! test
19578 Lists: 3. Only bullets at start of text should be escaped
19579 !! wikitext
19580 *<nowiki>*foo*bar</nowiki>
19581
19582 *<nowiki>*foo</nowiki>''it''*bar
19583 !! html
19584 <ul><li>*foo*bar</li></ul>
19585 <ul><li>*foo<i>it</i>*bar</li></ul>
19586
19587 !!end
19588
19589 !! test
19590 Lists: 4. No escapes needed
19591 !! options
19592 parsoid
19593 !! wikitext
19594 *foo*bar
19595
19596 *''foo''*bar
19597
19598 *[[Foo]]: bar
19599
19600 *[[Foo]]*bar
19601 !! html
19602 <ul>
19603 <li>foo*bar
19604 </li>
19605 </ul>
19606 <ul>
19607 <li><i>foo</i>*bar
19608 </li>
19609 </ul>
19610 <ul>
19611 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
19612 </li>
19613 </ul>
19614 <ul>
19615 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
19616 </li>
19617 </ul>
19618 !!end
19619
19620 !! test
19621 Lists: 5. No unnecessary escapes
19622 !! wikitext
19623 * bar <span><nowiki>[[foo]]</nowiki></span>
19624
19625 *=bar <span><nowiki>[[foo]]</nowiki></span>
19626
19627 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19628
19629 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19630
19631 *=bar <span>foo]]</span>=
19632
19633 * <s></s>: a
19634 !! html
19635 <ul><li> bar <span>[[foo]]</span></li></ul>
19636 <ul><li>=bar <span>[[foo]]</span></li></ul>
19637 <ul><li>[[bar <span>[[foo]]</span></li></ul>
19638 <ul><li>]]bar <span>[[foo]]</span></li></ul>
19639 <ul><li>=bar <span>foo]]</span>=</li></ul>
19640 <ul><li> <s></s>: a</li></ul>
19641
19642 !!end
19643
19644 !! test
19645 Lists: 6. Escape bullets in SOL position
19646 !! options
19647 parsoid
19648 !! wikitext
19649 <!--cmt--><nowiki>*foo</nowiki>
19650 !! html
19651 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19652 !!end
19653
19654 !! test
19655 Lists: 7. Escape bullets in a multi-line context
19656 !! wikitext
19657 a
19658 <nowiki>*</nowiki>b
19659 !! html
19660 <p>a
19661 *b
19662 </p>
19663 !!end
19664
19665 #### --------------- HRs ---------------
19666 #### 1. Single line
19667 #### -----------------------------------
19668
19669 !! test
19670 HRs: 1. Single line
19671 !! options
19672 parsoid
19673 !! wikitext
19674 ----<nowiki>----</nowiki>
19675 ----=foo=
19676 ----*foo
19677 !! html
19678 <hr><span typeof="mw:Nowiki">----</span>
19679 <hr>=foo=
19680 <hr>*foo
19681 !! end
19682
19683 #### --------------- Tables ---------------
19684 #### 1a. Simple example
19685 #### 1b. No escaping needed (!foo)
19686 #### 1c. No escaping needed (|foo)
19687 #### 1d. No escaping needed (|}foo)
19688 ####
19689 #### 2a. Nested in td (<td>foo|bar</td>)
19690 #### 2b. Nested in td (<td>foo||bar</td>)
19691 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19692 ####
19693 #### 3a. Nested in th (<th>foo!bar</th>)
19694 #### 3b. Nested in th (<th>foo!!bar</th>)
19695 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19696 ####
19697 #### 4a. Escape -
19698 #### 4b. Escape +
19699 #### 4c. No escaping needed
19700 #### --------------------------------------
19701
19702 !! test
19703 Tables: 1a. Simple example
19704 !! wikitext
19705 <nowiki>{|
19706 |}</nowiki>
19707 !! html
19708 <p>{|
19709 |}
19710 </p>
19711 !! end
19712
19713 !! test
19714 Tables: 1b. No escaping needed
19715 !! wikitext
19716 !foo
19717 !! html
19718 <p>!foo
19719 </p>
19720 !! end
19721
19722 !! test
19723 Tables: 1c. No escaping needed
19724 !! wikitext
19725 |foo
19726 !! html
19727 <p>|foo
19728 </p>
19729 !! end
19730
19731 !! test
19732 Tables: 1d. No escaping needed
19733 !! wikitext
19734 |}foo
19735 !! html
19736 <p>|}foo
19737 </p>
19738 !! end
19739
19740 !! test
19741 Tables: 2a. Nested in td
19742 !! options
19743 parsoid=html2wt
19744 !! wikitext
19745 {|
19746 |<nowiki>foo|bar</nowiki>
19747 |-
19748 |x<div><nowiki>a|b</nowiki></div>
19749 |}
19750 !! html
19751 <table><tbody><tr>
19752 <td>foo|bar</td></tr>
19753 <tr><td>x<div>a|b</div></td>
19754 </tbody></table>
19755 !! end
19756
19757 !! test
19758 Tables: 2b. Nested in td
19759 !! options
19760 parsoid
19761 !! wikitext
19762 {|
19763 |<nowiki>foo||bar</nowiki>
19764 |''it''<nowiki>foo||bar</nowiki>
19765 |}
19766 !! html
19767 <table><tbody><tr>
19768 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19769 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19770 !! end
19771
19772 !! test
19773 Tables: 2c. Nested in td -- no escaping needed
19774 !! options
19775 parsoid
19776 !! wikitext
19777 {|
19778 |foo!!bar
19779 |}
19780 !! html
19781 <table><tbody><tr><td>foo!!bar
19782 </td></tr></tbody></table>
19783
19784 !! end
19785
19786 !! test
19787 Tables: 3a. Nested in th
19788 !! options
19789 parsoid
19790 !! wikitext
19791 {|
19792 !foo!bar
19793 |}
19794 !! html
19795 <table><tbody><tr><th>foo!bar
19796 </th></tr></tbody></table>
19797
19798 !! end
19799
19800 !! test
19801 Tables: 3b. Nested in th
19802 !! options
19803 parsoid
19804 !! wikitext
19805 {|
19806 !<nowiki>foo!!bar</nowiki>
19807 |}
19808 !! html
19809 <table>
19810 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19811 </tbody></table>
19812 !! end
19813
19814 !! test
19815 Tables: 3c. Nested in th -- no escaping needed
19816 !! options
19817 parsoid
19818 !! wikitext
19819 {|
19820 !<nowiki>foo||bar</nowiki>
19821 |}
19822 !! html
19823 <table><tbody><tr>
19824 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19825 !! end
19826
19827 !! test
19828 Tables: 4a. Escape -
19829 !! options
19830 parsoid
19831 !! wikitext
19832 {|
19833 !-bar
19834 |-
19835 |<nowiki>-bar</nowiki>
19836 |}
19837 !! html
19838 <table><tbody>
19839 <tr><th>-bar</th></tr>
19840 <tr>
19841 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19842 !! end
19843
19844 !! test
19845 Tables: 4b. Escape +
19846 !! options
19847 parsoid
19848 !! wikitext
19849 {|
19850 !+bar
19851 |-
19852 |<nowiki>+bar</nowiki>
19853 |}
19854 !! html
19855 <table><tbody>
19856 <tr><th>+bar</th></tr>
19857 <tr>
19858 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19859 !! end
19860
19861 !! test
19862 Tables: 4c. No escaping needed
19863 !! options
19864 parsoid
19865 !! wikitext
19866 {|
19867 |foo-bar
19868 |foo+bar
19869 |-
19870 |''foo''-bar
19871 |''foo''+bar
19872 |-
19873 |foo
19874 bar|baz
19875 +bar
19876 -bar
19877 |-
19878 |x
19879 <div>a|b</div>
19880 |}
19881 !! html
19882 <table><tbody>
19883 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19884 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19885 <tr><td>foo
19886 <p>bar|baz
19887 +bar
19888 -bar</p></td></tr>
19889 <tr><td>x
19890 <div>a|b</div></td>
19891 </tbody></table>
19892 !! end
19893
19894 !! test
19895 Tables: 4d. No escaping needed
19896 !! options
19897 parsoid
19898 !! wikitext
19899 {|
19900 |[[Foo]]-bar
19901 ||+1
19902 ||-2
19903 |}
19904 !! html
19905 <table>
19906 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
19907 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19908 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19909 </tbody></table>
19910 !! end
19911
19912 !! test
19913 Tables: Digest broken attributes on table and tr tag
19914 !! options
19915 parsoid=wt2html
19916 !! wikitext
19917 {| || |} ++
19918 |- || || ++ --
19919 |- > [
19920 |}
19921 !! html
19922 <table>
19923 <tbody>
19924 <tr></tr>
19925 <tr></tr>
19926 </tbody></table>
19927 !! end
19928
19929 #### --------------- Links ----------------
19930 #### 1. Quote marks in link text
19931 #### 2. Wikilinks: Escapes needed
19932 #### 3. Wikilinks: No escapes needed
19933 #### 4. Extlinks: Escapes needed
19934 #### 5. Extlinks: No escapes needed
19935 #### --------------------------------------
19936 !! test
19937 Links 1. Quote marks in link text
19938 !! options
19939 parsoid
19940 !! wikitext
19941 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19942 !! html
19943 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19944 !! end
19945
19946 !! test
19947 Links 2. WikiLinks: Escapes needed
19948 !! options
19949 parsoid
19950 !! wikitext
19951 [[Foo|[Foobar]]]
19952 [[Foo|<nowiki>Foobar]</nowiki>]]
19953 [[Foo|x [Foobar] x]]
19954 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19955 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19956 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19957 [[Foo|<nowiki>|Bar</nowiki>]]
19958 [[Foo|<nowiki>]]bar</nowiki>]]
19959 [[Foo|<nowiki>[[bar</nowiki>]]
19960 [[Foo|<nowiki>x [[ y</nowiki>]]
19961 [[Foo|<nowiki>x ]] y</nowiki>]]
19962 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19963 !! html
19964 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19965 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19966 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19967 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19968 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19969 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19970 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19971 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19972 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19973 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19974 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19975 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19976 !! end
19977
19978 !! test
19979 Links 3. WikiLinks: No escapes needed
19980 !! options
19981 parsoid
19982 !! wikitext
19983 [[Foo|[Foobar]]
19984 [[Foo|foo|bar]]
19985 !! html
19986 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19987 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19988 !! end
19989
19990 !! test
19991 Links 4. ExtLinks: Escapes needed
19992 !! options
19993 parsoid
19994 !! wikitext
19995 [http://google.com <nowiki>[google]</nowiki>]
19996 [http://google.com <nowiki>google]</nowiki>]
19997
19998 <nowiki>[http://google.com]</nowiki>
19999
20000 <nowiki>[http://google.com google]</nowiki>
20001
20002 !! html
20003 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20004 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20005 <p>[http://google.com]</p>
20006 <p>[http://google.com google]</p>
20007 !! end
20008
20009 !! test
20010 Links 5. ExtLinks: No escapes needed
20011 !! options
20012 parsoid
20013 !! wikitext
20014 [http://google.com [google]
20015 !! html
20016 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20017 !! end
20018
20019 !! test
20020 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20021 !! html/parsoid
20022 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20023 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20024 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20025 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20026 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20027 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20028 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20029 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20030 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20031 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20032 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20033 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20034 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20035 </p>
20036 !! wikitext
20037 x<nowiki/>http://example.com<nowiki/>y
20038 http://example.com<nowiki/>?x
20039 http://example.com<nowiki/>&x
20040 http://example.com<nowiki/>'x
20041 http://example.com<nowiki/>,x
20042 http://example.com<nowiki/>.x
20043 http://example.com<nowiki/>;x
20044 http://example.com<nowiki/>:x
20045 http://example.com<nowiki/>;x
20046 http://example.com<nowiki/>!x
20047 http://example.com<nowiki/>=x
20048 http://example.com<nowiki/>(x)
20049 http://example.com(x<nowiki/>)
20050 !! end
20051
20052 !! test
20053 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20054 !! html/parsoid
20055 <p>x
20056 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20057 y
20058 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20059 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20060 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20061 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20062 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20063 </p>
20064 !! wikitext
20065 x
20066 http://example.com
20067 y
20068 "http://example.com"
20069 (http://example.com)
20070 (http://example.com) foo
20071 http://example.com,
20072 http://example.com, foo
20073 !! end
20074
20075 ## Parsoid currently fails wt2html on this one!
20076 !! test
20077 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20078 !! html/parsoid
20079 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20080 !! wikitext
20081 http://example.com.,;:!?
20082 !! end
20083
20084 !! test
20085 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20086 !! html/parsoid
20087 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20088 !! wikitext
20089 RFC 123<nowiki/>4
20090 !! end
20091
20092 !! test
20093 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20094 !! html/parsoid
20095 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20096 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20097 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20098 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20099 </p>
20100 !! wikitext
20101 xRFC 123y
20102 XRFC 123y
20103 RFC 123?foo
20104 RFC 123&foo
20105 !! end
20106
20107 !! test
20108 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20109 !! html/parsoid
20110 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20111 !! wikitext
20112 PMID 123<nowiki/>4
20113 !! end
20114
20115 !! test
20116 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20117 !! html/parsoid
20118 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20119 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20120 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20121 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20122 </p>
20123 !! wikitext
20124 xPMID 123y
20125 XPMID 123y
20126 PMID 123?foo
20127 PMID 123&foo
20128 !! end
20129
20130 !! test
20131 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20132 !! html/parsoid
20133 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20134 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20135 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20136 </p>
20137 !! wikitext
20138 ISBN 1234567890<nowiki/>1
20139 ISBN 1234567890<nowiki/>x
20140 ISBN 1234567890<nowiki/>b
20141 !! end
20142
20143 !! test
20144 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20145 !! html/parsoid
20146 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20147 !! wikitext
20148 ISBN 1234567890's
20149 !! end
20150
20151 #### --------------- Quotes ---------------
20152 #### 1. Quotes inside <b> and <i>
20153 #### 2. Link fragments separated by <i> and <b> tags
20154 #### 3. Link fragments inside <i> and <b>
20155 #### 4. No escaping needed
20156 #### --------------------------------------
20157 !! test
20158 1. Quotes inside <b> and <i>
20159 !! options
20160 parsoid=html2wt,wt2wt
20161 !! wikitext
20162 ''<nowiki>'foo'</nowiki>''
20163 ''<nowiki>''foo''</nowiki>''
20164 ''<nowiki>'''foo'''</nowiki>''
20165 ''foo''<nowiki/>'s
20166 '''<nowiki>'foo'</nowiki>'''
20167 '''<nowiki>''foo''</nowiki>'''
20168 '''<nowiki>'''foo'''</nowiki>'''
20169 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20170 '''foo'''<nowiki/>'s
20171 '''foo''
20172 ''foo''<nowiki/>'
20173 '<nowiki/>''foo''<nowiki/>'
20174 ''''foo'''
20175 '''foo'''<nowiki/>'
20176 '<nowiki/>'''foo'''<nowiki/>'
20177 ''fools'<span> errand</span>''
20178 ''<span>fool</span>'s errand''
20179 !! html
20180 <p><i>'foo'</i>
20181 <i>''foo''</i>
20182 <i>'''foo'''</i>
20183 <i>foo</i>'s
20184 <b>'foo'</b>
20185 <b>''foo''</b>
20186 <b>'''foo'''</b>
20187 <b>foo'<i>bar'</i>baz</b>
20188 <b>foo</b>'s
20189 '<i>foo</i>
20190 <i>foo</i>'
20191 '<i>foo</i>'
20192 '<b>foo</b>
20193 <b>foo</b>'
20194 '<b>foo</b>'</p>
20195 <i>fools'<span> errand</span></i>
20196 <i><span>fool</span>'s errand</i>
20197 !! end
20198
20199 !! test
20200 2. Link fragments separated by <i> and <b> tags
20201 !! wikitext
20202 [[''foo''<nowiki>hello]]</nowiki>
20203
20204 [['''foo'''<nowiki>hello]]</nowiki>
20205 !! html
20206 <p>[[<i>foo</i>hello]]
20207 </p><p>[[<b>foo</b>hello]]
20208 </p>
20209 !! end
20210
20211 !! test
20212 3. Link fragments inside <i> and <b>
20213 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
20214 this is one of the shortcomings of this format)
20215 !! wikitext
20216 ''[[foo''<nowiki>]]</nowiki>
20217
20218 '''[[foo'''<nowiki>]]</nowiki>
20219 !! html
20220 <p><i>[[foo</i>]]
20221 </p><p><b>[[foo</b>]]
20222 </p>
20223 !! end
20224
20225 !! test
20226 4. No escaping needed
20227 !! wikitext
20228 '<span>''bar''</span>'
20229 '<span>'''bar'''</span>'
20230 !! html
20231 <p>'<span><i>bar</i></span>'
20232 '<span><b>bar</b></span>'
20233 </p>
20234 !! end
20235
20236 #### ----------- Paragraphs ---------------
20237 #### 1. No unnecessary escapes
20238 #### --------------------------------------
20239
20240 !! test
20241 1. No unnecessary escapes
20242 !! wikitext
20243 bar <span><nowiki>[[foo]]</nowiki></span>
20244
20245 =bar <span><nowiki>[[foo]]</nowiki></span>
20246
20247 [[bar <span><nowiki>[[foo]]</nowiki></span>
20248
20249 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20250
20251 =bar <span>foo]]</span><nowiki>=</nowiki>
20252 !! html
20253 <p>bar <span>[[foo]]</span>
20254 </p><p>=bar <span>[[foo]]</span>
20255 </p><p>[[bar <span>[[foo]]</span>
20256 </p><p>]]bar <span>[[foo]]</span>
20257 </p><p>=bar <span>foo]]</span>=
20258 </p>
20259 !!end
20260
20261 #### ----------------------- PRE --------------------------
20262 #### 1. Leading whitespace in SOL context should be escaped
20263 #### ------------------------------------------------------
20264 !! test
20265 1. Leading whitespace in SOL context should be escaped
20266 !! options
20267 parsoid
20268 !! wikitext
20269 <nowiki> </nowiki>a
20270
20271 <nowiki> </nowiki> a
20272
20273 <nowiki> </nowiki>a(tab)
20274
20275 <nowiki> </nowiki> a
20276 <!--cmt-->
20277 <nowiki> </nowiki> a
20278
20279 a
20280 <nowiki> </nowiki>b
20281
20282 a
20283 <nowiki> </nowiki>b
20284
20285 a
20286 <nowiki> </nowiki> b
20287 !! html
20288 <p> a</p>
20289 <p> a</p>
20290 <p> a(tab)</p>
20291 <p> a</p>
20292 <p><!--cmt--> a</p>
20293 <p>a
20294 b</p>
20295 <p>a
20296 b</p>
20297 <p>a
20298 b</p>
20299 !! end
20300
20301 !! test
20302 2. Leading whitespace in non-indent-pre contexts should not be escaped
20303 !! options
20304 parsoid
20305 !! wikitext
20306 foo <ref>''a''
20307 b</ref>
20308 !! html
20309 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
20310 !! end
20311
20312 !! test
20313 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20314 !! options
20315 parsoid
20316 !! wikitext
20317 <blockquote>
20318 a
20319 <span>b</span>
20320 c
20321 </blockquote>
20322 !! html
20323 <blockquote>
20324 <p>
20325 a
20326 <span>b</span>
20327 c</p>
20328 </blockquote>
20329 !! end
20330
20331 !! test
20332 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20333 !! options
20334 parsoid
20335 !! wikitext
20336 [[File:Foobar.jpg|thumb|caption]]
20337 !! html
20338 !! html/parsoid
20339 <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>
20340 !! end
20341
20342 !! test
20343 5. Nowiki escaping should account for indent-pres
20344 !! options
20345 parsoid=html2wt
20346 !! html
20347 <pre>==foo==</pre>
20348 !! wikitext
20349 ==foo==
20350 !! end
20351
20352 #### --------------- Behavior Switches --------------------
20353 !! test
20354 1. Valid behavior switches should be escaped
20355 !! options
20356 parsoid=html2wt
20357 !! wikitext
20358 <nowiki>__TOC__</nowiki>
20359 ''<nowiki>__TOC__</nowiki>''
20360 !! html
20361 __TOC__
20362 <i>__TOC__</i>
20363 !! end
20364
20365 !! test
20366 2. Invalid behavior switches should not be escaped
20367 !! options
20368 parsoid=html2wt
20369 !! wikitext
20370 __TOO__
20371 __|__
20372 !! html
20373 __TOO__
20374 __|__
20375 !! end
20376
20377 #### --------------- HTML tags ---------------
20378 #### 1. a tags
20379 #### 2. other tags
20380 #### 3. multi-line html tag
20381 #### 4. extension tags
20382 #### -----------------------------------------
20383 !! test
20384 1. a tags
20385 !! options
20386 parsoid
20387 !! wikitext
20388 <a href="http://google.com">google</a>
20389 !! html
20390 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20391 !! end
20392
20393 !! test
20394 2. other tags
20395 !! wikitext
20396 <nowiki><div>foo</div>
20397 <div style="color:red">foo</div></nowiki>
20398 !! html
20399 <p>&lt;div&gt;foo&lt;/div&gt;
20400 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20401 </p>
20402 !! end
20403
20404 !! test
20405 3. multi-line html tag
20406 !! wikitext
20407 <nowiki><div
20408 >foo</div
20409 ></nowiki>
20410 !! html
20411 <p>&lt;div
20412 &gt;foo&lt;/div
20413 &gt;
20414 </p>
20415 !! end
20416
20417 !! test
20418 4. extension tags
20419 !! wikitext
20420 <nowiki><ref>foo</ref></nowiki>
20421
20422 <nowiki><ref>bar</nowiki>
20423
20424 baz<nowiki></ref></nowiki>
20425 !! html
20426 <p>&lt;ref&gt;foo&lt;/ref&gt;
20427 </p><p>&lt;ref&gt;bar
20428 </p><p>baz&lt;/ref&gt;
20429 </p>
20430 !! end
20431
20432 #### --------------- Others ---------------
20433 !! test
20434 Escaping nowikis
20435 !! wikitext
20436 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20437 !! html
20438 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20439 </p>
20440 !! end
20441
20442 ## The quote-char in the input is necessary for triggering the bug
20443 !! test
20444 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20445 !! options
20446 parsoid=wt2wt,html2wt
20447 !! wikitext
20448 foo's bar :
20449 !! html
20450 <p>foo's bar :</p>
20451 !! end
20452
20453 !! test
20454
20455 Tag-like HTML structures are passed through as text
20456 !! wikitext
20457 <x y>
20458
20459 <x.y>
20460
20461 <x-y>
20462
20463 1>2
20464
20465 x<y
20466
20467 a>b
20468
20469 1<d e>f
20470 !! html
20471 <p>&lt;x y&gt;
20472 </p><p>&lt;x.y&gt;
20473 </p><p>&lt;x-y&gt;
20474 </p><p>1&gt;2
20475 </p><p>x&lt;y
20476 </p><p>a&gt;b
20477 </p><p>1&lt;d e&gt;f
20478 </p>
20479 !! end
20480
20481
20482 # This was a bug in the PHP parser (see bug 17663 and its dups,
20483 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20484 !! test
20485 Tag names followed by punctuation should not be recognized as tags
20486 !! wikitext
20487 <s.ome> text
20488 !! html
20489 <p>&lt;s.ome&gt; text
20490 </p>
20491 !! end
20492
20493 !! test
20494 HTML tag with necessary entities in attributes
20495 !! wikitext
20496 <span title="&amp;amp;">foo</span>
20497 !! html
20498 <p><span title="&amp;amp;">foo</span>
20499 </p>
20500 !! end
20501
20502 !! test
20503 HTML tag with 'unnecessary' entity encoding in attributes
20504 !! wikitext
20505 <span title="&amp;">foo</span>
20506 !! html
20507 <p><span title="&amp;">foo</span>
20508 </p>
20509 !! end
20510
20511 !! test
20512 HTML tag with broken attribute value quoting
20513 !! wikitext
20514 <span title="Hello world>Foo</span>
20515 !! html/php
20516 <p><span>Foo</span>
20517 </p>
20518 !! html/parsoid
20519 <p><span title="Hello world">Foo</span>
20520 </p>
20521 !! end
20522
20523 !! test
20524 Parsoid-only: HTML tag with broken attribute value quoting
20525 !! options
20526 parsoid
20527 !! wikitext
20528 <span title="Hello world>Foo</span>
20529 !! html
20530 <p><span title="Hello world">Foo</span>
20531 </p>
20532 !! end
20533
20534 !! test
20535 Table with broken attribute value quoting
20536 !! wikitext
20537 {|
20538 | title="Hello world|Foo
20539 |}
20540 !! html/php
20541 <table>
20542 <tr>
20543 <td>Foo
20544 </td></tr></table>
20545
20546 !! html/parsoid
20547 <table>
20548 <tr>
20549 <td title="Hello world">Foo
20550 </td></tr></table>
20551
20552 !! end
20553
20554 !! test
20555 Table with broken attribute value quoting on consecutive lines
20556 !! wikitext
20557 {|
20558 | title="Hello world|Foo
20559 | style="color:red|Bar
20560 |}
20561 !! html
20562 <table>
20563 <tr>
20564 <td>Foo
20565 </td>
20566 <td>Bar
20567 </td></tr></table>
20568
20569 !! end
20570
20571 !! test
20572 Parsoid-only: Table with broken attribute value quoting on consecutive lines
20573 !! options
20574 parsoid
20575 !! wikitext
20576 {|
20577 | title="Hello world|Foo
20578 | style="color:red|Bar
20579 |}
20580 !! html
20581 <table><tbody>
20582 <tr>
20583 <td title="Hello world">Foo
20584 </td><td style="color: red">Bar
20585 </td></tr></tbody></table>
20586
20587 !! end
20588
20589 !! test
20590 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20591 !! options
20592 parsoid
20593 !! wikitext
20594 {{}}
20595 !! html
20596 {{}}
20597 !! end
20598
20599 !! test
20600 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20601 !! options
20602 parsoid
20603 !! wikitext
20604 }}{{
20605 !! html
20606 }}{{
20607 !! end
20608
20609 !!test
20610 Accept empty td cell attribute
20611 !! wikitext
20612 {|
20613 | align="center" | foo || |
20614 |}
20615 !! html
20616 <table>
20617 <tr>
20618 <td align="center"> foo </td>
20619 <td>
20620 </td></tr></table>
20621
20622 !!end
20623
20624 !!test
20625 Non-empty attributes in th-cells
20626 !! wikitext
20627 {|
20628 ! Foo !! style="color: red" | Bar
20629 |}
20630 !! html
20631 <table>
20632 <tr>
20633 <th> Foo </th>
20634 <th style="color: red"> Bar
20635 </th></tr></table>
20636
20637 !!end
20638
20639 !!test
20640 Accept empty attributes in th-cells
20641 !! wikitext
20642 {|
20643 !| foo !!| bar
20644 |}
20645 !! html
20646 <table>
20647 <tr>
20648 <th> foo </th>
20649 <th> bar
20650 </th></tr></table>
20651
20652 !!end
20653
20654 !!test
20655 Empty table rows go away
20656 !! wikitext
20657 {|
20658 | Hello
20659 | there
20660 |- class="foo"
20661 |-
20662 |}
20663 !! html
20664 <table>
20665 <tr>
20666 <td> Hello
20667 </td>
20668 <td> there
20669 </td></tr>
20670
20671 </table>
20672
20673 !! end
20674
20675 ###
20676 ### Parsoid-centric tests for testing RTing of inter-element separators
20677 ### Edge cases not tested by existing parser tests and specific to
20678 ### Parsoid-specific serialization strategies.
20679 ###
20680
20681 !!test
20682 RT-ed inter-element separators should be valid separators
20683 !! wikitext
20684 {|
20685 |- [[foo]]
20686 |}
20687 !! html
20688 <table>
20689
20690 </table>
20691
20692 !!end
20693
20694 !!test
20695 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20696 (Parsoid-only since PHP parser relies on Tidy for correct output)
20697 !!options
20698 parsoid
20699 !! wikitext
20700 {|
20701 |<small>foo
20702 bar
20703 |}
20704
20705 {|
20706 |<small>foo<small>
20707 |}
20708 !! html
20709 !!end
20710
20711 !!test
20712 Empty TD followed by TD with tpl-generated attribute
20713 !! wikitext
20714 {|
20715 |-
20716 |
20717 |{{echo|style='color:red'}}|foo
20718 |}
20719 !! html
20720 <table>
20721
20722 <tr>
20723 <td>
20724 </td>
20725 <td>foo
20726 </td></tr></table>
20727
20728 !!end
20729
20730 !!test
20731 Indented table with an empty td
20732 !! wikitext
20733 {|
20734 |-
20735 |
20736 |foo
20737 |}
20738 !! html
20739 <table>
20740
20741 <tr>
20742 <td>
20743 </td>
20744 <td>foo
20745 </td></tr></table>
20746
20747 !!end
20748
20749 !!test
20750 Indented block & table
20751 !! wikitext
20752 <div>foo</div>
20753 {|
20754 |foo
20755 |}
20756 !! html/php
20757 <div>foo</div>
20758 <table>
20759 <tr>
20760 <td>foo
20761 </td></tr></table>
20762
20763 !! html/parsoid
20764 <div data-parsoid='{"stx":"html"}'>foo</div>
20765 <table><tbody>
20766 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20767 </tbody></table>
20768 !!end
20769
20770 !! test
20771 Indent and comment before table row
20772 !! wikitext
20773 {|
20774 <!--hi-->|-
20775 | there
20776 |}
20777 !! html/php
20778 <table>
20779
20780 <tr>
20781 <td> there
20782 </td></tr></table>
20783
20784 !! html/parsoid
20785 <table data-parsoid='{}'>
20786 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20787 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20788 </tbody></table>
20789 !! end
20790
20791 !!test
20792 Empty TR followed by a template-generated TR
20793 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20794 !!options
20795 parsoid
20796 !! wikitext
20797 {|
20798 |-
20799 {{echo|<tr><td>foo</td></tr>}}
20800 |}
20801 !! html
20802 <table>
20803 <tbody>
20804 <tr></tr>
20805 <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}}]}'>
20806 <td>foo</td></tr>
20807 </tbody></table>
20808 !!end
20809
20810 ## PHP and parsoid output differ for this, and since this is primarily
20811 ## for testing Parsoid's serializer, marking this Parsoid only
20812 !!test
20813 Empty TR followed by mixed-ws-comment line should RT correctly
20814 !!options
20815 parsoid
20816 !! wikitext
20817 {|
20818 |-
20819 <!--c-->
20820 |-
20821 <!--c--> <!--d-->
20822 |}
20823 !! html
20824 <table>
20825 <tbody>
20826 <tr></tr>
20827 <!--c-->
20828 <tr>
20829 <!--c--> </tr><!--d-->
20830 </tbody></table>
20831
20832 !!end
20833
20834 !!test
20835 Multi-line image caption generated by templates with/without trailing newlines
20836 !!options
20837 parsoid
20838 !! wikitext
20839 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20840 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20841 !! html
20842 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
20843 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
20844
20845 !!end
20846
20847 !! test
20848 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20849 !! options
20850 parsoid=html2wt
20851 !! wikitext
20852 <includeonly>foo</includeonly>
20853 new para
20854
20855 [[./Category:Foo]]
20856
20857 = new heading =
20858 !! html
20859 <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>
20860
20861 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20862 !! end
20863
20864 ## PHP emits broken html for this, and since this is primarily
20865 ## a Parsoid serializer test, marking this Parsoid only
20866 !!test
20867 Improperly nested inline or quotes tags with whitespace in between
20868 !!options
20869 parsoid
20870 !! wikitext
20871 <span> <s>x</span> </s>
20872 ''' ''x''' ''
20873 !! html
20874 <p><span> <s>x</s></span><s> </s>
20875 <b> <i>x</i></b><i> </i>
20876 </p>
20877 !!end
20878
20879 !!test
20880 Encapsulate protected attributes from wt
20881 !!options
20882 parsoid
20883 !! wikitext
20884 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20885 !! html
20886 <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>
20887 </body>
20888 !!end
20889
20890 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20891 ## Having nested or stray pre tags results in the attempt to add duplicates,
20892 ## causing an assertion fail. This test tries to prevent that situation.
20893 !!test
20894 Ensure ParagraphWrapper can deal with stray closing pre tags
20895 !!options
20896 parsoid=wt2html
20897 !! wikitext
20898 plain text</pre>
20899 !! html
20900 plain text
20901 !!end
20902
20903 !!test
20904 1. Ensure fostered text content is wrapped in spans
20905 !!options
20906 parsoid=wt2html
20907 !! wikitext
20908 <table>hi</table><table>ho</table>
20909 !! html
20910 <span>hi</span>
20911 <table></table>
20912 <span>ho</span>
20913 <table></table>
20914 !!end
20915
20916 !!test
20917 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20918 !!options
20919 parsoid=wt2html,wt2wt
20920 !! wikitext
20921 <table>
20922 <tr> || ||
20923 <td> a
20924 </table>
20925 !! html
20926 <span> || ||</span>
20927 <table>
20928 <tbody>
20929 <tr>
20930 <td> a</td></tr>
20931 </tbody></table>
20932 !!end
20933
20934 !!test
20935 Encapsulation properly handles null DSR information from foster box
20936 !!options
20937 parsoid=wt2html,wt2wt
20938 !! wikitext
20939 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20940 !! html
20941 <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;
20942 <table>foo
20943 <tr>
20944 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20945 <table>
20946 <tbody>
20947 <tr>
20948 <td>bar</td></tr></tbody></table>
20949 !!end
20950
20951 !!test
20952 1. Encapsulate foster-parented transclusion content
20953 !!options
20954 parsoid=wt2wt,wt2html
20955 !! wikitext
20956 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20957 !! html
20958 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20959 <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
20960 <tr>
20961 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20962 <table>
20963 <tbody>
20964 <tr>
20965 <td>bar</td></tr></tbody></table>
20966 !!end
20967
20968 !!test
20969 2. Encapsulate foster-parented transclusion content
20970 !!options
20971 parsoid=wt2wt,wt2html
20972 !! wikitext
20973 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20974 !! html
20975 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20976 <table>
20977 <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>
20978 <tr>
20979 <td>bar</td></tr></table>&quot;]}">foo</div>
20980 <table>
20981 <tbody>
20982 <tr>
20983 <td>bar</td></tr></tbody></table>
20984 !!end
20985
20986 !!test
20987 3. Encapsulate foster-parented transclusion content
20988 !!options
20989 parsoid=wt2wt,wt2html
20990 !! wikitext
20991 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20992 !! html
20993 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20994 <table>
20995 <div>
20996 <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>
20997 <tr>
20998 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20999 <p>foo</p></div>
21000 <table>
21001 <tbody>
21002 <tr>
21003 <td>bar</td></tr></tbody></table>
21004 !!end
21005
21006 !!test
21007 4. Encapsulate foster-parented transclusion content
21008 !!options
21009 parsoid=wt2wt,wt2html
21010 !! wikitext
21011 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21012 !! html
21013 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21014 <table>
21015 <div>
21016 <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>
21017 <tr>
21018 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21019 <p>foo</p></div>
21020 <table>
21021 <tbody>
21022 <tr>
21023 <td>bar</td></tr></tbody></table>
21024 !!end
21025
21026 !!test
21027 5. Encapsulate foster-parented transclusion content
21028 !!options
21029 parsoid=wt2wt,wt2html
21030 !! wikitext
21031 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21032 !! html
21033 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21034 <table>
21035 <tr>
21036 <td>
21037 <div>
21038 <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</span>
21039 <table>
21040 <tbody>
21041 <tr>
21042 <td>
21043 <div>
21044 <p>foo</p></div></td></tr></tbody></table>
21045 !!end
21046
21047 !!test
21048 6. Encapsulate foster-parented transclusion content
21049 !!options
21050 parsoid=wt2wt,wt2html
21051 !! wikitext
21052 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21053 !! html
21054 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21055 <table>
21056 <tr>
21057 <td>
21058 <div>
21059 <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</span>
21060 <table>
21061 <tbody>
21062 <tr>
21063 <td>
21064 <div>
21065 <p>foo</p></div></td></tr></tbody></table>
21066 <p>ok</p>
21067 !!end
21068
21069 !!test
21070 7. Encapsulate foster-parented transclusion content
21071 !!options
21072 parsoid=wt2wt,wt2html
21073 !! wikitext
21074 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21075 !! html
21076 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21077 <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;
21078 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
21079 <td>bar</td></table>&quot;]}">foo</p>
21080 <table>
21081 <tbody>
21082 <tr>
21083 <td>bar</td></tr></tbody></table>
21084 !!end
21085
21086 !!test
21087 8. Encapsulate foster-parented transclusion content
21088 !!options
21089 parsoid=wt2wt,wt2html
21090 !! wikitext
21091 {{echo|a
21092 }}{|{{echo|style='color:red'}}
21093 |-
21094 |b
21095 |}
21096 !! html
21097 <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><span 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}}}</span>
21098 <table>
21099 <tbody>
21100 <tr>
21101 <td>b</td></tr></tbody></table>
21102 !!end
21103
21104 !!test
21105 9. Encapsulate foster-parented transclusion content
21106 !!options
21107 parsoid=wt2wt,wt2html
21108 !! wikitext
21109 <table>{{echo|hi</table>hello}}
21110 !! html
21111 <span 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</span>
21112 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
21113 !!end
21114
21115 !!test
21116 Table in fosterable position
21117 !!options
21118 parsoid=wt2html,wt2wt
21119 !! wikitext
21120 {{OpenTable}}
21121 <div>
21122 {|
21123 |}
21124 </div>
21125 |}
21126 !! html
21127 <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" data-parsoid="{}">
21128 </span>
21129 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21130
21131 <table>
21132 </table>
21133 !!end
21134
21135 # Parsoid only for bug 64747
21136 !! test
21137 Properly encapsulate empty-content transclusions in fosterable positions
21138 !! wikitext
21139 <table>
21140 {{#if:|
21141 <td>foo</td>
21142 }}
21143 </table>
21144 !! html/parsoid
21145 <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":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
21146
21147 </table>
21148 !! end
21149
21150 !!test
21151 Support <object> element with .data attribute
21152 !!options
21153 parsoid=html2wt
21154 !! wikitext
21155 <object data="test.swf"></object>
21156 !! html
21157 <object data="test.swf"></object>
21158 !!end
21159
21160 # -----------------------------------------------------------------
21161 # The following section of tests are primarily to spec requirements
21162 # around serialization of new/edited content.
21163 #
21164 # All these tests are marked Parsoid html2wt and html2html only
21165 # ----------------------------------------------------------------
21166
21167 !! test
21168 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21169 !! options
21170 parsoid=html2wt
21171 language=es
21172 !! wikitext
21173 [[Foo]]
21174 !! html
21175 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
21176 !! end
21177
21178 !! test
21179 Image: Modifying size of an image (1)
21180 !! options
21181 parsoid={
21182 "modes": ["wt2wt"],
21183 "changes": [
21184 ["img[height]", "attr", "height", "22"],
21185 ["img[width]", "attr", "width", "200"]
21186 ]
21187 }
21188 !! wikitext
21189 [[Image:Foobar.jpg|230x230px]]
21190 !! wikitext/edited
21191 [[Image:Foobar.jpg|200x200px]]
21192 !!end
21193
21194 !! test
21195 Image: Modifying size of an image (2)
21196 !! options
21197 parsoid={
21198 "modes": ["wt2wt"],
21199 "changes": [
21200 ["img[height]", "attr", "height", "100"],
21201 ["img[width]", "attr", "width", "500"]
21202 ]
21203 }
21204 !! wikitext
21205 [[Image:Foobar.jpg|230x230px]]
21206 !! wikitext/edited
21207 [[Image:Foobar.jpg|500x500px]]
21208 !!end
21209
21210 # Change in size is ignored so long as class='mw-default-size'
21211 !! test
21212 Image: Modifying size of an image (3)
21213 !! options
21214 parsoid={
21215 "modes": ["wt2wt"],
21216 "changes": [
21217 ["figure[class]", "removeClass", "mw-default-size"],
21218 ["figure img", "attr", "height", "19"],
21219 ["figure img", "attr", "width", "170"]
21220 ]
21221 }
21222 !! wikitext
21223 [[Image:Foobar.jpg|thumb]]
21224 !! wikitext/edited
21225 [[Image:Foobar.jpg|thumb|170x170px]]
21226 !!end
21227
21228 !! test
21229 Image: Modifying alignment of an image (bug 48665)
21230 !! options
21231 parsoid={
21232 "modes": ["wt2wt"],
21233 "changes": [
21234 ["figure[class]", "removeClass", "mw-halign-right"],
21235 ["figure[class]", "addClass", "mw-halign-left"]
21236 ]
21237 }
21238 !! wikitext
21239 [[Image:Foobar.jpg|thumb|caption|right]]
21240 !! wikitext/edited
21241 [[Image:Foobar.jpg|thumb|caption|left]]
21242 !! end
21243
21244 !! test
21245 Image: Modifying mw-default-size of an frameless image (bug 62805)
21246 !! options
21247 parsoid={
21248 "modes": ["wt2wt"],
21249 "changes": [
21250 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21251 ]
21252 }
21253 !! wikitext
21254 [[Image:Foobar.jpg|frameless|right]]
21255 !! wikitext/edited
21256 [[Image:Foobar.jpg|frameless|right|220x220px]]
21257 !! end
21258
21259 !! test
21260 Image: Modifying valign of an image (bug 49221)
21261 !! options
21262 parsoid={
21263 "modes": ["wt2wt"],
21264 "changes": [
21265 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21266 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21267 ]
21268 }
21269 !! wikitext
21270 [[File:Foobar.jpg|20px|middle]]
21271 !! wikitext/edited
21272 [[File:Foobar.jpg|20px|text-top]]
21273 !! end
21274
21275 !! test
21276 Image: Modifying alt attribute of an image (bug 56400)
21277 !! options
21278 parsoid={
21279 "modes": ["wt2wt"],
21280 "changes": [
21281 ["img[alt]", "attr", "alt", "some alternate edited text"]
21282 ]
21283 }
21284 !! wikitext
21285 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21286 !! wikitext/edited
21287 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21288 !!end
21289
21290 !! test
21291 Image: Modifying caption of an image
21292 !! options
21293 parsoid={
21294 "modes": ["wt2wt"],
21295 "changes": [
21296 ["figcaption", "text", "new caption"]
21297 ]
21298 }
21299 !! wikitext
21300 [[Image:Foobar.jpg|thumb|original caption]]
21301 !! wikitext/edited
21302 [[Image:Foobar.jpg|thumb|new caption]]
21303 !!end
21304
21305 !! test
21306 Image: empty alt attribute (bug 48924)
21307 !! options
21308 parsoid
21309 !! wikitext
21310 [[File:Foobar.jpg|thumb|alt=|bar]]
21311 !! html
21312 <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>
21313 !! end
21314
21315 #!! test
21316 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21317 #!! options
21318 #parsoid=html2wt
21319 #language=ar
21320 #!! input
21321 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21322 #!! result
21323 #<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>
21324 #!! end
21325
21326 !! test
21327 Image: Block level image should have \n before and after
21328 !! options
21329 parsoid
21330 !! wikitext
21331 123
21332 [[File:Foobar.jpg|right|thumb|150x150px]]
21333 456
21334 !! html
21335 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p>
21336 !!end
21337
21338 !! test
21339 Image: New block level image should have \n before and after (existing
21340 content)
21341 !! options
21342 parsoid
21343 !! wikitext
21344 123
21345 [[File:Foobar.jpg|right|thumb|150x150px]]
21346 456
21347 !! html
21348 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
21349 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}],"dsr":[4,45,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[6,43,null,null]}'><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>
21350 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
21351 !!end
21352
21353 !! test
21354 Image: upright option (parsoid)
21355 !! options
21356 parsoid
21357 !! wikitext
21358 [[File:Foobar.jpg|thumb|upright|caption]]
21359 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21360 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21361 !! html
21362 <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><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><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>
21363 !!end
21364
21365 !! test
21366 Image: upright option is ignored on inline and frame images (parsoid)
21367 !! options
21368 parsoid
21369 !! wikitext
21370 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21371 !! html
21372 <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>
21373 !!end
21374
21375 !! test
21376 Image: from basic HTML (1)
21377 !! options
21378 parsoid=html2wt
21379 !! html/parsoid
21380 <span typeof="mw:Image">
21381 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21382 </span>
21383 !! wikitext
21384 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21385 !! end
21386
21387 !! test
21388 Image: from basic HTML (2)
21389 !! options
21390 parsoid=html2wt
21391 !! html/parsoid
21392 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21393 !! wikitext
21394 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21395 !! end
21396
21397 !! test
21398 Image: from basic HTML (3)
21399 !! options
21400 parsoid=html2wt
21401 !! html/parsoid
21402 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21403 !! wikitext
21404 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21405 !! end
21406
21407 !! test
21408 Image: from basic HTML (4)
21409 !! options
21410 parsoid=html2wt
21411 !! html/parsoid
21412 <img src="File:Foobar.jpg">
21413 !! wikitext
21414 [[File:Foobar.jpg|link=]]
21415 !! end
21416
21417 !! test
21418 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21419 !! options
21420 parsoid=html2wt
21421 !! wikitext
21422 * foo
21423 !! html
21424 <ul>
21425 <li><p>foo</p></li>
21426 </ul>
21427 !! end
21428
21429 !! test
21430 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21431 !! options
21432 parsoid=html2wt
21433 !! wikitext
21434 * foo
21435 !! html
21436 <ul> <li>foo</li></ul>
21437 !! end
21438
21439 !! test
21440 Don't strip leading whitespace when handling indent-pre suppressing tags
21441 !! options
21442 parsoid=html2wt
21443 !! wikitext
21444 {|
21445 | indented row
21446 |}
21447 <blockquote>
21448 '''This is very bold of you!'''
21449
21450 {|
21451 |
21452 indented cell (no pre-wrapping!)
21453 |}
21454 </blockquote>
21455 foo
21456 <div>bar</div>
21457 !! html
21458 <table>
21459 <tr><td> indented row</td></tr>
21460 </table>
21461 <blockquote><p>
21462 <b>This is very bold of you!</b>
21463 </p>
21464 <table><tr><td>
21465 indented cell (no pre-wrapping!)
21466 </td></tr></table>
21467 </blockquote>
21468 <p>foo</p>
21469 <div>bar</div>
21470 !! end
21471
21472 !! test
21473 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21474 !! options
21475 parsoid=html2wt
21476 !! wikitext
21477 foo
21478 <nowiki> </nowiki><span>bar</span>
21479
21480 <span>foo2
21481 <nowiki> </nowiki></span>bar2
21482
21483 <div>foo</div>
21484 <nowiki> </nowiki><span>bar</span>
21485
21486 <div>
21487 <nowiki> </nowiki><span>foo</span>
21488 </div>
21489 !! html
21490 <p>foo</p>
21491 <span>bar</span>
21492
21493 <span>foo2
21494 </span>bar2
21495
21496 <div>foo</div>
21497 <span>bar</span>
21498
21499 <div>
21500 <span>foo</span>
21501 </div>
21502 !! end
21503
21504 !! test
21505 Lists: Add space after bullets
21506 !! options
21507 parsoid=html2wt
21508 !! wikitext
21509 * foo
21510 * bar
21511 * <span> baz</span>
21512 !! html
21513 <ul>
21514 <li>foo</li>
21515 <li> bar</li>
21516 <li><span> baz</span></li>
21517 </ul>
21518 !! end
21519
21520 !! test
21521 Lists: Dont insert newlines in a serialized list item.
21522 !! options
21523 parsoid=html2wt
21524 !! wikitext
21525 * a<br>b
21526 * c
21527 !! html
21528 <ul><li>a<br>b</li><li>c</li></ul>
21529 !! end
21530
21531 !! test
21532 Headings: Add space before/after == (Bug 51744)
21533 !! options
21534 parsoid=html2wt
21535 !! wikitext
21536 == foo ==
21537
21538 == bar ==
21539
21540 == baz ==
21541
21542 == <span> baz</span> ==
21543 !! html
21544 <h2>foo</h2>
21545 <h2> bar</h2>
21546 <h2>baz </h2>
21547 <h2><span> baz</span></h2>
21548 !! end
21549
21550 !! test
21551 Parsoid: Serialize positional parameters with = in them as named parameter
21552 !! options
21553 parsoid=html2wt
21554 !! wikitext
21555 {{echo|1 = f=oo}}
21556
21557 {{echo|1 = f=oo|2 = bar}}
21558
21559 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21560 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21561 {{echo|<nowiki>f=oo</nowiki>|bar}}
21562 !! html
21563 <p about="#mwt1" typeof="mw:Transclusion"
21564 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21565
21566 <p about="#mwt1" typeof="mw:Transclusion"
21567 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21568
21569 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21570 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21571 <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>
21572 !! end
21573
21574 !! test
21575 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21576 !! options
21577 parsoid=html2wt
21578 !! wikitext
21579 <div>a
21580 b
21581 </div>
21582 <div>a
21583 b
21584 </div>
21585 <div>
21586 a
21587
21588 b
21589 </div>
21590 !! html
21591 <div>a<p>b</p></div>
21592 <div>a
21593 <p>b</p></div>
21594 <div>
21595 a
21596 <p>b</p></div>
21597 !! end
21598
21599 !! test
21600 Substrings resembling wikitext in hrefs should not get nowiki escapes
21601 !! options
21602 parsoid=html2wt
21603 !! wikitext
21604 [[Foo''bar''baz]]
21605 !! html
21606 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21607 !! end
21608
21609 #-----------------------------
21610 # I/B quote minimization tests
21611 #-----------------------------
21612
21613 !! test
21614 1. I/B quote minimization: wikitext-only tags should be combined
21615 !! options
21616 parsoid=html2wt
21617 !! wikitext
21618 ''AB''
21619
21620 '''AB'''
21621
21622 ''A'''B'''''
21623
21624 '''A''B'''''
21625
21626 '''A''BC''D'''
21627
21628 '''''AB'''''
21629
21630 '''''AB'''''
21631
21632 '''''AB'''''
21633 !! html
21634 <p><i>A</i><i>B</i></p>
21635 <p><b>A</b><b>B</b></p>
21636 <p><i>A</i><b><i>B</i></b></p>
21637 <p><b>A</b><i><b>B</b></i></p>
21638 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21639 <p><i><b>A</b></i><i><b>B</b></i></p>
21640 <p><i><b>A</b></i><b><i>B</i></b></p>
21641 <p><b><i>A</i></b><i><b>B</b></i></p>
21642 !! end
21643
21644 !! test
21645 2. I/B quote minimization: wikitext and html tags should not be combined
21646 !! options
21647 parsoid=html2wt
21648 !! wikitext
21649 ''A''<i>B</i>
21650
21651 ''A'''''<i>B</i>'''
21652 !! html
21653 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21654 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21655 !! end
21656
21657 !! test
21658 3. I/B quote minimization: templated content stops minimization
21659 !! options
21660 parsoid=html2wt
21661 !! wikitext
21662 ''A''{{echo|''B''}}
21663
21664 ''A''{{echo|'''''B'''''}}
21665 !! html
21666 <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>
21667 <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>
21668 !! end
21669
21670 !! test
21671 4. I/B quote minimization: new content should be mimimized with adjacent old content
21672 !! options
21673 parsoid=html2wt
21674 !! wikitext
21675 ''AB''
21676
21677 '''AB'''
21678
21679 ''A'''B'''''
21680 !! html
21681 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21682 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21683 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21684 !! end
21685
21686 #------------------------------------
21687 # End of I/B quote minimization tests
21688 #------------------------------------
21689
21690 !!test
21691 Bug 54262: New entities
21692 !! options
21693 parsoid=html2wt
21694 !! wikitext
21695 &nbsp;
21696 !! html
21697 <span typeof="mw:Entity">&nbsp;</span>
21698 !! end
21699
21700 ## Note that there is no wikitext output for 'unknownproperty' ##
21701 ## Unknown magic words are silently dropped ##
21702
21703 !! test
21704 Magic words
21705 !! options
21706 parsoid=html2wt
21707 !! wikitext
21708 __TOC__
21709 __NOTOC__
21710 __FORCETOC__
21711 __INDEX__
21712 __NOINDEX__
21713 __NOGALLERY__
21714 __NOEDITSECTION__
21715 __NOTITLECONVERT__
21716 __NOCONTENTCONVERT__
21717 !! html
21718 <meta property='mw:PageProp/toc' />
21719 <meta property='mw:PageProp/notoc' />
21720 <meta property='mw:PageProp/forcetoc' />
21721 <meta property='mw:PageProp/index' />
21722 <meta property='mw:PageProp/noindex' />
21723 <meta property='mw:PageProp/nogallery' />
21724 <meta property='mw:PageProp/noeditsection' />
21725 <meta property='mw:PageProp/notitleconvert' />
21726 <meta property='mw:PageProp/nocontentconvert' />
21727 <meta property='mw:PageProp/unknownproperty' />
21728 !! end
21729
21730 !! test
21731 Consecutive <pre>s should not get merged
21732 !! options
21733 parsoid=html2wt,html2html
21734 !! wikitext
21735 a
21736
21737 b
21738
21739 c
21740
21741 d
21742
21743 e
21744
21745
21746
21747 f
21748 !! html
21749 <pre>a</pre><pre>b</pre>
21750
21751 <pre>c
21752 </pre><pre>
21753 d</pre>
21754
21755 <pre>e
21756
21757 </pre><pre>
21758
21759 f</pre>
21760 !! end
21761
21762 !! test
21763 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21764 !! options
21765 parsoid=html2wt
21766 !! wikitext
21767 [[Special:BookSources/1234567890|ISBN 1234567895]]
21768 !! html
21769 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21770 !! end
21771
21772 !! test
21773 Edited RFC links not serializable as RFC links should serialize as extlinks
21774 !! options
21775 parsoid=html2wt
21776 !! wikitext
21777 [//tools.ietf.org/html/rfc123 New RFC]
21778 !! html
21779 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21780 !! end
21781
21782 !! test
21783 Edited PMID links not serializable as PMID links should serialize as extlinks
21784 !! options
21785 parsoid=html2wt
21786 !! wikitext
21787 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21788 !! html
21789 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21790 !! end
21791
21792 !! test
21793 Edited Redirect link should emit a non-piped wikitext link
21794 !! options
21795 parsoid=html2wt
21796 !! wikitext
21797 #REDIRECT [[Bar]]
21798 !! html
21799 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21800 !! end
21801
21802 # -----------------------------------------------------------------
21803 # End of section for Parsoid-only html2wt tests for serialization
21804 # of new content
21805 # -----------------------------------------------------------------
21806
21807 TODO:
21808 more images
21809 more tables
21810 character entities
21811 and much more
21812 Try for 100% code coverage