Sync up with Parsoid parserTests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well 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 ###
13931 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13932 ###
13933 !! test
13934 Parser hook: empty input
13935 !! wikitext
13936 <tag></tag>
13937 !! html
13938 <pre>
13939 ''
13940 array (
13941 )
13942 </pre>
13943
13944 !! end
13945
13946 !! test
13947 Parser hook: empty input using terminated empty elements
13948 !! wikitext
13949 <tag/>
13950 !! html
13951 <pre>
13952 NULL
13953 array (
13954 )
13955 </pre>
13956
13957 !! end
13958
13959 !! test
13960 Parser hook: empty input using terminated empty elements (space before)
13961 !! wikitext
13962 <tag />
13963 !! html
13964 <pre>
13965 NULL
13966 array (
13967 )
13968 </pre>
13969
13970 !! end
13971
13972 !! test
13973 Parser hook: basic input
13974 !! wikitext
13975 <tag>input</tag>
13976 !! html
13977 <pre>
13978 'input'
13979 array (
13980 )
13981 </pre>
13982
13983 !! end
13984
13985
13986 !! test
13987 Parser hook: case insensitive
13988 !! wikitext
13989 <TAG>input</TAG>
13990 !! html
13991 <pre>
13992 'input'
13993 array (
13994 )
13995 </pre>
13996
13997 !! end
13998
13999
14000 !! test
14001 Parser hook: case insensitive, redux
14002 !! wikitext
14003 <TaG>input</TAg>
14004 !! html
14005 <pre>
14006 'input'
14007 array (
14008 )
14009 </pre>
14010
14011 !! end
14012
14013 !! test
14014 Parser hook: nested tags
14015 !! options
14016 noxml
14017 !! wikitext
14018 <tag><tag></tag></tag>
14019 !! html
14020 <pre>
14021 '<tag>'
14022 array (
14023 )
14024 </pre>&lt;/tag&gt;
14025
14026 !! end
14027
14028 !! test
14029 Parser hook: basic arguments
14030 !! wikitext
14031 <tag width=200 height = "100" depth = '50' square></tag>
14032 !! html
14033 <pre>
14034 ''
14035 array (
14036 'width' => '200',
14037 'height' => '100',
14038 'depth' => '50',
14039 'square' => 'square',
14040 )
14041 </pre>
14042
14043 !! end
14044
14045 !! test
14046 Parser hook: argument containing a forward slash (bug 5344)
14047 !! wikitext
14048 <tag filename='/tmp/bla'></tag>
14049 !! html
14050 <pre>
14051 ''
14052 array (
14053 'filename' => '/tmp/bla',
14054 )
14055 </pre>
14056
14057 !! end
14058
14059 !! test
14060 Parser hook: empty input using terminated empty elements (bug 2374)
14061 !! wikitext
14062 <tag foo=bar/>text
14063 !! html
14064 <pre>
14065 NULL
14066 array (
14067 'foo' => 'bar',
14068 )
14069 </pre>text
14070
14071 !! end
14072
14073 # </tag> should be output literally since there is no matching tag that begins it
14074 !! test
14075 Parser hook: basic arguments using terminated empty elements (bug 2374)
14076 !! wikitext
14077 <tag width=200 height = "100" depth = '50' square/>
14078 other stuff
14079 </tag>
14080 !! html
14081 <pre>
14082 NULL
14083 array (
14084 'width' => '200',
14085 'height' => '100',
14086 'depth' => '50',
14087 'square' => 'square',
14088 )
14089 </pre>
14090 <p>other stuff
14091 &lt;/tag&gt;
14092 </p>
14093 !! end
14094
14095 ###
14096 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14097 ###
14098
14099 !! test
14100 Parser hook: static parser hook not inside a comment
14101 !! wikitext
14102 <statictag>hello, world</statictag>
14103 <statictag action=flush/>
14104 !! html
14105 <p>hello, world
14106 </p>
14107 !! end
14108
14109
14110 !! test
14111 Parser hook: static parser hook inside a comment
14112 !! wikitext
14113 <!-- <statictag>hello, world</statictag> -->
14114 <statictag action=flush/>
14115 !! html
14116 <p><br />
14117 </p>
14118 !! end
14119
14120 # Nested template calls; this case was broken by Parser.php rev 1.506,
14121 # since reverted.
14122
14123 !! article
14124 Template:One-parameter
14125 !! text
14126 (My parameter is: {{{1}}})
14127 !! endarticle
14128
14129 !! article
14130 Template:Map-one-parameter
14131 !! text
14132 {{{{{1}}}|{{{2}}}}}
14133 !! endarticle
14134
14135 !! test
14136 Nested template calls
14137 !! wikitext
14138 {{Map-one-parameter|One-parameter|param}}
14139 !! html
14140 <p>(My parameter is: param)
14141 </p>
14142 !! end
14143
14144
14145 ###
14146 ### Sanitizer
14147 ###
14148 !! test
14149 Sanitizer: Closing of open tags
14150 !! wikitext
14151 <s></s><table></table>
14152 !! html
14153 <s></s><table></table>
14154
14155 !! end
14156
14157 !! test
14158 Sanitizer: Closing of open but not closed tags
14159 !! wikitext
14160 <s>foo
14161 !! html
14162 <p><s>foo</s>
14163 </p>
14164 !! end
14165
14166 !! test
14167 Sanitizer: Closing of closed but not open tags
14168 !! wikitext
14169 </s>
14170 !! html
14171 <p>&lt;/s&gt;
14172 </p>
14173 !! end
14174
14175 !! test
14176 Sanitizer: Closing of closed but not open table tags
14177 !! wikitext
14178 Table not started</td></tr></table>
14179 !! html
14180 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14181 </p>
14182 !! end
14183
14184 !! test
14185 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14186 !! wikitext
14187 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14188 !! html
14189 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14190 </p>
14191 !! end
14192
14193 !! test
14194 Sanitizer: Validating the contents of the id attribute (bug 4515)
14195 !! options
14196 disabled
14197 !! wikitext
14198 <br id=9 />
14199 !! html
14200 Something, but definitely not <br id="9" />...
14201 !! end
14202
14203 !! test
14204 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14205 !! options
14206 disabled
14207 !! wikitext
14208 <br id="foo" /><br id="foo" />
14209 !! html
14210 Something need to be done. foo-2 ?
14211 !! end
14212
14213 !! test
14214 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14215 !! wikitext
14216 <div itemscope>
14217 <meta itemprop="hello" content="world">
14218 <meta http-equiv="refresh" content="5">
14219 <meta itemprop="hello" http-equiv="refresh" content="5">
14220 <link itemprop="hello" href="{{SERVER}}">
14221 <link rel="stylesheet" href="{{SERVER}}">
14222 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14223 </div>
14224 !! html
14225 <div itemscope="itemscope">
14226 <p> <meta itemprop="hello" content="world" />
14227 &lt;meta http-equiv="refresh" content="5"&gt;
14228 <meta itemprop="hello" content="5" />
14229 </p>
14230 <link itemprop="hello" href="http&#58;//example.org" />
14231 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14232 <link itemprop="hello" href="http&#58;//example.org" />
14233 </div>
14234
14235 !! end
14236
14237 !! test
14238 Language converter: output gets cut off unexpectedly (bug 5757)
14239 !! options
14240 language=zh
14241 !! wikitext
14242 this bit is safe: }-
14243
14244 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14245
14246 then we get cut off here: }-
14247
14248 all additional text is vanished
14249 !! html
14250 <p>this bit is safe: }-
14251 </p><p>but if we add a conversion instance: xxx
14252 </p><p>then we get cut off here: }-
14253 </p><p>all additional text is vanished
14254 </p>
14255 !! end
14256
14257 !! test
14258 Self closed html pairs (bug 5487)
14259 !! options
14260 !! wikitext
14261 <center><font id="bug" />Centered text</center>
14262 <div><font id="bug2" />In div text</div>
14263 !! html
14264 <center>&lt;font id="bug" /&gt;Centered text</center>
14265 <div>&lt;font id="bug2" /&gt;In div text</div>
14266
14267 !! end
14268
14269 #
14270 #
14271 #
14272
14273 !! test
14274 Punctuation: nbsp before exclamation
14275 !! wikitext
14276 C'est grave !
14277 !! html
14278 <p>C'est grave&#160;!
14279 </p>
14280 !! end
14281
14282 !! test
14283 Punctuation: CSS !important (bug 11874)
14284 !! wikitext
14285 <div style="width:50% !important">important</div>
14286 !! html
14287 <div style="width:50% !important">important</div>
14288
14289 !!end
14290
14291 !! test
14292 Punctuation: CSS ! important (bug 11874; with space after)
14293 !! wikitext
14294 <div style="width:50% ! important">important</div>
14295 !! html
14296 <div style="width:50% ! important">important</div>
14297
14298 !!end
14299
14300
14301 !! test
14302 HTML bullet list, closed tags (bug 5497)
14303 !! wikitext
14304 <ul>
14305 <li>One</li>
14306 <li>Two</li>
14307 </ul>
14308 !! html
14309 <ul>
14310 <li>One</li>
14311 <li>Two</li>
14312 </ul>
14313
14314 !! end
14315
14316 !! test
14317 HTML bullet list, unclosed tags (bug 5497)
14318 !! options
14319 disabled
14320 !! wikitext
14321 <ul>
14322 <li>One
14323 <li>Two
14324 </ul>
14325 !! html
14326 <ul>
14327 <li>One
14328 </li>
14329 <li>Two
14330 </li>
14331 </ul>
14332
14333 !! end
14334
14335 !! test
14336 HTML ordered list, closed tags (bug 5497)
14337 !! wikitext
14338 <ol>
14339 <li>One</li>
14340 <li>Two</li>
14341 </ol>
14342 !! html
14343 <ol>
14344 <li>One</li>
14345 <li>Two</li>
14346 </ol>
14347
14348 !! end
14349
14350 !! test
14351 HTML ordered list, unclosed tags (bug 5497)
14352 !! options
14353 disabled
14354 !! wikitext
14355 <ol>
14356 <li>One
14357 <li>Two
14358 </ol>
14359 !! html
14360 <ol>
14361 <li>One
14362 </li>
14363 <li>Two
14364 </li>
14365 </ol>
14366
14367 !! end
14368
14369 !! test
14370 HTML nested bullet list, closed tags (bug 5497)
14371 !! wikitext
14372 <ul>
14373 <li>One</li>
14374 <li>Two:
14375 <ul>
14376 <li>Sub-one</li>
14377 <li>Sub-two</li>
14378 </ul>
14379 </li>
14380 </ul>
14381 !! html
14382 <ul>
14383 <li>One</li>
14384 <li>Two:
14385 <ul>
14386 <li>Sub-one</li>
14387 <li>Sub-two</li>
14388 </ul>
14389 </li>
14390 </ul>
14391
14392 !! end
14393
14394 !! test
14395 HTML nested bullet list, open tags (bug 5497)
14396 !! options
14397 disabled
14398 !! wikitext
14399 <ul>
14400 <li>One
14401 <li>Two:
14402 <ul>
14403 <li>Sub-one
14404 <li>Sub-two
14405 </ul>
14406 </ul>
14407 !! html
14408 <ul>
14409 <li>One
14410 </li>
14411 <li>Two:
14412 <ul>
14413 <li>Sub-one
14414 </li>
14415 <li>Sub-two
14416 </li>
14417 </ul>
14418 </li>
14419 </ul>
14420
14421 !! end
14422
14423 !! test
14424 HTML nested ordered list, closed tags (bug 5497)
14425 !! wikitext
14426 <ol>
14427 <li>One</li>
14428 <li>Two:
14429 <ol>
14430 <li>Sub-one</li>
14431 <li>Sub-two</li>
14432 </ol>
14433 </li>
14434 </ol>
14435 !! html
14436 <ol>
14437 <li>One</li>
14438 <li>Two:
14439 <ol>
14440 <li>Sub-one</li>
14441 <li>Sub-two</li>
14442 </ol>
14443 </li>
14444 </ol>
14445
14446 !! end
14447
14448 !! test
14449 HTML nested ordered list, open tags (bug 5497)
14450 !! options
14451 disabled
14452 !! wikitext
14453 <ol>
14454 <li>One
14455 <li>Two:
14456 <ol>
14457 <li>Sub-one
14458 <li>Sub-two
14459 </ol>
14460 </ol>
14461 !! html
14462 <ol>
14463 <li>One
14464 </li>
14465 <li>Two:
14466 <ol>
14467 <li>Sub-one
14468 </li>
14469 <li>Sub-two
14470 </li>
14471 </ol>
14472 </li>
14473 </ol>
14474
14475 !! end
14476
14477 !! test
14478 HTML ordered list item with parameters oddity
14479 !! wikitext
14480 <ol><li id="fragment">One</li>
14481 </ol>
14482 !! html
14483 <ol><li id="fragment">One</li>
14484 </ol>
14485
14486 !! end
14487
14488 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14489 !!test
14490 bug 5918: autonumbering
14491 !! wikitext
14492 [http://first/] [http://second] [ftp://ftp]
14493
14494 ftp://inlineftp
14495
14496 [mailto:enclosed@mail.tld With target]
14497
14498 [mailto:enclosed@mail.tld]
14499
14500 mailto:inline@mail.tld
14501 !! html/php
14502 <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>
14503 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14504 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14505 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14506 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14507 </p>
14508 !! html/parsoid
14509 <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>
14510 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14511 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14512 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14513 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14514 !! end
14515
14516
14517 #
14518 # Security and HTML correctness
14519 # From Nick Jenkins' fuzz testing
14520 #
14521
14522 !! test
14523 Fuzz testing: Parser13
14524 !! wikitext
14525 {|
14526 | http://a|
14527 !! html
14528 <table>
14529 <tr>
14530 <td>
14531 </td>
14532 </tr>
14533 </table>
14534
14535 !! end
14536
14537 !! test
14538 Fuzz testing: Parser14
14539 !! wikitext
14540 == onmouseover= ==
14541 http://__TOC__
14542 !! html
14543 <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>
14544 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14545 <ul>
14546 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14547 </ul>
14548 </div>
14549
14550
14551 !! html+tidy
14552 <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>
14553 <p>http://</p>
14554 <div id="toc" class="toc">
14555 <div id="toctitle">
14556 <h2>Contents</h2>
14557 </div>
14558 <ul>
14559 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14560 </ul>
14561 </div>
14562 !! end
14563
14564 !! test
14565 Fuzz testing: Parser14-table
14566 !! wikitext
14567 ==a==
14568 {| STYLE=__TOC__
14569 !! html
14570 <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>
14571 <table style="&#95;_TOC&#95;_">
14572 <tr><td></td></tr>
14573 </table>
14574
14575 !! html+tidy
14576 <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>
14577 <table style="__TOC__">
14578 <tr>
14579 <td></td>
14580 </tr>
14581 </table>
14582 !! end
14583
14584 # Known to produce bogus xml (extra </td>)
14585 !! test
14586 Fuzz testing: Parser16
14587 !! options
14588 noxml
14589 !! wikitext
14590 {|
14591 !https://||||||
14592 !! html
14593 <table>
14594 <tr>
14595 <th>https://</th>
14596 <th></th>
14597 <th></th>
14598 <th>
14599 </td>
14600 </tr>
14601 </table>
14602
14603 !! html+tidy
14604 <table>
14605 <tr>
14606 <th>https://</th>
14607 <th></th>
14608 <th></th>
14609 <th></th>
14610 </tr>
14611 </table>
14612 !! end
14613
14614 !! test
14615 Fuzz testing: Parser21
14616 !! wikitext
14617 {|
14618 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14619 |
14620 !! html
14621 <table>
14622 <tr>
14623 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14624 </th>
14625 <td>
14626 </td>
14627 </tr>
14628 </table>
14629
14630 !! end
14631
14632 !! test
14633 Fuzz testing: Parser22
14634 !! wikitext
14635 http://===r:::https://b
14636
14637 {|
14638 !! html
14639 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14640 </p>
14641 <table>
14642 <tr><td></td></tr>
14643 </table>
14644
14645 !! end
14646
14647 # Known to produce bad XML for now
14648 !! test
14649 Fuzz testing: Parser24
14650 !! options
14651 noxml
14652 !! wikitext
14653 {|
14654 {{{|
14655 <u CLASS=
14656 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14657 <br style="onmouseover='alert(document.cookie);' " />
14658
14659 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14660 |
14661 !! html
14662 <table>
14663 {{{|
14664 <u class="&#124;">}}}} &gt;
14665 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14666
14667 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14668 <tr>
14669 <td></u>
14670 </td>
14671 </tr>
14672 </table>
14673
14674 !! end
14675
14676 # Note: the current result listed for this is not what the original one was,
14677 # but the original bug was JavaScript injection, which is fixed in any case.
14678 # It's not clear that the original result listed was any more correct than the
14679 # current one. Original result:
14680 # <p>{{{|
14681 # </p>
14682 # <li class="&#124;&#124;">
14683 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14684 !!test
14685 Fuzz testing: Parser25 (bug 6055)
14686 !! wikitext
14687 {{{
14688 |
14689 <LI CLASS=||
14690 >
14691 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14692 !! html
14693 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14694 </p>
14695 !! end
14696
14697 !!test
14698 Fuzz testing: URL adjacent extension (with space, clean)
14699 !! wikitext
14700 http://example.com <nowiki>junk</nowiki>
14701 !! html
14702 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14703 </p>
14704 !!end
14705
14706 !!test
14707 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14708 !! wikitext
14709 http://example.com<nowiki>junk</nowiki>
14710 !! html
14711 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14712 </p>
14713 !!end
14714
14715 !!test
14716 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14717 !! wikitext
14718 http://example.com<pre>junk</pre>
14719 !! html
14720 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14721
14722 !! html+tidy
14723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
14724 <pre>
14725 junk
14726 </pre>
14727 !!end
14728
14729 !!test
14730 Fuzz testing: image with bogus manual thumbnail
14731 !! wikitext
14732 [[Image:foobar.jpg|thumbnail= ]]
14733 !! html/php
14734 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14735
14736 !! html/parsoid
14737 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14738 !!end
14739
14740 !! test
14741 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14742 !! wikitext
14743 <pre dir="&#10;"></pre>
14744 !! html
14745 <pre dir="&#10;"></pre>
14746
14747 !! end
14748
14749 !! test
14750 Parsing optional HTML elements (Bug 6171)
14751 !! options
14752 !! wikitext
14753 <table>
14754 <tr>
14755 <td> Some tabular data</td>
14756 <td> More tabular data ...
14757 <td> And yet som tabular data</td>
14758 </tr>
14759 </table>
14760 !! html
14761 <table>
14762 <tr>
14763 <td> Some tabular data</td>
14764 <td> More tabular data ...
14765 </td><td> And yet som tabular data</td>
14766 </tr>
14767 </table>
14768
14769 !! end
14770
14771 !! test
14772 Correct handling of <td>, <tr> (Bug 6171)
14773 !! options
14774 !! wikitext
14775 <table>
14776 <tr>
14777 <td> Some tabular data</td>
14778 <td> More tabular data ...</td>
14779 <td> And yet som tabular data</td>
14780 </tr>
14781 </table>
14782 !! html
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
14791 !! end
14792
14793
14794 !! test
14795 Parsing crashing regression (fr:JavaScript)
14796 !! wikitext
14797 </body></x>
14798 !! html
14799 <p>&lt;/body&gt;&lt;/x&gt;
14800 </p>
14801 !! end
14802
14803 !! test
14804 Inline wiki vs wiki block nesting
14805 !! wikitext
14806 '''Bold paragraph
14807
14808 New wiki paragraph
14809 !! html
14810 <p><b>Bold paragraph</b>
14811 </p><p>New wiki paragraph
14812 </p>
14813 !! end
14814
14815 !! test
14816 Inline HTML vs wiki block nesting
14817 !! options
14818 disabled
14819 !! wikitext
14820 <b>Bold paragraph
14821
14822 New wiki paragraph
14823 !! html
14824 <p><b>Bold paragraph</b>
14825 </p><p>New wiki paragraph
14826 </p>
14827 !! end
14828
14829 # Original result was this:
14830 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14831 # </p>
14832 # While that might be marginally more intuitive, maybe, the six-apostrophe
14833 # construct is clearly pathological and the result stated here (which is what
14834 # the parser actually does) is about as reasonable as anything.
14835 !!test
14836 Mixing markup for italics and bold
14837 !! options
14838 !! wikitext
14839 '''bold''''''bold''bolditalics'''''
14840 !! html
14841 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14842 </p>
14843 !! end
14844
14845
14846 !! article
14847 Xyzzyx
14848 !! text
14849 Article for special page transclusion test
14850 !! endarticle
14851
14852 !! test
14853 Special page transclusion
14854 !! options
14855 !! wikitext
14856 {{Special:Prefixindex/Xyzzyx}}
14857 !! html
14858 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14859
14860 !! end
14861
14862 !! test
14863 Special page transclusion twice (bug 5021)
14864 !! options
14865 !! wikitext
14866 {{Special:Prefixindex/Xyzzyx}}
14867 {{Special:Prefixindex/Xyzzyx}}
14868 !! html
14869 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14870 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14871
14872 !! end
14873
14874 !! test
14875 Transclusion of default MediaWiki message
14876 !! wikitext
14877 {{MediaWiki:Mainpage}}
14878 !! html
14879 <p>Main Page
14880 </p>
14881 !! end
14882
14883 !! test
14884 Transclusion of nonexistent MediaWiki message
14885 !! wikitext
14886 {{MediaWiki:Mainpagexxx}}
14887 !! html
14888 <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>
14889 </p>
14890 !! end
14891
14892 !! test
14893 Transclusion of MediaWiki message with underscore
14894 !! wikitext
14895 {{MediaWiki:history_short}}
14896 !! html
14897 <p>History
14898 </p>
14899 !! end
14900
14901 !! test
14902 Transclusion of MediaWiki message with space
14903 !! wikitext
14904 {{MediaWiki:history short}}
14905 !! html
14906 <p>History
14907 </p>
14908 !! end
14909
14910 !! test
14911 Invalid header with following text
14912 !! wikitext
14913 = x = y
14914 !! html
14915 <p>= x = y
14916 </p>
14917 !! end
14918
14919
14920 !! test
14921 Section extraction test (section 0)
14922 !! options
14923 section=0
14924 !! wikitext
14925 start
14926 ==a==
14927 ===aa===
14928 ====aaa====
14929 ==b==
14930 ===ba===
14931 ===bb===
14932 ====bba====
14933 ===bc===
14934 ==c==
14935 ===ca===
14936 !! html
14937 start
14938 !! end
14939
14940 !! test
14941 Section extraction test (section 1)
14942 !! options
14943 section=1
14944 !! wikitext
14945 start
14946 ==a==
14947 ===aa===
14948 ====aaa====
14949 ==b==
14950 ===ba===
14951 ===bb===
14952 ====bba====
14953 ===bc===
14954 ==c==
14955 ===ca===
14956 !! html
14957 ==a==
14958 ===aa===
14959 ====aaa====
14960 !! end
14961
14962 !! test
14963 Section extraction test (section 2)
14964 !! options
14965 section=2
14966 !! wikitext
14967 start
14968 ==a==
14969 ===aa===
14970 ====aaa====
14971 ==b==
14972 ===ba===
14973 ===bb===
14974 ====bba====
14975 ===bc===
14976 ==c==
14977 ===ca===
14978 !! html
14979 ===aa===
14980 ====aaa====
14981 !! end
14982
14983 !! test
14984 Section extraction test (section 3)
14985 !! options
14986 section=3
14987 !! wikitext
14988 start
14989 ==a==
14990 ===aa===
14991 ====aaa====
14992 ==b==
14993 ===ba===
14994 ===bb===
14995 ====bba====
14996 ===bc===
14997 ==c==
14998 ===ca===
14999 !! html
15000 ====aaa====
15001 !! end
15002
15003 !! test
15004 Section extraction test (section 4)
15005 !! options
15006 section=4
15007 !! wikitext
15008 start
15009 ==a==
15010 ===aa===
15011 ====aaa====
15012 ==b==
15013 ===ba===
15014 ===bb===
15015 ====bba====
15016 ===bc===
15017 ==c==
15018 ===ca===
15019 !! html
15020 ==b==
15021 ===ba===
15022 ===bb===
15023 ====bba====
15024 ===bc===
15025 !! end
15026
15027 !! test
15028 Section extraction test (section 5)
15029 !! options
15030 section=5
15031 !! wikitext
15032 start
15033 ==a==
15034 ===aa===
15035 ====aaa====
15036 ==b==
15037 ===ba===
15038 ===bb===
15039 ====bba====
15040 ===bc===
15041 ==c==
15042 ===ca===
15043 !! html
15044 ===ba===
15045 !! end
15046
15047 !! test
15048 Section extraction test (section 6)
15049 !! options
15050 section=6
15051 !! wikitext
15052 start
15053 ==a==
15054 ===aa===
15055 ====aaa====
15056 ==b==
15057 ===ba===
15058 ===bb===
15059 ====bba====
15060 ===bc===
15061 ==c==
15062 ===ca===
15063 !! html
15064 ===bb===
15065 ====bba====
15066 !! end
15067
15068 !! test
15069 Section extraction test (section 7)
15070 !! options
15071 section=7
15072 !! wikitext
15073 start
15074 ==a==
15075 ===aa===
15076 ====aaa====
15077 ==b==
15078 ===ba===
15079 ===bb===
15080 ====bba====
15081 ===bc===
15082 ==c==
15083 ===ca===
15084 !! html
15085 ====bba====
15086 !! end
15087
15088 !! test
15089 Section extraction test (section 8)
15090 !! options
15091 section=8
15092 !! wikitext
15093 start
15094 ==a==
15095 ===aa===
15096 ====aaa====
15097 ==b==
15098 ===ba===
15099 ===bb===
15100 ====bba====
15101 ===bc===
15102 ==c==
15103 ===ca===
15104 !! html
15105 ===bc===
15106 !! end
15107
15108 !! test
15109 Section extraction test (section 9)
15110 !! options
15111 section=9
15112 !! wikitext
15113 start
15114 ==a==
15115 ===aa===
15116 ====aaa====
15117 ==b==
15118 ===ba===
15119 ===bb===
15120 ====bba====
15121 ===bc===
15122 ==c==
15123 ===ca===
15124 !! html
15125 ==c==
15126 ===ca===
15127 !! end
15128
15129 !! test
15130 Section extraction test (section 10)
15131 !! options
15132 section=10
15133 !! wikitext
15134 start
15135 ==a==
15136 ===aa===
15137 ====aaa====
15138 ==b==
15139 ===ba===
15140 ===bb===
15141 ====bba====
15142 ===bc===
15143 ==c==
15144 ===ca===
15145 !! html
15146 ===ca===
15147 !! end
15148
15149 !! test
15150 Section extraction test (nonexistent section 11)
15151 !! options
15152 section=11
15153 !! wikitext
15154 start
15155 ==a==
15156 ===aa===
15157 ====aaa====
15158 ==b==
15159 ===ba===
15160 ===bb===
15161 ====bba====
15162 ===bc===
15163 ==c==
15164 ===ca===
15165 !! html
15166 !! end
15167
15168 !! test
15169 Section extraction test with bogus heading (section 1)
15170 !! options
15171 section=1
15172 !! wikitext
15173 ==a==
15174 ==bogus== not a legal section
15175 ==b==
15176 !! html
15177 ==a==
15178 ==bogus== not a legal section
15179 !! end
15180
15181 !! test
15182 Section extraction test with bogus heading (section 2)
15183 !! options
15184 section=2
15185 !! wikitext
15186 ==a==
15187 ==bogus== not a legal section
15188 ==b==
15189 !! html
15190 ==b==
15191 !! end
15192
15193 !! test
15194 Section extraction test with comment after heading (section 1)
15195 !! options
15196 section=1
15197 !! wikitext
15198 ==a==
15199 ==b== <!-- -->
15200 ==c==
15201 !! html
15202 ==a==
15203 !! end
15204
15205 !! test
15206 Section extraction test with comment after heading (section 2)
15207 !! options
15208 section=2
15209 !! wikitext
15210 ==a==
15211 ==b== <!-- -->
15212 ==c==
15213 !! html
15214 ==b== <!-- -->
15215 !! end
15216
15217 !! test
15218 Section extraction test with bogus <nowiki> heading (section 1)
15219 !! options
15220 section=1
15221 !! wikitext
15222 ==a==
15223 ==bogus== <nowiki>not a legal section</nowiki>
15224 ==b==
15225 !! html
15226 ==a==
15227 ==bogus== <nowiki>not a legal section</nowiki>
15228 !! end
15229
15230 !! test
15231 Section extraction test with bogus <nowiki> heading (section 2)
15232 !! options
15233 section=2
15234 !! wikitext
15235 ==a==
15236 ==bogus== <nowiki>not a legal section</nowiki>
15237 ==b==
15238 !! html
15239 ==b==
15240 !! end
15241
15242
15243 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15244 # instead of respecting commented sections
15245 !! test
15246 Section extraction prefixed by comment (section 1)
15247 !! options
15248 section=1
15249 !! wikitext
15250 <!-- -->==sec1==
15251 ==sec2==
15252 !! html
15253 ==sec2==
15254 !!end
15255
15256 !! test
15257 Section extraction prefixed by comment (section 2)
15258 !! options
15259 section=2
15260 !! wikitext
15261 <!-- -->==sec1==
15262 ==sec2==
15263 !! html
15264
15265 !!end
15266
15267
15268 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15269 # instead of respecting HTML-style headings
15270 !! test
15271 Section extraction, mixed wiki and html (section 1)
15272 !! options
15273 section=1
15274 !! wikitext
15275 <h2>unmarked</h2>
15276 unmarked
15277 ==1==
15278 one
15279 ==2==
15280 two
15281 !! html
15282 ==1==
15283 one
15284 !! end
15285
15286 !! test
15287 Section extraction, mixed wiki and html (section 2)
15288 !! options
15289 section=2
15290 !! wikitext
15291 <h2>unmarked</h2>
15292 unmarked
15293 ==1==
15294 one
15295 ==2==
15296 two
15297 !! html
15298 ==2==
15299 two
15300 !! end
15301
15302
15303 # Formerly testing for bug 3342
15304 !! test
15305 Section extraction, heading surrounded by <noinclude>
15306 !! options
15307 section=1
15308 !! wikitext
15309 <noinclude>==unmarked==</noinclude>
15310 ==marked==
15311 !! html
15312 ==marked==
15313 !!end
15314
15315 # Test behavior of bug 19910
15316 !! test
15317 Sectiion with all-equals
15318 !! options
15319 section=2
15320 !! wikitext
15321 ===
15322 The line above must have a trailing space
15323 === <!--
15324 --> <!-- -->
15325 But just in case it doesn't...
15326 !! html
15327 === <!--
15328 --> <!-- -->
15329 But just in case it doesn't...
15330 !! end
15331
15332 !! test
15333 Section replacement test (section 0)
15334 !! options
15335 replace=0,"xxx"
15336 !! wikitext
15337 start
15338 ==a==
15339 ===aa===
15340 ====aaa====
15341 ==b==
15342 ===ba===
15343 ===bb===
15344 ====bba====
15345 ===bc===
15346 ==c==
15347 ===ca===
15348 !! html
15349 xxx
15350
15351 ==a==
15352 ===aa===
15353 ====aaa====
15354 ==b==
15355 ===ba===
15356 ===bb===
15357 ====bba====
15358 ===bc===
15359 ==c==
15360 ===ca===
15361 !! end
15362
15363 !! test
15364 Section replacement test (section 1)
15365 !! options
15366 replace=1,"xxx"
15367 !! wikitext
15368 start
15369 ==a==
15370 ===aa===
15371 ====aaa====
15372 ==b==
15373 ===ba===
15374 ===bb===
15375 ====bba====
15376 ===bc===
15377 ==c==
15378 ===ca===
15379 !! html
15380 start
15381 xxx
15382
15383 ==b==
15384 ===ba===
15385 ===bb===
15386 ====bba====
15387 ===bc===
15388 ==c==
15389 ===ca===
15390 !! end
15391
15392 !! test
15393 Section replacement test (section 2)
15394 !! options
15395 replace=2,"xxx"
15396 !! wikitext
15397 start
15398 ==a==
15399 ===aa===
15400 ====aaa====
15401 ==b==
15402 ===ba===
15403 ===bb===
15404 ====bba====
15405 ===bc===
15406 ==c==
15407 ===ca===
15408 !! html
15409 start
15410 ==a==
15411 xxx
15412
15413 ==b==
15414 ===ba===
15415 ===bb===
15416 ====bba====
15417 ===bc===
15418 ==c==
15419 ===ca===
15420 !! end
15421
15422 !! test
15423 Section replacement test (section 3)
15424 !! options
15425 replace=3,"xxx"
15426 !! wikitext
15427 start
15428 ==a==
15429 ===aa===
15430 ====aaa====
15431 ==b==
15432 ===ba===
15433 ===bb===
15434 ====bba====
15435 ===bc===
15436 ==c==
15437 ===ca===
15438 !! html
15439 start
15440 ==a==
15441 ===aa===
15442 xxx
15443
15444 ==b==
15445 ===ba===
15446 ===bb===
15447 ====bba====
15448 ===bc===
15449 ==c==
15450 ===ca===
15451 !! end
15452
15453 !! test
15454 Section replacement test (section 4)
15455 !! options
15456 replace=4,"xxx"
15457 !! wikitext
15458 start
15459 ==a==
15460 ===aa===
15461 ====aaa====
15462 ==b==
15463 ===ba===
15464 ===bb===
15465 ====bba====
15466 ===bc===
15467 ==c==
15468 ===ca===
15469 !! html
15470 start
15471 ==a==
15472 ===aa===
15473 ====aaa====
15474 xxx
15475
15476 ==c==
15477 ===ca===
15478 !! end
15479
15480 !! test
15481 Section replacement test (section 5)
15482 !! options
15483 replace=5,"xxx"
15484 !! wikitext
15485 start
15486 ==a==
15487 ===aa===
15488 ====aaa====
15489 ==b==
15490 ===ba===
15491 ===bb===
15492 ====bba====
15493 ===bc===
15494 ==c==
15495 ===ca===
15496 !! html
15497 start
15498 ==a==
15499 ===aa===
15500 ====aaa====
15501 ==b==
15502 xxx
15503
15504 ===bb===
15505 ====bba====
15506 ===bc===
15507 ==c==
15508 ===ca===
15509 !! end
15510
15511 !! test
15512 Section replacement test (section 6)
15513 !! options
15514 replace=6,"xxx"
15515 !! wikitext
15516 start
15517 ==a==
15518 ===aa===
15519 ====aaa====
15520 ==b==
15521 ===ba===
15522 ===bb===
15523 ====bba====
15524 ===bc===
15525 ==c==
15526 ===ca===
15527 !! html
15528 start
15529 ==a==
15530 ===aa===
15531 ====aaa====
15532 ==b==
15533 ===ba===
15534 xxx
15535
15536 ===bc===
15537 ==c==
15538 ===ca===
15539 !! end
15540
15541 !! test
15542 Section replacement test (section 7)
15543 !! options
15544 replace=7,"xxx"
15545 !! wikitext
15546 start
15547 ==a==
15548 ===aa===
15549 ====aaa====
15550 ==b==
15551 ===ba===
15552 ===bb===
15553 ====bba====
15554 ===bc===
15555 ==c==
15556 ===ca===
15557 !! html
15558 start
15559 ==a==
15560 ===aa===
15561 ====aaa====
15562 ==b==
15563 ===ba===
15564 ===bb===
15565 xxx
15566
15567 ===bc===
15568 ==c==
15569 ===ca===
15570 !! end
15571
15572 !! test
15573 Section replacement test (section 8)
15574 !! options
15575 replace=8,"xxx"
15576 !! wikitext
15577 start
15578 ==a==
15579 ===aa===
15580 ====aaa====
15581 ==b==
15582 ===ba===
15583 ===bb===
15584 ====bba====
15585 ===bc===
15586 ==c==
15587 ===ca===
15588 !! html
15589 start
15590 ==a==
15591 ===aa===
15592 ====aaa====
15593 ==b==
15594 ===ba===
15595 ===bb===
15596 ====bba====
15597 xxx
15598
15599 ==c==
15600 ===ca===
15601 !!end
15602
15603 !! test
15604 Section replacement test (section 9)
15605 !! options
15606 replace=9,"xxx"
15607 !! wikitext
15608 start
15609 ==a==
15610 ===aa===
15611 ====aaa====
15612 ==b==
15613 ===ba===
15614 ===bb===
15615 ====bba====
15616 ===bc===
15617 ==c==
15618 ===ca===
15619 !! html
15620 start
15621 ==a==
15622 ===aa===
15623 ====aaa====
15624 ==b==
15625 ===ba===
15626 ===bb===
15627 ====bba====
15628 ===bc===
15629 xxx
15630 !! end
15631
15632 !! test
15633 Section replacement test (section 10)
15634 !! options
15635 replace=10,"xxx"
15636 !! wikitext
15637 start
15638 ==a==
15639 ===aa===
15640 ====aaa====
15641 ==b==
15642 ===ba===
15643 ===bb===
15644 ====bba====
15645 ===bc===
15646 ==c==
15647 ===ca===
15648 !! html
15649 start
15650 ==a==
15651 ===aa===
15652 ====aaa====
15653 ==b==
15654 ===ba===
15655 ===bb===
15656 ====bba====
15657 ===bc===
15658 ==c==
15659 xxx
15660 !! end
15661
15662 !! test
15663 Section replacement test with initial whitespace (bug 13728)
15664 !! options
15665 replace=2,"xxx"
15666 !! wikitext
15667 Preformatted initial line
15668 ==a==
15669 ===a===
15670 !! html
15671 Preformatted initial line
15672 ==a==
15673 xxx
15674 !! end
15675
15676
15677 !! test
15678 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15679 !! options
15680 section=1
15681 !! wikitext
15682 ==a==
15683 a
15684 !! html
15685 ==a==
15686 a
15687 !! end
15688
15689 !! test
15690 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15691 !! options
15692 section=1
15693 !! wikitext
15694 ==a==
15695 a
15696 !! html
15697 ==a==
15698 a
15699 !! end
15700
15701
15702 !! test
15703 Section extraction, <pre> around bogus header (bug 10309)
15704 !! options
15705 noxml section=2
15706 !! wikitext
15707 == Section One ==
15708 <pre>
15709 =======
15710 </pre>
15711
15712 == Section Two ==
15713 stuff
15714 !! html
15715 == Section Two ==
15716 stuff
15717 !! end
15718
15719 !! test
15720 Section replacement, <pre> around bogus header (bug 10309)
15721 !! options
15722 noxml replace=2,"xxx"
15723 !! wikitext
15724 == Section One ==
15725 <pre>
15726 =======
15727 </pre>
15728
15729 == Section Two ==
15730 stuff
15731 !! html
15732 == Section One ==
15733 <pre>
15734 =======
15735 </pre>
15736
15737 xxx
15738 !! end
15739
15740
15741
15742 !! test
15743 Handling of &#x0A; in URLs
15744 !! wikitext
15745 ** irc://&#x0A;a
15746 !! html/php
15747 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15748
15749 !! html/parsoid
15750 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15751 a">irc://
15752 a</a></li></ul></li></ul>
15753 !! end
15754
15755 !! test
15756 Handling of %0A in URLs
15757 !! wikitext
15758 ** irc://%0Aa
15759 !! html/php
15760 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15761
15762 !! html/parsoid
15763 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15764 !! end
15765
15766
15767 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15768 !! test
15769 5 quotes, code coverage +1 line
15770 !! options
15771 parsoid=wt2html
15772 !! wikitext
15773 '''''
15774 !! html/php
15775 !! html/parsoid
15776 <p><b><i></i></b></p>
15777 !! end
15778
15779 # same html as previous, but wikitext adjusted to match parsoid html2wt
15780 # note that wt2html and html2html will put the <i> before the <b>
15781 !! test
15782 5 quotes, code coverage +1 line w/ nowiki (1)
15783 !! options
15784 parsoid=wt2wt,html2wt
15785 !! wikitext
15786 '''''<nowiki/>'''''
15787 !! html/php
15788 <p><i></i>
15789 </p>
15790 !! html/parsoid
15791 <p><b><i></i></b></p>
15792 !! end
15793
15794 # same as previous, just swapping the <i> and <b>
15795 !! test
15796 5 quotes, code coverage +1 line w/ nowiki (2)
15797 !! wikitext
15798 '''''<nowiki/>'''''
15799 !! html/php
15800 <p><i></i>
15801 </p>
15802 !! html/parsoid
15803 <p><i><b></b></i></p>
15804 !! end
15805
15806 !! test
15807 Special:Search page linking.
15808 !! wikitext
15809 {{Special:search}}
15810 !! html
15811 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15812 </p>
15813 !! end
15814
15815 !! test
15816 Say the magic word
15817 !! options
15818 title=[[Parser test]]
15819 !! wikitext
15820 * {{PAGENAME}}
15821 * {{PAGENAMEE}}
15822 * {{FULLPAGENAME}}
15823 * {{FULLPAGENAMEE}}
15824 * {{BASEPAGENAME}}
15825 * {{BASEPAGENAMEE}}
15826 * {{SUBPAGENAME}}
15827 * {{SUBPAGENAMEE}}
15828 * {{ROOTPAGENAME}}
15829 * {{ROOTPAGENAMEE}}
15830 * {{TALKPAGENAME}}
15831 * {{TALKPAGENAMEE}}
15832 * {{SUBJECTPAGENAME}}
15833 * {{SUBJECTPAGENAMEE}}
15834 * {{NAMESPACEE}}
15835 * {{NAMESPACE}}
15836 * {{NAMESPACENUMBER}}
15837 * {{TALKSPACE}}
15838 * {{TALKSPACEE}}
15839 * {{SUBJECTSPACE}}
15840 * {{SUBJECTSPACEE}}
15841 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15842 !! html
15843 <ul><li> Parser test</li>
15844 <li> Parser_test</li>
15845 <li> Parser test</li>
15846 <li> Parser_test</li>
15847 <li> Parser test</li>
15848 <li> Parser_test</li>
15849 <li> Parser test</li>
15850 <li> Parser_test</li>
15851 <li> Parser test</li>
15852 <li> Parser_test</li>
15853 <li> Talk:Parser test</li>
15854 <li> Talk:Parser_test</li>
15855 <li> Parser test</li>
15856 <li> Parser_test</li>
15857 <li> </li>
15858 <li> </li>
15859 <li> 0</li>
15860 <li> Talk</li>
15861 <li> Talk</li>
15862 <li> </li>
15863 <li> </li>
15864 <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>
15865
15866 !! end
15867 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15868
15869 !! test
15870 Gallery
15871 !! wikitext
15872 <gallery>
15873 image1.png |
15874 image2.gif|||||
15875
15876 image3|
15877 image4 |300px| centre
15878 image5.svg| http://///////
15879 [[x|xx]]]]
15880 * image6
15881 </gallery>
15882 !! html
15883 <ul class="gallery mw-gallery-traditional">
15884 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15885 <div class="thumb" style="height: 150px;">Image1.png</div>
15886 <div class="gallerytext">
15887 </div>
15888 </div></li>
15889 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15890 <div class="thumb" style="height: 150px;">Image2.gif</div>
15891 <div class="gallerytext">
15892 <p>||||
15893 </p>
15894 </div>
15895 </div></li>
15896 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15897 <div class="thumb" style="height: 150px;">Image3</div>
15898 <div class="gallerytext">
15899 </div>
15900 </div></li>
15901 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15902 <div class="thumb" style="height: 150px;">Image4</div>
15903 <div class="gallerytext">
15904 <p>300px| centre
15905 </p>
15906 </div>
15907 </div></li>
15908 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15909 <div class="thumb" style="height: 150px;">Image5.svg</div>
15910 <div class="gallerytext">
15911 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15912 </p>
15913 </div>
15914 </div></li>
15915 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15916 <div class="thumb" style="height: 150px;">* image6</div>
15917 <div class="gallerytext">
15918 </div>
15919 </div></li>
15920 </ul>
15921
15922 !! end
15923
15924 !! test
15925 Gallery (with options)
15926 !! wikitext
15927 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15928 File:Nonexistant.jpg|caption
15929 File:Nonexistant.jpg
15930 image:foobar.jpg|some '''caption''' [[Main Page]]
15931 image:foobar.jpg
15932 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15933 </gallery>
15934 !! html
15935 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15936 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15937 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15938 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15939 <div class="gallerytext">
15940 <p>caption
15941 </p>
15942 </div>
15943 </div></li>
15944 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15945 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15946 <div class="gallerytext">
15947 </div>
15948 </div></li>
15949 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15950 <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>
15951 <div class="gallerytext">
15952 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15953 </p>
15954 </div>
15955 </div></li>
15956 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15957 <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>
15958 <div class="gallerytext">
15959 </div>
15960 </div></li>
15961 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15962 <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>
15963 <div class="gallerytext">
15964 <p>Blabla|blabla.
15965 </p>
15966 </div>
15967 </div></li>
15968 </ul>
15969
15970 !! end
15971
15972 !! test
15973 Gallery with link that has fragment
15974 !! wikitext
15975 <gallery>
15976 image:foobar.jpg|link=Main_Page
15977 image:foobar.jpg|link=Main_Page#section
15978 image:foobar.jpg|link=Main Page#section|caption
15979 </gallery>
15980 !! html
15981 <ul class="gallery mw-gallery-traditional">
15982 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15983 <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>
15984 <div class="gallerytext">
15985 </div>
15986 </div></li>
15987 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15988 <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>
15989 <div class="gallerytext">
15990 </div>
15991 </div></li>
15992 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15993 <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>
15994 <div class="gallerytext">
15995 <p>caption
15996 </p>
15997 </div>
15998 </div></li>
15999 </ul>
16000
16001 !! end
16002
16003 !! test
16004 Gallery with wikitext inside caption
16005 !! wikitext
16006 <gallery>
16007 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16008 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16009 </gallery>
16010 !! html
16011 <ul class="gallery mw-gallery-traditional">
16012 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16013 <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>
16014 <div class="gallerytext">
16015 <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>
16016 </p>
16017 </div>
16018 </div></li>
16019 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16020 <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>
16021 <div class="gallerytext">
16022 <p>This is a test template
16023 </p>
16024 </div>
16025 </div></li>
16026 </ul>
16027
16028 !! end
16029
16030 !! test
16031 gallery (with showfilename option)
16032 !! wikitext
16033 <gallery showfilename>
16034 File:Nonexistant.jpg|caption
16035 File:Nonexistant.jpg
16036 image:foobar.jpg|some '''caption''' [[Main Page]]
16037 File:Foobar.jpg
16038 </gallery>
16039 !! html
16040 <ul class="gallery mw-gallery-traditional">
16041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16042 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16043 <div class="gallerytext">
16044 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16045 caption
16046 </p>
16047 </div>
16048 </div></li>
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 </p>
16054 </div>
16055 </div></li>
16056 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16057 <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>
16058 <div class="gallerytext">
16059 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16060 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
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="Foobar.jpg" 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 </p>
16069 </div>
16070 </div></li>
16071 </ul>
16072
16073 !! end
16074
16075 !! test
16076 Gallery (with namespace-less filenames)
16077 !! wikitext
16078 <gallery>
16079 File:Nonexistant.jpg
16080 Nonexistant.jpg
16081 image:foobar.jpg
16082 foobar.jpg
16083 </gallery>
16084 !! html
16085 <ul class="gallery mw-gallery-traditional">
16086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16087 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16088 <div class="gallerytext">
16089 </div>
16090 </div></li>
16091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16092 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16093 <div class="gallerytext">
16094 </div>
16095 </div></li>
16096 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16097 <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>
16098 <div class="gallerytext">
16099 </div>
16100 </div></li>
16101 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16102 <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>
16103 <div class="gallerytext">
16104 </div>
16105 </div></li>
16106 </ul>
16107
16108 !! end
16109
16110 !! test
16111 HTML Hex character encoding (spells the word "JavaScript")
16112 !! options
16113 parsoid=wt2html,wt2wt,html2html
16114 !! wikitext
16115 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16116 !! html/php
16117 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16118 </p>
16119 !! html/php+tidy
16120 <p>JavaScript</p>
16121 !! html/parsoid
16122 <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>
16123 !! end
16124
16125 !! test
16126 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16127 !! wikitext
16128 &#xsee;&#XSEE;
16129 !! html/php
16130 <p>&amp;#xsee;&amp;#XSEE;
16131 </p>
16132 !! html/parsoid
16133 <p>&amp;#xsee;&amp;#XSEE;</p>
16134 !! end
16135
16136 !! test
16137 HTML Hex character encoding mixed case
16138 !! options
16139 parsoid=wt2html,wt2wt,html2html
16140 !! wikitext
16141 &#xEE;&#Xee;
16142 !! html/php
16143 <p>&#xee;&#xee;
16144 </p>
16145 !! html/php+tidy
16146 <p>îî</p>
16147 !! html/parsoid
16148 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16149 !! end
16150
16151 !! test
16152 __FORCETOC__ override
16153 !! wikitext
16154 __NEWSECTIONLINK__
16155 __FORCETOC__
16156 !! html
16157 <p><br />
16158 </p>
16159 !! end
16160
16161 !! test
16162 ISBN code coverage
16163 !! wikitext
16164 ISBN 978-0-1234-56&#x20;789
16165 !! html
16166 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16167 </p>
16168 !! html+tidy
16169 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16170 !! end
16171
16172 !! test
16173 ISBN followed by 5 spaces
16174 !! wikitext
16175 ISBN
16176 !! html
16177 <p>ISBN
16178 </p>
16179 !! end
16180
16181 !! test
16182 Double ISBN
16183 !! wikitext
16184 ISBN ISBN 1234567890
16185 !! html
16186 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16187 </p>
16188 !! end
16189
16190 !! test
16191 ISBN with an X
16192 !! wikitext
16193 ISBN 3-462-04561-X
16194 !! html
16195 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16196 </p>
16197 !! end
16198
16199 !! test
16200 ISBN with empty prefix (parsoid test)
16201 !! wikitext
16202 ISBN 1234567890
16203 !! html/parsoid
16204 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16205 !! end
16206
16207 !! test
16208 Bug 22905: <abbr> followed by ISBN followed by </a>
16209 !! wikitext
16210 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16211 !! html
16212 <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>
16213 </p>
16214 !! end
16215
16216 !! test
16217 Double RFC
16218 !! wikitext
16219 RFC RFC 1234
16220 !! html
16221 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16222 </p>
16223 !! end
16224
16225 !! test
16226 Double RFC with a wiki link
16227 !! wikitext
16228 RFC [[RFC 1234]]
16229 !! html
16230 <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>
16231 </p>
16232 !! end
16233
16234 !! test
16235 RFC code coverage
16236 !! wikitext
16237 RFC 983&#x20;987
16238 !! html
16239 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16240 </p>
16241 !! html+tidy
16242 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16243 !! end
16244
16245 !! test
16246 Centre-aligned image
16247 !! wikitext
16248 [[Image:foobar.jpg|centre]]
16249 !! html
16250 <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>
16251
16252 !!end
16253
16254 !! test
16255 None-aligned image
16256 !! wikitext
16257 [[Image:foobar.jpg|none]]
16258 !! html
16259 <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>
16260
16261 !!end
16262
16263 !! test
16264 Width + Height sized image (using px) (height is ignored)
16265 !! wikitext
16266 [[Image:foobar.jpg|640x480px]]
16267 !! html
16268 <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>
16269 </p>
16270 !!end
16271
16272 !! test
16273 Width-sized image (using px, no following whitespace)
16274 !! wikitext
16275 [[Image:foobar.jpg|640px]]
16276 !! html
16277 <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>
16278 </p>
16279 !!end
16280
16281 !! test
16282 Width-sized image (using px, with following whitespace - test regression from r39467)
16283 !! wikitext
16284 [[Image:foobar.jpg|640px ]]
16285 !! html
16286 <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>
16287 </p>
16288 !!end
16289
16290 !! test
16291 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16292 !! wikitext
16293 [[Image:foobar.jpg| 640px]]
16294 !! html
16295 <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>
16296 </p>
16297 !!end
16298
16299 !! test
16300 Image with page parameter
16301 !! options
16302 djvu
16303 !! wikitext
16304 [[File:LoremIpsum.djvu|page=2]]
16305 !! html
16306 <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>
16307 </p>
16308 !! end
16309
16310 !! test
16311 Another italics / bold test
16312 !! wikitext
16313 ''' ''x'
16314 !! html
16315 <pre>'<i> </i>x'
16316 </pre>
16317 !!end
16318
16319 # Note the results may be incorrect, as parserTest output included this:
16320 # XML error: Mismatched tag at byte 6120:
16321 # ...<dd> </dt></dl> </dd...
16322 !! test
16323 dt/dd/dl test
16324 !! options
16325 disabled
16326 !! wikitext
16327 :;;;::
16328 !! html
16329 <dl>
16330 <dd><dl>
16331 <dt><dl>
16332 <dt><dl>
16333 <dt><dl>
16334 <dd><dl>
16335 <dd>
16336 </dd>
16337 </dl>
16338 </dd>
16339 </dl>
16340 </dt>
16341 </dl>
16342 </dt>
16343 </dl>
16344 </dt>
16345 </dl>
16346 </dd>
16347 </dl>
16348
16349 !!end
16350
16351
16352 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16353 !! test
16354 Images with the "|" character in the comment
16355 !! wikitext
16356 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16357 !! html/php
16358 <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>
16359
16360 !! html/parsoid
16361 <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>
16362 !! end
16363
16364 !! test
16365 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16366 !! wikitext
16367 <html><script>alert(1);</script></html>
16368 !! html
16369 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16370 </p>
16371 !! end
16372
16373 !! test
16374 HTML with raw HTML ($wgRawHtml==true)
16375 !! options
16376 wgRawHtml=1
16377 !! wikitext
16378 <html><script>alert(1);</script></html>
16379 !! html
16380 <p><script>alert(1);</script>
16381 </p>
16382 !! end
16383
16384 !! test
16385 Parents of subpages, one level up
16386 !! options
16387 subpage title=[[Subpage test/L1/L2/L3]]
16388 !! wikitext
16389 [[../|L2]]
16390 !! html
16391 <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>
16392 </p>
16393 !! end
16394
16395
16396 !! test
16397 Parents of subpages, one level up, not named
16398 !! options
16399 subpage title=[[Subpage test/L1/L2/L3]]
16400 !! wikitext
16401 [[../]]
16402 !! html
16403 <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>
16404 </p>
16405 !! end
16406
16407
16408
16409 !! test
16410 Parents of subpages, two levels up
16411 !! options
16412 subpage title=[[Subpage test/L1/L2/L3]]
16413 !! wikitext
16414 [[../../|L1]]2
16415
16416 [[../../|L1]]l
16417 !! html
16418 <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
16419 </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>
16420 </p>
16421 !! end
16422
16423 !! test
16424 Parents of subpages, two levels up, without trailing slash or name.
16425 !! options
16426 subpage title=[[Subpage test/L1/L2/L3]]
16427 !! wikitext
16428 [[../..]]
16429 !! html
16430 <p>[[../..]]
16431 </p>
16432 !! end
16433
16434 !! test
16435 Parents of subpages, two levels up, with lots of extra trailing slashes.
16436 !! options
16437 subpage title=[[Subpage test/L1/L2/L3]]
16438 !! wikitext
16439 [[../../////]]
16440 !! html
16441 <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>
16442 </p>
16443 !! end
16444
16445 !! article
16446 Subpage test/L1/L2/L3Sibling
16447 !! text
16448 Sibling article
16449 !! endarticle
16450
16451 !! test
16452 Transclusion of a sibling page (one level up)
16453 !! options
16454 subpage title=[[Subpage test/L1/L2/L3]]
16455 !! wikitext
16456 {{../L3Sibling}}
16457 !! html
16458 <p>Sibling article
16459 </p>
16460 !! end
16461
16462 !! test
16463 Transclusion of a child page
16464 !! options
16465 subpage title=[[Subpage test/L1/L2]]
16466 !! wikitext
16467 {{/L3Sibling}}
16468 !! html
16469 <p>Sibling article
16470 </p>
16471 !! end
16472
16473 !! test
16474 Non-transclusion because of too many up levels
16475 !! options
16476 subpage title=[[Subpage test/L1/L2/L3]]
16477 !! wikitext
16478 {{../../../../More than parent}}
16479 !! html
16480 <p>{{../../../../More than parent}}
16481 </p>
16482 !! end
16483
16484 !! test
16485 Definition list code coverage
16486 !! wikitext
16487 ; title : def
16488 ; title : def
16489 ;title: def
16490 !! html
16491 <dl><dt> title &#160;</dt>
16492 <dd> def</dd>
16493 <dt> title&#160;</dt>
16494 <dd> def</dd>
16495 <dt>title</dt>
16496 <dd> def</dd></dl>
16497
16498 !! end
16499
16500 !! test
16501 Don't fall for the self-closing div
16502 !! wikitext
16503 <div>hello world</div/>
16504 !! html
16505 <div>hello world</div>
16506
16507 !! end
16508
16509 !! test
16510 MSGNW magic word
16511 !! wikitext
16512 {{MSGNW:msg}}
16513 !! html
16514 <p>&#91;&#91;:Template:Msg&#93;&#93;
16515 </p>
16516 !! end
16517
16518 !! test
16519 RAW magic word
16520 !! wikitext
16521 {{RAW:QUERTY}}
16522 !! html
16523 <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>
16524 </p>
16525 !! end
16526
16527 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16528 !! test
16529 Always escape literal '>' in output, not just after '<'
16530 !! wikitext
16531 ><>
16532 !! html
16533 <p>&gt;&lt;&gt;
16534 </p>
16535 !! end
16536
16537 !! test
16538 Template caching
16539 !! wikitext
16540 {{Test}}
16541 {{Test}}
16542 !! html
16543 <p>This is a test template
16544 This is a test template
16545 </p>
16546 !! end
16547
16548
16549 !! article
16550 MediaWiki:Fake
16551 !! text
16552 ==header==
16553 !! endarticle
16554
16555 !! test
16556 Inclusion of !userCanEdit() content
16557 !! wikitext
16558 {{MediaWiki:Fake}}
16559 !! html
16560 <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>
16561
16562 !! end
16563
16564
16565 !! test
16566 Out-of-order TOC heading levels
16567 !! wikitext
16568 ==2==
16569 ======6======
16570 ===3===
16571 =1=
16572 =====5=====
16573 ==2==
16574 !! html
16575 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16576 <ul>
16577 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16578 <ul>
16579 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16580 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16581 </ul>
16582 </li>
16583 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16584 <ul>
16585 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16586 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16587 </ul>
16588 </li>
16589 </ul>
16590 </div>
16591
16592 <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>
16593 <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>
16594 <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>
16595 <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>
16596 <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>
16597 <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>
16598
16599 !! end
16600
16601
16602 !! test
16603 ISBN with a dummy number
16604 !! wikitext
16605 ISBN ---
16606 !! html
16607 <p>ISBN ---
16608 </p>
16609 !! end
16610
16611
16612 !! test
16613 ISBN with space-delimited number
16614 !! wikitext
16615 ISBN 92 9017 032 8
16616 !! html
16617 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16618 </p>
16619 !! end
16620
16621
16622 !! test
16623 ISBN with multiple spaces, no number
16624 !! wikitext
16625 ISBN foo
16626 !! html
16627 <p>ISBN foo
16628 </p>
16629 !! end
16630
16631
16632 !! test
16633 ISBN length
16634 !! wikitext
16635 ISBN 123456789
16636
16637 ISBN 1234567890
16638
16639 ISBN 12345678901
16640 !! html
16641 <p>ISBN 123456789
16642 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16643 </p><p>ISBN 12345678901
16644 </p>
16645 !! end
16646
16647
16648 !! test
16649 ISBN with trailing year (bug 8110)
16650 !! wikitext
16651 ISBN 1-234-56789-0 - 2006
16652
16653 ISBN 1 234 56789 0 - 2006
16654 !! html
16655 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16656 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16657 </p>
16658 !! end
16659
16660
16661 !! test
16662 anchorencode
16663 !! wikitext
16664 {{anchorencode:foo bar©#%n}}
16665 !! html
16666 <p>foo_bar.C2.A9.23.25n
16667 </p>
16668 !! end
16669
16670 !! test
16671 anchorencode trims spaces
16672 !! wikitext
16673 {{anchorencode: __pretty__please__}}
16674 !! html
16675 <p>pretty_please
16676 </p>
16677 !! end
16678
16679 !! test
16680 anchorencode deals with links
16681 !! wikitext
16682 {{anchorencode: [[hello|world]] [[hi]]}}
16683 !! html
16684 <p>world_hi
16685 </p>
16686 !! end
16687
16688 !! test
16689 anchorencode deals with templates
16690 !! wikitext
16691 {{anchorencode: {{Foo}} }}
16692 !! html
16693 <p>FOO
16694 </p>
16695 !! end
16696
16697 !! test
16698 anchorencode encodes like the TOC generator: (bug 18431)
16699 !! wikitext
16700 === _ +:.3A%3A&&amp;]] ===
16701 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16702 __NOEDITSECTION__
16703 !! html
16704 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16705 <p>.2B:.3A.253A.26.26.5D.5D
16706 </p>
16707 !! end
16708
16709 !! test
16710 Bug 6200: blockquotes and paragraph formatting
16711 !! wikitext
16712 <blockquote>
16713 foo
16714 </blockquote>
16715
16716 bar
16717
16718 baz
16719 !! html
16720 <blockquote>
16721 <p>foo
16722 </p>
16723 </blockquote>
16724 <p>bar
16725 </p>
16726 <pre>baz
16727 </pre>
16728 !! end
16729
16730 !! test
16731 Bug 8293: Use of center tag ruins paragraph formatting
16732 !! wikitext
16733 <center>
16734 foo
16735 </center>
16736
16737 bar
16738
16739 baz
16740 !! html
16741 <center>
16742 <p>foo
16743 </p>
16744 </center>
16745 <p>bar
16746 </p>
16747 <pre>baz
16748 </pre>
16749 !! end
16750
16751 !!test
16752 Parsing of overlapping (improperly nested) inline html tags
16753 !! wikitext
16754 <span><s>x</span></s>
16755 !! html/php
16756 <p><span><s>x&lt;/span&gt;</s></span>
16757 </p>
16758 !! html/parsoid
16759 <p><span><s>x</s></span>
16760 </p>
16761 !!end
16762
16763 ###
16764 ### Language variants related tests
16765 ###
16766 !! test
16767 Self-link in language variants
16768 !! options
16769 title=[[Dunav]] language=sr
16770 !! wikitext
16771 Both [[Dunav]] and [[Дунав]] are names for this river.
16772 !! html
16773 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16774 </p>
16775 !!end
16776
16777 !! article
16778 Дуна
16779 !! text
16780 content
16781 !! endarticle
16782
16783 !! test
16784 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16785 !! options
16786 title=[[Duna]] language=sr
16787 !! wikitext
16788 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16789 !! html
16790 <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.
16791 </p>
16792 !! end
16793
16794 !! test
16795 Link to a section of a variant of this title shouldn't be parsed as self-link
16796 !! options
16797 title=[[Duna]] language=sr
16798 !! wikitext
16799 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16800 !! html
16801 <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.
16802 </p>
16803 !! end
16804
16805 !! test
16806 Link to pages in language variants
16807 !! options
16808 language=sr
16809 !! wikitext
16810 Main Page can be written as [[Маин Паге]]
16811 !! html
16812 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16813 </p>
16814 !!end
16815
16816
16817 !! test
16818 Multiple links to pages in language variants
16819 !! options
16820 language=sr
16821 !! wikitext
16822 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16823 !! html
16824 <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>.
16825 </p>
16826 !!end
16827
16828
16829 !! test
16830 Simple template in language variants
16831 !! options
16832 language=sr
16833 !! wikitext
16834 {{тест}}
16835 !! html
16836 <p>This is a test template
16837 </p>
16838 !! end
16839
16840
16841 !! test
16842 Template with explicit namespace in language variants
16843 !! options
16844 language=sr
16845 !! wikitext
16846 {{Template:тест}}
16847 !! html
16848 <p>This is a test template
16849 </p>
16850 !! end
16851
16852
16853 !! test
16854 Basic test for template parameter in language variants
16855 !! options
16856 language=sr
16857 !! wikitext
16858 {{парамтест|param=foo}}
16859 !! html
16860 <p>This is a test template with parameter foo
16861 </p>
16862 !! end
16863
16864
16865 !! test
16866 Simple category in language variants
16867 !! options
16868 language=sr cat
16869 !! wikitext
16870 [[Category:МедиаWики Усер'с Гуиде]]
16871 !! html
16872 <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>
16873 !! end
16874
16875
16876 !! article
16877 Category:分类
16878 !! text
16879 blah
16880 !! endarticle
16881
16882 !! article
16883 Category:分類
16884 !! text
16885 blah
16886 !! endarticle
16887
16888 !! test
16889 Don't convert blue categorylinks to another variant (bug 33210)
16890 !! options
16891 language=zh cat
16892 !! wikitext
16893 [[A]][[Category:分类]]
16894 !! html
16895 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16896 !! end
16897
16898
16899 !! test
16900 Stripping -{}- tags (language variants)
16901 !! options
16902 language=sr
16903 !! wikitext
16904 Latin proverb: -{Ne nuntium necare}-
16905 !! html
16906 <p>Latin proverb: Ne nuntium necare
16907 </p>
16908 !! end
16909
16910
16911 !! test
16912 Prevent conversion with -{}- tags (language variants)
16913 !! options
16914 language=sr variant=sr-ec
16915 !! wikitext
16916 Latinski: -{Ne nuntium necare}-
16917 !! html
16918 <p>Латински: Ne nuntium necare
16919 </p>
16920 !! end
16921
16922
16923 !! test
16924 Prevent conversion of text with -{}- tags (language variants)
16925 !! options
16926 language=sr variant=sr-ec
16927 !! wikitext
16928 Latinski: -{Ne nuntium necare}-
16929 !! html
16930 <p>Латински: Ne nuntium necare
16931 </p>
16932 !! end
16933
16934
16935 !! test
16936 Prevent conversion of links with -{}- tags (language variants)
16937 !! options
16938 language=sr variant=sr-ec
16939 !! wikitext
16940 -{[[Main Page]]}-
16941 !! html
16942 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16943 </p>
16944 !! end
16945
16946
16947 !! test
16948 -{}- tags within headlines (within html for parserConvert())
16949 !! options
16950 language=sr variant=sr-ec
16951 !! wikitext
16952 == -{Naslov}- ==
16953 !! html
16954 <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>
16955
16956 !! end
16957
16958
16959 !! test
16960 Explicit definition of language variant alternatives
16961 !! options
16962 language=zh variant=zh-tw
16963 !! wikitext
16964 -{zh:China;zh-tw:Taiwan}-, not China
16965 !! html
16966 <p>Taiwan, not China
16967 </p>
16968 !! end
16969
16970
16971 !! test
16972 Conversion around HTML tags
16973 !! options
16974 language=sr variant=sr-ec
16975 !! wikitext
16976 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16977 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16978 !! html
16979 <p>
16980 <span title="ЛаCтин">ски</span>
16981 </p>
16982 !! end
16983
16984
16985 !! test
16986 Explicit session-wise language variant mapping (A flag and - flag)
16987 !! options
16988 language=zh variant=zh-tw
16989 !! wikitext
16990 Taiwan is not China.
16991 But -{A|zh:China;zh-tw:Taiwan}- is China,
16992 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16993 and -{China}- is China.
16994 !! html
16995 <p>Taiwan is not China.
16996 But Taiwan is Taiwan,
16997 (This should be stripped!)
16998 and China is China.
16999 </p>
17000 !! end
17001
17002 !! test
17003 Explicit session-wise language variant mapping (H flag for hide)
17004 !! options
17005 language=zh variant=zh-tw
17006 !! wikitext
17007 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17008 Taiwan is China.
17009 !! html
17010 <p>(This should be stripped!)
17011 Taiwan is Taiwan.
17012 </p>
17013 !! end
17014
17015 !! test
17016 Adding explicit conversion rule for title (T flag)
17017 !! options
17018 language=zh variant=zh-tw showtitle
17019 !! wikitext
17020 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17021 !! html
17022 Taiwan
17023 <p>Should be stripped!
17024 </p>
17025 !! end
17026
17027 !! test
17028 Testing that changing the language variant here in the tests actually works
17029 !! options
17030 language=zh variant=zh showtitle
17031 !! wikitext
17032 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17033 !! html
17034 China
17035 <p>Should be stripped!
17036 </p>
17037 !! end
17038
17039 !! test
17040 Recursive conversion of alt and title attrs shouldn't clear converter state
17041 !! options
17042 language=zh variant=zh-cn showtitle
17043 !! wikitext
17044 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17045 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17046 !! html
17047 China
17048 <p>
17049 Should be stripped<span title="Exclamation">!</span>
17050 </p>
17051 !! end
17052
17053 !! test
17054 Bug 24072: more test on conversion rule for title
17055 !! options
17056 language=zh variant=zh-tw showtitle
17057 !! wikitext
17058 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17059 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17060 !! html
17061 Taiwan
17062 <p>This should be stripped!
17063 This won't take interferes with the title rule.
17064 </p>
17065 !! end
17066
17067 !! test
17068 Partly disable title conversion if variant == main language code
17069 !! options
17070 language=zh variant=zh title=[[ZH]] showtitle
17071 !! wikitext
17072 -{T|zh-cn:CN;zh-tw:TW}-
17073 !! html
17074 ZH
17075 <p>
17076 </p>
17077 !! end
17078
17079 !! test
17080 Partly disable title conversion if variant == main language code, more
17081 !! options
17082 language=zh variant=zh title=[[ZH]] showtitle
17083 !! wikitext
17084 -{T|TW}-
17085 !! html
17086 ZH
17087 <p>
17088 </p>
17089 !! end
17090
17091 !! test
17092 Raw output of variant escape tags (R flag)
17093 !! options
17094 language=zh variant=zh-tw
17095 !! wikitext
17096 Raw: -{R|zh:China;zh-tw:Taiwan}-
17097 !! html
17098 <p>Raw: zh:China;zh-tw:Taiwan
17099 </p>
17100 !! end
17101
17102 !! test
17103 Nested using of manual convert syntax
17104 !! options
17105 language=zh variant=zh-hk
17106 !! wikitext
17107 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17108 !! html
17109 <p>Nested: Hello Hong Kong!
17110 </p>
17111 !! end
17112
17113 !! test
17114 Proper conversion of text in external links
17115 !! options
17116 language=sr variant=sr-ec
17117 !! wikitext
17118 http://www.google.com
17119 gopher://www.google.com
17120 [http://www.google.com http://www.google.com]
17121 [gopher://www.google.com gopher://www.google.com]
17122 [https://www.google.com irc://www.google.com]
17123 [ftp://www.google.com www.google.com/ftp://dir]
17124 [//www.google.com www.google.com]
17125 !! html
17126 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17127 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17128 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17129 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17130 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17131 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17132 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17133 </p>
17134 !! end
17135
17136 !! test
17137 Do not convert roman numbers to language variants
17138 !! options
17139 language=sr variant=sr-ec
17140 !! wikitext
17141 Fridrih IV je car.
17142 !! html
17143 <p>Фридрих IV је цар.
17144 </p>
17145 !! end
17146
17147 !! test
17148 Unclosed language converter markup "-{"
17149 !! options
17150 language=sr
17151 !! wikitext
17152 -{T|hello
17153 !! html
17154 <p>-{T|hello
17155 </p>
17156 !! end
17157
17158 !! test
17159 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17160 !! options
17161 language=sr
17162 !! wikitext
17163 -{R|=&gt;}-
17164 !! html
17165 <p>=&gt;
17166 </p>
17167 !!end
17168
17169 !! test
17170 Don't break link parsing if language converter markup is in the caption.
17171 !! options
17172 language=sr variant=sr-ec
17173 !! wikitext
17174 [[Main Page|-{R|main page}-]]
17175 !! html
17176 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17177 </p>
17178 !! end
17179
17180 # This test is currently broken in the PHP parser (bug 52661)
17181 !! test
17182 Don't break image parsing if language converter markup is in the caption.
17183 !! options
17184 language=sr
17185 disabled
17186 !! wikitext
17187 [[File:Foobar.jpg|-{R|caption}-]]
17188 !! html
17189 <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>
17190 </p>
17191 !! end
17192
17193 # This test is currently broken in the PHP parser (bug 52661)
17194 !! test
17195 Don't break list handling if language converter markup is in the item.
17196 !! options
17197 language=zh variant=zh-cn
17198 disabled
17199 !! wikitext
17200 ;-{zh-cn:AAA;zh-tw:BBB}-
17201 !! html
17202 <dl><dt>AAA
17203 </dt></dl>
17204
17205 !! end
17206
17207 # This test is currently broken in the PHP parser (bug 52661)
17208 !! test
17209 Don't break table handling if language converter markup is in the cell.
17210 !! options
17211 language=sr variant=sr-ec
17212 disabled
17213 !! wikitext
17214 {|
17215 |-
17216 | -{R|B}-
17217 |}
17218 !! html
17219 <table>
17220
17221 <tr>
17222 <td> B
17223 </td></tr></table>
17224
17225 !! end
17226
17227 !! test
17228 Bug 529: Uncovered bullet
17229 !! wikitext
17230 * Foo {{bullet}}
17231 !! html
17232 <ul><li> Foo </li>
17233 <li> Bar</li></ul>
17234
17235 !! end
17236
17237 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17238 # Templates in Wikipedia rely on this behavior, as tidy has always been
17239 # enabled there. These tests are normally run *without* tidy, so specify the
17240 # full output here.
17241 # To test realistic parsing behavior, apply a tidy-like transformation to both
17242 # the expected output and your parser's output.
17243 !! test
17244 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17245 !! wikitext
17246 ******* Foo {{bullet}}
17247 !! html
17248 <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>
17249 <li> Bar</li></ul>
17250
17251 !! end
17252
17253 !! test
17254 Bug 529: Uncovered table already at line-start
17255 !! wikitext
17256 x
17257
17258 {{table}}
17259 y
17260 !! html
17261 <p>x
17262 </p>
17263 <table>
17264 <tr>
17265 <td> 1 </td>
17266 <td> 2
17267 </td></tr>
17268 <tr>
17269 <td> 3 </td>
17270 <td> 4
17271 </td></tr></table>
17272 <p>y
17273 </p>
17274 !! end
17275
17276 !! test
17277 Bug 529: Uncovered bullet in parser function result
17278 !! wikitext
17279 * Foo {{lc:{{bullet}} }}
17280 !! html
17281 <ul><li> Foo </li>
17282 <li> bar</li></ul>
17283
17284 !! end
17285
17286 !! test
17287 Bug 5678: Double-parsed template argument
17288 !! wikitext
17289 {{lc:{{{1}}}|hello}}
17290 !! html
17291 <p>{{{1}}}
17292 </p>
17293 !! end
17294
17295 !! test
17296 Bug 5678: Double-parsed template invocation
17297 !! wikitext
17298 {{lc:{{paramtest {{!}} param = hello }} }}
17299 !! html
17300 <p>{{paramtest | param = hello }}
17301 </p>
17302 !! end
17303
17304 !! test
17305 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17306 !! options
17307 language=cs
17308 title=[[Main Page]]
17309 !! wikitext
17310 {{PRVNÍVELKÉ:ěščř}}
17311 {{prvnívelké:ěščř}}
17312 {{PRVNÍMALÉ:ěščř}}
17313 {{prvnímalé:ěščř}}
17314 {{MALÁ:ěščř}}
17315 {{malá:ěščř}}
17316 {{VELKÁ:ěščř}}
17317 {{velká:ěščř}}
17318 !! html
17319 <p>Ěščř
17320 Ěščř
17321 ěščř
17322 ěščř
17323 ěščř
17324 ěščř
17325 ĚŠČŘ
17326 ĚŠČŘ
17327 </p>
17328 !! end
17329
17330 !! test
17331 Morwen/13: Unclosed link followed by heading
17332 !! wikitext
17333 [[link
17334 ==heading==
17335 !! html
17336 <p>[[link
17337 </p>
17338 <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>
17339
17340 !! end
17341
17342 !! test
17343 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17344 !! wikitext
17345 {{foo|
17346 =heading=
17347 !! html
17348 <p>{{foo|
17349 </p>
17350 <h1><span class="mw-headline" id="heading">heading</span></h1>
17351
17352 !! end
17353
17354 !! test
17355 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17356 !! wikitext
17357 {{foo|
17358 ==heading==
17359 !! html
17360 <p>{{foo|
17361 </p>
17362 <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>
17363
17364 !! end
17365
17366 !! test
17367 Tildes in comments
17368 !! options
17369 pst
17370 !! wikitext
17371 <!-- ~~~~ -->
17372 !! html
17373 <!-- ~~~~ -->
17374 !! end
17375
17376 !! test
17377 Paragraphs inside divs (no extra line breaks)
17378 !! wikitext
17379 <div>Line one
17380
17381 Line two</div>
17382 !! html
17383 <div>Line one
17384 Line two</div>
17385
17386 !! end
17387
17388 !! test
17389 Paragraphs inside divs (extra line break on open)
17390 !! wikitext
17391 <div>
17392 Line one
17393
17394 Line two</div>
17395 !! html
17396 <div>
17397 <p>Line one
17398 </p>
17399 Line two</div>
17400
17401 !! end
17402
17403 !! test
17404 Paragraphs inside divs (extra line break on close)
17405 !! wikitext
17406 <div>Line one
17407
17408 Line two
17409 </div>
17410 !! html
17411 <div>Line one
17412 <p>Line two
17413 </p>
17414 </div>
17415
17416 !! end
17417
17418 !! test
17419 Paragraphs inside divs (extra line break on open and close)
17420 !! wikitext
17421 <div>
17422 Line one
17423
17424 Line two
17425 </div>
17426 !! html
17427 <div>
17428 <p>Line one
17429 </p><p>Line two
17430 </p>
17431 </div>
17432
17433 !! end
17434
17435 !! test
17436 Nesting tags, paragraphs on lines which begin with <div>
17437 !! options
17438 disabled
17439 !! wikitext
17440 <div></div><strong>A
17441 B</strong>
17442 !! html
17443 <div></div>
17444 <p><strong>A
17445 B</strong>
17446 </p>
17447 !! end
17448
17449 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17450 !! test
17451 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17452 !! wikitext
17453 <blockquote>Line one
17454
17455 Line two</blockquote>
17456 !! html
17457 <blockquote>Line one
17458 Line two</blockquote>
17459
17460 !! html+tidy
17461 <blockquote>
17462 <p>Line one Line two</p>
17463 </blockquote>
17464 !! end
17465
17466 !! test
17467 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17468 !! wikitext
17469 <blockquote>
17470 Line one
17471
17472 Line two</blockquote>
17473 !! html
17474 <blockquote>
17475 <p>Line one
17476 </p>
17477 Line two</blockquote>
17478
17479 !! html+tidy
17480 <blockquote>
17481 <p>Line one</p>
17482 Line two</blockquote>
17483 !! end
17484
17485 !! test
17486 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17487 !! wikitext
17488 <blockquote>Line one
17489
17490 Line two
17491 </blockquote>
17492 !! html
17493 <blockquote>Line one
17494 <p>Line two
17495 </p>
17496 </blockquote>
17497
17498 !! html+tidy
17499 <blockquote>
17500 <p>Line one</p>
17501 <p>Line two</p>
17502 </blockquote>
17503 !! end
17504
17505 !! test
17506 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17507 !! wikitext
17508 <blockquote>
17509 Line one
17510
17511 Line two
17512 </blockquote>
17513 !! html
17514 <blockquote>
17515 <p>Line one
17516 </p><p>Line two
17517 </p>
17518 </blockquote>
17519
17520 !! html+tidy
17521 <blockquote>
17522 <p>Line one</p>
17523 <p>Line two</p>
17524 </blockquote>
17525 !! end
17526
17527 !! test
17528 Paragraphs inside blockquotes/divs (no extra line breaks)
17529 !! wikitext
17530 <blockquote><div>Line one
17531
17532 Line two</div></blockquote>
17533 !! html
17534 <blockquote><div>Line one
17535 Line two</div></blockquote>
17536
17537 !! end
17538
17539 !! test
17540 Paragraphs inside blockquotes/divs (extra line break on open)
17541 !! wikitext
17542 <blockquote><div>
17543 Line one
17544
17545 Line two</div></blockquote>
17546 !! html
17547 <blockquote><div>
17548 <p>Line one
17549 </p>
17550 Line two</div></blockquote>
17551
17552 !! end
17553
17554 !! test
17555 Paragraphs inside blockquotes/divs (extra line break on close)
17556 !! wikitext
17557 <blockquote><div>Line one
17558
17559 Line two
17560 </div></blockquote>
17561 !! html
17562 <blockquote><div>Line one
17563 <p>Line two
17564 </p>
17565 </div></blockquote>
17566
17567 !! end
17568
17569 !! test
17570 Paragraphs inside blockquotes/divs (extra line break on open and close)
17571 !! wikitext
17572 <blockquote><div>
17573 Line one
17574
17575 Line two
17576 </div></blockquote>
17577 !! html
17578 <blockquote><div>
17579 <p>Line one
17580 </p><p>Line two
17581 </p>
17582 </div></blockquote>
17583
17584 !! end
17585
17586 !! test
17587 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17588 !! options
17589 wgLinkHolderBatchSize=0
17590 !! wikitext
17591 [[meatball:1]]
17592 [[meatball:2]]
17593 [[meatball:3]]
17594 !! html
17595 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17596 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17597 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17598 </p>
17599 !! end
17600
17601 !! test
17602 Free external link invading image caption
17603 !! wikitext
17604 [[Image:Foobar.jpg|thumb|http://x|hello]]
17605 !! html
17606 <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>
17607
17608 !! end
17609
17610 !! test
17611 Bug 15196: localised external link numbers
17612 !! options
17613 language=fa
17614 !! wikitext
17615 [http://en.wikipedia.org/]
17616 !! html/php
17617 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17618 </p>
17619 !! html/parsoid
17620 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17621 !! end
17622
17623 !! test
17624 Multibyte character in padleft
17625 !! wikitext
17626 {{padleft:-Hello|7|Æ}}
17627 !! html
17628 <p>Æ-Hello
17629 </p>
17630 !! end
17631
17632 !! test
17633 Multibyte character in padright
17634 !! wikitext
17635 {{padright:Hello-|7|Æ}}
17636 !! html
17637 <p>Hello-Æ
17638 </p>
17639 !! end
17640
17641 !!test
17642 formatdate parser function
17643 !! wikitext
17644 {{#formatdate:2009-03-24}}
17645 !! html
17646 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17647 </p>
17648 !! end
17649
17650 !!test
17651 formatdate parser function, with default format
17652 !! wikitext
17653 {{#formatdate:2009-03-24|mdy}}
17654 !! html
17655 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17656 </p>
17657 !! end
17658
17659 !! test
17660 Spacing of numbers in formatted dates
17661 !! wikitext
17662 {{#formatdate:January 15}}
17663 !! html
17664 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17665 </p>
17666 !! end
17667
17668 !! test
17669 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
17670 !! options
17671 language=nl title=[[MediaWiki:Common.css]]
17672 !! wikitext
17673 {{#formatdate:2009-03-24|dmy}}
17674 !! html
17675 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17676 </p>
17677 !! end
17678
17679 #
17680 #
17681 #
17682
17683 #
17684 # Edit comments
17685 #
17686
17687 !! test
17688 Edit comment with link
17689 !! options
17690 comment
17691 !! wikitext
17692 I like the [[Main Page]] a lot
17693 !! html
17694 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17695 !!end
17696
17697 !! test
17698 Edit comment with link and link text
17699 !! options
17700 comment
17701 !! wikitext
17702 I like the [[Main Page|best pages]] a lot
17703 !! html
17704 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17705 !!end
17706
17707 !! test
17708 Edit comment with link and link text with suffix
17709 !! options
17710 comment
17711 !! wikitext
17712 I like the [[Main Page|best page]]s a lot
17713 !! html
17714 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17715 !!end
17716
17717 !! test
17718 Edit comment with section link (non-local, eg in history list)
17719 !! options
17720 comment title=[[Main Page]]
17721 !! wikitext
17722 /* External links */ removed bogus entries
17723 !! html
17724 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17725 !!end
17726
17727 !! test
17728 Edit comment with section link and text before it (non-local, eg in history list)
17729 !! options
17730 comment title=[[Main Page]]
17731 !! wikitext
17732 pre-comment text /* External links */ removed bogus entries
17733 !! html
17734 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>
17735 !!end
17736
17737 !! test
17738 Edit comment with section link (local, eg in diff view)
17739 !! options
17740 comment local title=[[Main Page]]
17741 !! wikitext
17742 /* External links */ removed bogus entries
17743 !! html
17744 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17745 !!end
17746
17747 !! test
17748 Edit comment with subpage link (bug 14080)
17749 !! options
17750 comment
17751 subpage
17752 title=[[Subpage test]]
17753 !! wikitext
17754 Poked at a [[/subpage]] here...
17755 !! html
17756 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17757 !!end
17758
17759 !! test
17760 Edit comment with subpage link and link text (bug 14080)
17761 !! options
17762 comment
17763 subpage
17764 title=[[Subpage test]]
17765 !! wikitext
17766 Poked at a [[/subpage|neat little page]] here...
17767 !! html
17768 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17769 !!end
17770
17771 !! test
17772 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17773 !! options
17774 comment
17775 title=[[Subpage test]]
17776 !! wikitext
17777 Poked at a [[/subpage]] here...
17778 !! html
17779 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...
17780 !!end
17781
17782 !! test
17783 Edit comment with bare anchor link (local, as on diff)
17784 !! options
17785 comment
17786 local
17787 title=[[Main Page]]
17788 !! wikitext
17789 [[#section]]
17790 !! html
17791 <a href="#section">#section</a>
17792 !! end
17793
17794 !! test
17795 Edit comment with bare anchor link (non-local, as on history)
17796 !! options
17797 comment
17798 title=[[Main Page]]
17799 !! wikitext
17800 [[#section]]
17801 !! html
17802 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17803 !! end
17804
17805 !! test
17806 Anchor starting with underscore
17807 !! wikitext
17808 [[#_ref|One]]
17809 !! html
17810 <p><a href="#_ref">One</a>
17811 </p>
17812 !! end
17813
17814 !! test
17815 Id starting with underscore
17816 !! wikitext
17817 <div id="_ref"></div>
17818 !! html
17819 <div id="_ref"></div>
17820
17821 !! end
17822
17823 !! test
17824 Space normalisation on autocomment (bug 22784)
17825 !! options
17826 comment
17827 title=[[Main Page]]
17828 !! wikitext
17829 /* __hello__world__ */
17830 !! html
17831 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17832 !! end
17833
17834 !! test
17835 percent-encoding and + signs in comments (Bug 26410)
17836 !! options
17837 comment
17838 !! wikitext
17839 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17840 !! html
17841 <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>
17842 !! end
17843
17844 !! test
17845 Bad images - basic functionality
17846 !! options
17847 disabled
17848 !! wikitext
17849 [[File:Bad.jpg]]
17850 !! html
17851 !! end
17852
17853 !! test
17854 Bad images - bug 16039: text after bad image disappears
17855 !! options
17856 disabled
17857 !! wikitext
17858 Foo bar
17859 [[File:Bad.jpg]]
17860 Bar foo
17861 !! html
17862 <p>Foo bar
17863 </p><p>Bar foo
17864 </p>
17865 !! end
17866
17867 !! test
17868 Verify that displaytitle works (bug #22501) no displaytitle
17869 !! options
17870 showtitle
17871 !! config
17872 wgAllowDisplayTitle=true
17873 wgRestrictDisplayTitle=false
17874 !! wikitext
17875 this is not the the title
17876 !! html
17877 Parser test
17878 <p>this is not the the title
17879 </p>
17880 !! end
17881
17882 !! test
17883 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17884 !! options
17885 showtitle
17886 title=[[Screen]]
17887 !! config
17888 wgAllowDisplayTitle=true
17889 wgRestrictDisplayTitle=false
17890 !! wikitext
17891 this is not the the title
17892 {{DISPLAYTITLE:whatever}}
17893 !! html
17894 whatever
17895 <p>this is not the the title
17896 </p>
17897 !! end
17898
17899 !! test
17900 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17901 !! options
17902 showtitle
17903 title=[[Screen]]
17904 !! config
17905 wgAllowDisplayTitle=true
17906 wgRestrictDisplayTitle=true
17907 !! wikitext
17908 this is not the the title
17909 {{DISPLAYTITLE:whatever}}
17910 !! html
17911 Screen
17912 <p>this is not the the title
17913 </p>
17914 !! end
17915
17916 !! test
17917 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17918 !! options
17919 showtitle
17920 title=[[Screen]]
17921 !! config
17922 wgAllowDisplayTitle=true
17923 wgRestrictDisplayTitle=true
17924 !! wikitext
17925 this is not the the title
17926 {{DISPLAYTITLE:screen}}
17927 !! html
17928 screen
17929 <p>this is not the the title
17930 </p>
17931 !! end
17932
17933 !! test
17934 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17935 !! options
17936 showtitle
17937 title=[[Screen]]
17938 !! config
17939 wgAllowDisplayTitle=false
17940 !! wikitext
17941 this is not the the title
17942 {{DISPLAYTITLE:screen}}
17943 !! html
17944 Screen
17945 <p>this is not the the title
17946 <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>
17947 </p>
17948 !! end
17949
17950 !! test
17951 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17952 !! options
17953 showtitle
17954 title=[[Screen]]
17955 !! config
17956 wgAllowDisplayTitle=false
17957 !! wikitext
17958 this is not the the title
17959 !! html
17960 Screen
17961 <p>this is not the the title
17962 </p>
17963 !! end
17964
17965 !! test
17966 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17967 !! options
17968 showtitle
17969 title=[[Screen]]
17970 !! config
17971 wgAllowDisplayTitle=true
17972 wgRestrictDisplayTitle=true
17973 !! wikitext
17974 this is not the the title
17975 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17976 !! html
17977 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17978 <p>this is not the the title
17979 </p>
17980 !! end
17981
17982 !! test
17983 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17984 !! options
17985 showtitle
17986 title=[[Screen]]
17987 !! config
17988 wgAllowDisplayTitle=true
17989 wgRestrictDisplayTitle=true
17990 !! wikitext
17991 this is not the the title
17992 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17993 !! html
17994 <span style="color: red;">s</span>creen
17995 <p>this is not the the title
17996 </p>
17997 !! end
17998
17999 !! test
18000 preload: check <noinclude> and <includeonly>
18001 !! options
18002 preload
18003 !! wikitext
18004 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18005 !! html
18006 Hello kind world.
18007 !! end
18008
18009 !! test
18010 preload: check <onlyinclude>
18011 !! options
18012 preload
18013 !! wikitext
18014 Goodbye <onlyinclude>Hello world</onlyinclude>
18015 !! html
18016 Hello world
18017 !! end
18018
18019 !! test
18020 preload: can pass tags through if we want to
18021 !! options
18022 preload
18023 !! wikitext
18024 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18025 !! html
18026 <includeonly>Hello world</includeonly>
18027 !! end
18028
18029 !! test
18030 preload: check that it doesn't try to do tricks
18031 !! options
18032 preload
18033 !! wikitext
18034 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18035 !! html
18036 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18037 !! end
18038
18039 !! test
18040 Play a bit with r67090 and bug 3158
18041 !! options
18042 disabled
18043 !! wikitext
18044 <div style="width:50% !important">&nbsp;</div>
18045 <div style="width:50%&nbsp;!important">&nbsp;</div>
18046 <div style="width:50%&#160;!important">&nbsp;</div>
18047 <div style="border : solid;">&nbsp;</div>
18048 !! html
18049 <div style="width:50% !important">&nbsp;</div>
18050 <div style="width:50% !important">&nbsp;</div>
18051 <div style="width:50% !important">&nbsp;</div>
18052 <div style="border&#160;: solid;">&nbsp;</div>
18053
18054 !! end
18055
18056 !! test
18057 HTML5 data attributes
18058 !! wikitext
18059 <span data-foo="bar">Baz</span>
18060 <p data-abc-def_hij="">Quuz</p>
18061 !! html
18062 <p><span data-foo="bar">Baz</span>
18063 </p>
18064 <p data-abc-def_hij="">Quuz</p>
18065
18066 !! end
18067
18068 !! test
18069 percent-encoding and + signs in internal links (Bug 26410)
18070 !! wikitext
18071 [[User:+%]] [[Page+title%]]
18072 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18073 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18074 [[%33%45]] [[%33%45+]]
18075 !! html
18076 <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>
18077 <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>
18078 <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>
18079 <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>
18080 </p>
18081 !! end
18082
18083 !! test
18084 Special characters in embedded file links (bug 27679)
18085 !! wikitext
18086 [[File:Contains & ampersand.jpg]]
18087 [[File:Does not exist.jpg|Title with & ampersand]]
18088 !! html
18089 <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>
18090 <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>
18091 </p>
18092 !! end
18093
18094
18095 !! test
18096 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18097 !! wikitext
18098 Text&apos;s been normalized?
18099 !! html
18100 <p>Text&#39;s been normalized?
18101 </p>
18102 !! end
18103
18104 !! test
18105 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18106 !! wikitext
18107 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18108 !! html
18109 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18110 </p>
18111 !! end
18112
18113 !! test
18114 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18115 !! wikitext
18116 [http://www.example.org/ ideograms]
18117 !! html
18118 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18119 </p>
18120 !! end
18121
18122 !! test
18123 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18124 !! wikitext
18125 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18126 !! html
18127 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18128 </p>
18129 !! end
18130
18131 !! article
18132 Mediawiki:loop1
18133 !! text
18134 {{Identical|A}}
18135 !! endarticle
18136
18137 !! article
18138 Mediawiki:loop2
18139 !! text
18140 {{Identical|B}}
18141 !! endarticle
18142
18143 !! article
18144 Template:Identical
18145 !! text
18146 {{int:loop1}}
18147 {{int:loop2}}
18148 !! endarticle
18149
18150 !! test
18151 Bug 31098 Template which includes system messages which includes the template
18152 !! wikitext
18153 {{Identical}}
18154 !! html
18155 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18156 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18157 </p>
18158 !! end
18159
18160 !! test
18161 Bug31490 Turkish: ucfirst 'blah'
18162 !! options
18163 language=tr
18164 !! wikitext
18165 {{ucfirst:blah}}
18166 !! html
18167 <p>Blah
18168 </p>
18169 !! end
18170
18171 !! test
18172 Bug31490 Turkish: ucfirst 'ix'
18173 !! options
18174 language=tr
18175 !! wikitext
18176 {{ucfirst:ix}}
18177 !! html
18178 <p>İx
18179 </p>
18180 !! end
18181
18182 !! test
18183 Bug31490 Turkish: lcfirst 'BLAH'
18184 !! options
18185 language=tr
18186 !! wikitext
18187 {{lcfirst:BLAH}}
18188 !! html
18189 <p>bLAH
18190 </p>
18191 !! end
18192
18193 !! test
18194 Bug31490 Turkish: ucfırst (with a dotless i)
18195 !! options
18196 language=tr
18197 !! wikitext
18198 {{ucfırst:blah}}
18199 !! html
18200 <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>
18201 </p>
18202 !! end
18203
18204 !! test
18205 Bug31490 ucfırst (with a dotless i) with English language
18206 !! options
18207 language=en
18208 !! wikitext
18209 {{ucfırst:blah}}
18210 !! html
18211 <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>
18212 </p>
18213 !! end
18214
18215 !! test
18216 Bug 26375: TOC with italics
18217 !! options
18218 title=[[Main Page]]
18219 !! wikitext
18220 __TOC__
18221 == ''Lost'' episodes ==
18222 !! html
18223 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18224 <ul>
18225 <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>
18226 </ul>
18227 </div>
18228
18229 <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>
18230
18231 !! end
18232
18233 !! test
18234 Bug 26375: TOC with bold
18235 !! options
18236 title=[[Main Page]]
18237 !! wikitext
18238 __TOC__
18239 == '''should be bold''' then normal text ==
18240 !! html
18241 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18242 <ul>
18243 <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>
18244 </ul>
18245 </div>
18246
18247 <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>
18248
18249 !! end
18250
18251 !! test
18252 Bug 33845: Headings become cursive in TOC when they contain an image
18253 !! options
18254 title=[[Main Page]]
18255 !! wikitext
18256 __TOC__
18257 == Image [[Image:foobar.jpg]] ==
18258 !! html
18259 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18260 <ul>
18261 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18262 </ul>
18263 </div>
18264
18265 <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>
18266
18267 !! end
18268
18269 !! test
18270 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18271 !! options
18272 title=[[Main Page]]
18273 !! wikitext
18274 __TOC__
18275 == <blockquote>Quote</blockquote> ==
18276 !! html
18277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18278 <ul>
18279 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18280 </ul>
18281 </div>
18282
18283 <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>
18284
18285 !! html+tidy
18286 <div id="toc" class="toc">
18287 <div id="toctitle">
18288 <h2>Contents</h2>
18289 </div>
18290 <ul>
18291 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18292 </ul>
18293 </div>
18294 <h2><span class="mw-headline" id="Quote"></span></h2>
18295 <blockquote>
18296 <p><span class="mw-headline" id="Quote">Quote</span></p>
18297 </blockquote>
18298 <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>
18299 !! end
18300
18301 !! test
18302 Unclosed tags in TOC
18303 !! options
18304 title=[[Main Page]]
18305 !! wikitext
18306 __TOC__
18307 == Proof: 2 < 3 ==
18308 <small>Hanc marginis exiguitas non caperet.</small>
18309 QED
18310 !! html
18311 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18312 <ul>
18313 <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>
18314 </ul>
18315 </div>
18316
18317 <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>
18318 <p><small>Hanc marginis exiguitas non caperet.</small>
18319 QED
18320 </p>
18321 !! end
18322
18323 !! test
18324 Multiple tags in TOC
18325 !! wikitext
18326 __TOC__
18327 == <i>Foo</i> <b>Bar</b> ==
18328
18329 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18330 !! html
18331 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18332 <ul>
18333 <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>
18334 <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>
18335 </ul>
18336 </div>
18337
18338 <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>
18339 <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>
18340
18341 !! html+tidy
18342 <div id="toc" class="toc">
18343 <div id="toctitle">
18344 <h2>Contents</h2>
18345 </div>
18346 <ul>
18347 <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>
18348 <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>
18349 </ul>
18350 </div>
18351 <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>
18352 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18353 <blockquote>
18354 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18355 </blockquote>
18356 <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>
18357 !! end
18358
18359 !! test
18360 Tags with parameters in TOC
18361 !! wikitext
18362 __TOC__
18363 == <sup class="in-h2">Hello</sup> ==
18364
18365 == <sup class="a > b">Evilbye</sup> ==
18366 !! html
18367 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18368 <ul>
18369 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18370 <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>
18371 </ul>
18372 </div>
18373
18374 <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>
18375 <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>
18376
18377 !! end
18378
18379 !! test
18380 span tags with directionality in TOC
18381 !! wikitext
18382 __TOC__
18383 == <span dir="ltr">C++</span> ==
18384
18385 == <span dir="rtl">זבנג!</span> ==
18386
18387 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18388
18389 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18390
18391 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18392 !! html
18393 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18394 <ul>
18395 <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>
18396 <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>
18397 <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>
18398 <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>
18399 <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>
18400 </ul>
18401 </div>
18402
18403 <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>
18404 <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>
18405 <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>
18406 <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>
18407 <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>
18408
18409 !! end
18410
18411 !! article
18412 MediaWiki:Bug32057
18413 !! text
18414 == {{int:headline_sample}} ==
18415 !! endarticle
18416
18417 !! test
18418 Bug 32057: Title needed when expanding <h> nodes.
18419 !! options
18420 title=[[Main Page]]
18421 !! wikitext
18422 {{int:Bug32057}}
18423 !! html
18424 <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>
18425
18426 !! end
18427
18428 !! test
18429 Strip marker in urlencode
18430 !! wikitext
18431 {{urlencode:x<nowiki/>y}}
18432 {{urlencode:x<nowiki/>y|wiki}}
18433 {{urlencode:x<nowiki/>y|path}}
18434 !! html
18435 <p>xy
18436 xy
18437 xy
18438 </p>
18439 !! end
18440
18441 !! test
18442 Strip marker in lc
18443 !! wikitext
18444 {{lc:x<nowiki/>y}}
18445 !! html
18446 <p>xy
18447 </p>
18448 !! end
18449
18450 !! test
18451 Strip marker in uc
18452 !! wikitext
18453 {{uc:x<nowiki/>y}}
18454 !! html
18455 <p>XY
18456 </p>
18457 !! end
18458
18459 !! test
18460 Strip marker in formatNum
18461 !! wikitext
18462 {{formatnum:1<nowiki/>2}}
18463 {{formatnum:1<nowiki/>2|R}}
18464 !! html
18465 <p>12
18466 12
18467 </p>
18468 !! end
18469
18470 !! test
18471 Check noCommafy in formatNum
18472 !! options
18473 language=be-tarask
18474 !! wikitext
18475 {{formatnum:123456.78}}
18476 {{formatnum:123456.78|NOSEP}}
18477 !! html
18478 <p>123 456,78
18479 123456.78
18480 </p>
18481 !! end
18482
18483 !! test
18484 Wrong option for formatNum (bug 56199)
18485 !! wikitext
18486 {{formatnum:1,234.56|Random}}
18487 {{formatnum:1,234.56|EVERYTHING}}
18488 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18489 !! html
18490 <p>1,234.56
18491 1,234.56
18492 1,234.56
18493 </p>
18494 !! end
18495
18496 !! test
18497 Strip marker in grammar
18498 !! options
18499 language=fi
18500 !! wikitext
18501 {{grammar:elative|foo<nowiki/>bar}}
18502 !! html
18503 <p>foobarista
18504 </p>
18505 !! end
18506
18507 !! test
18508 Strip marker in padleft
18509 !! wikitext
18510 {{padleft:|2|x<nowiki/>y}}
18511 !! html
18512 <p>xy
18513 </p>
18514 !! end
18515
18516 !! test
18517 Strip marker in padright
18518 !! wikitext
18519 {{padright:|2|x<nowiki/>y}}
18520 !! html
18521 <p>xy
18522 </p>
18523 !! end
18524
18525 !! test
18526 Strip marker in anchorencode
18527 !! wikitext
18528 {{anchorencode:x<nowiki/>y}}
18529 !! html
18530 <p>xy
18531 </p>
18532 !! end
18533
18534 !! test
18535 nowiki inside link inside heading (bug 18295)
18536 !! wikitext
18537 ==[[foo|x<nowiki>y</nowiki>z]]==
18538 !! html
18539 <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>
18540
18541 !! end
18542
18543 !! test
18544 new support for bdi element (bug 31817)
18545 !! wikitext
18546 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18547 !! html
18548 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18549
18550 !!end
18551
18552 !! test
18553 Ignore pipe between table row attributes
18554 !! wikitext
18555 {|
18556 | quux
18557 |- id=foo | style='color: red'
18558 | bar
18559 |}
18560 !! html
18561 <table>
18562 <tr>
18563 <td> quux
18564 </td></tr>
18565 <tr id="foo" style="color: red">
18566 <td> bar
18567 </td></tr></table>
18568
18569 !! end
18570
18571 !!test
18572 Gallery override link with WikiLink (bug 34852)
18573 !! wikitext
18574 <gallery>
18575 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18576 </gallery>
18577 !! html
18578 <ul class="gallery mw-gallery-traditional">
18579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18580 <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>
18581 <div class="gallerytext">
18582 <p>caption
18583 </p>
18584 </div>
18585 </div></li>
18586 </ul>
18587
18588 !! end
18589
18590 !!test
18591 Gallery override link with absolute external link (bug 34852)
18592 !! wikitext
18593 <gallery>
18594 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18595 </gallery>
18596 !! html
18597 <ul class="gallery mw-gallery-traditional">
18598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18599 <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>
18600 <div class="gallerytext">
18601 <p>caption
18602 </p>
18603 </div>
18604 </div></li>
18605 </ul>
18606
18607 !! end
18608
18609 !!test
18610 Gallery override link with malicious javascript (bug 34852)
18611 !! wikitext
18612 <gallery>
18613 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18614 </gallery>
18615 !! html
18616 <ul class="gallery mw-gallery-traditional">
18617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18618 <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>
18619 <div class="gallerytext">
18620 <p>caption
18621 </p>
18622 </div>
18623 </div></li>
18624 </ul>
18625
18626 !! end
18627
18628 !!test
18629 Gallery with invalid title as link (bug 43964)
18630 !! wikitext
18631 <gallery>
18632 File:foobar.jpg|link=<
18633 </gallery>
18634 !! html
18635 <ul class="gallery mw-gallery-traditional">
18636 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18637 <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>
18638 <div class="gallerytext">
18639 </div>
18640 </div></li>
18641 </ul>
18642
18643 !! end
18644
18645 !!test
18646 Language parser function
18647 !! wikitext
18648 {{#language:ar}}
18649 !! html
18650 <p>العربية
18651 </p>
18652 !! end
18653
18654 !!test
18655 Padleft and padright as substr
18656 !! wikitext
18657 {{padleft:|3|abcde}}
18658 {{padright:|3|abcde}}
18659 !! html
18660 <p>abc
18661 abc
18662 </p>
18663 !! end
18664
18665 !!test
18666 Special parser function
18667 !! wikitext
18668 {{#special:RandomPage}}
18669 {{#special:BaDtItLe}}
18670 {{#special:Foobar}}
18671 !! html
18672 <p>Special:Random
18673 Special:Badtitle
18674 Special:Foobar
18675 </p>
18676 !! end
18677
18678 !!test
18679 Bug 34939 - Case insensitive link parsing ([HttP://])
18680 !! wikitext
18681 [HttP://MediaWiki.Org/]
18682 !! html/php
18683 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18684 </p>
18685 !! html/parsoid
18686 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18687 !! end
18688
18689 !!test
18690 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18691 !! wikitext
18692 [HttP://MediaWiki.Org/ MediaWiki]
18693 !! html
18694 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18695 </p>
18696 !! end
18697
18698 !!test
18699 Bug 34939 - Case insensitive link parsing (HttP://)
18700 !! wikitext
18701 HttP://MediaWiki.Org/
18702 !! html/php
18703 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18704 </p>
18705 !! html/parsoid
18706 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18707 !! end
18708
18709 !!test
18710 Disable TOC
18711 !! options
18712 notoc
18713 !! wikitext
18714 Lead
18715 == Section 1 ==
18716 == Section 2 ==
18717 == Section 3 ==
18718 == Section 4 ==
18719 == Section 5 ==
18720 !! html
18721 <p>Lead
18722 </p>
18723
18724 <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>
18725 <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>
18726 <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>
18727 <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>
18728 <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>
18729
18730 !! end
18731
18732
18733 ###
18734 ### Parsoid-specific tests
18735 ### Parsoid-PHP parser incompatibilities
18736 ###
18737 !!test
18738 1. SOL-sensitive wikitext tokens as template-args
18739 !!options
18740 parsoid=wt2html,wt2wt
18741 !! wikitext
18742 {{echo|*a}}
18743 {{echo|#a}}
18744 {{echo|:a}}
18745 !! html
18746 <span about="#mwt1" typeof="mw:Transclusion">
18747 </span><ul about="#mwt1"><li>a</li>
18748 </ul>
18749 <span about="#mwt2" typeof="mw:Transclusion">
18750 </span><ol about="#mwt2"><li>a</li>
18751 </ol>
18752 <span about="#mwt3" typeof="mw:Transclusion">
18753 </span><dl about="#mwt3"><dd>a</dd>
18754 </dl>
18755 !!end
18756
18757 #### -----------------------------------------------------------------
18758 #### Parsoid-specific functionality tests
18759 #### -----------------------------------------------------------------
18760
18761 # Bug 63642: Formatting elt fixup is cleaned up.
18762 # We know wt2wt will fail, but we expect selser to pass.
18763 # Due to the nature of our testing, wt2wt and selser tests will enter the
18764 # blacklist and we'll catch selser regressions based on changes to the
18765 # blacklist entries for selser tests.
18766 !! test
18767 Bad treebuilder fixup of formatting elt is cleaned up
18768 !! options
18769 parsoid=wt2html,wt2wt
18770 !! wikitext
18771 {|
18772 |
18773 <small>
18774 [[Image:Foobar.jpg|right|Test]]
18775 </small>
18776 |}
18777 !! html/parsoid
18778 <table>
18779 <tbody><tr><td>
18780 <p><small></small></p>
18781 <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>
18782 <p></p></td></tr>
18783 </tbody></table>
18784 !! end
18785
18786 #### ----------------------------------------------------------------
18787 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18788 #### tags. Parsoid's output for these tags differs from that of the
18789 #### PHP parser.
18790 #### ----------------------------------------------------------------
18791
18792 !!test
18793 Ref: 1. ref-location should be replaced with an index span
18794 !!options
18795 parsoid
18796 !! wikitext
18797 A <ref>foo</ref>
18798 B <ref name="x">foo</ref>
18799 C <ref name="y" />
18800 !! html
18801 <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>
18802 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>
18803 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>
18804 !!end
18805
18806 !!test
18807 Ref: 2. ref-tags with identical names should all get the same index
18808 !!options
18809 parsoid
18810 !! wikitext
18811 A <ref name="x">foo</ref>
18812 B <ref name="x" />
18813 !! html
18814 <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>
18815 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>
18816 !!end
18817
18818 !!test
18819 Ref: 3. spaces in ref-names should be ignored
18820 !!options
18821 parsoid
18822 !! wikitext
18823 A <ref name="x">foo</ref>
18824 B <ref name=" x " />
18825 C <ref name= x />
18826 !! html
18827 <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>
18828 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>
18829 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>
18830 !!end
18831
18832 !!test
18833 Ref: 4. 'constructor' should be accepted as a valid ref-name
18834 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18835 !!options
18836 parsoid
18837 !! wikitext
18838 A <ref name="constructor">foo</ref>
18839 !! html
18840 <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>
18841 !!end
18842
18843 !!test
18844 Ref: 5. body should accept generic wikitext
18845 !!options
18846 parsoid
18847 !! wikitext
18848 A <ref>
18849 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18850 </ref>
18851
18852 <references />
18853 !! html
18854 <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>
18855
18856 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18857 <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>
18858 </li>
18859 </ol>
18860 !!end
18861
18862 !!test
18863 Ref: 6. indent-pres should not be output in ref-body
18864 !!options
18865 parsoid
18866 !! wikitext
18867 A <ref>
18868 foo
18869 bar
18870 baz
18871 </ref>
18872
18873 <references />
18874 !! html
18875 <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>
18876
18877 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18878 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18879 bar
18880 baz
18881 </li>
18882 </ol>
18883 !!end
18884
18885 !!test
18886 Ref: 7. No p-wrapping in ref-body
18887 !!options
18888 parsoid
18889 !! wikitext
18890 A <ref>
18891 foo
18892
18893 bar
18894
18895
18896 baz
18897
18898
18899
18900 booz
18901 </ref>
18902
18903 <references />
18904 !! html
18905 <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>
18906
18907 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18908 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18909
18910 bar
18911
18912
18913 baz
18914
18915
18916
18917 booz
18918 </li>
18919 </ol>
18920 !!end
18921
18922 !!test
18923 Ref: 8. transclusion wikitext has lower precedence
18924 !!options
18925 parsoid
18926 !! wikitext
18927 A <ref> foo {{echo|</ref> B C}}
18928
18929 <references />
18930 !! html
18931 <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>
18932 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18933 <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>
18934 </ol>
18935 !!end
18936
18937 !!test
18938 Ref: 9. unclosed comments should not leak out of ref-body
18939 !!options
18940 parsoid
18941 !! wikitext
18942 A <ref> foo <!--</ref> B C
18943 <references />
18944 !! html
18945 <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>
18946 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18947 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18948 </ol>
18949 !!end
18950
18951 !!test
18952 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18953 !!options
18954 parsoid
18955 !! wikitext
18956 A <ref> <b> foo </ref> B C
18957
18958 <references />
18959 !! html
18960 <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>
18961
18962
18963 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18964 <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>
18965 </ol>
18966 !!end
18967
18968 !!test
18969 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18970 !!options
18971 parsoid
18972 !! wikitext
18973 A <ref>foo</ref> B
18974 C <ref>bar</ref> D
18975 !! html
18976 <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
18977 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>
18978 !!end
18979
18980 !!test
18981 Ref: 12. ref-tags act as trailing newline migration barrier
18982 !!options
18983 parsoid
18984 !! wikitext
18985 <!--the newline at the end of this line moves out of the p-tag-->a
18986
18987 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18988 <ref />
18989
18990 c
18991 !! html
18992 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18993
18994
18995 <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>
18996 <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>
18997
18998
18999 <p>c</p>
19000 !!end
19001
19002 !!test
19003 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19004 !!options
19005 parsoid
19006 !! wikitext
19007 <ref>foo</ref> A
19008 <ref>bar
19009 </ref> B
19010 !! html
19011 <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
19012 <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>
19013 !!end
19014
19015 !!test
19016 Ref: 14. A nested ref-tag should be emitted as plain text
19017 !!options
19018 parsoid
19019 !! wikitext
19020 <ref>foo <ref>bar</ref> baz</ref>
19021
19022 <references />
19023 !! html
19024 <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>
19025
19026 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
19027 <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>
19028 </ol>
19029 !!end
19030
19031 !!test
19032 Ref: 15. ref-tags with identical names should get identical indexes
19033 !!options
19034 parsoid
19035 !! wikitext
19036 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19037 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19038
19039 <references />
19040 !! html
19041 <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>
19042 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>
19043
19044 <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>
19045 </ol>
19046 !!end
19047
19048 ## We don't bother wt2wt-ing non-standard whitespace
19049 !!test
19050 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19051 !!options
19052 parsoid=wt2html
19053 !! wikitext
19054 A <ref >foo</ref >
19055
19056 <references />
19057 !! html
19058 <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>
19059
19060 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19061 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19062 !!end
19063
19064 !!test
19065 References: 1. references tag without any refs should be handled properly
19066 !!options
19067 parsoid
19068 !! wikitext
19069 <references />
19070 !! html
19071 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19072 !!end
19073
19074 !!test
19075 References: 2. references tag with group only outputs references from that group
19076 !!options
19077 parsoid
19078 !! wikitext
19079 A <ref group="a">foo</ref>
19080 B <ref group="b">bar</ref>
19081
19082 <references group="a" />
19083 !! html
19084 <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>
19085 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>
19086
19087 <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>
19088 </ol>
19089 !!end
19090
19091 !!test
19092 References: 3. ref list should be cleared after processing references
19093 !!options
19094 parsoid
19095 !! wikitext
19096 A <ref>foo</ref>
19097
19098 <references />
19099
19100 B <ref>bar</ref>
19101
19102 <references />
19103 !! html
19104 <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>
19105
19106 <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>
19107 </ol>
19108
19109 <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>
19110
19111 <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>
19112 </ol>
19113 !!end
19114
19115 !!test
19116 References: 4. only referenced group should be cleared after processing references
19117 !!options
19118 parsoid
19119 !! wikitext
19120 A <ref group="a">afoo</ref>
19121 B <ref>bfoo</ref>
19122
19123 <references group="a" />
19124
19125 C <ref>cfoo</ref>
19126
19127 <references />
19128 !! html
19129 <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>
19130 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>
19131
19132 <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>
19133 </ol>
19134
19135 <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>
19136
19137 <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>
19138 </ol>
19139 !!end
19140
19141 !!test
19142 References: 5. ref tags in references should be processed while ignoring all other content
19143 !!options
19144 parsoid
19145 !! wikitext
19146 A <ref name="a" />
19147 B <ref name="b">bar</ref>
19148
19149 <references>
19150 <ref name="a">foo</ref>
19151 This should just get lost.
19152 </references>
19153 !! html
19154 <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>
19155 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>
19156
19157
19158 <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":{}}'>
19159 <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>
19160 <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>
19161 </ol>
19162 !!end
19163
19164 !!test
19165 References: 6. <references /> from a transclusion
19166 !!options
19167 parsoid
19168 !! wikitext
19169 <ref>Foo</ref> {{echo|<references />}}
19170 !! html
19171 <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>
19172 !!end
19173
19174 !! test
19175 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19176 !! options
19177 parsoid
19178 !! wikitext
19179 A <ref>foo bar for a</ref>
19180 B <ref group="X" name="b" />
19181
19182 <references />
19183
19184 <references group="X">
19185 <ref name="b">foo</ref>
19186 </references>
19187 !! html
19188 <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>
19189 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>
19190
19191 <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>
19192
19193 <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>
19194 !! end
19195
19196 !! test
19197 Entities in ref name
19198 !! options
19199 parsoid
19200 !! wikitext
19201 <ref name="test &amp; me">hi</ref>
19202 !! html
19203 <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>
19204 !! end
19205
19206 # This test is wt2html only because we're permitting the serializer to produce
19207 # dirty diffs, normalizing the unclosed references to the self-closed version.
19208 !! test
19209 Generate references for unclosed references tag
19210 !! options
19211 parsoid=wt2html
19212 !! wikitext
19213 a<ref>foo</ref>
19214
19215 <references>
19216 !! html
19217 <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>
19218
19219
19220 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
19221 <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>
19222 !! end
19223
19224 !! test
19225 New reference serializes on its own line
19226 !! options
19227 parsoid=wt2wt,html2wt
19228 !! wikitext
19229 foo
19230 <references />
19231 !! html
19232 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19233 !! end
19234
19235 #### ----------------------------------------------------------------
19236 #### The following section of tests are primarily to test
19237 #### wikitext escaping capabilities of Parsoid. Given that
19238 #### escaping can be done any number of ways, the wikitext (input)
19239 #### is always adjusted to reflect how Parsoid adds nowiki
19240 #### escape tags.
19241 ####
19242 #### We are marking several tests as parsoid-only since the
19243 #### HTML in the result section is different from what the
19244 #### PHP parser generates for it.
19245 #### ----------------------------------------------------------------
19246
19247
19248 #### --------------- Headings ---------------
19249 #### 0. Unnested
19250 #### 1. Nested inside html <h1>=foo=</h1>
19251 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19252 #### 3. Nested inside html with wikitext split by html tags
19253 #### 4. No escape needed
19254 #### 5. Empty headings <h1></h1>
19255 #### 6. Heading chars in SOL context
19256 #### ----------------------------------------
19257 !! test
19258 Headings: 0. Unnested
19259 !! options
19260 parsoid
19261 !! wikitext
19262 <nowiki>=foo=</nowiki>
19263
19264 <nowiki> =foo= </nowiki>
19265 <!--cmt-->
19266 <nowiki>=foo=</nowiki>
19267
19268 =foo''a''<nowiki>=</nowiki>
19269 !! html
19270 <p><span typeof="mw:Nowiki">=foo=</span></p>
19271
19272 <p><span typeof="mw:Nowiki"> =foo= </span>
19273 <!--cmt-->
19274 <span typeof="mw:Nowiki">=foo=</span></p>
19275
19276 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19277 !!end
19278
19279 !! test
19280 Headings: 1. Nested inside html
19281 (New headings and existing headings are handled differently)
19282 !! options
19283 parsoid=html2wt
19284 !! wikitext
19285 = =foo= =
19286
19287 == =foo= ==
19288
19289 === =foo= ===
19290
19291 =<nowiki>=foo=</nowiki>=
19292 ==<nowiki>=foo=</nowiki>==
19293 ===<nowiki>=foo=</nowiki>===
19294 ====<nowiki>=foo=</nowiki>====
19295 =====<nowiki>=foo=</nowiki>=====
19296 ======<nowiki>=foo=</nowiki>======
19297
19298 !! html
19299 <h1>=foo=</h1>
19300 <h2>=foo=</h2>
19301 <h3>=foo=</h3>
19302
19303 <h1 data-parsoid='{}'>=foo=</h1>
19304 <h2 data-parsoid='{}'>=foo=</h2>
19305 <h3 data-parsoid='{}'>=foo=</h3>
19306 <h4 data-parsoid='{}'>=foo=</h4>
19307 <h5 data-parsoid='{}'>=foo=</h5>
19308 <h6 data-parsoid='{}'>=foo=</h6>
19309 !!end
19310
19311 !! test
19312 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19313 !! options
19314 parsoid=html2wt
19315 !! wikitext
19316 = foo =
19317 <nowiki>*</nowiki>bar
19318
19319 = foo =
19320 =bar
19321
19322 = foo =
19323 <nowiki>=bar=</nowiki>
19324 !! html
19325 <h1>foo</h1>*bar
19326 <h1>foo</h1>=bar
19327 <h1>foo</h1>=bar=
19328 !!end
19329
19330 !! test
19331 Headings: 3. Nested inside html with wikitext split by html tags
19332 !! options
19333 parsoid=html2wt
19334 !! wikitext
19335 = ='''bold'''<nowiki>foo=</nowiki> =
19336 !! html
19337 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19338 !!end
19339
19340 !! test
19341 Headings: 4a. No escaping needed (testing just h1 and h2)
19342 !! options
19343 parsoid=html2wt
19344 !! wikitext
19345 = =foo =
19346
19347 = foo= =
19348
19349 = =foo= =
19350
19351 = =foo= bar =
19352
19353 == =foo ==
19354
19355 == foo= ==
19356
19357 = ''=''foo= =
19358
19359 = <nowiki>=</nowiki> =
19360 !! html
19361 <h1>=foo</h1>
19362 <h1>foo=</h1>
19363 <h1> =foo= </h1>
19364 <h1>=foo= bar</h1>
19365 <h2>=foo</h2>
19366 <h2>foo=</h2>
19367 <h1><i>=</i>foo=</h1>
19368 <h1><span typeof="mw:Nowiki">=</span></h1>
19369 !!end
19370
19371 !! test
19372 Headings: 4b. No escaping needed (inside p-tags)
19373 !! options
19374 parsoid=html2wt
19375 !! wikitext
19376 ===
19377 =foo= x
19378 =foo= <s></s>
19379 !! html
19380 <p>===
19381 =foo= x
19382 =foo= <s></s>
19383 </p>
19384 !!end
19385
19386 !! test
19387 Headings: 5. Empty headings
19388 !! options
19389 parsoid
19390 !! wikitext
19391 =<nowiki/>=
19392
19393 ==<nowiki/>==
19394
19395 ===<nowiki/>===
19396
19397 ====<nowiki/>====
19398
19399 =====<nowiki/>=====
19400
19401 ======<nowiki/>======
19402 !! html
19403 <h1></h1>
19404 <h2></h2>
19405 <h3></h3>
19406 <h4></h4>
19407 <h5></h5>
19408 <h6></h6>
19409 !!end
19410
19411 !! test
19412 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19413 !! options
19414 parsoid
19415 !! wikitext
19416 <nowiki>=a=</nowiki>
19417
19418 <nowiki>=a=</nowiki>
19419
19420 <nowiki>=a=</nowiki>
19421
19422 <nowiki>=a=</nowiki>
19423 !! html
19424 <p>=a=</p>
19425 <p>=a= </p>
19426 <p>=a= </p>
19427 <p>=a= </p>
19428 !!end
19429
19430 !! test
19431 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19432 !! options
19433 parsoid
19434 !! wikitext
19435 <nowiki>=a=
19436 b</nowiki>
19437
19438 <nowiki>=a=
19439 b</nowiki>
19440
19441 <nowiki>=a=
19442 b</nowiki>
19443
19444 <nowiki>=a=
19445 b</nowiki>
19446 !! html
19447 <p>=a=
19448 b</p>
19449 <p>=a=
19450 b</p>
19451 <p>=a=
19452 b</p>
19453 <p>=a=
19454 b</p>
19455 </p>
19456 !!end
19457
19458 !! test
19459 Headings: 6c. Heading chars in SOL context (leading newline break)
19460 !! options
19461 parsoid
19462 !! wikitext
19463 a
19464 <nowiki>=b=</nowiki>
19465 !! html
19466 <p>a
19467 =b=</p>
19468 !!end
19469
19470 !! test
19471 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19472 !! options
19473 parsoid
19474 !! wikitext
19475 <!--c0--><nowiki>=a=</nowiki>
19476
19477 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19478 !! html
19479 <p><!--c0-->=a=</p>
19480 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19481 !!end
19482
19483 !! test
19484 Headings: 6d. Heading chars in SOL context (No escaping needed)
19485 !! options
19486 parsoid=html2wt
19487 !! wikitext
19488 =a=<div>b</div>
19489 !! html
19490 =a=<div>b</div>
19491 !!end
19492
19493 #### --------------- Lists ---------------
19494 #### 0. Outside nests (*foo, etc.)
19495 #### 1. Nested inside html <ul><li>*foo</li></ul>
19496 #### 2. Inside definition lists
19497 #### 3. Only bullets at start should be escaped
19498 #### 4. No escapes needed
19499 #### 5. No unnecessary escapes
19500 #### 6. Escape bullets in SOL position
19501 #### 7. Escape bullets in a multi-line context
19502 #### ----------------------------------------
19503
19504 !! test
19505 Lists: 0. Outside nests
19506 !! wikitext
19507 <nowiki>*</nowiki>foo
19508
19509 <nowiki>#</nowiki>foo
19510
19511 <nowiki>;Foo:</nowiki>bar
19512 !! html
19513 <p>*foo
19514 </p><p>#foo
19515 </p><p>;Foo:bar
19516 </p>
19517 !!end
19518
19519 !! test
19520 Lists: 1. Nested inside html
19521 !! wikitext
19522 *<nowiki>*foo</nowiki>
19523
19524 *<nowiki>#foo</nowiki>
19525
19526 *<nowiki>:foo</nowiki>
19527
19528 *<nowiki>;foo</nowiki>
19529
19530 #<nowiki>*foo</nowiki>
19531
19532 #<nowiki>#foo</nowiki>
19533
19534 #<nowiki>:foo</nowiki>
19535
19536 #<nowiki>;foo</nowiki>
19537 !! html
19538 <ul><li>*foo</li></ul>
19539 <ul><li>#foo</li></ul>
19540 <ul><li>:foo</li></ul>
19541 <ul><li>;foo</li></ul>
19542 <ol><li>*foo</li></ol>
19543 <ol><li>#foo</li></ol>
19544 <ol><li>:foo</li></ol>
19545 <ol><li>;foo</li></ol>
19546
19547 !!end
19548
19549 !! test
19550 Lists: 2. Inside definition lists
19551 !! wikitext
19552 ;<nowiki>;foo</nowiki>
19553
19554 ;<nowiki>:foo</nowiki>
19555
19556 ;<nowiki>:foo</nowiki>
19557 :bar
19558
19559 :<nowiki>:foo</nowiki>
19560 !! html
19561 <dl><dt>;foo</dt></dl>
19562 <dl><dt>:foo</dt></dl>
19563 <dl><dt>:foo</dt>
19564 <dd>bar</dd></dl>
19565 <dl><dd>:foo</dd></dl>
19566
19567 !!end
19568
19569 !! test
19570 Lists: 3. Only bullets at start of text should be escaped
19571 !! wikitext
19572 *<nowiki>*foo*bar</nowiki>
19573
19574 *<nowiki>*foo</nowiki>''it''*bar
19575 !! html
19576 <ul><li>*foo*bar</li></ul>
19577 <ul><li>*foo<i>it</i>*bar</li></ul>
19578
19579 !!end
19580
19581 !! test
19582 Lists: 4. No escapes needed
19583 !! options
19584 parsoid
19585 !! wikitext
19586 *foo*bar
19587
19588 *''foo''*bar
19589
19590 *[[Foo]]: bar
19591
19592 *[[Foo]]*bar
19593 !! html
19594 <ul>
19595 <li>foo*bar
19596 </li>
19597 </ul>
19598 <ul>
19599 <li><i>foo</i>*bar
19600 </li>
19601 </ul>
19602 <ul>
19603 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
19604 </li>
19605 </ul>
19606 <ul>
19607 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
19608 </li>
19609 </ul>
19610 !!end
19611
19612 !! test
19613 Lists: 5. No unnecessary escapes
19614 !! wikitext
19615 * bar <span><nowiki>[[foo]]</nowiki></span>
19616
19617 *=bar <span><nowiki>[[foo]]</nowiki></span>
19618
19619 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19620
19621 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19622
19623 *=bar <span>foo]]</span>=
19624
19625 * <s></s>: a
19626 !! html
19627 <ul><li> bar <span>[[foo]]</span></li></ul>
19628 <ul><li>=bar <span>[[foo]]</span></li></ul>
19629 <ul><li>[[bar <span>[[foo]]</span></li></ul>
19630 <ul><li>]]bar <span>[[foo]]</span></li></ul>
19631 <ul><li>=bar <span>foo]]</span>=</li></ul>
19632 <ul><li> <s></s>: a</li></ul>
19633
19634 !!end
19635
19636 !! test
19637 Lists: 6. Escape bullets in SOL position
19638 !! options
19639 parsoid
19640 !! wikitext
19641 <!--cmt--><nowiki>*foo</nowiki>
19642 !! html
19643 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19644 !!end
19645
19646 !! test
19647 Lists: 7. Escape bullets in a multi-line context
19648 !! wikitext
19649 a
19650 <nowiki>*</nowiki>b
19651 !! html
19652 <p>a
19653 *b
19654 </p>
19655 !!end
19656
19657 #### --------------- HRs ---------------
19658 #### 1. Single line
19659 #### -----------------------------------
19660
19661 !! test
19662 HRs: 1. Single line
19663 !! options
19664 parsoid
19665 !! wikitext
19666 ----<nowiki>----</nowiki>
19667 ----=foo=
19668 ----*foo
19669 !! html
19670 <hr><span typeof="mw:Nowiki">----</span>
19671 <hr>=foo=
19672 <hr>*foo
19673 !! end
19674
19675 #### --------------- Tables ---------------
19676 #### 1a. Simple example
19677 #### 1b. No escaping needed (!foo)
19678 #### 1c. No escaping needed (|foo)
19679 #### 1d. No escaping needed (|}foo)
19680 ####
19681 #### 2a. Nested in td (<td>foo|bar</td>)
19682 #### 2b. Nested in td (<td>foo||bar</td>)
19683 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19684 ####
19685 #### 3a. Nested in th (<th>foo!bar</th>)
19686 #### 3b. Nested in th (<th>foo!!bar</th>)
19687 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19688 ####
19689 #### 4a. Escape -
19690 #### 4b. Escape +
19691 #### 4c. No escaping needed
19692 #### --------------------------------------
19693
19694 !! test
19695 Tables: 1a. Simple example
19696 !! wikitext
19697 <nowiki>{|
19698 |}</nowiki>
19699 !! html
19700 <p>{|
19701 |}
19702 </p>
19703 !! end
19704
19705 !! test
19706 Tables: 1b. No escaping needed
19707 !! wikitext
19708 !foo
19709 !! html
19710 <p>!foo
19711 </p>
19712 !! end
19713
19714 !! test
19715 Tables: 1c. No escaping needed
19716 !! wikitext
19717 |foo
19718 !! html
19719 <p>|foo
19720 </p>
19721 !! end
19722
19723 !! test
19724 Tables: 1d. No escaping needed
19725 !! wikitext
19726 |}foo
19727 !! html
19728 <p>|}foo
19729 </p>
19730 !! end
19731
19732 !! test
19733 Tables: 2a. Nested in td
19734 !! options
19735 parsoid=html2wt
19736 !! wikitext
19737 {|
19738 |<nowiki>foo|bar</nowiki>
19739 |-
19740 |x<div><nowiki>a|b</nowiki></div>
19741 |}
19742 !! html
19743 <table><tbody><tr>
19744 <td>foo|bar</td></tr>
19745 <tr><td>x<div>a|b</div></td>
19746 </tbody></table>
19747 !! end
19748
19749 !! test
19750 Tables: 2b. Nested in td
19751 !! options
19752 parsoid
19753 !! wikitext
19754 {|
19755 |<nowiki>foo||bar</nowiki>
19756 |''it''<nowiki>foo||bar</nowiki>
19757 |}
19758 !! html
19759 <table><tbody><tr>
19760 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19761 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19762 !! end
19763
19764 !! test
19765 Tables: 2c. Nested in td -- no escaping needed
19766 !! options
19767 parsoid
19768 !! wikitext
19769 {|
19770 |foo!!bar
19771 |}
19772 !! html
19773 <table><tbody><tr><td>foo!!bar
19774 </td></tr></tbody></table>
19775
19776 !! end
19777
19778 !! test
19779 Tables: 3a. Nested in th
19780 !! options
19781 parsoid
19782 !! wikitext
19783 {|
19784 !foo!bar
19785 |}
19786 !! html
19787 <table><tbody><tr><th>foo!bar
19788 </th></tr></tbody></table>
19789
19790 !! end
19791
19792 !! test
19793 Tables: 3b. Nested in th
19794 !! options
19795 parsoid
19796 !! wikitext
19797 {|
19798 !<nowiki>foo!!bar</nowiki>
19799 |}
19800 !! html
19801 <table>
19802 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19803 </tbody></table>
19804 !! end
19805
19806 !! test
19807 Tables: 3c. Nested in th -- no escaping needed
19808 !! options
19809 parsoid
19810 !! wikitext
19811 {|
19812 !<nowiki>foo||bar</nowiki>
19813 |}
19814 !! html
19815 <table><tbody><tr>
19816 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19817 !! end
19818
19819 !! test
19820 Tables: 4a. Escape -
19821 !! options
19822 parsoid
19823 !! wikitext
19824 {|
19825 !-bar
19826 |-
19827 |<nowiki>-bar</nowiki>
19828 |}
19829 !! html
19830 <table><tbody>
19831 <tr><th>-bar</th></tr>
19832 <tr>
19833 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19834 !! end
19835
19836 !! test
19837 Tables: 4b. Escape +
19838 !! options
19839 parsoid
19840 !! wikitext
19841 {|
19842 !+bar
19843 |-
19844 |<nowiki>+bar</nowiki>
19845 |}
19846 !! html
19847 <table><tbody>
19848 <tr><th>+bar</th></tr>
19849 <tr>
19850 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19851 !! end
19852
19853 !! test
19854 Tables: 4c. No escaping needed
19855 !! options
19856 parsoid
19857 !! wikitext
19858 {|
19859 |foo-bar
19860 |foo+bar
19861 |-
19862 |''foo''-bar
19863 |''foo''+bar
19864 |-
19865 |foo
19866 bar|baz
19867 +bar
19868 -bar
19869 |-
19870 |x
19871 <div>a|b</div>
19872 |}
19873 !! html
19874 <table><tbody>
19875 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19876 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19877 <tr><td>foo
19878 <p>bar|baz
19879 +bar
19880 -bar</p></td></tr>
19881 <tr><td>x
19882 <div>a|b</div></td>
19883 </tbody></table>
19884 !! end
19885
19886 !! test
19887 Tables: 4d. No escaping needed
19888 !! options
19889 parsoid
19890 !! wikitext
19891 {|
19892 |[[Foo]]-bar
19893 ||+1
19894 ||-2
19895 |}
19896 !! html
19897 <table>
19898 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
19899 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19900 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19901 </tbody></table>
19902 !! end
19903
19904 !! test
19905 Tables: Digest broken attributes on table and tr tag
19906 !! options
19907 parsoid=wt2html
19908 !! wikitext
19909 {| || |} ++
19910 |- || || ++ --
19911 |- > [
19912 |}
19913 !! html
19914 <table>
19915 <tbody>
19916 <tr></tr>
19917 <tr></tr>
19918 </tbody></table>
19919 !! end
19920
19921 #### --------------- Links ----------------
19922 #### 1. Quote marks in link text
19923 #### 2. Wikilinks: Escapes needed
19924 #### 3. Wikilinks: No escapes needed
19925 #### 4. Extlinks: Escapes needed
19926 #### 5. Extlinks: No escapes needed
19927 #### --------------------------------------
19928 !! test
19929 Links 1. Quote marks in link text
19930 !! options
19931 parsoid
19932 !! wikitext
19933 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19934 !! html
19935 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19936 !! end
19937
19938 !! test
19939 Links 2. WikiLinks: Escapes needed
19940 !! options
19941 parsoid
19942 !! wikitext
19943 [[Foo|[Foobar]]]
19944 [[Foo|<nowiki>Foobar]</nowiki>]]
19945 [[Foo|x [Foobar] x]]
19946 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19947 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19948 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19949 [[Foo|<nowiki>|Bar</nowiki>]]
19950 [[Foo|<nowiki>]]bar</nowiki>]]
19951 [[Foo|<nowiki>[[bar</nowiki>]]
19952 [[Foo|<nowiki>x [[ y</nowiki>]]
19953 [[Foo|<nowiki>x ]] y</nowiki>]]
19954 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19955 !! html
19956 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19957 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19958 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19959 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19960 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19961 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19962 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19963 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19964 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19965 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19966 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19967 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19968 !! end
19969
19970 !! test
19971 Links 3. WikiLinks: No escapes needed
19972 !! options
19973 parsoid
19974 !! wikitext
19975 [[Foo|[Foobar]]
19976 [[Foo|foo|bar]]
19977 !! html
19978 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19979 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19980 !! end
19981
19982 !! test
19983 Links 4. ExtLinks: Escapes needed
19984 !! options
19985 parsoid
19986 !! wikitext
19987 [http://google.com <nowiki>[google]</nowiki>]
19988 [http://google.com <nowiki>google]</nowiki>]
19989
19990 <nowiki>[http://google.com]</nowiki>
19991
19992 <nowiki>[http://google.com google]</nowiki>
19993
19994 !! html
19995 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19996 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19997 <p>[http://google.com]</p>
19998 <p>[http://google.com google]</p>
19999 !! end
20000
20001 !! test
20002 Links 5. ExtLinks: No escapes needed
20003 !! options
20004 parsoid
20005 !! wikitext
20006 [http://google.com [google]
20007 !! html
20008 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20009 !! end
20010
20011 !! test
20012 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20013 !! html/parsoid
20014 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20015 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20016 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20017 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20018 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20019 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20020 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20021 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20022 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
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>=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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20027 </p>
20028 !! wikitext
20029 x<nowiki/>http://example.com<nowiki/>y
20030 http://example.com<nowiki/>?x
20031 http://example.com<nowiki/>&x
20032 http://example.com<nowiki/>'x
20033 http://example.com<nowiki/>,x
20034 http://example.com<nowiki/>.x
20035 http://example.com<nowiki/>;x
20036 http://example.com<nowiki/>:x
20037 http://example.com<nowiki/>;x
20038 http://example.com<nowiki/>!x
20039 http://example.com<nowiki/>=x
20040 http://example.com<nowiki/>(x)
20041 http://example.com(x<nowiki/>)
20042 !! end
20043
20044 !! test
20045 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20046 !! html/parsoid
20047 <p>x
20048 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20049 y
20050 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20051 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20052 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20053 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20054 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20055 </p>
20056 !! wikitext
20057 x
20058 http://example.com
20059 y
20060 "http://example.com"
20061 (http://example.com)
20062 (http://example.com) foo
20063 http://example.com,
20064 http://example.com, foo
20065 !! end
20066
20067 ## Parsoid currently fails wt2html on this one!
20068 !! test
20069 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20070 !! html/parsoid
20071 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20072 !! wikitext
20073 http://example.com.,;:!?
20074 !! end
20075
20076 !! test
20077 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20078 !! html/parsoid
20079 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20080 !! wikitext
20081 RFC 123<nowiki/>4
20082 !! end
20083
20084 !! test
20085 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20086 !! html/parsoid
20087 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20088 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20089 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20090 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20091 </p>
20092 !! wikitext
20093 xRFC 123y
20094 XRFC 123y
20095 RFC 123?foo
20096 RFC 123&foo
20097 !! end
20098
20099 !! test
20100 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20101 !! html/parsoid
20102 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20103 !! wikitext
20104 PMID 123<nowiki/>4
20105 !! end
20106
20107 !! test
20108 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20109 !! html/parsoid
20110 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20111 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20112 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20113 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20114 </p>
20115 !! wikitext
20116 xPMID 123y
20117 XPMID 123y
20118 PMID 123?foo
20119 PMID 123&foo
20120 !! end
20121
20122 !! test
20123 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20124 !! html/parsoid
20125 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20126 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20127 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20128 </p>
20129 !! wikitext
20130 ISBN 1234567890<nowiki/>1
20131 ISBN 1234567890<nowiki/>x
20132 ISBN 1234567890<nowiki/>b
20133 !! end
20134
20135 !! test
20136 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20137 !! html/parsoid
20138 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20139 !! wikitext
20140 ISBN 1234567890's
20141 !! end
20142
20143 #### --------------- Quotes ---------------
20144 #### 1. Quotes inside <b> and <i>
20145 #### 2. Link fragments separated by <i> and <b> tags
20146 #### 3. Link fragments inside <i> and <b>
20147 #### 4. No escaping needed
20148 #### --------------------------------------
20149 !! test
20150 1. Quotes inside <b> and <i>
20151 !! options
20152 parsoid=html2wt,wt2wt
20153 !! wikitext
20154 ''<nowiki>'foo'</nowiki>''
20155 ''<nowiki>''foo''</nowiki>''
20156 ''<nowiki>'''foo'''</nowiki>''
20157 ''foo''<nowiki/>'s
20158 '''<nowiki>'foo'</nowiki>'''
20159 '''<nowiki>''foo''</nowiki>'''
20160 '''<nowiki>'''foo'''</nowiki>'''
20161 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20162 '''foo'''<nowiki/>'s
20163 '''foo''
20164 ''foo''<nowiki/>'
20165 '<nowiki/>''foo''<nowiki/>'
20166 ''''foo'''
20167 '''foo'''<nowiki/>'
20168 '<nowiki/>'''foo'''<nowiki/>'
20169 ''fools'<span> errand</span>''
20170 ''<span>fool</span>'s errand''
20171 !! html
20172 <p><i>'foo'</i>
20173 <i>''foo''</i>
20174 <i>'''foo'''</i>
20175 <i>foo</i>'s
20176 <b>'foo'</b>
20177 <b>''foo''</b>
20178 <b>'''foo'''</b>
20179 <b>foo'<i>bar'</i>baz</b>
20180 <b>foo</b>'s
20181 '<i>foo</i>
20182 <i>foo</i>'
20183 '<i>foo</i>'
20184 '<b>foo</b>
20185 <b>foo</b>'
20186 '<b>foo</b>'</p>
20187 <i>fools'<span> errand</span></i>
20188 <i><span>fool</span>'s errand</i>
20189 !! end
20190
20191 !! test
20192 2. Link fragments separated by <i> and <b> tags
20193 !! wikitext
20194 [[''foo''<nowiki>hello]]</nowiki>
20195
20196 [['''foo'''<nowiki>hello]]</nowiki>
20197 !! html
20198 <p>[[<i>foo</i>hello]]
20199 </p><p>[[<b>foo</b>hello]]
20200 </p>
20201 !! end
20202
20203 !! test
20204 3. Link fragments inside <i> and <b>
20205 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
20206 this is one of the shortcomings of this format)
20207 !! wikitext
20208 ''[[foo''<nowiki>]]</nowiki>
20209
20210 '''[[foo'''<nowiki>]]</nowiki>
20211 !! html
20212 <p><i>[[foo</i>]]
20213 </p><p><b>[[foo</b>]]
20214 </p>
20215 !! end
20216
20217 !! test
20218 4. No escaping needed
20219 !! wikitext
20220 '<span>''bar''</span>'
20221 '<span>'''bar'''</span>'
20222 !! html
20223 <p>'<span><i>bar</i></span>'
20224 '<span><b>bar</b></span>'
20225 </p>
20226 !! end
20227
20228 #### ----------- Paragraphs ---------------
20229 #### 1. No unnecessary escapes
20230 #### --------------------------------------
20231
20232 !! test
20233 1. No unnecessary escapes
20234 !! wikitext
20235 bar <span><nowiki>[[foo]]</nowiki></span>
20236
20237 =bar <span><nowiki>[[foo]]</nowiki></span>
20238
20239 [[bar <span><nowiki>[[foo]]</nowiki></span>
20240
20241 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20242
20243 =bar <span>foo]]</span><nowiki>=</nowiki>
20244 !! html
20245 <p>bar <span>[[foo]]</span>
20246 </p><p>=bar <span>[[foo]]</span>
20247 </p><p>[[bar <span>[[foo]]</span>
20248 </p><p>]]bar <span>[[foo]]</span>
20249 </p><p>=bar <span>foo]]</span>=
20250 </p>
20251 !!end
20252
20253 #### ----------------------- PRE --------------------------
20254 #### 1. Leading whitespace in SOL context should be escaped
20255 #### ------------------------------------------------------
20256 !! test
20257 1. Leading whitespace in SOL context should be escaped
20258 !! options
20259 parsoid
20260 !! wikitext
20261 <nowiki> </nowiki>a
20262
20263 <nowiki> </nowiki> a
20264
20265 <nowiki> </nowiki>a(tab)
20266
20267 <nowiki> </nowiki> a
20268 <!--cmt-->
20269 <nowiki> </nowiki> a
20270
20271 a
20272 <nowiki> </nowiki>b
20273
20274 a
20275 <nowiki> </nowiki>b
20276
20277 a
20278 <nowiki> </nowiki> b
20279 !! html
20280 <p> a</p>
20281 <p> a</p>
20282 <p> a(tab)</p>
20283 <p> a</p>
20284 <p><!--cmt--> a</p>
20285 <p>a
20286 b</p>
20287 <p>a
20288 b</p>
20289 <p>a
20290 b</p>
20291 !! end
20292
20293 !! test
20294 2. Leading whitespace in non-indent-pre contexts should not be escaped
20295 !! options
20296 parsoid
20297 !! wikitext
20298 foo <ref>''a''
20299 b</ref>
20300 !! html
20301 <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>
20302 !! end
20303
20304 !! test
20305 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20306 !! options
20307 parsoid
20308 !! wikitext
20309 <blockquote>
20310 a
20311 <span>b</span>
20312 c
20313 </blockquote>
20314 !! html
20315 <blockquote>
20316 <p>
20317 a
20318 <span>b</span>
20319 c</p>
20320 </blockquote>
20321 !! end
20322
20323 !! test
20324 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20325 !! options
20326 parsoid
20327 !! wikitext
20328 [[File:Foobar.jpg|thumb|caption]]
20329 !! html
20330 !! html/parsoid
20331 <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>
20332 !! end
20333
20334 !! test
20335 5. Nowiki escaping should account for indent-pres
20336 !! options
20337 parsoid=html2wt
20338 !! html
20339 <pre>==foo==</pre>
20340 !! wikitext
20341 ==foo==
20342 !! end
20343
20344 #### --------------- Behavior Switches --------------------
20345 !! test
20346 1. Valid behavior switches should be escaped
20347 !! options
20348 parsoid=html2wt
20349 !! wikitext
20350 <nowiki>__TOC__</nowiki>
20351 ''<nowiki>__TOC__</nowiki>''
20352 !! html
20353 __TOC__
20354 <i>__TOC__</i>
20355 !! end
20356
20357 !! test
20358 2. Invalid behavior switches should not be escaped
20359 !! options
20360 parsoid=html2wt
20361 !! wikitext
20362 __TOO__
20363 __|__
20364 !! html
20365 __TOO__
20366 __|__
20367 !! end
20368
20369 #### --------------- HTML tags ---------------
20370 #### 1. a tags
20371 #### 2. other tags
20372 #### 3. multi-line html tag
20373 #### 4. extension tags
20374 #### -----------------------------------------
20375 !! test
20376 1. a tags
20377 !! options
20378 parsoid
20379 !! wikitext
20380 <a href="http://google.com">google</a>
20381 !! html
20382 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20383 !! end
20384
20385 !! test
20386 2. other tags
20387 !! wikitext
20388 <nowiki><div>foo</div>
20389 <div style="color:red">foo</div></nowiki>
20390 !! html
20391 <p>&lt;div&gt;foo&lt;/div&gt;
20392 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20393 </p>
20394 !! end
20395
20396 !! test
20397 3. multi-line html tag
20398 !! wikitext
20399 <nowiki><div
20400 >foo</div
20401 ></nowiki>
20402 !! html
20403 <p>&lt;div
20404 &gt;foo&lt;/div
20405 &gt;
20406 </p>
20407 !! end
20408
20409 !! test
20410 4. extension tags
20411 !! wikitext
20412 <nowiki><ref>foo</ref></nowiki>
20413
20414 <nowiki><ref>bar</nowiki>
20415
20416 baz<nowiki></ref></nowiki>
20417 !! html
20418 <p>&lt;ref&gt;foo&lt;/ref&gt;
20419 </p><p>&lt;ref&gt;bar
20420 </p><p>baz&lt;/ref&gt;
20421 </p>
20422 !! end
20423
20424 #### --------------- Others ---------------
20425 !! test
20426 Escaping nowikis
20427 !! wikitext
20428 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20429 !! html
20430 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20431 </p>
20432 !! end
20433
20434 ## The quote-char in the input is necessary for triggering the bug
20435 !! test
20436 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20437 !! options
20438 parsoid=wt2wt,html2wt
20439 !! wikitext
20440 foo's bar :
20441 !! html
20442 <p>foo's bar :</p>
20443 !! end
20444
20445 !! test
20446
20447 Tag-like HTML structures are passed through as text
20448 !! wikitext
20449 <x y>
20450
20451 <x.y>
20452
20453 <x-y>
20454
20455 1>2
20456
20457 x<y
20458
20459 a>b
20460
20461 1<d e>f
20462 !! html
20463 <p>&lt;x y&gt;
20464 </p><p>&lt;x.y&gt;
20465 </p><p>&lt;x-y&gt;
20466 </p><p>1&gt;2
20467 </p><p>x&lt;y
20468 </p><p>a&gt;b
20469 </p><p>1&lt;d e&gt;f
20470 </p>
20471 !! end
20472
20473
20474 # This was a bug in the PHP parser (see bug 17663 and its dups,
20475 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20476 !! test
20477 Tag names followed by punctuation should not be recognized as tags
20478 !! wikitext
20479 <s.ome> text
20480 !! html
20481 <p>&lt;s.ome&gt; text
20482 </p>
20483 !! end
20484
20485 !! test
20486 HTML tag with necessary entities in attributes
20487 !! wikitext
20488 <span title="&amp;amp;">foo</span>
20489 !! html
20490 <p><span title="&amp;amp;">foo</span>
20491 </p>
20492 !! end
20493
20494 !! test
20495 HTML tag with 'unnecessary' entity encoding in attributes
20496 !! wikitext
20497 <span title="&amp;">foo</span>
20498 !! html
20499 <p><span title="&amp;">foo</span>
20500 </p>
20501 !! end
20502
20503 !! test
20504 HTML tag with broken attribute value quoting
20505 !! wikitext
20506 <span title="Hello world>Foo</span>
20507 !! html/php
20508 <p><span>Foo</span>
20509 </p>
20510 !! html/parsoid
20511 <p><span title="Hello world">Foo</span>
20512 </p>
20513 !! end
20514
20515 !! test
20516 Parsoid-only: HTML tag with broken attribute value quoting
20517 !! options
20518 parsoid
20519 !! wikitext
20520 <span title="Hello world>Foo</span>
20521 !! html
20522 <p><span title="Hello world">Foo</span>
20523 </p>
20524 !! end
20525
20526 !! test
20527 Table with broken attribute value quoting
20528 !! wikitext
20529 {|
20530 | title="Hello world|Foo
20531 |}
20532 !! html/php
20533 <table>
20534 <tr>
20535 <td>Foo
20536 </td></tr></table>
20537
20538 !! html/parsoid
20539 <table>
20540 <tr>
20541 <td title="Hello world">Foo
20542 </td></tr></table>
20543
20544 !! end
20545
20546 !! test
20547 Table with broken attribute value quoting on consecutive lines
20548 !! wikitext
20549 {|
20550 | title="Hello world|Foo
20551 | style="color:red|Bar
20552 |}
20553 !! html
20554 <table>
20555 <tr>
20556 <td>Foo
20557 </td>
20558 <td>Bar
20559 </td></tr></table>
20560
20561 !! end
20562
20563 !! test
20564 Parsoid-only: Table with broken attribute value quoting on consecutive lines
20565 !! options
20566 parsoid
20567 !! wikitext
20568 {|
20569 | title="Hello world|Foo
20570 | style="color:red|Bar
20571 |}
20572 !! html
20573 <table><tbody>
20574 <tr>
20575 <td title="Hello world">Foo
20576 </td><td style="color: red">Bar
20577 </td></tr></tbody></table>
20578
20579 !! end
20580
20581 !! test
20582 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20583 !! options
20584 parsoid
20585 !! wikitext
20586 {{}}
20587 !! html
20588 {{}}
20589 !! end
20590
20591 !! test
20592 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20593 !! options
20594 parsoid
20595 !! wikitext
20596 }}{{
20597 !! html
20598 }}{{
20599 !! end
20600
20601 !!test
20602 Accept empty td cell attribute
20603 !! wikitext
20604 {|
20605 | align="center" | foo || |
20606 |}
20607 !! html
20608 <table>
20609 <tr>
20610 <td align="center"> foo </td>
20611 <td>
20612 </td></tr></table>
20613
20614 !!end
20615
20616 !!test
20617 Non-empty attributes in th-cells
20618 !! wikitext
20619 {|
20620 ! Foo !! style="color: red" | Bar
20621 |}
20622 !! html
20623 <table>
20624 <tr>
20625 <th> Foo </th>
20626 <th style="color: red"> Bar
20627 </th></tr></table>
20628
20629 !!end
20630
20631 !!test
20632 Accept empty attributes in th-cells
20633 !! wikitext
20634 {|
20635 !| foo !!| bar
20636 |}
20637 !! html
20638 <table>
20639 <tr>
20640 <th> foo </th>
20641 <th> bar
20642 </th></tr></table>
20643
20644 !!end
20645
20646 !!test
20647 Empty table rows go away
20648 !! wikitext
20649 {|
20650 | Hello
20651 | there
20652 |- class="foo"
20653 |-
20654 |}
20655 !! html
20656 <table>
20657 <tr>
20658 <td> Hello
20659 </td>
20660 <td> there
20661 </td></tr>
20662
20663 </table>
20664
20665 !! end
20666
20667 ###
20668 ### Parsoid-centric tests for testing RTing of inter-element separators
20669 ### Edge cases not tested by existing parser tests and specific to
20670 ### Parsoid-specific serialization strategies.
20671 ###
20672
20673 !!test
20674 RT-ed inter-element separators should be valid separators
20675 !! wikitext
20676 {|
20677 |- [[foo]]
20678 |}
20679 !! html
20680 <table>
20681
20682 </table>
20683
20684 !!end
20685
20686 !!test
20687 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20688 (Parsoid-only since PHP parser relies on Tidy for correct output)
20689 !!options
20690 parsoid
20691 !! wikitext
20692 {|
20693 |<small>foo
20694 bar
20695 |}
20696
20697 {|
20698 |<small>foo<small>
20699 |}
20700 !! html
20701 !!end
20702
20703 !!test
20704 Empty TD followed by TD with tpl-generated attribute
20705 !! wikitext
20706 {|
20707 |-
20708 |
20709 |{{echo|style='color:red'}}|foo
20710 |}
20711 !! html
20712 <table>
20713
20714 <tr>
20715 <td>
20716 </td>
20717 <td>foo
20718 </td></tr></table>
20719
20720 !!end
20721
20722 !!test
20723 Indented table with an empty td
20724 !! wikitext
20725 {|
20726 |-
20727 |
20728 |foo
20729 |}
20730 !! html
20731 <table>
20732
20733 <tr>
20734 <td>
20735 </td>
20736 <td>foo
20737 </td></tr></table>
20738
20739 !!end
20740
20741 !!test
20742 Indented block & table
20743 !! wikitext
20744 <div>foo</div>
20745 {|
20746 |foo
20747 |}
20748 !! html/php
20749 <div>foo</div>
20750 <table>
20751 <tr>
20752 <td>foo
20753 </td></tr></table>
20754
20755 !! html/parsoid
20756 <div data-parsoid='{"stx":"html"}'>foo</div>
20757 <table><tbody>
20758 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20759 </tbody></table>
20760 !!end
20761
20762 !! test
20763 Indent and comment before table row
20764 !! wikitext
20765 {|
20766 <!--hi-->|-
20767 | there
20768 |}
20769 !! html/php
20770 <table>
20771
20772 <tr>
20773 <td> there
20774 </td></tr></table>
20775
20776 !! html/parsoid
20777 <table data-parsoid='{}'>
20778 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20779 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20780 </tbody></table>
20781 !! end
20782
20783 !!test
20784 Empty TR followed by a template-generated TR
20785 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20786 !!options
20787 parsoid
20788 !! wikitext
20789 {|
20790 |-
20791 {{echo|<tr><td>foo</td></tr>}}
20792 |}
20793 !! html
20794 <table>
20795 <tbody>
20796 <tr></tr>
20797 <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}}]}'>
20798 <td>foo</td></tr>
20799 </tbody></table>
20800 !!end
20801
20802 ## PHP and parsoid output differ for this, and since this is primarily
20803 ## for testing Parsoid's serializer, marking this Parsoid only
20804 !!test
20805 Empty TR followed by mixed-ws-comment line should RT correctly
20806 !!options
20807 parsoid
20808 !! wikitext
20809 {|
20810 |-
20811 <!--c-->
20812 |-
20813 <!--c--> <!--d-->
20814 |}
20815 !! html
20816 <table>
20817 <tbody>
20818 <tr></tr>
20819 <!--c-->
20820 <tr>
20821 <!--c--> </tr><!--d-->
20822 </tbody></table>
20823
20824 !!end
20825
20826 !!test
20827 Multi-line image caption generated by templates with/without trailing newlines
20828 !!options
20829 parsoid
20830 !! wikitext
20831 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20832 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20833 !! html
20834 <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>
20835 <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>
20836
20837 !!end
20838
20839 !! test
20840 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20841 !! options
20842 parsoid=html2wt
20843 !! wikitext
20844 <includeonly>foo</includeonly>
20845 new para
20846
20847 [[./Category:Foo]]
20848
20849 = new heading =
20850 !! html
20851 <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>
20852
20853 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20854 !! end
20855
20856 ## PHP emits broken html for this, and since this is primarily
20857 ## a Parsoid serializer test, marking this Parsoid only
20858 !!test
20859 Improperly nested inline or quotes tags with whitespace in between
20860 !!options
20861 parsoid
20862 !! wikitext
20863 <span> <s>x</span> </s>
20864 ''' ''x''' ''
20865 !! html
20866 <p><span> <s>x</s></span><s> </s>
20867 <b> <i>x</i></b><i> </i>
20868 </p>
20869 !!end
20870
20871 !!test
20872 Encapsulate protected attributes from wt
20873 !!options
20874 parsoid
20875 !! wikitext
20876 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20877 !! html
20878 <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>
20879 </body>
20880 !!end
20881
20882 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20883 ## Having nested or stray pre tags results in the attempt to add duplicates,
20884 ## causing an assertion fail. This test tries to prevent that situation.
20885 !!test
20886 Ensure ParagraphWrapper can deal with stray closing pre tags
20887 !!options
20888 parsoid=wt2html
20889 !! wikitext
20890 plain text</pre>
20891 !! html
20892 plain text
20893 !!end
20894
20895 !!test
20896 1. Ensure fostered text content is wrapped in spans
20897 !!options
20898 parsoid=wt2html
20899 !! wikitext
20900 <table>hi</table><table>ho</table>
20901 !! html
20902 <span>hi</span>
20903 <table></table>
20904 <span>ho</span>
20905 <table></table>
20906 !!end
20907
20908 !!test
20909 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20910 !!options
20911 parsoid=wt2html,wt2wt
20912 !! wikitext
20913 <table>
20914 <tr> || ||
20915 <td> a
20916 </table>
20917 !! html
20918 <span> || ||</span>
20919 <table>
20920 <tbody>
20921 <tr>
20922 <td> a</td></tr>
20923 </tbody></table>
20924 !!end
20925
20926 !!test
20927 Encapsulation properly handles null DSR information from foster box
20928 !!options
20929 parsoid=wt2html,wt2wt
20930 !! wikitext
20931 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20932 !! html
20933 <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;
20934 <table>foo
20935 <tr>
20936 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20937 <table>
20938 <tbody>
20939 <tr>
20940 <td>bar</td></tr></tbody></table>
20941 !!end
20942
20943 !!test
20944 1. Encapsulate foster-parented transclusion content
20945 !!options
20946 parsoid=wt2wt,wt2html
20947 !! wikitext
20948 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20949 !! html
20950 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20951 <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
20952 <tr>
20953 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20954 <table>
20955 <tbody>
20956 <tr>
20957 <td>bar</td></tr></tbody></table>
20958 !!end
20959
20960 !!test
20961 2. Encapsulate foster-parented transclusion content
20962 !!options
20963 parsoid=wt2wt,wt2html
20964 !! wikitext
20965 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20966 !! html
20967 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20968 <table>
20969 <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>
20970 <tr>
20971 <td>bar</td></tr></table>&quot;]}">foo</div>
20972 <table>
20973 <tbody>
20974 <tr>
20975 <td>bar</td></tr></tbody></table>
20976 !!end
20977
20978 !!test
20979 3. Encapsulate foster-parented transclusion content
20980 !!options
20981 parsoid=wt2wt,wt2html
20982 !! wikitext
20983 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20984 !! html
20985 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20986 <table>
20987 <div>
20988 <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>
20989 <tr>
20990 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20991 <p>foo</p></div>
20992 <table>
20993 <tbody>
20994 <tr>
20995 <td>bar</td></tr></tbody></table>
20996 !!end
20997
20998 !!test
20999 4. Encapsulate foster-parented transclusion content
21000 !!options
21001 parsoid=wt2wt,wt2html
21002 !! wikitext
21003 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21004 !! html
21005 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21006 <table>
21007 <div>
21008 <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>
21009 <tr>
21010 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21011 <p>foo</p></div>
21012 <table>
21013 <tbody>
21014 <tr>
21015 <td>bar</td></tr></tbody></table>
21016 !!end
21017
21018 !!test
21019 5. Encapsulate foster-parented transclusion content
21020 !!options
21021 parsoid=wt2wt,wt2html
21022 !! wikitext
21023 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21024 !! html
21025 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21026 <table>
21027 <tr>
21028 <td>
21029 <div>
21030 <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>
21031 <table>
21032 <tbody>
21033 <tr>
21034 <td>
21035 <div>
21036 <p>foo</p></div></td></tr></tbody></table>
21037 !!end
21038
21039 !!test
21040 6. Encapsulate foster-parented transclusion content
21041 !!options
21042 parsoid=wt2wt,wt2html
21043 !! wikitext
21044 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21045 !! html
21046 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21047 <table>
21048 <tr>
21049 <td>
21050 <div>
21051 <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>
21052 <table>
21053 <tbody>
21054 <tr>
21055 <td>
21056 <div>
21057 <p>foo</p></div></td></tr></tbody></table>
21058 <p>ok</p>
21059 !!end
21060
21061 !!test
21062 7. Encapsulate foster-parented transclusion content
21063 !!options
21064 parsoid=wt2wt,wt2html
21065 !! wikitext
21066 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21067 !! html
21068 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21069 <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;
21070 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
21071 <td>bar</td></table>&quot;]}">foo</p>
21072 <table>
21073 <tbody>
21074 <tr>
21075 <td>bar</td></tr></tbody></table>
21076 !!end
21077
21078 !!test
21079 8. Encapsulate foster-parented transclusion content
21080 !!options
21081 parsoid=wt2wt,wt2html
21082 !! wikitext
21083 {{echo|a
21084 }}{|{{echo|style='color:red'}}
21085 |-
21086 |b
21087 |}
21088 !! html
21089 <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>
21090 <table>
21091 <tbody>
21092 <tr>
21093 <td>b</td></tr></tbody></table>
21094 !!end
21095
21096 !!test
21097 9. Encapsulate foster-parented transclusion content
21098 !!options
21099 parsoid=wt2wt,wt2html
21100 !! wikitext
21101 <table>{{echo|hi</table>hello}}
21102 !! html
21103 <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>
21104 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
21105 !!end
21106
21107 !!test
21108 Table in fosterable position
21109 !!options
21110 parsoid=wt2html,wt2wt
21111 !! wikitext
21112 {{OpenTable}}
21113 <div>
21114 {|
21115 |}
21116 </div>
21117 |}
21118 !! html
21119 <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="{}">
21120 </span>
21121 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21122
21123 <table>
21124 </table>
21125 !!end
21126
21127 # Parsoid only for bug 64747
21128 !! test
21129 Properly encapsulate empty-content transclusions in fosterable positions
21130 !! wikitext
21131 <table>
21132 {{#if:|
21133 <td>foo</td>
21134 }}
21135 </table>
21136 !! html/parsoid
21137 <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>"}'>
21138
21139 </table>
21140 !! end
21141
21142 !!test
21143 Support <object> element with .data attribute
21144 !!options
21145 parsoid=html2wt
21146 !! wikitext
21147 <object data="test.swf"></object>
21148 !! html
21149 <object data="test.swf"></object>
21150 !!end
21151
21152 # -----------------------------------------------------------------
21153 # The following section of tests are primarily to spec requirements
21154 # around serialization of new/edited content.
21155 #
21156 # All these tests are marked Parsoid html2wt and html2html only
21157 # ----------------------------------------------------------------
21158
21159 !! test
21160 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21161 !! options
21162 parsoid=html2wt
21163 language=es
21164 !! wikitext
21165 [[Foo]]
21166 !! html
21167 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
21168 !! end
21169
21170 !! test
21171 Image: Modifying size of an image (1)
21172 !! options
21173 parsoid={
21174 "modes": ["wt2wt"],
21175 "changes": [
21176 ["img[height]", "attr", "height", "22"],
21177 ["img[width]", "attr", "width", "200"]
21178 ]
21179 }
21180 !! wikitext
21181 [[Image:Foobar.jpg|230x230px]]
21182 !! wikitext/edited
21183 [[Image:Foobar.jpg|200x200px]]
21184 !!end
21185
21186 !! test
21187 Image: Modifying size of an image (2)
21188 !! options
21189 parsoid={
21190 "modes": ["wt2wt"],
21191 "changes": [
21192 ["img[height]", "attr", "height", "100"],
21193 ["img[width]", "attr", "width", "500"]
21194 ]
21195 }
21196 !! wikitext
21197 [[Image:Foobar.jpg|230x230px]]
21198 !! wikitext/edited
21199 [[Image:Foobar.jpg|500x500px]]
21200 !!end
21201
21202 # Change in size is ignored so long as class='mw-default-size'
21203 !! test
21204 Image: Modifying size of an image (3)
21205 !! options
21206 parsoid={
21207 "modes": ["wt2wt"],
21208 "changes": [
21209 ["figure[class]", "removeClass", "mw-default-size"],
21210 ["figure img", "attr", "height", "19"],
21211 ["figure img", "attr", "width", "170"]
21212 ]
21213 }
21214 !! wikitext
21215 [[Image:Foobar.jpg|thumb]]
21216 !! wikitext/edited
21217 [[Image:Foobar.jpg|thumb|170x170px]]
21218 !!end
21219
21220 !! test
21221 Image: Modifying alignment of an image (bug 48665)
21222 !! options
21223 parsoid={
21224 "modes": ["wt2wt"],
21225 "changes": [
21226 ["figure[class]", "removeClass", "mw-halign-right"],
21227 ["figure[class]", "addClass", "mw-halign-left"]
21228 ]
21229 }
21230 !! wikitext
21231 [[Image:Foobar.jpg|thumb|caption|right]]
21232 !! wikitext/edited
21233 [[Image:Foobar.jpg|thumb|caption|left]]
21234 !! end
21235
21236 !! test
21237 Image: Modifying mw-default-size of an frameless image (bug 62805)
21238 !! options
21239 parsoid={
21240 "modes": ["wt2wt"],
21241 "changes": [
21242 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21243 ]
21244 }
21245 !! wikitext
21246 [[Image:Foobar.jpg|frameless|right]]
21247 !! wikitext/edited
21248 [[Image:Foobar.jpg|frameless|right|220x220px]]
21249 !! end
21250
21251 !! test
21252 Image: Modifying valign of an image (bug 49221)
21253 !! options
21254 parsoid={
21255 "modes": ["wt2wt"],
21256 "changes": [
21257 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21258 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21259 ]
21260 }
21261 !! wikitext
21262 [[File:Foobar.jpg|20px|middle]]
21263 !! wikitext/edited
21264 [[File:Foobar.jpg|20px|text-top]]
21265 !! end
21266
21267 !! test
21268 Image: Modifying alt attribute of an image (bug 56400)
21269 !! options
21270 parsoid={
21271 "modes": ["wt2wt"],
21272 "changes": [
21273 ["img[alt]", "attr", "alt", "some alternate edited text"]
21274 ]
21275 }
21276 !! wikitext
21277 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21278 !! wikitext/edited
21279 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21280 !!end
21281
21282 !! test
21283 Image: Modifying caption of an image
21284 !! options
21285 parsoid={
21286 "modes": ["wt2wt"],
21287 "changes": [
21288 ["figcaption", "text", "new caption"]
21289 ]
21290 }
21291 !! wikitext
21292 [[Image:Foobar.jpg|thumb|original caption]]
21293 !! wikitext/edited
21294 [[Image:Foobar.jpg|thumb|new caption]]
21295 !!end
21296
21297 !! test
21298 Image: empty alt attribute (bug 48924)
21299 !! options
21300 parsoid
21301 !! wikitext
21302 [[File:Foobar.jpg|thumb|alt=|bar]]
21303 !! html
21304 <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>
21305 !! end
21306
21307 #!! test
21308 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21309 #!! options
21310 #parsoid=html2wt
21311 #language=ar
21312 #!! input
21313 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21314 #!! result
21315 #<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>
21316 #!! end
21317
21318 !! test
21319 Image: Block level image should have \n before and after
21320 !! options
21321 parsoid
21322 !! wikitext
21323 123
21324 [[File:Foobar.jpg|right|thumb|150x150px]]
21325 456
21326 !! html
21327 <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>
21328 !!end
21329
21330 !! test
21331 Image: New block level image should have \n before and after (existing
21332 content)
21333 !! options
21334 parsoid
21335 !! wikitext
21336 123
21337 [[File:Foobar.jpg|right|thumb|150x150px]]
21338 456
21339 !! html
21340 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
21341 <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>
21342 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
21343 !!end
21344
21345 !! test
21346 Image: upright option (parsoid)
21347 !! options
21348 parsoid
21349 !! wikitext
21350 [[File:Foobar.jpg|thumb|upright|caption]]
21351 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21352 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21353 !! html
21354 <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>
21355 !!end
21356
21357 !! test
21358 Image: upright option is ignored on inline and frame images (parsoid)
21359 !! options
21360 parsoid
21361 !! wikitext
21362 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21363 !! html
21364 <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>
21365 !!end
21366
21367 !! test
21368 Image: from basic HTML (1)
21369 !! options
21370 parsoid=html2wt
21371 !! html/parsoid
21372 <span typeof="mw:Image">
21373 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21374 </span>
21375 !! wikitext
21376 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21377 !! end
21378
21379 !! test
21380 Image: from basic HTML (2)
21381 !! options
21382 parsoid=html2wt
21383 !! html/parsoid
21384 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21385 !! wikitext
21386 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21387 !! end
21388
21389 !! test
21390 Image: from basic HTML (3)
21391 !! options
21392 parsoid=html2wt
21393 !! html/parsoid
21394 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21395 !! wikitext
21396 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21397 !! end
21398
21399 !! test
21400 Image: from basic HTML (4)
21401 !! options
21402 parsoid=html2wt
21403 !! html/parsoid
21404 <img src="File:Foobar.jpg">
21405 !! wikitext
21406 [[File:Foobar.jpg|link=]]
21407 !! end
21408
21409 !! test
21410 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21411 !! options
21412 parsoid=html2wt
21413 !! wikitext
21414 * foo
21415 !! html
21416 <ul>
21417 <li><p>foo</p></li>
21418 </ul>
21419 !! end
21420
21421 !! test
21422 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21423 !! options
21424 parsoid=html2wt
21425 !! wikitext
21426 * foo
21427 !! html
21428 <ul> <li>foo</li></ul>
21429 !! end
21430
21431 !! test
21432 Don't strip leading whitespace when handling indent-pre suppressing tags
21433 !! options
21434 parsoid=html2wt
21435 !! wikitext
21436 {|
21437 | indented row
21438 |}
21439 <blockquote>
21440 '''This is very bold of you!'''
21441
21442 {|
21443 |
21444 indented cell (no pre-wrapping!)
21445 |}
21446 </blockquote>
21447 foo
21448 <div>bar</div>
21449 !! html
21450 <table>
21451 <tr><td> indented row</td></tr>
21452 </table>
21453 <blockquote><p>
21454 <b>This is very bold of you!</b>
21455 </p>
21456 <table><tr><td>
21457 indented cell (no pre-wrapping!)
21458 </td></tr></table>
21459 </blockquote>
21460 <p>foo</p>
21461 <div>bar</div>
21462 !! end
21463
21464 !! test
21465 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21466 !! options
21467 parsoid=html2wt
21468 !! wikitext
21469 foo
21470 <nowiki> </nowiki><span>bar</span>
21471
21472 <span>foo2
21473 <nowiki> </nowiki></span>bar2
21474
21475 <div>foo</div>
21476 <nowiki> </nowiki><span>bar</span>
21477
21478 <div>
21479 <nowiki> </nowiki><span>foo</span>
21480 </div>
21481 !! html
21482 <p>foo</p>
21483 <span>bar</span>
21484
21485 <span>foo2
21486 </span>bar2
21487
21488 <div>foo</div>
21489 <span>bar</span>
21490
21491 <div>
21492 <span>foo</span>
21493 </div>
21494 !! end
21495
21496 !! test
21497 Lists: Add space after bullets
21498 !! options
21499 parsoid=html2wt
21500 !! wikitext
21501 * foo
21502 * bar
21503 * <span> baz</span>
21504 !! html
21505 <ul>
21506 <li>foo</li>
21507 <li> bar</li>
21508 <li><span> baz</span></li>
21509 </ul>
21510 !! end
21511
21512 !! test
21513 Lists: Dont insert newlines in a serialized list item.
21514 !! options
21515 parsoid=html2wt
21516 !! wikitext
21517 * a<br>b
21518 * c
21519 !! html
21520 <ul><li>a<br>b</li><li>c</li></ul>
21521 !! end
21522
21523 !! test
21524 Headings: Add space before/after == (Bug 51744)
21525 !! options
21526 parsoid=html2wt
21527 !! wikitext
21528 == foo ==
21529
21530 == bar ==
21531
21532 == baz ==
21533
21534 == <span> baz</span> ==
21535 !! html
21536 <h2>foo</h2>
21537 <h2> bar</h2>
21538 <h2>baz </h2>
21539 <h2><span> baz</span></h2>
21540 !! end
21541
21542 !! test
21543 Parsoid: Serialize positional parameters with = in them as named parameter
21544 !! options
21545 parsoid=html2wt
21546 !! wikitext
21547 {{echo|1 = f=oo}}
21548
21549 {{echo|1 = f=oo|2 = bar}}
21550
21551 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21552 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21553 {{echo|<nowiki>f=oo</nowiki>|bar}}
21554 !! html
21555 <p about="#mwt1" typeof="mw:Transclusion"
21556 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21557
21558 <p about="#mwt1" typeof="mw:Transclusion"
21559 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21560
21561 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21562 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21563 <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>
21564 !! end
21565
21566 !! test
21567 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21568 !! options
21569 parsoid=html2wt
21570 !! wikitext
21571 <div>a
21572 b
21573 </div>
21574 <div>a
21575 b
21576 </div>
21577 <div>
21578 a
21579
21580 b
21581 </div>
21582 !! html
21583 <div>a<p>b</p></div>
21584 <div>a
21585 <p>b</p></div>
21586 <div>
21587 a
21588 <p>b</p></div>
21589 !! end
21590
21591 !! test
21592 Substrings resembling wikitext in hrefs should not get nowiki escapes
21593 !! options
21594 parsoid=html2wt
21595 !! wikitext
21596 [[Foo''bar''baz]]
21597 !! html
21598 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21599 !! end
21600
21601 #-----------------------------
21602 # I/B quote minimization tests
21603 #-----------------------------
21604
21605 !! test
21606 1. I/B quote minimization: wikitext-only tags should be combined
21607 !! options
21608 parsoid=html2wt
21609 !! wikitext
21610 ''AB''
21611
21612 '''AB'''
21613
21614 ''A'''B'''''
21615
21616 '''A''B'''''
21617
21618 '''A''BC''D'''
21619
21620 '''''AB'''''
21621
21622 '''''AB'''''
21623
21624 '''''AB'''''
21625 !! html
21626 <p><i>A</i><i>B</i></p>
21627 <p><b>A</b><b>B</b></p>
21628 <p><i>A</i><b><i>B</i></b></p>
21629 <p><b>A</b><i><b>B</b></i></p>
21630 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21631 <p><i><b>A</b></i><i><b>B</b></i></p>
21632 <p><i><b>A</b></i><b><i>B</i></b></p>
21633 <p><b><i>A</i></b><i><b>B</b></i></p>
21634 !! end
21635
21636 !! test
21637 2. I/B quote minimization: wikitext and html tags should not be combined
21638 !! options
21639 parsoid=html2wt
21640 !! wikitext
21641 ''A''<i>B</i>
21642
21643 ''A'''''<i>B</i>'''
21644 !! html
21645 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21646 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21647 !! end
21648
21649 !! test
21650 3. I/B quote minimization: templated content stops minimization
21651 !! options
21652 parsoid=html2wt
21653 !! wikitext
21654 ''A''{{echo|''B''}}
21655
21656 ''A''{{echo|'''''B'''''}}
21657 !! html
21658 <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>
21659 <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>
21660 !! end
21661
21662 !! test
21663 4. I/B quote minimization: new content should be mimimized with adjacent old content
21664 !! options
21665 parsoid=html2wt
21666 !! wikitext
21667 ''AB''
21668
21669 '''AB'''
21670
21671 ''A'''B'''''
21672 !! html
21673 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21674 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21675 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21676 !! end
21677
21678 #------------------------------------
21679 # End of I/B quote minimization tests
21680 #------------------------------------
21681
21682 !!test
21683 Bug 54262: New entities
21684 !! options
21685 parsoid=html2wt
21686 !! wikitext
21687 &nbsp;
21688 !! html
21689 <span typeof="mw:Entity">&nbsp;</span>
21690 !! end
21691
21692 ## Note that there is no wikitext output for 'unknownproperty' ##
21693 ## Unknown magic words are silently dropped ##
21694
21695 !! test
21696 Magic words
21697 !! options
21698 parsoid=html2wt
21699 !! wikitext
21700 __TOC__
21701 __NOTOC__
21702 __FORCETOC__
21703 __INDEX__
21704 __NOINDEX__
21705 __NOGALLERY__
21706 __NOEDITSECTION__
21707 __NOTITLECONVERT__
21708 __NOCONTENTCONVERT__
21709 !! html
21710 <meta property='mw:PageProp/toc' />
21711 <meta property='mw:PageProp/notoc' />
21712 <meta property='mw:PageProp/forcetoc' />
21713 <meta property='mw:PageProp/index' />
21714 <meta property='mw:PageProp/noindex' />
21715 <meta property='mw:PageProp/nogallery' />
21716 <meta property='mw:PageProp/noeditsection' />
21717 <meta property='mw:PageProp/notitleconvert' />
21718 <meta property='mw:PageProp/nocontentconvert' />
21719 <meta property='mw:PageProp/unknownproperty' />
21720 !! end
21721
21722 !! test
21723 Consecutive <pre>s should not get merged
21724 !! options
21725 parsoid=html2wt,html2html
21726 !! wikitext
21727 a
21728
21729 b
21730
21731 c
21732
21733 d
21734
21735 e
21736
21737
21738
21739 f
21740 !! html
21741 <pre>a</pre><pre>b</pre>
21742
21743 <pre>c
21744 </pre><pre>
21745 d</pre>
21746
21747 <pre>e
21748
21749 </pre><pre>
21750
21751 f</pre>
21752 !! end
21753
21754 !! test
21755 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21756 !! options
21757 parsoid=html2wt
21758 !! wikitext
21759 [[Special:BookSources/1234567890|ISBN 1234567895]]
21760 !! html
21761 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21762 !! end
21763
21764 !! test
21765 Edited RFC links not serializable as RFC links should serialize as extlinks
21766 !! options
21767 parsoid=html2wt
21768 !! wikitext
21769 [//tools.ietf.org/html/rfc123 New RFC]
21770 !! html
21771 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21772 !! end
21773
21774 !! test
21775 Edited PMID links not serializable as PMID links should serialize as extlinks
21776 !! options
21777 parsoid=html2wt
21778 !! wikitext
21779 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21780 !! html
21781 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21782 !! end
21783
21784 !! test
21785 Edited Redirect link should emit a non-piped wikitext link
21786 !! options
21787 parsoid=html2wt
21788 !! wikitext
21789 #REDIRECT [[Bar]]
21790 !! html
21791 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21792 !! end
21793
21794 # -----------------------------------------------------------------
21795 # End of section for Parsoid-only html2wt tests for serialization
21796 # of new content
21797 # -----------------------------------------------------------------
21798
21799 TODO:
21800 more images
21801 more tables
21802 character entities
21803 and much more
21804 Try for 100% code coverage