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 Template:Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
59
60 !! article
61 Template:pipe
62 !! text
63 |
64 !! endarticle
65
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
71
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
77
78 !! article
79 Template:tbl-start
80 !! text
81 {|
82 !! endarticle
83
84 !! article
85 Template:tbl-end
86 !! text
87 |}
88 !! endarticle
89
90 !! article
91 Template:!
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 !! test
411 Simple list
412 !! wikitext
413 * Item 1
414 * Item 2
415 !! html
416 <ul>
417 <li> Item 1
418 </li>
419 <li> Item 2
420 </li>
421 </ul>
422
423 !! end
424
425 !! test
426 Italics and bold
427 !! wikitext
428 * plain
429 * plain''italic''plain
430 * plain''italic''plain''italic''plain
431 * plain'''bold'''plain
432 * plain'''bold'''plain'''bold'''plain
433 * plain''italic''plain'''bold'''plain
434 * plain'''bold'''plain''italic''plain
435 * plain''italic'''bold-italic'''italic''plain
436 * plain'''bold''bold-italic''bold'''plain
437 * plain'''''bold-italic'''italic''plain
438 * plain'''''bold-italic''bold'''plain
439 * plain''italic'''bold-italic'''''plain
440 * plain'''bold''bold-italic'''''plain
441 * plain l'''italic''plain
442 * plain l''''bold''' plain
443 !! html
444 <ul>
445 <li> plain
446 </li>
447 <li> plain<i>italic</i>plain
448 </li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain
450 </li>
451 <li> plain<b>bold</b>plain
452 </li>
453 <li> plain<b>bold</b>plain<b>bold</b>plain
454 </li>
455 <li> plain<i>italic</i>plain<b>bold</b>plain
456 </li>
457 <li> plain<b>bold</b>plain<i>italic</i>plain
458 </li>
459 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
460 </li>
461 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
462 </li>
463 <li> plain<i><b>bold-italic</b>italic</i>plain
464 </li>
465 <li> plain<b><i>bold-italic</i>bold</b>plain
466 </li>
467 <li> plain<i>italic<b>bold-italic</b></i>plain
468 </li>
469 <li> plain<b>bold<i>bold-italic</i></b>plain
470 </li>
471 <li> plain l'<i>italic</i>plain
472 </li>
473 <li> plain l'<b>bold</b> plain
474 </li>
475 </ul>
476
477 !! end
478
479 # this example taken from the [[simple:Moon]] article (bug 47326)
480 !! test
481 Italics and possessives (1)
482 !! wikitext
483 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
484 !! html
485 <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
486 </p>
487 !! end
488
489 # this example taken from [[en:Flaming Pie]] (bug 49926)
490 !! test
491 Italics and possessives (2)
492 !! wikitext
493 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
494 !! html
495 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
496 </p>
497 !! end
498
499 # this example taken from [[en:Dictionary]] (bug 49926)
500 !! test
501 Italics and possessives (3)
502 !! wikitext
503 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''.
504 !! html
505 <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>.
506 </p>
507 !! end
508
509
510 ###
511 ### 2-quote opening sequence tests
512 ###
513 !! test
514 Italics and bold: 2-quote opening sequence: (2,2)
515 !! wikitext
516 ''foo''
517 !! html
518 <p><i>foo</i>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 2-quote opening sequence: (2,3)
525 !! options
526 parsoid=wt2html
527 !! wikitext
528 ''foo'''
529 !! html/*
530 <p><i>foo'</i>
531 </p>
532 !!end
533
534
535 # same html as previous, but wikitext adjusted to match parsoid html2wt
536 !! test
537 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
538 !! wikitext
539 ''<nowiki>foo'</nowiki>''
540 !! html
541 <p><i>foo'</i>
542 </p>
543 !! end
544
545
546 !! test
547 Italics and bold: 2-quote opening sequence: (2,4)
548 !! options
549 parsoid=wt2html
550 !! wikitext
551 ''foo''''
552 !! html/*
553 <p><i>foo''</i>
554 </p>
555 !!end
556
557
558 # same html as previous, but wikitext adjusted to match parsoid html2wt
559 !! test
560 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
561 !! wikitext
562 ''<nowiki>foo''</nowiki>''
563 !! html
564 <p><i>foo''</i>
565 </p>
566 !! end
567
568
569 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
570 !! test
571 Italics and bold: 2-quote opening sequence: (2,5)
572 !! options
573 parsoid=wt2html
574 !! wikitext
575 ''foo'''''
576 !! html/php
577 <p><i>foo</i>
578 </p>
579 !! html/parsoid
580 <p><i>foo</i><b></b>
581 </p>
582 !!end
583
584 # same html as previous, but wikitext adjusted to match parsoid html2wt
585 !! test
586 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
587 !! wikitext
588 ''foo'''''<nowiki/>'''
589 !! html/php
590 <p><i>foo</i>
591 </p>
592 !! html/parsoid
593 <p><i>foo</i><b></b>
594 </p>
595 !! end
596
597
598 ###
599 ### 3-quote opening sequence tests
600 ###
601
602 !! test
603 Italics and bold: 3-quote opening sequence: (3,2)
604 !! wikitext
605 '''foo''
606 !! html
607 <p>'<i>foo</i>
608 </p>
609 !!end
610
611
612 !! test
613 Italics and bold: 3-quote opening sequence: (3,3)
614 !! wikitext
615 '''foo'''
616 !! html
617 <p><b>foo</b>
618 </p>
619 !!end
620
621
622 !! test
623 Italics and bold: 3-quote opening sequence: (3,4)
624 !! options
625 parsoid=wt2html
626 !! wikitext
627 '''foo''''
628 !! html/*
629 <p><b>foo'</b>
630 </p>
631 !!end
632
633
634 # same html as previous, but wikitext adjusted to match parsoid html2wt
635 !! test
636 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
637 !! wikitext
638 '''<nowiki>foo'</nowiki>'''
639 !! html
640 <p><b>foo'</b>
641 </p>
642 !! end
643
644
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: 3-quote opening sequence: (3,5)
648 !! options
649 parsoid=wt2html
650 !! wikitext
651 '''foo'''''
652 !! html/php
653 <p><b>foo</b>
654 </p>
655 !! html/parsoid
656 <p><b>foo</b><i></i>
657 </p>
658 !!end
659
660 # same html as previous, but wikitext adjusted to match parsoid html2wt
661 !! test
662 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
663 !! wikitext
664 '''foo'''''<nowiki/>''
665 !! html/php
666 <p><b>foo</b>
667 </p>
668 !! html/parsoid
669 <p><b>foo</b><i></i>
670 </p>
671 !! end
672
673
674 ###
675 ### 4-quote opening sequence tests
676 ###
677
678 !! test
679 Italics and bold: 4-quote opening sequence: (4,2)
680 !! options
681 parsoid=wt2html
682 !! wikitext
683 ''''foo''
684 !! html/*
685 <p>''<i>foo</i>
686 </p>
687 !!end
688
689
690 # same html as previous, but wikitext adjusted to match parsoid html2wt
691 !! test
692 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
693 !! wikitext
694 <nowiki>''</nowiki>''foo''
695 !! html
696 <p>''<i>foo</i>
697 </p>
698 !! end
699
700
701 !! test
702 Italics and bold: 4-quote opening sequence: (4,3)
703 !! wikitext
704 ''''foo'''
705 !! html
706 <p>'<b>foo</b>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: 4-quote opening sequence: (4,4)
713 !! options
714 parsoid=wt2html
715 !! wikitext
716 ''''foo''''
717 !! html/*
718 <p>'<b>foo'</b>
719 </p>
720 !!end
721
722
723 # same html as previous, but wikitext adjusted to match parsoid html2wt
724 !! test
725 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
726 !! wikitext
727 ''''<nowiki>foo'</nowiki>'''
728 !! html
729 <p>'<b>foo'</b>
730 </p>
731 !! end
732
733
734 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
735 !! test
736 Italics and bold: 4-quote opening sequence: (4,5)
737 !! options
738 parsoid=wt2html
739 !! wikitext
740 ''''foo'''''
741 !! html/php
742 <p>'<b>foo</b>
743 </p>
744 !! html/parsoid
745 <p>'<b>foo</b><i></i>
746 </p>
747 !!end
748
749 # same html as previous, but wikitext adjusted to match parsoid html2wt
750 !! test
751 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
752 !! wikitext
753 ''''foo'''''<nowiki/>''
754 !! html/php
755 <p>'<b>foo</b>
756 </p>
757 !! html/parsoid
758 <p>'<b>foo</b><i></i>
759 </p>
760 !! end
761
762
763 ###
764 ### 5-quote opening sequence tests
765 ###
766
767 !! test
768 Italics and bold: 5-quote opening sequence: (5,2)
769 !! options
770 parsoid=wt2html
771 !! wikitext
772 '''''foo''
773 !! html/*
774 <p><b><i>foo</i></b>
775 </p>
776 !!end
777
778
779 # same html as previous, but wikitext adjusted to match parsoid html2wt
780 # skipping wt2html and html2html because it wants to put <i> before <b>
781 !! test
782 Italics and bold: 5-quote opening sequence: (5,2+3)
783 !! options
784 parsoid=wt2wt,html2wt
785 !! wikitext
786 '''''foo'''''
787 !! html/*
788 <p><b><i>foo</i></b>
789 </p>
790 !! end
791
792 !! test
793 Italics and bold: 5-quote opening sequence: (5,3)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 '''''foo'''
798 !! html/*
799 <p><i><b>foo</b></i>
800 </p>
801 !!end
802
803
804 # same html as previous, but wikitext adjusted to match parsoid html2wt
805 !! test
806 Italics and bold: 5-quote opening sequence: (5,3+2)
807 !! wikitext
808 '''''foo'''''
809 !! html
810 <p><i><b>foo</b></i>
811 </p>
812 !! end
813
814
815 !! test
816 Italics and bold: 5-quote opening sequence: (5,4)
817 !! options
818 parsoid=wt2html
819 !! wikitext
820 '''''foo''''
821 !! html/*
822 <p><i><b>foo'</b></i>
823 </p>
824 !!end
825
826
827 # same html as previous, but wikitext adjusted to match parsoid html2wt
828 !! test
829 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
830 !! wikitext
831 '''''<nowiki>foo'</nowiki>'''''
832 !! html
833 <p><i><b>foo'</b></i>
834 </p>
835 !! end
836
837
838 !! test
839 Italics and bold: 5-quote opening sequence: (5,5)
840 !! wikitext
841 '''''foo'''''
842 !! html
843 <p><i><b>foo</b></i>
844 </p>
845 !!end
846
847 ###
848 ### multiple quote sequences in a line
849 ###
850 !! test
851 Italics and bold: multiple quote sequences: (2,4,2)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 ''foo''''bar''
856 !! html/*
857 <p><i>foo'<b>bar</b></i>
858 </p>
859 !!end
860
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
865 !! wikitext
866 ''<nowiki>foo'</nowiki>'''bar'''''
867 !! html
868 <p><i>foo'<b>bar</b></i>
869 </p>
870 !! end
871
872
873 !! test
874 Italics and bold: multiple quote sequences: (2,4,3)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 ''foo''''bar'''
879 !! html/*
880 <p><i>foo'<b>bar</b></i>
881 </p>
882 !!end
883
884
885 # same html as previous, but wikitext adjusted to match parsoid html2wt
886 !! test
887 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
888 !! wikitext
889 ''<nowiki>foo'</nowiki>'''bar'''''
890 !! html
891 <p><i>foo'<b>bar</b></i>
892 </p>
893 !! end
894
895
896 !! test
897 Italics and bold: multiple quote sequences: (2,4,4)
898 !! options
899 parsoid=wt2html
900 !! wikitext
901 ''foo''''bar''''
902 !! html/*
903 <p><i>foo'<b>bar'</b></i>
904 </p>
905 !!end
906
907
908 # same html as previous, but wikitext adjusted to match parsoid html2wt
909 !! test
910 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
911 !! wikitext
912 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
913 !! html
914 <p><i>foo'<b>bar'</b></i>
915 </p>
916 !! end
917
918
919 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
920 !! test
921 Italics and bold: multiple quote sequences: (3,4,2)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 '''foo''''bar''
926 !! html/php
927 <p><b>foo'</b>bar
928 </p>
929 !! html/parsoid
930 <p><b>foo'</b>bar<i></i>
931 </p>
932 !!end
933
934 # same html as previous, but wikitext adjusted to match parsoid html2wt
935 !! test
936 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
937 !! options
938 parsoid
939 !! wikitext
940 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
941 !! html/php
942 <p><b>foo'</b>bar
943 </p>
944 !! html/parsoid
945 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
946 </p>
947 !! end
948
949
950 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
951 !! test
952 Italics and bold: multiple quote sequences: (3,4,3)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 '''foo''''bar'''
957 !! html/php
958 <p><b>foo'</b>bar
959 </p>
960 !! html/parsoid
961 <p><b>foo'</b>bar<b></b>
962 </p>
963 !!end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
968 !! wikitext
969 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
970 !! html/php
971 <p><b>foo'</b>bar
972 </p>
973 !! html/parsoid
974 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
975 </p>
976 !! end
977
978 ###
979 ### other quote tests
980 ###
981 !! test
982 Italics and bold: other quote tests: (2,3,5)
983 !! wikitext
984 ''this is about '''foo's family'''''
985 !! html
986 <p><i>this is about <b>foo's family</b></i>
987 </p>
988 !!end
989
990
991 !! test
992 Italics and bold: other quote tests: (2,(3,3),2)
993 !! wikitext
994 ''this is about '''foo's''' family''
995 !! html
996 <p><i>this is about <b>foo's</b> family</i>
997 </p>
998 !!end
999
1000
1001 !! test
1002 Italics and bold: other quote tests: (3,2,3,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''this is about ''foo'''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 # same html as previous, but wikitext adjusted to match parsoid html2wt
1014 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1015 !! test
1016 Italics and bold: other quote tests: (3,2,3+2+2,2)
1017 !! options
1018 parsoid
1019 !! wikitext
1020 '''this is about ''foo'''''<nowiki/>''s family''
1021 !! html/*
1022 <p><b>this is about <i>foo</i></b><i>s family</i>
1023 </p>
1024 !! end
1025
1026
1027 !! test
1028 Italics and bold: other quote tests: (3,2,3,3)
1029 !! options
1030 !! wikitext
1031 '''this is about ''foo'''s family'''
1032 !! html
1033 <p>'<i>this is about </i>foo<b>s family</b>
1034 </p>
1035 !!end
1036
1037
1038 !! test
1039 Italics and bold: other quote tests: (3,(2,2),3)
1040 !! wikitext
1041 '''this is about ''foo's'' family'''
1042 !! html
1043 <p><b>this is about <i>foo's</i> family</b>
1044 </p>
1045 !!end
1046
1047
1048 !! test
1049 Italicized possessive
1050 !! wikitext
1051 The ''[[Main Page]]'''s talk page.
1052 !! html
1053 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1054 </p>
1055 !! end
1056
1057 !! test
1058 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1059 (Requires tidy for PHP parser output to be fixed up)
1060 !! options
1061 parsoid=wt2html,wt2wt
1062 !! wikitext
1063 {|
1064 !''a!!''b
1065 |''a||''b
1066 |}
1067 !! html
1068 <table>
1069 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1070 <td><i>a</i></td><td><i>b</i></td></tr>
1071 </tbody></table>
1072 !! end
1073
1074 ###
1075 ### Non-html5 tags
1076 ###
1077
1078 !! test
1079 Non-html5 tags should be accepted
1080 !! wikitext
1081 <center>''foo''</center>
1082 <big>''foo''</big>
1083 <font>''foo''</font>
1084 <strike>''foo''</strike>
1085 <tt>''foo''</tt>
1086 !! html
1087 <center><i>foo</i></center>
1088 <p><big><i>foo</i></big>
1089 <font><i>foo</i></font>
1090 <strike><i>foo</i></strike>
1091 <tt><i>foo</i></tt>
1092 </p>
1093 !! end
1094
1095 !! test
1096 <wbr> is valid wikitext (bug 52468)
1097 !! wikitext
1098 <wbr>
1099 !! html
1100 <p><wbr />
1101 </p>
1102 !! end
1103
1104 # <strike> is HTML4, <s> is HTML4/5.
1105 !! test
1106 <s> or <strike> for strikethrough
1107 !! wikitext
1108 <strike>strike</strike>
1109
1110 <s>s</s>
1111 !! html
1112 <p><strike>strike</strike>
1113 </p><p><s>s</s>
1114 </p>
1115 !! end
1116
1117 !! test
1118 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1119 !! wikitext
1120 <b→> doesn't work! </b→>
1121
1122 <bä> doesn't work! </bä>
1123
1124 <boo> works fine </boo>
1125
1126 <s.foo>s.foo</s.foo>
1127
1128 <sub-ID#1>
1129 !! html
1130 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1131 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1132 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1133 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1134 </p><p>&lt;sub-ID#1&gt;
1135 </p>
1136 !! end
1137
1138 !! test
1139 Isolated close tags should be treated as literal text (bug 52760)
1140 !! wikitext
1141 </b>
1142
1143 <s.foo>s</s>
1144 !! html
1145 <p>&lt;/b&gt;
1146 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1147 </p>
1148 !! end
1149
1150 ###
1151 ### Special characters
1152 ###
1153
1154 !! test
1155 Bare pipe character (bug 52363)
1156 !! wikitext
1157 |
1158 !! html
1159 <p>|
1160 </p>
1161 !! end
1162
1163 !! test
1164 Bare pipe character from a template (bug 52363)
1165 !! wikitext
1166 {{pipe}}
1167 !! html
1168 <p>|
1169 </p>
1170 !! end
1171
1172 ###
1173 ### <nowiki> test cases
1174 ###
1175
1176 !! test
1177 <nowiki> unordered list
1178 !! wikitext
1179 <nowiki>* This is not an unordered list item.</nowiki>
1180 !! html
1181 <p>* This is not an unordered list item.
1182 </p>
1183 !! end
1184
1185 !! test
1186 <nowiki> spacing
1187 !! wikitext
1188 <nowiki>Lorem ipsum dolor
1189
1190 sed abit.
1191 sed nullum.
1192
1193 :and a colon
1194 </nowiki>
1195 !! html
1196 <p>Lorem ipsum dolor
1197
1198 sed abit.
1199 sed nullum.
1200
1201 :and a colon
1202
1203 </p>
1204 !! end
1205
1206 !! test
1207 nowiki 3
1208 !! wikitext
1209 :There is not nowiki.
1210 :There is <nowiki>nowiki</nowiki>.
1211
1212 #There is not nowiki.
1213 #There is <nowiki>nowiki</nowiki>.
1214
1215 *There is not nowiki.
1216 *There is <nowiki>nowiki</nowiki>.
1217 !! html
1218 <dl>
1219 <dd>There is not nowiki.
1220 </dd>
1221 <dd>There is nowiki.
1222 </dd>
1223 </dl>
1224 <ol>
1225 <li>There is not nowiki.
1226 </li>
1227 <li>There is nowiki.
1228 </li>
1229 </ol>
1230 <ul>
1231 <li>There is not nowiki.
1232 </li>
1233 <li>There is nowiki.
1234 </li>
1235 </ul>
1236
1237 !! end
1238
1239 !! test
1240 Entities inside <nowiki>
1241 !! wikitext
1242 <nowiki>&lt;</nowiki>
1243 !! html
1244 <p>&lt;
1245 </p>
1246 !! end
1247
1248 !! test
1249 Entities inside template parameters
1250 !! options
1251 parsoid
1252 !! wikitext
1253 {{echo|&ndash;}}
1254 !! html
1255 <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>
1256 </p>
1257 !! end
1258
1259 ###
1260 ### Comments
1261 ###
1262 !! test
1263 Comments and Indent-Pre
1264 !! wikitext
1265 <!-- comment 1 --> asdf
1266
1267 <!-- comment 1 --> asdf
1268 <!-- comment 2 -->
1269
1270 <!-- comment 1 --> asdf
1271 <!-- comment 2 -->xyz
1272
1273 <!-- comment 1 --> asdf
1274 <!-- comment 2 --> xyz
1275 !! html
1276 <pre>asdf
1277 </pre>
1278 <pre>asdf
1279 </pre>
1280 <pre>asdf
1281 </pre>
1282 <p>xyz
1283 </p>
1284 <pre>asdf
1285 xyz
1286 </pre>
1287 !! end
1288
1289 !! test
1290 Comment test 2a
1291 !! wikitext
1292 asdf
1293 <!-- comment 1 -->
1294 jkl
1295 !! html
1296 <p>asdf
1297 jkl
1298 </p>
1299 !! end
1300
1301 !! test
1302 Comment test 2b
1303 !! wikitext
1304 asdf
1305 <!-- comment 1 -->
1306
1307 jkl
1308 !! html
1309 <p>asdf
1310 </p><p>jkl
1311 </p>
1312 !! end
1313
1314 !! test
1315 Comment test 3
1316 !! wikitext
1317 asdf
1318 <!-- comment 1 -->
1319 <!-- comment 2 -->
1320 jkl
1321 !! html
1322 <p>asdf
1323 jkl
1324 </p>
1325 !! end
1326
1327 !! test
1328 Comment test 4
1329 !! wikitext
1330 asdf<!-- comment 1 -->jkl
1331 !! html
1332 <p>asdfjkl
1333 </p>
1334 !! end
1335
1336 !! test
1337 Comment spacing
1338 !! wikitext
1339 a
1340 <!-- foo --> b <!-- bar -->
1341 c
1342 !! html
1343 <p>a
1344 </p>
1345 <pre> b
1346 </pre>
1347 <p>c
1348 </p>
1349 !! end
1350
1351 !! test
1352 Comment whitespace
1353 !! wikitext
1354 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1355 !! html
1356
1357 !! end
1358
1359 !! test
1360 Comment semantics and delimiters
1361 !! wikitext
1362 <!-- --><!----><!-----><!------>
1363 !! html
1364
1365 !! end
1366
1367 !! test
1368 Comment semantics and delimiters, redux
1369 !! wikitext
1370 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1371 -- foo -- funky huh? ... -->
1372 !! html
1373
1374 !! end
1375
1376 !! test
1377 Comment semantics and delimiters: directors cut
1378 !! wikitext
1379 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1380 everything starting with < followed by !-- until the first -- and > we see,
1381 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1382 -->-->
1383 !! html
1384 <p>--&gt;
1385 </p>
1386 !! end
1387
1388 !! test
1389 Comment semantics: nesting
1390 !! wikitext
1391 <!--<!-- no, we're not going to do anything fancy here -->-->
1392 !! html
1393 <p>--&gt;
1394 </p>
1395 !! end
1396
1397 !! test
1398 Comment semantics: unclosed comment at end
1399 !! wikitext
1400 <!--This comment will run out to the end of the document
1401 !! html
1402
1403 !! end
1404
1405 !! test
1406 Comment in template title
1407 !! wikitext
1408 {{f<!---->oo}}
1409 !! html
1410 <p>FOO
1411 </p>
1412 !! end
1413
1414 !! test
1415 Comment on its own line post-expand
1416 !! wikitext
1417 a
1418 {{blank}}<!---->
1419 b
1420 !! html
1421 <p>a
1422 </p><p>b
1423 </p>
1424 !! end
1425
1426 !! test
1427 Comment on its own line post-expand with non-significant whitespace
1428 !! wikitext
1429 a
1430 {{blank}} <!---->
1431 b
1432 !! html
1433 <p>a
1434 </p><p>b
1435 </p>
1436 !! end
1437
1438 !! test
1439 Multiple comments should still parse as SOL-transparent
1440 !! options
1441 parsoid=wt2html,wt2wt
1442 !! wikitext
1443 <!--c1-->*a
1444 <!--c2--><!--c3--><!--c4-->*b
1445 !! html
1446 <ul>
1447 <li>a
1448 </li>
1449 <li>b
1450 </li>
1451 </ul>
1452 !! end
1453
1454 ###
1455 ### paragraph wrapping tests
1456 ###
1457 !! test
1458 No block tags
1459 !! wikitext
1460 a
1461
1462 b
1463 !! html
1464 <p>a
1465 </p><p>b
1466 </p>
1467 !! end
1468
1469 !! test
1470 Block tag on one line (<div>)
1471 !! wikitext
1472 a <div>foo</div>
1473
1474 b
1475 !! html
1476 a <div>foo</div>
1477 <p>b
1478 </p>
1479 !! end
1480
1481 !! test
1482 Block tag on one line (<blockquote>)
1483 !! wikitext
1484 a <blockquote>foo</blockquote>
1485
1486 b
1487 !! html
1488 a <blockquote>foo</blockquote>
1489 <p>b
1490 </p>
1491 !! end
1492
1493 !! test
1494 Block tag on both lines (<div>)
1495 !! wikitext
1496 a <div>foo</div>
1497
1498 b <div>foo</div>
1499 !! html
1500 a <div>foo</div>
1501 b <div>foo</div>
1502
1503 !! end
1504
1505 !! test
1506 Block tag on both lines (<blockquote>)
1507 !! wikitext
1508 a <blockquote>foo</blockquote>
1509
1510 b <blockquote>foo</blockquote>
1511 !! html
1512 a <blockquote>foo</blockquote>
1513 b <blockquote>foo</blockquote>
1514
1515 !! end
1516
1517 !! test
1518 Multiple lines without block tags
1519 !! wikitext
1520 <div>foo</div> a
1521 b
1522 c
1523 d<!--foo--> e
1524 x <div>foo</div> z
1525 !! html
1526 <div>foo</div> a
1527 <p>b
1528 c
1529 d e
1530 </p>
1531 x <div>foo</div> z
1532
1533 !! end
1534
1535 !! test
1536 Empty lines between lines with block tags
1537 !! wikitext
1538 <div></div>
1539
1540
1541 <div></div>a
1542
1543 b
1544 <div>a</div>b
1545
1546 <div>b</div>d
1547
1548
1549 <div>e</div>
1550 !! html
1551 <div></div>
1552 <p><br />
1553 </p>
1554 <div></div>a
1555 <p>b
1556 </p>
1557 <div>a</div>b
1558 <div>b</div>d
1559 <p><br />
1560 </p>
1561 <div>e</div>
1562
1563 !! end
1564
1565 ## PHP parser emits output which is broken
1566 !! test
1567 Unclosed HTML p-tags should be handled properly
1568 !! wikitext
1569 <div><p>foo</div>
1570 a
1571
1572 b
1573 !! html/parsoid
1574 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1575 <p>a</p>
1576 <p>b</p>
1577 !! end
1578
1579 ###
1580 ### Preformatted text
1581 ###
1582 !! test
1583 Preformatted text
1584 !! wikitext
1585 This is some
1586 Preformatted text
1587 With ''italic''
1588 And '''bold'''
1589 And a [[Main Page|link]]
1590 !! html
1591 <pre>This is some
1592 Preformatted text
1593 With <i>italic</i>
1594 And <b>bold</b>
1595 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1596 </pre>
1597 !! end
1598
1599 !! test
1600 Tabs don't trigger preformatted text
1601 !! wikitext
1602 This is not
1603 preformatted text.
1604 This is preformatted text.
1605 So is this.
1606 !! html
1607 <p> This is not
1608 preformatted text.
1609 </p>
1610 <pre>This is preformatted text.
1611 So is this.
1612 </pre>
1613 !! end
1614
1615 !! test
1616 Ident preformatting with inline content
1617 !! wikitext
1618 a
1619 ''b''
1620 !! html
1621 <pre>a
1622 <i>b</i>
1623 </pre>
1624 !! end
1625
1626 !! test
1627 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1628 !! wikitext
1629 <pre><nowiki>
1630 <b>
1631 <cite>
1632 <em>
1633 </nowiki></pre>
1634 !! html
1635 <pre>
1636 &lt;b&gt;
1637 &lt;cite&gt;
1638 &lt;em&gt;
1639 </pre>
1640
1641 !! end
1642
1643 !! test
1644 Regression with preformatted in <center>
1645 !! wikitext
1646 <center>
1647 Blah
1648 </center>
1649 !! html
1650 <center>
1651 <pre>Blah
1652 </pre>
1653 </center>
1654
1655 !! end
1656
1657 !! test
1658 Bug 52763: Preformatted in <blockquote>
1659 !! wikitext
1660 <blockquote>
1661 Blah
1662 {|
1663 |
1664 indented cell (no pre-wrapping!)
1665 |}
1666 </blockquote>
1667 !! html
1668 <blockquote>
1669 <p> Blah
1670 </p>
1671 <table>
1672 <tr>
1673 <td>
1674 <p> indented cell (no pre-wrapping!)
1675 </p>
1676 </td></tr></table>
1677 </blockquote>
1678
1679 !! end
1680
1681 !! test
1682 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1683 !! wikitext
1684 <blockquote>
1685 Foo
1686
1687 Bar
1688 </blockquote>
1689 !! html
1690 <blockquote>
1691 <p>Foo
1692 </p><p>Bar
1693 </p>
1694 </blockquote>
1695
1696 !! end
1697
1698 !! test
1699 Bug 15491: <ins>/<del> in blockquote
1700 !! wikitext
1701 <blockquote>
1702 Foo <del>bar</del> <ins>baz</ins> quux
1703 </blockquote>
1704 !! html
1705 <blockquote>
1706 <p>Foo <del>bar</del> <ins>baz</ins> quux
1707 </p>
1708 </blockquote>
1709
1710 !! end
1711
1712 # Note that the p-wrapping is newline sensitive, which could be
1713 # considered a bug: tidy will wrap only the 'Foo' in the example
1714 # below in a <p> tag. (see comment 23-25 of bug #6200)
1715 !! test
1716 Bug 15491: <ins>/<del> in blockquote (2)
1717 !! wikitext
1718 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1719 </blockquote>
1720 !! html
1721 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1722 </blockquote>
1723
1724 !! end
1725
1726 !! test
1727 <pre> with attributes (bug 3202)
1728 !! wikitext
1729 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1730 !! html
1731 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1732
1733 !! end
1734
1735 !! test
1736 <pre> with width attribute (bug 3202)
1737 !! wikitext
1738 <pre width="8">Narrow screen goodies</pre>
1739 !! html
1740 <pre width="8">Narrow screen goodies</pre>
1741
1742 !! end
1743
1744 !! test
1745 <pre> with forbidden attribute (bug 3202)
1746 !! wikitext
1747 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1748 !! html
1749 <pre width="8">Narrow screen goodies</pre>
1750
1751 !! end
1752
1753 !! test
1754 Entities inside <pre>
1755 !! wikitext
1756 <pre>&lt;</pre>
1757 !! html
1758 <pre>&lt;</pre>
1759
1760 !! end
1761
1762 !! test
1763 <pre> with forbidden attribute values (bug 3202)
1764 !! wikitext
1765 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1766 !! html
1767 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1768
1769 !! end
1770
1771 !! test
1772 <nowiki> inside <pre> (bug 13238)
1773 !! wikitext
1774 <pre>
1775 <nowiki>
1776 </pre>
1777 <pre>
1778 <nowiki></nowiki>
1779 </pre>
1780 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1781 !! html
1782 <pre>
1783 &lt;nowiki&gt;
1784 </pre>
1785 <pre>
1786
1787 </pre>
1788 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1789
1790 !! end
1791
1792 !! test
1793 <nowiki> and <pre> preference (first one wins)
1794 !! wikitext
1795 <pre>
1796 <nowiki>
1797 </pre>
1798 </nowiki>
1799 </pre>
1800
1801 <nowiki>
1802 <pre>
1803 <nowiki>
1804 </pre>
1805 </nowiki>
1806 </pre>
1807
1808 !! html
1809 <pre>
1810 &lt;nowiki&gt;
1811 </pre>
1812 <p>&lt;/nowiki&gt;
1813 &lt;/pre&gt;
1814 </p><p>
1815 &lt;pre&gt;
1816 &lt;nowiki&gt;
1817 &lt;/pre&gt;
1818
1819 &lt;/pre&gt;
1820 </p>
1821 !! end
1822
1823 !! test
1824 </pre> inside nowiki
1825 !! wikitext
1826 <nowiki></pre></nowiki>
1827 !! html
1828 <p>&lt;/pre&gt;
1829 </p>
1830 !! end
1831
1832 !! test
1833 Empty pre; pre inside other HTML tags (bug 54946)
1834 !! wikitext
1835 a
1836
1837 <div><pre>
1838 foo
1839 </pre></div>
1840 <pre></pre>
1841 !! html
1842 <p>a
1843 </p>
1844 <div><pre>
1845 foo
1846 </pre></div>
1847 <pre></pre>
1848
1849 !! end
1850
1851 !! test
1852 HTML pre followed by indent-pre
1853 !! wikitext
1854 <pre>foo</pre>
1855 bar
1856 !! html
1857 <pre>foo</pre>
1858 <pre>bar
1859 </pre>
1860 !! end
1861
1862 !!test
1863 Block tag pre
1864 !!options
1865 parsoid
1866 !! wikitext
1867 <p><pre>foo</pre></p>
1868 !! html
1869 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1870 !!end
1871
1872 !!test
1873 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1874 !! wikitext
1875 {{echo|}}
1876 !! html
1877
1878 !!end
1879
1880 !!test
1881 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1882 !! wikitext
1883 {{echo|
1884 foo}}
1885 !! html
1886 <p>foo
1887 </p>
1888 !!end
1889
1890 !! test
1891 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1892 !! wikitext
1893 {{echo|a
1894 b}}
1895 !! html
1896 <pre>a
1897 </pre>
1898 <p>b
1899 </p>
1900 !!end
1901
1902 !! test
1903 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1904 !! wikitext
1905 {{echo|a
1906 b
1907 c
1908 d
1909 e
1910 }}
1911 !! html
1912 <pre>a
1913 </pre>
1914 <p>b
1915 c
1916 </p>
1917 <pre>d
1918 </pre>
1919 <p>e
1920 </p>
1921 !!end
1922
1923 !!test
1924 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1925 !! wikitext
1926 {{echo| foo}}
1927
1928 {{echo| foo}}{{echo| bar}}
1929
1930 {{echo| foo}}
1931 {{echo| bar}}
1932
1933 {{echo|<!--cmt--> foo}}
1934
1935 <!--cmt-->{{echo| foo}}
1936
1937 {{echo|{{echo| }}bar}}
1938 !! html
1939 <pre>foo
1940 </pre>
1941 <pre>foo bar
1942 </pre>
1943 <pre>foo
1944 bar
1945 </pre>
1946 <pre>foo
1947 </pre>
1948 <pre>foo
1949 </pre>
1950 <pre>bar
1951 </pre>
1952 !!end
1953
1954 !! test
1955 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1956 !! wikitext
1957 {{echo| }}a
1958
1959 {{echo|
1960 }}a
1961
1962 {{echo|
1963 b}}
1964
1965 {{echo|a
1966 }}b
1967
1968 {{echo|a
1969 }} b
1970 !! html
1971 <pre>a
1972 </pre>
1973 <p><br />
1974 </p>
1975 <pre>a
1976 </pre>
1977 <p><br />
1978 </p>
1979 <pre>b
1980 </pre>
1981 <p>a
1982 </p>
1983 <pre>b
1984 </pre>
1985 <p>a
1986 </p>
1987 <pre>b
1988 </pre>
1989 !!end
1990
1991 !! test
1992 Things that look like <pre> tags aren't treated as such
1993 !! wikitext
1994 Barack Obama <President> of the United States
1995 !! html
1996 <p>Barack Obama &lt;President&gt; of the United States
1997 </p>
1998 !! end
1999
2000 !! test
2001 Parsoid: handle pre with space after attribute
2002 !! options
2003 parsoid=wt2html
2004 !! wikitext
2005 <pre style="width:50%;" >{{echo|foo}}</pre>
2006 !! html
2007 <pre style="width:50%;">{{echo|foo}}</pre>
2008 !! end
2009
2010 # TODO / maybe: fix wt2wt for this
2011 !! test
2012 Parsoid: Don't paragraph-wrap fosterable content
2013 !! options
2014 parsoid=wt2html
2015 !! wikitext
2016 {|
2017 <td></td>
2018 <td></td>
2019
2020
2021
2022 |}
2023 !! html
2024 <table>
2025
2026 <tbody>
2027 <tr>
2028 <td></td>
2029
2030 <td></td></tr>
2031
2032
2033
2034 </tbody></table>
2035 !! end
2036
2037 !! test
2038 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2039 !! options
2040 parsoid=wt2html
2041 !! wikitext
2042 {|
2043 <td>
2044 <td>
2045 </td>
2046
2047
2048
2049 |}
2050 !! html
2051 <table>
2052
2053 <tbody>
2054 <tr>
2055 <td></td>
2056
2057 <td>
2058 </td></tr>
2059
2060
2061
2062 </tbody></table>
2063 !! end
2064
2065
2066 #--------------------------------------------------------------------
2067 # Transclusion parameter whitespace stripping tests
2068 # Behavior is different for positional and named parameters
2069 #--------------------------------------------------------------------
2070 !! test
2071 Templates: Strip leading and trailing whitespace from named-param values
2072 !! wikitext
2073 {{echo|1= a }}
2074
2075 {{echo|1= {{echo|b}} }}
2076
2077 {{echo| 1 =
2078 c }}
2079
2080 {{echo| 1 =
2081 * d
2082 }}
2083 !! html
2084 <p>a
2085 </p><p>b
2086 </p><p>c
2087 </p>
2088 <ul>
2089 <li> d
2090 </li>
2091 </ul>
2092
2093 !! end
2094
2095 !! test
2096 Templates: Don't strip whitespace from positional-param values
2097 !! wikitext
2098 {{echo|a }}
2099
2100 {{echo|{{echo|b}} }}
2101
2102 {{echo| c
2103 }}
2104
2105 {{echo| {{echo|d}}
2106 }}
2107
2108 {{echo|
2109 e}}
2110
2111 {{echo|
2112 * f}}
2113
2114 {{echo|
2115 }}g
2116 !! html
2117 <p>a
2118 </p><p>b
2119 </p>
2120 <pre>c
2121 </pre>
2122 <p><br />
2123 </p>
2124 <pre>d
2125 </pre>
2126 <p><br />
2127 </p>
2128 <pre>e
2129 </pre>
2130 <p><br />
2131 </p>
2132 <ul>
2133 <li> f
2134 </li>
2135 </ul>
2136 <p><br />
2137 </p>
2138 <pre>g
2139 </pre>
2140 !! end
2141
2142 !! test
2143 Templates: Handle empty comment-and-ws-only lines correctly
2144 !! wikitext
2145 {{echo|foo
2146 <!--should be ignored-->
2147 <!--should be ignored as well-->
2148 bar}}
2149 !! html
2150 <p>foo
2151 bar
2152 </p>
2153 !! end
2154
2155 !! test
2156 Templates: Handle comments in the target
2157 !! wikitext
2158 {{echo
2159 <!-- should be ignored -->
2160 |foo}}
2161
2162 {{echo<!-- should be ignored -->
2163 |foo}}
2164
2165 {{echo<!-- should be ignored -->|foo}}
2166
2167 {{<!-- should be ignored -->echo|foo}}
2168 !!html/parsoid
2169 <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>
2170
2171 <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>
2172
2173 <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>
2174
2175 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2176 !!end
2177
2178 #--------------------------------------------------------------------
2179 # Transclusion parameter escaping tests
2180 #--------------------------------------------------------------------
2181 !! test
2182 Templates: Parsoid parameter escaping test 1
2183 !! options
2184 parsoid
2185 !! wikitext
2186 {{echo|[foo]|{{echo|[bar]}}}}
2187 !! html
2188 <p about="#mwt1" typeof="mw:Transclusion"
2189 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2190 !! end
2191
2192 !! test
2193 Parsoid: Pipes in external links in template parameter
2194 !! options
2195 parsoid
2196 !! wikitext
2197 {{echo|[{{echo|http://example.com}} link]}}
2198 !! html
2199 <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>
2200 !! end
2201
2202 !! test
2203 Parsoid: pipe in transclusion parameter
2204 !! options
2205 parsoid
2206 !! wikitext
2207 {{echo|http://foo.com/a&#124;b}}
2208 !! html
2209 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2210 typeof="mw:Transclusion"
2211 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>
2212 !! end
2213
2214 !! test
2215 Parsoid: Pipe in external link target and content in template parameter
2216 !! options
2217 parsoid=html2wt,wt2wt
2218 !! wikitext
2219 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2220 !! html
2221 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2222 typeof="mw:Transclusion"
2223 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2224 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2225 !! end
2226
2227 !! test
2228 Templates: Don't escape already nowiki-escaped text in template parameters
2229 !! options
2230 parsoid=html2wt,wt2wt
2231 !! wikitext
2232 {{echo|foo<nowiki>|</nowiki>bar}}
2233 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2234 {{echo|<nowiki></nowiki>}}
2235 !! html
2236 <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>
2237 <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>
2238 <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>
2239 </p>
2240 !! end
2241
2242 ## Bug 52824
2243 !! test
2244 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2245 !! options
2246 parsoid=html2wt,wt2wt
2247 !! wikitext
2248 {{echo|{{echo|1=bar}}}}
2249 !! html
2250 <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>
2251 !! end
2252
2253 ## Bug 56733
2254 !! test
2255 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2256 !! options
2257 parsoid
2258 !! wikitext
2259 {{echo|a : b}}
2260 !! html
2261 <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>
2262 !! end
2263
2264 ###
2265 ### Parsoid-centric tests for testing RT edge cases for pre
2266 ###
2267
2268 !!test
2269 1a. Indent-Pre and Comments
2270 !! wikitext
2271 a
2272 <!--a-->
2273 c
2274 !! html
2275 <pre>a
2276 </pre>
2277 <p>c
2278 </p>
2279 !!end
2280
2281 !!test
2282 1b. Indent-Pre and Comments
2283 !! wikitext
2284 a
2285 <!--a-->
2286 c
2287 !! html
2288 <pre>a
2289 </pre>
2290 <p>c
2291 </p>
2292 !!end
2293
2294 !!test
2295 1c. Indent-Pre and Comments
2296 !! wikitext
2297 <!--a--> a
2298
2299 <!--a--> a
2300 !! html
2301 <pre> a
2302 </pre>
2303 <pre> a
2304 </pre>
2305 !!end
2306
2307 !!test
2308 1d. Indent-Pre and Comments
2309 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2310 !! wikitext
2311 <!--a--> a
2312
2313 <!--b-->b
2314 !! html
2315 <pre>a
2316 </pre>
2317 <pre>b
2318 </pre>
2319 !!end
2320
2321 !!test
2322 2a. Indent-Pre and tables
2323 !! wikitext
2324 {|
2325 |-
2326 !h1!!h2
2327 |foo||bar
2328 |}
2329 !! html
2330 <table>
2331
2332 <tr>
2333 <th>h1</th>
2334 <th>h2
2335 </th>
2336 <td>foo</td>
2337 <td>bar
2338 </td></tr></table>
2339
2340 !!end
2341
2342 !!test
2343 2b. Indent-Pre and tables
2344 !! wikitext
2345 {|
2346 |-
2347 |foo
2348 |}
2349 !! html
2350 <table>
2351
2352 <tr>
2353 <td>foo
2354 </td></tr></table>
2355
2356 !!end
2357
2358 !!test
2359 2c. Indent-Pre and tables (bug 42252)
2360 !! wikitext
2361 {|
2362 |+ foo
2363 ! | bar
2364 |}
2365 !! html
2366 <table>
2367 <caption> foo
2368 </caption>
2369 <tr>
2370 <th> bar
2371 </th></tr></table>
2372
2373 !!end
2374
2375 !!test
2376 3a. Indent-Pre and block tags (single-line html)
2377 !! wikitext
2378 a <p> foo </p>
2379 b <div> foo </div>
2380 c <blockquote> foo </blockquote>
2381 <span> foo </span>
2382 !! html
2383 a <p> foo </p>
2384 b <div> foo </div>
2385 c <blockquote> foo </blockquote>
2386 <pre><span> foo </span>
2387 </pre>
2388 !!end
2389
2390 !!test
2391 3b. Indent-Pre and block tags (multi-line html)
2392 !! wikitext
2393 a <span>foo</span>
2394 b <div> foo </div>
2395 !! html
2396 <pre>a <span>foo</span>
2397 </pre>
2398 b <div> foo </div>
2399
2400 !!end
2401
2402 !!test
2403 3c. Indent-Pre and block tags (pre-content on separate line)
2404 !! wikitext
2405 <p>
2406 foo
2407 </p>
2408
2409 <div>
2410 foo
2411 </div>
2412
2413 <center>
2414 foo
2415 </center>
2416
2417 <blockquote>
2418 foo
2419 </blockquote>
2420
2421 <blockquote>
2422 <pre>
2423 foo
2424 </pre>
2425 </blockquote>
2426
2427 <table><tr><td>
2428 foo
2429 </td></tr></table>
2430
2431 <ul><li>
2432 foo
2433 </li></ul>
2434
2435 !! html
2436 <p>
2437 foo
2438 </p>
2439 <div>
2440 <pre>foo
2441 </pre>
2442 </div>
2443 <center>
2444 <pre>foo
2445 </pre>
2446 </center>
2447 <blockquote>
2448 <p> foo
2449 </p>
2450 </blockquote>
2451 <blockquote>
2452 <pre>
2453 foo
2454 </pre>
2455 </blockquote>
2456 <table><tr><td>
2457 <pre>foo
2458 </pre>
2459 </td></tr></table>
2460 <ul><li>
2461 foo
2462 </li></ul>
2463
2464 !!end
2465
2466 !!test
2467 4. Indent-Pre and extension tags
2468 !! wikitext
2469 a <gallery>
2470 File:foobar.jpg
2471 </gallery>
2472 !! html
2473 a <ul class="gallery mw-gallery-traditional">
2474 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2475 <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>
2476 <div class="gallerytext">
2477 </div>
2478 </div></li>
2479 </ul>
2480
2481 !!end
2482
2483 !! test
2484 Leading pipes outside of tables
2485 !! options
2486 parsoid
2487 !! wikitext
2488 | foo
2489 !! html
2490 <p>| foo</p>
2491 !! end
2492
2493 !! test
2494 Leading pipes outside of tables 2
2495 !! options
2496 parsoid
2497 !! wikitext
2498 a
2499 | foo
2500 b
2501 !! html
2502 <p>a
2503 | foo
2504 b</p>
2505 !! end
2506
2507 !! test
2508 Leading pipes outside of tables 3
2509 !! options
2510 parsoid
2511 !! wikitext
2512 a
2513 | class="foo bar" | baz
2514 b
2515 !! html
2516 <p>a
2517 | class="foo bar" | baz
2518 b</p>
2519 !! end
2520
2521 !!test
2522 Render paragraphs when indent-pre is suppressed in blocklevels
2523 !! wikitext
2524 <blockquote>
2525 foo
2526
2527 bar
2528 </blockquote>
2529 !! html
2530 <blockquote>
2531 <p> foo
2532 </p><p> bar
2533 </p>
2534 </blockquote>
2535
2536 !!end
2537
2538 !!test
2539 4. Multiple spaces at start-of-line
2540 !! wikitext
2541 <p> foo </p>
2542 foo
2543 {|
2544 |foo
2545 |}
2546 !! html
2547 <p> foo </p>
2548 <pre> foo
2549 </pre>
2550 <table>
2551 <tr>
2552 <td>foo
2553 </td></tr></table>
2554
2555 !!end
2556
2557 ## NOTE: the leading white-space chars on empty line are significant
2558 !! test
2559 5a. White-space in indent-pre
2560 !! wikitext
2561 a<br />
2562
2563 b
2564 !! html
2565 <pre>a<br />
2566
2567 b
2568 </pre>
2569 !! end
2570
2571 ## NOTE: the leading white-space chars on empty line are significant
2572 !! test
2573 5b. White-space in indent-pre
2574 !! wikitext
2575 a
2576
2577 b
2578
2579
2580 c
2581 !! html
2582 <pre>a
2583
2584 b
2585
2586
2587 c
2588 </pre>
2589 !! end
2590
2591 !! test
2592 5c. White-space in indent-pre
2593 !! wikitext
2594 ''a''
2595 ''b''
2596 ''c''
2597 !! html
2598 <pre><i>a</i>
2599 <i>b</i>
2600 <i>c</i>
2601 </pre>
2602 !! end
2603
2604 !! test
2605 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2606 !! wikitext
2607 a
2608
2609 <!-- continue -->
2610 b
2611
2612 c
2613
2614 d
2615 !! html
2616 <pre>a
2617
2618 b
2619 </pre>
2620 <pre>c
2621
2622 </pre>
2623 <p>d
2624 </p>
2625 !! end
2626
2627 !! test
2628 7a. Indent-pre and category links
2629 !! options
2630 parsoid=wt2html,wt2wt
2631 !! wikitext
2632 [[Category:foo]] <!-- No pre-wrapping -->
2633 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2634 !! html
2635 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2636 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2637 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2638 !! end
2639
2640 !! test
2641 7b. Indent-pre and category links
2642 !! options
2643 parsoid=wt2html,wt2wt
2644 !! wikitext
2645 [[Category:foo]] a
2646 [[Category:foo]] {{echo|b}}
2647 !! html
2648 <pre>
2649 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2650
2651 <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>
2652 !! end
2653
2654 ###
2655 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2656 ###
2657
2658 !!test
2659 HTML-pre: 1. embedded newlines
2660 !! wikitext
2661 <pre>foo</pre>
2662
2663 <pre>
2664 foo
2665 </pre>
2666
2667 <pre>
2668
2669 foo
2670 </pre>
2671
2672 <pre>
2673
2674
2675 foo
2676 </pre>
2677 !! html
2678 <pre>foo</pre>
2679 <pre>
2680 foo
2681 </pre>
2682 <pre>
2683
2684 foo
2685 </pre>
2686 <pre>
2687
2688
2689 foo
2690 </pre>
2691
2692 !!end
2693
2694 !!test
2695 HTML-pre: 2: indented text
2696 !! wikitext
2697 <pre>
2698 foo
2699 </pre>
2700 !! html
2701 <pre>
2702 foo
2703 </pre>
2704
2705 !!end
2706
2707 !!test
2708 HTML-pre: 3: other wikitext
2709 !! wikitext
2710 <pre>
2711 * foo
2712 # bar
2713 = no-h =
2714 '' no-italic ''
2715 [[ NoLink ]]
2716 </pre>
2717 !! html
2718 <pre>
2719 * foo
2720 # bar
2721 = no-h =
2722 '' no-italic ''
2723 [[ NoLink ]]
2724 </pre>
2725
2726 !!end
2727
2728 ###
2729 ### Definition lists
2730 ###
2731 !! test
2732 Simple definition
2733 !! wikitext
2734 ; name : Definition
2735 !! html
2736 <dl>
2737 <dt> name&#160;</dt>
2738 <dd> Definition
2739 </dd>
2740 </dl>
2741
2742 !! end
2743
2744 !! test
2745 Definition list for indentation only
2746 !! wikitext
2747 : Indented text
2748 !! html
2749 <dl>
2750 <dd> Indented text
2751 </dd>
2752 </dl>
2753
2754 !! end
2755
2756 !! test
2757 Definition list with no space
2758 !! wikitext
2759 ;name:Definition
2760 !! html
2761 <dl>
2762 <dt>name</dt>
2763 <dd>Definition
2764 </dd>
2765 </dl>
2766
2767 !!end
2768
2769 !! test
2770 Definition list with URL link
2771 !! wikitext
2772 ; http://example.com/ : definition
2773 !! html
2774 <dl>
2775 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2776 <dd> definition
2777 </dd>
2778 </dl>
2779
2780 !! end
2781
2782 !! test
2783 Definition list with bracketed URL link
2784 !! wikitext
2785 ;[http://www.example.com/ Example]:Something about it
2786 !! html
2787 <dl>
2788 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2789 <dd>Something about it
2790 </dd>
2791 </dl>
2792
2793 !! end
2794
2795 !! test
2796 Definition list with wikilink containing colon
2797 !! wikitext
2798 ; [[Help:FAQ]]: The least-read page on Wikipedia
2799 !! html
2800 <dl>
2801 <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>
2802 <dd> The least-read page on Wikipedia
2803 </dd>
2804 </dl>
2805
2806 !! end
2807
2808 # At Brion's and JeLuF's insistence... :)
2809 !! test
2810 Definition list with news link containing colon
2811 !! wikitext
2812 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2813 !! html
2814 <dl>
2815 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2816 <dd> This isn't even a real newsgroup!
2817 </dd>
2818 </dl>
2819
2820 !! end
2821
2822 !! test
2823 Malformed definition list with colon
2824 !! wikitext
2825 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2826 !! html
2827 <dl>
2828 <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
2829 </dt>
2830 </dl>
2831
2832 !! end
2833
2834 !! test
2835 Definition lists: colon in external link text
2836 !! wikitext
2837 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2838 !! html
2839 <dl>
2840 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2841 <dd> OK, I made that up
2842 </dd>
2843 </dl>
2844
2845 !! end
2846
2847 !! test
2848 Definition lists: colon in HTML attribute
2849 !! wikitext
2850 ;<b style="display: inline">bold</b>
2851 !! html
2852 <dl>
2853 <dt><b style="display: inline">bold</b>
2854 </dt>
2855 </dl>
2856
2857 !! end
2858
2859 !! test
2860 Definition lists: self-closed tag
2861 !! wikitext
2862 ;one<br/>two : two-line fun
2863 !! html
2864 <dl>
2865 <dt>one<br />two&#160;</dt>
2866 <dd> two-line fun
2867 </dd>
2868 </dl>
2869
2870 !! end
2871
2872 !! test
2873 Bug 11748: Literal closing tags
2874 !! wikitext
2875 <dl>
2876 <dt>test 1</dt>
2877 <dd>test test test test test</dd>
2878 <dt>test 2</dt>
2879 <dd>test test test test test</dd>
2880 </dl>
2881 !! html
2882 <dl>
2883 <dt>test 1</dt>
2884 <dd>test test test test test</dd>
2885 <dt>test 2</dt>
2886 <dd>test test test test test</dd>
2887 </dl>
2888
2889 !! end
2890
2891 !! test
2892 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2893 !! wikitext
2894 <ul><li>
2895 ; term : description
2896 * unordered
2897 </li></ul>
2898 !! html
2899 <ul><li>
2900 <dl>
2901 <dt> term&#160;</dt>
2902 <dd> description
2903 </dd>
2904 </dl>
2905 <ul>
2906 <li> unordered
2907 </li>
2908 </ul>
2909 </li></ul>
2910
2911 !! end
2912
2913 !! test
2914
2915 Definition list with empty definition and following paragraph
2916 !! wikitext
2917 ; term:
2918 Paragraph text
2919 !! html
2920 <dl>
2921 <dt> term</dt>
2922 <dd>
2923 </dd>
2924 </dl>
2925 <p>Paragraph text
2926 </p>
2927 !! end
2928
2929 !! test
2930 Nested definition lists using html syntax
2931 !! wikitext
2932 <dl><dd>
2933 <dl>
2934 <dd>Foo</dd>
2935 </dl>
2936 </dd></dl>
2937 !! html
2938 <dl><dd>
2939 <dl>
2940 <dd>Foo</dd>
2941 </dl>
2942 </dd></dl>
2943
2944 !! end
2945
2946 !! test
2947 Definition Lists: No nesting: Multiple dd's
2948 !! wikitext
2949 ;x
2950 :a
2951 :b
2952 !! html
2953 <dl>
2954 <dt>x
2955 </dt>
2956 <dd>a
2957 </dd>
2958 <dd>b
2959 </dd>
2960 </dl>
2961
2962 !! end
2963
2964 !! test
2965 Definition Lists: Indentation: Regular
2966 !! wikitext
2967 :i1
2968 ::i2
2969 :::i3
2970 !! html
2971 <dl>
2972 <dd>i1
2973 <dl>
2974 <dd>i2
2975 <dl>
2976 <dd>i3
2977 </dd>
2978 </dl>
2979 </dd>
2980 </dl>
2981 </dd>
2982 </dl>
2983
2984 !! end
2985
2986 !! test
2987 Definition Lists: Indentation: Missing 1st level
2988 !! wikitext
2989 ::i2
2990 :::i3
2991 !! html
2992 <dl>
2993 <dd><dl>
2994 <dd>i2
2995 <dl>
2996 <dd>i3
2997 </dd>
2998 </dl>
2999 </dd>
3000 </dl>
3001 </dd>
3002 </dl>
3003
3004 !! end
3005
3006 !! test
3007 Definition Lists: Indentation: Multi-level indent
3008 !! wikitext
3009 :::i3
3010 !! html
3011 <dl>
3012 <dd><dl>
3013 <dd><dl>
3014 <dd>i3
3015 </dd>
3016 </dl>
3017 </dd>
3018 </dl>
3019 </dd>
3020 </dl>
3021
3022 !! end
3023
3024 !! test
3025 Definition Lists: Hacky use to indent tables
3026 !! wikitext
3027 ::{|
3028 |foo
3029 |bar
3030 |}
3031 this text
3032 should be left alone
3033 !! html
3034 <dl><dd><dl><dd><table>
3035 <tr>
3036 <td>foo
3037 </td>
3038 <td>bar
3039 </td></tr></table></dd></dl></dd></dl>
3040 <p>this text
3041 should be left alone
3042 </p>
3043 !! end
3044
3045 !! test
3046 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3047 !! wikitext
3048 <!-- foo -->
3049 ::{|
3050 |foo
3051 |bar
3052 |}<!-- bar -->
3053 this text
3054 should be left alone
3055 !! html/parsoid
3056 <!-- foo -->
3057 <dl><dd><dl><dd><table><tr>
3058 <td>foo</td>
3059 <td>bar</td>
3060 </tr></table><!-- bar --></dd></dl></dd></dl>
3061 <p>this text
3062 should be left alone</p>
3063 !! end
3064
3065 !! test
3066 Definition Lists: Hacky use to indent tables, with comment before table
3067 !! wikitext
3068 ::<!-- foo -->{|
3069 |foo
3070 |}
3071 !! html/parsoid
3072 <dl><dd><dl><dd><!-- foo --><table><tr>
3073 <td>foo</td>
3074 </tr></table></dd></dl></dd></dl>
3075 !! end
3076
3077 # Bug 52473
3078 !! test
3079 Definition Lists: Hacky use to indent tables (WS-insensitive)
3080 !! options
3081 parsoid
3082 !! wikitext
3083 : {|
3084 |a
3085 |}
3086 !! html
3087 <dl>
3088 <dd> <table><tr><td>a</td></tr></table> </dd>
3089 </dl>
3090 !! end
3091 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3092 ## as an empty dt item. It also ignores all but the last ";" when followed
3093 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3094 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3095 ## ";"s.
3096 ##
3097 ## Ex: ";;t2 ::d2" is transformed into:
3098 ##
3099 ## <dl>
3100 ## <dt>t2 </dt>
3101 ## <dd>
3102 ## <dl>
3103 ## <dt></dt>
3104 ## <dd>d2</dd>
3105 ## </dl>
3106 ## </dd>
3107 ## </dl>
3108 ##
3109 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3110 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3111 ##
3112 ## <dl>
3113 ## <dt>
3114 ## <dl>
3115 ## <dt>t2 </dt>
3116 ## <dd>:d2</dd>
3117 ## </dl>
3118 ## </dt>
3119 ## </dl>
3120 ##
3121 ## All Parsoid only definition list tests have this difference.
3122 ##
3123 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3124 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3125
3126 !! test
3127 Table / list interaction: indented table with lists in table contents
3128 !! wikitext
3129 :{|
3130 |-
3131 | a
3132 * b
3133 |-
3134 | c
3135 * d
3136 |}
3137 !! html
3138 <dl><dd><table>
3139
3140 <tr>
3141 <td> a
3142 <ul>
3143 <li> b
3144 </li>
3145 </ul>
3146 </td></tr>
3147 <tr>
3148 <td> c
3149 <ul>
3150 <li> d
3151 </li>
3152 </ul>
3153 </td></tr></table></dd></dl>
3154
3155 !! end
3156
3157 !!test
3158 Table / list interaction: lists nested in tables nested in indented lists
3159 !! wikitext
3160 :{|
3161 |
3162 :a
3163 :b
3164 |
3165 *c
3166 *d
3167 |}
3168
3169 *e
3170 *f
3171 !! html
3172 <dl><dd><table>
3173 <tr>
3174 <td>
3175 <dl>
3176 <dd>a
3177 </dd>
3178 <dd>b
3179 </dd>
3180 </dl>
3181 </td>
3182 <td>
3183 <ul>
3184 <li>c
3185 </li>
3186 <li>d
3187 </li>
3188 </ul>
3189 </td></tr></table></dd></dl>
3190 <ul>
3191 <li>e
3192 </li>
3193 <li>f
3194 </li>
3195 </ul>
3196
3197 !!end
3198
3199 !! test
3200 Definition Lists: Nesting: Multi-level (Parsoid only)
3201 !! options
3202 parsoid
3203 !! wikitext
3204 ;t1 :d1
3205 ;;t2 ::d2
3206 ;;;t3 :::d3
3207 !! html
3208 <dl>
3209 <dt>t1 </dt>
3210 <dd>d1</dd>
3211 <dt>
3212 <dl>
3213 <dt>t2 </dt>
3214 <dd>:d2</dd>
3215 <dt>
3216 <dl>
3217 <dt>t3 </dt>
3218 <dd>::d3</dd>
3219 </dl>
3220 </dt>
3221 </dl>
3222 </dt>
3223 </dl>
3224
3225
3226 !! end
3227
3228
3229 !! test
3230 Definition Lists: Nesting: Test 2 (Parsoid only)
3231 !! options
3232 parsoid
3233 !! wikitext
3234 ;t1
3235 ::d2
3236 !! html
3237 <dl>
3238 <dt>t1</dt>
3239 <dd>
3240 <dl>
3241 <dd>d2</dd>
3242 </dl>
3243 </dd>
3244 </dl>
3245
3246 !! end
3247
3248
3249 !! test
3250 Definition Lists: Nesting: Test 3 (Parsoid only)
3251 !! options
3252 parsoid
3253 !! wikitext
3254 :;t1
3255 ::::d2
3256 !! html
3257 <dl>
3258 <dd>
3259 <dl>
3260 <dt>t1</dt>
3261 <dd>
3262 <dl>
3263 <dd>
3264 <dl>
3265 <dd>d2</dd>
3266 </dl>
3267 </dd>
3268 </dl>
3269 </dd>
3270 </dl>
3271 </dd>
3272 </dl>
3273
3274 !! end
3275
3276
3277 !! test
3278 Definition Lists: Nesting: Test 4
3279 !! wikitext
3280 ::;t3
3281 :::d3
3282 !! html
3283 <dl>
3284 <dd><dl>
3285 <dd><dl>
3286 <dt>t3
3287 </dt>
3288 <dd>d3
3289 </dd>
3290 </dl>
3291 </dd>
3292 </dl>
3293 </dd>
3294 </dl>
3295
3296 !! end
3297
3298
3299 ## The Parsoid team believes the following three test exposes a
3300 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3301 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3302 !! test
3303 Definition Lists: Mixed Lists: Test 1
3304 !! wikitext
3305 :;* foo
3306 ::* bar
3307 :; baz
3308 !! html/php
3309 <dl>
3310 <dd><dl>
3311 <dt><ul>
3312 <li> foo
3313 </li>
3314 <li> bar
3315 </li>
3316 </ul>
3317 </dt>
3318 </dl>
3319 <dl>
3320 <dt> baz
3321 </dt>
3322 </dl>
3323 </dd>
3324 </dl>
3325
3326 !! html/parsoid
3327 <dl>
3328 <dd><dl>
3329 <dt><ul>
3330 <li> foo
3331 </li>
3332 </ul></dt>
3333 <dd><ul>
3334 <li> bar
3335 </li>
3336 </ul></dd>
3337 <dt> baz</dt>
3338 </dl></dd>
3339 </dl>
3340 !! end
3341
3342 !! test
3343 Definition Lists: Mixed Lists: Test 2
3344 !! wikitext
3345 *: d1
3346 *: d2
3347 !! html
3348 <ul>
3349 <li><dl>
3350 <dd> d1
3351 </dd>
3352 <dd> d2
3353 </dd>
3354 </dl>
3355 </li>
3356 </ul>
3357
3358 !! end
3359
3360
3361 !! test
3362 Definition Lists: Mixed Lists: Test 3
3363 !! wikitext
3364 *::: d1
3365 *::: d2
3366 !! html
3367 <ul>
3368 <li><dl>
3369 <dd><dl>
3370 <dd><dl>
3371 <dd> d1
3372 </dd>
3373 <dd> d2
3374 </dd>
3375 </dl>
3376 </dd>
3377 </dl>
3378 </dd>
3379 </dl>
3380 </li>
3381 </ul>
3382
3383 !! end
3384
3385
3386 !! test
3387 Definition Lists: Mixed Lists: Test 4
3388 !! wikitext
3389 *;d1 :d2
3390 *;d3 :d4
3391 !! html
3392 <ul>
3393 <li><dl>
3394 <dt>d1&#160;</dt>
3395 <dd>d2
3396 </dd>
3397 <dt>d3&#160;</dt>
3398 <dd>d4
3399 </dd>
3400 </dl>
3401 </li>
3402 </ul>
3403
3404 !! end
3405
3406
3407 !! test
3408 Definition Lists: Mixed Lists: Test 5
3409 !! wikitext
3410 *:d1
3411 *:: d2
3412 !! html
3413 <ul>
3414 <li><dl>
3415 <dd>d1
3416 <dl>
3417 <dd> d2
3418 </dd>
3419 </dl>
3420 </dd>
3421 </dl>
3422 </li>
3423 </ul>
3424
3425 !! end
3426
3427
3428 !! test
3429 Definition Lists: Mixed Lists: Test 6
3430 !! wikitext
3431 #*:d1
3432 #*::: d3
3433 !! html
3434 <ol>
3435 <li><ul>
3436 <li><dl>
3437 <dd>d1
3438 <dl>
3439 <dd><dl>
3440 <dd> d3
3441 </dd>
3442 </dl>
3443 </dd>
3444 </dl>
3445 </dd>
3446 </dl>
3447 </li>
3448 </ul>
3449 </li>
3450 </ol>
3451
3452 !! end
3453
3454
3455 !! test
3456 Definition Lists: Mixed Lists: Test 7
3457 !! wikitext
3458 :* d1
3459 :* d2
3460 !! html
3461 <dl>
3462 <dd><ul>
3463 <li> d1
3464 </li>
3465 <li> d2
3466 </li>
3467 </ul>
3468 </dd>
3469 </dl>
3470
3471 !! end
3472
3473
3474 !! test
3475 Definition Lists: Mixed Lists: Test 8
3476 !! wikitext
3477 :* d1
3478 ::* d2
3479 !! html
3480 <dl>
3481 <dd><ul>
3482 <li> d1
3483 </li>
3484 </ul>
3485 <dl>
3486 <dd><ul>
3487 <li> d2
3488 </li>
3489 </ul>
3490 </dd>
3491 </dl>
3492 </dd>
3493 </dl>
3494
3495 !! end
3496
3497
3498 !! test
3499 Definition Lists: Mixed Lists: Test 9
3500 !! wikitext
3501 *;foo :bar
3502 !! html
3503 <ul>
3504 <li><dl>
3505 <dt>foo&#160;</dt>
3506 <dd>bar
3507 </dd>
3508 </dl>
3509 </li>
3510 </ul>
3511
3512 !! end
3513
3514
3515 !! test
3516 Definition Lists: Mixed Lists: Test 10
3517 !! wikitext
3518 *#;foo :bar
3519 !! html
3520 <ul>
3521 <li><ol>
3522 <li><dl>
3523 <dt>foo&#160;</dt>
3524 <dd>bar
3525 </dd>
3526 </dl>
3527 </li>
3528 </ol>
3529 </li>
3530 </ul>
3531
3532 !! end
3533
3534 # The Parsoid team disagrees with the PHP parser's seemingly-random
3535 # rules regarding dd/dt on the next two tests. Parsoid is more
3536 # consistent, and recognizes the shared nesting and keeps the
3537 # still-open tags around until the nesting is complete.
3538
3539 !! test
3540 Definition Lists: Mixed Lists: Test 11
3541 !! wikitext
3542 *#*#;*;;foo :bar
3543 *#*#;boo :baz
3544 !! html/php
3545 <ul>
3546 <li><ol>
3547 <li><ul>
3548 <li><ol>
3549 <li><dl>
3550 <dt>foo&#160;</dt>
3551 <dd><ul>
3552 <li><dl>
3553 <dt><dl>
3554 <dt>bar
3555 </dt>
3556 </dl>
3557 </dd>
3558 </dl>
3559 </li>
3560 </ul>
3561 </dd>
3562 </dl>
3563 <dl>
3564 <dt>boo&#160;</dt>
3565 <dd>baz
3566 </dd>
3567 </dl>
3568 </li>
3569 </ol>
3570 </li>
3571 </ul>
3572 </li>
3573 </ol>
3574 </li>
3575 </ul>
3576
3577 !! html/parsoid
3578 <ul>
3579 <li>
3580 <ol>
3581 <li>
3582 <ul>
3583 <li>
3584 <ol>
3585 <li>
3586 <dl>
3587 <dt>
3588 <ul>
3589 <li>
3590 <dl>
3591 <dt>
3592 <dl>
3593 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3594 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3595 </dl></dt>
3596 </dl></li>
3597 </ul></dt>
3598 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3599 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3600 </dl></li>
3601 </ol></li>
3602 </ul></li>
3603 </ol></li>
3604 </ul>
3605 !! end
3606
3607
3608 !! test
3609 Definition Lists: Weird Ones: Test 1
3610 !! wikitext
3611 *#;*::;; foo : bar (who uses this?)
3612 !! html/php
3613 <ul>
3614 <li><ol>
3615 <li><dl>
3616 <dt> foo&#160;</dt>
3617 <dd><ul>
3618 <li><dl>
3619 <dd><dl>
3620 <dd><dl>
3621 <dt><dl>
3622 <dt> bar (who uses this?)
3623 </dt>
3624 </dl>
3625 </dd>
3626 </dl>
3627 </dd>
3628 </dl>
3629 </dd>
3630 </dl>
3631 </li>
3632 </ul>
3633 </dd>
3634 </dl>
3635 </li>
3636 </ol>
3637 </li>
3638 </ul>
3639
3640 !! html/parsoid
3641 <ul>
3642 <li>
3643 <ol>
3644 <li>
3645 <dl>
3646 <dt>
3647 <ul>
3648 <li>
3649 <dl>
3650 <dd>
3651 <dl>
3652 <dd>
3653 <dl>
3654 <dt>
3655 <dl>
3656 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3657 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3658 </dl></dt>
3659 </dl></dd>
3660 </dl></dd>
3661 </dl></li>
3662 </ul></dt>
3663 </dl></li>
3664 </ol></li>
3665 </ul>
3666 !! end
3667
3668 ###
3669 ### External links
3670 ###
3671 !! test
3672 External links: non-bracketed
3673 !! wikitext
3674 Non-bracketed: http://example.com
3675 !! html
3676 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3677 </p>
3678 !! end
3679
3680 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3681 !! test
3682 External links: numbered
3683 !! wikitext
3684 Numbered: [http://example.com]
3685 Numbered: [http://example.net]
3686 Numbered: [http://example.com]
3687 !! html/php
3688 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3689 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3690 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3691 </p>
3692 !! html/parsoid
3693 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3694 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3695 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3696 !!end
3697
3698 !! test
3699 External links: specified text
3700 !! wikitext
3701 Specified text: [http://example.com link]
3702 !! html
3703 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3704 </p>
3705 !!end
3706
3707 !! test
3708 External links: trail
3709 !! wikitext
3710 Linktrails should not work for external links: [http://example.com link]s
3711 !! html
3712 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3713 </p>
3714 !! end
3715
3716 !! test
3717 External links: dollar sign in URL
3718 !! wikitext
3719 http://example.com/1$2345
3720 !! html
3721 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3722 </p>
3723 !! end
3724
3725 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3726 !! test
3727 External links: dollar sign in URL (autonumber)
3728 !! wikitext
3729 [http://example.com/1$2345]
3730 !! html/php
3731 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3732 </p>
3733 !! html/parsoid
3734 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3735 !!end
3736
3737 !! test
3738 External links: open square bracket forbidden in URL (bug 4377)
3739 !! options
3740 parsoid=wt2html,wt2wt,html2html
3741 !! wikitext
3742 http://example.com/1[2345
3743 !! html/php
3744 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3745 </p>
3746 !! html/parsoid
3747 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3748 !! end
3749
3750 !! test
3751 External links: open square bracket forbidden in URL (named) (bug 4377)
3752 !! options
3753 parsoid=wt2html,html2html
3754 !! wikitext
3755 [http://example.com/1[2345]
3756 !! html/php
3757 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3758 </p>
3759 !! html/parsoid
3760 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3761 !!end
3762
3763 # parsoid adds a space before the link name
3764 !! test
3765 External links: open square bracket forbidden in URL (named) (bug 4377)
3766 Parsoid variant.
3767 !! wikitext
3768 [http://example.com/1 [2345]
3769 !! html
3770 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3771 </p>
3772 !!end
3773
3774 !! test
3775 External links: nowiki in URL link text (bug 6230)
3776 !! wikitext
3777 [http://example.com/ <nowiki>''example site''</nowiki>]
3778 !! html
3779 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3780 </p>
3781 !! end
3782
3783 !! test
3784 External links: newline forbidden in text (bug 6230 regression check)
3785 !! wikitext
3786 [http://example.com/ first
3787 second]
3788 !! html
3789 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3790 second]
3791 </p>
3792 !!end
3793
3794 !! test
3795 External links: Pipe char between url and text
3796 !! wikitext
3797 [http://example.com | link]
3798 !! html
3799 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3800 </p>
3801 !!end
3802
3803 !! test
3804 External links: protocol-relative URL in brackets
3805 !! wikitext
3806 [//example.com/ Test]
3807 !! html
3808 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3809 </p>
3810 !! end
3811
3812 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3813 !! test
3814 External links: protocol-relative URL in brackets without text
3815 !! wikitext
3816 [//example.com]
3817 !! html/php
3818 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3819 </p>
3820 !! html/parsoid
3821 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3822 !! end
3823
3824 !! test
3825 External links: protocol-relative URL in free text is left alone
3826 !! wikitext
3827 //example.com/Foo
3828 !! html
3829 <p>//example.com/Foo
3830 </p>
3831 !!end
3832
3833 !! test
3834 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3835 !! wikitext
3836 foo//example.com/Foo
3837 !! html
3838 <p>foo//example.com/Foo
3839 </p>
3840 !! end
3841
3842 !! test
3843 External image
3844 !! wikitext
3845 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3846 !! html
3847 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3848 </p>
3849 !! end
3850
3851 !! test
3852 External image from https
3853 !! wikitext
3854 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3855 !! html
3856 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3857 </p>
3858 !! end
3859
3860 !! test
3861 External image (when not allowed)
3862 !! options
3863 wgAllowExternalImages=0
3864 !! wikitext
3865 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3866 !! html
3867 <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>
3868 </p>
3869 !! end
3870
3871 !! test
3872 Link to non-http image, no img tag
3873 !! wikitext
3874 Link to non-http image, no img tag: ftp://example.com/test.jpg
3875 !! html
3876 <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>
3877 </p>
3878 !! end
3879
3880 !! test
3881 External links: terminating separator
3882 !! wikitext
3883 Terminating separator: http://example.com/thing,
3884 !! html
3885 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3886 </p>
3887 !! end
3888
3889 !! test
3890 External links: intervening separator
3891 !! wikitext
3892 Intervening separator: http://example.com/1,2,3
3893 !! html
3894 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3895 </p>
3896 !! end
3897
3898 !! test
3899 External links: old bug with URL in query
3900 !! wikitext
3901 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3902 !! html
3903 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3904 </p>
3905 !! end
3906
3907 !! test
3908 External links: old URL-in-URL bug, mixed protocols
3909 !! wikitext
3910 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3911 !! html
3912 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3913 </p>
3914 !!end
3915
3916 !! test
3917 External links: URL in text
3918 !! wikitext
3919 URL in text: [http://example.com http://example.com]
3920 !! html
3921 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3922 </p>
3923 !! end
3924
3925 !! test
3926 External links: Clickable images
3927 !! wikitext
3928 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3929 !! html
3930 <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>
3931 </p>
3932 !!end
3933
3934 !! test
3935 External links: raw ampersand
3936 !! wikitext
3937 Old &amp; use: http://x&y
3938 !! html
3939 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3940 </p>
3941 !! end
3942
3943 !! test
3944 External links: encoded ampersand
3945 !! wikitext
3946 Old &amp; use: http://x&amp;y
3947 !! html/php
3948 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3949 </p>
3950 !! html/parsoid
3951 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3952 !! end
3953
3954 !! test
3955 External links: encoded equals (bug 6102)
3956 !! wikitext
3957 http://example.com/?foo&#61;bar
3958 !! html/php
3959 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3960 </p>
3961 !! html/parsoid
3962 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3963 !! end
3964
3965 ##
3966 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3967 ## does it number them. As discussed in bug 53505, we can identify
3968 ## autonumbered links via CSS.
3969 ##
3970
3971 !! test
3972 External links: [raw ampersand]
3973 !! wikitext
3974 Old &amp; use: [http://x&y]
3975 !! html/php
3976 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3977 </p>
3978 !! html/parsoid
3979 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3980 !! end
3981
3982 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3983 # mode will return the [raw ampersand] wikitext
3984 !! test
3985 External links: [encoded ampersand]
3986 !! options
3987 parsoid=wt2html,wt2wt,html2html
3988 !! wikitext
3989 Old &amp; use: [http://x&amp;y]
3990 !! html/php
3991 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3992 </p>
3993 !! html/parsoid
3994 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3995 !! end
3996
3997 !! test
3998 External links: [raw equals]
3999 !! wikitext
4000 [http://example.com/?foo=bar]
4001 !! html/php
4002 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4003 </p>
4004 !! html/parsoid
4005 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4006 !! end
4007
4008 # note that parsoid html is identical to [raw equals] case; so html2wt
4009 # mode will return the [raw equals] wikitext
4010 !! test
4011 External links: [encoded equals] (bug 6102)
4012 !! options
4013 parsoid=wt2html,wt2wt,html2html
4014 !! wikitext
4015 [http://example.com/?foo&#61;bar]
4016 !! html/php
4017 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4018 </p>
4019 !! html/parsoid
4020 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4021 !! end
4022
4023 # xxx parsoid strips the IDN character, so the round-trip tests will
4024 # obviously fail and are disabled. --cscott
4025 !! test
4026 External links: [IDN ignored character reference in hostname; strip it right off]
4027 !! options
4028 parsoid=wt2html,wt2wt,html2html
4029 !! wikitext
4030 [http://e&zwnj;xample.com/]
4031 !! html/php
4032 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4033 </p>
4034 !! html/parsoid
4035 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4036 !! end
4037
4038 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4039 # Where an external link could easily circumvent the sanitization of the text of
4040 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4041 # test demands a higher standard. That's a bit strange.
4042 #
4043 # Example:
4044 #
4045 # http://e‌xample.com -> [http://example.com|http://example.com]
4046 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4047 #
4048 # The first example is sanitized, but the second is not. Any security benefits
4049 # from this production are trivial to circumvent. Either remove this test and
4050 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4051 # the test accordingly.
4052 #
4053 # All our love,
4054 # The Parsoid team.
4055 # xxx parsoid strips the IDN character, so the round-trip tests will
4056 # obviously fail and are disabled. --cscott
4057 !! test
4058 External links: IDN ignored character reference in hostname; strip it right off
4059 !! options
4060 parsoid=wt2html,html2html
4061 !! wikitext
4062 http://e&zwnj;xample.com/
4063 !! html/php
4064 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4065 </p>
4066 !! html/parsoid
4067 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4068 !! end
4069
4070 !! test
4071 External links: www.jpeg.org (bug 554)
4072 !! wikitext
4073 http://www.jpeg.org
4074 !! html
4075 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4076 </p>
4077 !! end
4078
4079 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4080 !! test
4081 External links: URL within URL (original bug 2)
4082 !! wikitext
4083 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4084 !! html/php
4085 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4086 </p>
4087 !! html/parsoid
4088 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4089 !! end
4090
4091 !! test
4092 BUG 361: URL inside bracketed URL
4093 !! wikitext
4094 [http://www.example.com/foo http://www.example.com/bar]
4095 !! html
4096 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4097 </p>
4098 !! end
4099
4100 !! test
4101 BUG 361: URL within URL, not bracketed
4102 !! wikitext
4103 http://www.example.com/foo?=http://www.example.com/bar
4104 !! html
4105 <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>
4106 </p>
4107 !! end
4108
4109 !! test
4110 BUG 289: ">"-token in URL-tail
4111 !! wikitext
4112 http://www.example.com/<hello>
4113 !! html
4114 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4115 </p>
4116 !!end
4117
4118 !! test
4119 BUG 289: literal ">"-token in URL-tail
4120 !! wikitext
4121 http://www.example.com/<b>html</b>
4122 !! html
4123 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4124 </p>
4125 !!end
4126
4127 !! test
4128 BUG 289: ">"-token in bracketed URL
4129 !! wikitext
4130 [http://www.example.com/<hello> stuff]
4131 !! html
4132 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4133 </p>
4134 !!end
4135
4136 !! test
4137 BUG 289: literal ">"-token in bracketed URL
4138 !! wikitext
4139 [http://www.example.com/<b>html</b> stuff]
4140 !! html
4141 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4142 </p>
4143 !!end
4144
4145 !! test
4146 BUG 289: literal double quote at end of URL
4147 !! wikitext
4148 http://www.example.com/"hello"
4149 !! html
4150 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4151 </p>
4152 !!end
4153
4154 !! test
4155 BUG 289: literal double quote in bracketed URL
4156 !! wikitext
4157 [http://www.example.com/"hello" stuff]
4158 !! html
4159 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4160 </p>
4161 !!end
4162
4163 !! test
4164 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4165 !! wikitext
4166 [http://www.example.com test]
4167 !! html
4168 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4169 </p>
4170 !! end
4171
4172 !! test
4173 External links: link text with spaces
4174 !! wikitext
4175 [http://www.example.com a b c]
4176 [http://www.example.com ''a'' ''b'']
4177 !! html
4178 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4179 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4180 </p>
4181 !! end
4182
4183 !! test
4184 External links: wiki links within external link (Bug 3695)
4185 !! wikitext
4186 [http://example.com [[wikilink]] embedded in ext link]
4187 !! html/php
4188 <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>
4189 </p>
4190 !! html/parsoid
4191 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
4192 !! end
4193
4194 !! test
4195 BUG 787: Links with one slash after the url protocol are invalid
4196 !! wikitext
4197 http:/example.com
4198
4199 [http:/example.com title]
4200 !! html
4201 <p>http:/example.com
4202 </p><p>[http:/example.com title]
4203 </p>
4204 !! end
4205
4206 !! test
4207 Bracketed external links with template-generated invalid target
4208 !! wikitext
4209 [{{echo|http:/example.com}} title]
4210 !! html
4211 <p>[http:/example.com title]
4212 </p>
4213 !! end
4214
4215 !! test
4216 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4217 !! wikitext
4218 ''[http://example.com text'']
4219 [http://example.com '''text]'''
4220 ''Something [http://example.com in italic'']
4221 ''Something [http://example.com mixed''''', even bold]'''
4222 '''''Now [http://example.com both''''']
4223 !! html
4224 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4225 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4226 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4227 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4228 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4229 </p>
4230 !! end
4231
4232
4233 !! test
4234 Bug 4781: %26 in URL
4235 !! wikitext
4236 http://www.example.com/?title=AT%26T
4237 !! html/php
4238 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4239 </p>
4240 !! html/parsoid
4241 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4242 !! end
4243
4244 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4245 # % is actually legal in HTML5. Any change in output would need testing though.
4246 !! test
4247 Bug 4781, 5267: %25 in URL
4248 !! wikitext
4249 http://www.example.com/?title=100%25_Bran
4250 !! html/php
4251 <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>
4252 </p>
4253 !! html/parsoid
4254 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4255 !! end
4256
4257 !! test
4258 Bug 4781, 5267: %28, %29 in URL
4259 !! wikitext
4260 http://www.example.com/?title=Ben-Hur_%281959_film%29
4261 !! html/php
4262 <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>
4263 </p>
4264 !! html/parsoid
4265 <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>
4266 !! end
4267
4268
4269 !! test
4270 Bug 4781: %26 in autonumber URL
4271 !! wikitext
4272 [http://www.example.com/?title=AT%26T]
4273 !! html/php
4274 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4275 </p>
4276 !! html/parsoid
4277 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4278 !! end
4279
4280 !! test
4281 Bug 4781, 5267: %26 in autonumber URL
4282 !! wikitext
4283 [http://www.example.com/?title=100%25_Bran]
4284 !! html/php
4285 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4286 </p>
4287 !! html/parsoid
4288 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4289 !! end
4290
4291 !! test
4292 Bug 4781, 5267: %28, %29 in autonumber URL
4293 !! wikitext
4294 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4295 !! html/php
4296 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4297 </p>
4298 !! html/parsoid
4299 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4300 !! end
4301
4302
4303 !! test
4304 Bug 4781: %26 in bracketed URL
4305 !! wikitext
4306 [http://www.example.com/?title=AT%26T link]
4307 !! html/php
4308 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4309 </p>
4310 !! html/parsoid
4311 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4312 !! end
4313
4314 !! test
4315 Bug 4781, 5267: %25 in bracketed URL
4316 !! wikitext
4317 [http://www.example.com/?title=100%25_Bran link]
4318 !! html
4319 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4320 </p>
4321 !! end
4322
4323 !! test
4324 Bug 4781, 5267: %28, %29 in bracketed URL
4325 !! wikitext
4326 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4327 !! html/php
4328 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4329 </p>
4330 !! html/parsoid
4331 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4332 !! end
4333
4334 # Note that parsoid does not munge anchor text; all non-space
4335 # characters are valid in HTML5 ids.
4336 !! test
4337 Anchor containing a #. (bug 63430)
4338 !! wikitext
4339 [[Main Page#And#Link]]
4340 !! html/php
4341 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
4342 </p>
4343 !! html/parsoid
4344 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
4345 !! end
4346
4347 !! test
4348 External link containing a period in the anchor. (bug 63947)
4349 !! wikitext
4350 [//foo.org/bar#baz. bang]
4351
4352 [//foo.org/bar. bang]
4353 !! html/php
4354 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4355 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4356 </p>
4357 !! html/parsoid
4358 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4359 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4360 !! end
4361
4362 !! test
4363 External link containing a single quote. (bug 63947)
4364 !! wikitext
4365 [//foo.org/bar'baz]
4366
4367 [//foo.org/bar'baz bang]
4368 !! html/php
4369 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4370 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4371 </p>
4372 !! html/parsoid
4373 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4374 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4375 !! end
4376
4377
4378 !! test
4379 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4380 !! wikitext
4381 Some [http://example.com/ pretty ''italics'' and stuff]!
4382 !! html
4383 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4384 </p>
4385 !! end
4386
4387 !! test
4388 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4389 !! wikitext
4390 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4391 !! html
4392 <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>
4393 </p>
4394 !! end
4395
4396 !! test
4397 External link containing double-single-quotes with no space separating the url from text in italics
4398 !! wikitext
4399 [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]].]
4400 !! html/php
4401 <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>
4402 </p>
4403 !! html/parsoid
4404 <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)">Museo Picasso</a><span>.</span></p>
4405 !! end
4406
4407 !! test
4408 External link with comments in link text
4409 !! wikitext
4410 [http://www.google.com Google <!-- comment -->]
4411 !! html
4412 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4413 </p>
4414 !! end
4415
4416 !! test
4417 URL-encoding in URL functions (single parameter)
4418 !! wikitext
4419 {{localurl:Some page|amp=&}}
4420 !! html
4421 <p>/index.php?title=Some_page&amp;amp=&amp;
4422 </p>
4423 !! end
4424
4425 !! test
4426 URL-encoding in URL functions (multiple parameters)
4427 !! wikitext
4428 {{localurl:Some page|q=?&amp=&}}
4429 !! html
4430 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4431 </p>
4432 !! end
4433
4434 !! test
4435 Brackets in urls
4436 !! wikitext
4437 http://example.com/index.php?foozoid%5B%5D=bar
4438
4439 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4440 !! html/php
4441 <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>
4442 </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>
4443 </p>
4444 !! html/parsoid
4445 <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>
4446
4447 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4448 !! end
4449
4450 !! test
4451 IPv6 urls (bug 21261)
4452 !! options
4453 disabled
4454 !! wikitext
4455 http://[2404:130:0:1000::187:2]/index.php
4456 !! html
4457 <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>
4458 </p>
4459 !! end
4460
4461 !! test
4462 Non-extlinks in brackets
4463 !! wikitext
4464 [foo]
4465 [foo bar]
4466 [foo ''bar'']
4467 [fool's] errand
4468 [fool's errand]
4469 [{{echo|foo}}]
4470 [{{echo|foo}} bar]
4471 [{{echo|foo}} ''bar'']
4472 [{{echo|foo}}l's] errand
4473 [{{echo|foo}}l's errand]
4474 [url={{echo|foo}}]
4475 [url=http://example.com]
4476 !! html
4477 <p>[foo]
4478 [foo bar]
4479 [foo <i>bar</i>]
4480 [fool's] errand
4481 [fool's errand]
4482 [foo]
4483 [foo bar]
4484 [foo <i>bar</i>]
4485 [fool's] errand
4486 [fool's errand]
4487 [url=foo]
4488 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4489 </p>
4490 !! end
4491
4492 !! test
4493 Percent encoding in external links
4494 !! wikitext
4495 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4496 !! html/php
4497 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4498 </p>
4499 !! html/parsoid
4500 <p><a rel="mw:ExtLink"
4501 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4502 !! end
4503
4504 !! test
4505 Use url link syntax for links where the content is equal the link target
4506 !! wikitext
4507 http://example.com
4508 !! html/php
4509 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4510 </p>
4511 !! html/parsoid
4512 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4513 !! end
4514
4515 !! test
4516 Parenthesis in external links, especially URL links
4517 !! wikitext
4518 http://example.com)
4519
4520 http://example.com/test)
4521
4522 http://example.com/(test)
4523
4524 http://example.com/((test)
4525
4526 (http://example.com/(test))
4527
4528 (http://example.com/(test)))))
4529
4530 http://example.com/a)b
4531
4532 [http://example.com) foo]
4533 !! html/php
4534 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4535 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4536 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4537 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4538 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4539 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4540 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4541 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4542 </p>
4543 !! html/parsoid
4544 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4545 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4546 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4547 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4548 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4549 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4550 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4551 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4552 !! end
4553
4554 !! test
4555 Parenthesis in external links, w/ transclusion or comment
4556 !! wikitext
4557 (http://example.com/{{echo|hi}})
4558
4559 (http://example.com<!-- hi -->)
4560 !! html/php
4561 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4562 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4563 </p>
4564 !! html/parsoid
4565 <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;dsr&amp;quot;:[20,31,null,null],&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;]}]]}\">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>
4566
4567 <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>
4568 !! end
4569
4570 ###
4571 ### Quotes
4572 ###
4573
4574 !! test
4575 Quotes
4576 !! wikitext
4577 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4578
4579 Normal text. '''''Bold italic text.''''' Normal text.
4580 !! html
4581 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4582 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4583 </p>
4584 !! end
4585
4586
4587 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4588 # parser strips. The wikitext contains just the first half of the bold
4589 # quote pair.
4590 !! test
4591 Unclosed and unmatched quotes
4592 !! wikitext
4593 '''''Bold italic text '''with bold deactivated''' in between.'''''
4594
4595 '''''Bold italic text ''with italic deactivated'' in between.'''''
4596
4597 '''Bold text..
4598
4599 ..spanning two paragraphs (should not work).'''
4600
4601 '''Bold tag left open
4602
4603 ''Italic tag left open
4604
4605 Normal text.
4606
4607 <!-- Unmatching number of opening, closing tags: -->
4608 '''This year''''s election ''should'' beat '''last year''''s.
4609
4610 ''Tom'''s car is bigger than ''Susan'''s.
4611
4612 Plain ''italic'''s plain
4613 !! html/php
4614 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4615 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4616 </p><p><b>Bold text..</b>
4617 </p><p>..spanning two paragraphs (should not work).
4618 </p><p><b>Bold tag left open</b>
4619 </p><p><i>Italic tag left open</i>
4620 </p><p>Normal text.
4621 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4622 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4623 </p><p>Plain <i>italic'</i>s plain
4624 </p>
4625 !! html/parsoid
4626 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4627 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4628 </p><p><b>Bold text..</b>
4629 </p><p>..spanning two paragraphs (should not work).<b></b>
4630 </p><p><b>Bold tag left open</b>
4631 </p><p><i>Italic tag left open</i>
4632 </p><p>Normal text.
4633 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4634 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4635 </p><p>Plain <i>italic'</i>s plain
4636 </p>
4637 !! end
4638
4639 ###
4640 ### Tables
4641 ###
4642 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4643 ###
4644
4645 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4646 # is the bare minimum required by the spec, see:
4647 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4648 # Parsoid team replies: empty table tags are legal in HTML5
4649 !! test
4650 A table with no data.
4651 !! options
4652 parsoid=wt2html
4653 !! wikitext
4654 {||}
4655 !! html/php
4656
4657 !! html/parsoid
4658 <table></table>
4659
4660 !! end
4661
4662 !! test
4663 A table with stray table end tags on start tag line (wt2html)
4664 !! options
4665 parsoid=wt2html
4666 !! wikitext
4667 {|style="color: red;"|}
4668
4669 {|style="color: red;" |}
4670 |foo
4671 |}
4672
4673 {|style="color: red;"|} id="foo"
4674 |foo
4675 |}
4676
4677 {|style="color: red;" |} id="foo"
4678 |foo
4679 |}
4680 !! html
4681 <table style="color: red;"></table>
4682
4683 <table style="color: red;">
4684 <tbody><tr>
4685 <td>foo</td>
4686 </tr></tbody>
4687 </table>
4688
4689 <table style="color: red;" id="foo">
4690 <tbody><tr>
4691 <td>foo</td>
4692 </tr></tbody>
4693 </table>
4694
4695 <table style="color: red;" id="foo">
4696 <tbody><tr>
4697 <td>foo</td>
4698 </tr></tbody>
4699 </table>
4700
4701 !! end
4702
4703 !! test
4704 A table with no data (take 2)
4705 !! wikitext
4706 {|
4707 |}
4708 !! html/parsoid
4709 <table></table>
4710 !! end
4711
4712 # A table with nothing but a caption is invalid XHTML, we might want to render
4713 # this as <p>caption</p>
4714 # Parsoid team replies: table with only a caption is legal in HTML5
4715 !! test
4716 A table with nothing but a caption
4717 !! wikitext
4718 {|
4719 |+ caption
4720 |}
4721 !! html/php
4722 <table>
4723 <caption> caption
4724 </caption><tr><td></td></tr></table>
4725
4726 !! html/parsoid
4727 <table><caption> caption</caption></table>
4728 !! end
4729
4730 !! test
4731 A table with caption with default-spaced attributes and a table row
4732 !! wikitext
4733 {|
4734 |+ style="color: red;" | caption1
4735 |-
4736 | foo
4737 |}
4738 !! html
4739 <table>
4740 <caption style="color: red;"> caption1
4741 </caption>
4742 <tr>
4743 <td> foo
4744 </td></tr></table>
4745
4746 !! end
4747
4748 !! test
4749 A table with captions with non-default spaced attributes and a table row
4750 !! wikitext
4751 {|
4752 |+style="color: red;"|caption2
4753 |+ style="color: red;"| caption3
4754 |-
4755 | foo
4756 |}
4757 !! html
4758 <table>
4759 <caption style="color: red;">caption2
4760 </caption>
4761 <caption style="color: red;"> caption3
4762 </caption>
4763 <tr>
4764 <td> foo
4765 </td></tr></table>
4766
4767 !! end
4768
4769 !! test
4770 Table td-cell syntax variations
4771 !! wikitext
4772 {|
4773 | foo bar foo | baz
4774 | foo bar foo || baz
4775 | style='color:red;' | baz
4776 | style='color:red;' || baz
4777 |}
4778 !! html
4779 <table>
4780 <tr>
4781 <td> baz
4782 </td>
4783 <td> foo bar foo </td>
4784 <td> baz
4785 </td>
4786 <td style="color:red;"> baz
4787 </td>
4788 <td> style='color:red;' </td>
4789 <td> baz
4790 </td></tr></table>
4791
4792 !! end
4793
4794 !! test
4795 Simple table
4796 !! wikitext
4797 {|
4798 | 1 || 2
4799 |-
4800 | 3 || 4
4801 |}
4802 !! html
4803 <table>
4804 <tr>
4805 <td> 1 </td>
4806 <td> 2
4807 </td></tr>
4808 <tr>
4809 <td> 3 </td>
4810 <td> 4
4811 </td></tr></table>
4812
4813 !! end
4814
4815 !! test
4816 Simple table but with multiple dashes for row wikitext
4817 !! wikitext
4818 {|
4819 | foo
4820 |-----
4821 | bar
4822 |}
4823 !! html
4824 <table>
4825 <tr>
4826 <td> foo
4827 </td></tr>
4828 <tr>
4829 <td> bar
4830 </td></tr></table>
4831
4832 !! end
4833 !! test
4834 Multiplication table
4835 !! wikitext
4836 {| border="1" cellpadding="2"
4837 |+Multiplication table
4838 |-
4839 ! &times; !! 1 !! 2 !! 3
4840 |-
4841 ! 1
4842 | 1 || 2 || 3
4843 |-
4844 ! 2
4845 | 2 || 4 || 6
4846 |-
4847 ! 3
4848 | 3 || 6 || 9
4849 |-
4850 ! 4
4851 | 4 || 8 || 12
4852 |-
4853 ! 5
4854 | 5 || 10 || 15
4855 |}
4856 !! html
4857 <table border="1" cellpadding="2">
4858 <caption>Multiplication table
4859 </caption>
4860 <tr>
4861 <th> &#215; </th>
4862 <th> 1 </th>
4863 <th> 2 </th>
4864 <th> 3
4865 </th></tr>
4866 <tr>
4867 <th> 1
4868 </th>
4869 <td> 1 </td>
4870 <td> 2 </td>
4871 <td> 3
4872 </td></tr>
4873 <tr>
4874 <th> 2
4875 </th>
4876 <td> 2 </td>
4877 <td> 4 </td>
4878 <td> 6
4879 </td></tr>
4880 <tr>
4881 <th> 3
4882 </th>
4883 <td> 3 </td>
4884 <td> 6 </td>
4885 <td> 9
4886 </td></tr>
4887 <tr>
4888 <th> 4
4889 </th>
4890 <td> 4 </td>
4891 <td> 8 </td>
4892 <td> 12
4893 </td></tr>
4894 <tr>
4895 <th> 5
4896 </th>
4897 <td> 5 </td>
4898 <td> 10 </td>
4899 <td> 15
4900 </td></tr></table>
4901
4902 !! end
4903
4904 !! test
4905 Accept "||" in table headings
4906 !! wikitext
4907 {|
4908 !h1 || h2
4909 |}
4910 !! html
4911 <table>
4912 <tr>
4913 <th>h1 </th>
4914 <th> h2
4915 </th></tr></table>
4916
4917 !! end
4918
4919 !! test
4920 Accept "||" in indented table headings
4921 !! wikitext
4922 :{|
4923 !h1 || h2
4924 |}
4925 !! html
4926 <dl><dd><table>
4927 <tr>
4928 <th>h1 </th>
4929 <th> h2
4930 </th></tr></table></dd></dl>
4931
4932 !! end
4933
4934 !! test
4935 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4936 !! wikitext
4937 {|
4938 !| h1
4939 || a
4940 |}
4941 !! html
4942 <table>
4943 <tr>
4944 <th> h1
4945 </th>
4946 <td> a
4947 </td></tr></table>
4948
4949 !! end
4950
4951 !!test
4952 Accept "| !" at start of line in tables (ignore !-attribute)
4953 !! wikitext
4954 {|
4955 |-
4956 | !style="color:red" | bar
4957 |}
4958 !! html
4959 <table>
4960
4961 <tr>
4962 <td> bar
4963 </td></tr></table>
4964
4965 !!end
4966
4967 !!test
4968 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 +/-
4969 !! wikitext
4970 {|
4971 |-
4972 |style='color:red;'|+1
4973 |style='color:blue;'|-1
4974 |-
4975 | 1 || 2 || 3
4976 | 1 ||+2 ||-3
4977 |-
4978 | +1
4979 | -1
4980 |}
4981 !! html
4982 <table>
4983
4984 <tr>
4985 <td style="color:red;">+1
4986 </td>
4987 <td style="color:blue;">-1
4988 </td></tr>
4989 <tr>
4990 <td> 1 </td>
4991 <td> 2 </td>
4992 <td> 3
4993 </td>
4994 <td> 1 </td>
4995 <td>+2 </td>
4996 <td>-3
4997 </td></tr>
4998 <tr>
4999 <td> +1
5000 </td>
5001 <td> -1
5002 </td></tr></table>
5003
5004 !!end
5005
5006 !! test
5007 Table rowspan
5008 !! wikitext
5009 {| border=1
5010 | Cell 1, row 1
5011 |rowspan=2| Cell 2, row 1 (and 2)
5012 | Cell 3, row 1
5013 |-
5014 | Cell 1, row 2
5015 | Cell 3, row 2
5016 |}
5017 !! html
5018 <table border="1">
5019 <tr>
5020 <td> Cell 1, row 1
5021 </td>
5022 <td rowspan="2"> Cell 2, row 1 (and 2)
5023 </td>
5024 <td> Cell 3, row 1
5025 </td></tr>
5026 <tr>
5027 <td> Cell 1, row 2
5028 </td>
5029 <td> Cell 3, row 2
5030 </td></tr></table>
5031
5032 !! end
5033
5034 !! test
5035 Nested table
5036 !! wikitext
5037 {| border=1
5038 | &alpha;
5039 |
5040 {| bgcolor=#ABCDEF border=2
5041 |nested
5042 |-
5043 |table
5044 |}
5045 |the original table again
5046 |}
5047 !! html
5048 <table border="1">
5049 <tr>
5050 <td> &#945;
5051 </td>
5052 <td>
5053 <table bgcolor="#ABCDEF" border="2">
5054 <tr>
5055 <td>nested
5056 </td></tr>
5057 <tr>
5058 <td>table
5059 </td></tr></table>
5060 </td>
5061 <td>the original table again
5062 </td></tr></table>
5063
5064 !! end
5065
5066 !! test
5067 Invalid attributes in table cell (bug 1830)
5068 !! wikitext
5069 {|
5070 |Cell:|broken
5071 |}
5072 !! html
5073 <table>
5074 <tr>
5075 <td>broken
5076 </td></tr></table>
5077
5078 !! end
5079
5080
5081 # The "|}" to close the table is missing from the input, so parsoid's
5082 # *2wt modes will fail.
5083 !! test
5084 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5085 !! options
5086 parsoid=wt2html,html2html
5087 !! wikitext
5088 {|
5089 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5090 !! html/php
5091 <table>
5092 <tr>
5093 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5094 <td>]" onmouseover="alert(document.cookie)"&gt;test
5095 </td>
5096 </tr>
5097 </table>
5098
5099 !! html/parsoid
5100 <table><tbody>
5101 <tr>
5102 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5103 !! end
5104
5105
5106 !! test
5107 Indented table markup mixed with indented pre content (proposed in bug 6200)
5108 !! wikitext
5109 <table>
5110 <tr>
5111 <td>
5112 Text that should be rendered preformatted
5113 </td>
5114 </tr>
5115 </table>
5116 !! html
5117 <table>
5118 <tr>
5119 <td>
5120 <pre>Text that should be rendered preformatted
5121 </pre>
5122 </td>
5123 </tr>
5124 </table>
5125
5126 !! end
5127
5128 !! test
5129 Template-generated table cell attributes and cell content
5130 !! wikitext
5131 {|
5132 |{{table_attribs}}
5133 | {{table_attribs}}
5134 |}
5135 !! html
5136 <table>
5137 <tr>
5138 <td style="color: red"> Foo
5139 </td>
5140 <td style="color: red"> Foo
5141 </td></tr></table>
5142
5143 !! end
5144
5145 !! test
5146 Template-generated table cell attributes and cell content (2)
5147 !! wikitext
5148 {|
5149 |align=center {{table_attribs}}
5150 |}
5151 !! html
5152 <table>
5153 <tr>
5154 <td align="center" style="color: red"> Foo
5155 </td></tr></table>
5156
5157 !! end
5158
5159 !! test
5160 Template-generated table cell attributes and cell content (3)
5161 !! wikitext
5162 {|
5163 |align=center {{table_cells}}
5164 |}
5165 !! html
5166 <table>
5167 <tr>
5168 <td align="center" style="color: red"> Foo </td>
5169 <td> Bar </td>
5170 <td> Baz
5171 </td></tr></table>
5172
5173 !! end
5174
5175 !! test
5176 Table with row followed by newlines and table heading
5177 !! wikitext
5178 {|
5179 |-
5180
5181 ! foo
5182 |}
5183 !! html
5184 <table>
5185
5186
5187 <tr>
5188 <th> foo
5189 </th></tr></table>
5190
5191 !! end
5192
5193 !! test
5194 Table with empty line following the start tag
5195 !! wikitext
5196 {|
5197
5198 |-
5199 | foo
5200 |}
5201 !! html
5202 <table>
5203
5204
5205 <tr>
5206 <td> foo
5207 </td></tr></table>
5208
5209 !! end
5210
5211 # FIXME: Preserve the attribute properly (with an empty string as value) in
5212 # the PHP parser. Parsoid implements the behavior below.
5213 !! test
5214 Table attributes with empty value
5215 !! wikitext
5216 {|
5217 | style=| hello
5218 |}
5219 !! html/parsoid
5220 <table>
5221 <tbody>
5222 <tr>
5223 <td style=""> hello
5224 </td></tr></tbody></table>
5225
5226 !! end
5227
5228 !! test
5229 Wikitext table with a lot of comments
5230 !! wikitext
5231 {|
5232 <!-- c0 -->
5233 | foo
5234 <!-- c1 -->
5235 |- <!-- c2 -->
5236 <!-- c3 -->
5237 |<!-- c4 -->
5238 <!-- c5 -->
5239 |}
5240 !! html
5241 <table>
5242 <tr>
5243 <td> foo
5244 </td></tr>
5245 <tr>
5246 <td>
5247 </td></tr></table>
5248
5249 !! end
5250
5251 !! test
5252 Wikitext table with double-line table cell
5253 !! wikitext
5254 {|
5255 |a
5256 b
5257 |}
5258 !! html
5259 <table>
5260 <tr>
5261 <td>a
5262 <p>b
5263 </p>
5264 </td></tr></table>
5265
5266 !! end
5267
5268 !! test
5269 Table cell with a single comment
5270 !! wikitext
5271 {|
5272 | <!-- c1 -->
5273 | a
5274 |}
5275 !! html
5276 <table>
5277 <tr>
5278 <td>
5279 </td>
5280 <td> a
5281 </td></tr></table>
5282
5283 !! end
5284
5285 # The expected HTML structure in this test is debatable. The PHP parser does
5286 # not parse this kind of table at all. The main focus for Parsoid is on
5287 # round-tripping, so this output is ok for now. TODO: revisit!
5288 !! test
5289 Wikitext table with html-syntax row
5290 !! wikitext
5291 {|
5292 |-
5293 <td>foo</td>
5294 |}
5295 !! html/parsoid
5296 <table>
5297 <tbody>
5298 <tr>
5299 <td>foo</td></tr></tbody></table>
5300 !! end
5301
5302 !! test
5303 Implicit <td> after a |-
5304 (PHP parser relies on Tidy to add the missing <td> tags)
5305 !! options
5306 parsoid=wt2html,wt2wt
5307 !! wikitext
5308 {|
5309 |-
5310 a
5311 |}
5312 !! html
5313 <table>
5314 <tr><td>a</td></tr>
5315 </table>
5316 !! end
5317
5318 !! test
5319 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5320 (PHP parser relies on Tidy to add the missing <td> tags)
5321 !! options
5322 parsoid=wt2html,wt2wt
5323 !! wikitext
5324 {|
5325 |-
5326 |
5327 a
5328 |-
5329 b
5330 |}
5331 !! html
5332 <table>
5333 <tbody>
5334 <tr><td><pre>a</pre></td></tr>
5335 <tr><td> b</td></tr>
5336 </tbody>
5337 </table>
5338 !! end
5339
5340 !! test
5341 Lists should be recognized in an implicit <td> context
5342 (PHP parser relies on Tidy to add the missing <td> tags)
5343 !! options
5344 parsoid=wt2html,wt2wt
5345 !! wikitext
5346 {|
5347 |-
5348 *a
5349 |}
5350 !! html
5351 <table>
5352 <tr>
5353 <td><ul>
5354 <li>a</li>
5355 </ul></td>
5356 </tr>
5357 </table>
5358 !! end
5359
5360 !! test
5361 Parsoid: Round-trip tables directly followed by content (bug 51219)
5362 !! options
5363 parsoid=wt2html,wt2wt
5364 !! wikitext
5365 {|
5366 |foo
5367 |} bar
5368
5369 {|
5370 |baz
5371 |}<b>quux</b>
5372 !! html
5373 <table><tbody>
5374 <tr>
5375 <td>foo</td></tr></tbody></table> bar
5376 <table>
5377 <tbody>
5378 <tr>
5379 <td>baz</td></tr></tbody></table><b>quux</b>
5380 !! end
5381
5382 !! test
5383 Parsoid: Default to a newline after tables in new content (bug 51219)
5384 !! options
5385 parsoid=html2wt
5386 !! wikitext
5387 {|
5388 |foo
5389 |}
5390 <nowiki> </nowiki>bar
5391 {|
5392 |baz
5393 |}
5394 '''quux'''
5395 !! html
5396 <table><tbody>
5397 <tr><td>foo</td></tr></tbody></table> bar
5398 <table><tbody>
5399 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5400 !! end
5401
5402 !! test
5403 Parsoid: newline inducing block nodes don't suppress <nowiki>
5404 !! options
5405 parsoid=html2wt
5406 !! wikitext
5407 <nowiki> </nowiki>a
5408
5409 = foo =
5410 !! html
5411 a<h1>foo</h1>
5412 !! end
5413
5414 ###
5415 ### Internal links
5416 ###
5417 !! test
5418 Plain link, capitalized
5419 !! wikitext
5420 [[Main Page]]
5421 !! html
5422 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5423 </p>
5424 !! end
5425
5426 !! test
5427 Plain link, uncapitalized
5428 !! wikitext
5429 [[main Page]]
5430 !! html
5431 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5432 </p>
5433 !! end
5434
5435 !! test
5436 Piped link
5437 !! wikitext
5438 [[Main Page|The Main Page]]
5439 !! html
5440 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5441 </p>
5442 !! end
5443
5444 !! test
5445 Piped link with comment in link text
5446 !! wikitext
5447 [[Main Page|The Main<!--front--> Page]]
5448 !! html
5449 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5450 </p>
5451 !! end
5452
5453 !! test
5454 Piped link with multiple pipe characters in link text
5455 !! wikitext
5456 [[Main Page||The|Main|Page|]]
5457 !! html/php
5458 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5459 </p>
5460 !! html/parsoid
5461 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5462 !! end
5463
5464 !! test
5465 Broken link
5466 !! wikitext
5467 [[Zigzagzogzagzig]]
5468 !! html
5469 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5470 </p>
5471 !! end
5472
5473 !! test
5474 Broken link with fragment
5475 !! wikitext
5476 [[Zigzagzogzagzig#zug]]
5477 !! html
5478 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5479 </p>
5480 !! end
5481
5482 !! test
5483 Special page link with fragment
5484 !! wikitext
5485 [[Special:Version#anchor]]
5486 !! html
5487 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5488 </p>
5489 !! end
5490
5491 !! test
5492 Nonexistent special page link with fragment
5493 !! wikitext
5494 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5495 !! html
5496 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5497 </p>
5498 !! end
5499
5500 !! test
5501 Link with prefix
5502 !! wikitext
5503 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5504 !! html
5505 <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>
5506 </p>
5507 !! end
5508
5509 !! test
5510 Link with suffix
5511 !! wikitext
5512 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5513 !! html
5514 <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>!!!
5515 </p>
5516 !! end
5517
5518 !! article
5519 prefixed article
5520 !! text
5521 Some text
5522 !! endarticle
5523
5524 !! test
5525 Bug 43661: Piped links with identical prefixes
5526 !! wikitext
5527 [[prefixed article|prefixed articles with spaces]]
5528
5529 [[prefixed article|prefixed articlesaoeu]]
5530
5531 [[Main Page|Main Page test]]
5532 !! html
5533 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5534 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5535 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5536 </p>
5537 !! end
5538
5539
5540 !! test
5541 Link with HTML entity in suffix / tail
5542 !! wikitext
5543 [[Main Page]]&quot;, [[Main Page]]&#97;
5544 !! html
5545 <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;
5546 </p>
5547 !! end
5548
5549 !! test
5550 Link with 3 brackets
5551 !! wikitext
5552 [[[Main Page]]]
5553 !! html
5554 <p>[[[Main Page]]]
5555 </p>
5556 !! end
5557
5558 !! test
5559 Link with 4 brackets
5560 !! wikitext
5561 [[[[Main Page]]]]
5562 !! html
5563 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5564 </p>
5565 !! end
5566
5567 !! test
5568 Piped link with 3 brackets
5569 !! wikitext
5570 [[[main page|the main page]]]
5571 !! html
5572 <p>[[[main page|the main page]]]
5573 </p>
5574 !! end
5575
5576 !! test
5577 Piped link with extlink-like text
5578 !! wikitext
5579 [[Main Page|[bar]]]
5580 [[Main Page|This is a [bar]]]
5581 !! html
5582 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5583 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5584 </p>
5585 !! end
5586
5587 !! test
5588 Link with multiple pipes
5589 !! wikitext
5590 [[Main Page|The|Main|Page]]
5591 !! html
5592 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5593 </p>
5594 !! end
5595
5596 !! test
5597 Link to namespaces
5598 !! wikitext
5599 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5600 !! html
5601 <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>
5602 </p>
5603 !! end
5604
5605 !! article
5606 MemoryAlpha:AlphaTest
5607 !! text
5608 This is an article in the MemoryAlpha namespace
5609 (which shadows the memoryalpha interwiki link).
5610 !! endarticle
5611
5612 !! test
5613 Namespace takes precedence over interwiki link (bug 51680)
5614 !! wikitext
5615 [[MemoryAlpha:AlphaTest]]
5616 !! html
5617 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5618 </p>
5619 !! end
5620
5621 # The previous test doesn't work correctly in html2*, due to not recognizing the
5622 # link as an internal one. This one checks for the correct behavior.
5623 !! test
5624 Link to namespace preferred over interwiki with correct rel attribute
5625 !! options
5626 parsoid=html2wt,html2html
5627 !! wikitext
5628 [[MemoryAlpha:AlphaTest]]
5629 !! html
5630 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5631 </p>
5632 !! end
5633
5634 !! test
5635 Piped link to namespace
5636 !! wikitext
5637 [[Meta:Disclaimers|The disclaimers]]
5638 !! html
5639 <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>
5640 </p>
5641 !! end
5642
5643 !! test
5644 Link containing }
5645 !! wikitext
5646 [[Usually caused by a typo (oops}]]
5647 !! html
5648 <p>[[Usually caused by a typo (oops}]]
5649 </p>
5650 !! end
5651
5652 !! article
5653 7% Solution
5654 !! text
5655 Just a test of an article title containing a percent.
5656 !! endarticle
5657
5658 !! test
5659 Link containing % (not as a hex sequence)
5660 !! wikitext
5661 [[7% Solution]]
5662 !! html/php
5663 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5664 </p>
5665 !! html/parsoid
5666 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5667 !! end
5668
5669 # note that the parsoid HTML is identical to the previous test output,
5670 # so the previous test ensures that the html2wt mode will generate the
5671 # "not as a hex sequence" wikitext.
5672 !! test
5673 Link containing % as a single hex sequence interpreted to char
5674 !! options
5675 parsoid=wt2wt,wt2html,html2html
5676 !! wikitext
5677 [[7%25 Solution]]
5678 !! html/php
5679 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5683 !!end
5684
5685 !! test
5686 Link containing % as a double hex sequence interpreted to hex sequence
5687 !! wikitext
5688 [[7%2525 Solution]]
5689 !! html
5690 <p>[[7%2525 Solution]]
5691 </p>
5692 !!end
5693
5694 # note that parsoid does not munge anchor text; all non-space
5695 # characters are valid in HTML5 anchors.
5696 !! test
5697 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5698 Example for such a section: == < ==
5699 !! wikitext
5700 [[%23%3c]][[%23%3e]]
5701 !! html/php
5702 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5703 </p>
5704 !! html/parsoid
5705 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5706 !! end
5707
5708 !! test
5709 Link containing "<#" and ">#" as a hex sequences
5710 !! wikitext
5711 [[%3c%23]][[%3e%23]]
5712 !! html
5713 <p>[[%3c%23]][[%3e%23]]
5714 </p>
5715 !! end
5716
5717 !! test
5718 Link containing an equals sign
5719 !! wikitext
5720 [[Special:BookSources/isbn=4-00-026157-6]]
5721 !! html/php
5722 <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>
5723 </p>
5724 !! html/parsoid
5725 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5726 !! end
5727
5728 !! article
5729 Foo~bar
5730 !! text
5731 Just a test of an article title containing a tilde.
5732 !! endarticle
5733
5734 # note that links containing signatures, like [[Foo~~~~]], are
5735 # massaged by the pre-save transform (PST) and so the tildes are never
5736 # seen by the parser.
5737 !! test
5738 Link containing a tilde
5739 !! wikitext
5740 [[Foo~bar]]
5741 !! html/php
5742 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5743 </p>
5744 !! html/parsoid
5745 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5746 !! end
5747
5748 !! test
5749 Link containing double-single-quotes '' (bug 4598)
5750 !! wikitext
5751 [[Lista d''e paise d''o munno]]
5752 !! html/php
5753 <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>
5754 </p>
5755 !! html/parsoid
5756 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5757 !! end
5758
5759 !! test
5760 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5761 !! wikitext
5762 Some [[Link|pretty ''italics'' and stuff]]!
5763 !! html/php
5764 <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>!
5765 </p>
5766 !! html/parsoid
5767 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5768 !! end
5769
5770 !! test
5771 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5772 !! wikitext
5773 ''Some [[Link|pretty ''italics'' and stuff]]!''
5774 !! html
5775 <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>
5776 </p>
5777 !! end
5778
5779 !! test
5780 Link with double quotes in title part (literal) and alternate part (interpreted)
5781 !! wikitext
5782 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5783
5784 [[''Pentecoste'']]
5785
5786 [[''Pentecoste''|Pentecoste]]
5787
5788 [[''Pentecoste''|''Pentecoste'']]
5789 !! html/php
5790 <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>
5791 </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>
5792 </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>
5793 </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>
5794 </p>
5795 !! html/parsoid
5796 <meta typeof="mw:Placeholder"/>
5797 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5798 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5799 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5800 !! end
5801
5802 !! test
5803 Broken image links with HTML captions (bug 39700)
5804 !! wikitext
5805 [[File:Nonexistent|<script></script>]]
5806 [[File:Nonexistent|100px|<script></script>]]
5807 [[File:Nonexistent|&lt;]]
5808 [[File:Nonexistent|a<i>b</i>c]]
5809 !! html
5810 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5811 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5812 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5813 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5814 </p>
5815 !! end
5816
5817 !! test
5818 Plain link to URL
5819 !! wikitext
5820 [[http://www.example.com]]
5821 !! html/php
5822 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5823 </p>
5824 !! html/parsoid
5825 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5826 !! end
5827
5828 !! test
5829 Plain link to URL with link text
5830 !! wikitext
5831 [[http://www.example.com Link text]]
5832 !! html
5833 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5834 </p>
5835 !! end
5836
5837 !! test
5838 Plain link to protocol-relative URL
5839 !! wikitext
5840 [[//www.example.com]]
5841 !! html/php
5842 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5843 </p>
5844 !! html/parsoid
5845 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5846 !! end
5847
5848 !! test
5849 Plain link to protocol-relative URL with link text
5850 !! wikitext
5851 [[//www.example.com Link text]]
5852 !! html
5853 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5854 </p>
5855 !! end
5856
5857 !! test
5858 Plain link to page with question mark in title
5859 !! wikitext
5860 [[A?b]]
5861
5862 [[A?b|Baz]]
5863 !! html
5864 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5865 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5866 </p>
5867 !! end
5868
5869
5870 # I'm fairly sure the expected result here is wrong.
5871 # We want these to be URL links, not pseudo-pages with URLs for titles....
5872 # However the current output is also pretty screwy.
5873 #
5874 # ----
5875 # I'm changing it to match the current output--it arguably makes more
5876 # sense in the light of the test above. Old expected result was:
5877 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5878 #</p>
5879 # But I think this test is bordering on "garbage in, garbage out" anyway.
5880 # -- wtm
5881 !! test
5882 Piped link to URL
5883 !! wikitext
5884 Piped link to URL: [[http://www.example.com|an example URL]]
5885 !! html/php
5886 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5887 </p>
5888 !! html/parsoid
5889 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5890 !! end
5891
5892 !! test
5893 BUG 2: [[page|http://url/]] should link to page, not http://url/
5894 !! wikitext
5895 [[Main Page|http://url/]]
5896 !! html/php
5897 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5898 </p>
5899 !! html/parsoid
5900 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5901 !! end
5902
5903 # Parsoid does not mark self-links, by design.
5904 !! test
5905 BUG 337: Escaped self-links should be bold
5906 !! options
5907 title=[[Bug462]]
5908 !! wikitext
5909 [[Bu&#103;462]] [[Bug462]]
5910 !! html/php
5911 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5912 </p>
5913 !! html/parsoid
5914 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
5915 !! end
5916
5917 !! test
5918 Self-link to section should not be bold
5919 !! options
5920 title=[[Main Page]]
5921 !! wikitext
5922 [[Main Page#section]]
5923 !! html
5924 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5925 </p>
5926 !! end
5927
5928 !! article
5929 00
5930 !! text
5931 This is 00.
5932 !! endarticle
5933
5934 !!test
5935 Self-link to numeric title
5936 !!options
5937 title=[[0]]
5938 !! wikitext
5939 [[0]]
5940 !! html
5941 <p><strong class="selflink">0</strong>
5942 </p>
5943 !!end
5944
5945 !!test
5946 Link to numeric-equivalent title
5947 !!options
5948 title=[[0]]
5949 !! wikitext
5950 [[00]]
5951 !! html
5952 <p><a href="/wiki/00" title="00">00</a>
5953 </p>
5954 !!end
5955
5956 !! test
5957 <nowiki> inside a link
5958 !! wikitext
5959 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5960 !! html
5961 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5962 </p>
5963 !! end
5964
5965 !! test
5966 Non-breaking spaces in title
5967 !! wikitext
5968 [[&nbsp; Main &nbsp; Page &nbsp;]]
5969 !! html
5970 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5971 </p>
5972 !!end
5973
5974 !! test
5975 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5976 !! options
5977 language=ca
5978 !! wikitext
5979 '''[[Main Page]]'''
5980 !! html
5981 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5982 </p>
5983 !! end
5984
5985 !! test
5986 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5987 !! options
5988 language=ca
5989 !! wikitext
5990 ''[[Main Page]]''
5991 !! html
5992 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5993 </p>
5994 !! end
5995
5996 !! test
5997 Internal link with en linktrail: no apostrophes (bug 27473)
5998 !! options
5999 language=en
6000 !! wikitext
6001 [[Something]]'nice
6002 !! html
6003 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6004 </p>
6005 !! end
6006
6007 !! test
6008 Internal link with ca linktrail with apostrophes (bug 27473)
6009 !! options
6010 language=ca
6011 !! wikitext
6012 [[Something]]'nice
6013 !! html
6014 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6015 </p>
6016 !! end
6017
6018 !! test
6019 Internal link with kaa linktrail with apostrophes (bug 27473)
6020 !! options
6021 language=kaa
6022 !! wikitext
6023 [[Something]]'nice
6024 !! html
6025 <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>
6026 </p>
6027 !! end
6028
6029 !! test
6030 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6031 !! wikitext
6032 [[User:Foo/Test/63636:Bar|Test]]
6033 !! html/php
6034 <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>
6035 </p>
6036 !! html/parsoid
6037 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6038 !! end
6039
6040 !! test
6041 1. Interaction of linktrail and template encapsulation
6042 !! options
6043 parsoid
6044 !! wikitext
6045 {{echo|[[Foo]]}}l
6046 !! html
6047 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6048 !! end
6049
6050 !! test
6051 2. Interaction of linktrail and template encapsulation
6052 !! options
6053 parsoid
6054 !! wikitext
6055 {{echo|Some [[Fool]]}}s
6056 !! html
6057 <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" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6058 !! end
6059
6060 !! test
6061 3. Interaction of linktrail and template encapsulation
6062 !! options
6063 parsoid
6064 !! wikitext
6065 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6066 !! html
6067 <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" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
6068 !! end
6069
6070 !! article
6071 Söfnuður
6072 !! text
6073 Test.
6074 !! endarticle
6075
6076 !! test
6077 Internal link with is link prefix
6078 !! options
6079 language=is
6080 !! wikitext
6081 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6082 !! html
6083 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6084 </p>
6085 !! end
6086
6087 !! article
6088 Mótmælendatrú
6089 !! text
6090 Test.
6091 !! endarticle
6092
6093 !! test
6094 Internal link with is link trail and link prefix
6095 !! options
6096 language=is
6097 !! wikitext
6098 [[mótmælendatrú|xxx]]ar
6099 [[mótmælendatrú]]ar
6100 mótmælenda[[söfnuður]]
6101 mótmælenda[[söfnuður|söfnuðir]]
6102 mótmælenda[[söfnuður|söfnuðir]]xxx
6103 !! html
6104 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6105 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6106 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6107 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6108 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6109 </p>
6110 !! end
6111
6112 !! test
6113 Parsoid link trail escaping
6114 !! options
6115 parsoid=html2wt,html2html
6116 !! wikitext
6117 [[apple]]<nowiki/>s
6118 !! html
6119 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6120 !! end
6121
6122 !! test
6123 Parsoid link prefix escaping
6124 !! options
6125 language=is
6126 parsoid=html2wt,html2html
6127 !! wikitext
6128 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6129 !! html
6130 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6131 !! end
6132
6133 !! test
6134 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6135 !! wikitext
6136 [[Foo| bar]]
6137
6138 [[Foo| ''bar'']]
6139
6140 [http://wp.org foo]
6141
6142 [http://wp.org ''foo'']
6143 !! html
6144 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6145 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
6146 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6147 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6148 </p>
6149 !! end
6150
6151 !! test
6152 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6153 !! options
6154 parsoid
6155 !! wikitext
6156 [[Foo|{{echo|a}} b {{echo|c}}]]
6157 !! html
6158 <p><a rel="mw:WikiLink" href="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>
6159 !! end
6160
6161 ###
6162 ### Interwiki links (see maintenance/interwiki.sql)
6163 ###
6164
6165 !! test
6166 Inline interwiki link
6167 !! wikitext
6168 [[MeatBall:SoftSecurity]]
6169 !! html
6170 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6171 </p>
6172 !! end
6173
6174 !! test
6175 Inline interwiki link with empty title (bug 2372)
6176 !! wikitext
6177 [[MeatBall:]]
6178 !! html
6179 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6180 </p>
6181 !! end
6182
6183 !! test
6184 Interwiki link encoding conversion (bug 1636)
6185 !! wikitext
6186 *[[Wikipedia:ro:Olteni&#0355;a]]
6187 *[[Wikipedia:ro:Olteni&#355;a]]
6188 !! html
6189 <ul>
6190 <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>
6191 </li>
6192 <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>
6193 </li>
6194 </ul>
6195
6196 !! end
6197
6198 !! test
6199 Interwiki link with fragment (bug 2130)
6200 !! wikitext
6201 [[MeatBall:SoftSecurity#foo]]
6202 !! html
6203 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6204 </p>
6205 !! end
6206
6207 # Ideally the wikipedia: prefix here should be proto-relative too
6208 !! test
6209 Different interwiki prefixes mapping to the same URL
6210 !! wikitext
6211 [[:en:Foo]]
6212
6213 [[:en:Foo|Foo]]
6214
6215 [[wikipedia:Foo]]
6216
6217 [[:wikipedia:Foo|Foo]]
6218
6219 [[wikipedia:en:Foo]]
6220
6221 [[:wikipedia:en:Foo]]
6222 !! html/parsoid
6223 <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>
6224
6225 <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>
6226
6227 <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>
6228
6229 <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>
6230
6231 <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>
6232
6233 <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>
6234 !! end
6235
6236 !! test
6237 Interwiki links that cannot be represented in wiki syntax
6238 !! wikitext
6239 [[meatball:ok]]
6240 [[meatball:ok#foo|ok with fragment]]
6241 [[meatball:ok_as_well?|ok ending with ? mark]]
6242 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6243 [http://de.wikipedia.org/wiki/#foo is just fragment]
6244
6245 !! html/parsoid
6246 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6247 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6248 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6249 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6250 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6251 !! end
6252
6253 !! test
6254 Interwiki links: trail
6255 !! options
6256 parsoid
6257 !! wikitext
6258 [[wikipedia:Foo|Ba]]r
6259 !! html
6260 <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>
6261 !! end
6262
6263 ###
6264 ### Interlanguage links
6265 ### Language links (so that searching for '### language' matches..)
6266 ###
6267
6268 !! test
6269 Interlanguage link
6270 !! wikitext
6271 Blah blah blah
6272 [[zh:Chinese]]
6273 !! html
6274 <p>Blah blah blah
6275 </p>
6276 !! end
6277
6278 !! test
6279 Double interlanguage link
6280 !! wikitext
6281 Blah blah blah
6282 [[es:Spanish]]
6283 [[zh:Chinese]]
6284 !! html
6285 <p>Blah blah blah
6286 </p>
6287 !! end
6288
6289 !! test
6290 Interlanguage link, with prefix links
6291 !! options
6292 language=ln
6293 !! wikitext
6294 Blah blah blah
6295 [[zh:Chinese]]
6296 !! html
6297 <p>Blah blah blah
6298 </p>
6299 !! end
6300
6301 !! test
6302 Double interlanguage link, with prefix links (bug 8897)
6303 !! options
6304 language=ln
6305 !! wikitext
6306 Blah blah blah
6307 [[es:Spanish]]
6308 [[zh:Chinese]]
6309 !! html
6310 <p>Blah blah blah
6311 </p>
6312 !! end
6313
6314 !! test
6315 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6316 !! options
6317 language=ln
6318 !! wikitext
6319 [[WW&nbsp;II]]
6320 !! html
6321 <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>
6322 </p>
6323 !! end
6324
6325 !! test
6326 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6327 !! options
6328 parsoid=html2wt
6329 !! wikitext
6330 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6331
6332 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6333 !! html
6334 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6335 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6336 !! end
6337
6338 !! test
6339 Parsoid: handle constructor well
6340 !! options
6341 parsoid
6342 !! wikitext
6343 [[constructor]]
6344
6345 [[constructor:foo]]
6346 !! html
6347 <p><a rel="mw:WikiLink" href="./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>
6348
6349 <p><a rel="mw:WikiLink" href="./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>
6350 !! end
6351
6352 !! test
6353 Parsoid: recognize interlanguage links without a target page
6354 !! options
6355 parsoid
6356 !! wikitext
6357 [[ko:]]
6358 !! html
6359 <p>
6360 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6361 !! end
6362
6363 !! test
6364 Parsoid: recognize interwiki links without a target page
6365 !! options
6366 parsoid
6367 !! wikitext
6368 [[:ko:]]
6369 !! html
6370 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6371 !! end
6372
6373 !! test
6374 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6375 !! options
6376 parsoid
6377 !! wikitext
6378 [[en:Foo]]
6379 !! html
6380 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6381 !! end
6382
6383 ###
6384 ### Redirects, Parsoid-only
6385 ###
6386 !! test
6387 1. Simple redirect to page
6388 !! options
6389 parsoid
6390 !! wikitext
6391 #REDIRECT [[Main Page]]
6392 !! html
6393 <link rel="mw:PageProp/redirect" href="./Main_Page">
6394 !! end
6395
6396 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6397 !! test
6398 2. Other redirect variants
6399 !! options
6400 parsoid=wt2html,wt2wt
6401 !! wikitext
6402 #REDIRECT [[Main_Page]]
6403 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6404 !! html
6405 <link rel="mw:PageProp/redirect" href="./Main_Page">
6406 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6407 !! end
6408
6409 !! test
6410 Optional colon in #REDIRECT
6411 !! options
6412 # the colon is archaic syntax. we support it for wt2html, but we
6413 # don't care that it roundtrips back to the modern syntax.
6414 parsoid=wt2html,html2html
6415 !! wikitext
6416 #REDIRECT:[[Main Page]]
6417 !! html
6418 <link rel="mw:PageProp/redirect" href="./Main_Page">
6419 !! end
6420
6421 !! test
6422 Whitespace in #REDIRECT with optional colon
6423 !! options
6424 # the colon and gratuitous whitespace is archaic syntax. we support
6425 # it for wt2html, but we don't care that it roundtrips back to the
6426 # modern syntax (without extra whitespace)
6427 parsoid=wt2html,html2html
6428 !! wikitext
6429
6430 #REDIRECT
6431 :
6432 [[Main Page]]
6433 !! html
6434 <link rel="mw:PageProp/redirect" href="./Main_Page">
6435 !! end
6436
6437 !! test
6438 Piped link in #REDIRECT
6439 !! options
6440 # content after piped link is ignored. we support this syntax,
6441 # but don't care that the piped link is lost when we roundtrip this.
6442 parsoid=wt2html
6443 !! wikitext
6444 #REDIRECT [[Main Page|bar]]
6445 !! html
6446 <link rel="mw:PageProp/redirect" href="./Main_Page">
6447 !! end
6448
6449 !! test
6450 Redirect to category
6451 !! options
6452 parsoid=wt2html
6453 !! wikitext
6454 #REDIRECT [[Category:Foo]]
6455 !! html
6456 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6457 !! end
6458
6459 !! test
6460 Redirect to category with URL encoding
6461 !! options
6462 parsoid=wt2html
6463 !! wikitext
6464 #REDIRECT [[Category%3AFoo]]
6465 !! html
6466 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6467 !! end
6468
6469 !! test
6470 Redirect to category page
6471 !! options
6472 parsoid=wt2html,html2html
6473 !! wikitext
6474 #REDIRECT [[:Category:Foo]]
6475 !! html
6476 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6477 !! end
6478
6479 !! test
6480 Redirect to image page (1)
6481 !! options
6482 parsoid
6483 !! wikitext
6484 #REDIRECT [[File:Wiki.png]]
6485 !! html
6486 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6487 !! end
6488
6489 !! test
6490 Redirect to image page (2)
6491 !! options
6492 parsoid
6493 !! wikitext
6494 #REDIRECT [[Image:Wiki.png]]
6495 !! html
6496 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6497 !! end
6498
6499 !! test
6500 Redirect to language
6501 !! options
6502 parsoid
6503 !! wikitext
6504 #REDIRECT [[en:File:Wiki.png]]
6505 !! html
6506 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6507 !! end
6508
6509 !! test
6510 Redirect to interwiki
6511 !! options
6512 parsoid
6513 !! wikitext
6514 #REDIRECT [[meatball:File:Wiki.png]]
6515 !! html
6516 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6517 !! end
6518
6519 !! test
6520 Non-English #REDIRECT
6521 !! options
6522 parsoid
6523 language=is
6524 !! wikitext
6525 #TILVÍSUN [[Main Page]]
6526 !! html
6527 <link rel="mw:PageProp/redirect" href="./Main_Page">
6528 !! end
6529
6530 !! test
6531 New redirect
6532 !! options
6533 parsoid=html2wt
6534 !! wikitext
6535 Foo
6536 #REDIRECT [[Foo]]
6537 !! html
6538 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6539 !! end
6540
6541 ##
6542 ## XHTML tidiness
6543 ###
6544
6545 !! test
6546 <br> to <br />
6547 !! wikitext
6548 1<br>2<br />3
6549 !! html
6550 <p>1<br />2<br />3
6551 </p>
6552 !! end
6553
6554 !! test
6555 Broken br tag sanitization
6556 !! wikitext
6557 </br>
6558 !! html/php
6559 <p>&lt;/br&gt;
6560 </p>
6561 !! end
6562
6563 # TODO: Fix html2html mode (bug 51055)!
6564 !! test
6565 Parsoid: Broken br tag recognition
6566 !! options
6567 parsoid=wt2html
6568 !! wikitext
6569 </br>
6570 !! html/parsoid
6571 <p><br></p>
6572 !! end
6573
6574 !! test
6575 Incorrecly removing closing slashes from correctly formed XHTML
6576 !! wikitext
6577 <br style="clear:both;" />
6578 !! html
6579 <p><br style="clear:both;" />
6580 </p>
6581 !! end
6582
6583 !! test
6584 Failing to transform badly formed HTML into correct XHTML
6585 !! wikitext
6586 <br style="clear: left;">
6587 <br style="clear: right;">
6588 <br style="clear: both;">
6589 !! html
6590 <p><br style="clear: left;" />
6591 <br style="clear: right;" />
6592 <br style="clear: both;" />
6593 </p>
6594 !!end
6595
6596 !! test
6597 Handling html with a div self-closing tag
6598 !! wikitext
6599 <div title />
6600 <div title/>
6601 <div title/ >
6602 <div title=bar />
6603 <div title=bar/>
6604 <div title=bar/ >
6605 !! html
6606 <p>&lt;div title /&gt;
6607 &lt;div title/&gt;
6608 </p>
6609 <div>
6610 <p>&lt;div title=bar /&gt;
6611 &lt;div title=bar/&gt;
6612 </p>
6613 <div title="bar/"></div>
6614 </div>
6615
6616 !! end
6617
6618 !! test
6619 Handling html with a br self-closing tag
6620 !! wikitext
6621 <br title />
6622 <br title/>
6623 <br title/ >
6624 <br title=bar />
6625 <br title=bar/>
6626 <br title=bar/ >
6627 !! html
6628 <p><br title="title" />
6629 <br title="title" />
6630 <br />
6631 <br title="bar" />
6632 <br title="bar" />
6633 <br title="bar/" />
6634 </p>
6635 !! end
6636
6637 !! test
6638 Horizontal ruler (should it add that extra space?)
6639 !! wikitext
6640 <hr>
6641 <hr >
6642 foo <hr
6643 > bar
6644 !! html
6645 <hr />
6646 <hr />
6647 foo <hr /> bar
6648
6649 !! end
6650
6651 !! test
6652 Horizontal ruler -- 4+ dashes render hr
6653 !! wikitext
6654 ----
6655 !! html
6656 <hr />
6657
6658 !! end
6659
6660 !! test
6661 Horizontal ruler -- eats additional dashes on the same line
6662 !! wikitext
6663 ---------
6664 !! html
6665 <hr />
6666
6667 !! end
6668
6669 !! test
6670 Horizontal ruler -- does not collapse dashes on consecutive lines
6671 !! wikitext
6672 ----
6673 ----
6674 !! html
6675 <hr />
6676 <hr />
6677
6678 !! end
6679
6680 !! test
6681 Horizontal ruler -- <4 dashes render as plain text
6682 !! wikitext
6683 ---
6684 !! html
6685 <p>---
6686 </p>
6687 !! end
6688
6689 !! test
6690 Horizontal ruler -- Supports content following dashes on same line
6691 !! wikitext
6692 ---- Foo
6693 !! html
6694 <hr /> Foo
6695
6696 !! end
6697
6698 ###
6699 ### Block-level elements
6700 ###
6701 !! test
6702 Common list
6703 !! wikitext
6704 *Common list
6705 * item 2
6706 *item 3
6707 !! html
6708 <ul>
6709 <li>Common list
6710 </li>
6711 <li> item 2
6712 </li>
6713 <li>item 3
6714 </li>
6715 </ul>
6716
6717 !! end
6718
6719 !! test
6720 Numbered list
6721 !! wikitext
6722 #Numbered list
6723 #item 2
6724 # item 3
6725 !! html
6726 <ol>
6727 <li>Numbered list
6728 </li>
6729 <li>item 2
6730 </li>
6731 <li> item 3
6732 </li>
6733 </ol>
6734
6735 !! end
6736
6737 !! test
6738 Mixed list
6739 !! wikitext
6740 *Mixed list
6741 *# with numbers
6742 ** and bullets
6743 *# and numbers
6744 *bullets again
6745 **bullet level 2
6746 ***bullet level 3
6747 ***#Number on level 4
6748 **bullet level 2
6749 **#Number on level 3
6750 **#Number on level 3
6751 *#number level 2
6752 *Level 1
6753 *** Level 3
6754 #** Level 3, but ordered
6755 !! html
6756 <ul>
6757 <li>Mixed list
6758 <ol>
6759 <li> with numbers
6760 </li>
6761 </ol>
6762 <ul>
6763 <li> and bullets
6764 </li>
6765 </ul>
6766 <ol>
6767 <li> and numbers
6768 </li>
6769 </ol>
6770 </li>
6771 <li>bullets again
6772 <ul>
6773 <li>bullet level 2
6774 <ul>
6775 <li>bullet level 3
6776 <ol>
6777 <li>Number on level 4
6778 </li>
6779 </ol>
6780 </li>
6781 </ul>
6782 </li>
6783 <li>bullet level 2
6784 <ol>
6785 <li>Number on level 3
6786 </li>
6787 <li>Number on level 3
6788 </li>
6789 </ol>
6790 </li>
6791 </ul>
6792 <ol>
6793 <li>number level 2
6794 </li>
6795 </ol>
6796 </li>
6797 <li>Level 1
6798 <ul>
6799 <li><ul>
6800 <li> Level 3
6801 </li>
6802 </ul>
6803 </li>
6804 </ul>
6805 </li>
6806 </ul>
6807 <ol>
6808 <li><ul>
6809 <li><ul>
6810 <li> Level 3, but ordered
6811 </li>
6812 </ul>
6813 </li>
6814 </ul>
6815 </li>
6816 </ol>
6817
6818 !! end
6819
6820 !! test
6821 Nested lists 1
6822 !! wikitext
6823 *foo
6824 **bar
6825 !! html
6826 <ul>
6827 <li>foo
6828 <ul>
6829 <li>bar
6830 </li>
6831 </ul>
6832 </li>
6833 </ul>
6834
6835 !! end
6836
6837 !! test
6838 Nested lists 2
6839 !! wikitext
6840 **foo
6841 *bar
6842 !! html
6843 <ul>
6844 <li><ul>
6845 <li>foo
6846 </li>
6847 </ul>
6848 </li>
6849 <li>bar
6850 </li>
6851 </ul>
6852
6853 !! end
6854
6855 !! test
6856 Nested lists 3 (first element empty)
6857 !! wikitext
6858 *
6859 **bar
6860 !! html
6861 <ul>
6862 <li>
6863 <ul>
6864 <li>bar
6865 </li>
6866 </ul>
6867 </li>
6868 </ul>
6869
6870 !! end
6871
6872 !! test
6873 Nested lists 4 (first element empty)
6874 !! wikitext
6875 **
6876 *bar
6877 !! html
6878 <ul>
6879 <li><ul>
6880 <li>
6881 </li>
6882 </ul>
6883 </li>
6884 <li>bar
6885 </li>
6886 </ul>
6887
6888 !! end
6889
6890 !! test
6891 Nested lists 5 (both elements empty)
6892 !! wikitext
6893 **
6894 *
6895 !! html
6896 <ul>
6897 <li><ul>
6898 <li>
6899 </li>
6900 </ul>
6901 </li>
6902 <li>
6903 </li>
6904 </ul>
6905
6906 !! end
6907
6908 !! test
6909 Nested lists 6 (both elements empty)
6910 !! wikitext
6911 *
6912 **
6913 !! html
6914 <ul>
6915 <li>
6916 <ul>
6917 <li>
6918 </li>
6919 </ul>
6920 </li>
6921 </ul>
6922
6923 !! end
6924
6925 !! test
6926 Nested lists 7 (skip initial nesting levels)
6927 !! wikitext
6928 *** foo
6929 !! html
6930 <ul>
6931 <li><ul>
6932 <li><ul>
6933 <li> foo
6934 </li>
6935 </ul>
6936 </li>
6937 </ul>
6938 </li>
6939 </ul>
6940
6941 !! end
6942
6943 !! test
6944 Nested lists 8 (multiple nesting transitions)
6945 !! wikitext
6946 * foo
6947 *** bar
6948 ** baz
6949 * boo
6950 !! html
6951 <ul>
6952 <li> foo
6953 <ul>
6954 <li><ul>
6955 <li> bar
6956 </li>
6957 </ul>
6958 </li>
6959 <li> baz
6960 </li>
6961 </ul>
6962 </li>
6963 <li> boo
6964 </li>
6965 </ul>
6966
6967 !! end
6968
6969 !! test
6970 1. Lists with start-of-line-transparent tokens before bullets: Comments
6971 !! wikitext
6972 *foo
6973 *<!--cmt-->bar
6974 <!--cmt-->*baz
6975 !! html
6976 <ul>
6977 <li>foo
6978 </li>
6979 <li>bar
6980 </li>
6981 <li>baz
6982 </li>
6983 </ul>
6984
6985 !! end
6986
6987 !! test
6988 2. Lists with start-of-line-transparent tokens before bullets: Template close
6989 !! wikitext
6990 *foo {{echo|bar
6991 }}*baz
6992 !! html
6993 <ul>
6994 <li>foo bar
6995 </li>
6996 <li>baz
6997 </li>
6998 </ul>
6999
7000 !! end
7001
7002 !! test
7003 List items are not parsed correctly following a <pre> block (bug 785)
7004 !! wikitext
7005 * <pre>foo</pre>
7006 * <pre>bar</pre>
7007 * zar
7008 !! html
7009 <ul>
7010 <li> <pre>foo</pre>
7011 </li>
7012 <li> <pre>bar</pre>
7013 </li>
7014 <li> zar
7015 </li>
7016 </ul>
7017
7018 !! end
7019
7020 !! test
7021 List items from template
7022 !! wikitext
7023
7024 {{inner list}}
7025 * item 2
7026
7027 * item 0
7028 {{inner list}}
7029 * item 2
7030
7031 * item 0
7032 * notSOL{{inner list}}
7033 * item 2
7034 !! html
7035 <ul>
7036 <li> item 1
7037 </li>
7038 <li> item 2
7039 </li>
7040 </ul>
7041 <ul>
7042 <li> item 0
7043 </li>
7044 <li> item 1
7045 </li>
7046 <li> item 2
7047 </li>
7048 </ul>
7049 <ul>
7050 <li> item 0
7051 </li>
7052 <li> notSOL
7053 </li>
7054 <li> item 1
7055 </li>
7056 <li> item 2
7057 </li>
7058 </ul>
7059
7060 !! end
7061
7062 !! test
7063 List interrupted by empty line or heading
7064 !! wikitext
7065 * foo
7066
7067 ** bar
7068 == A heading ==
7069 * Another list item
7070 !! html
7071 <ul>
7072 <li> foo
7073 </li>
7074 </ul>
7075 <ul>
7076 <li><ul>
7077 <li> bar
7078 </li>
7079 </ul>
7080 </li>
7081 </ul>
7082 <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>
7083 <ul>
7084 <li> Another list item
7085 </li>
7086 </ul>
7087
7088 !!end
7089
7090 !!test
7091 Multiple list tags generated by templates
7092 !! wikitext
7093 {{echo|<li>}}a
7094 {{echo|<li>}}b
7095 {{echo|<li>}}c
7096 !! html
7097 <li>a
7098 <li>b
7099 <li>c</li>
7100 </li>
7101 </li>
7102
7103 !!end
7104
7105 !!test
7106 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7107 !! wikitext
7108 *a
7109 <!--This line will NOT split the list-->
7110 *b
7111 <!--This line will NOT split the list either-->
7112 *c
7113 <!--foo--> <!----> <!--This line NOT split the list either-->
7114 *d
7115 !! html
7116 <ul>
7117 <li>a
7118 </li>
7119 <li>b
7120 </li>
7121 <li>c
7122 </li>
7123 <li>d
7124 </li>
7125 </ul>
7126
7127 !!end
7128
7129 !!test
7130 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7131 !! wikitext
7132 *a
7133 <!--This line will NOT split the list-->
7134 *b
7135 <!--This line will NOT split the list either-->
7136 *c
7137 <!--foo--> <!----> <!--This line NOT split the list
7138 either-->
7139 *d
7140 !! html
7141 <ul>
7142 <li>a
7143 </li>
7144 <li>b
7145 </li>
7146 <li>c
7147 </li>
7148 <li>d
7149 </li>
7150 </ul>
7151
7152 !!end
7153
7154 !!test
7155 Test the li-hack
7156 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7157 !!options
7158 parsoid=wt2html,wt2wt
7159 !! wikitext
7160 * foo
7161 * <li>li-hack
7162 * {{echo|<li>templated li-hack}}
7163 * <!--foo--> <li> unsupported li-hack with preceding comments
7164
7165 <ul>
7166 <li><li>not a li-hack
7167 </li>
7168 </ul>
7169 !! html
7170 <ul>
7171 <li> foo</li>
7172 <li>li-hack</li>
7173 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
7174 <li> <!--foo--> </li>
7175 <li> li-hack with preceding comments</li>
7176 </ul>
7177
7178 <ul>
7179 <li></li>
7180 <li>not a li-hack
7181 </li>
7182 </ul>
7183 !!end
7184
7185 !! test
7186 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7187 !! options
7188 parsoid
7189 !! wikitext
7190 # foo
7191 ## bar
7192 * foo
7193 ** bar
7194 : foo
7195 :: bar
7196 !! html
7197 <ol>
7198 <li> foo<ol>
7199 <li> bar</li>
7200 </ol></li>
7201 </ol><ul>
7202 <li> foo<ul>
7203 <li> bar</li>
7204 </ul></li>
7205 </ul><dl>
7206 <dd> foo<dl>
7207 <dd> bar</dd>
7208 </dl></dd>
7209 </dl>
7210 !! end
7211
7212 !! test
7213 Parsoid: Test of whitespace serialization with Templated bullets
7214 !! options
7215 parsoid
7216 !! wikitext
7217 * {{bullet}}
7218 !! html
7219 <ul>
7220 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7221 </ul>
7222 !! end
7223
7224 # ------------------------------------------------------------------------
7225 # The next set of tests are about Parsoid's ability to handle badly nested
7226 # tags (parse, minimize scope of fixup, and roundtrip back)
7227 # ------------------------------------------------------------------------
7228
7229 !! test
7230 Unbalanced closing block tags break a list
7231 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7232 !! wikitext
7233 <div>
7234 *a</div><div>
7235 *b</div>
7236 !! html/parsoid
7237 <div>
7238 <ul>
7239 <li>a
7240 </li>
7241 </ul></div><div>
7242 <ul>
7243 <li>b
7244 </li>
7245 </ul></div>
7246 !! end
7247
7248 !! test
7249 Unbalanced closing non-block tags don't break a list
7250 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7251 !! wikitext
7252 <span>
7253 *a</span><span>
7254 *b</span>
7255 !! html/parsoid
7256 <p><span></span>
7257 </p>
7258 <ul>
7259 <li>a<span></span>
7260 </li>
7261 <li>b
7262 </li>
7263 </ul>
7264 !! end
7265
7266 !! test
7267 Unclosed formatting tags that straddle lists are closed and reopened
7268 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7269 !! wikitext
7270 # <s> a
7271 # b </s>
7272 !! html/parsoid
7273 <ol>
7274 <li> <s> a </s>
7275 </li>
7276 <li> <s> b </s>
7277 </li>
7278 </ol>
7279 !! end
7280
7281 !!test
7282 List embedded in a non-block tag
7283 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7284 !! wikitext
7285 <small>
7286 * foo
7287 </small>
7288 !! html/parsoid
7289 <p><small></small></p>
7290 <small>
7291 <ul>
7292 <li> foo</li>
7293 </ul>
7294 </small>
7295 <p><small></small></p>
7296 !!end
7297
7298 !! test
7299 Table with missing opening <tr> tag
7300 !! options
7301 parsoid=wt2html,wt2wt
7302 !! wikitext
7303 <table>
7304 <td>foo</td>
7305 </tr>
7306 </table>
7307 !! html/parsoid
7308 <table>
7309 <tr>
7310 <td>foo</td>
7311 </tr>
7312 </table>
7313 !! end
7314
7315 ###
7316 ### Magic Words
7317 ###
7318
7319 # Note that the current date is hard-coded as
7320 # 1970-01-01T00:02:03Z (a Thursday)
7321 # when running parser tests. The timezone is also fixed to GMT, so
7322 # local date will be identical to current date.
7323
7324 !! test
7325 Magic Word: {{CURRENTDAY}}
7326 !! wikitext
7327 {{CURRENTDAY}}
7328 !! html
7329 <p>1
7330 </p>
7331 !! end
7332
7333 !! test
7334 Magic Word: {{CURRENTDAY2}}
7335 !! wikitext
7336 {{CURRENTDAY2}}
7337 !! html
7338 <p>01
7339 </p>
7340 !! end
7341
7342 !! test
7343 Magic Word: {{CURRENTDAYNAME}}
7344 !! wikitext
7345 {{CURRENTDAYNAME}}
7346 !! html
7347 <p>Thursday
7348 </p>
7349 !! end
7350
7351 !! test
7352 Magic Word: {{CURRENTDOW}}
7353 !! wikitext
7354 {{CURRENTDOW}}
7355 !! html
7356 <p>4
7357 </p>
7358 !! end
7359
7360 !! test
7361 Magic Word: {{CURRENTMONTH}}
7362 !! wikitext
7363 {{CURRENTMONTH}}
7364 !! html
7365 <p>01
7366 </p>
7367 !! end
7368
7369 !! test
7370 Magic Word: {{CURRENTMONTH1}}
7371 !! wikitext
7372 {{CURRENTMONTH1}}
7373 !! html
7374 <p>1
7375 </p>
7376 !! end
7377
7378 !! test
7379 Magic Word: {{CURRENTMONTHABBREV}}
7380 !! wikitext
7381 {{CURRENTMONTHABBREV}}
7382 !! html
7383 <p>Jan
7384 </p>
7385 !! end
7386
7387 !! test
7388 Magic Word: {{CURRENTMONTHNAME}}
7389 !! wikitext
7390 {{CURRENTMONTHNAME}}
7391 !! html
7392 <p>January
7393 </p>
7394 !! end
7395
7396 !! test
7397 Magic Word: {{CURRENTMONTHNAMEGEN}}
7398 !! wikitext
7399 {{CURRENTMONTHNAMEGEN}}
7400 !! html
7401 <p>January
7402 </p>
7403 !! end
7404
7405 !! test
7406 Magic Word: {{CURRENTTIME}}
7407 !! wikitext
7408 {{CURRENTTIME}}
7409 !! html
7410 <p>00:02
7411 </p>
7412 !! end
7413
7414 !! test
7415 Magic Word: {{CURRENTHOUR}}
7416 !! wikitext
7417 {{CURRENTHOUR}}
7418 !! html
7419 <p>00
7420 </p>
7421 !! end
7422
7423 !! test
7424 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7425 !! wikitext
7426 {{CURRENTWEEK}}
7427 !! html
7428 <p>1
7429 </p>
7430 !! end
7431
7432 !! test
7433 Magic Word: {{CURRENTYEAR}}
7434 !! wikitext
7435 {{CURRENTYEAR}}
7436 !! html
7437 <p>1970
7438 </p>
7439 !! end
7440
7441 !! test
7442 Magic Word: {{CURRENTTIMESTAMP}}
7443 !! wikitext
7444 {{CURRENTTIMESTAMP}}
7445 !! html
7446 <p>19700101000203
7447 </p>
7448 !! end
7449
7450 !! test
7451 Magic Words LOCAL (UTC)
7452 !! wikitext
7453 * {{LOCALMONTH}}
7454 * {{LOCALMONTH1}}
7455 * {{LOCALMONTHNAME}}
7456 * {{LOCALMONTHNAMEGEN}}
7457 * {{LOCALMONTHABBREV}}
7458 * {{LOCALDAY}}
7459 * {{LOCALDAY2}}
7460 * {{LOCALDAYNAME}}
7461 * {{LOCALYEAR}}
7462 * {{LOCALTIME}}
7463 * {{LOCALHOUR}}
7464 * {{LOCALWEEK}}
7465 * {{LOCALDOW}}
7466 * {{LOCALTIMESTAMP}}
7467 !! html
7468 <ul>
7469 <li> 01
7470 </li>
7471 <li> 1
7472 </li>
7473 <li> January
7474 </li>
7475 <li> January
7476 </li>
7477 <li> Jan
7478 </li>
7479 <li> 1
7480 </li>
7481 <li> 01
7482 </li>
7483 <li> Thursday
7484 </li>
7485 <li> 1970
7486 </li>
7487 <li> 00:02
7488 </li>
7489 <li> 00
7490 </li>
7491 <li> 1
7492 </li>
7493 <li> 4
7494 </li>
7495 <li> 19700101000203
7496 </li>
7497 </ul>
7498
7499 !! end
7500
7501 !! test
7502 Magic Word: {{FULLPAGENAME}}
7503 !! options
7504 title=[[User:Ævar Arnfjörð Bjarmason]]
7505 !! wikitext
7506 {{FULLPAGENAME}}
7507 !! html
7508 <p>User:Ævar Arnfjörð Bjarmason
7509 </p>
7510 !! end
7511
7512 !! test
7513 Magic Word: {{FULLPAGENAMEE}}
7514 !! options
7515 title=[[User:Ævar Arnfjörð Bjarmason]]
7516 !! wikitext
7517 {{FULLPAGENAMEE}}
7518 !! html
7519 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7520 </p>
7521 !! end
7522
7523 !! test
7524 Magic Word: {{TALKSPACE}}
7525 !! options
7526 title=[[User:Ævar Arnfjörð Bjarmason]]
7527 !! wikitext
7528 {{TALKSPACE}}
7529 !! html
7530 <p>User talk
7531 </p>
7532 !! end
7533
7534 !! test
7535 Magic Word: {{TALKSPACE}}, same namespace
7536 !! options
7537 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7538 !! wikitext
7539 {{TALKSPACE}}
7540 !! html
7541 <p>User talk
7542 </p>
7543 !! end
7544
7545 !! test
7546 Magic Word: {{TALKSPACE}}, main namespace
7547 !! options
7548 title=[[Parser Test]]
7549 !! wikitext
7550 {{TALKSPACE}}
7551 !! html
7552 <p>Talk
7553 </p>
7554 !! end
7555
7556 !! test
7557 Magic Word: {{TALKSPACEE}}
7558 !! options
7559 title=[[User:Ævar Arnfjörð Bjarmason]]
7560 !! wikitext
7561 {{TALKSPACEE}}
7562 !! html
7563 <p>User_talk
7564 </p>
7565 !! end
7566
7567 !! test
7568 Magic Word: {{SUBJECTSPACE}}
7569 !! options
7570 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7571 !! wikitext
7572 {{SUBJECTSPACE}}
7573 !! html
7574 <p>User
7575 </p>
7576 !! end
7577
7578 !! test
7579 Magic Word: {{SUBJECTSPACE}}, same namespace
7580 !! options
7581 title=[[User:Ævar Arnfjörð Bjarmason]]
7582 !! wikitext
7583 {{SUBJECTSPACE}}
7584 !! html
7585 <p>User
7586 </p>
7587 !! end
7588
7589 !! test
7590 Magic Word: {{SUBJECTSPACE}}, main namespace
7591 !! options
7592 title=[[Parser Test]]
7593 !! wikitext
7594 {{SUBJECTSPACE}}
7595 !! html
7596
7597 !! end
7598
7599 !! test
7600 Magic Word: {{SUBJECTSPACEE}}
7601 !! options
7602 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7603 !! wikitext
7604 {{SUBJECTSPACEE}}
7605 !! html
7606 <p>User
7607 </p>
7608 !! end
7609
7610 !! test
7611 Magic Word: {{NAMESPACE}}
7612 !! options
7613 title=[[User:Ævar Arnfjörð Bjarmason]]
7614 !! wikitext
7615 {{NAMESPACE}}
7616 !! html
7617 <p>User
7618 </p>
7619 !! end
7620
7621 !! test
7622 Magic Word: {{NAMESPACEE}}
7623 !! options
7624 title=[[User:Ævar Arnfjörð Bjarmason]]
7625 !! wikitext
7626 {{NAMESPACEE}}
7627 !! html
7628 <p>User
7629 </p>
7630 !! end
7631
7632 !! test
7633 Magic Word: {{NAMESPACENUMBER}}
7634 !! options
7635 title=[[User:Ævar Arnfjörð Bjarmason]]
7636 !! wikitext
7637 {{NAMESPACENUMBER}}
7638 !! html
7639 <p>2
7640 </p>
7641 !! end
7642
7643 !! test
7644 Magic Word: {{SUBPAGENAME}}
7645 !! options
7646 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7647 !! wikitext
7648 {{SUBPAGENAME}}
7649 !! html
7650 <p>sub ö
7651 </p>
7652 !! end
7653
7654 !! test
7655 Magic Word: {{SUBPAGENAMEE}}
7656 !! options
7657 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7658 !! wikitext
7659 {{SUBPAGENAMEE}}
7660 !! html
7661 <p>sub_%C3%B6
7662 </p>
7663 !! end
7664
7665 !! test
7666 Magic Word: {{ROOTPAGENAME}}
7667 !! options
7668 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7669 !! wikitext
7670 {{ROOTPAGENAME}}
7671 !! html
7672 <p>Ævar Arnfjörð Bjarmason
7673 </p>
7674 !! end
7675
7676 !! test
7677 Magic Word: {{ROOTPAGENAMEE}}
7678 !! options
7679 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7680 !! wikitext
7681 {{ROOTPAGENAMEE}}
7682 !! html
7683 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7684 </p>
7685 !! end
7686
7687 !! test
7688 Magic Word: {{BASEPAGENAME}}
7689 !! options
7690 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7691 !! wikitext
7692 {{BASEPAGENAME}}
7693 !! html
7694 <p>Ævar Arnfjörð Bjarmason
7695 </p>
7696 !! end
7697
7698 !! test
7699 Magic Word: {{BASEPAGENAMEE}}
7700 !! options
7701 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7702 !! wikitext
7703 {{BASEPAGENAMEE}}
7704 !! html
7705 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7706 </p>
7707 !! end
7708
7709 !! test
7710 Magic Word: {{TALKPAGENAME}}
7711 !! options
7712 title=[[User:Ævar Arnfjörð Bjarmason]]
7713 !! wikitext
7714 {{TALKPAGENAME}}
7715 !! html
7716 <p>User talk:Ævar Arnfjörð Bjarmason
7717 </p>
7718 !! end
7719
7720 !! test
7721 Magic Word: {{TALKPAGENAMEE}}
7722 !! options
7723 title=[[User:Ævar Arnfjörð Bjarmason]]
7724 !! wikitext
7725 {{TALKPAGENAMEE}}
7726 !! html
7727 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7728 </p>
7729 !! end
7730
7731 !! test
7732 Magic Word: {{SUBJECTPAGENAME}}
7733 !! options
7734 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7735 !! wikitext
7736 {{SUBJECTPAGENAME}}
7737 !! html
7738 <p>User:Ævar Arnfjörð Bjarmason
7739 </p>
7740 !! end
7741
7742 !! test
7743 Magic Word: {{SUBJECTPAGENAMEE}}
7744 !! options
7745 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7746 !! wikitext
7747 {{SUBJECTPAGENAMEE}}
7748 !! html
7749 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7750 </p>
7751 !! end
7752
7753 !! test
7754 Magic Word: {{NUMBEROFFILES}}
7755 !! wikitext
7756 {{NUMBEROFFILES}}
7757 !! html
7758 <p>5
7759 </p>
7760 !! end
7761
7762 !! test
7763 Magic Word: {{PAGENAME}}
7764 !! options
7765 title=[[User:Ævar Arnfjörð Bjarmason]]
7766 !! wikitext
7767 {{PAGENAME}}
7768 !! html
7769 <p>Ævar Arnfjörð Bjarmason
7770 </p>
7771 !! end
7772
7773 !! test
7774 Magic Word: {{PAGENAME}} with metacharacters
7775 !! options
7776 title=[['foo & bar = baz']]
7777 !! wikitext
7778 ''{{PAGENAME}}''
7779 !! html
7780 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7786 !! options
7787 title=[[*RFC 1234 http://example.com/]]
7788 !! wikitext
7789 {{PAGENAME}}
7790 !! html
7791 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7792 </p>
7793 !! end
7794
7795 !! test
7796 Magic Word: {{PAGENAMEE}}
7797 !! options
7798 title=[[User:Ævar Arnfjörð Bjarmason]]
7799 !! wikitext
7800 {{PAGENAMEE}}
7801 !! html
7802 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7803 </p>
7804 !! end
7805
7806 !! test
7807 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7808 !! options
7809 title=[[*RFC 1234 http://example.com/]]
7810 !! wikitext
7811 {{PAGENAMEE}}
7812 !! html
7813 <p>&#42;RFC_1234_http&#58;//example.com/
7814 </p>
7815 !! end
7816
7817 !! test
7818 Magic Word: {{REVISIONID}}
7819 !! wikitext
7820 {{REVISIONID}}
7821 !! html
7822 <p>1337
7823 </p>
7824 !! end
7825
7826 !! test
7827 Magic Word: {{SCRIPTPATH}}
7828 !! wikitext
7829 {{SCRIPTPATH}}
7830 !! html
7831 <p>/
7832 </p>
7833 !! end
7834
7835 !! test
7836 Magic Word: {{STYLEPATH}}
7837 !! wikitext
7838 {{STYLEPATH}}
7839 !! html
7840 <p>/skins
7841 </p>
7842 !! end
7843
7844 !! test
7845 Magic Word: {{SERVER}}
7846 !! wikitext
7847 {{SERVER}}
7848 !! html
7849 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7850 </p>
7851 !! end
7852
7853 !! test
7854 Magic Word: {{SERVERNAME}}
7855 !! wikitext
7856 {{SERVERNAME}}
7857 !! html
7858 <p>example.org
7859 </p>
7860 !! end
7861
7862 !! test
7863 Magic Word: {{SITENAME}}
7864 !! wikitext
7865 {{SITENAME}}
7866 !! html
7867 <p>MediaWiki
7868 </p>
7869 !! end
7870
7871 !! test
7872 Case-sensitive magic words, when cased differently, should just be template transclusions
7873 !! wikitext
7874 {{CurrentMonth}}
7875 {{currentday}}
7876 {{cURreNTweEK}}
7877 {{currentHour}}
7878 !! html
7879 <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>
7880 <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>
7881 <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>
7882 <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>
7883 </p>
7884 !! end
7885
7886 !! test
7887 Case-insensitive magic words should still work with weird casing.
7888 !! wikitext
7889 {{sErVeRNaMe}}
7890 {{LCFirst:AOEU}}
7891 {{ucFIRST:aoeu}}
7892 {{SERver}}
7893 !! html
7894 <p>example.org
7895 aOEU
7896 Aoeu
7897 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7898 </p>
7899 !! end
7900
7901 !! test
7902 Namespace 1 {{ns:1}}
7903 !! wikitext
7904 {{ns:1}}
7905 !! html
7906 <p>Talk
7907 </p>
7908 !! end
7909
7910 !! test
7911 Namespace 1 {{ns:01}}
7912 !! wikitext
7913 {{ns:01}}
7914 !! html
7915 <p>Talk
7916 </p>
7917 !! end
7918
7919 !! test
7920 Namespace 0 {{ns:0}} (bug 4783)
7921 !! wikitext
7922 {{ns:0}}
7923 !! html
7924
7925 !! end
7926
7927 !! test
7928 Namespace 0 {{ns:00}} (bug 4783)
7929 !! wikitext
7930 {{ns:00}}
7931 !! html
7932
7933 !! end
7934
7935 !! test
7936 Namespace -1 {{ns:-1}}
7937 !! wikitext
7938 {{ns:-1}}
7939 !! html
7940 <p>Special
7941 </p>
7942 !! end
7943
7944 !! test
7945 Namespace User {{ns:User}}
7946 !! wikitext
7947 {{ns:User}}
7948 !! html
7949 <p>User
7950 </p>
7951 !! end
7952
7953 !! test
7954 Namespace User talk {{ns:User_talk}}
7955 !! wikitext
7956 {{ns:User_talk}}
7957 !! html
7958 <p>User talk
7959 </p>
7960 !! end
7961
7962 !! test
7963 Namespace User talk {{ns:uSeR tAlK}}
7964 !! wikitext
7965 {{ns:uSeR tAlK}}
7966 !! html
7967 <p>User talk
7968 </p>
7969 !! end
7970
7971 !! test
7972 Namespace File {{ns:File}}
7973 !! wikitext
7974 {{ns:File}}
7975 !! html
7976 <p>File
7977 </p>
7978 !! end
7979
7980 !! test
7981 Namespace File {{ns:Image}}
7982 !! wikitext
7983 {{ns:Image}}
7984 !! html
7985 <p>File
7986 </p>
7987 !! end
7988
7989 !! test
7990 Namespace (lang=de) Benutzer {{ns:User}}
7991 !! options
7992 language=de
7993 !! wikitext
7994 {{ns:User}}
7995 !! html
7996 <p>Benutzer
7997 </p>
7998 !! end
7999
8000 !! test
8001 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8002 !! options
8003 language=de
8004 !! wikitext
8005 {{ns:3}}
8006 !! html
8007 <p>Benutzer Diskussion
8008 </p>
8009 !! end
8010
8011
8012 !! test
8013 Urlencode
8014 !! wikitext
8015 {{urlencode:hi world?!}}
8016 {{urlencode:hi world?!|WIKI}}
8017 {{urlencode:hi world?!|PATH}}
8018 {{urlencode:hi world?!|QUERY}}
8019 !! html
8020 <p>hi+world%3F%21
8021 hi_world%3F!
8022 hi%20world%3F%21
8023 hi+world%3F%21
8024 </p>
8025 !! end
8026
8027 !! test
8028 Magic Word: prioritize type info over data-parsoid
8029 !! options
8030 parsoid=html2wt
8031 !! wikitext
8032 __FORCETOC__
8033 !! html
8034 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8035 !! end
8036
8037 !! test
8038 Magic Word: serialize on separate line (parsoid)
8039 !! options
8040 parsoid=wt2wt,html2wt
8041 !! wikitext
8042 foo
8043 __NOTOC__
8044 bar
8045 !! html
8046 foo<meta property="mw:PageProp/notoc"/>bar
8047 !! end
8048
8049 !! test
8050 Magic Word: rt non-english wikis
8051 !! options
8052 parsoid=wt2wt
8053 language=de
8054 !! wikitext
8055 __NOEDITSECTION__
8056 !! html
8057 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8058 !! end
8059
8060 ###
8061 ### Magic links
8062 ###
8063 !! test
8064 Magic links: internal link to RFC (bug 479)
8065 !! wikitext
8066 [[RFC 123]]
8067 !! html
8068 <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>
8069 </p>
8070 !! end
8071
8072 !! test
8073 Magic links: RFC (bug 479)
8074 !! wikitext
8075 RFC 822
8076 !! html
8077 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8078 </p>
8079 !! end
8080
8081 !! test
8082 Magic links: ISBN (bug 1937)
8083 !! wikitext
8084 ISBN 0-306-40615-2
8085 !! html
8086 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8087 </p>
8088 !! end
8089
8090 !! test
8091 Magic links: PMID incorrectly converts space to underscore
8092 !! wikitext
8093 PMID 1234
8094 !! html
8095 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8096 </p>
8097 !! end
8098
8099 ###
8100 ### Templates
8101 ####
8102
8103 !! test
8104 Nonexistent template
8105 !! wikitext
8106 {{thistemplatedoesnotexist}}
8107 !! html
8108 <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>
8109 </p>
8110 !! end
8111
8112 !! test
8113 Template with invalid target containing tags
8114 !! wikitext
8115 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8116 !! html
8117 <p>{{a<b>b</b>|foo|a=b|a = b}}
8118 </p>
8119 !! end
8120
8121 !! test
8122 Template with invalid target containing unclosed tag
8123 !! wikitext
8124 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8125 !! html
8126 <p>{{a<b>|foo|a=b|a = b}}</b>
8127 </p>
8128 !! end
8129
8130 !! test
8131 Template with invalid target containing wikilink
8132 !! wikitext
8133 {{[[Main Page]]}}
8134 !! html/php
8135 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8136 </p>
8137 !! html/parsoid
8138 <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>
8139 !! end
8140
8141 !! article
8142 Template:test
8143 !! text
8144 This is a test template
8145 !! endarticle
8146
8147 !! test
8148 Simple template
8149 !! wikitext
8150 {{test}}
8151 !! html
8152 <p>This is a test template
8153 </p>
8154 !! end
8155
8156 !! test
8157 Template with explicit namespace
8158 !! wikitext
8159 {{Template:test}}
8160 !! html
8161 <p>This is a test template
8162 </p>
8163 !! end
8164
8165
8166 !! article
8167 Template:paramtest
8168 !! text
8169 This is a test template with parameter {{{param}}}
8170 !! endarticle
8171
8172 !! test
8173 Template parameter
8174 !! wikitext
8175 {{paramtest|param=foo}}
8176 !! html
8177 <p>This is a test template with parameter foo
8178 </p>
8179 !! end
8180
8181 !! article
8182 Template:paramtestnum
8183 !! text
8184 [[{{{1}}}|{{{2}}}]]
8185 !! endarticle
8186
8187 !! test
8188 Template unnamed parameter
8189 !! wikitext
8190 {{paramtestnum|Main Page|the main page}}
8191 !! html
8192 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8193 </p>
8194 !! end
8195
8196 !! article
8197 Template:templatesimple
8198 !! text
8199 (test)
8200 !! endarticle
8201
8202 !! article
8203 Template:templateredirect
8204 !! text
8205 #redirect [[Template:templatesimple]]
8206 !! endarticle
8207
8208 !! article
8209 Template:templateasargtestnum
8210 !! text
8211 {{{{{1}}}}}
8212 !! endarticle
8213
8214 !! article
8215 Template:templateasargtest
8216 !! text
8217 {{template{{{templ}}}}}
8218 !! endarticle
8219
8220 !! article
8221 Template:templateasargtest2
8222 !! text
8223 {{{{{templ}}}}}
8224 !! endarticle
8225
8226 !! test
8227 Template with template name as unnamed argument
8228 !! wikitext
8229 {{templateasargtestnum|templatesimple}}
8230 !! html
8231 <p>(test)
8232 </p>
8233 !! end
8234
8235 !! test
8236 Template with template name as argument
8237 !! wikitext
8238 {{templateasargtest|templ=simple}}
8239 !! html
8240 <p>(test)
8241 </p>
8242 !! end
8243
8244 !! test
8245 Template with template name as argument (2)
8246 !! wikitext
8247 {{templateasargtest2|templ=templatesimple}}
8248 !! html
8249 <p>(test)
8250 </p>
8251 !! end
8252
8253 !! article
8254 Template:templateasargtestdefault
8255 !! text
8256 {{{{{templ|templatesimple}}}}}
8257 !! endarticle
8258
8259 !! article
8260 Template:templa
8261 !! text
8262 '''templ'''
8263 !! endarticle
8264
8265 !! test
8266 Template with default value
8267 !! wikitext
8268 {{templateasargtestdefault}}
8269 !! html
8270 <p>(test)
8271 </p>
8272 !! end
8273
8274 !! test
8275 Template with default value (value set)
8276 !! wikitext
8277 {{templateasargtestdefault|templ=templa}}
8278 !! html
8279 <p><b>templ</b>
8280 </p>
8281 !! end
8282
8283 !! test
8284 Template redirect
8285 !! wikitext
8286 {{templateredirect}}
8287 !! html
8288 <p>(test)
8289 </p>
8290 !! end
8291
8292 !! test
8293 Template with argument in separate line
8294 !! wikitext
8295 {{ templateasargtest |
8296 templ = simple }}
8297 !! html
8298 <p>(test)
8299 </p>
8300 !! end
8301
8302 !! test
8303 Template with complex template as argument
8304 !! wikitext
8305 {{paramtest|
8306 param ={{ templateasargtest |
8307 templ = simple }}}}
8308 !! html
8309 <p>This is a test template with parameter (test)
8310 </p>
8311 !! end
8312
8313 !! test
8314 Template with thumb image (with link in description)
8315 !! wikitext
8316 {{paramtest|
8317 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8318 !! html
8319 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>
8320
8321 !! end
8322
8323 !! article
8324 Template:complextemplate
8325 !! text
8326 {{{1}}} {{paramtest|
8327 param ={{{param}}}}}
8328 !! endarticle
8329
8330 !! test
8331 Template with complex arguments
8332 !! wikitext
8333 {{complextemplate|
8334 param ={{ templateasargtest |
8335 templ = simple }}|[[Template:complextemplate|link]]}}
8336 !! html
8337 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8338 </p>
8339 !! end
8340
8341 !! test
8342 BUG 553: link with two variables in a piped link
8343 !! wikitext
8344 {|
8345 |[[{{{1}}}|{{{2}}}]]
8346 |}
8347 !! html
8348 <table>
8349 <tr>
8350 <td>[[{{{1}}}|{{{2}}}]]
8351 </td></tr></table>
8352
8353 !! end
8354
8355 !! test
8356 Magic variable as template parameter
8357 !! wikitext
8358 {{paramtest|param={{SITENAME}}}}
8359 !! html
8360 <p>This is a test template with parameter MediaWiki
8361 </p>
8362 !! end
8363
8364 !! article
8365 Template:linktest
8366 !! text
8367 [[{{{param}}}|link]]
8368 !! endarticle
8369
8370 !! test
8371 Template parameter as link source
8372 !! wikitext
8373 {{linktest|param=Main Page}}
8374 !! html
8375 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8376 </p>
8377 !! end
8378
8379 !!test
8380 Template-generated attribute string (k='v')
8381 !! wikitext
8382 <span {{attr_str|id|v1}}>bar</span>
8383 !! html
8384 <p><span id="v1">bar</span>
8385 </p>
8386 !!end
8387
8388 !!article
8389 Template:paramtest2
8390 !! text
8391 including another template, {{paramtest|param={{{arg}}}}}
8392 !! endarticle
8393
8394 !! test
8395 Template passing argument to another template
8396 !! wikitext
8397 {{paramtest2|arg='hmm'}}
8398 !! html
8399 <p>including another template, This is a test template with parameter 'hmm'
8400 </p>
8401 !! end
8402
8403 !! article
8404 Template:Linktest2
8405 !! text
8406 Main Page
8407 !! endarticle
8408
8409 !! test
8410 Template as link source
8411 !! wikitext
8412 [[{{linktest2}}]]
8413
8414 [[{{linktest2}}|Main Page]]
8415
8416 [[{{linktest2}}]]Page
8417 !! html
8418 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8419 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8420 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8421 </p>
8422 !! end
8423
8424
8425 !! article
8426 Template:loop1
8427 !! text
8428 {{loop2}}
8429 !! endarticle
8430
8431 !! article
8432 Template:loop2
8433 !! text
8434 {{loop1}}
8435 !! endarticle
8436
8437 !! test
8438 Template infinite loop
8439 !! wikitext
8440 {{loop1}}
8441 !! html
8442 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8443 </p>
8444 !! end
8445
8446 !! test
8447 Template from main namespace
8448 !! wikitext
8449 {{:Main Page}}
8450 !! html
8451 <p>blah blah
8452 </p>
8453 !! end
8454
8455 !! article
8456 Template:table
8457 !! text
8458 {|
8459 | 1 || 2
8460 |-
8461 | 3 || 4
8462 |}
8463 !! endarticle
8464
8465 !! test
8466 BUG 529: Template with table, not included at beginning of line
8467 !! wikitext
8468 foo {{table}}
8469 !! html
8470 <p>foo
8471 </p>
8472 <table>
8473 <tr>
8474 <td> 1 </td>
8475 <td> 2
8476 </td></tr>
8477 <tr>
8478 <td> 3 </td>
8479 <td> 4
8480 </td></tr></table>
8481
8482 !! end
8483
8484 !! test
8485 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8486 !! wikitext
8487 foo
8488 {{table}}
8489 !! html
8490 <p>foo
8491 </p>
8492 <table>
8493 <tr>
8494 <td> 1 </td>
8495 <td> 2
8496 </td></tr>
8497 <tr>
8498 <td> 3 </td>
8499 <td> 4
8500 </td></tr></table>
8501
8502 !! end
8503
8504 !! test
8505 BUG 41: Template parameters shown as broken links
8506 !! wikitext
8507 {{{parameter}}}
8508 !! html
8509 <p>{{{parameter}}}
8510 </p>
8511 !! end
8512
8513 !! test
8514 Template with targets containing wikilinks
8515 !! wikitext
8516 {{[[foo]]}}
8517
8518 {{[[{{echo|foo}}]]}}
8519
8520 {{{{echo|[[foo}}]]}}
8521 !! html
8522 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8523 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8524 </p><p>{{[[foo}}]]
8525 </p>
8526 !! end
8527
8528 !! article
8529 Template:MSGNW test
8530 !! text
8531 ''None'' of '''this''' should be
8532 * interpreted
8533 but rather passed unmodified
8534 {{test}}
8535 !! endarticle
8536
8537 # hmm, fix this or just deprecate msgnw and document its behavior?
8538 !! test
8539 msgnw keyword
8540 !! options
8541 disabled
8542 !! wikitext
8543 {{msgnw:MSGNW test}}
8544 !! html
8545 <p>''None'' of '''this''' should be
8546 * interpreted
8547 but rather passed unmodified
8548 {{test}}
8549 </p>
8550 !! end
8551
8552 !! test
8553 int keyword
8554 !! wikitext
8555 {{int:youhavenewmessages|lots of money|not!}}
8556 !! html
8557 <p>You have lots of money (not!).
8558 </p>
8559 !! end
8560
8561 !! article
8562 Template:Includes
8563 !! text
8564 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8565 !! endarticle
8566
8567 !! test
8568 <includeonly> and <noinclude> being included
8569 !! wikitext
8570 {{Includes}}
8571 !! html
8572 <p>Foobar
8573 </p>
8574 !! end
8575
8576 !! article
8577 Template:Includes2
8578 !! text
8579 <onlyinclude>Foo</onlyinclude>bar
8580 !! endarticle
8581
8582 !! test
8583 <onlyinclude> being included
8584 !! wikitext
8585 {{Includes2}}
8586 !! html
8587 <p>Foo
8588 </p>
8589 !! end
8590
8591
8592 !! article
8593 Template:Includes3
8594 !! text
8595 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8596 !! endarticle
8597
8598 !! test
8599 <onlyinclude> and <includeonly> being included
8600 !! wikitext
8601 {{Includes3}}
8602 !! html
8603 <p>Foo
8604 </p>
8605 !! end
8606
8607 !! test
8608 <includeonly> and <noinclude> on a page
8609 !! wikitext
8610 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8611 !! html
8612 <p>Foozar
8613 </p>
8614 !! end
8615
8616 !! test
8617 Un-closed <noinclude>
8618 !! wikitext
8619 <noinclude>
8620 !! html
8621 !! end
8622
8623 !! test
8624 <onlyinclude> on a page
8625 !! wikitext
8626 <onlyinclude>Foo</onlyinclude>bar
8627 !! html
8628 <p>Foobar
8629 </p>
8630 !! end
8631
8632 !! test
8633 Un-closed <onlyinclude>
8634 !! wikitext
8635 <onlyinclude>
8636 !! html
8637 !! end
8638
8639 !!test
8640 Self-closed noinclude, includeonly, onlyinclude tags
8641 !! wikitext
8642 <noinclude />
8643 <includeonly />
8644 <onlyinclude />
8645 !! html
8646 <p><br />
8647 </p>
8648 !!end
8649
8650 !!test
8651 Unbalanced includeonly and noinclude tags
8652 !! wikitext
8653 {|
8654 |a</noinclude>
8655 |b</noinclude></noinclude>
8656 |c</noinclude></includeonly>
8657 |d</includeonly></includeonly>
8658 |}
8659 !! html
8660 <table>
8661 <tr>
8662 <td>a
8663 </td>
8664 <td>b
8665 </td>
8666 <td>c&lt;/includeonly&gt;
8667 </td>
8668 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8669 </td></tr></table>
8670
8671 !!end
8672
8673 !! article
8674 Template:Includeonly section
8675 !! text
8676 <includeonly>
8677 ==Includeonly section==
8678 </includeonly>
8679 ==Section T-1==
8680 !!endarticle
8681
8682 !! test
8683 Bug 6563: Edit link generation for section shown by <includeonly>
8684 !! wikitext
8685 {{includeonly section}}
8686 !! html
8687 <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>
8688 <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>
8689
8690 !! end
8691
8692 # Uses same input as the contents of [[Template:Includeonly section]]
8693 !! test
8694 Bug 6563: Section extraction for section shown by <includeonly>
8695 !! options
8696 section=T-2
8697 !! wikitext
8698 <includeonly>
8699 ==Includeonly section==
8700 </includeonly>
8701 ==Section T-2==
8702 !! html
8703 ==Section T-2==
8704 !! end
8705
8706 !! test
8707 Bug 6563: Edit link generation for section suppressed by <includeonly>
8708 !! wikitext
8709 <includeonly>
8710 ==Includeonly section==
8711 </includeonly>
8712 ==Section 1==
8713 !! html
8714 <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>
8715
8716 !! end
8717
8718 !! test
8719 Bug 6563: Section extraction for section suppressed by <includeonly>
8720 !! options
8721 section=1
8722 !! wikitext
8723 <includeonly>
8724 ==Includeonly section==
8725 </includeonly>
8726 ==Section 1==
8727 !! html
8728 ==Section 1==
8729 !! end
8730
8731 !! test
8732 Un-closed <includeonly>
8733 !! wikitext
8734 <includeonly>
8735 !! html
8736 !! end
8737
8738 # TODO: test with DOM fragment reuse!
8739 !! test
8740 Parsoid: DOM fragment reuse
8741 !! options
8742 parsoid=wt2wt,wt2html
8743 !! wikitext
8744 a{{echo|b<table></table>c}}d
8745
8746 a{{echo|b
8747 <table></table>
8748 c}}d
8749
8750 {{echo|a
8751
8752 <table></table>
8753
8754 b}}
8755 !! html
8756 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8757 <table></table>c"}},"i":0}}]}'>b</span>
8758 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8759
8760
8761 <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">
8762 </span>
8763 <table about="#mwt2"></table><span about="#mwt2">
8764 </span>
8765 <p about="#mwt2">cd</p>
8766
8767
8768 <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">
8769
8770 </span>
8771 <table about="#mwt3"></table><span about="#mwt3">
8772
8773 </span>
8774 <p about="#mwt3">b</p>
8775 !! end
8776
8777 !! test
8778 Parsoid: Merge double tds (bug 50603)
8779 !! options
8780 parsoid
8781 !! wikitext
8782 {|
8783 |{{echo|{{!}} foo}}
8784 |}
8785 !! html
8786 <table><tbody>
8787 <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>
8788 </tbody></table>
8789 !! end
8790
8791 !! test
8792 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8793 !! options
8794 parsoid
8795 !! wikitext
8796 {{echo|<div>}}
8797 {|
8798 |{{echo|{{!}} foo}}
8799 |}
8800 {{echo|</div>}}
8801 !! html
8802 <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}}]}'>
8803 <table><tbody>
8804 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8805 </tbody></table>
8806 </div>
8807 !! end
8808
8809 ###
8810 ### <includeonly> and <noinclude> in attributes
8811 ###
8812 !!test
8813 0. includeonly around the entire attribute
8814 !! wikitext
8815 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8816 !! html
8817 <p><span id="v2">bar</span>
8818 </p>
8819 !!end
8820
8821 !!test
8822 1. includeonly in html attr key
8823 !! wikitext
8824 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8825 !! html
8826 <p><span id="foo">bar</span>
8827 </p>
8828 !!end
8829
8830 !!test
8831 2. includeonly in html attr value
8832 !! wikitext
8833 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8834 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8835 !! html
8836 <p><span id="v1">bar</span>
8837 <span id="v1">bar</span>
8838 </p>
8839 !!end
8840
8841 !!test
8842 3. includeonly in part of an attr value
8843 !! wikitext
8844 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8845 !! html
8846 <p><span style="color:red;">bar</span>
8847 </p>
8848 !!end
8849
8850 !!test
8851 4. includeonly in table attributes
8852 !! wikitext
8853 {|
8854 |- <noinclude>
8855 |-
8856 |a
8857 </noinclude>
8858 |- <includeonly>
8859 |-
8860 |b
8861 </includeonly>
8862 |}
8863 !! html
8864 <table>
8865
8866
8867 <tr>
8868 <td>a
8869 </td></tr>
8870 </table>
8871
8872 !!end
8873
8874 ###
8875 ### Testing parsing of templates where a template arg
8876 ### has the same name as the template itself.
8877 ###
8878
8879 !! article
8880 Template:quote
8881 !! text
8882 {{{quote|{{{1}}}}}}
8883 !! endarticle
8884
8885 !!test
8886 Templates: Template Name/Arg clash: 1. Use of positional param
8887 !! wikitext
8888 {{quote|foo}}
8889 !! html
8890 <p>foo
8891 </p>
8892 !!end
8893
8894 !!test
8895 Templates: Template Name/Arg clash: 2. Use of named param
8896 !! wikitext
8897 {{quote|quote=foo}}
8898 !! html
8899 <p>foo
8900 </p>
8901 !!end
8902
8903 !!test
8904 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8905 !! wikitext
8906 {{quote|quote}}
8907 !! html
8908 <p>quote
8909 </p>
8910 !!end
8911
8912 ###
8913 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8914 ###
8915
8916 !!test
8917 Templates: 1. Simple use
8918 !! wikitext
8919 {{echo|Foo}}
8920 !! html
8921 <p>Foo
8922 </p>
8923 !!end
8924
8925 !!test
8926 Templates: 2. Inside a block tag
8927 !! wikitext
8928 <div>{{echo|Foo}}</div>
8929 <blockquote>{{echo|Foo}}</blockquote>
8930 !! html
8931 <div>Foo</div>
8932 <blockquote>Foo</blockquote>
8933
8934 !!end
8935
8936 !!test
8937 Templates: P-wrapping: 1a. Templates on consecutive lines
8938 !! wikitext
8939 {{echo|Foo}}
8940 {{echo|bar}}
8941 !! html
8942 <p>Foo
8943 bar
8944 </p>
8945 !!end
8946
8947 !!test
8948 Templates: P-wrapping: 1b. Templates on consecutive lines
8949 !! wikitext
8950 Foo
8951
8952 {{echo|bar}}
8953 {{echo|baz}}
8954 !! html
8955 <p>Foo
8956 </p><p>bar
8957 baz
8958 </p>
8959 !!end
8960
8961 !!test
8962 Templates: P-wrapping: 1c. Templates on consecutive lines
8963 !! wikitext
8964 {{echo|Foo}}
8965 {{echo|bar}} <div>baz</div>
8966 !! html
8967 <p>Foo
8968 </p>
8969 bar <div>baz</div>
8970
8971 !!end
8972
8973 !!test
8974 Templates: P-wrapping: 1d. Template preceded by comment-only line
8975 !!options
8976 parsoid
8977 !! wikitext
8978 <!-- foo -->
8979 {{echo|Bar}}
8980 !! html
8981 <!-- foo -->
8982
8983 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8984 !!end
8985
8986 !!test
8987 Templates: Inline Text: 1. Multiple template uses
8988 !! wikitext
8989 {{echo|Foo}}bar{{echo|baz}}
8990 !! html
8991 <p>Foobarbaz
8992 </p>
8993 !!end
8994
8995 !!test
8996 Templates: Inline Text: 2. Back-to-back template uses
8997 !! wikitext
8998 {{echo|Foo}}{{echo|bar}}
8999 !! html
9000 <p>Foobar
9001 </p>
9002 !!end
9003
9004 !!test
9005 Templates: Block Tags: 1. Multiple template uses
9006 !! wikitext
9007 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9008 !! html
9009 <div>Foo</div><div>bar</div><div>baz</div>
9010
9011 !!end
9012
9013 !!test
9014 Templates: Block Tags: 2. Back-to-back template uses
9015 !! wikitext
9016 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9017 !! html
9018 <div>Foo</div><div>bar</div>
9019
9020 !!end
9021
9022 !!test
9023 Templates: Links: 1. Simple example
9024 !! wikitext
9025 {{echo|[[Foo|bar]]}}
9026 !! html
9027 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9028 </p>
9029 !!end
9030
9031 !!test
9032 Templates: Links: 2. Generation of link href
9033 !! wikitext
9034 [[{{echo|Foo}}|bar]]
9035 !! html
9036 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9037 </p>
9038 !!end
9039
9040 !!test
9041 Templates: Links: 3. Generation of part of a link href
9042 !! wikitext
9043 [[Fo{{echo|o}}|bar]]
9044
9045 [[Foo{{echo|bar}}]]
9046
9047 [[Foo{{echo|bar}}baz]]
9048
9049 [[Foo{{echo|bar}}|bar]]
9050
9051 [[:Foo{{echo|bar}}]]
9052
9053 [[:Foo{{echo|bar}}|bar]]
9054 !! html
9055 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9056 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9057 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9058 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9059 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9060 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9061 </p>
9062 !!end
9063
9064 !!test
9065 Templates: Links: 4. Multiple templates generating link href
9066 !! wikitext
9067 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9068 !! html
9069 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9070 </p>
9071 !!end
9072
9073 !!test
9074 Templates: Links: 5. Generation of link text
9075 !! wikitext
9076 [[Foo|{{echo|bar}}]]
9077 !! html
9078 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9079 </p>
9080 !!end
9081
9082 !!test
9083 Templates: Links: 5. Nested templates (only outermost template should be marked)
9084 !! wikitext
9085 {{echo|[[{{echo|Foo}}|bar]]}}
9086 !! html
9087 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9088 </p>
9089 !!end
9090
9091 !!test
9092 Templates: HTML Tag: 1. Generation of HTML attr. key
9093 !! wikitext
9094 <div {{echo|style}}="color:red;">foo</div>
9095 !! html
9096 <div style="color:red;">foo</div>
9097
9098 !!end
9099
9100 !!test
9101 Templates: HTML Tag: 2. Generation of HTML attr. value
9102 !! wikitext
9103 <div style={{echo|'color:red;'}}>foo</div>
9104 !! html
9105 <div style="color:red;">foo</div>
9106
9107 !!end
9108
9109 !!test
9110 Templates: HTML Tag: 3. Generation of HTML attr key and value
9111 !! wikitext
9112 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9113 !! html
9114 <div style="color:red;">foo</div>
9115
9116 !!end
9117
9118 !!test
9119 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9120 !! wikitext
9121 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9122 !! html
9123 <div title="This is a long title with just one piece templated">foo</div>
9124
9125 !!end
9126
9127 !!test
9128 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9129 !! wikitext
9130 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9131 !! html
9132 <div title="This is a long title with just one piece templated">foo</div>
9133
9134 !!end
9135
9136 !!test
9137 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9138 !! wikitext
9139 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9140 !! html
9141 <div title="This is a long title with just one piece templated">foo</div>
9142
9143 !!end
9144
9145 !!test
9146 Templates: HTML Tag: 7. Generation of partial attribute key string
9147 !! wikitext
9148 <div st{{echo|yle}}="color:red;">foo</div>
9149 !! html
9150 <div style="color:red;">foo</div>
9151
9152 !!end
9153
9154 !!test
9155 Templates: HTML Tables: 1. Generating start of a HTML table
9156 !! wikitext
9157 {{echo|<table><tr><td>foo</td>}}</tr></table>
9158 !! html
9159 <table><tr><td>foo</td></tr></table>
9160
9161 !!end
9162
9163 !!test
9164 Templates: HTML Tables: 2a. Generating middle of a HTML table
9165 !! wikitext
9166 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9167 !! html
9168 <table><tr><td>foo</td></tr></table>
9169
9170 !!end
9171
9172 !!test
9173 Templates: HTML Tables: 2b. Generating middle of a HTML table
9174 !! wikitext
9175 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9176 !! html
9177 <table><tr><td>foo</td></tr></table>
9178
9179 !!end
9180
9181 !!test
9182 Templates: HTML Tables: 3. Generating end of a HTML table
9183 !! wikitext
9184 <table><tr>{{echo|<td>foo</td></tr></table>}}
9185 !! html
9186 <table><tr><td>foo</td></tr></table>
9187
9188 !!end
9189
9190 !!test
9191 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9192 !! wikitext
9193 {{echo|<table>}}<tr><td>foo</td></tr></table>
9194 !! html
9195 <table><tr><td>foo</td></tr></table>
9196
9197 !!end
9198
9199 !!test
9200 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9201 !! wikitext
9202 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9203 !! html
9204 <table><tr><td>foo</td></tr></table>
9205
9206 !!end
9207
9208 !!test
9209 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9210 !! wikitext
9211 <table><tr>{{echo|<td>}}foo</td></tr></table>
9212 !! html
9213 <table><tr><td>foo</td></tr></table>
9214
9215 !!end
9216
9217 !!test
9218 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9219 !! wikitext
9220 <table><tr><td>foo{{echo|</td>}}</tr></table>
9221 !! html
9222 <table><tr><td>foo</td></tr></table>
9223
9224 !!end
9225
9226 !!test
9227 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9228 !! wikitext
9229 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9230 !! html
9231 <table><tr><td>foo</td></tr></table>
9232
9233 !!end
9234
9235 !!test
9236 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9237 !! wikitext
9238 <table><tr><td>foo</td></tr>{{echo|</table>}}
9239 !! html
9240 <table><tr><td>foo</td></tr></table>
9241
9242 !!end
9243
9244 !!test
9245 Templates: HTML Tables: 5. Proper fostering of categories from inside
9246 !!options
9247 parsoid=wt2html,wt2wt
9248 !! wikitext
9249 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9250 <!--Two categories (Bug 50330)-->
9251 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9252 !! html
9253 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9254 <!--Two categories (Bug 50330)-->
9255 <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>
9256 !!end
9257
9258 !!test
9259 Templates: Wiki Tables: 1a. Fostering of entire template content
9260 !! wikitext
9261 {|
9262 {{echo|a}}
9263 |}
9264 !! html
9265 <table>
9266 a
9267 <tr><td></td></tr></table>
9268
9269 !!end
9270
9271 !!test
9272 Templates: Wiki Tables: 1b. Fostering of entire template content
9273 !! wikitext
9274 {|
9275 {{echo|<div>}}
9276 foo
9277 {{echo|</div>}}
9278 |}
9279 !! html
9280 <table>
9281 <div>
9282 <p>foo
9283 </p>
9284 </div>
9285 <tr><td></td></tr></table>
9286
9287 !!end
9288
9289 !!test
9290 Templates: Wiki Tables: 2. Fostering of partial template content
9291 !! wikitext
9292 {|
9293 {{echo|a
9294 <div>b</div>}}
9295 |}
9296 !! html
9297 <table>
9298 a
9299 <div>b</div>
9300 <tr><td></td></tr></table>
9301
9302 !!end
9303
9304 !!test
9305 Templates: Wiki Tables: 3. td-content via multiple templates
9306 !! wikitext
9307 {|
9308 {{echo|{{pipe}}a}}{{echo|b}}
9309 |}
9310 !! html
9311 <table>
9312 <tr>
9313 <td>ab
9314 </td></tr></table>
9315
9316 !!end
9317
9318 !!test
9319 Templates: Wiki Tables: 4. Templated tags, no content
9320 !! wikitext
9321 {{tbl-start}}
9322 {{tbl-end}}
9323 !! html
9324 <table>
9325 <tr><td></td></tr></table>
9326
9327 !!end
9328
9329 !!test
9330 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9331 !! wikitext
9332 {{tbl-start}}
9333 |foo
9334 {{tbl-end}}
9335 !! html
9336 <table>
9337 <tr>
9338 <td>foo
9339 </td></tr></table>
9340
9341 !!end
9342
9343 !!test
9344 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9345 !! wikitext
9346 {{tbl-start}}
9347 {{!}}foo
9348 {{tbl-end}}
9349 !! html
9350 <table>
9351 <tr>
9352 <td>foo
9353 </td></tr></table>
9354
9355 !!end
9356
9357 !!test
9358 Templates: Lists: Multi-line list-items via templates
9359 !! wikitext
9360 *{{echo|a {{nonexistent|
9361 unused}}}}
9362 *{{echo|b {{nonexistent|
9363 unused}}}}
9364 !! html
9365 <ul>
9366 <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>
9367 </li>
9368 <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>
9369 </li>
9370 </ul>
9371
9372 !!end
9373
9374 !!test
9375 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9376 !! wikitext
9377 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9378 !! html
9379 <p><i>ab</i>c<i>d</i>e
9380 </p>
9381 !!end
9382
9383 !!test
9384 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9385 (PHP parser generates misnested html)
9386 !! wikitext
9387 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9388 !! html/parsoid
9389 <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>
9390 !!end
9391
9392 !!test
9393 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9394 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9395 !! options
9396 parsoid=wt2html,wt2wt
9397 !! wikitext
9398 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9399 !! html
9400 <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>
9401 <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>
9402 <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>
9403 !!end
9404
9405 !!test
9406 Templates: Ugly nesting: 4. Divs opened/closed across templates
9407 !! wikitext
9408 a<div>b{{echo|c</div>d}}e
9409 !! html
9410 a<div>bc</div>de
9411
9412 !!end
9413
9414 !!test
9415 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9416 (Parsoid-centric)
9417 !! options
9418 parsoid
9419 !! wikitext
9420 {|
9421 |{{echo|foo</table>}}
9422 |bar
9423 |}
9424 !! html
9425 <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|}"]}'>
9426
9427 <tbody>
9428 <tr>
9429 <td>foo</td></tr></tbody></table><span about="#mwt1">
9430 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9431 |}</span>
9432 !!end
9433
9434 !!test
9435 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9436 (Parsoid-centric)
9437 !! options
9438 parsoid
9439 !! wikitext
9440 <table>
9441 <tr>
9442 <td>
9443 <table>
9444 <tr>
9445 <td>1. {{echo|foo </table>}}</td>
9446 <td> bar </td>
9447 <td>2. {{echo|baz </table>}}</td>
9448 </tr>
9449 <tr>
9450 <td>abc</td>
9451 </tr>
9452 </table>
9453 </td>
9454 </tr>
9455 <tr>
9456 <td>xyz</td>
9457 </tr>
9458 </table>
9459 !! html
9460 <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>"]}'>
9461 <tbody><tr>
9462 <td>
9463 <table>
9464 <tbody><tr>
9465 <td>1. foo </td></tr></tbody></table></td>
9466 <td> bar </td>
9467 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9468 </span><span about="#mwt2">
9469 </span><span about="#mwt2">
9470 </span><span about="#mwt2">abc</span><span about="#mwt2">
9471 </span><span about="#mwt2">
9472 </span><span about="#mwt2">
9473 </span><span about="#mwt2">
9474 </span><span about="#mwt2">
9475 </span><span about="#mwt2">
9476 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9477 </span><span about="#mwt2">
9478 </span>
9479 !!end
9480
9481 !! test
9482 Templates: Ugly templates: 3. newline-only template parameter
9483 !! wikitext
9484 foo {{echo|
9485 }}
9486 !! html
9487 <p>foo
9488 </p>
9489 !! end
9490
9491 # This looks like a bug: a single newline triggers p/br for some reason.
9492 !! test
9493 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9494 !! wikitext
9495 {{echo|
9496 }}
9497 !! html
9498 <p><br />
9499 </p>
9500 !! end
9501
9502 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9503 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9504 !! test
9505 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9506 !! wikitext
9507 {{echo|<table>}}
9508 {{echo|<div>foo}}
9509 {{echo|</table>}}
9510 !! html/parsoid
9511 <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
9512 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9513 </table>
9514 !! end
9515
9516 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9517 # that are "identical" and generate nesting cycles in the algorithm
9518 !! test
9519 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9520 !! wikitext
9521 {{echo|<table><tr><td><table>}}
9522 {{echo|<div>}}
9523 {{echo|</div>}}
9524 !! html/parsoid
9525 <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"}'>
9526 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9527 </table></td></tr></tbody></table>
9528 !! end
9529
9530 !!test
9531 Parser Functions: 1. Simple example
9532 !! wikitext
9533 {{uc:foo}}
9534 !! html
9535 <p>FOO
9536 </p>
9537 !!end
9538
9539 !!test
9540 Parser Functions: 2. Nested use (only outermost should be marked up)
9541 !! wikitext
9542 {{uc:{{lc:FOO}}}}
9543 !! html
9544 <p>FOO
9545 </p>
9546 !!end
9547
9548 ###
9549 ### Pre-save transform tests
9550 ###
9551 !! test
9552 pre-save transform: subst:
9553 !! options
9554 PST
9555 !! wikitext
9556 {{subst:test}}
9557 !! html
9558 This is a test template
9559 !! end
9560
9561 !! test
9562 pre-save transform: normal template
9563 !! options
9564 PST
9565 !! wikitext
9566 {{test}}
9567 !! html
9568 {{test}}
9569 !! end
9570
9571 !! test
9572 pre-save transform: nonexistent template
9573 !! options
9574 PST
9575 !! wikitext
9576 {{thistemplatedoesnotexist}}
9577 !! html
9578 {{thistemplatedoesnotexist}}
9579 !! end
9580
9581
9582 !! test
9583 pre-save transform: subst magic variables
9584 !! options
9585 PST
9586 !! wikitext
9587 {{subst:SITENAME}}
9588 !! html
9589 MediaWiki
9590 !! end
9591
9592 # This is bug 89, which I fixed. -- wtm
9593 !! test
9594 pre-save transform: subst: templates with parameters
9595 !! options
9596 pst
9597 !! wikitext
9598 {{subst:paramtest|param="something else"}}
9599 !! html
9600 This is a test template with parameter "something else"
9601 !! end
9602
9603 !! article
9604 Template:nowikitest
9605 !! text
9606 <nowiki>'''not wiki'''</nowiki>
9607 !! endarticle
9608
9609 !! test
9610 pre-save transform: nowiki in subst (bug 1188)
9611 !! options
9612 pst
9613 !! wikitext
9614 {{subst:nowikitest}}
9615 !! html
9616 <nowiki>'''not wiki'''</nowiki>
9617 !! end
9618
9619
9620 !! article
9621 Template:commenttest
9622 !! text
9623 This template has <!-- a comment --> in it.
9624 !! endarticle
9625
9626 !! test
9627 pre-save transform: comment in subst (bug 1936)
9628 !! options
9629 pst
9630 !! wikitext
9631 {{subst:commenttest}}
9632 !! html
9633 This template has <!-- a comment --> in it.
9634 !! end
9635
9636 !! test
9637 pre-save transform: unclosed tag
9638 !! options
9639 pst noxml
9640 !! wikitext
9641 <nowiki>'''not wiki'''
9642 !! html
9643 <nowiki>'''not wiki'''
9644 !! end
9645
9646 !! test
9647 pre-save transform: mixed tag case
9648 !! options
9649 pst noxml
9650 !! wikitext
9651 <NOwiki>'''not wiki'''</noWIKI>
9652 !! html
9653 <NOwiki>'''not wiki'''</noWIKI>
9654 !! end
9655
9656 !! test
9657 pre-save transform: unclosed comment in <nowiki>
9658 !! options
9659 pst noxml
9660 !! wikitext
9661 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9662 !! html
9663 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9664 !!end
9665
9666 # Leading @ in this template definition works around a limitation
9667 # in parsoid's parserTests which otherwise strips the <span> from the
9668 # result (confusing it for a template wrapper)
9669 !! article
9670 Template:dangerous
9671 !!text
9672 @<span onmouseover="alert('crap')">Oh no</span>
9673 !!endarticle
9674
9675 !!test
9676 (confirming safety of fix for subst bug 1936)
9677 !! wikitext
9678 {{Template:dangerous}}
9679 !! html
9680 <p>@<span>Oh no</span>
9681 </p>
9682 !! end
9683
9684 !! test
9685 pre-save transform: comment containing gallery (bug 5024)
9686 !! options
9687 pst
9688 !! wikitext
9689 <!-- <gallery>data</gallery> -->
9690 !! html
9691 <!-- <gallery>data</gallery> -->
9692 !!end
9693
9694 !! test
9695 pre-save transform: comment containing extension
9696 !! options
9697 pst
9698 !! wikitext
9699 <!-- <tag>data</tag> -->
9700 !! html
9701 <!-- <tag>data</tag> -->
9702 !!end
9703
9704 !! test
9705 pre-save transform: comment containing nowiki
9706 !! options
9707 pst
9708 !! wikitext
9709 <!-- <nowiki>data</nowiki> -->
9710 !! html
9711 <!-- <nowiki>data</nowiki> -->
9712 !!end
9713
9714 !! test
9715 pre-save transform: <noinclude> in subst (bug 3298)
9716 !! options
9717 pst
9718 !! wikitext
9719 {{subst:Includes}}
9720 !! html
9721 Foobar
9722 !! end
9723
9724 !! test
9725 pre-save transform: <onlyinclude> in subst (bug 3298)
9726 !! options
9727 pst
9728 !! wikitext
9729 {{subst:Includes2}}
9730 !! html
9731 Foo
9732 !! end
9733
9734 !! article
9735 Template:SubstTest
9736 !!text
9737 {{<includeonly>subst:</includeonly>Includes}}
9738 !! endarticle
9739
9740 !! article
9741 Template:SafeSubstTest
9742 !! text
9743 {{<includeonly>safesubst:</includeonly>Includes}}
9744 !! endarticle
9745
9746 !! test
9747 bug 22297: safesubst: works during PST
9748 !! options
9749 pst
9750 !! wikitext
9751 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9752 !! html
9753 FoobarFoobar
9754 !! end
9755
9756 !! test
9757 bug 22297: safesubst: works during normal parse
9758 !! wikitext
9759 {{SafeSubstTest}}
9760 !! html
9761 <p>Foobar
9762 </p>
9763 !! end
9764
9765 !! test
9766 subst: does not work during normal parse
9767 !! wikitext
9768 {{SubstTest}}
9769 !! html
9770 <p>{{subst:Includes}}
9771 </p>
9772 !! end
9773
9774 !! test
9775 pre-save transform: context links ("pipe trick")
9776 !! options
9777 pst
9778 !! wikitext
9779 [[Article (context)|]]
9780 [[Bar:Article|]]
9781 [[:Bar:Article|]]
9782 [[Bar:Article (context)|]]
9783 [[:Bar:Article (context)|]]
9784 [[|Article]]
9785 [[|Article (context)]]
9786 [[Bar:X (Y) Z|]]
9787 [[:Bar:X (Y) Z|]]
9788 !! html
9789 [[Article (context)|Article]]
9790 [[Bar:Article|Article]]
9791 [[:Bar:Article|Article]]
9792 [[Bar:Article (context)|Article]]
9793 [[:Bar:Article (context)|Article]]
9794 [[Article]]
9795 [[Article (context)]]
9796 [[Bar:X (Y) Z|X (Y) Z]]
9797 [[:Bar:X (Y) Z|X (Y) Z]]
9798 !! end
9799
9800 !! test
9801 pre-save transform: context links ("pipe trick") with interwiki prefix
9802 !! options
9803 pst
9804 !! wikitext
9805 [[interwiki:Article|]]
9806 [[:interwiki:Article|]]
9807 [[interwiki:Bar:Article|]]
9808 [[:interwiki:Bar:Article|]]
9809 !! html
9810 [[interwiki:Article|Article]]
9811 [[:interwiki:Article|Article]]
9812 [[interwiki:Bar:Article|Bar:Article]]
9813 [[:interwiki:Bar:Article|Bar:Article]]
9814 !! end
9815
9816 !! test
9817 pre-save transform: context links ("pipe trick") with parens in title
9818 !! options
9819 pst title=[[Somearticle (context)]]
9820 !! wikitext
9821 [[|Article]]
9822 !! html
9823 [[Article (context)|Article]]
9824 !! end
9825
9826 !! test
9827 pre-save transform: context links ("pipe trick") with comma in title
9828 !! options
9829 pst title=[[Someplace, Somewhere]]
9830 !! wikitext
9831 [[|Otherplace]]
9832 [[Otherplace, Elsewhere|]]
9833 [[Otherplace, Elsewhere, Anywhere|]]
9834 !! html
9835 [[Otherplace, Somewhere|Otherplace]]
9836 [[Otherplace, Elsewhere|Otherplace]]
9837 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9838 !! end
9839
9840 !! test
9841 pre-save transform: context links ("pipe trick") with parens and comma
9842 !! options
9843 pst title=[[Someplace (IGNORED), Somewhere]]
9844 !! wikitext
9845 [[|Otherplace]]
9846 [[Otherplace (place), Elsewhere|]]
9847 !! html
9848 [[Otherplace, Somewhere|Otherplace]]
9849 [[Otherplace (place), Elsewhere|Otherplace]]
9850 !! end
9851
9852 !! test
9853 pre-save transform: context links ("pipe trick") with comma and parens
9854 !! options
9855 pst title=[[Who, me? (context)]]
9856 !! wikitext
9857 [[|Yes, you.]]
9858 [[Me, Myself, and I (1937 song)|]]
9859 !! html
9860 [[Yes, you. (context)|Yes, you.]]
9861 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9862 !! end
9863
9864 !! test
9865 pre-save transform: context links ("pipe trick") with namespace
9866 !! options
9867 pst title=[[Ns:Somearticle]]
9868 !! wikitext
9869 [[|Article]]
9870 !! html
9871 [[Ns:Article|Article]]
9872 !! end
9873
9874 !! test
9875 pre-save transform: context links ("pipe trick") with namespace and parens
9876 !! options
9877 pst title=[[Ns:Somearticle (context)]]
9878 !! wikitext
9879 [[|Article]]
9880 !! html
9881 [[Ns:Article (context)|Article]]
9882 !! end
9883
9884 !! test
9885 pre-save transform: context links ("pipe trick") with namespace and comma
9886 !! options
9887 pst title=[[Ns:Somearticle, Context, Whatever]]
9888 !! wikitext
9889 [[|Article]]
9890 !! html
9891 [[Ns:Article, Context, Whatever|Article]]
9892 !! end
9893
9894 !! test
9895 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9896 !! options
9897 pst title=[[Ns:Somearticle, Context (context)]]
9898 !! wikitext
9899 [[|Article]]
9900 !! html
9901 [[Ns:Article (context)|Article]]
9902 !! end
9903
9904 !! test
9905 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9906 !! options
9907 pst title=[[Ns:Somearticle (IGNORED), Context]]
9908 !! wikitext
9909 [[|Article]]
9910 !! html
9911 [[Ns:Article, Context|Article]]
9912 !! end
9913
9914 !! test
9915 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9916 !! options
9917 pst
9918 !! wikitext
9919 [[Article(context)|]]
9920 [[Bar:Article(context)|]]
9921 [[:Bar:Article(context)|]]
9922 [[|Article(context)]]
9923 [[Bar:X(Y)Z|]]
9924 [[:Bar:X(Y)Z|]]
9925 !! html
9926 [[Article(context)|Article]]
9927 [[Bar:Article(context)|Article]]
9928 [[:Bar:Article(context)|Article]]
9929 [[Article(context)]]
9930 [[Bar:X(Y)Z|X(Y)Z]]
9931 [[:Bar:X(Y)Z|X(Y)Z]]
9932 !! end
9933
9934 !! test
9935 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9936 !! options
9937 pst
9938 !! wikitext
9939 [[Article (context)|]]
9940 [[Bar:Article (context)|]]
9941 [[:Bar:Article (context)|]]
9942 [[|Article (context)]]
9943 [[Bar:X (Y) Z|]]
9944 [[:Bar:X (Y) Z|]]
9945 !! html
9946 [[Article (context)|Article]]
9947 [[Bar:Article (context)|Article]]
9948 [[:Bar:Article (context)|Article]]
9949 [[Article (context)]]
9950 [[Bar:X (Y) Z|X (Y) Z]]
9951 [[:Bar:X (Y) Z|X (Y) Z]]
9952 !! end
9953
9954 !! test
9955 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9956 !! options
9957 pst
9958 !! wikitext
9959 [[Article(context)|]]
9960 [[Bar:Article(context)|]]
9961 [[:Bar:Article(context)|]]
9962 [[|Article(context)]]
9963 [[Bar:X(Y)Z|]]
9964 [[:Bar:X(Y)Z|]]
9965 !! html
9966 [[Article(context)|Article]]
9967 [[Bar:Article(context)|Article]]
9968 [[:Bar:Article(context)|Article]]
9969 [[Article(context)]]
9970 [[Bar:X(Y)Z|X(Y)Z]]
9971 [[:Bar:X(Y)Z|X(Y)Z]]
9972 !! end
9973
9974 !! test
9975 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9976 !! options
9977 pst
9978 !! wikitext
9979 [[Article (context), context|]]
9980 [[Article (context),context|]]
9981 [[Bar:Article (context), context|]]
9982 [[Bar:Article (context),context|]]
9983 [[:Bar:Article (context), context|]]
9984 [[:Bar:Article (context),context|]]
9985 !! html
9986 [[Article (context), context|Article]]
9987 [[Article (context),context|Article]]
9988 [[Bar:Article (context), context|Article]]
9989 [[Bar:Article (context),context|Article]]
9990 [[:Bar:Article (context), context|Article]]
9991 [[:Bar:Article (context),context|Article]]
9992 !! end
9993
9994 !! test
9995 pre-save transform: trim trailing empty lines
9996 !! options
9997 pst
9998 !! wikitext
9999 Empty lines are trimmed
10000
10001
10002
10003
10004 !! html
10005 Empty lines are trimmed
10006 !! end
10007
10008 !! test
10009 pre-save transform: Signature expansion
10010 !! options
10011 pst
10012 !! wikitext
10013 * ~~~
10014 * <noinclude>~~~</noinclude>
10015 * <includeonly>~~~</includeonly>
10016 * <onlyinclude>~~~</onlyinclude>
10017 !! html
10018 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10019 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10020 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10021 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10022 !! end
10023
10024
10025 !! test
10026 pre-save transform: Signature expansion in nowiki tags (bug 93)
10027 !! options
10028 pst disabled
10029 !! wikitext
10030 Shall not expand:
10031
10032 <nowiki>~~~~</nowiki>
10033
10034 <includeonly><nowiki>~~~~</nowiki></includeonly>
10035
10036 <noinclude><nowiki>~~~~</nowiki></noinclude>
10037
10038 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10039
10040 {{subst:Foo}} shall be converted to FOO
10041
10042 As well as inside noinclude/onlyinclude
10043 <noinclude>{{subst:Foo}}</noinclude>
10044 <onlyinclude>{{subst:Foo}}</onlyinclude>
10045
10046 But not inside includeonly
10047 <includeonly>{{subst:Foo}}</includeonly>
10048 !! html
10049 Shall not expand:
10050
10051 <nowiki>~~~~</nowiki>
10052
10053 <includeonly><nowiki>~~~~</nowiki></includeonly>
10054
10055 <noinclude><nowiki>~~~~</nowiki></noinclude>
10056
10057 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10058
10059 FOO shall be converted to FOO
10060
10061 As well as inside noinclude/onlyinclude
10062 <noinclude>FOO</noinclude>
10063 <onlyinclude>FOO</onlyinclude>
10064
10065 But not inside includeonly
10066 <includeonly>{{subst:Foo}}</includeonly>
10067 !! end
10068
10069 !! test
10070 Parsoid: Recognize nowiki with trailing space in tags
10071 !! options
10072 parsoid=wt2html
10073 !! wikitext
10074 <nowiki ><div>[[foo]]</nowiki >
10075
10076 a<nowiki / >b
10077
10078 c<nowiki />d
10079
10080 e<nowiki/ >f
10081 !! html
10082 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10083 <p>ab</p>
10084 <p>cd</p>
10085 <p>ef</p>
10086 !! end
10087
10088 !! test
10089 Parsoid: Recognize nowiki with odd capitalization
10090 !! options
10091 parsoid=wt2html
10092 !! wikitext
10093 <noWikI ><div>[[foo]]</Nowiki >
10094 !! html
10095 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10096 !! end
10097
10098
10099 !! test
10100 Parsoid: Escape nowiki with trailing space in tags
10101 !! options
10102 parsoid=html2wt
10103 !! wikitext
10104 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10105
10106 a&lt;nowiki /&gt;b
10107
10108 c&lt;nowiki/ &gt;d
10109 !! html
10110 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10111 <p>a&lt;nowiki /&gt;b</p>
10112 <p>c&lt;nowiki/ &gt;d</p>
10113 !! end
10114
10115 !! test
10116 Parsoid: Escape weird noWikI capitalizations
10117 !! options
10118 parsoid=html2wt
10119 !! wikitext
10120 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10121 !! html
10122 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10123 !! end
10124
10125 ###
10126 ### Message transform tests
10127 ###
10128 !! test
10129 message transform: magic variables
10130 !! options
10131 msg
10132 !! wikitext
10133 {{SITENAME}}
10134 !! html
10135 MediaWiki
10136 !! end
10137
10138 !! test
10139 message transform: should not transform wiki markup
10140 !! options
10141 msg
10142 !! wikitext
10143 ''test''
10144 !! html
10145 ''test''
10146 !! end
10147
10148 !! test
10149 message transform: <noinclude> in transcluded template (bug 4926)
10150 !! options
10151 msg
10152 !! wikitext
10153 {{Includes}}
10154 !! html
10155 Foobar
10156 !! end
10157
10158 !! test
10159 message transform: <onlyinclude> in transcluded template (bug 4926)
10160 !! options
10161 msg
10162 !! wikitext
10163 {{Includes2}}
10164 !! html
10165 Foo
10166 !! end
10167
10168 !! test
10169 {{#special:}} page name, known
10170 !! options
10171 msg
10172 !! wikitext
10173 {{#special:Recentchanges}}
10174 !! html
10175 Special:RecentChanges
10176 !! end
10177
10178 !! test
10179 {{#special:}} page name with subpage, known
10180 !! options
10181 msg
10182 !! wikitext
10183 {{#special:Recentchanges/param}}
10184 !! html
10185 Special:RecentChanges/param
10186 !! end
10187
10188 !! test
10189 {{#special:}} page name, unknown
10190 !! options
10191 msg
10192 !! wikitext
10193 {{#special:foobar nonexistent}}
10194 !! html
10195 Special:Foobar nonexistent
10196 !! end
10197
10198 !! test
10199 {{#speciale:}} page name, known
10200 !! options
10201 msg
10202 !! wikitext
10203 {{#speciale:Recentchanges}}
10204 !! html
10205 Special:RecentChanges
10206 !! end
10207
10208 !! test
10209 {{#speciale:}} page name with subpage, known
10210 !! options
10211 msg
10212 !! wikitext
10213 {{#speciale:Recentchanges/param}}
10214 !! html
10215 Special:RecentChanges/param
10216 !! end
10217
10218 !! test
10219 {{#speciale:}} page name, unknown
10220 !! options
10221 msg
10222 !! wikitext
10223 {{#speciale:foobar nonexistent}}
10224 !! html
10225 Special:Foobar_nonexistent
10226 !! end
10227
10228 ###
10229 ### Images
10230 ###
10231 ### For Parsoid-specific tests, see
10232 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10233
10234 !! test
10235 Simple image
10236 !! options
10237 parsoid=wt2html,wt2wt,html2html
10238 !! wikitext
10239 [[Image:foobar.jpg]]
10240 !! html/php
10241 <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>
10242 </p>
10243 !! html/parsoid
10244 <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>
10245 </p>
10246 !! end
10247
10248 !! test
10249 Simple image (using File: namespace, now canonical)
10250 !! wikitext
10251 [[File:Foobar.jpg]]
10252 !! html/php
10253 <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>
10254 </p>
10255 !! html/parsoid
10256 <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>
10257 </p>
10258 !! end
10259
10260 !! test
10261 Right-aligned image
10262 !! wikitext
10263 [[File:Foobar.jpg|right]]
10264 !! html/php
10265 <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>
10266
10267 !! html/parsoid
10268 <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>
10269 !! end
10270
10271 !! test
10272 Image with caption
10273 !! wikitext
10274 [[File:Foobar.jpg|right|Caption text]]
10275 !! html/php
10276 <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>
10277
10278 !! html/parsoid
10279 <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>
10280 !! end
10281
10282 !! test
10283 Image with caption, bug 53312 #1
10284 !! wikitext
10285 [[File:Foobar.jpg|right|Caption page stuff]]
10286 !! html/php
10287 <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>
10288
10289 !! html/parsoid
10290 <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>
10291 !! end
10292
10293 !! test
10294 Image with caption, bug 53312 #2
10295 !! wikitext
10296 [[File:Foobar.jpg|right|Caption page=]]
10297 !! html/php
10298 <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>
10299
10300 !! html/parsoid
10301 <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>
10302 !! end
10303
10304 !! test
10305 Image with caption, bug 53312 #3
10306 !! wikitext
10307 [[File:Foobar.jpg|right|Caption page=stuff]]
10308 !! html/php
10309 <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>
10310
10311 !! html/parsoid
10312 <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>
10313 !! end
10314
10315 !! test
10316 Allow empty links in image captions (Bug 60753)
10317 !! options
10318 thumbsize=220
10319 !! wikitext
10320 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10321 [[]]
10322 [[Link2]]
10323 ]]
10324 !! html/php
10325 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10326
10327 !! html/parsoid
10328 <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" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
10329 [[]]
10330 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10331 </figcaption></figure>
10332 !! end
10333
10334 !! test
10335 Link with empty target
10336 !! wikitext
10337 [[]]
10338 !! html
10339 <p>[[]]
10340 </p>
10341 !! end
10342
10343 !! test
10344 Image with empty attribute
10345 !! options
10346 parsoid=wt2html,wt2wt,html2html
10347 !! wikitext
10348 [[File:Foobar.jpg|right||Caption text]]
10349 !! html/php
10350 <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>
10351
10352 !! html/parsoid
10353 <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>
10354 !! end
10355
10356 !! test
10357 1. Block image with individual attributes from templates
10358 !! wikitext
10359 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10360 !! html/php
10361 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
10362
10363 !! html/parsoid
10364 <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;dsr&amp;quot;:[24,38,null,null],&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;]}]]}\">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>
10365 !! end
10366
10367 !! test
10368 2. Block Image with individual attributes from templates
10369 !! wikitext
10370 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10371 !! html/php
10372 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
10373
10374 !! html/parsoid
10375 <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;dsr&amp;quot;:[18,32,null,null],&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;]}]]}\">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;dsr&amp;quot;:[33,47,null,null],&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;]}]]}\">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>
10376 !! end
10377
10378 !! test
10379 3. Inline image with individual attributes from templates
10380 !! wikitext
10381 [[File:Foobar.jpg|{{echo|50px}}]]
10382 !! html/php
10383 <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>
10384 </p>
10385 !! html/parsoid
10386 <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;dsr&amp;quot;:[18,31,null,null],&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;]}]]}\">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>
10387 !! end
10388
10389 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10390 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10391 !! test
10392 Image with multiple attributes from the same template
10393 !! wikitext
10394 [[File:Foobar.jpg|{{image_attribs}}]]
10395 !! html/php
10396 <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>
10397
10398 !! html/parsoid
10399 <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>
10400 !! end
10401
10402 !! test
10403 Image with link tails
10404 !! options
10405 thumbsize=220
10406 !! wikitext
10407 123[[File:Foobar.jpg]]456
10408 123[[File:Foobar.jpg|right]]456
10409 123[[File:Foobar.jpg|thumb]]456
10410 !! html/php
10411 <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
10412 </p>
10413 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
10414 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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
10415
10416 !! html/parsoid
10417 <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>
10418 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
10419 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
10420 !! end
10421
10422 !! test
10423 Image with multiple captions -- only last one is accepted
10424 !! wikitext
10425 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10426 !! html/php
10427 <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>
10428
10429 !! html/parsoid
10430 <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>
10431 !! end
10432
10433 !! test
10434 Image with multiple widths -- use last
10435 !! wikitext
10436 [[File:Foobar.jpg|200px|300px|caption]]
10437 !! html/php
10438 <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>
10439 </p>
10440 !! html/parsoid
10441 <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>
10442 !! end
10443
10444 !! test
10445 Image with multiple alignments -- use first (bug 48664)
10446 !! options
10447 thumbsize=220
10448 !! wikitext
10449 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10450
10451 [[File:Foobar.jpg|middle|text-top|caption]]
10452 !! html/php
10453 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10454 <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>
10455 </p>
10456 !! html/parsoid
10457 <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>
10458 <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>
10459 !! end
10460
10461 !! test
10462 Image with width attribute at different positions
10463 !! wikitext
10464 [[File:Foobar.jpg|200px|right|Caption]]
10465 [[File:Foobar.jpg|right|200px|Caption]]
10466 [[File:Foobar.jpg|right|Caption|200px]]
10467 !! html/php
10468 <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>
10469 <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>
10470 <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>
10471
10472 !! html/parsoid
10473 <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>
10474 <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>
10475 <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>
10476 !! end
10477
10478 # a sad bit of backward-compatibility
10479 !! test
10480 Image with size specified with pxpx (bug 13500, 51628)
10481 !! options
10482 parsoid=wt2html,wt2wt,html2html
10483 !! wikitext
10484 [[File:Foobar.jpg|20pxpx]]
10485 [[File:Foobar.jpg|200x20pxpx]]
10486 !! html/php
10487 <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>
10488 <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>
10489 </p>
10490 !! html/parsoid
10491 <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>
10492 !! end
10493
10494 !! test
10495 Image with link parameter, wiki target
10496 !! wikitext
10497 [[File:Foobar.jpg|link=Main Page]]
10498 !! html/php
10499 <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>
10500 </p>
10501 !! html/parsoid
10502 <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>
10503 !! end
10504
10505 # parsoid bug 49293 (part 1)
10506 !! test
10507 Image with link parameter, URL target
10508 !! wikitext
10509 [[File:Foobar.jpg|link=http://example.com/]]
10510 !! html/php
10511 <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>
10512 </p>
10513 !! html/parsoid
10514 <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>
10515 !! end
10516
10517 # parsoid bug 49293 (part 2)
10518 !! test
10519 Image with link parameter, protocol-less URL target
10520 !! wikitext
10521 [[File:Foobar.jpg|link=//example.com/]]
10522 !! html/php
10523 <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>
10524 </p>
10525 !! html/parsoid
10526 <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>
10527 !! end
10528
10529 !! test
10530 Image with link parameter, wgExternalLinkTarget
10531 !! wikitext
10532 [[Image:foobar.jpg|link=http://example.com/]]
10533 !! config
10534 wgExternalLinkTarget='foobar'
10535 !! html
10536 <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>
10537 </p>
10538 !! end
10539
10540 !! test
10541 Image with link parameter, wgNoFollowLinks set to false
10542 !! wikitext
10543 [[Image:foobar.jpg|link=http://example.com/]]
10544 !! config
10545 wgNoFollowLinks=false
10546 !! html
10547 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10548 </p>
10549 !! end
10550
10551 !! test
10552 Image with link parameter, wgNoFollowDomainExceptions
10553 !! wikitext
10554 [[Image:foobar.jpg|link=http://example.com/]]
10555 !! config
10556 wgNoFollowDomainExceptions='example.com'
10557 !! html
10558 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10559 </p>
10560 !! end
10561
10562 !! test
10563 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10564 !! wikitext
10565 [[Image:foobar.jpg|link=http://example.com/|Title]]
10566 !! config
10567 wgExternalLinkTarget='foobar'
10568 !! html
10569 <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>
10570 </p>
10571 !! end
10572
10573 !! test
10574 Image with empty link parameter
10575 !! wikitext
10576 [[File:Foobar.jpg|link=]]
10577 !! html/php
10578 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10579 </p>
10580 !! html/parsoid
10581 <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>
10582 !! end
10583
10584 !! test
10585 Image with link parameter (wiki target) and unnamed parameter
10586 !! wikitext
10587 [[File:Foobar.jpg|link=Main_Page|Title]]
10588 !! html/php
10589 <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>
10590 </p>
10591 !! html/parsoid
10592 <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>
10593 !! end
10594
10595 !! test
10596 Image with link parameter (URL target) and unnamed parameter
10597 !! wikitext
10598 [[File:Foobar.jpg|link=http://example.com/|Title]]
10599 !! html/php
10600 <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>
10601 </p>
10602 !! html/parsoid
10603 <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>
10604 !! end
10605
10606 !! test
10607 Thumbnail image with link parameter
10608 !! options
10609 thumbsize=220
10610 parsoid=wt2html,wt2wt,html2html
10611 !! wikitext
10612 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10613 !! html/php
10614 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10615
10616 !! html/parsoid
10617 <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>
10618 !! end
10619
10620 !! test
10621 Manually-specified thumbnail image
10622 !! options
10623 thumbsize=220
10624 !! wikitext
10625 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10626 !! html/php
10627 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10628
10629 !! html/parsoid
10630 <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>
10631 !! end
10632
10633 !! test
10634 Manually-specified thumbnail image with explicit link to wiki page
10635 !! options
10636 thumbsize=220
10637 parsoid=wt2html,wt2wt,html2html
10638 !! wikitext
10639 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10640 !! html/php
10641 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10642
10643 !! html/parsoid
10644 <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>
10645 !! end
10646
10647 !! test
10648 Manually-specified thumbnail image with explicit link to url
10649 !! options
10650 thumbsize=220
10651 parsoid=wt2html,wt2wt,html2html
10652 !! wikitext
10653 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10654 !! html/php
10655 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10656
10657 !! html/parsoid
10658 <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>
10659 !! end
10660
10661 !! test
10662 Manually-specified thumbnail image with explicit no link
10663 !! options
10664 thumbsize=220
10665 parsoid=wt2html,wt2wt,html2html
10666 !! wikitext
10667 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10668 !! html/php
10669 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10670
10671 !! html/parsoid
10672 <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>
10673 !! end
10674
10675 !! test
10676 Manually-specified thumbnail image with explicit link and alt text
10677 !! options
10678 thumbsize=220
10679 parsoid=wt2html,wt2wt,html2html
10680 !! wikitext
10681 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10682 !! html/php
10683 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10684
10685 !! html/parsoid
10686 <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>
10687 !! end
10688
10689 !! test
10690 Image with frame and link
10691 !! options
10692 parsoid=wt2html,wt2wt,html2html
10693 !! wikitext
10694 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10695 !! html/php
10696 <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>
10697
10698 !! html/parsoid
10699 <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">Main Page</a></figcaption></figure>
10700 !! end
10701
10702 !! test
10703 Image with frame and link and explicit alt
10704 !! options
10705 parsoid=wt2html,wt2wt,html2html
10706 !! wikitext
10707 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10708 !! html/php
10709 <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>
10710
10711 !! html/parsoid
10712 <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">Main Page</a></figcaption></figure>
10713 !! end
10714
10715 !! test
10716 Image with wiki markup in implicit alt
10717 !! options
10718 parsoid=wt2html,wt2wt,html2html
10719 !! wikitext
10720 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10721
10722 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10723 !! html/php
10724 <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>
10725 </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>
10726 </p>
10727 !! html/parsoid
10728 <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>
10729 <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>
10730 !! end
10731
10732 ###################
10733 # Conflicting image format options.
10734 # First option specified should 'win'.
10735 # All three cases in each test should be identical.
10736
10737 !! test
10738 Image with 'frameless' first.
10739 !! options
10740 parsoid=wt2html,wt2wt,html2html
10741 !! wikitext
10742 [[File:Foobar.jpg|frameless|caption]]
10743
10744 [[File:Foobar.jpg|frameless|frame|caption]]
10745
10746 [[File:Foobar.jpg|frameless|thumb|caption]]
10747 !! html/php
10748 <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>
10749 </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>
10750 </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>
10751 </p>
10752 !! html/parsoid
10753 <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>
10754 <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>
10755 <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>
10756 !! end
10757
10758 !! test
10759 Image with 'frame' first.
10760 !! options
10761 parsoid=wt2html,wt2wt,html2html
10762 !! wikitext
10763 [[File:Foobar.jpg|frame|caption]]
10764 [[File:Foobar.jpg|frame|frameless|caption]]
10765 [[File:Foobar.jpg|frame|thumb|caption]]
10766 !! html/php
10767 <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>
10768 <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>
10769 <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>
10770
10771 !! html/parsoid
10772 <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>
10773 !! end
10774
10775 !! test
10776 Image with 'thumb' first.
10777 !! options
10778 parsoid=wt2html,wt2wt,html2html
10779 !! wikitext
10780 [[File:Foobar.jpg|thumb|caption]]
10781 [[File:Foobar.jpg|thumb|frameless|caption]]
10782 [[File:Foobar.jpg|thumb|frame|caption]]
10783 !! html/php
10784 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10785 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10786 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10787
10788 !! html/parsoid
10789 <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>
10790 !! end
10791
10792 ###################
10793 # Image sizing.
10794 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10795 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10796 # Foobar has actual size of 1941x220
10797 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10798 # a scalable format.
10799 # 2. Framed images always ignore size options; always render at default size.
10800 # 3. "Unspecified format" and border are the only types which can be
10801 # enlarged.
10802
10803 !! test
10804 Image: "unspecified format" and border enlarge
10805 !! options
10806 parsoid=wt2html,wt2wt,html2html
10807 !! wikitext
10808 [[File:Foobar.jpg|2000px]]
10809
10810 [[File:Foobar.jpg|border|2000px]]
10811 !! html/php
10812 <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>
10813 </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>
10814 </p>
10815 !! html/parsoid
10816 <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>
10817 <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>
10818 !! end
10819
10820 !! test
10821 Image: "unspecified format" and border reduce
10822 !! options
10823 parsoid=wt2html,wt2wt,html2html
10824 !! wikitext
10825 [[File:Foobar.jpg|1000px]]
10826
10827 [[File:Foobar.jpg|border|1000px]]
10828 !! html/php
10829 <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>
10830 </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>
10831 </p>
10832 !! html/parsoid
10833 <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>
10834 <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>
10835 !! end
10836
10837 !! test
10838 Image: thumbs reduce
10839 !! options
10840 parsoid=wt2html,wt2wt,html2html
10841 !! wikitext
10842 [[File:Foobar.jpg|thumb|50px]]
10843 !! html/php
10844 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10845
10846 !! html/parsoid
10847 <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>
10848 !! end
10849
10850 !! test
10851 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10852 !! options
10853 parsoid=wt2html,wt2wt,html2html
10854 !! wikitext
10855 [[File:Foobar.jpg|thumb|2000px]]
10856
10857 [[File:Foobar.svg|thumb|2000px]]
10858 !! html/php
10859 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10860 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10861
10862 !! html/parsoid
10863 <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>
10864 <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>
10865 !! end
10866
10867 !! test
10868 Image: frameless can reduce in size
10869 !! options
10870 parsoid=wt2html,wt2wt,html2html
10871 !! wikitext
10872 [[File:Foobar.jpg|frameless|50px]]
10873 !! html/php
10874 <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>
10875 </p>
10876 !! html/parsoid
10877 <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>
10878 !! end
10879
10880 !! test
10881 Image: bitmap frameless can't be enlarged past original size, but vector can
10882 !! options
10883 parsoid=wt2html,wt2wt,html2html
10884 !! wikitext
10885 [[File:Foobar.jpg|frameless|2000px]]
10886
10887 [[File:Foobar.svg|frameless|2000px]]
10888 !! html/php
10889 <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>
10890 </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>
10891 </p>
10892 !! html/parsoid
10893 <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>
10894 <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>
10895 !! end
10896
10897 !! test
10898 Image: framed images are always unscaled.
10899 !! options
10900 parsoid=wt2html,wt2wt,html2html
10901 !! wikitext
10902 [[File:Foobar.jpg|frame]]
10903
10904 [[File:Foobar.jpg|frame|50px]]
10905
10906 [[File:Foobar.jpg|frame|50x50px]]
10907
10908 [[File:Foobar.jpg|frame|2000px]]
10909 !! html/php
10910 <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>
10911 <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>
10912 <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>
10913 <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>
10914
10915 !! html/parsoid
10916 <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>
10917 !! end
10918
10919 ###################
10920
10921 !! test
10922 Link to image page- image page normally doesn't exists, hence edit link
10923 Add test with existing image page
10924 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10925 !! wikitext
10926 [[:Image:test]]
10927 !! html
10928 <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>
10929 </p>
10930 !! end
10931
10932 !! test
10933 bug 18784 Link to non-existent image page with caption should use caption as link text
10934 !! wikitext
10935 [[:Image:test|caption]]
10936 !! html
10937 <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>
10938 </p>
10939 !! end
10940
10941 !! test
10942 Frameless image caption with a free URL
10943 !! wikitext
10944 [[File:Foobar.jpg|http://example.com]]
10945 !! html/php
10946 <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>
10947 </p>
10948 !! html/parsoid
10949 <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>
10950 !! end
10951
10952 !! test
10953 Thumbnail image caption with a free URL
10954 !! options
10955 thumbsize=220
10956 !! wikitext
10957 [[File:Foobar.jpg|thumb|http://example.com]]
10958 !! html/php
10959 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10960
10961 !! html/parsoid
10962 <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>
10963 !! end
10964
10965 !! test
10966 Thumbnail image caption with a free URL and explicit alt
10967 !! options
10968 thumbsize=220
10969 parsoid=wt2html,wt2wt,html2html
10970 !! wikitext
10971 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10972 !! html/php
10973 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10974
10975 !! html/parsoid
10976 <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>
10977 !! end
10978
10979 !! test
10980 SVG thumbnails with no language set
10981 !! options
10982 !! wikitext
10983 [[File:Foobar.svg|thumb|caption]]
10984 !! html/php
10985 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10986
10987 !! html/parsoid
10988 <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>
10989 !! end
10990
10991 !! test
10992 SVG thumbnails with language de
10993 !! options
10994 parsoid=wt2html,wt2wt,html2html
10995 !! wikitext
10996 [[File:Foobar.svg|thumb|caption|lang=de]]
10997 !! html/php
10998 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10999
11000 !! html/parsoid
11001 <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>
11002 !! end
11003
11004 !! test
11005 SVG thumbnails with invalid language code
11006 !! options
11007 parsoid=wt2html,wt2wt,html2html
11008 !! wikitext
11009 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11010 !! html/php
11011 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
11012
11013 !! html/parsoid
11014 <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>
11015 !! end
11016
11017 !! test
11018 BUG 1887: A ISBN with a thumbnail
11019 !! wikitext
11020 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11021 !! html/php
11022 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
11023
11024 !! html/parsoid
11025 <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>
11026 !! end
11027
11028 !! test
11029 BUG 1887: A RFC with a thumbnail
11030 !! wikitext
11031 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11032 !! html/php
11033 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
11034
11035 !! html/parsoid
11036 <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>
11037 !! end
11038
11039 !! test
11040 BUG 1887: A mailto link with a thumbnail
11041 !! wikitext
11042 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11043 !! html/php
11044 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
11045
11046 !! html/parsoid
11047 <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>
11048 !! end
11049
11050 # Pending resolution to bug 368
11051 !! test
11052 BUG 648: Frameless image caption with a link
11053 !! wikitext
11054 [[File:Foobar.jpg|text with a [[link]] in it]]
11055 !! html/php
11056 <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>
11057 </p>
11058 !! html/parsoid
11059 <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>
11060 !! end
11061
11062 !! test
11063 BUG 648: Frameless image caption with a link (suffix)
11064 !! wikitext
11065 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11066 !! html/php
11067 <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>
11068 </p>
11069 !! html/parsoid
11070 <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>
11071 !! end
11072
11073 !! test
11074 BUG 648: Frameless image caption with an interwiki link
11075 !! wikitext
11076 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11077 !! html/php
11078 <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>
11079 </p>
11080 !! html/parsoid
11081 <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>
11082 !! end
11083
11084 !! test
11085 BUG 648: Frameless image caption with a piped interwiki link
11086 !! wikitext
11087 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11088 !! html/php
11089 <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>
11090 </p>
11091 !! html/parsoid
11092 <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>
11093 !! end
11094
11095 !! test
11096 Escape HTML special chars in image alt text
11097 !! wikitext
11098 [[File:Foobar.jpg|& < > "]]
11099 !! html/php
11100 <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>
11101 </p>
11102 !! html/parsoid
11103 <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>
11104 !! end
11105
11106 !! test
11107 BUG 499: Alt text should have &#1234;, not &amp;1234;
11108 !! wikitext
11109 [[File:Foobar.jpg|&#9792;]]
11110 !! html/php
11111 <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>
11112 </p>
11113 !! html/parsoid
11114 <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>
11115 !! end
11116
11117 !! test
11118 Broken image caption with link
11119 !! options
11120 parsoid=wt2html,wt2wt,html2html
11121 !! wikitext
11122 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11123 !! html/php
11124 <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.
11125 </p>
11126 !! html/parsoid
11127 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page">this</a> is just an ordinary link.</p>
11128 !! end
11129
11130 !! test
11131 Image caption containing another image
11132 !! wikitext
11133 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11134 !! html/php
11135 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
11136
11137 !! html/parsoid
11138 <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>
11139 !! end
11140
11141 !! test
11142 Image: caption containing a newline
11143 !! wikitext
11144 [[File:Foobar.jpg|This
11145 *is some text]]
11146 !! html/php
11147 <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>
11148 </p>
11149 !! html/parsoid
11150 <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>
11151 !!end
11152
11153 !!test
11154 Image: caption containing leading space
11155 (The leading space should not trigger nowiki escaping in wt2wt mode)
11156 !! wikitext
11157 [[File:Foobar.jpg|thumb| bar]]
11158 !! html/php
11159 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
11160
11161 !! html/parsoid
11162 <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>
11163 !!end
11164
11165 !! test
11166 Image: caption containing a table
11167 !! options
11168 parsoid=wt2html,wt2wt,html2html
11169 !! wikitext
11170 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11171 {|
11172 ! Foo !! Bar
11173 |-
11174 | Foo1 || Bar1
11175 |}
11176 and some more text.]]
11177 !! html/php
11178 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
11179
11180 !! html/parsoid
11181 <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
11182 <table>
11183 <tbody>
11184 <tr><th>Foo </th><th>Bar</th></tr>
11185 <tr>
11186 <td>Foo1 </td>
11187 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11188 !! end
11189
11190 !! test
11191 Bug 3090: External links other than http: in image captions
11192 !! wikitext
11193 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11194 !! html/php
11195 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
11196
11197 !! html/parsoid
11198 <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>
11199 !! end
11200
11201 !! test
11202 Custom class
11203 !! options
11204 parsoid=wt2html,wt2wt,html2html
11205 !! wikitext
11206 [[Image:foobar.jpg|a|class=b]]
11207 !! html/php
11208 <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>
11209 </p>
11210 !! html/parsoid
11211 <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>
11212 !! end
11213
11214 !! test
11215 Localized image handling (1).
11216 !! options
11217 parsoid=wt2html,wt2wt,html2html
11218 language=es
11219 !! wikitext
11220 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11221 !! html/php
11222 <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>
11223
11224 !! html/parsoid
11225 <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>
11226 !! end
11227
11228 !! test
11229 Localized image handling (2).
11230 !! options
11231 thumbsize=220
11232 parsoid=wt2html,wt2wt,html2html
11233 language=es
11234 !! wikitext
11235 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11236 !! html/php
11237 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11238
11239 !! html/parsoid
11240 <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>
11241 !! end
11242
11243 !! test
11244 "border", "frameless" and "class" attributes on an image.
11245 !! options
11246 thumbsize=220
11247 parsoid=wt2html,wt2wt,html2html
11248 !! wikitext
11249 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11250 !! html/php
11251 <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>
11252 </p>
11253 !! html/parsoid
11254 <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>
11255 !! end
11256
11257 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11258 !! test
11259 Invalid image attributes (bug 62500)
11260 !! options
11261 thumbsize=220
11262 parsoid=wt2html,wt2wt,html2html
11263 !! wikitext
11264 [[File:Foobar.jpg|thumb|float|left|caption]]
11265
11266 [[File:Foobar.jpg|thumb|righ|caption]]
11267
11268 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11269 !! html/php
11270 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11271 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11272 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
11273
11274 !! html/parsoid
11275 <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>
11276 !! end
11277
11278 !! article
11279 File:Barfoo.jpg
11280 !! text
11281 #REDIRECT [[File:Barfoo.jpg]]
11282 !! endarticle
11283
11284 !! test
11285 Redirected image
11286 !! wikitext
11287 [[Image:Barfoo.jpg]]
11288 !! html
11289 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11290 </p>
11291 !! end
11292
11293 !! test
11294 Missing image with uploads disabled
11295 !! options
11296 wgEnableUploads=0
11297 !! wikitext
11298 [[Image:Foobaz.jpg]]
11299 !! html
11300 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11301 </p>
11302 !! end
11303
11304 # Parsoid-specific testing for images
11305 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11306 # Currently imperfect due to a flaw in the Parsoid testrunner
11307 # Work in progress
11308 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11309 # image tests.
11310
11311 !! test
11312 Parsoid-specific image handling - simple image with size and middle alignment
11313 !! wikitext
11314 [[File:Foobar.jpg|middle|50px]]
11315 !! html/parsoid
11316 <p><span class="mw-valign-middle" typeof="mw:Image">
11317 <a href="File:Foobar.jpg">
11318 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11319 </a>
11320 </span>
11321 </p>
11322 !! end
11323
11324 !! test
11325 Parsoid-specific image handling - simple image with size, middle alignment,
11326 non-standard namespace alias
11327 !! options
11328 parsoid=wt2wt,wt2html,html2html
11329 !! wikitext
11330 [[Image:Foobar.jpg|middle|50px]]
11331 !! html/parsoid
11332 <p><span class="mw-valign-middle" typeof="mw:Image">
11333 <a href="File:Foobar.jpg">
11334 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11335 </a>
11336 </span>
11337 </p>
11338 !! end
11339
11340 !! test
11341 Parsoid-specific image handling - simple image with size and middle alignment
11342 (existing content)
11343 !! wikitext
11344 [[File:Foobar.jpg|50px|middle]]
11345 !! html/parsoid
11346 <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>
11347 !! end
11348
11349 !! test
11350 Parsoid-specific image handling - simple image with size and middle alignment
11351 and non-standard namespace name
11352 !! options
11353 parsoid=wt2html,wt2wt,html2html
11354 !! wikitext
11355 [[Image:Foobar.jpg|50px|middle]]
11356 !! html/parsoid
11357 <p><span class="mw-valign-middle" typeof="mw:Image">
11358 <a href="File:Foobar.jpg">
11359 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11360 </a>
11361 </span>
11362 </p>
11363 !! end
11364
11365 !! test
11366 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11367 !! wikitext
11368 [[File:Foobar.jpg|500x10px|baseline|caption]]
11369 !! html/parsoid
11370 <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>
11371 !! end
11372
11373 !! test
11374 Parsoid-specific image handling - simple image with border and size spec
11375 !! wikitext
11376 [[File:Foobar.jpg|50px|border|caption]]
11377 !! html/parsoid
11378 <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>
11379 !! end
11380
11381 !! test
11382 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11383 !! wikitext
11384 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11385 !! html/parsoid
11386 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11387 <a href="File:Foobar.jpg">
11388 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11389 </a>
11390 <figcaption>caption content</figcaption>
11391 </figure>
11392 !! end
11393
11394 !! test
11395 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11396 (existing content)
11397 !! wikitext
11398 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11399 !! html/parsoid
11400 <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>
11401 !! end
11402
11403 !! test
11404 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11405 !! wikitext
11406 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11407 !! html/parsoid
11408 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11409 <a href="File:Foobar.jpg">
11410 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11411 </a>
11412 <figcaption>caption</figcaption>
11413 </figure>
11414 !! end
11415
11416 !! test
11417 Parsoid-specific image handling - thumbnail with specific size, halign,
11418 valign, and caption (existing content)
11419 !! wikitext
11420 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11421 !! html/parsoid
11422 <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>
11423 !! end
11424
11425 !! test
11426 Parsoid-specific image handling - framed image with specific size and caption
11427 (size is ignored)
11428 !! options
11429 parsoid=wt2html,wt2wt,html2html
11430 !! wikitext
11431 [[File:Foobar.jpg|frame|500x50px|caption]]
11432 !! html/parsoid
11433 <figure typeof="mw:Image/Frame">
11434 <a href="File:Foobar.jpg">
11435 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11436 </a>
11437 <figcaption>caption</figcaption>
11438 </figure>
11439 !! end
11440
11441 !! test
11442 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11443 (size is ignored)
11444 !! options
11445 parsoid=wt2html,wt2wt,html2html
11446 !! wikitext
11447 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11448 !! html/parsoid
11449 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11450 <a href="File:Foobar.jpg">
11451 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11452 </a>
11453 <figcaption>caption</figcaption>
11454 </figure>
11455 !! end
11456
11457 !! test
11458 Parsoid-specific image handling - frameless image with specific size, border, and caption
11459 !! wikitext
11460 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11461 !! html/parsoid
11462 <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>
11463 !! end
11464
11465 !! test
11466 Parsoid-specific image handling - simple image with a formatted caption
11467 !! wikitext
11468 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11469 !! html/parsoid
11470 <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>"}'>
11471 <a href="File:Foobar.jpg">
11472 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11473 </a></span></p>
11474 !! end
11475
11476 !! test
11477 Parsoid-specific image handling - caption with a template in it
11478 !! wikitext
11479 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11480 !! html/parsoid
11481 <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>
11482 !! end
11483
11484 !! test
11485 Parsoid-specific image handling - caption with unbalanced tags in it
11486 !! options
11487 parsoid=wt2html,wt2wt,html2html
11488 !! wikitext
11489 foo
11490 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11491 bar
11492 !! html/parsoid
11493 <p>foo</p>
11494 <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>
11495 <p>bar</p>
11496 !! end
11497
11498 !! test
11499 Parsoid-specific image handling - empty caption (1)
11500 !! options
11501 parsoid=wt2html,wt2wt
11502 !! wikitext
11503 [[File:Foobar.jpg|thumb|]]
11504 !! html/parsoid
11505 <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>
11506 !! end
11507
11508 # empty captions don't get serialized unless we're in the "round trip" case
11509 !! test
11510 Parsoid-specific image handling - empty caption (2)
11511 !! options
11512 parsoid=html2wt
11513 !! html/parsoid
11514 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11515 <a href="File:Foobar.jpg">
11516 <img resource="./File:Foobar.jpg"
11517 src="//example.com/images/3/3a/Foobar.jpg"
11518 height="25" width="220"/>
11519 </a>
11520 <figcaption></figcaption>
11521 </figure>
11522 !! wikitext
11523 [[File:Foobar.jpg|thumb]]
11524 !! end
11525
11526 !! test
11527 Parsoid-specific image handling - whitespace caption
11528 !! wikitext
11529 [[File:Foobar.jpg|thumb| ]]
11530 !! html/parsoid
11531 <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>
11532 !! end
11533
11534 !! test
11535 Parsoid-specific image handling - lang option
11536 !! wikitext
11537 foo
11538 [[File:Foobar.svg|lang=de|caption]]
11539 bar
11540 !! html/parsoid
11541 <p>foo
11542 <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>
11543 bar</p>
11544 !! end
11545
11546
11547 ###
11548 ### Subpages
11549 ###
11550 !! article
11551 Subpage test/subpage
11552 !! text
11553 foo
11554 !! endarticle
11555
11556 !! test
11557 Subpage link
11558 !! options
11559 subpage title=[[Subpage test]]
11560 !! wikitext
11561 [[/subpage]]
11562 !! html
11563 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11564 </p>
11565 !! end
11566
11567 !! test
11568 Subpage noslash link
11569 !! options
11570 subpage title=[[Subpage test]]
11571 !! wikitext
11572 [[/subpage/]]
11573 !! html
11574 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11575 </p>
11576 !! end
11577
11578 # TODO: make this PHP-parser compatible!
11579 !! test
11580 Relative subpage noslash link
11581 !! options
11582 parsoid=wt2wt,wt2html,html2html
11583 subpage title=[[Subpage test/1/2/3/4]]
11584 !! wikitext
11585 [[../../subpage/]]
11586
11587 [[../../subpage]]
11588 !! html
11589 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11590 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11591 !! end
11592
11593 !! test
11594 Parsoid: dot-slash prefixed wikilinks
11595 !! wikitext
11596 [[./foo]]
11597
11598 [[././bar]]
11599
11600 [[././baz/]]
11601 !! html/php
11602 <p>[[./foo]]
11603 </p><p>[[././bar]]
11604 </p><p>[[././baz/]]
11605 </p>
11606 !! html/parsoid
11607 <p>[[./foo]]
11608 </p><p>[[././bar]]
11609 </p><p>[[././baz/]]
11610 </p>
11611 !! end
11612
11613 !! test
11614 Render invalid page names as plain text (bug 51090)
11615 !! wikitext
11616 [[./../foo|bar]]
11617 [[foo�|bar]]
11618 [[foo/.|bar]]
11619 [[foo/..|bar]]
11620 [[foo~~~bar]]
11621 [[foo>bar]]
11622 [[foo[bar]]
11623 [[.]]
11624 [[..]]
11625 [[foo././bar]]
11626
11627 [[{{echo|./../foo}}|bar]]
11628 [[{{echo|foo/.}}|bar]]
11629 [[{{echo|foo/..}}|bar]]
11630 [[{{echo|foo~~~~bar}}]]
11631 [[{{echo|foo>bar}}]]
11632 [[{{echo|foo././bar}}]]
11633 [[{{echo|foo{bar}}]]
11634 [[{{echo|foo}bar}}]]
11635 [[{{echo|foo[bar}}]]
11636 [[{{echo|foo]bar}}]]
11637 [[{{echo|foo<bar}}]]
11638 !!html/php
11639 <p>[[./../foo|bar]]
11640 [[foo�|bar]]
11641 [[foo/.|bar]]
11642 [[foo/..|bar]]
11643 [[foo~~~bar]]
11644 [[foo&gt;bar]]
11645 [[foo[bar]]
11646 [[.]]
11647 [[..]]
11648 [[foo././bar]]
11649 </p><p>[[./../foo|bar]]
11650 [[foo/.|bar]]
11651 [[foo/..|bar]]
11652 [[foo~~~~bar]]
11653 [[foo&gt;bar]]
11654 [[foo././bar]]
11655 [[foo{bar]]
11656 [[foo}bar]]
11657 [[foo[bar]]
11658 [[foo]bar]]
11659 [[foo&lt;bar]]
11660 </p>
11661 !!html/parsoid
11662 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11663 <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>
11664 !!end
11665
11666 !! test
11667 Disabled subpages
11668 !! wikitext
11669 [[/subpage]]
11670 !! html
11671 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11672 </p>
11673 !! end
11674
11675 !! test
11676 BUG 561: {{/Subpage}}
11677 !! options
11678 subpage title=[[Page]]
11679 !! wikitext
11680 {{/Subpage}}
11681 !! html
11682 <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>
11683 </p>
11684 !! end
11685
11686 ###
11687 ### Categories
11688 ###
11689 !! article
11690 Category:MediaWiki User's Guide
11691 !! text
11692 blah
11693 !! endarticle
11694
11695 !! test
11696 Link to category
11697 !! wikitext
11698 [[:Category:MediaWiki User's Guide]]
11699 !! html
11700 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11701 </p>
11702 !! end
11703
11704 !! test
11705 Simple category
11706 !! options
11707 cat
11708 !! wikitext
11709 [[Category:MediaWiki User's Guide]]
11710 !! html
11711 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11712 !! end
11713
11714 !! test
11715 PAGESINCATEGORY invalid title fatal (r33546 fix)
11716 !! wikitext
11717 {{PAGESINCATEGORY:<bogus>}}
11718 !! html
11719 <p>0
11720 </p>
11721 !! end
11722
11723 !! test
11724 Category with different sort key
11725 !! options
11726 cat
11727 !! wikitext
11728 [[Category:MediaWiki User's Guide|Foo]]
11729 !! html
11730 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11731 !! end
11732
11733 !! test
11734 Category with identical sort key
11735 !! options
11736 cat
11737 !! wikitext
11738 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11739 !! html
11740 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11741 !! end
11742
11743 !! test
11744 Category with empty sort key
11745 !! options
11746 cat
11747 pst
11748 !! wikitext
11749 [[Category:MediaWiki User's Guide|]]
11750 !! html
11751 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11752 !! end
11753
11754 !! test
11755 Category with empty sort key and parentheses
11756 !! options
11757 cat
11758 pst
11759 !! wikitext
11760 [[Category:Foo (bar)|]]
11761 !! html
11762 [[Category:Foo (bar)|Foo]]
11763 !! end
11764
11765 !! test
11766 Category with link tail
11767 !! options
11768 cat
11769 pst
11770 !! wikitext
11771 123[[Category:Foo]]456
11772 !! html
11773 123[[Category:Foo]]456
11774 !! end
11775
11776 !! test
11777 Category with template
11778 !! options
11779 cat
11780 pst
11781 !! wikitext
11782 [[Category:{{echo|Foo}}]]
11783 !! html
11784 [[Category:{{echo|Foo}}]]
11785 !! end
11786
11787 !! test
11788 Category with template in sort key
11789 !! options
11790 cat
11791 pst
11792 !! wikitext
11793 [[Category:Foo|{{echo|Bar}}]]
11794 !! html
11795 [[Category:Foo|{{echo|Bar}}]]
11796 !! end
11797
11798 !! test
11799 Category with template in sort key and title
11800 !! options
11801 cat
11802 pst
11803 !! wikitext
11804 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11805 !! html
11806 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11807 !! end
11808
11809 !! test
11810 Category / paragraph interactions
11811 !! wikitext
11812 Foo [[Category:Baz]] Bar
11813
11814 Foo [[Category:Baz]]
11815 Bar
11816
11817 Foo
11818 [[Category:Baz]]
11819 Bar
11820
11821 Foo
11822 [[Category:Baz]] Bar
11823
11824 Foo
11825 [[Category:Baz]]
11826 [[Category:Baz]]
11827 [[Category:Baz]]
11828 Bar
11829
11830 [[Category:Baz]]
11831 [[Category:Baz]]
11832 [[Category:Baz]]
11833
11834 [[Category:Baz]]
11835 {{echo|[[Category:Baz]]}}
11836 [[Category:Baz]]
11837 !! html
11838 <p>Foo Bar
11839 </p><p>Foo
11840 Bar
11841 </p><p>Foo
11842 Bar
11843 </p><p>Foo Bar
11844 </p><p>Foo
11845 Bar
11846 </p>
11847 !! end
11848
11849 !! test
11850 Parsoid: Serialize link to category page with colon escape
11851 !! options
11852 parsoid
11853 !! wikitext
11854
11855 [[:Category:Foo]]
11856 [[:Category:Foo|Bar]]
11857 !! html
11858 <p>
11859 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11860 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11861 </p>
11862 !! end
11863
11864 !! test
11865 Parsoid: Link prefix/suffixes aren't applied to category links
11866 !! options
11867 parsoid=wt2html,wt2wt,html2html
11868 language=is
11869 !! wikitext
11870 x[[Category:Foo]]y
11871 !! html
11872 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11873 !! end
11874
11875 !! test
11876 Parsoid: Serialize link to file page with colon escape
11877 !! options
11878 parsoid
11879 !! wikitext
11880
11881 [[:File:Foo.png]]
11882 [[:File:Foo.png|Bar]]
11883 !! html
11884 <p>
11885 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11886 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11887 </p>
11888 !! end
11889
11890 !! test
11891 Parsoid: Serialize a genuine category link without colon escape
11892 !! options
11893 parsoid
11894 !! wikitext
11895 [[Category:Foo]]
11896 [[Category:Foo|Bar]]
11897 !! html
11898 <link rel="mw:PageProp/Category" href="Category:Foo">
11899 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11900 !! end
11901
11902 !! test
11903 Parsoid: Defaultsort
11904 !! options
11905 parsoid
11906 !! wikitext
11907 {{DEFAULTSORT:Foo}}
11908 !! html
11909 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11910 !! end
11911
11912 ###
11913 ### Inter-language links
11914 ###
11915 !! test
11916 Inter-language links
11917 !! options
11918 ill
11919 !! wikitext
11920 [[es:Alimento]]
11921 [[fr:Nourriture]]
11922 [[zh:&#39135;&#21697;]]
11923 !! html
11924 es:Alimento fr:Nourriture zh:食品
11925 !! end
11926
11927 !! test
11928 Duplicate interlanguage links (bug 24502)
11929 !! options
11930 ill
11931 !! wikitext
11932 [[es:1]]
11933 [[es:2]]
11934 [[fr:1]]
11935 [[fr:2]]
11936 !! html
11937 es:1 fr:1
11938 !! end
11939
11940 ###
11941 ### Sections
11942 ###
11943 !! test
11944 Basic section headings
11945 !! wikitext
11946 == Headline 1 ==
11947 Some text
11948
11949 ==Headline 2==
11950 More
11951 ===Smaller headline===
11952 Blah blah
11953 !! html
11954 <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>
11955 <p>Some text
11956 </p>
11957 <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>
11958 <p>More
11959 </p>
11960 <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>
11961 <p>Blah blah
11962 </p>
11963 !! end
11964
11965 !! test
11966 Section headings with TOC
11967 !! wikitext
11968 == Headline 1 ==
11969 === Subheadline 1 ===
11970 ===== Skipping a level =====
11971 ====== Skipping a level ======
11972
11973 == Headline 2 ==
11974 Some text
11975 ===Another headline===
11976 !! html
11977 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11978 <ul>
11979 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11980 <ul>
11981 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11982 <ul>
11983 <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>
11984 <ul>
11985 <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>
11986 </ul>
11987 </li>
11988 </ul>
11989 </li>
11990 </ul>
11991 </li>
11992 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11993 <ul>
11994 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11995 </ul>
11996 </li>
11997 </ul>
11998 </div>
11999
12000 <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>
12001 <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>
12002 <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>
12003 <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>
12004 <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>
12005 <p>Some text
12006 </p>
12007 <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>
12008
12009 !! end
12010
12011 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12012 !! test
12013 Handling of sections up to level 6 and beyond
12014 !! wikitext
12015 = Level 1 Heading=
12016 == Level 2 Heading==
12017 === Level 3 Heading===
12018 ==== Level 4 Heading====
12019 ===== Level 5 Heading=====
12020 ====== Level 6 Heading======
12021 ======= Level 7 Heading=======
12022 ======== Level 8 Heading========
12023 ========= Level 9 Heading=========
12024 ========== Level 10 Heading==========
12025 !! html
12026 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12027 <ul>
12028 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12029 <ul>
12030 <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>
12031 <ul>
12032 <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>
12033 <ul>
12034 <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>
12035 <ul>
12036 <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>
12037 <ul>
12038 <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>
12039 <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>
12040 <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>
12041 <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>
12042 <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>
12043 </ul>
12044 </li>
12045 </ul>
12046 </li>
12047 </ul>
12048 </li>
12049 </ul>
12050 </li>
12051 </ul>
12052 </li>
12053 </ul>
12054 </div>
12055
12056 <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>
12057 <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>
12058 <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>
12059 <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>
12060 <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>
12061 <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>
12062 <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>
12063 <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>
12064 <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>
12065 <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>
12066
12067 !! end
12068
12069 !! test
12070 TOC regression (bug 9764)
12071 !! wikitext
12072 == title 1 ==
12073 === title 1.1 ===
12074 ==== title 1.1.1 ====
12075 === title 1.2 ===
12076 == title 2 ==
12077 === title 2.1 ===
12078 !! html
12079 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12080 <ul>
12081 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12082 <ul>
12083 <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>
12084 <ul>
12085 <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>
12086 </ul>
12087 </li>
12088 <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>
12089 </ul>
12090 </li>
12091 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12092 <ul>
12093 <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>
12094 </ul>
12095 </li>
12096 </ul>
12097 </div>
12098
12099 <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>
12100 <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>
12101 <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>
12102 <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>
12103 <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>
12104 <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>
12105
12106 !! end
12107
12108 !! test
12109 TOC with wgMaxTocLevel=3 (bug 6204)
12110 !! options
12111 wgMaxTocLevel=3
12112 !! wikitext
12113 == title 1 ==
12114 === title 1.1 ===
12115 ==== title 1.1.1 ====
12116 === title 1.2 ===
12117 == title 2 ==
12118 === title 2.1 ===
12119 !! html
12120 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12121 <ul>
12122 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12123 <ul>
12124 <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>
12125 <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>
12126 </ul>
12127 </li>
12128 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12129 <ul>
12130 <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>
12131 </ul>
12132 </li>
12133 </ul>
12134 </div>
12135
12136 <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>
12137 <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>
12138 <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>
12139 <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>
12140 <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>
12141 <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>
12142
12143 !! end
12144
12145 !! test
12146 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12147 !! options
12148 wgMaxTocLevel=3
12149 !! wikitext
12150 ==Section 1==
12151 ===Section 1.1===
12152 ====Section 1.1.1====
12153 ====Section 1.1.1.1====
12154 ==Section 2==
12155 !! html
12156 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12157 <ul>
12158 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12159 <ul>
12160 <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>
12161 </ul>
12162 </li>
12163 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12164 </ul>
12165 </div>
12166
12167 <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>
12168 <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>
12169 <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>
12170 <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>
12171 <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>
12172
12173 !! end
12174
12175
12176 !! test
12177 Resolving duplicate section names
12178 !! wikitext
12179 == Foo bar ==
12180 == Foo bar ==
12181 !! html
12182 <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>
12183 <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>
12184
12185 !! end
12186
12187 !! test
12188 Resolving duplicate section names with differing case (bug 10721)
12189 !! wikitext
12190 == Foo bar ==
12191 == Foo Bar ==
12192 !! html
12193 <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>
12194 <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>
12195
12196 !! end
12197
12198 !! article
12199 Template:sections
12200 !! text
12201 ===Section 1===
12202 ==Section 2==
12203 !! endarticle
12204
12205 !! test
12206 Template with sections, __NOTOC__
12207 !! wikitext
12208 __NOTOC__
12209 ==Section 0==
12210 {{sections}}
12211 ==Section 4==
12212 !! html
12213 <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>
12214 <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>
12215 <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>
12216 <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>
12217
12218 !! end
12219
12220 !! test
12221 __NOEDITSECTION__ keyword
12222 !! wikitext
12223 __NOEDITSECTION__
12224 ==Section 1==
12225 ==Section 2==
12226 !! html
12227 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12228 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12229
12230 !! end
12231
12232 !! test
12233 Link inside a section heading
12234 !! wikitext
12235 ==Section with a [[Main Page|link]] in it==
12236 !! html
12237 <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>
12238
12239 !! end
12240
12241 !! test
12242 TOC regression (bug 12077)
12243 !! wikitext
12244 __TOC__
12245 == title 1 ==
12246 === title 1.1 ===
12247 == title 2 ==
12248 !! html
12249 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12250 <ul>
12251 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12252 <ul>
12253 <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>
12254 </ul>
12255 </li>
12256 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12257 </ul>
12258 </div>
12259
12260 <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>
12261 <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>
12262 <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>
12263
12264 !! end
12265
12266 !! test
12267 BUG 1219 URL next to image (good)
12268 !! wikitext
12269 http://example.com [[Image:foobar.jpg]]
12270 !! html
12271 <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>
12272 </p>
12273 !!end
12274
12275 !! test
12276 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12277 !! wikitext
12278 ===
12279 The line above must have a trailing space!
12280 === <!--
12281 --> <!-- -->
12282 But just in case it doesn't...
12283 !! html
12284 <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>
12285 <p>The line above must have a trailing space!
12286 </p>
12287 <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>
12288 <p>But just in case it doesn't...
12289 </p>
12290 !! end
12291
12292 !! test
12293 Header with special characters (bug 25462)
12294 !! wikitext
12295 The tooltips shall not show entities to the user (ie. be double escaped)
12296
12297 == text > text ==
12298 section 1
12299
12300 == text < text ==
12301 section 2
12302
12303 == text & text ==
12304 section 3
12305
12306 == text ' text ==
12307 section 4
12308
12309 == text " text ==
12310 section 5
12311 !! html
12312 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12313 </p>
12314 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12315 <ul>
12316 <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>
12317 <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>
12318 <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>
12319 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12320 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12321 </ul>
12322 </div>
12323
12324 <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>
12325 <p>section 1
12326 </p>
12327 <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>
12328 <p>section 2
12329 </p>
12330 <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>
12331 <p>section 3
12332 </p>
12333 <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>
12334 <p>section 4
12335 </p>
12336 <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>
12337 <p>section 5
12338 </p>
12339 !! end
12340
12341 !! test
12342 Headers with excess '=' characters
12343 (Are similar tests necessary beyond the 1st level?)
12344 !! wikitext
12345 =foo==
12346 ==foo=
12347 =''italic'' heading==
12348 ==''italic'' heading=
12349 !! html
12350 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12351 <ul>
12352 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12353 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12354 <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>
12355 <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>
12356 </ul>
12357 </div>
12358
12359 <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>
12360 <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>
12361 <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>
12362 <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>
12363
12364 !! end
12365
12366 !! test
12367 HTML headers vs TOC (bug 23393)
12368 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12369 !! wikitext
12370 <h1>Header 1</h1>
12371 == Header 1.1 ==
12372 == Header 1.2 ==
12373
12374 <h1>Header 2
12375 </h1>
12376 == Header 2.1 ==
12377 == Header 2.2 ==
12378 __NOEDITSECTION__
12379 !! html
12380 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12381 <ul>
12382 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12383 <ul>
12384 <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>
12385 <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>
12386 </ul>
12387 </li>
12388 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12389 <ul>
12390 <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>
12391 <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>
12392 </ul>
12393 </li>
12394 </ul>
12395 </div>
12396
12397 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12398 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12399 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12400 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12401 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12402 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12403
12404 !! end
12405
12406 !! test
12407 Single-line or multiline-comments can follow headings
12408 !! options
12409 parsoid=wt2html,wt2wt
12410 !! wikitext
12411 ==foo==<!---->
12412 ==bar==<!--c1-->
12413 ==baz==<!--
12414 c2
12415 c3-->
12416 !! html
12417 <h2><span class="mw-headline" id="foo">foo</span></h2>
12418 <h2><span class="mw-headline" id="bar">bar</span></h2>
12419 <h2><span class="mw-headline" id="baz">baz</span></h2>
12420
12421 !! end
12422
12423 !! test
12424 BUG 1219 URL next to image (broken)
12425 !! wikitext
12426 http://example.com[[Image:foobar.jpg]]
12427 !! html
12428 <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>
12429 </p>
12430 !!end
12431
12432 !! test
12433 Bug 1186 news: in the middle of text
12434 !! wikitext
12435 http://en.wikinews.org/wiki/Wikinews:Workplace
12436 !! html
12437 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12438 </p>
12439 !!end
12440
12441
12442 !! test
12443 Namespaced link must have a title
12444 !! wikitext
12445 [[Project:]]
12446 !! html
12447 <p>[[Project:]]
12448 </p>
12449 !!end
12450
12451 !! test
12452 Namespaced link must have a title (bad fragment version)
12453 !! wikitext
12454 [[Project:#fragment]]
12455 !! html
12456 <p>[[Project:#fragment]]
12457 </p>
12458 !!end
12459
12460
12461 ###
12462 ### HTML tags and HTML attributes
12463 ###
12464
12465 !! test
12466 div with no attributes
12467 !! wikitext
12468 <div>HTML rocks</div>
12469 !! html
12470 <div>HTML rocks</div>
12471
12472 !! end
12473
12474 !! test
12475 div with double-quoted attribute
12476 !! wikitext
12477 <div id="rock">HTML rocks</div>
12478 !! html
12479 <div id="rock">HTML rocks</div>
12480
12481 !! end
12482
12483 !! test
12484 div with single-quoted attribute
12485 !! wikitext
12486 <div id='rock'>HTML rocks</div>
12487 !! html
12488 <div id="rock">HTML rocks</div>
12489
12490 !! end
12491
12492 !! test
12493 div with unquoted attribute
12494 !! wikitext
12495 <div id=rock>HTML rocks</div>
12496 !! html
12497 <div id="rock">HTML rocks</div>
12498
12499 !! end
12500
12501 !! test
12502 div with illegal double attributes
12503 !! wikitext
12504 <div id="a" id="b">HTML rocks</div>
12505 !! html
12506 <div id="b">HTML rocks</div>
12507
12508 !!end
12509
12510 # FIXME: produce empty string instead of "class" in the PHP parser, following
12511 # the HTML5 spec.
12512 !! test
12513 div with empty attribute value, space before equals
12514 !! options
12515 parsoid
12516 !! wikitext
12517 <div class =>HTML rocks</div>
12518 !! html
12519 <div class="">HTML rocks</div>
12520
12521 !! end
12522
12523 # The PHP parser escapes the opening brace to &#123; for some reason, so
12524 # disabled this test for it.
12525 !! test
12526 div with braces in attribute value
12527 !! options
12528 parsoid
12529 !! wikitext
12530 <div title="{}">Foo</div>
12531 !! html
12532 <div title="{}">Foo</div>
12533 !! end
12534
12535 # This it very inconsistent in the PHP parser: it returns
12536 # class="class" if there is a space between the name and the equal sign (see
12537 # 'div with empty attribute value, space before equals'), but strips the
12538 # attribute completely if the space is missing. We hope that not much content
12539 # depends on this, so are implementing the behavior below in Parsoid for
12540 # consistencies' sake. Disabled for the PHP parser.
12541 # FIXME: fix this behavior in the PHP parser?
12542 !! test
12543 div with empty attribute value, no space before equals
12544 !! options
12545 parsoid
12546 !! wikitext
12547 <div class=>HTML rocks</div>
12548 !! html
12549 <div class="">HTML rocks</div>
12550
12551 !! end
12552
12553 !! test
12554 HTML multiple attributes correction
12555 !! wikitext
12556 <p class="error" class="awesome">Awesome!</p>
12557 !! html
12558 <p class="awesome">Awesome!</p>
12559
12560 !!end
12561
12562 !! test
12563 Table multiple attributes correction
12564 !! wikitext
12565 {|
12566 !+ class="error" class="awesome"| status
12567 |}
12568 !! html
12569 <table>
12570 <tr>
12571 <th class="awesome"> status
12572 </th></tr></table>
12573
12574 !!end
12575
12576 !! test
12577 DIV IN UPPERCASE
12578 !! wikitext
12579 <DIV ID="x">HTML ROCKS</DIV>
12580 !! html
12581 <div id="x">HTML ROCKS</div>
12582
12583 !!end
12584
12585 !! test
12586 Non-ASCII pseudo-tags are rendered as text
12587 !! wikitext
12588 <khyô>
12589 !! html
12590 <p>&lt;khyô&gt;
12591 </p>
12592 !! end
12593
12594 !! test
12595 Pseudo-tag with URL 'name' renders as url link
12596 !! wikitext
12597 <http://example.com/>
12598 !! html
12599 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12600 </p>
12601 !! end
12602
12603 !! test
12604 text with amp in the middle of nowhere
12605 !! wikitext
12606 Remember AT&T?
12607 !! html
12608 <p>Remember AT&amp;T?
12609 </p>
12610 !! end
12611
12612 !! test
12613 text with character entity: eacute
12614 !! wikitext
12615 I always thought &eacute; was a cute letter.
12616 !! html
12617 <p>I always thought &#233; was a cute letter.
12618 </p>
12619 !! end
12620
12621 !! test
12622 text with entity-escaped character entity-like string: eacute
12623 !! wikitext
12624 I always thought &amp;eacute; was a cute letter.
12625 !! html
12626 <p>I always thought &amp;eacute; was a cute letter.
12627 </p>
12628 !! end
12629
12630 !! test
12631 text with undefined character entity: xacute
12632 !! wikitext
12633 I always thought &xacute; was a cute letter.
12634 !! html
12635 <p>I always thought &amp;xacute; was a cute letter.
12636 </p>
12637 !! end
12638
12639 # TODO: generalize to PHP parser?
12640 !! test
12641 HTML5 tags
12642 !! options
12643 parsoid
12644 !! wikitext
12645 <data value="5">five</data>
12646 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12647 <mark>This highlighted text</mark>
12648 !! html
12649 <p><data value="5">five</data>
12650 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12651 <mark>This highlighted text</mark></p>
12652 !! end
12653
12654 !! test
12655 HTML tag with leading space is parsed as text
12656 !! wikitext
12657 < div>foo< /div>
12658 !! html
12659 <p>&lt; div&gt;foo&lt; /div&gt;
12660 </p>
12661 !! end
12662
12663 ###
12664 ### Nesting tests (see bug 41545, 50604, 51081)
12665 ###
12666
12667 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12668 # Note that html2wt is considerably more difficult if we use <b> in
12669 # the test case, instead of <big>
12670 !! test
12671 Ensure that HTML adoption agency algorithm is properly implemented.
12672 !! wikitext
12673 <big>X<big>Y</big>Z</big>
12674 !! html
12675 <p><big>X<big>Y</big>Z</big>
12676 </p>
12677 !! end
12678
12679 # This was bug 41545 in the PHP parser.
12680 !! test
12681 Nesting of <kbd>
12682 !! wikitext
12683 <kbd>X<kbd>Y</kbd>Z</kbd>
12684 !! html
12685 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12686 </p>
12687 !! end
12688
12689 # The following cases were bug 51081 in the PHP parser.
12690 # Note that there are some other nestable tags (b, i, etc) which are
12691 # not covered; see bug 51081 for discussion.
12692 !! test
12693 Nesting of <em>
12694 !! wikitext
12695 <em>X<em>Y</em>Z</em>
12696 !! html
12697 <p><em>X<em>Y</em>Z</em>
12698 </p>
12699 !! end
12700
12701 !! test
12702 Nesting of <strong>
12703 !! wikitext
12704 <strong>X<strong>Y</strong>Z</strong>
12705 !! html
12706 <p><strong>X<strong>Y</strong>Z</strong>
12707 </p>
12708 !! end
12709
12710 !! test
12711 Nesting of <q>
12712 !! wikitext
12713 <q>X<q>Y</q>Z</q>
12714 !! html
12715 <p><q>X<q>Y</q>Z</q>
12716 </p>
12717 !! end
12718
12719 !! test
12720 Nesting of <ruby>
12721 !! wikitext
12722 <ruby>X<ruby>Y</ruby>Z</ruby>
12723 !! html
12724 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12725 </p>
12726 !! end
12727
12728 !! test
12729 Nesting of <bdo>
12730 !! wikitext
12731 <bdo>X<bdo>Y</bdo>Z</bdo>
12732 !! html
12733 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12734 </p>
12735 !! end
12736
12737
12738 ###
12739 ### Media links
12740 ###
12741
12742 !! test
12743 Media link
12744 !! wikitext
12745 [[Media:Foobar.jpg]]
12746 !! html
12747 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12748 </p>
12749 !! end
12750
12751 !! test
12752 Media link with text
12753 !! wikitext
12754 [[Media:Foobar.jpg|A neat file to look at]]
12755 !! html
12756 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12757 </p>
12758 !! end
12759
12760 # FIXME: this is still bad HTML tag nesting
12761 !! test
12762 Media link with nasty text
12763 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12764 !! wikitext
12765 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12766 !! html
12767 <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>
12768
12769 !! end
12770
12771 !! test
12772 Media link to nonexistent file (bug 1702)
12773 !! wikitext
12774 [[Media:No such.jpg]]
12775 !! html
12776 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12777 </p>
12778 !! end
12779
12780 !! test
12781 Image link to nonexistent file (bug 1850 - good)
12782 !! wikitext
12783 [[Image:No such.jpg]]
12784 !! html
12785 <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>
12786 </p>
12787 !! end
12788
12789 !! test
12790 :Image link to nonexistent file (bug 1850 - bad)
12791 !! wikitext
12792 [[:Image:No such.jpg]]
12793 !! html
12794 <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>
12795 </p>
12796 !! end
12797
12798
12799
12800 !! test
12801 Character reference normalization in link text (bug 1938)
12802 !! wikitext
12803 [[Main Page|this&that]]
12804 !! html
12805 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12806 </p>
12807 !!end
12808
12809 !! article
12810 אַ
12811 !! text
12812 Test for unicode normalization
12813
12814 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12815 !! endarticle
12816
12817 !! test
12818 (bug 19451) Links should refer to the normalized form.
12819 !! wikitext
12820 [[&#xFB2E;]]
12821 [[&#x5d0;&#x5b7;]]
12822 [[&#x5d0;ַ]]
12823 [[א&#x5b7;]]
12824 [[אַ]]
12825 !! html
12826 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12827 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12828 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12829 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12830 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12831 </p>
12832 !! end
12833
12834 !! test
12835 Empty attribute crash test (bug 2067)
12836 !! wikitext
12837 <font color="">foo</font>
12838 !! html
12839 <p><font color="">foo</font>
12840 </p>
12841 !! end
12842
12843 !! test
12844 Empty attribute crash test single-quotes (bug 2067)
12845 !! wikitext
12846 <font color=''>foo</font>
12847 !! html
12848 <p><font color="">foo</font>
12849 </p>
12850 !! end
12851
12852 !! test
12853 Attribute test: equals, then nothing
12854 !! wikitext
12855 <font color=>foo</font>
12856 !! html
12857 <p><font>foo</font>
12858 </p>
12859 !! end
12860
12861 !! test
12862 Attribute test: unquoted value
12863 !! wikitext
12864 <font color=x>foo</font>
12865 !! html
12866 <p><font color="x">foo</font>
12867 </p>
12868 !! end
12869
12870 !! test
12871 Attribute test: unquoted but illegal value (hash)
12872 !! wikitext
12873 <font color=#x>foo</font>
12874 !! html
12875 <p><font color="#x">foo</font>
12876 </p>
12877 !! end
12878
12879 !! test
12880 Attribute test: no value
12881 !! wikitext
12882 <font color>foo</font>
12883 !! html
12884 <p><font color="color">foo</font>
12885 </p>
12886 !! end
12887
12888 !! test
12889 Bug 2095: link with three closing brackets
12890 !! wikitext
12891 [[Main Page]]]
12892 !! html/php
12893 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12894 </p>
12895 !! html/parsoid
12896 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12897 !! end
12898
12899 !! test
12900 Bug 2095: link with pipe and three closing brackets
12901 !! wikitext
12902 [[Main Page|link]]]
12903 !! html/php
12904 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12905 </p>
12906 !! html/parsoid
12907 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12908 !! end
12909
12910 !! test
12911 Bug 2095: link with pipe and three closing brackets, version 2
12912 !! wikitext
12913 [[Main Page|[http://example.com/]]]
12914 !! html/php
12915 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12916 </p>
12917 !! html/parsoid
12918 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12919 !! end
12920
12921
12922 ###
12923 ### Safety
12924 ###
12925
12926 !! article
12927 Template:Dangerous attribute
12928 !! text
12929 " onmouseover="alert(document.cookie)
12930 !! endarticle
12931
12932 !! article
12933 Template:Dangerous style attribute
12934 !! text
12935 border-size: expression(alert(document.cookie))
12936 !! endarticle
12937
12938 !! article
12939 Template:Div style
12940 !! text
12941 <div style="float: right; {{{1}}}">Magic div</div>
12942 !! endarticle
12943
12944 !! test
12945 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12946 !! wikitext
12947 <div title="{{test}}"></div>
12948 !! html
12949 <div title="This is a test template"></div>
12950
12951 !! end
12952
12953 !! test
12954 Bug 2304: HTML attribute safety (dangerous template; 2309)
12955 !! wikitext
12956 <div title="{{dangerous attribute}}"></div>
12957 !! html
12958 <div title=""></div>
12959
12960 !! end
12961
12962 !! test
12963 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12964 !! wikitext
12965 <div style="{{dangerous style attribute}}"></div>
12966 !! html
12967 <div style="/* insecure input */"></div>
12968
12969 !! end
12970
12971 !! test
12972 Bug 2304: HTML attribute safety (safe parameter; 2309)
12973 !! wikitext
12974 {{div style|width: 200px}}
12975 !! html
12976 <div style="float: right; width: 200px">Magic div</div>
12977
12978 !! end
12979
12980 !! test
12981 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12982 !! wikitext
12983 {{div style|width: expression(alert(document.cookie))}}
12984 !! html
12985 <div style="/* insecure input */">Magic div</div>
12986
12987 !! end
12988
12989 !! test
12990 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12991 !! wikitext
12992 {{div style|"><script>alert(document.cookie)</script>}}
12993 !! html
12994 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12995
12996 !! end
12997
12998 !! test
12999 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13000 !! wikitext
13001 {{div style|" ><script>alert(document.cookie)</script>}}
13002 !! html
13003 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13004
13005 !! end
13006
13007 !! test
13008 Bug 2304: HTML attribute safety (link)
13009 !! wikitext
13010 <div title="[[Main Page]]"></div>
13011 !! html
13012 <div title="&#91;&#91;Main Page]]"></div>
13013
13014 !! end
13015
13016 !! test
13017 Bug 2304: HTML attribute safety (italics)
13018 !! wikitext
13019 <div title="''foobar''"></div>
13020 !! html
13021 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13022
13023 !! end
13024
13025 !! test
13026 Bug 2304: HTML attribute safety (bold)
13027 !! wikitext
13028 <div title="'''foobar'''"></div>
13029 !! html
13030 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13031
13032 !! end
13033
13034
13035 !! test
13036 Bug 2304: HTML attribute safety (ISBN)
13037 !! wikitext
13038 <div title="ISBN 1234567890"></div>
13039 !! html
13040 <div title="&#73;SBN 1234567890"></div>
13041
13042 !! end
13043
13044 !! test
13045 Bug 2304: HTML attribute safety (RFC)
13046 !! wikitext
13047 <div title="RFC 1234"></div>
13048 !! html
13049 <div title="&#82;FC 1234"></div>
13050
13051 !! end
13052
13053 !! test
13054 Bug 2304: HTML attribute safety (PMID)
13055 !! wikitext
13056 <div title="PMID 1234567890"></div>
13057 !! html
13058 <div title="&#80;MID 1234567890"></div>
13059
13060 !! end
13061
13062 !! test
13063 Bug 2304: HTML attribute safety (web link)
13064 !! wikitext
13065 <div title="http://example.com/"></div>
13066 !! html
13067 <div title="http&#58;//example.com/"></div>
13068
13069 !! end
13070
13071 !! test
13072 Bug 2304: HTML attribute safety (named web link)
13073 !! wikitext
13074 <div title="[http://example.com/ link]"></div>
13075 !! html
13076 <div title="&#91;http&#58;//example.com/ link]"></div>
13077
13078 !! end
13079
13080 !! test
13081 Bug 3244: HTML attribute safety (extension; safe)
13082 !! wikitext
13083 <div style="<nowiki>background:blue</nowiki>"></div>
13084 !! html
13085 <div style="background:blue"></div>
13086
13087 !! end
13088
13089 !! test
13090 Bug 3244: HTML attribute safety (extension; unsafe)
13091 !! wikitext
13092 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13093 !! html
13094 <div style="/* insecure input */"></div>
13095
13096 !! end
13097
13098 # More MSIE fun discovered by Tom Gilder
13099
13100 !! test
13101 MSIE CSS safety test: spurious slash
13102 !! wikitext
13103 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13104 !! html
13105 <div style="/* insecure input */">evil</div>
13106
13107 !! end
13108
13109 !! test
13110 MSIE CSS safety test: hex code
13111 !! wikitext
13112 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13113 !! html
13114 <div style="/* insecure input */">evil</div>
13115
13116 !! end
13117
13118 !! test
13119 MSIE CSS safety test: comment in url
13120 !! wikitext
13121 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13122 !! html
13123 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13124
13125 !! end
13126
13127 !! test
13128 MSIE CSS safety test: comment in expression
13129 !! wikitext
13130 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13131 !! html
13132 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13133
13134 !! end
13135
13136 !! test
13137 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13138 !! wikitext
13139 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13140 !! html
13141 <p style="/* invalid control char */">A</p>
13142
13143 !! end
13144
13145 !! test
13146 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13147 !! wikitext
13148 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13149 <div style="top:EXPRESSION(alert())">B</div>
13150 !! html
13151 <p style="/* insecure input */">A</p>
13152 <div style="/* insecure input */">B</div>
13153
13154 !! end
13155
13156 !! test
13157 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13158 !! wikitext
13159 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13160 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13161 !! html
13162 <div style="/* insecure input */">A</div>
13163 <p style="/* insecure input */">B</p>
13164
13165 !! end
13166
13167 !! test
13168 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13169 !! wikitext
13170 <div style="background-image:url⁽javascript:alert())">A</div>
13171 <div style="background-image:url₍javascript:alert())">B</div>
13172 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13173 !! html
13174 <div style="/* insecure input */">A</div>
13175 <div style="/* insecure input */">B</div>
13176 <p style="/* insecure input */">C</p>
13177
13178 !! end
13179
13180 !! test
13181 Opera -o-link CSS
13182 !! wikitext
13183 <div
13184 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;"
13185 style="-o-link:attr(title);-o-link-source:current">X</div>
13186 !! html
13187 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13188
13189 !! end
13190
13191 !! test
13192 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13193 !! wikitext
13194 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13195 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13196 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13197 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13198 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13199 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13200 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13201 !! html
13202 <p style="/* insecure input */">A</p>
13203 <p style="/* insecure input */">B</p>
13204 <p style="/* insecure input */">C</p>
13205 <p style="/* insecure input */">D</p>
13206 <p style="/* insecure input */">E</p>
13207 <p style="/* insecure input */">F</p>
13208 <p style="/* insecure input */">G</p>
13209
13210 !! end
13211
13212 !! test
13213 Table attribute legitimate extension
13214 !! wikitext
13215 {|
13216 !+ style="<nowiki>color:blue</nowiki>"| status
13217 |}
13218 !! html
13219 <table>
13220 <tr>
13221 <th style="color:blue"> status
13222 </th></tr></table>
13223
13224 !!end
13225
13226 !! test
13227 Table attribute safety
13228 !! wikitext
13229 {|
13230 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13231 |}
13232 !! html
13233 <table>
13234 <tr>
13235 <th style="/* insecure input */"> status
13236 </th></tr></table>
13237
13238 !! end
13239
13240 !! test
13241 CSS line continuation 1
13242 !! wikitext
13243 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13244 !! html
13245 <div style="/* insecure input */"></div>
13246
13247 !! end
13248
13249 !! test
13250 CSS line continuation 2
13251 !! wikitext
13252 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13253 !! html
13254 <div style="/* insecure input */"></div>
13255
13256 !! end
13257
13258 !! article
13259 Template:Identity
13260 !! text
13261 {{{1}}}
13262 !! endarticle
13263
13264 !! test
13265 Expansion of multi-line templates in attribute values (bug 6255)
13266 !! wikitext
13267 <div style="background: {{identity|#00FF00}}">-</div>
13268 !! html
13269 <div style="background: #00FF00">-</div>
13270
13271 !! end
13272
13273
13274 !! test
13275 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13276 !! wikitext
13277 <div style="background:
13278 #00FF00">-</div>
13279 !! html
13280 <div style="background: #00FF00">-</div>
13281
13282 !! end
13283
13284 !! test
13285 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13286 !! wikitext
13287 <div style="background: &#10;#00FF00">-</div>
13288 !! html
13289 <div style="background: &#10;#00FF00">-</div>
13290
13291 !! end
13292
13293 ###
13294 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13295 ###
13296 !! test
13297 Parser hook: empty input
13298 !! wikitext
13299 <tag></tag>
13300 !! html
13301 <pre>
13302 ''
13303 array (
13304 )
13305 </pre>
13306
13307 !! end
13308
13309 !! test
13310 Parser hook: empty input using terminated empty elements
13311 !! wikitext
13312 <tag/>
13313 !! html
13314 <pre>
13315 NULL
13316 array (
13317 )
13318 </pre>
13319
13320 !! end
13321
13322 !! test
13323 Parser hook: empty input using terminated empty elements (space before)
13324 !! wikitext
13325 <tag />
13326 !! html
13327 <pre>
13328 NULL
13329 array (
13330 )
13331 </pre>
13332
13333 !! end
13334
13335 !! test
13336 Parser hook: basic input
13337 !! wikitext
13338 <tag>input</tag>
13339 !! html
13340 <pre>
13341 'input'
13342 array (
13343 )
13344 </pre>
13345
13346 !! end
13347
13348
13349 !! test
13350 Parser hook: case insensitive
13351 !! wikitext
13352 <TAG>input</TAG>
13353 !! html
13354 <pre>
13355 'input'
13356 array (
13357 )
13358 </pre>
13359
13360 !! end
13361
13362
13363 !! test
13364 Parser hook: case insensitive, redux
13365 !! wikitext
13366 <TaG>input</TAg>
13367 !! html
13368 <pre>
13369 'input'
13370 array (
13371 )
13372 </pre>
13373
13374 !! end
13375
13376 !! test
13377 Parser hook: nested tags
13378 !! options
13379 noxml
13380 !! wikitext
13381 <tag><tag></tag></tag>
13382 !! html
13383 <pre>
13384 '<tag>'
13385 array (
13386 )
13387 </pre>&lt;/tag&gt;
13388
13389 !! end
13390
13391 !! test
13392 Parser hook: basic arguments
13393 !! wikitext
13394 <tag width=200 height = "100" depth = '50' square></tag>
13395 !! html
13396 <pre>
13397 ''
13398 array (
13399 'width' => '200',
13400 'height' => '100',
13401 'depth' => '50',
13402 'square' => 'square',
13403 )
13404 </pre>
13405
13406 !! end
13407
13408 !! test
13409 Parser hook: argument containing a forward slash (bug 5344)
13410 !! wikitext
13411 <tag filename='/tmp/bla'></tag>
13412 !! html
13413 <pre>
13414 ''
13415 array (
13416 'filename' => '/tmp/bla',
13417 )
13418 </pre>
13419
13420 !! end
13421
13422 !! test
13423 Parser hook: empty input using terminated empty elements (bug 2374)
13424 !! wikitext
13425 <tag foo=bar/>text
13426 !! html
13427 <pre>
13428 NULL
13429 array (
13430 'foo' => 'bar',
13431 )
13432 </pre>text
13433
13434 !! end
13435
13436 # </tag> should be output literally since there is no matching tag that begins it
13437 !! test
13438 Parser hook: basic arguments using terminated empty elements (bug 2374)
13439 !! wikitext
13440 <tag width=200 height = "100" depth = '50' square/>
13441 other stuff
13442 </tag>
13443 !! html
13444 <pre>
13445 NULL
13446 array (
13447 'width' => '200',
13448 'height' => '100',
13449 'depth' => '50',
13450 'square' => 'square',
13451 )
13452 </pre>
13453 <p>other stuff
13454 &lt;/tag&gt;
13455 </p>
13456 !! end
13457
13458 ###
13459 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13460 ###
13461
13462 !! test
13463 Parser hook: static parser hook not inside a comment
13464 !! wikitext
13465 <statictag>hello, world</statictag>
13466 <statictag action=flush/>
13467 !! html
13468 <p>hello, world
13469 </p>
13470 !! end
13471
13472
13473 !! test
13474 Parser hook: static parser hook inside a comment
13475 !! wikitext
13476 <!-- <statictag>hello, world</statictag> -->
13477 <statictag action=flush/>
13478 !! html
13479 <p><br />
13480 </p>
13481 !! end
13482
13483 # Nested template calls; this case was broken by Parser.php rev 1.506,
13484 # since reverted.
13485
13486 !! article
13487 Template:One-parameter
13488 !! text
13489 (My parameter is: {{{1}}})
13490 !! endarticle
13491
13492 !! article
13493 Template:Map-one-parameter
13494 !! text
13495 {{{{{1}}}|{{{2}}}}}
13496 !! endarticle
13497
13498 !! test
13499 Nested template calls
13500 !! wikitext
13501 {{Map-one-parameter|One-parameter|param}}
13502 !! html
13503 <p>(My parameter is: param)
13504 </p>
13505 !! end
13506
13507
13508 ###
13509 ### Sanitizer
13510 ###
13511 !! test
13512 Sanitizer: Closing of open tags
13513 !! wikitext
13514 <s></s><table></table>
13515 !! html
13516 <s></s><table></table>
13517
13518 !! end
13519
13520 !! test
13521 Sanitizer: Closing of open but not closed tags
13522 !! wikitext
13523 <s>foo
13524 !! html
13525 <p><s>foo</s>
13526 </p>
13527 !! end
13528
13529 !! test
13530 Sanitizer: Closing of closed but not open tags
13531 !! wikitext
13532 </s>
13533 !! html
13534 <p>&lt;/s&gt;
13535 </p>
13536 !! end
13537
13538 !! test
13539 Sanitizer: Closing of closed but not open table tags
13540 !! wikitext
13541 Table not started</td></tr></table>
13542 !! html
13543 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13544 </p>
13545 !! end
13546
13547 !! test
13548 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13549 !! wikitext
13550 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13551 !! html
13552 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13553 </p>
13554 !! end
13555
13556 !! test
13557 Sanitizer: Validating the contents of the id attribute (bug 4515)
13558 !! options
13559 disabled
13560 !! wikitext
13561 <br id=9 />
13562 !! html
13563 Something, but definitely not <br id="9" />...
13564 !! end
13565
13566 !! test
13567 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13568 !! options
13569 disabled
13570 !! wikitext
13571 <br id="foo" /><br id="foo" />
13572 !! html
13573 Something need to be done. foo-2 ?
13574 !! end
13575
13576 !! test
13577 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13578 !! wikitext
13579 <div itemscope>
13580 <meta itemprop="hello" content="world">
13581 <meta http-equiv="refresh" content="5">
13582 <meta itemprop="hello" http-equiv="refresh" content="5">
13583 <link itemprop="hello" href="{{SERVER}}">
13584 <link rel="stylesheet" href="{{SERVER}}">
13585 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13586 </div>
13587 !! html
13588 <div itemscope="itemscope">
13589 <p> <meta itemprop="hello" content="world" />
13590 &lt;meta http-equiv="refresh" content="5"&gt;
13591 <meta itemprop="hello" content="5" />
13592 </p>
13593 <link itemprop="hello" href="http&#58;//example.org" />
13594 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13595 <link itemprop="hello" href="http&#58;//example.org" />
13596 </div>
13597
13598 !! end
13599
13600 !! test
13601 Language converter: output gets cut off unexpectedly (bug 5757)
13602 !! options
13603 language=zh
13604 !! wikitext
13605 this bit is safe: }-
13606
13607 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13608
13609 then we get cut off here: }-
13610
13611 all additional text is vanished
13612 !! html
13613 <p>this bit is safe: }-
13614 </p><p>but if we add a conversion instance: xxx
13615 </p><p>then we get cut off here: }-
13616 </p><p>all additional text is vanished
13617 </p>
13618 !! end
13619
13620 !! test
13621 Self closed html pairs (bug 5487)
13622 !! options
13623 !! wikitext
13624 <center><font id="bug" />Centered text</center>
13625 <div><font id="bug2" />In div text</div>
13626 !! html
13627 <center>&lt;font id="bug" /&gt;Centered text</center>
13628 <div>&lt;font id="bug2" /&gt;In div text</div>
13629
13630 !! end
13631
13632 #
13633 #
13634 #
13635
13636 !! test
13637 Punctuation: nbsp before exclamation
13638 !! wikitext
13639 C'est grave !
13640 !! html
13641 <p>C'est grave&#160;!
13642 </p>
13643 !! end
13644
13645 !! test
13646 Punctuation: CSS !important (bug 11874)
13647 !! wikitext
13648 <div style="width:50% !important">important</div>
13649 !! html
13650 <div style="width:50% !important">important</div>
13651
13652 !!end
13653
13654 !! test
13655 Punctuation: CSS ! important (bug 11874; with space after)
13656 !! wikitext
13657 <div style="width:50% ! important">important</div>
13658 !! html
13659 <div style="width:50% ! important">important</div>
13660
13661 !!end
13662
13663
13664 !! test
13665 HTML bullet list, closed tags (bug 5497)
13666 !! wikitext
13667 <ul>
13668 <li>One</li>
13669 <li>Two</li>
13670 </ul>
13671 !! html
13672 <ul>
13673 <li>One</li>
13674 <li>Two</li>
13675 </ul>
13676
13677 !! end
13678
13679 !! test
13680 HTML bullet list, unclosed tags (bug 5497)
13681 !! options
13682 disabled
13683 !! wikitext
13684 <ul>
13685 <li>One
13686 <li>Two
13687 </ul>
13688 !! html
13689 <ul>
13690 <li>One
13691 </li>
13692 <li>Two
13693 </li>
13694 </ul>
13695
13696 !! end
13697
13698 !! test
13699 HTML ordered list, closed tags (bug 5497)
13700 !! wikitext
13701 <ol>
13702 <li>One</li>
13703 <li>Two</li>
13704 </ol>
13705 !! html
13706 <ol>
13707 <li>One</li>
13708 <li>Two</li>
13709 </ol>
13710
13711 !! end
13712
13713 !! test
13714 HTML ordered list, unclosed tags (bug 5497)
13715 !! options
13716 disabled
13717 !! wikitext
13718 <ol>
13719 <li>One
13720 <li>Two
13721 </ol>
13722 !! html
13723 <ol>
13724 <li>One
13725 </li>
13726 <li>Two
13727 </li>
13728 </ol>
13729
13730 !! end
13731
13732 !! test
13733 HTML nested bullet list, closed tags (bug 5497)
13734 !! wikitext
13735 <ul>
13736 <li>One</li>
13737 <li>Two:
13738 <ul>
13739 <li>Sub-one</li>
13740 <li>Sub-two</li>
13741 </ul>
13742 </li>
13743 </ul>
13744 !! html
13745 <ul>
13746 <li>One</li>
13747 <li>Two:
13748 <ul>
13749 <li>Sub-one</li>
13750 <li>Sub-two</li>
13751 </ul>
13752 </li>
13753 </ul>
13754
13755 !! end
13756
13757 !! test
13758 HTML nested bullet list, open tags (bug 5497)
13759 !! options
13760 disabled
13761 !! wikitext
13762 <ul>
13763 <li>One
13764 <li>Two:
13765 <ul>
13766 <li>Sub-one
13767 <li>Sub-two
13768 </ul>
13769 </ul>
13770 !! html
13771 <ul>
13772 <li>One
13773 </li>
13774 <li>Two:
13775 <ul>
13776 <li>Sub-one
13777 </li>
13778 <li>Sub-two
13779 </li>
13780 </ul>
13781 </li>
13782 </ul>
13783
13784 !! end
13785
13786 !! test
13787 HTML nested ordered list, closed tags (bug 5497)
13788 !! wikitext
13789 <ol>
13790 <li>One</li>
13791 <li>Two:
13792 <ol>
13793 <li>Sub-one</li>
13794 <li>Sub-two</li>
13795 </ol>
13796 </li>
13797 </ol>
13798 !! html
13799 <ol>
13800 <li>One</li>
13801 <li>Two:
13802 <ol>
13803 <li>Sub-one</li>
13804 <li>Sub-two</li>
13805 </ol>
13806 </li>
13807 </ol>
13808
13809 !! end
13810
13811 !! test
13812 HTML nested ordered list, open tags (bug 5497)
13813 !! options
13814 disabled
13815 !! wikitext
13816 <ol>
13817 <li>One
13818 <li>Two:
13819 <ol>
13820 <li>Sub-one
13821 <li>Sub-two
13822 </ol>
13823 </ol>
13824 !! html
13825 <ol>
13826 <li>One
13827 </li>
13828 <li>Two:
13829 <ol>
13830 <li>Sub-one
13831 </li>
13832 <li>Sub-two
13833 </li>
13834 </ol>
13835 </li>
13836 </ol>
13837
13838 !! end
13839
13840 !! test
13841 HTML ordered list item with parameters oddity
13842 !! wikitext
13843 <ol><li id="fragment">One</li>
13844 </ol>
13845 !! html
13846 <ol><li id="fragment">One</li>
13847 </ol>
13848
13849 !! end
13850
13851 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13852 !!test
13853 bug 5918: autonumbering
13854 !! wikitext
13855 [http://first/] [http://second] [ftp://ftp]
13856
13857 ftp://inlineftp
13858
13859 [mailto:enclosed@mail.tld With target]
13860
13861 [mailto:enclosed@mail.tld]
13862
13863 mailto:inline@mail.tld
13864 !! html/php
13865 <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>
13866 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13867 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13868 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13869 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13870 </p>
13871 !! html/parsoid
13872 <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>
13873 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13874 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13875 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13876 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13877 !! end
13878
13879
13880 #
13881 # Security and HTML correctness
13882 # From Nick Jenkins' fuzz testing
13883 #
13884
13885 !! test
13886 Fuzz testing: Parser13
13887 !! wikitext
13888 {|
13889 | http://a|
13890 !! html
13891 <table>
13892 <tr>
13893 <td>
13894 </td>
13895 </tr>
13896 </table>
13897
13898 !! end
13899
13900 !! test
13901 Fuzz testing: Parser14
13902 !! wikitext
13903 == onmouseover= ==
13904 http://__TOC__
13905 !! html
13906 <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>
13907 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13908 <ul>
13909 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13910 </ul>
13911 </div>
13912
13913
13914 !! end
13915
13916 !! test
13917 Fuzz testing: Parser14-table
13918 !! wikitext
13919 ==a==
13920 {| STYLE=__TOC__
13921 !! html
13922 <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>
13923 <table style="&#95;_TOC&#95;_">
13924 <tr><td></td></tr>
13925 </table>
13926
13927 !! end
13928
13929 # Known to produce bogus xml (extra </td>)
13930 !! test
13931 Fuzz testing: Parser16
13932 !! options
13933 noxml
13934 !! wikitext
13935 {|
13936 !https://||||||
13937 !! html
13938 <table>
13939 <tr>
13940 <th>https://</th>
13941 <th></th>
13942 <th></th>
13943 <th>
13944 </td>
13945 </tr>
13946 </table>
13947
13948 !! end
13949
13950 !! test
13951 Fuzz testing: Parser21
13952 !! wikitext
13953 {|
13954 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13955 |
13956 !! html
13957 <table>
13958 <tr>
13959 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13960 </th>
13961 <td>
13962 </td>
13963 </tr>
13964 </table>
13965
13966 !! end
13967
13968 !! test
13969 Fuzz testing: Parser22
13970 !! wikitext
13971 http://===r:::https://b
13972
13973 {|
13974 !! html
13975 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13976 </p>
13977 <table>
13978 <tr><td></td></tr>
13979 </table>
13980
13981 !! end
13982
13983 # Known to produce bad XML for now
13984 !! test
13985 Fuzz testing: Parser24
13986 !! options
13987 noxml
13988 !! wikitext
13989 {|
13990 {{{|
13991 <u CLASS=
13992 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13993 <br style="onmouseover='alert(document.cookie);' " />
13994
13995 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13996 |
13997 !! html
13998 <table>
13999 {{{|
14000 <u class="&#124;">}}}} &gt;
14001 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14002
14003 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14004 <tr>
14005 <td></u>
14006 </td>
14007 </tr>
14008 </table>
14009
14010 !! end
14011
14012 # Note: the current result listed for this is not what the original one was,
14013 # but the original bug was JavaScript injection, which is fixed in any case.
14014 # It's not clear that the original result listed was any more correct than the
14015 # current one. Original result:
14016 # <p>{{{|
14017 # </p>
14018 # <li class="&#124;&#124;">
14019 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14020 !!test
14021 Fuzz testing: Parser25 (bug 6055)
14022 !! wikitext
14023 {{{
14024 |
14025 <LI CLASS=||
14026 >
14027 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14028 !! html
14029 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14030 </p>
14031 !! end
14032
14033 !!test
14034 Fuzz testing: URL adjacent extension (with space, clean)
14035 !! options
14036 !! wikitext
14037 http://example.com <nowiki>junk</nowiki>
14038 !! html
14039 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14040 </p>
14041 !!end
14042
14043 !!test
14044 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14045 !! options
14046 !! wikitext
14047 http://example.com<nowiki>junk</nowiki>
14048 !! html
14049 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14050 </p>
14051 !!end
14052
14053 !!test
14054 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14055 !! options
14056 !! wikitext
14057 http://example.com<pre>junk</pre>
14058 !! html
14059 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14060
14061 !!end
14062
14063 !!test
14064 Fuzz testing: image with bogus manual thumbnail
14065 !! wikitext
14066 [[Image:foobar.jpg|thumbnail= ]]
14067 !! html/php
14068 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14069
14070 !! html/parsoid
14071 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14072 !!end
14073
14074 !! test
14075 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14076 !! wikitext
14077 <pre dir="&#10;"></pre>
14078 !! html
14079 <pre dir="&#10;"></pre>
14080
14081 !! end
14082
14083 !! test
14084 Parsing optional HTML elements (Bug 6171)
14085 !! options
14086 !! wikitext
14087 <table>
14088 <tr>
14089 <td> Some tabular data</td>
14090 <td> More tabular data ...
14091 <td> And yet som tabular data</td>
14092 </tr>
14093 </table>
14094 !! html
14095 <table>
14096 <tr>
14097 <td> Some tabular data</td>
14098 <td> More tabular data ...
14099 </td><td> And yet som tabular data</td>
14100 </tr>
14101 </table>
14102
14103 !! end
14104
14105 !! test
14106 Correct handling of <td>, <tr> (Bug 6171)
14107 !! options
14108 !! wikitext
14109 <table>
14110 <tr>
14111 <td> Some tabular data</td>
14112 <td> More tabular data ...</td>
14113 <td> And yet som tabular data</td>
14114 </tr>
14115 </table>
14116 !! html
14117 <table>
14118 <tr>
14119 <td> Some tabular data</td>
14120 <td> More tabular data ...</td>
14121 <td> And yet som tabular data</td>
14122 </tr>
14123 </table>
14124
14125 !! end
14126
14127
14128 !! test
14129 Parsing crashing regression (fr:JavaScript)
14130 !! wikitext
14131 </body></x>
14132 !! html
14133 <p>&lt;/body&gt;&lt;/x&gt;
14134 </p>
14135 !! end
14136
14137 !! test
14138 Inline wiki vs wiki block nesting
14139 !! wikitext
14140 '''Bold paragraph
14141
14142 New wiki paragraph
14143 !! html
14144 <p><b>Bold paragraph</b>
14145 </p><p>New wiki paragraph
14146 </p>
14147 !! end
14148
14149 !! test
14150 Inline HTML vs wiki block nesting
14151 !! options
14152 disabled
14153 !! wikitext
14154 <b>Bold paragraph
14155
14156 New wiki paragraph
14157 !! html
14158 <p><b>Bold paragraph</b>
14159 </p><p>New wiki paragraph
14160 </p>
14161 !! end
14162
14163 # Original result was this:
14164 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14165 # </p>
14166 # While that might be marginally more intuitive, maybe, the six-apostrophe
14167 # construct is clearly pathological and the result stated here (which is what
14168 # the parser actually does) is about as reasonable as anything.
14169 !!test
14170 Mixing markup for italics and bold
14171 !! options
14172 !! wikitext
14173 '''bold''''''bold''bolditalics'''''
14174 !! html
14175 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14176 </p>
14177 !! end
14178
14179
14180 !! article
14181 Xyzzyx
14182 !! text
14183 Article for special page transclusion test
14184 !! endarticle
14185
14186 !! test
14187 Special page transclusion
14188 !! options
14189 !! wikitext
14190 {{Special:Prefixindex/Xyzzyx}}
14191 !! html
14192 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14193
14194 !! end
14195
14196 !! test
14197 Special page transclusion twice (bug 5021)
14198 !! options
14199 !! wikitext
14200 {{Special:Prefixindex/Xyzzyx}}
14201 {{Special:Prefixindex/Xyzzyx}}
14202 !! html
14203 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14204 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14205
14206 !! end
14207
14208 !! test
14209 Transclusion of default MediaWiki message
14210 !! wikitext
14211 {{MediaWiki:Mainpage}}
14212 !! html
14213 <p>Main Page
14214 </p>
14215 !! end
14216
14217 !! test
14218 Transclusion of nonexistent MediaWiki message
14219 !! wikitext
14220 {{MediaWiki:Mainpagexxx}}
14221 !! html
14222 <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>
14223 </p>
14224 !! end
14225
14226 !! test
14227 Transclusion of MediaWiki message with underscore
14228 !! wikitext
14229 {{MediaWiki:history_short}}
14230 !! html
14231 <p>History
14232 </p>
14233 !! end
14234
14235 !! test
14236 Transclusion of MediaWiki message with space
14237 !! wikitext
14238 {{MediaWiki:history short}}
14239 !! html
14240 <p>History
14241 </p>
14242 !! end
14243
14244 !! test
14245 Invalid header with following text
14246 !! wikitext
14247 = x = y
14248 !! html
14249 <p>= x = y
14250 </p>
14251 !! end
14252
14253
14254 !! test
14255 Section extraction test (section 0)
14256 !! options
14257 section=0
14258 !! wikitext
14259 start
14260 ==a==
14261 ===aa===
14262 ====aaa====
14263 ==b==
14264 ===ba===
14265 ===bb===
14266 ====bba====
14267 ===bc===
14268 ==c==
14269 ===ca===
14270 !! html
14271 start
14272 !! end
14273
14274 !! test
14275 Section extraction test (section 1)
14276 !! options
14277 section=1
14278 !! wikitext
14279 start
14280 ==a==
14281 ===aa===
14282 ====aaa====
14283 ==b==
14284 ===ba===
14285 ===bb===
14286 ====bba====
14287 ===bc===
14288 ==c==
14289 ===ca===
14290 !! html
14291 ==a==
14292 ===aa===
14293 ====aaa====
14294 !! end
14295
14296 !! test
14297 Section extraction test (section 2)
14298 !! options
14299 section=2
14300 !! wikitext
14301 start
14302 ==a==
14303 ===aa===
14304 ====aaa====
14305 ==b==
14306 ===ba===
14307 ===bb===
14308 ====bba====
14309 ===bc===
14310 ==c==
14311 ===ca===
14312 !! html
14313 ===aa===
14314 ====aaa====
14315 !! end
14316
14317 !! test
14318 Section extraction test (section 3)
14319 !! options
14320 section=3
14321 !! wikitext
14322 start
14323 ==a==
14324 ===aa===
14325 ====aaa====
14326 ==b==
14327 ===ba===
14328 ===bb===
14329 ====bba====
14330 ===bc===
14331 ==c==
14332 ===ca===
14333 !! html
14334 ====aaa====
14335 !! end
14336
14337 !! test
14338 Section extraction test (section 4)
14339 !! options
14340 section=4
14341 !! wikitext
14342 start
14343 ==a==
14344 ===aa===
14345 ====aaa====
14346 ==b==
14347 ===ba===
14348 ===bb===
14349 ====bba====
14350 ===bc===
14351 ==c==
14352 ===ca===
14353 !! html
14354 ==b==
14355 ===ba===
14356 ===bb===
14357 ====bba====
14358 ===bc===
14359 !! end
14360
14361 !! test
14362 Section extraction test (section 5)
14363 !! options
14364 section=5
14365 !! wikitext
14366 start
14367 ==a==
14368 ===aa===
14369 ====aaa====
14370 ==b==
14371 ===ba===
14372 ===bb===
14373 ====bba====
14374 ===bc===
14375 ==c==
14376 ===ca===
14377 !! html
14378 ===ba===
14379 !! end
14380
14381 !! test
14382 Section extraction test (section 6)
14383 !! options
14384 section=6
14385 !! wikitext
14386 start
14387 ==a==
14388 ===aa===
14389 ====aaa====
14390 ==b==
14391 ===ba===
14392 ===bb===
14393 ====bba====
14394 ===bc===
14395 ==c==
14396 ===ca===
14397 !! html
14398 ===bb===
14399 ====bba====
14400 !! end
14401
14402 !! test
14403 Section extraction test (section 7)
14404 !! options
14405 section=7
14406 !! wikitext
14407 start
14408 ==a==
14409 ===aa===
14410 ====aaa====
14411 ==b==
14412 ===ba===
14413 ===bb===
14414 ====bba====
14415 ===bc===
14416 ==c==
14417 ===ca===
14418 !! html
14419 ====bba====
14420 !! end
14421
14422 !! test
14423 Section extraction test (section 8)
14424 !! options
14425 section=8
14426 !! wikitext
14427 start
14428 ==a==
14429 ===aa===
14430 ====aaa====
14431 ==b==
14432 ===ba===
14433 ===bb===
14434 ====bba====
14435 ===bc===
14436 ==c==
14437 ===ca===
14438 !! html
14439 ===bc===
14440 !! end
14441
14442 !! test
14443 Section extraction test (section 9)
14444 !! options
14445 section=9
14446 !! wikitext
14447 start
14448 ==a==
14449 ===aa===
14450 ====aaa====
14451 ==b==
14452 ===ba===
14453 ===bb===
14454 ====bba====
14455 ===bc===
14456 ==c==
14457 ===ca===
14458 !! html
14459 ==c==
14460 ===ca===
14461 !! end
14462
14463 !! test
14464 Section extraction test (section 10)
14465 !! options
14466 section=10
14467 !! wikitext
14468 start
14469 ==a==
14470 ===aa===
14471 ====aaa====
14472 ==b==
14473 ===ba===
14474 ===bb===
14475 ====bba====
14476 ===bc===
14477 ==c==
14478 ===ca===
14479 !! html
14480 ===ca===
14481 !! end
14482
14483 !! test
14484 Section extraction test (nonexistent section 11)
14485 !! options
14486 section=11
14487 !! wikitext
14488 start
14489 ==a==
14490 ===aa===
14491 ====aaa====
14492 ==b==
14493 ===ba===
14494 ===bb===
14495 ====bba====
14496 ===bc===
14497 ==c==
14498 ===ca===
14499 !! html
14500 !! end
14501
14502 !! test
14503 Section extraction test with bogus heading (section 1)
14504 !! options
14505 section=1
14506 !! wikitext
14507 ==a==
14508 ==bogus== not a legal section
14509 ==b==
14510 !! html
14511 ==a==
14512 ==bogus== not a legal section
14513 !! end
14514
14515 !! test
14516 Section extraction test with bogus heading (section 2)
14517 !! options
14518 section=2
14519 !! wikitext
14520 ==a==
14521 ==bogus== not a legal section
14522 ==b==
14523 !! html
14524 ==b==
14525 !! end
14526
14527 !! test
14528 Section extraction test with comment after heading (section 1)
14529 !! options
14530 section=1
14531 !! wikitext
14532 ==a==
14533 ==b== <!-- -->
14534 ==c==
14535 !! html
14536 ==a==
14537 !! end
14538
14539 !! test
14540 Section extraction test with comment after heading (section 2)
14541 !! options
14542 section=2
14543 !! wikitext
14544 ==a==
14545 ==b== <!-- -->
14546 ==c==
14547 !! html
14548 ==b== <!-- -->
14549 !! end
14550
14551 !! test
14552 Section extraction test with bogus <nowiki> heading (section 1)
14553 !! options
14554 section=1
14555 !! wikitext
14556 ==a==
14557 ==bogus== <nowiki>not a legal section</nowiki>
14558 ==b==
14559 !! html
14560 ==a==
14561 ==bogus== <nowiki>not a legal section</nowiki>
14562 !! end
14563
14564 !! test
14565 Section extraction test with bogus <nowiki> heading (section 2)
14566 !! options
14567 section=2
14568 !! wikitext
14569 ==a==
14570 ==bogus== <nowiki>not a legal section</nowiki>
14571 ==b==
14572 !! html
14573 ==b==
14574 !! end
14575
14576
14577 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14578 # instead of respecting commented sections
14579 !! test
14580 Section extraction prefixed by comment (section 1)
14581 !! options
14582 section=1
14583 !! wikitext
14584 <!-- -->==sec1==
14585 ==sec2==
14586 !! html
14587 ==sec2==
14588 !!end
14589
14590 !! test
14591 Section extraction prefixed by comment (section 2)
14592 !! options
14593 section=2
14594 !! wikitext
14595 <!-- -->==sec1==
14596 ==sec2==
14597 !! html
14598
14599 !!end
14600
14601
14602 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14603 # instead of respecting HTML-style headings
14604 !! test
14605 Section extraction, mixed wiki and html (section 1)
14606 !! options
14607 section=1
14608 !! wikitext
14609 <h2>unmarked</h2>
14610 unmarked
14611 ==1==
14612 one
14613 ==2==
14614 two
14615 !! html
14616 ==1==
14617 one
14618 !! end
14619
14620 !! test
14621 Section extraction, mixed wiki and html (section 2)
14622 !! options
14623 section=2
14624 !! wikitext
14625 <h2>unmarked</h2>
14626 unmarked
14627 ==1==
14628 one
14629 ==2==
14630 two
14631 !! html
14632 ==2==
14633 two
14634 !! end
14635
14636
14637 # Formerly testing for bug 3342
14638 !! test
14639 Section extraction, heading surrounded by <noinclude>
14640 !! options
14641 section=1
14642 !! wikitext
14643 <noinclude>==unmarked==</noinclude>
14644 ==marked==
14645 !! html
14646 ==marked==
14647 !!end
14648
14649 # Test behavior of bug 19910
14650 !! test
14651 Sectiion with all-equals
14652 !! options
14653 section=2
14654 !! wikitext
14655 ===
14656 The line above must have a trailing space
14657 === <!--
14658 --> <!-- -->
14659 But just in case it doesn't...
14660 !! html
14661 === <!--
14662 --> <!-- -->
14663 But just in case it doesn't...
14664 !! end
14665
14666 !! test
14667 Section replacement test (section 0)
14668 !! options
14669 replace=0,"xxx"
14670 !! wikitext
14671 start
14672 ==a==
14673 ===aa===
14674 ====aaa====
14675 ==b==
14676 ===ba===
14677 ===bb===
14678 ====bba====
14679 ===bc===
14680 ==c==
14681 ===ca===
14682 !! html
14683 xxx
14684
14685 ==a==
14686 ===aa===
14687 ====aaa====
14688 ==b==
14689 ===ba===
14690 ===bb===
14691 ====bba====
14692 ===bc===
14693 ==c==
14694 ===ca===
14695 !! end
14696
14697 !! test
14698 Section replacement test (section 1)
14699 !! options
14700 replace=1,"xxx"
14701 !! wikitext
14702 start
14703 ==a==
14704 ===aa===
14705 ====aaa====
14706 ==b==
14707 ===ba===
14708 ===bb===
14709 ====bba====
14710 ===bc===
14711 ==c==
14712 ===ca===
14713 !! html
14714 start
14715 xxx
14716
14717 ==b==
14718 ===ba===
14719 ===bb===
14720 ====bba====
14721 ===bc===
14722 ==c==
14723 ===ca===
14724 !! end
14725
14726 !! test
14727 Section replacement test (section 2)
14728 !! options
14729 replace=2,"xxx"
14730 !! wikitext
14731 start
14732 ==a==
14733 ===aa===
14734 ====aaa====
14735 ==b==
14736 ===ba===
14737 ===bb===
14738 ====bba====
14739 ===bc===
14740 ==c==
14741 ===ca===
14742 !! html
14743 start
14744 ==a==
14745 xxx
14746
14747 ==b==
14748 ===ba===
14749 ===bb===
14750 ====bba====
14751 ===bc===
14752 ==c==
14753 ===ca===
14754 !! end
14755
14756 !! test
14757 Section replacement test (section 3)
14758 !! options
14759 replace=3,"xxx"
14760 !! wikitext
14761 start
14762 ==a==
14763 ===aa===
14764 ====aaa====
14765 ==b==
14766 ===ba===
14767 ===bb===
14768 ====bba====
14769 ===bc===
14770 ==c==
14771 ===ca===
14772 !! html
14773 start
14774 ==a==
14775 ===aa===
14776 xxx
14777
14778 ==b==
14779 ===ba===
14780 ===bb===
14781 ====bba====
14782 ===bc===
14783 ==c==
14784 ===ca===
14785 !! end
14786
14787 !! test
14788 Section replacement test (section 4)
14789 !! options
14790 replace=4,"xxx"
14791 !! wikitext
14792 start
14793 ==a==
14794 ===aa===
14795 ====aaa====
14796 ==b==
14797 ===ba===
14798 ===bb===
14799 ====bba====
14800 ===bc===
14801 ==c==
14802 ===ca===
14803 !! html
14804 start
14805 ==a==
14806 ===aa===
14807 ====aaa====
14808 xxx
14809
14810 ==c==
14811 ===ca===
14812 !! end
14813
14814 !! test
14815 Section replacement test (section 5)
14816 !! options
14817 replace=5,"xxx"
14818 !! wikitext
14819 start
14820 ==a==
14821 ===aa===
14822 ====aaa====
14823 ==b==
14824 ===ba===
14825 ===bb===
14826 ====bba====
14827 ===bc===
14828 ==c==
14829 ===ca===
14830 !! html
14831 start
14832 ==a==
14833 ===aa===
14834 ====aaa====
14835 ==b==
14836 xxx
14837
14838 ===bb===
14839 ====bba====
14840 ===bc===
14841 ==c==
14842 ===ca===
14843 !! end
14844
14845 !! test
14846 Section replacement test (section 6)
14847 !! options
14848 replace=6,"xxx"
14849 !! wikitext
14850 start
14851 ==a==
14852 ===aa===
14853 ====aaa====
14854 ==b==
14855 ===ba===
14856 ===bb===
14857 ====bba====
14858 ===bc===
14859 ==c==
14860 ===ca===
14861 !! html
14862 start
14863 ==a==
14864 ===aa===
14865 ====aaa====
14866 ==b==
14867 ===ba===
14868 xxx
14869
14870 ===bc===
14871 ==c==
14872 ===ca===
14873 !! end
14874
14875 !! test
14876 Section replacement test (section 7)
14877 !! options
14878 replace=7,"xxx"
14879 !! wikitext
14880 start
14881 ==a==
14882 ===aa===
14883 ====aaa====
14884 ==b==
14885 ===ba===
14886 ===bb===
14887 ====bba====
14888 ===bc===
14889 ==c==
14890 ===ca===
14891 !! html
14892 start
14893 ==a==
14894 ===aa===
14895 ====aaa====
14896 ==b==
14897 ===ba===
14898 ===bb===
14899 xxx
14900
14901 ===bc===
14902 ==c==
14903 ===ca===
14904 !! end
14905
14906 !! test
14907 Section replacement test (section 8)
14908 !! options
14909 replace=8,"xxx"
14910 !! wikitext
14911 start
14912 ==a==
14913 ===aa===
14914 ====aaa====
14915 ==b==
14916 ===ba===
14917 ===bb===
14918 ====bba====
14919 ===bc===
14920 ==c==
14921 ===ca===
14922 !! html
14923 start
14924 ==a==
14925 ===aa===
14926 ====aaa====
14927 ==b==
14928 ===ba===
14929 ===bb===
14930 ====bba====
14931 xxx
14932
14933 ==c==
14934 ===ca===
14935 !!end
14936
14937 !! test
14938 Section replacement test (section 9)
14939 !! options
14940 replace=9,"xxx"
14941 !! wikitext
14942 start
14943 ==a==
14944 ===aa===
14945 ====aaa====
14946 ==b==
14947 ===ba===
14948 ===bb===
14949 ====bba====
14950 ===bc===
14951 ==c==
14952 ===ca===
14953 !! html
14954 start
14955 ==a==
14956 ===aa===
14957 ====aaa====
14958 ==b==
14959 ===ba===
14960 ===bb===
14961 ====bba====
14962 ===bc===
14963 xxx
14964 !! end
14965
14966 !! test
14967 Section replacement test (section 10)
14968 !! options
14969 replace=10,"xxx"
14970 !! wikitext
14971 start
14972 ==a==
14973 ===aa===
14974 ====aaa====
14975 ==b==
14976 ===ba===
14977 ===bb===
14978 ====bba====
14979 ===bc===
14980 ==c==
14981 ===ca===
14982 !! html
14983 start
14984 ==a==
14985 ===aa===
14986 ====aaa====
14987 ==b==
14988 ===ba===
14989 ===bb===
14990 ====bba====
14991 ===bc===
14992 ==c==
14993 xxx
14994 !! end
14995
14996 !! test
14997 Section replacement test with initial whitespace (bug 13728)
14998 !! options
14999 replace=2,"xxx"
15000 !! wikitext
15001 Preformatted initial line
15002 ==a==
15003 ===a===
15004 !! html
15005 Preformatted initial line
15006 ==a==
15007 xxx
15008 !! end
15009
15010
15011 !! test
15012 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15013 !! options
15014 section=1
15015 !! wikitext
15016 ==a==
15017 a
15018 !! html
15019 ==a==
15020 a
15021 !! end
15022
15023 !! test
15024 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15025 !! options
15026 section=1
15027 !! wikitext
15028 ==a==
15029 a
15030 !! html
15031 ==a==
15032 a
15033 !! end
15034
15035
15036 !! test
15037 Section extraction, <pre> around bogus header (bug 10309)
15038 !! options
15039 noxml section=2
15040 !! wikitext
15041 == Section One ==
15042 <pre>
15043 =======
15044 </pre>
15045
15046 == Section Two ==
15047 stuff
15048 !! html
15049 == Section Two ==
15050 stuff
15051 !! end
15052
15053 !! test
15054 Section replacement, <pre> around bogus header (bug 10309)
15055 !! options
15056 noxml replace=2,"xxx"
15057 !! wikitext
15058 == Section One ==
15059 <pre>
15060 =======
15061 </pre>
15062
15063 == Section Two ==
15064 stuff
15065 !! html
15066 == Section One ==
15067 <pre>
15068 =======
15069 </pre>
15070
15071 xxx
15072 !! end
15073
15074
15075
15076 !! test
15077 Handling of &#x0A; in URLs
15078 !! wikitext
15079 ** irc://&#x0A;a
15080 !! html/php
15081 <ul>
15082 <li><ul>
15083 <li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
15084 </li>
15085 </ul>
15086 </li>
15087 </ul>
15088
15089 !! html/parsoid
15090 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15091 a">irc://
15092 a</a></li></ul></li></ul>
15093 !! end
15094
15095 !! test
15096 Handling of %0A in URLs
15097 !! wikitext
15098 ** irc://%0Aa
15099 !! html/php
15100 <ul>
15101 <li><ul>
15102 <li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
15103 </li>
15104 </ul>
15105 </li>
15106 </ul>
15107
15108 !! html/parsoid
15109 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15110 !! end
15111
15112
15113 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15114 !! test
15115 5 quotes, code coverage +1 line
15116 !! options
15117 parsoid=wt2html
15118 !! wikitext
15119 '''''
15120 !! html/php
15121 !! html/parsoid
15122 <p><b><i></i></b></p>
15123 !! end
15124
15125 # same html as previous, but wikitext adjusted to match parsoid html2wt
15126 # note that wt2html and html2html will put the <i> before the <b>
15127 !! test
15128 5 quotes, code coverage +1 line w/ nowiki (1)
15129 !! options
15130 parsoid=wt2wt,html2wt
15131 !! wikitext
15132 '''''<nowiki/>'''''
15133 !! html/php
15134 <p><i></i>
15135 </p>
15136 !! html/parsoid
15137 <p><b><i></i></b></p>
15138 !! end
15139
15140 # same as previous, just swapping the <i> and <b>
15141 !! test
15142 5 quotes, code coverage +1 line w/ nowiki (2)
15143 !! wikitext
15144 '''''<nowiki/>'''''
15145 !! html/php
15146 <p><i></i>
15147 </p>
15148 !! html/parsoid
15149 <p><i><b></b></i></p>
15150 !! end
15151
15152 !! test
15153 Special:Search page linking.
15154 !! wikitext
15155 {{Special:search}}
15156 !! html
15157 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15158 </p>
15159 !! end
15160
15161 !! test
15162 Say the magic word
15163 !! options
15164 title=[[Parser test]]
15165 !! wikitext
15166 * {{PAGENAME}}
15167 * {{PAGENAMEE}}
15168 * {{FULLPAGENAME}}
15169 * {{FULLPAGENAMEE}}
15170 * {{BASEPAGENAME}}
15171 * {{BASEPAGENAMEE}}
15172 * {{SUBPAGENAME}}
15173 * {{SUBPAGENAMEE}}
15174 * {{ROOTPAGENAME}}
15175 * {{ROOTPAGENAMEE}}
15176 * {{TALKPAGENAME}}
15177 * {{TALKPAGENAMEE}}
15178 * {{SUBJECTPAGENAME}}
15179 * {{SUBJECTPAGENAMEE}}
15180 * {{NAMESPACEE}}
15181 * {{NAMESPACE}}
15182 * {{NAMESPACENUMBER}}
15183 * {{TALKSPACE}}
15184 * {{TALKSPACEE}}
15185 * {{SUBJECTSPACE}}
15186 * {{SUBJECTSPACEE}}
15187 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15188 !! html
15189 <ul>
15190 <li> Parser test
15191 </li>
15192 <li> Parser_test
15193 </li>
15194 <li> Parser test
15195 </li>
15196 <li> Parser_test
15197 </li>
15198 <li> Parser test
15199 </li>
15200 <li> Parser_test
15201 </li>
15202 <li> Parser test
15203 </li>
15204 <li> Parser_test
15205 </li>
15206 <li> Parser test
15207 </li>
15208 <li> Parser_test
15209 </li>
15210 <li> Talk:Parser test
15211 </li>
15212 <li> Talk:Parser_test
15213 </li>
15214 <li> Parser test
15215 </li>
15216 <li> Parser_test
15217 </li>
15218 <li>
15219 </li>
15220 <li>
15221 </li>
15222 <li> 0
15223 </li>
15224 <li> Talk
15225 </li>
15226 <li> Talk
15227 </li>
15228 <li>
15229 </li>
15230 <li>
15231 </li>
15232 <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>
15233 </li>
15234 </ul>
15235
15236 !! end
15237 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15238
15239 !! test
15240 Gallery
15241 !! wikitext
15242 <gallery>
15243 image1.png |
15244 image2.gif|||||
15245
15246 image3|
15247 image4 |300px| centre
15248 image5.svg| http://///////
15249 [[x|xx]]]]
15250 * image6
15251 </gallery>
15252 !! html
15253 <ul class="gallery mw-gallery-traditional">
15254 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15255 <div class="thumb" style="height: 150px;">Image1.png</div>
15256 <div class="gallerytext">
15257 </div>
15258 </div></li>
15259 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15260 <div class="thumb" style="height: 150px;">Image2.gif</div>
15261 <div class="gallerytext">
15262 <p>||||
15263 </p>
15264 </div>
15265 </div></li>
15266 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15267 <div class="thumb" style="height: 150px;">Image3</div>
15268 <div class="gallerytext">
15269 </div>
15270 </div></li>
15271 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15272 <div class="thumb" style="height: 150px;">Image4</div>
15273 <div class="gallerytext">
15274 <p>300px| centre
15275 </p>
15276 </div>
15277 </div></li>
15278 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15279 <div class="thumb" style="height: 150px;">Image5.svg</div>
15280 <div class="gallerytext">
15281 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15282 </p>
15283 </div>
15284 </div></li>
15285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15286 <div class="thumb" style="height: 150px;">* image6</div>
15287 <div class="gallerytext">
15288 </div>
15289 </div></li>
15290 </ul>
15291
15292 !! end
15293
15294 !! test
15295 Gallery (with options)
15296 !! wikitext
15297 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15298 File:Nonexistant.jpg|caption
15299 File:Nonexistant.jpg
15300 image:foobar.jpg|some '''caption''' [[Main Page]]
15301 image:foobar.jpg
15302 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15303 </gallery>
15304 !! html
15305 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15306 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15307 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15308 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15309 <div class="gallerytext">
15310 <p>caption
15311 </p>
15312 </div>
15313 </div></li>
15314 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15315 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15316 <div class="gallerytext">
15317 </div>
15318 </div></li>
15319 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15320 <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>
15321 <div class="gallerytext">
15322 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15323 </p>
15324 </div>
15325 </div></li>
15326 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15327 <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>
15328 <div class="gallerytext">
15329 </div>
15330 </div></li>
15331 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15332 <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>
15333 <div class="gallerytext">
15334 <p>Blabla|blabla.
15335 </p>
15336 </div>
15337 </div></li>
15338 </ul>
15339
15340 !! end
15341
15342 !! test
15343 Gallery with wikitext inside caption
15344 !! wikitext
15345 <gallery>
15346 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15347 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15348 </gallery>
15349 !! html
15350 <ul class="gallery mw-gallery-traditional">
15351 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15352 <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>
15353 <div class="gallerytext">
15354 <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>
15355 </p>
15356 </div>
15357 </div></li>
15358 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15359 <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>
15360 <div class="gallerytext">
15361 <p>This is a test template
15362 </p>
15363 </div>
15364 </div></li>
15365 </ul>
15366
15367 !! end
15368
15369 !! test
15370 gallery (with showfilename option)
15371 !! wikitext
15372 <gallery showfilename>
15373 File:Nonexistant.jpg|caption
15374 File:Nonexistant.jpg
15375 image:foobar.jpg|some '''caption''' [[Main Page]]
15376 File:Foobar.jpg
15377 </gallery>
15378 !! html
15379 <ul class="gallery mw-gallery-traditional">
15380 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15381 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15382 <div class="gallerytext">
15383 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15384 caption
15385 </p>
15386 </div>
15387 </div></li>
15388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15389 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15390 <div class="gallerytext">
15391 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15392 </p>
15393 </div>
15394 </div></li>
15395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15396 <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>
15397 <div class="gallerytext">
15398 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15399 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15400 </p>
15401 </div>
15402 </div></li>
15403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15404 <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>
15405 <div class="gallerytext">
15406 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15407 </p>
15408 </div>
15409 </div></li>
15410 </ul>
15411
15412 !! end
15413
15414 !! test
15415 Gallery (with namespace-less filenames)
15416 !! wikitext
15417 <gallery>
15418 File:Nonexistant.jpg
15419 Nonexistant.jpg
15420 image:foobar.jpg
15421 foobar.jpg
15422 </gallery>
15423 !! html
15424 <ul class="gallery mw-gallery-traditional">
15425 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15426 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15427 <div class="gallerytext">
15428 </div>
15429 </div></li>
15430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15431 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15432 <div class="gallerytext">
15433 </div>
15434 </div></li>
15435 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15436 <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>
15437 <div class="gallerytext">
15438 </div>
15439 </div></li>
15440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15441 <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>
15442 <div class="gallerytext">
15443 </div>
15444 </div></li>
15445 </ul>
15446
15447 !! end
15448
15449 !! test
15450 HTML Hex character encoding (spells the word "JavaScript")
15451 !! options
15452 parsoid=wt2html,wt2wt,html2html
15453 !! wikitext
15454 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15455 !! html/php
15456 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15457 </p>
15458 !! html/parsoid
15459 <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>
15460 !! end
15461
15462 !! test
15463 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15464 !! wikitext
15465 &#xsee;&#XSEE;
15466 !! html/php
15467 <p>&amp;#xsee;&amp;#XSEE;
15468 </p>
15469 !! html/parsoid
15470 <p>&amp;#xsee;&amp;#XSEE;</p>
15471 !! end
15472
15473 !! test
15474 HTML Hex character encoding mixed case
15475 !! options
15476 parsoid=wt2html,wt2wt,html2html
15477 !! wikitext
15478 &#xEE;&#Xee;
15479 !! html/php
15480 <p>&#xee;&#xee;
15481 </p>
15482 !! html/parsoid
15483 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15484 !! end
15485
15486 !! test
15487 __FORCETOC__ override
15488 !! wikitext
15489 __NEWSECTIONLINK__
15490 __FORCETOC__
15491 !! html
15492 <p><br />
15493 </p>
15494 !! end
15495
15496 !! test
15497 ISBN code coverage
15498 !! wikitext
15499 ISBN 978-0-1234-56&#x20;789
15500 !! html
15501 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15502 </p>
15503 !! end
15504
15505 !! test
15506 ISBN followed by 5 spaces
15507 !! wikitext
15508 ISBN
15509 !! html
15510 <p>ISBN
15511 </p>
15512 !! end
15513
15514 !! test
15515 Double ISBN
15516 !! wikitext
15517 ISBN ISBN 1234567890
15518 !! html
15519 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15520 </p>
15521 !! end
15522
15523 !! test
15524 ISBN with an X
15525 !! wikitext
15526 ISBN 3-462-04561-X
15527 !! html
15528 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15529 </p>
15530 !! end
15531
15532 !! test
15533 ISBN with empty prefix (parsoid test)
15534 !! wikitext
15535 ISBN 1234567890
15536 !! html/parsoid
15537 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15538 !! end
15539
15540 !! test
15541 Bug 22905: <abbr> followed by ISBN followed by </a>
15542 !! wikitext
15543 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15544 !! html
15545 <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>
15546 </p>
15547 !! end
15548
15549 !! test
15550 Double RFC
15551 !! wikitext
15552 RFC RFC 1234
15553 !! html
15554 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15555 </p>
15556 !! end
15557
15558 !! test
15559 Double RFC with a wiki link
15560 !! wikitext
15561 RFC [[RFC 1234]]
15562 !! html
15563 <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>
15564 </p>
15565 !! end
15566
15567 !! test
15568 RFC code coverage
15569 !! wikitext
15570 RFC 983&#x20;987
15571 !! html
15572 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15573 </p>
15574 !! end
15575
15576 !! test
15577 Centre-aligned image
15578 !! wikitext
15579 [[Image:foobar.jpg|centre]]
15580 !! html
15581 <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>
15582
15583 !!end
15584
15585 !! test
15586 None-aligned image
15587 !! wikitext
15588 [[Image:foobar.jpg|none]]
15589 !! html
15590 <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>
15591
15592 !!end
15593
15594 !! test
15595 Width + Height sized image (using px) (height is ignored)
15596 !! wikitext
15597 [[Image:foobar.jpg|640x480px]]
15598 !! html
15599 <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>
15600 </p>
15601 !!end
15602
15603 !! test
15604 Width-sized image (using px, no following whitespace)
15605 !! wikitext
15606 [[Image:foobar.jpg|640px]]
15607 !! html
15608 <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>
15609 </p>
15610 !!end
15611
15612 !! test
15613 Width-sized image (using px, with following whitespace - test regression from r39467)
15614 !! wikitext
15615 [[Image:foobar.jpg|640px ]]
15616 !! html
15617 <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>
15618 </p>
15619 !!end
15620
15621 !! test
15622 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15623 !! wikitext
15624 [[Image:foobar.jpg| 640px]]
15625 !! html
15626 <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>
15627 </p>
15628 !!end
15629
15630 !! test
15631 Image with page parameter
15632 !! options
15633 djvu
15634 !! wikitext
15635 [[File:LoremIpsum.djvu|page=2]]
15636 !! html
15637 <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>
15638 </p>
15639 !! end
15640
15641 !! test
15642 Another italics / bold test
15643 !! wikitext
15644 ''' ''x'
15645 !! html
15646 <pre>'<i> </i>x'
15647 </pre>
15648 !!end
15649
15650 # Note the results may be incorrect, as parserTest output included this:
15651 # XML error: Mismatched tag at byte 6120:
15652 # ...<dd> </dt></dl> </dd...
15653 !! test
15654 dt/dd/dl test
15655 !! options
15656 disabled
15657 !! wikitext
15658 :;;;::
15659 !! html
15660 <dl>
15661 <dd><dl>
15662 <dt><dl>
15663 <dt><dl>
15664 <dt><dl>
15665 <dd><dl>
15666 <dd>
15667 </dd>
15668 </dl>
15669 </dd>
15670 </dl>
15671 </dt>
15672 </dl>
15673 </dt>
15674 </dl>
15675 </dt>
15676 </dl>
15677 </dd>
15678 </dl>
15679
15680 !!end
15681
15682
15683 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15684 !! test
15685 Images with the "|" character in the comment
15686 !! wikitext
15687 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15688 !! html/php
15689 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
15690
15691 !! html/parsoid
15692 <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>
15693 !! end
15694
15695 !! test
15696 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15697 !! wikitext
15698 <html><script>alert(1);</script></html>
15699 !! html
15700 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15701 </p>
15702 !! end
15703
15704 !! test
15705 HTML with raw HTML ($wgRawHtml==true)
15706 !! options
15707 wgRawHtml=1
15708 !! wikitext
15709 <html><script>alert(1);</script></html>
15710 !! html
15711 <p><script>alert(1);</script>
15712 </p>
15713 !! end
15714
15715 !! test
15716 Parents of subpages, one level up
15717 !! options
15718 subpage title=[[Subpage test/L1/L2/L3]]
15719 !! wikitext
15720 [[../|L2]]
15721 !! html
15722 <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>
15723 </p>
15724 !! end
15725
15726
15727 !! test
15728 Parents of subpages, one level up, not named
15729 !! options
15730 subpage title=[[Subpage test/L1/L2/L3]]
15731 !! wikitext
15732 [[../]]
15733 !! html
15734 <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>
15735 </p>
15736 !! end
15737
15738
15739
15740 !! test
15741 Parents of subpages, two levels up
15742 !! options
15743 subpage title=[[Subpage test/L1/L2/L3]]
15744 !! wikitext
15745 [[../../|L1]]2
15746
15747 [[../../|L1]]l
15748 !! html
15749 <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
15750 </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>
15751 </p>
15752 !! end
15753
15754 !! test
15755 Parents of subpages, two levels up, without trailing slash or name.
15756 !! options
15757 subpage title=[[Subpage test/L1/L2/L3]]
15758 !! wikitext
15759 [[../..]]
15760 !! html
15761 <p>[[../..]]
15762 </p>
15763 !! end
15764
15765 !! test
15766 Parents of subpages, two levels up, with lots of extra trailing slashes.
15767 !! options
15768 subpage title=[[Subpage test/L1/L2/L3]]
15769 !! wikitext
15770 [[../../////]]
15771 !! html
15772 <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>
15773 </p>
15774 !! end
15775
15776 !! article
15777 Subpage test/L1/L2/L3Sibling
15778 !! text
15779 Sibling article
15780 !! endarticle
15781
15782 !! test
15783 Transclusion of a sibling page (one level up)
15784 !! options
15785 subpage title=[[Subpage test/L1/L2/L3]]
15786 !! wikitext
15787 {{../L3Sibling}}
15788 !! html
15789 <p>Sibling article
15790 </p>
15791 !! end
15792
15793 !! test
15794 Transclusion of a child page
15795 !! options
15796 subpage title=[[Subpage test/L1/L2]]
15797 !! wikitext
15798 {{/L3Sibling}}
15799 !! html
15800 <p>Sibling article
15801 </p>
15802 !! end
15803
15804 !! test
15805 Non-transclusion because of too many up levels
15806 !! options
15807 subpage title=[[Subpage test/L1/L2/L3]]
15808 !! wikitext
15809 {{../../../../More than parent}}
15810 !! html
15811 <p>{{../../../../More than parent}}
15812 </p>
15813 !! end
15814
15815 !! test
15816 Definition list code coverage
15817 !! wikitext
15818 ; title : def
15819 ; title : def
15820 ;title: def
15821 !! html
15822 <dl>
15823 <dt> title &#160;</dt>
15824 <dd> def
15825 </dd>
15826 <dt> title&#160;</dt>
15827 <dd> def
15828 </dd>
15829 <dt>title</dt>
15830 <dd> def
15831 </dd>
15832 </dl>
15833
15834 !! end
15835
15836 !! test
15837 Don't fall for the self-closing div
15838 !! wikitext
15839 <div>hello world</div/>
15840 !! html
15841 <div>hello world</div>
15842
15843 !! end
15844
15845 !! test
15846 MSGNW magic word
15847 !! wikitext
15848 {{MSGNW:msg}}
15849 !! html
15850 <p>&#91;&#91;:Template:Msg&#93;&#93;
15851 </p>
15852 !! end
15853
15854 !! test
15855 RAW magic word
15856 !! wikitext
15857 {{RAW:QUERTY}}
15858 !! html
15859 <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>
15860 </p>
15861 !! end
15862
15863 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15864 !! test
15865 Always escape literal '>' in output, not just after '<'
15866 !! wikitext
15867 ><>
15868 !! html
15869 <p>&gt;&lt;&gt;
15870 </p>
15871 !! end
15872
15873 !! test
15874 Template caching
15875 !! wikitext
15876 {{Test}}
15877 {{Test}}
15878 !! html
15879 <p>This is a test template
15880 This is a test template
15881 </p>
15882 !! end
15883
15884
15885 !! article
15886 MediaWiki:Fake
15887 !! text
15888 ==header==
15889 !! endarticle
15890
15891 !! test
15892 Inclusion of !userCanEdit() content
15893 !! wikitext
15894 {{MediaWiki:Fake}}
15895 !! html
15896 <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>
15897
15898 !! end
15899
15900
15901 !! test
15902 Out-of-order TOC heading levels
15903 !! wikitext
15904 ==2==
15905 ======6======
15906 ===3===
15907 =1=
15908 =====5=====
15909 ==2==
15910 !! html
15911 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15912 <ul>
15913 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15914 <ul>
15915 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15916 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15917 </ul>
15918 </li>
15919 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15920 <ul>
15921 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15922 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15923 </ul>
15924 </li>
15925 </ul>
15926 </div>
15927
15928 <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>
15929 <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>
15930 <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>
15931 <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>
15932 <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>
15933 <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>
15934
15935 !! end
15936
15937
15938 !! test
15939 ISBN with a dummy number
15940 !! wikitext
15941 ISBN ---
15942 !! html
15943 <p>ISBN ---
15944 </p>
15945 !! end
15946
15947
15948 !! test
15949 ISBN with space-delimited number
15950 !! wikitext
15951 ISBN 92 9017 032 8
15952 !! html
15953 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15954 </p>
15955 !! end
15956
15957
15958 !! test
15959 ISBN with multiple spaces, no number
15960 !! wikitext
15961 ISBN foo
15962 !! html
15963 <p>ISBN foo
15964 </p>
15965 !! end
15966
15967
15968 !! test
15969 ISBN length
15970 !! wikitext
15971 ISBN 123456789
15972
15973 ISBN 1234567890
15974
15975 ISBN 12345678901
15976 !! html
15977 <p>ISBN 123456789
15978 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15979 </p><p>ISBN 12345678901
15980 </p>
15981 !! end
15982
15983
15984 !! test
15985 ISBN with trailing year (bug 8110)
15986 !! wikitext
15987 ISBN 1-234-56789-0 - 2006
15988
15989 ISBN 1 234 56789 0 - 2006
15990 !! html
15991 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15992 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15993 </p>
15994 !! end
15995
15996
15997 !! test
15998 anchorencode
15999 !! wikitext
16000 {{anchorencode:foo bar©#%n}}
16001 !! html
16002 <p>foo_bar.C2.A9.23.25n
16003 </p>
16004 !! end
16005
16006 !! test
16007 anchorencode trims spaces
16008 !! wikitext
16009 {{anchorencode: __pretty__please__}}
16010 !! html
16011 <p>pretty_please
16012 </p>
16013 !! end
16014
16015 !! test
16016 anchorencode deals with links
16017 !! wikitext
16018 {{anchorencode: [[hello|world]] [[hi]]}}
16019 !! html
16020 <p>world_hi
16021 </p>
16022 !! end
16023
16024 !! test
16025 anchorencode deals with templates
16026 !! wikitext
16027 {{anchorencode: {{Foo}} }}
16028 !! html
16029 <p>FOO
16030 </p>
16031 !! end
16032
16033 !! test
16034 anchorencode encodes like the TOC generator: (bug 18431)
16035 !! wikitext
16036 === _ +:.3A%3A&&amp;]] ===
16037 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16038 __NOEDITSECTION__
16039 !! html
16040 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16041 <p>.2B:.3A.253A.26.26.5D.5D
16042 </p>
16043 !! end
16044
16045 !! test
16046 Bug 6200: blockquotes and paragraph formatting
16047 !! wikitext
16048 <blockquote>
16049 foo
16050 </blockquote>
16051
16052 bar
16053
16054 baz
16055 !! html
16056 <blockquote>
16057 <p>foo
16058 </p>
16059 </blockquote>
16060 <p>bar
16061 </p>
16062 <pre>baz
16063 </pre>
16064 !! end
16065
16066 !! test
16067 Bug 8293: Use of center tag ruins paragraph formatting
16068 !! wikitext
16069 <center>
16070 foo
16071 </center>
16072
16073 bar
16074
16075 baz
16076 !! html
16077 <center>
16078 <p>foo
16079 </p>
16080 </center>
16081 <p>bar
16082 </p>
16083 <pre>baz
16084 </pre>
16085 !! end
16086
16087 !!test
16088 Parsing of overlapping (improperly nested) inline html tags
16089 !! wikitext
16090 <span><s>x</span></s>
16091 !! html/php
16092 <p><span><s>x&lt;/span&gt;</s></span>
16093 </p>
16094 !! html/parsoid
16095 <p><span><s>x</s></span>
16096 </p>
16097 !!end
16098
16099 ###
16100 ### Language variants related tests
16101 ###
16102 !! test
16103 Self-link in language variants
16104 !! options
16105 title=[[Dunav]] language=sr
16106 !! wikitext
16107 Both [[Dunav]] and [[Дунав]] are names for this river.
16108 !! html
16109 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16110 </p>
16111 !!end
16112
16113 !! article
16114 Дуна
16115 !! text
16116 content
16117 !! endarticle
16118
16119 !! test
16120 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16121 !! options
16122 title=[[Duna]] language=sr
16123 !! wikitext
16124 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16125 !! html
16126 <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.
16127 </p>
16128 !! end
16129
16130 !! test
16131 Link to a section of a variant of this title shouldn't be parsed as self-link
16132 !! options
16133 title=[[Duna]] language=sr
16134 !! wikitext
16135 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16136 !! html
16137 <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.
16138 </p>
16139 !! end
16140
16141 !! test
16142 Link to pages in language variants
16143 !! options
16144 language=sr
16145 !! wikitext
16146 Main Page can be written as [[Маин Паге]]
16147 !! html
16148 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16149 </p>
16150 !!end
16151
16152
16153 !! test
16154 Multiple links to pages in language variants
16155 !! options
16156 language=sr
16157 !! wikitext
16158 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16159 !! html
16160 <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>.
16161 </p>
16162 !!end
16163
16164
16165 !! test
16166 Simple template in language variants
16167 !! options
16168 language=sr
16169 !! wikitext
16170 {{тест}}
16171 !! html
16172 <p>This is a test template
16173 </p>
16174 !! end
16175
16176
16177 !! test
16178 Template with explicit namespace in language variants
16179 !! options
16180 language=sr
16181 !! wikitext
16182 {{Template:тест}}
16183 !! html
16184 <p>This is a test template
16185 </p>
16186 !! end
16187
16188
16189 !! test
16190 Basic test for template parameter in language variants
16191 !! options
16192 language=sr
16193 !! wikitext
16194 {{парамтест|param=foo}}
16195 !! html
16196 <p>This is a test template with parameter foo
16197 </p>
16198 !! end
16199
16200
16201 !! test
16202 Simple category in language variants
16203 !! options
16204 language=sr cat
16205 !! wikitext
16206 [[Category:МедиаWики Усер'с Гуиде]]
16207 !! html
16208 <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>
16209 !! end
16210
16211
16212 !! article
16213 Category:分类
16214 !! text
16215 blah
16216 !! endarticle
16217
16218 !! article
16219 Category:分類
16220 !! text
16221 blah
16222 !! endarticle
16223
16224 !! test
16225 Don't convert blue categorylinks to another variant (bug 33210)
16226 !! options
16227 language=zh cat
16228 !! wikitext
16229 [[A]][[Category:分类]]
16230 !! html
16231 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16232 !! end
16233
16234
16235 !! test
16236 Stripping -{}- tags (language variants)
16237 !! options
16238 language=sr
16239 !! wikitext
16240 Latin proverb: -{Ne nuntium necare}-
16241 !! html
16242 <p>Latin proverb: Ne nuntium necare
16243 </p>
16244 !! end
16245
16246
16247 !! test
16248 Prevent conversion with -{}- tags (language variants)
16249 !! options
16250 language=sr variant=sr-ec
16251 !! wikitext
16252 Latinski: -{Ne nuntium necare}-
16253 !! html
16254 <p>Латински: Ne nuntium necare
16255 </p>
16256 !! end
16257
16258
16259 !! test
16260 Prevent conversion of text with -{}- tags (language variants)
16261 !! options
16262 language=sr variant=sr-ec
16263 !! wikitext
16264 Latinski: -{Ne nuntium necare}-
16265 !! html
16266 <p>Латински: Ne nuntium necare
16267 </p>
16268 !! end
16269
16270
16271 !! test
16272 Prevent conversion of links with -{}- tags (language variants)
16273 !! options
16274 language=sr variant=sr-ec
16275 !! wikitext
16276 -{[[Main Page]]}-
16277 !! html
16278 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16279 </p>
16280 !! end
16281
16282
16283 !! test
16284 -{}- tags within headlines (within html for parserConvert())
16285 !! options
16286 language=sr variant=sr-ec
16287 !! wikitext
16288 == -{Naslov}- ==
16289 !! html
16290 <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>
16291
16292 !! end
16293
16294
16295 !! test
16296 Explicit definition of language variant alternatives
16297 !! options
16298 language=zh variant=zh-tw
16299 !! wikitext
16300 -{zh:China;zh-tw:Taiwan}-, not China
16301 !! html
16302 <p>Taiwan, not China
16303 </p>
16304 !! end
16305
16306
16307 !! test
16308 Conversion around HTML tags
16309 !! options
16310 language=sr variant=sr-ec
16311 !! wikitext
16312 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16313 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16314 !! html
16315 <p>
16316 <span title="ЛаCтин">ски</span>
16317 </p>
16318 !! end
16319
16320
16321 !! test
16322 Explicit session-wise language variant mapping (A flag and - flag)
16323 !! options
16324 language=zh variant=zh-tw
16325 !! wikitext
16326 Taiwan is not China.
16327 But -{A|zh:China;zh-tw:Taiwan}- is China,
16328 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16329 and -{China}- is China.
16330 !! html
16331 <p>Taiwan is not China.
16332 But Taiwan is Taiwan,
16333 (This should be stripped!)
16334 and China is China.
16335 </p>
16336 !! end
16337
16338 !! test
16339 Explicit session-wise language variant mapping (H flag for hide)
16340 !! options
16341 language=zh variant=zh-tw
16342 !! wikitext
16343 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16344 Taiwan is China.
16345 !! html
16346 <p>(This should be stripped!)
16347 Taiwan is Taiwan.
16348 </p>
16349 !! end
16350
16351 !! test
16352 Adding explicit conversion rule for title (T flag)
16353 !! options
16354 language=zh variant=zh-tw showtitle
16355 !! wikitext
16356 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16357 !! html
16358 Taiwan
16359 <p>Should be stripped!
16360 </p>
16361 !! end
16362
16363 !! test
16364 Testing that changing the language variant here in the tests actually works
16365 !! options
16366 language=zh variant=zh showtitle
16367 !! wikitext
16368 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16369 !! html
16370 China
16371 <p>Should be stripped!
16372 </p>
16373 !! end
16374
16375 !! test
16376 Recursive conversion of alt and title attrs shouldn't clear converter state
16377 !! options
16378 language=zh variant=zh-cn showtitle
16379 !! wikitext
16380 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16381 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16382 !! html
16383 China
16384 <p>
16385 Should be stripped<span title="Exclamation">!</span>
16386 </p>
16387 !! end
16388
16389 !! test
16390 Bug 24072: more test on conversion rule for title
16391 !! options
16392 language=zh variant=zh-tw showtitle
16393 !! wikitext
16394 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16395 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16396 !! html
16397 Taiwan
16398 <p>This should be stripped!
16399 This won't take interferes with the title rule.
16400 </p>
16401 !! end
16402
16403 !! test
16404 Partly disable title conversion if variant == main language code
16405 !! options
16406 language=zh variant=zh title=[[ZH]] showtitle
16407 !! wikitext
16408 -{T|zh-cn:CN;zh-tw:TW}-
16409 !! html
16410 ZH
16411 <p>
16412 </p>
16413 !! end
16414
16415 !! test
16416 Partly disable title conversion if variant == main language code, more
16417 !! options
16418 language=zh variant=zh title=[[ZH]] showtitle
16419 !! wikitext
16420 -{T|TW}-
16421 !! html
16422 ZH
16423 <p>
16424 </p>
16425 !! end
16426
16427 !! test
16428 Raw output of variant escape tags (R flag)
16429 !! options
16430 language=zh variant=zh-tw
16431 !! wikitext
16432 Raw: -{R|zh:China;zh-tw:Taiwan}-
16433 !! html
16434 <p>Raw: zh:China;zh-tw:Taiwan
16435 </p>
16436 !! end
16437
16438 !! test
16439 Nested using of manual convert syntax
16440 !! options
16441 language=zh variant=zh-hk
16442 !! wikitext
16443 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16444 !! html
16445 <p>Nested: Hello Hong Kong!
16446 </p>
16447 !! end
16448
16449 !! test
16450 Proper conversion of text in external links
16451 !! options
16452 language=sr variant=sr-ec
16453 !! wikitext
16454 http://www.google.com
16455 gopher://www.google.com
16456 [http://www.google.com http://www.google.com]
16457 [gopher://www.google.com gopher://www.google.com]
16458 [https://www.google.com irc://www.google.com]
16459 [ftp://www.google.com www.google.com/ftp://dir]
16460 [//www.google.com www.google.com]
16461 !! html
16462 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16463 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16464 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16465 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16466 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16467 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16468 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16469 </p>
16470 !! end
16471
16472 !! test
16473 Do not convert roman numbers to language variants
16474 !! options
16475 language=sr variant=sr-ec
16476 !! wikitext
16477 Fridrih IV je car.
16478 !! html
16479 <p>Фридрих IV је цар.
16480 </p>
16481 !! end
16482
16483 !! test
16484 Unclosed language converter markup "-{"
16485 !! options
16486 language=sr
16487 !! wikitext
16488 -{T|hello
16489 !! html
16490 <p>-{T|hello
16491 </p>
16492 !! end
16493
16494 !! test
16495 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16496 !! options
16497 language=sr
16498 !! wikitext
16499 -{R|=&gt;}-
16500 !! html
16501 <p>=&gt;
16502 </p>
16503 !!end
16504
16505 !! test
16506 Don't break link parsing if language converter markup is in the caption.
16507 !! options
16508 language=sr variant=sr-ec
16509 !! wikitext
16510 [[Main Page|-{R|main page}-]]
16511 !! html
16512 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16513 </p>
16514 !! end
16515
16516 # This test is currently broken in the PHP parser (bug 52661)
16517 !! test
16518 Don't break image parsing if language converter markup is in the caption.
16519 !! options
16520 language=sr
16521 disabled
16522 !! wikitext
16523 [[File:Foobar.jpg|-{R|caption}-]]
16524 !! html
16525 <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>
16526 </p>
16527 !! end
16528
16529 # This test is currently broken in the PHP parser (bug 52661)
16530 !! test
16531 Don't break list handling if language converter markup is in the item.
16532 !! options
16533 language=zh variant=zh-cn
16534 disabled
16535 !! wikitext
16536 ;-{zh-cn:AAA;zh-tw:BBB}-
16537 !! html
16538 <dl><dt>AAA
16539 </dt></dl>
16540
16541 !! end
16542
16543 # This test is currently broken in the PHP parser (bug 52661)
16544 !! test
16545 Don't break table handling if language converter markup is in the cell.
16546 !! options
16547 language=sr variant=sr-ec
16548 disabled
16549 !! wikitext
16550 {|
16551 |-
16552 | -{R|B}-
16553 |}
16554 !! html
16555 <table>
16556
16557 <tr>
16558 <td> B
16559 </td></tr></table>
16560
16561 !! end
16562
16563 !! test
16564 Bug 529: Uncovered bullet
16565 !! wikitext
16566 * Foo {{bullet}}
16567 !! html
16568 <ul>
16569 <li> Foo
16570 </li>
16571 <li> Bar
16572 </li>
16573 </ul>
16574
16575 !! end
16576
16577 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16578 # Templates in Wikipedia rely on this behavior, as tidy has always been
16579 # enabled there. These tests are normally run *without* tidy, so specify the
16580 # full output here.
16581 # To test realistic parsing behavior, apply a tidy-like transformation to both
16582 # the expected output and your parser's output.
16583 !! test
16584 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16585 !! wikitext
16586 ******* Foo {{bullet}}
16587 !! html
16588 <ul>
16589 <li><ul>
16590 <li><ul>
16591 <li><ul>
16592 <li><ul>
16593 <li><ul>
16594 <li><ul>
16595 <li> Foo
16596 </li>
16597 </ul>
16598 </li>
16599 </ul>
16600 </li>
16601 </ul>
16602 </li>
16603 </ul>
16604 </li>
16605 </ul>
16606 </li>
16607 </ul>
16608 </li>
16609 <li> Bar
16610 </li>
16611 </ul>
16612
16613 !! end
16614
16615 !! test
16616 Bug 529: Uncovered table already at line-start
16617 !! wikitext
16618 x
16619
16620 {{table}}
16621 y
16622 !! html
16623 <p>x
16624 </p>
16625 <table>
16626 <tr>
16627 <td> 1 </td>
16628 <td> 2
16629 </td></tr>
16630 <tr>
16631 <td> 3 </td>
16632 <td> 4
16633 </td></tr></table>
16634 <p>y
16635 </p>
16636 !! end
16637
16638 !! test
16639 Bug 529: Uncovered bullet in parser function result
16640 !! wikitext
16641 * Foo {{lc:{{bullet}} }}
16642 !! html
16643 <ul>
16644 <li> Foo
16645 </li>
16646 <li> bar
16647 </li>
16648 </ul>
16649
16650 !! end
16651
16652 !! test
16653 Bug 5678: Double-parsed template argument
16654 !! wikitext
16655 {{lc:{{{1}}}|hello}}
16656 !! html
16657 <p>{{{1}}}
16658 </p>
16659 !! end
16660
16661 !! test
16662 Bug 5678: Double-parsed template invocation
16663 !! wikitext
16664 {{lc:{{paramtest {{!}} param = hello }} }}
16665 !! html
16666 <p>{{paramtest | param = hello }}
16667 </p>
16668 !! end
16669
16670 !! test
16671 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16672 !! options
16673 language=cs
16674 title=[[Main Page]]
16675 !! wikitext
16676 {{PRVNÍVELKÉ:ěščř}}
16677 {{prvnívelké:ěščř}}
16678 {{PRVNÍMALÉ:ěščř}}
16679 {{prvnímalé:ěščř}}
16680 {{MALÁ:ěščř}}
16681 {{malá:ěščř}}
16682 {{VELKÁ:ěščř}}
16683 {{velká:ěščř}}
16684 !! html
16685 <p>Ěščř
16686 Ěščř
16687 ěščř
16688 ěščř
16689 ěščř
16690 ěščř
16691 ĚŠČŘ
16692 ĚŠČŘ
16693 </p>
16694 !! end
16695
16696 !! test
16697 Morwen/13: Unclosed link followed by heading
16698 !! wikitext
16699 [[link
16700 ==heading==
16701 !! html
16702 <p>[[link
16703 </p>
16704 <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>
16705
16706 !! end
16707
16708 !! test
16709 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16710 !! wikitext
16711 {{foo|
16712 =heading=
16713 !! html
16714 <p>{{foo|
16715 </p>
16716 <h1><span class="mw-headline" id="heading">heading</span></h1>
16717
16718 !! end
16719
16720 !! test
16721 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16722 !! wikitext
16723 {{foo|
16724 ==heading==
16725 !! html
16726 <p>{{foo|
16727 </p>
16728 <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>
16729
16730 !! end
16731
16732 !! test
16733 Tildes in comments
16734 !! options
16735 pst
16736 !! wikitext
16737 <!-- ~~~~ -->
16738 !! html
16739 <!-- ~~~~ -->
16740 !! end
16741
16742 !! test
16743 Paragraphs inside divs (no extra line breaks)
16744 !! wikitext
16745 <div>Line one
16746
16747 Line two</div>
16748 !! html
16749 <div>Line one
16750 Line two</div>
16751
16752 !! end
16753
16754 !! test
16755 Paragraphs inside divs (extra line break on open)
16756 !! wikitext
16757 <div>
16758 Line one
16759
16760 Line two</div>
16761 !! html
16762 <div>
16763 <p>Line one
16764 </p>
16765 Line two</div>
16766
16767 !! end
16768
16769 !! test
16770 Paragraphs inside divs (extra line break on close)
16771 !! wikitext
16772 <div>Line one
16773
16774 Line two
16775 </div>
16776 !! html
16777 <div>Line one
16778 <p>Line two
16779 </p>
16780 </div>
16781
16782 !! end
16783
16784 !! test
16785 Paragraphs inside divs (extra line break on open and close)
16786 !! wikitext
16787 <div>
16788 Line one
16789
16790 Line two
16791 </div>
16792 !! html
16793 <div>
16794 <p>Line one
16795 </p><p>Line two
16796 </p>
16797 </div>
16798
16799 !! end
16800
16801 !! test
16802 Nesting tags, paragraphs on lines which begin with <div>
16803 !! options
16804 disabled
16805 !! wikitext
16806 <div></div><strong>A
16807 B</strong>
16808 !! html
16809 <div></div>
16810 <p><strong>A
16811 B</strong>
16812 </p>
16813 !! end
16814
16815 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16816 !! test
16817 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16818 !! wikitext
16819 <blockquote>Line one
16820
16821 Line two</blockquote>
16822 !! html
16823 <blockquote>Line one
16824 Line two</blockquote>
16825
16826 !! end
16827
16828 !! test
16829 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16830 !! wikitext
16831 <blockquote>
16832 Line one
16833
16834 Line two</blockquote>
16835 !! html
16836 <blockquote>
16837 <p>Line one
16838 </p>
16839 Line two</blockquote>
16840
16841 !! end
16842
16843 !! test
16844 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16845 !! wikitext
16846 <blockquote>Line one
16847
16848 Line two
16849 </blockquote>
16850 !! html
16851 <blockquote>Line one
16852 <p>Line two
16853 </p>
16854 </blockquote>
16855
16856 !! end
16857
16858 !! test
16859 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16860 !! wikitext
16861 <blockquote>
16862 Line one
16863
16864 Line two
16865 </blockquote>
16866 !! html
16867 <blockquote>
16868 <p>Line one
16869 </p><p>Line two
16870 </p>
16871 </blockquote>
16872
16873 !! end
16874
16875 !! test
16876 Paragraphs inside blockquotes/divs (no extra line breaks)
16877 !! wikitext
16878 <blockquote><div>Line one
16879
16880 Line two</div></blockquote>
16881 !! html
16882 <blockquote><div>Line one
16883 Line two</div></blockquote>
16884
16885 !! end
16886
16887 !! test
16888 Paragraphs inside blockquotes/divs (extra line break on open)
16889 !! wikitext
16890 <blockquote><div>
16891 Line one
16892
16893 Line two</div></blockquote>
16894 !! html
16895 <blockquote><div>
16896 <p>Line one
16897 </p>
16898 Line two</div></blockquote>
16899
16900 !! end
16901
16902 !! test
16903 Paragraphs inside blockquotes/divs (extra line break on close)
16904 !! wikitext
16905 <blockquote><div>Line one
16906
16907 Line two
16908 </div></blockquote>
16909 !! html
16910 <blockquote><div>Line one
16911 <p>Line two
16912 </p>
16913 </div></blockquote>
16914
16915 !! end
16916
16917 !! test
16918 Paragraphs inside blockquotes/divs (extra line break on open and close)
16919 !! wikitext
16920 <blockquote><div>
16921 Line one
16922
16923 Line two
16924 </div></blockquote>
16925 !! html
16926 <blockquote><div>
16927 <p>Line one
16928 </p><p>Line two
16929 </p>
16930 </div></blockquote>
16931
16932 !! end
16933
16934 !! test
16935 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16936 !! options
16937 wgLinkHolderBatchSize=0
16938 !! wikitext
16939 [[meatball:1]]
16940 [[meatball:2]]
16941 [[meatball:3]]
16942 !! html
16943 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16944 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16945 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16946 </p>
16947 !! end
16948
16949 !! test
16950 Free external link invading image caption
16951 !! wikitext
16952 [[Image:Foobar.jpg|thumb|http://x|hello]]
16953 !! html
16954 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
16955
16956 !! end
16957
16958 !! test
16959 Bug 15196: localised external link numbers
16960 !! options
16961 language=fa
16962 !! wikitext
16963 [http://en.wikipedia.org/]
16964 !! html/php
16965 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16966 </p>
16967 !! html/parsoid
16968 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16969 !! end
16970
16971 !! test
16972 Multibyte character in padleft
16973 !! wikitext
16974 {{padleft:-Hello|7|Æ}}
16975 !! html
16976 <p>Æ-Hello
16977 </p>
16978 !! end
16979
16980 !! test
16981 Multibyte character in padright
16982 !! wikitext
16983 {{padright:Hello-|7|Æ}}
16984 !! html
16985 <p>Hello-Æ
16986 </p>
16987 !! end
16988
16989 !!test
16990 formatdate parser function
16991 !! wikitext
16992 {{#formatdate:2009-03-24}}
16993 !! html
16994 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16995 </p>
16996 !! end
16997
16998 !!test
16999 formatdate parser function, with default format
17000 !! wikitext
17001 {{#formatdate:2009-03-24|mdy}}
17002 !! html
17003 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17004 </p>
17005 !! end
17006
17007 !! test
17008 Spacing of numbers in formatted dates
17009 !! wikitext
17010 {{#formatdate:January 15}}
17011 !! html
17012 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17013 </p>
17014 !! end
17015
17016 !! test
17017 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
17018 !! options
17019 language=nl title=[[MediaWiki:Common.css]]
17020 !! wikitext
17021 {{#formatdate:2009-03-24|dmy}}
17022 !! html
17023 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17024 </p>
17025 !! end
17026
17027 #
17028 #
17029 #
17030
17031 #
17032 # Edit comments
17033 #
17034
17035 !! test
17036 Edit comment with link
17037 !! options
17038 comment
17039 !! wikitext
17040 I like the [[Main Page]] a lot
17041 !! html
17042 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17043 !!end
17044
17045 !! test
17046 Edit comment with link and link text
17047 !! options
17048 comment
17049 !! wikitext
17050 I like the [[Main Page|best pages]] a lot
17051 !! html
17052 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17053 !!end
17054
17055 !! test
17056 Edit comment with link and link text with suffix
17057 !! options
17058 comment
17059 !! wikitext
17060 I like the [[Main Page|best page]]s a lot
17061 !! html
17062 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17063 !!end
17064
17065 !! test
17066 Edit comment with section link (non-local, eg in history list)
17067 !! options
17068 comment title=[[Main Page]]
17069 !! wikitext
17070 /* External links */ removed bogus entries
17071 !! html
17072 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17073 !!end
17074
17075 !! test
17076 Edit comment with section link and text before it (non-local, eg in history list)
17077 !! options
17078 comment title=[[Main Page]]
17079 !! wikitext
17080 pre-comment text /* External links */ removed bogus entries
17081 !! html
17082 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>
17083 !!end
17084
17085 !! test
17086 Edit comment with section link (local, eg in diff view)
17087 !! options
17088 comment local title=[[Main Page]]
17089 !! wikitext
17090 /* External links */ removed bogus entries
17091 !! html
17092 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17093 !!end
17094
17095 !! test
17096 Edit comment with subpage link (bug 14080)
17097 !! options
17098 comment
17099 subpage
17100 title=[[Subpage test]]
17101 !! wikitext
17102 Poked at a [[/subpage]] here...
17103 !! html
17104 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17105 !!end
17106
17107 !! test
17108 Edit comment with subpage link and link text (bug 14080)
17109 !! options
17110 comment
17111 subpage
17112 title=[[Subpage test]]
17113 !! wikitext
17114 Poked at a [[/subpage|neat little page]] here...
17115 !! html
17116 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17117 !!end
17118
17119 !! test
17120 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17121 !! options
17122 comment
17123 title=[[Subpage test]]
17124 !! wikitext
17125 Poked at a [[/subpage]] here...
17126 !! html
17127 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...
17128 !!end
17129
17130 !! test
17131 Edit comment with bare anchor link (local, as on diff)
17132 !! options
17133 comment
17134 local
17135 title=[[Main Page]]
17136 !! wikitext
17137 [[#section]]
17138 !! html
17139 <a href="#section">#section</a>
17140 !! end
17141
17142 !! test
17143 Edit comment with bare anchor link (non-local, as on history)
17144 !! options
17145 comment
17146 title=[[Main Page]]
17147 !! wikitext
17148 [[#section]]
17149 !! html
17150 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17151 !! end
17152
17153 !! test
17154 Anchor starting with underscore
17155 !! wikitext
17156 [[#_ref|One]]
17157 !! html
17158 <p><a href="#_ref">One</a>
17159 </p>
17160 !! end
17161
17162 !! test
17163 Id starting with underscore
17164 !! wikitext
17165 <div id="_ref"></div>
17166 !! html
17167 <div id="_ref"></div>
17168
17169 !! end
17170
17171 !! test
17172 Space normalisation on autocomment (bug 22784)
17173 !! options
17174 comment
17175 title=[[Main Page]]
17176 !! wikitext
17177 /* __hello__world__ */
17178 !! html
17179 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17180 !! end
17181
17182 !! test
17183 percent-encoding and + signs in comments (Bug 26410)
17184 !! options
17185 comment
17186 !! wikitext
17187 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17188 !! html
17189 <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>
17190 !! end
17191
17192 !! test
17193 Bad images - basic functionality
17194 !! options
17195 disabled
17196 !! wikitext
17197 [[File:Bad.jpg]]
17198 !! html
17199 !! end
17200
17201 !! test
17202 Bad images - bug 16039: text after bad image disappears
17203 !! options
17204 disabled
17205 !! wikitext
17206 Foo bar
17207 [[File:Bad.jpg]]
17208 Bar foo
17209 !! html
17210 <p>Foo bar
17211 </p><p>Bar foo
17212 </p>
17213 !! end
17214
17215 !! test
17216 Verify that displaytitle works (bug #22501) no displaytitle
17217 !! options
17218 showtitle
17219 !! config
17220 wgAllowDisplayTitle=true
17221 wgRestrictDisplayTitle=false
17222 !! wikitext
17223 this is not the the title
17224 !! html
17225 Parser test
17226 <p>this is not the the title
17227 </p>
17228 !! end
17229
17230 !! test
17231 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17232 !! options
17233 showtitle
17234 title=[[Screen]]
17235 !! config
17236 wgAllowDisplayTitle=true
17237 wgRestrictDisplayTitle=false
17238 !! wikitext
17239 this is not the the title
17240 {{DISPLAYTITLE:whatever}}
17241 !! html
17242 whatever
17243 <p>this is not the the title
17244 </p>
17245 !! end
17246
17247 !! test
17248 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17249 !! options
17250 showtitle
17251 title=[[Screen]]
17252 !! config
17253 wgAllowDisplayTitle=true
17254 wgRestrictDisplayTitle=true
17255 !! wikitext
17256 this is not the the title
17257 {{DISPLAYTITLE:whatever}}
17258 !! html
17259 Screen
17260 <p>this is not the the title
17261 </p>
17262 !! end
17263
17264 !! test
17265 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17266 !! options
17267 showtitle
17268 title=[[Screen]]
17269 !! config
17270 wgAllowDisplayTitle=true
17271 wgRestrictDisplayTitle=true
17272 !! wikitext
17273 this is not the the title
17274 {{DISPLAYTITLE:screen}}
17275 !! html
17276 screen
17277 <p>this is not the the title
17278 </p>
17279 !! end
17280
17281 !! test
17282 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17283 !! options
17284 showtitle
17285 title=[[Screen]]
17286 !! config
17287 wgAllowDisplayTitle=false
17288 !! wikitext
17289 this is not the the title
17290 {{DISPLAYTITLE:screen}}
17291 !! html
17292 Screen
17293 <p>this is not the the title
17294 <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>
17295 </p>
17296 !! end
17297
17298 !! test
17299 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17300 !! options
17301 showtitle
17302 title=[[Screen]]
17303 !! config
17304 wgAllowDisplayTitle=false
17305 !! wikitext
17306 this is not the the title
17307 !! html
17308 Screen
17309 <p>this is not the the title
17310 </p>
17311 !! end
17312
17313 !! test
17314 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17315 !! options
17316 showtitle
17317 title=[[Screen]]
17318 !! config
17319 wgAllowDisplayTitle=true
17320 wgRestrictDisplayTitle=true
17321 !! wikitext
17322 this is not the the title
17323 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17324 !! html
17325 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17326 <p>this is not the the title
17327 </p>
17328 !! end
17329
17330 !! test
17331 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17332 !! options
17333 showtitle
17334 title=[[Screen]]
17335 !! config
17336 wgAllowDisplayTitle=true
17337 wgRestrictDisplayTitle=true
17338 !! wikitext
17339 this is not the the title
17340 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17341 !! html
17342 <span style="color: red;">s</span>creen
17343 <p>this is not the the title
17344 </p>
17345 !! end
17346
17347 !! test
17348 preload: check <noinclude> and <includeonly>
17349 !! options
17350 preload
17351 !! wikitext
17352 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17353 !! html
17354 Hello kind world.
17355 !! end
17356
17357 !! test
17358 preload: check <onlyinclude>
17359 !! options
17360 preload
17361 !! wikitext
17362 Goodbye <onlyinclude>Hello world</onlyinclude>
17363 !! html
17364 Hello world
17365 !! end
17366
17367 !! test
17368 preload: can pass tags through if we want to
17369 !! options
17370 preload
17371 !! wikitext
17372 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17373 !! html
17374 <includeonly>Hello world</includeonly>
17375 !! end
17376
17377 !! test
17378 preload: check that it doesn't try to do tricks
17379 !! options
17380 preload
17381 !! wikitext
17382 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17383 !! html
17384 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17385 !! end
17386
17387 !! test
17388 Play a bit with r67090 and bug 3158
17389 !! options
17390 disabled
17391 !! wikitext
17392 <div style="width:50% !important">&nbsp;</div>
17393 <div style="width:50%&nbsp;!important">&nbsp;</div>
17394 <div style="width:50%&#160;!important">&nbsp;</div>
17395 <div style="border : solid;">&nbsp;</div>
17396 !! html
17397 <div style="width:50% !important">&nbsp;</div>
17398 <div style="width:50% !important">&nbsp;</div>
17399 <div style="width:50% !important">&nbsp;</div>
17400 <div style="border&#160;: solid;">&nbsp;</div>
17401
17402 !! end
17403
17404 !! test
17405 HTML5 data attributes
17406 !! wikitext
17407 <span data-foo="bar">Baz</span>
17408 <p data-abc-def_hij="">Quuz</p>
17409 !! html
17410 <p><span data-foo="bar">Baz</span>
17411 </p>
17412 <p data-abc-def_hij="">Quuz</p>
17413
17414 !! end
17415
17416 !! test
17417 percent-encoding and + signs in internal links (Bug 26410)
17418 !! wikitext
17419 [[User:+%]] [[Page+title%]]
17420 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17421 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17422 [[%33%45]] [[%33%45+]]
17423 !! html
17424 <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>
17425 <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>
17426 <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>
17427 <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>
17428 </p>
17429 !! end
17430
17431 !! test
17432 Special characters in embedded file links (bug 27679)
17433 !! wikitext
17434 [[File:Contains & ampersand.jpg]]
17435 [[File:Does not exist.jpg|Title with & ampersand]]
17436 !! html
17437 <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>
17438 <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>
17439 </p>
17440 !! end
17441
17442
17443 !! test
17444 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17445 !! wikitext
17446 Text&apos;s been normalized?
17447 !! html
17448 <p>Text&#39;s been normalized?
17449 </p>
17450 !! end
17451
17452 !! test
17453 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17454 !! wikitext
17455 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17456 !! html
17457 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17458 </p>
17459 !! end
17460
17461 !! test
17462 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17463 !! wikitext
17464 [http://www.example.org/ ideograms]
17465 !! html
17466 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17467 </p>
17468 !! end
17469
17470 !! test
17471 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17472 !! wikitext
17473 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17474 !! html
17475 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17476 </p>
17477 !! end
17478
17479 !! article
17480 Mediawiki:loop1
17481 !! text
17482 {{Identical|A}}
17483 !! endarticle
17484
17485 !! article
17486 Mediawiki:loop2
17487 !! text
17488 {{Identical|B}}
17489 !! endarticle
17490
17491 !! article
17492 Template:Identical
17493 !! text
17494 {{int:loop1}}
17495 {{int:loop2}}
17496 !! endarticle
17497
17498 !! test
17499 Bug 31098 Template which includes system messages which includes the template
17500 !! wikitext
17501 {{Identical}}
17502 !! html
17503 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17504 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17505 </p>
17506 !! end
17507
17508 !! test
17509 Bug31490 Turkish: ucfirst 'blah'
17510 !! options
17511 language=tr
17512 !! wikitext
17513 {{ucfirst:blah}}
17514 !! html
17515 <p>Blah
17516 </p>
17517 !! end
17518
17519 !! test
17520 Bug31490 Turkish: ucfirst 'ix'
17521 !! options
17522 language=tr
17523 !! wikitext
17524 {{ucfirst:ix}}
17525 !! html
17526 <p>İx
17527 </p>
17528 !! end
17529
17530 !! test
17531 Bug31490 Turkish: lcfirst 'BLAH'
17532 !! options
17533 language=tr
17534 !! wikitext
17535 {{lcfirst:BLAH}}
17536 !! html
17537 <p>bLAH
17538 </p>
17539 !! end
17540
17541 !! test
17542 Bug31490 Turkish: ucfırst (with a dotless i)
17543 !! options
17544 language=tr
17545 !! wikitext
17546 {{ucfırst:blah}}
17547 !! html
17548 <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>
17549 </p>
17550 !! end
17551
17552 !! test
17553 Bug31490 ucfırst (with a dotless i) with English language
17554 !! options
17555 language=en
17556 !! wikitext
17557 {{ucfırst:blah}}
17558 !! html
17559 <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>
17560 </p>
17561 !! end
17562
17563 !! test
17564 Bug 26375: TOC with italics
17565 !! options
17566 title=[[Main Page]]
17567 !! wikitext
17568 __TOC__
17569 == ''Lost'' episodes ==
17570 !! html
17571 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17572 <ul>
17573 <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>
17574 </ul>
17575 </div>
17576
17577 <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>
17578
17579 !! end
17580
17581 !! test
17582 Bug 26375: TOC with bold
17583 !! options
17584 title=[[Main Page]]
17585 !! wikitext
17586 __TOC__
17587 == '''should be bold''' then normal text ==
17588 !! html
17589 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17590 <ul>
17591 <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>
17592 </ul>
17593 </div>
17594
17595 <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>
17596
17597 !! end
17598
17599 !! test
17600 Bug 33845: Headings become cursive in TOC when they contain an image
17601 !! options
17602 title=[[Main Page]]
17603 !! wikitext
17604 __TOC__
17605 == Image [[Image:foobar.jpg]] ==
17606 !! html
17607 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17608 <ul>
17609 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17610 </ul>
17611 </div>
17612
17613 <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>
17614
17615 !! end
17616
17617 !! test
17618 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17619 !! options
17620 title=[[Main Page]]
17621 !! wikitext
17622 __TOC__
17623 == <blockquote>Quote</blockquote> ==
17624 !! html
17625 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17626 <ul>
17627 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17628 </ul>
17629 </div>
17630
17631 <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>
17632
17633 !! end
17634
17635 !! test
17636 Unclosed tags in TOC
17637 !! options
17638 title=[[Main Page]]
17639 !! wikitext
17640 __TOC__
17641 == Proof: 2 < 3 ==
17642 <small>Hanc marginis exiguitas non caperet.</small>
17643 QED
17644 !! html
17645 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17646 <ul>
17647 <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>
17648 </ul>
17649 </div>
17650
17651 <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>
17652 <p><small>Hanc marginis exiguitas non caperet.</small>
17653 QED
17654 </p>
17655 !! end
17656
17657 !! test
17658 Multiple tags in TOC
17659 !! wikitext
17660 __TOC__
17661 == <i>Foo</i> <b>Bar</b> ==
17662
17663 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17664 !! html
17665 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17666 <ul>
17667 <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>
17668 <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>
17669 </ul>
17670 </div>
17671
17672 <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>
17673 <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>
17674
17675 !! end
17676
17677 !! test
17678 Tags with parameters in TOC
17679 !! wikitext
17680 __TOC__
17681 == <sup class="in-h2">Hello</sup> ==
17682
17683 == <sup class="a > b">Evilbye</sup> ==
17684 !! html
17685 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17686 <ul>
17687 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17688 <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>
17689 </ul>
17690 </div>
17691
17692 <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>
17693 <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>
17694
17695 !! end
17696
17697 !! test
17698 span tags with directionality in TOC
17699 !! wikitext
17700 __TOC__
17701 == <span dir="ltr">C++</span> ==
17702
17703 == <span dir="rtl">זבנג!</span> ==
17704
17705 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17706
17707 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17708
17709 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17710 !! html
17711 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17712 <ul>
17713 <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>
17714 <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>
17715 <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>
17716 <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>
17717 <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>
17718 </ul>
17719 </div>
17720
17721 <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>
17722 <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>
17723 <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>
17724 <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>
17725 <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>
17726
17727 !! end
17728
17729 !! article
17730 MediaWiki:Bug32057
17731 !! text
17732 == {{int:headline_sample}} ==
17733 !! endarticle
17734
17735 !! test
17736 Bug 32057: Title needed when expanding <h> nodes.
17737 !! options
17738 title=[[Main Page]]
17739 !! wikitext
17740 {{int:Bug32057}}
17741 !! html
17742 <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>
17743
17744 !! end
17745
17746 !! test
17747 Strip marker in urlencode
17748 !! wikitext
17749 {{urlencode:x<nowiki/>y}}
17750 {{urlencode:x<nowiki/>y|wiki}}
17751 {{urlencode:x<nowiki/>y|path}}
17752 !! html
17753 <p>xy
17754 xy
17755 xy
17756 </p>
17757 !! end
17758
17759 !! test
17760 Strip marker in lc
17761 !! wikitext
17762 {{lc:x<nowiki/>y}}
17763 !! html
17764 <p>xy
17765 </p>
17766 !! end
17767
17768 !! test
17769 Strip marker in uc
17770 !! wikitext
17771 {{uc:x<nowiki/>y}}
17772 !! html
17773 <p>XY
17774 </p>
17775 !! end
17776
17777 !! test
17778 Strip marker in formatNum
17779 !! wikitext
17780 {{formatnum:1<nowiki/>2}}
17781 {{formatnum:1<nowiki/>2|R}}
17782 !! html
17783 <p>12
17784 12
17785 </p>
17786 !! end
17787
17788 !! test
17789 Check noCommafy in formatNum
17790 !! options
17791 language=be-tarask
17792 !! wikitext
17793 {{formatnum:123456.78}}
17794 {{formatnum:123456.78|NOSEP}}
17795 !! html
17796 <p>123 456,78
17797 123456.78
17798 </p>
17799 !! end
17800
17801 !! test
17802 Wrong option for formatNum (bug 56199)
17803 !! wikitext
17804 {{formatnum:1,234.56|Random}}
17805 {{formatnum:1,234.56|EVERYTHING}}
17806 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17807 !! html
17808 <p>1,234.56
17809 1,234.56
17810 1,234.56
17811 </p>
17812 !! end
17813
17814 !! test
17815 Strip marker in grammar
17816 !! options
17817 language=fi
17818 !! wikitext
17819 {{grammar:elative|foo<nowiki/>bar}}
17820 !! html
17821 <p>foobarista
17822 </p>
17823 !! end
17824
17825 !! test
17826 Strip marker in padleft
17827 !! wikitext
17828 {{padleft:|2|x<nowiki/>y}}
17829 !! html
17830 <p>xy
17831 </p>
17832 !! end
17833
17834 !! test
17835 Strip marker in padright
17836 !! wikitext
17837 {{padright:|2|x<nowiki/>y}}
17838 !! html
17839 <p>xy
17840 </p>
17841 !! end
17842
17843 !! test
17844 Strip marker in anchorencode
17845 !! wikitext
17846 {{anchorencode:x<nowiki/>y}}
17847 !! html
17848 <p>xy
17849 </p>
17850 !! end
17851
17852 !! test
17853 nowiki inside link inside heading (bug 18295)
17854 !! wikitext
17855 ==[[foo|x<nowiki>y</nowiki>z]]==
17856 !! html
17857 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">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>
17858
17859 !! end
17860
17861 !! test
17862 new support for bdi element (bug 31817)
17863 !! wikitext
17864 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17865 !! html
17866 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17867
17868 !!end
17869
17870 !! test
17871 Ignore pipe between table row attributes
17872 !! wikitext
17873 {|
17874 | quux
17875 |- id=foo | style='color: red'
17876 | bar
17877 |}
17878 !! html
17879 <table>
17880 <tr>
17881 <td> quux
17882 </td></tr>
17883 <tr id="foo" style="color: red">
17884 <td> bar
17885 </td></tr></table>
17886
17887 !! end
17888
17889 !!test
17890 Gallery override link with WikiLink (bug 34852)
17891 !! wikitext
17892 <gallery>
17893 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17894 </gallery>
17895 !! html
17896 <ul class="gallery mw-gallery-traditional">
17897 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17898 <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>
17899 <div class="gallerytext">
17900 <p>caption
17901 </p>
17902 </div>
17903 </div></li>
17904 </ul>
17905
17906 !! end
17907
17908 !!test
17909 Gallery override link with absolute external link (bug 34852)
17910 !! wikitext
17911 <gallery>
17912 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17913 </gallery>
17914 !! html
17915 <ul class="gallery mw-gallery-traditional">
17916 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17917 <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>
17918 <div class="gallerytext">
17919 <p>caption
17920 </p>
17921 </div>
17922 </div></li>
17923 </ul>
17924
17925 !! end
17926
17927 !!test
17928 Gallery override link with malicious javascript (bug 34852)
17929 !! wikitext
17930 <gallery>
17931 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17932 </gallery>
17933 !! html
17934 <ul class="gallery mw-gallery-traditional">
17935 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17936 <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>
17937 <div class="gallerytext">
17938 <p>caption
17939 </p>
17940 </div>
17941 </div></li>
17942 </ul>
17943
17944 !! end
17945
17946 !!test
17947 Gallery with invalid title as link (bug 43964)
17948 !! wikitext
17949 <gallery>
17950 File:foobar.jpg|link=<
17951 </gallery>
17952 !! html
17953 <ul class="gallery mw-gallery-traditional">
17954 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17955 <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>
17956 <div class="gallerytext">
17957 </div>
17958 </div></li>
17959 </ul>
17960
17961 !! end
17962
17963 !!test
17964 Language parser function
17965 !! wikitext
17966 {{#language:ar}}
17967 !! html
17968 <p>العربية
17969 </p>
17970 !! end
17971
17972 !!test
17973 Padleft and padright as substr
17974 !! wikitext
17975 {{padleft:|3|abcde}}
17976 {{padright:|3|abcde}}
17977 !! html
17978 <p>abc
17979 abc
17980 </p>
17981 !! end
17982
17983 !!test
17984 Special parser function
17985 !! wikitext
17986 {{#special:RandomPage}}
17987 {{#special:BaDtItLe}}
17988 {{#special:Foobar}}
17989 !! html
17990 <p>Special:Random
17991 Special:Badtitle
17992 Special:Foobar
17993 </p>
17994 !! end
17995
17996 !!test
17997 Bug 34939 - Case insensitive link parsing ([HttP://])
17998 !! wikitext
17999 [HttP://MediaWiki.Org/]
18000 !! html/php
18001 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18002 </p>
18003 !! html/parsoid
18004 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18005 !! end
18006
18007 !!test
18008 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18009 !! wikitext
18010 [HttP://MediaWiki.Org/ MediaWiki]
18011 !! html
18012 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18013 </p>
18014 !! end
18015
18016 !!test
18017 Bug 34939 - Case insensitive link parsing (HttP://)
18018 !! wikitext
18019 HttP://MediaWiki.Org/
18020 !! html/php
18021 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18022 </p>
18023 !! html/parsoid
18024 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18025 !! end
18026
18027 !!test
18028 Disable TOC
18029 !! options
18030 notoc
18031 !! wikitext
18032 Lead
18033 == Section 1 ==
18034 == Section 2 ==
18035 == Section 3 ==
18036 == Section 4 ==
18037 == Section 5 ==
18038 !! html
18039 <p>Lead
18040 </p>
18041
18042 <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>
18043 <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>
18044 <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>
18045 <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>
18046 <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>
18047
18048 !! end
18049
18050
18051 ###
18052 ### Parsoids-specific tests
18053 ### Parsoid-PHP parser incompatibilities
18054 ###
18055 !!test
18056 1. SOL-sensitive wikitext tokens as template-args
18057 !!options
18058 parsoid=wt2html,wt2wt
18059 !! wikitext
18060 {{echo|*a}}
18061 {{echo|#a}}
18062 {{echo|:a}}
18063 !! html
18064 <span about="#mwt1" typeof="mw:Transclusion">
18065 </span><ul about="#mwt1"><li>a</li>
18066 </ul>
18067 <span about="#mwt2" typeof="mw:Transclusion">
18068 </span><ol about="#mwt2"><li>a</li>
18069 </ol>
18070 <span about="#mwt3" typeof="mw:Transclusion">
18071 </span><dl about="#mwt3"><dd>a</dd>
18072 </dl>
18073 !!end
18074
18075 #### ----------------------------------------------------------------
18076 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18077 #### tags. Parsoid's output for these tags differs from that of the
18078 #### PHP parser.
18079 #### ----------------------------------------------------------------
18080
18081 !!test
18082 Ref: 1. ref-location should be replaced with an index span
18083 !!options
18084 parsoid
18085 !! wikitext
18086 A <ref>foo</ref>
18087 B <ref name="x">foo</ref>
18088 C <ref name="y" />
18089 !! html
18090 <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>
18091 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>
18092 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>
18093 !!end
18094
18095 !!test
18096 Ref: 2. ref-tags with identical names should all get the same index
18097 !!options
18098 parsoid
18099 !! wikitext
18100 A <ref name="x">foo</ref>
18101 B <ref name="x" />
18102 !! html
18103 <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>
18104 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>
18105 !!end
18106
18107 !!test
18108 Ref: 3. spaces in ref-names should be ignored
18109 !!options
18110 parsoid
18111 !! wikitext
18112 A <ref name="x">foo</ref>
18113 B <ref name=" x " />
18114 C <ref name= x />
18115 !! html
18116 <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>
18117 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>
18118 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>
18119 !!end
18120
18121 !!test
18122 Ref: 4. 'constructor' should be accepted as a valid ref-name
18123 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18124 !!options
18125 parsoid
18126 !! wikitext
18127 A <ref name="constructor">foo</ref>
18128 !! html
18129 <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>
18130 !!end
18131
18132 !!test
18133 Ref: 5. body should accept generic wikitext
18134 !!options
18135 parsoid
18136 !! wikitext
18137 A <ref>
18138 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18139 </ref>
18140
18141 <references />
18142 !! html
18143 <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\" 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;{\"dsr\":[55,76,null,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]]}&#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>
18144
18145 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18146 <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">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>
18147 </li>
18148 </ol>
18149 !!end
18150
18151 !!test
18152 Ref: 6. indent-pres should not be output in ref-body
18153 !!options
18154 parsoid
18155 !! wikitext
18156 A <ref>
18157 foo
18158 bar
18159 baz
18160 </ref>
18161
18162 <references />
18163 !! html
18164 <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>
18165
18166 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18167 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18168 bar
18169 baz
18170 </li>
18171 </ol>
18172 !!end
18173
18174 !!test
18175 Ref: 7. No p-wrapping in ref-body
18176 !!options
18177 parsoid
18178 !! wikitext
18179 A <ref>
18180 foo
18181
18182 bar
18183
18184
18185 baz
18186
18187
18188
18189 booz
18190 </ref>
18191
18192 <references />
18193 !! html
18194 <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>
18195
18196 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18197 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18198
18199 bar
18200
18201
18202 baz
18203
18204
18205
18206 booz
18207 </li>
18208 </ol>
18209 !!end
18210
18211 !!test
18212 Ref: 8. transclusion wikitext has lower precedence
18213 !!options
18214 parsoid
18215 !! wikitext
18216 A <ref> foo {{echo|</ref> B C}}
18217
18218 <references />
18219 !! html
18220 <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>
18221 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18222 <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>
18223 </ol>
18224 !!end
18225
18226 !!test
18227 Ref: 9. unclosed comments should not leak out of ref-body
18228 !!options
18229 parsoid
18230 !! wikitext
18231 A <ref> foo <!--</ref> B C
18232 <references />
18233 !! html
18234 <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>
18235 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18236 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18237 </ol>
18238 !!end
18239
18240 !!test
18241 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18242 !!options
18243 parsoid
18244 !! wikitext
18245 A <ref> <b> foo </ref> B C
18246
18247 <references />
18248 !! html
18249 <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>
18250
18251
18252 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18253 <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>
18254 </ol>
18255 !!end
18256
18257 !!test
18258 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18259 !!options
18260 parsoid
18261 !! wikitext
18262 A <ref>foo</ref> B
18263 C <ref>bar</ref> D
18264 !! html
18265 <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
18266 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>
18267 !!end
18268
18269 !!test
18270 Ref: 12. ref-tags act as trailing newline migration barrier
18271 !!options
18272 parsoid
18273 !! wikitext
18274 <!--the newline at the end of this line moves out of the p-tag-->a
18275
18276 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18277 <ref />
18278
18279 c
18280 !! html
18281 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18282
18283
18284 <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>
18285 <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>
18286
18287
18288 <p>c</p>
18289 !!end
18290
18291 !!test
18292 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18293 !!options
18294 parsoid
18295 !! wikitext
18296 <ref>foo</ref> A
18297 <ref>bar
18298 </ref> B
18299 !! html
18300 <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
18301 <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>
18302 !!end
18303
18304 !!test
18305 Ref: 14. A nested ref-tag should be emitted as plain text
18306 !!options
18307 parsoid
18308 !! wikitext
18309 <ref>foo <ref>bar</ref> baz</ref>
18310
18311 <references />
18312 !! html
18313 <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>
18314
18315 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18316 <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>
18317 </ol>
18318 !!end
18319
18320 !!test
18321 Ref: 15. ref-tags with identical names should get identical indexes
18322 !!options
18323 parsoid
18324 !! wikitext
18325 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18326 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18327
18328 <references />
18329 !! html
18330 <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>
18331 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>
18332
18333 <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>
18334 </ol>
18335 !!end
18336
18337 ## We don't bother wt2wt-ing non-standard whitespace
18338 !!test
18339 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18340 !!options
18341 parsoid=wt2html
18342 !! wikitext
18343 A <ref >foo</ref >
18344
18345 <references />
18346 !! html
18347 <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>
18348
18349 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18350 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18351 !!end
18352
18353 !!test
18354 References: 1. references tag without any refs should be handled properly
18355 !!options
18356 parsoid
18357 !! wikitext
18358 <references />
18359 !! html
18360 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18361 !!end
18362
18363 !!test
18364 References: 2. references tag with group only outputs references from that group
18365 !!options
18366 parsoid
18367 !! wikitext
18368 A <ref group="a">foo</ref>
18369 B <ref group="b">bar</ref>
18370
18371 <references group="a" />
18372 !! html
18373 <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>
18374 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>
18375
18376 <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>
18377 </ol>
18378 !!end
18379
18380 !!test
18381 References: 3. ref list should be cleared after processing references
18382 !!options
18383 parsoid
18384 !! wikitext
18385 A <ref>foo</ref>
18386
18387 <references />
18388
18389 B <ref>bar</ref>
18390
18391 <references />
18392 !! html
18393 <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>
18394
18395 <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>
18396 </ol>
18397
18398 <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>
18399
18400 <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>
18401 </ol>
18402 !!end
18403
18404 !!test
18405 References: 4. only referenced group should be cleared after processing references
18406 !!options
18407 parsoid
18408 !! wikitext
18409 A <ref group="a">afoo</ref>
18410 B <ref>bfoo</ref>
18411
18412 <references group="a" />
18413
18414 C <ref>cfoo</ref>
18415
18416 <references />
18417 !! html
18418 <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>
18419 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>
18420
18421 <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>
18422 </ol>
18423
18424 <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>
18425
18426 <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>
18427 </ol>
18428 !!end
18429
18430 !!test
18431 References: 5. ref tags in references should be processed while ignoring all other content
18432 !!options
18433 parsoid
18434 !! wikitext
18435 A <ref name="a" />
18436 B <ref name="b">bar</ref>
18437
18438 <references>
18439 <ref name="a">foo</ref>
18440 This should just get lost.
18441 </references>
18442 !! html
18443 <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>
18444 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>
18445
18446
18447 <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":{}}'>
18448 <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>
18449 <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>
18450 </ol>
18451 !!end
18452
18453 !!test
18454 References: 6. <references /> from a transclusion
18455 !!options
18456 parsoid
18457 !! wikitext
18458 <ref>Foo</ref> {{echo|<references />}}
18459 !! html
18460 <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>
18461 !!end
18462
18463 !! test
18464 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18465 !! options
18466 parsoid
18467 !! wikitext
18468 A <ref>foo bar for a</ref>
18469 B <ref group="X" name="b" />
18470
18471 <references />
18472
18473 <references group="X">
18474 <ref name="b">foo</ref>
18475 </references>
18476 !! html
18477 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-2" data-parsoid="{}">[2]</a></span>
18478 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-3-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\" group=\"X\" />"}'><a href="#cite_note-b-3" data-parsoid="{}">[X 1]</a></span></p>
18479
18480 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}">↑</span> foo</li><li about="#cite_note-2" id="cite_note-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-2-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
18481
18482 <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-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-3" id="cite_note-b-3" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-3-0" data-parsoid="{}">↑</a></span> </li></ol>
18483 !! end
18484
18485 !! test
18486 Entities in ref name
18487 !! options
18488 parsoid
18489 !! wikitext
18490 <ref name="test &amp; me">hi</ref>
18491 !! html
18492 <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>
18493 !! end
18494
18495 # This test is wt2html only because we're permitting the serializer to produce
18496 # dirty diffs, normalizing the unclosed references to the self-closed version.
18497 !! test
18498 Generate references for unclosed references tag
18499 !! options
18500 parsoid=wt2html
18501 !! wikitext
18502 a<ref>foo</ref>
18503
18504 <references>
18505 !! html
18506 <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>
18507
18508
18509 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18510 <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>
18511 !! end
18512
18513 !! test
18514 New reference serializes on its own line
18515 !! options
18516 parsoid=wt2wt,html2wt
18517 !! wikitext
18518 foo
18519 <references />
18520 !! html
18521 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18522 !! end
18523
18524 #### ----------------------------------------------------------------
18525 #### The following section of tests are primarily to test
18526 #### wikitext escaping capabilities of Parsoid. Given that
18527 #### escaping can be done any number of ways, the wikitext (input)
18528 #### is always adjusted to reflect how Parsoid adds nowiki
18529 #### escape tags.
18530 ####
18531 #### We are marking several tests as parsoid-only since the
18532 #### HTML in the result section is different from what the
18533 #### PHP parser generates for it.
18534 #### ----------------------------------------------------------------
18535
18536
18537 #### --------------- Headings ---------------
18538 #### 0. Unnested
18539 #### 1. Nested inside html <h1>=foo=</h1>
18540 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18541 #### 3. Nested inside html with wikitext split by html tags
18542 #### 4. No escape needed
18543 #### 5. Empty headings <h1></h1>
18544 #### 6. Heading chars in SOL context
18545 #### ----------------------------------------
18546 !! test
18547 Headings: 0. Unnested
18548 !! options
18549 parsoid
18550 !! wikitext
18551 <nowiki>=foo=</nowiki>
18552
18553 <nowiki> =foo= </nowiki>
18554 <!--cmt-->
18555 <nowiki>=foo=</nowiki>
18556
18557 =foo''a''<nowiki>=</nowiki>
18558 !! html
18559 <p><span typeof="mw:Nowiki">=foo=</span></p>
18560
18561 <p><span typeof="mw:Nowiki"> =foo= </span>
18562 <!--cmt-->
18563 <span typeof="mw:Nowiki">=foo=</span></p>
18564
18565 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18566 !!end
18567
18568 !! test
18569 Headings: 1. Nested inside html
18570 (New headings and existing headings are handled differently)
18571 !! options
18572 parsoid=html2wt
18573 !! wikitext
18574 = =foo= =
18575
18576 == =foo= ==
18577
18578 === =foo= ===
18579
18580 =<nowiki>=foo=</nowiki>=
18581 ==<nowiki>=foo=</nowiki>==
18582 ===<nowiki>=foo=</nowiki>===
18583 ====<nowiki>=foo=</nowiki>====
18584 =====<nowiki>=foo=</nowiki>=====
18585 ======<nowiki>=foo=</nowiki>======
18586
18587 !! html
18588 <h1>=foo=</h1>
18589 <h2>=foo=</h2>
18590 <h3>=foo=</h3>
18591
18592 <h1 data-parsoid='{}'>=foo=</h1>
18593 <h2 data-parsoid='{}'>=foo=</h2>
18594 <h3 data-parsoid='{}'>=foo=</h3>
18595 <h4 data-parsoid='{}'>=foo=</h4>
18596 <h5 data-parsoid='{}'>=foo=</h5>
18597 <h6 data-parsoid='{}'>=foo=</h6>
18598 !!end
18599
18600 !! test
18601 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18602 !! options
18603 parsoid=html2wt
18604 !! wikitext
18605 = foo =
18606 <nowiki>*</nowiki>bar
18607
18608 = foo =
18609 =bar
18610
18611 = foo =
18612 <nowiki>=bar=</nowiki>
18613 !! html
18614 <h1>foo</h1>*bar
18615 <h1>foo</h1>=bar
18616 <h1>foo</h1>=bar=
18617 !!end
18618
18619 !! test
18620 Headings: 3. Nested inside html with wikitext split by html tags
18621 !! options
18622 parsoid=html2wt
18623 !! wikitext
18624 = ='''bold'''<nowiki>foo=</nowiki> =
18625 !! html
18626 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18627 !!end
18628
18629 !! test
18630 Headings: 4a. No escaping needed (testing just h1 and h2)
18631 !! options
18632 parsoid=html2wt
18633 !! wikitext
18634 = =foo =
18635
18636 = foo= =
18637
18638 = =foo= =
18639
18640 = =foo= bar =
18641
18642 == =foo ==
18643
18644 == foo= ==
18645
18646 = ''=''foo= =
18647
18648 = <nowiki>=</nowiki> =
18649 !! html
18650 <h1>=foo</h1>
18651 <h1>foo=</h1>
18652 <h1> =foo= </h1>
18653 <h1>=foo= bar</h1>
18654 <h2>=foo</h2>
18655 <h2>foo=</h2>
18656 <h1><i>=</i>foo=</h1>
18657 <h1><span typeof="mw:Nowiki">=</span></h1>
18658 !!end
18659
18660 !! test
18661 Headings: 4b. No escaping needed (inside p-tags)
18662 !! options
18663 parsoid=html2wt
18664 !! wikitext
18665 ===
18666 =foo= x
18667 =foo= <s></s>
18668 !! html
18669 <p>===
18670 =foo= x
18671 =foo= <s></s>
18672 </p>
18673 !!end
18674
18675 !! test
18676 Headings: 5. Empty headings
18677 !! options
18678 parsoid
18679 !! wikitext
18680 =<nowiki/>=
18681
18682 ==<nowiki/>==
18683
18684 ===<nowiki/>===
18685
18686 ====<nowiki/>====
18687
18688 =====<nowiki/>=====
18689
18690 ======<nowiki/>======
18691 !! html
18692 <h1></h1>
18693 <h2></h2>
18694 <h3></h3>
18695 <h4></h4>
18696 <h5></h5>
18697 <h6></h6>
18698 !!end
18699
18700 !! test
18701 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18702 !! options
18703 parsoid
18704 !! wikitext
18705 <nowiki>=a=</nowiki>
18706
18707 <nowiki>=a=</nowiki>
18708
18709 <nowiki>=a=</nowiki>
18710
18711 <nowiki>=a=</nowiki>
18712 !! html
18713 <p>=a=</p>
18714 <p>=a= </p>
18715 <p>=a= </p>
18716 <p>=a= </p>
18717 !!end
18718
18719 !! test
18720 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18721 !! options
18722 parsoid
18723 !! wikitext
18724 <nowiki>=a=
18725 b</nowiki>
18726
18727 <nowiki>=a=
18728 b</nowiki>
18729
18730 <nowiki>=a=
18731 b</nowiki>
18732
18733 <nowiki>=a=
18734 b</nowiki>
18735 !! html
18736 <p>=a=
18737 b</p>
18738 <p>=a=
18739 b</p>
18740 <p>=a=
18741 b</p>
18742 <p>=a=
18743 b</p>
18744 </p>
18745 !!end
18746
18747 !! test
18748 Headings: 6c. Heading chars in SOL context (leading newline break)
18749 !! options
18750 parsoid
18751 !! wikitext
18752 a
18753 <nowiki>=b=</nowiki>
18754 !! html
18755 <p>a
18756 =b=</p>
18757 !!end
18758
18759 !! test
18760 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18761 !! options
18762 parsoid
18763 !! wikitext
18764 <!--c0--><nowiki>=a=</nowiki>
18765
18766 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18767 !! html
18768 <p><!--c0-->=a=</p>
18769 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18770 !!end
18771
18772 !! test
18773 Headings: 6d. Heading chars in SOL context (No escaping needed)
18774 !! options
18775 parsoid=html2wt
18776 !! wikitext
18777 =a=<div>b</div>
18778 !! html
18779 =a=<div>b</div>
18780 !!end
18781
18782 #### --------------- Lists ---------------
18783 #### 0. Outside nests (*foo, etc.)
18784 #### 1. Nested inside html <ul><li>*foo</li></ul>
18785 #### 2. Inside definition lists
18786 #### 3. Only bullets at start should be escaped
18787 #### 4. No escapes needed
18788 #### 5. No unnecessary escapes
18789 #### 6. Escape bullets in SOL position
18790 #### 7. Escape bullets in a multi-line context
18791 #### ----------------------------------------
18792
18793 !! test
18794 Lists: 0. Outside nests
18795 !! wikitext
18796 <nowiki>*</nowiki>foo
18797
18798 <nowiki>#</nowiki>foo
18799 !! html
18800 <p>*foo
18801 </p><p>#foo
18802 </p>
18803 !!end
18804
18805 !! test
18806 Lists: 1. Nested inside html
18807 !! wikitext
18808 *<nowiki>*foo</nowiki>
18809
18810 *<nowiki>#foo</nowiki>
18811
18812 *<nowiki>:foo</nowiki>
18813
18814 *<nowiki>;foo</nowiki>
18815
18816 #<nowiki>*foo</nowiki>
18817
18818 #<nowiki>#foo</nowiki>
18819
18820 #<nowiki>:foo</nowiki>
18821
18822 #<nowiki>;foo</nowiki>
18823 !! html
18824 <ul>
18825 <li>*foo
18826 </li>
18827 </ul>
18828 <ul>
18829 <li>#foo
18830 </li>
18831 </ul>
18832 <ul>
18833 <li>:foo
18834 </li>
18835 </ul>
18836 <ul>
18837 <li>;foo
18838 </li>
18839 </ul>
18840 <ol>
18841 <li>*foo
18842 </li>
18843 </ol>
18844 <ol>
18845 <li>#foo
18846 </li>
18847 </ol>
18848 <ol>
18849 <li>:foo
18850 </li>
18851 </ol>
18852 <ol>
18853 <li>;foo
18854 </li>
18855 </ol>
18856
18857 !!end
18858
18859 !! test
18860 Lists: 2. Inside definition lists
18861 !! wikitext
18862 ;<nowiki>;foo</nowiki>
18863
18864 ;<nowiki>:foo</nowiki>
18865
18866 ;<nowiki>:foo</nowiki>
18867 :bar
18868
18869 :<nowiki>:foo</nowiki>
18870 !! html
18871 <dl>
18872 <dt>;foo
18873 </dt>
18874 </dl>
18875 <dl>
18876 <dt>:foo
18877 </dt>
18878 </dl>
18879 <dl>
18880 <dt>:foo
18881 </dt>
18882 <dd>bar
18883 </dd>
18884 </dl>
18885 <dl>
18886 <dd>:foo
18887 </dd>
18888 </dl>
18889
18890 !!end
18891
18892 !! test
18893 Lists: 3. Only bullets at start of text should be escaped
18894 !! wikitext
18895 *<nowiki>*foo*bar</nowiki>
18896
18897 *<nowiki>*foo</nowiki>''it''*bar
18898 !! html
18899 <ul>
18900 <li>*foo*bar
18901 </li>
18902 </ul>
18903 <ul>
18904 <li>*foo<i>it</i>*bar
18905 </li>
18906 </ul>
18907
18908 !!end
18909
18910 !! test
18911 Lists: 4. No escapes needed
18912 !! options
18913 parsoid
18914 !! wikitext
18915 *foo*bar
18916
18917 *''foo''*bar
18918
18919 *[[Foo]]: bar
18920
18921 *[[Foo]]*bar
18922 !! html
18923 <ul>
18924 <li>foo*bar
18925 </li>
18926 </ul>
18927 <ul>
18928 <li><i>foo</i>*bar
18929 </li>
18930 </ul>
18931 <ul>
18932 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18933 </li>
18934 </ul>
18935 <ul>
18936 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18937 </li>
18938 </ul>
18939 !!end
18940
18941 !! test
18942 Lists: 5. No unnecessary escapes
18943 !! wikitext
18944 * bar <span><nowiki>[[foo]]</nowiki></span>
18945
18946 *=bar <span><nowiki>[[foo]]</nowiki></span>
18947
18948 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18949
18950 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18951
18952 *=bar <span>foo]]</span>=
18953
18954 * <s></s>: a
18955 !! html
18956 <ul>
18957 <li> bar <span>[[foo]]</span>
18958 </li>
18959 </ul>
18960 <ul>
18961 <li>=bar <span>[[foo]]</span>
18962 </li>
18963 </ul>
18964 <ul>
18965 <li>[[bar <span>[[foo]]</span>
18966 </li>
18967 </ul>
18968 <ul>
18969 <li>]]bar <span>[[foo]]</span>
18970 </li>
18971 </ul>
18972 <ul>
18973 <li>=bar <span>foo]]</span>=
18974 </li>
18975 </ul>
18976 <ul>
18977 <li> <s></s>: a
18978 </li>
18979 </ul>
18980
18981 !!end
18982
18983 !! test
18984 Lists: 6. Escape bullets in SOL position
18985 !! options
18986 parsoid
18987 !! wikitext
18988 <!--cmt--><nowiki>*foo</nowiki>
18989 !! html
18990 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18991 !!end
18992
18993 !! test
18994 Lists: 7. Escape bullets in a multi-line context
18995 !! wikitext
18996 a
18997 <nowiki>*</nowiki>b
18998 !! html
18999 <p>a
19000 *b
19001 </p>
19002 !!end
19003
19004 #### --------------- HRs ---------------
19005 #### 1. Single line
19006 #### -----------------------------------
19007
19008 !! test
19009 HRs: 1. Single line
19010 !! options
19011 parsoid
19012 !! wikitext
19013 ----<nowiki>----</nowiki>
19014 ----=foo=
19015 ----*foo
19016 !! html
19017 <hr><span typeof="mw:Nowiki">----</span>
19018 <hr>=foo=
19019 <hr>*foo
19020 !! end
19021
19022 #### --------------- Tables ---------------
19023 #### 1a. Simple example
19024 #### 1b. No escaping needed (!foo)
19025 #### 1c. No escaping needed (|foo)
19026 #### 1d. No escaping needed (|}foo)
19027 ####
19028 #### 2a. Nested in td (<td>foo|bar</td>)
19029 #### 2b. Nested in td (<td>foo||bar</td>)
19030 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19031 ####
19032 #### 3a. Nested in th (<th>foo!bar</th>)
19033 #### 3b. Nested in th (<th>foo!!bar</th>)
19034 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19035 ####
19036 #### 4a. Escape -
19037 #### 4b. Escape +
19038 #### 4c. No escaping needed
19039 #### --------------------------------------
19040
19041 !! test
19042 Tables: 1a. Simple example
19043 !! wikitext
19044 <nowiki>{|
19045 |}</nowiki>
19046 !! html
19047 <p>{|
19048 |}
19049 </p>
19050 !! end
19051
19052 !! test
19053 Tables: 1b. No escaping needed
19054 !! wikitext
19055 !foo
19056 !! html
19057 <p>!foo
19058 </p>
19059 !! end
19060
19061 !! test
19062 Tables: 1c. No escaping needed
19063 !! wikitext
19064 |foo
19065 !! html
19066 <p>|foo
19067 </p>
19068 !! end
19069
19070 !! test
19071 Tables: 1d. No escaping needed
19072 !! wikitext
19073 |}foo
19074 !! html
19075 <p>|}foo
19076 </p>
19077 !! end
19078
19079 !! test
19080 Tables: 2a. Nested in td
19081 !! options
19082 parsoid=html2wt
19083 !! wikitext
19084 {|
19085 |<nowiki>foo|bar</nowiki>
19086 |-
19087 |x<div><nowiki>a|b</nowiki></div>
19088 |}
19089 !! html
19090 <table><tbody><tr>
19091 <td>foo|bar</td></tr>
19092 <tr><td>x<div>a|b</div></td>
19093 </tbody></table>
19094 !! end
19095
19096 !! test
19097 Tables: 2b. Nested in td
19098 !! options
19099 parsoid
19100 !! wikitext
19101 {|
19102 |<nowiki>foo||bar</nowiki>
19103 |''it''<nowiki>foo||bar</nowiki>
19104 |}
19105 !! html
19106 <table><tbody><tr>
19107 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19108 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19109 !! end
19110
19111 !! test
19112 Tables: 2c. Nested in td -- no escaping needed
19113 !! options
19114 parsoid
19115 !! wikitext
19116 {|
19117 |foo!!bar
19118 |}
19119 !! html
19120 <table><tbody><tr><td>foo!!bar
19121 </td></tr></tbody></table>
19122
19123 !! end
19124
19125 !! test
19126 Tables: 3a. Nested in th
19127 !! options
19128 parsoid
19129 !! wikitext
19130 {|
19131 !foo!bar
19132 |}
19133 !! html
19134 <table><tbody><tr><th>foo!bar
19135 </th></tr></tbody></table>
19136
19137 !! end
19138
19139 !! test
19140 Tables: 3b. Nested in th
19141 !! options
19142 parsoid
19143 !! wikitext
19144 {|
19145 !<nowiki>foo!!bar</nowiki>
19146 |}
19147 !! html
19148 <table>
19149 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19150 </tbody></table>
19151 !! end
19152
19153 !! test
19154 Tables: 3c. Nested in th -- no escaping needed
19155 !! options
19156 parsoid
19157 !! wikitext
19158 {|
19159 !<nowiki>foo||bar</nowiki>
19160 |}
19161 !! html
19162 <table><tbody><tr>
19163 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19164 !! end
19165
19166 !! test
19167 Tables: 4a. Escape -
19168 !! options
19169 parsoid
19170 !! wikitext
19171 {|
19172 !-bar
19173 |-
19174 |<nowiki>-bar</nowiki>
19175 |}
19176 !! html
19177 <table><tbody>
19178 <tr><th>-bar</th></tr>
19179 <tr>
19180 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19181 !! end
19182
19183 !! test
19184 Tables: 4b. Escape +
19185 !! options
19186 parsoid
19187 !! wikitext
19188 {|
19189 !+bar
19190 |-
19191 |<nowiki>+bar</nowiki>
19192 |}
19193 !! html
19194 <table><tbody>
19195 <tr><th>+bar</th></tr>
19196 <tr>
19197 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19198 !! end
19199
19200 !! test
19201 Tables: 4c. No escaping needed
19202 !! options
19203 parsoid
19204 !! wikitext
19205 {|
19206 |foo-bar
19207 |foo+bar
19208 |-
19209 |''foo''-bar
19210 |''foo''+bar
19211 |-
19212 |foo
19213 bar|baz
19214 +bar
19215 -bar
19216 |-
19217 |x
19218 <div>a|b</div>
19219 |}
19220 !! html
19221 <table><tbody>
19222 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19223 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19224 <tr><td>foo
19225 <p>bar|baz
19226 +bar
19227 -bar</p></td></tr>
19228 <tr><td>x
19229 <div>a|b</div></td>
19230 </tbody></table>
19231 !! end
19232
19233 !! test
19234 Tables: 4d. No escaping needed
19235 !! options
19236 parsoid
19237 !! wikitext
19238 {|
19239 |[[Foo]]-bar
19240 ||+1
19241 ||-2
19242 |}
19243 !! html
19244 <table>
19245 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19246 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19247 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19248 </tbody></table>
19249 !! end
19250
19251 !! test
19252 Tables: Digest broken attributes on table and tr tag
19253 !! options
19254 parsoid=wt2html
19255 !! wikitext
19256 {| || |} ++
19257 |- || || ++ --
19258 |- > [
19259 |}
19260 !! html
19261 <table>
19262 <tbody>
19263 <tr></tr>
19264 <tr></tr>
19265 </tbody></table>
19266 !! end
19267
19268 #### --------------- Links ----------------
19269 #### 1. Quote marks in link text
19270 #### 2. Wikilinks: Escapes needed
19271 #### 3. Wikilinks: No escapes needed
19272 #### 4. Extlinks: Escapes needed
19273 #### 5. Extlinks: No escapes needed
19274 #### --------------------------------------
19275 !! test
19276 Links 1. Quote marks in link text
19277 !! options
19278 parsoid
19279 !! wikitext
19280 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19281 !! html
19282 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19283 !! end
19284
19285 !! test
19286 Links 2. WikiLinks: Escapes needed
19287 !! options
19288 parsoid
19289 !! wikitext
19290 [[Foo|[Foobar]]]
19291 [[Foo|<nowiki>Foobar]</nowiki>]]
19292 [[Foo|x [Foobar] x]]
19293 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19294 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19295 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19296 [[Foo|<nowiki>|Bar</nowiki>]]
19297 [[Foo|<nowiki>]]bar</nowiki>]]
19298 [[Foo|<nowiki>[[bar</nowiki>]]
19299 [[Foo|<nowiki>x [[ y</nowiki>]]
19300 [[Foo|<nowiki>x ]] y</nowiki>]]
19301 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19302 !! html
19303 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19304 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19305 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19306 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19307 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19308 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19309 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19310 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19311 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19312 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19313 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19314 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19315 !! end
19316
19317 !! test
19318 Links 3. WikiLinks: No escapes needed
19319 !! options
19320 parsoid
19321 !! wikitext
19322 [[Foo|[Foobar]]
19323 [[Foo|foo|bar]]
19324 !! html
19325 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19326 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19327 !! end
19328
19329 !! test
19330 Links 4. ExtLinks: Escapes needed
19331 !! options
19332 parsoid
19333 !! wikitext
19334 [http://google.com <nowiki>[google]</nowiki>]
19335 [http://google.com <nowiki>google]</nowiki>]
19336
19337 <nowiki>[http://google.com]</nowiki>
19338
19339 <nowiki>[http://google.com google]</nowiki>
19340
19341 !! html
19342 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19343 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19344 <p>[http://google.com]</p>
19345 <p>[http://google.com google]</p>
19346 !! end
19347
19348 !! test
19349 Links 5. ExtLinks: No escapes needed
19350 !! options
19351 parsoid
19352 !! wikitext
19353 [http://google.com [google]
19354 !! html
19355 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19356 !! end
19357
19358 #### --------------- Quotes ---------------
19359 #### 1. Quotes inside <b> and <i>
19360 #### 2. Link fragments separated by <i> and <b> tags
19361 #### 3. Link fragments inside <i> and <b>
19362 #### 4. No escaping needed
19363 #### --------------------------------------
19364 !! test
19365 1. Quotes inside <b> and <i>
19366 !! options
19367 parsoid=html2wt,wt2wt
19368 !! wikitext
19369 ''<nowiki>'foo'</nowiki>''
19370 ''<nowiki>''foo''</nowiki>''
19371 ''<nowiki>'''foo'''</nowiki>''
19372 ''foo''<nowiki/>'s
19373 '''<nowiki>'foo'</nowiki>'''
19374 '''<nowiki>''foo''</nowiki>'''
19375 '''<nowiki>'''foo'''</nowiki>'''
19376 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19377 '''foo'''<nowiki/>'s
19378 '''foo''
19379 ''foo''<nowiki/>'
19380 '<nowiki/>''foo''<nowiki/>'
19381 ''''foo'''
19382 '''foo'''<nowiki/>'
19383 '<nowiki/>'''foo'''<nowiki/>'
19384 ''fools'<span> errand</span>''
19385 ''<span>fool</span>'s errand''
19386 !! html
19387 <p><i>'foo'</i>
19388 <i>''foo''</i>
19389 <i>'''foo'''</i>
19390 <i>foo</i>'s
19391 <b>'foo'</b>
19392 <b>''foo''</b>
19393 <b>'''foo'''</b>
19394 <b>foo'<i>bar'</i>baz</b>
19395 <b>foo</b>'s
19396 '<i>foo</i>
19397 <i>foo</i>'
19398 '<i>foo</i>'
19399 '<b>foo</b>
19400 <b>foo</b>'
19401 '<b>foo</b>'</p>
19402 <i>fools'<span> errand</span></i>
19403 <i><span>fool</span>'s errand</i>
19404 !! end
19405
19406 !! test
19407 2. Link fragments separated by <i> and <b> tags
19408 !! wikitext
19409 [[''foo''<nowiki>hello]]</nowiki>
19410
19411 [['''foo'''<nowiki>hello]]</nowiki>
19412 !! html
19413 <p>[[<i>foo</i>hello]]
19414 </p><p>[[<b>foo</b>hello]]
19415 </p>
19416 !! end
19417
19418 !! test
19419 3. Link fragments inside <i> and <b>
19420 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19421 this is one of the shortcomings of this format)
19422 !! wikitext
19423 ''[[foo''<nowiki>]]</nowiki>
19424
19425 '''[[foo'''<nowiki>]]</nowiki>
19426 !! html
19427 <p><i>[[foo</i>]]
19428 </p><p><b>[[foo</b>]]
19429 </p>
19430 !! end
19431
19432 !! test
19433 4. No escaping needed
19434 !! wikitext
19435 '<span>''bar''</span>'
19436 '<span>'''bar'''</span>'
19437 !! html
19438 <p>'<span><i>bar</i></span>'
19439 '<span><b>bar</b></span>'
19440 </p>
19441 !! end
19442
19443 #### ----------- Paragraphs ---------------
19444 #### 1. No unnecessary escapes
19445 #### --------------------------------------
19446
19447 !! test
19448 1. No unnecessary escapes
19449 !! wikitext
19450 bar <span><nowiki>[[foo]]</nowiki></span>
19451
19452 =bar <span><nowiki>[[foo]]</nowiki></span>
19453
19454 [[bar <span><nowiki>[[foo]]</nowiki></span>
19455
19456 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19457
19458 =bar <span>foo]]</span><nowiki>=</nowiki>
19459 !! html
19460 <p>bar <span>[[foo]]</span>
19461 </p><p>=bar <span>[[foo]]</span>
19462 </p><p>[[bar <span>[[foo]]</span>
19463 </p><p>]]bar <span>[[foo]]</span>
19464 </p><p>=bar <span>foo]]</span>=
19465 </p>
19466 !!end
19467
19468 #### ----------------------- PRE --------------------------
19469 #### 1. Leading whitespace in SOL context should be escaped
19470 #### ------------------------------------------------------
19471 !! test
19472 1. Leading whitespace in SOL context should be escaped
19473 !! options
19474 parsoid
19475 !! wikitext
19476 <nowiki> </nowiki>a
19477
19478 <nowiki> </nowiki> a
19479
19480 <nowiki> </nowiki>a(tab)
19481
19482 <nowiki> </nowiki> a
19483 <!--cmt-->
19484 <nowiki> </nowiki> a
19485
19486 a
19487 <nowiki> </nowiki>b
19488
19489 a
19490 <nowiki> </nowiki>b
19491
19492 a
19493 <nowiki> </nowiki> b
19494 !! html
19495 <p> a</p>
19496 <p> a</p>
19497 <p> a(tab)</p>
19498 <p> a</p>
19499 <p><!--cmt--> a</p>
19500 <p>a
19501 b</p>
19502 <p>a
19503 b</p>
19504 <p>a
19505 b</p>
19506 !! end
19507
19508 #### --------------- Behavior Switches --------------------
19509 !! test
19510 1. Valid behavior switches should be escaped
19511 !! options
19512 parsoid=html2wt
19513 !! wikitext
19514 <nowiki>__TOC__</nowiki>
19515 !! html
19516 __TOC__
19517 !! end
19518
19519 !! test
19520 2. Invalid behavior switches should not be escaped
19521 !! options
19522 parsoid=html2wt
19523 !! wikitext
19524 __TOO__
19525 __|__
19526 !! html
19527 __TOO__
19528 __|__
19529 !! end
19530
19531 #### --------------- HTML tags ---------------
19532 #### 1. a tags
19533 #### 2. other tags
19534 #### 3. multi-line html tag
19535 #### 4. extension tags
19536 #### -----------------------------------------
19537 !! test
19538 1. a tags
19539 !! options
19540 parsoid
19541 !! wikitext
19542 <a href="http://google.com">google</a>
19543 !! html
19544 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19545 !! end
19546
19547 !! test
19548 2. other tags
19549 !! wikitext
19550 <nowiki><div>foo</div>
19551 <div style="color:red">foo</div></nowiki>
19552 !! html
19553 <p>&lt;div&gt;foo&lt;/div&gt;
19554 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19555 </p>
19556 !! end
19557
19558 !! test
19559 3. multi-line html tag
19560 !! wikitext
19561 <nowiki><div
19562 >foo</div
19563 ></nowiki>
19564 !! html
19565 <p>&lt;div
19566 &gt;foo&lt;/div
19567 &gt;
19568 </p>
19569 !! end
19570
19571 !! test
19572 4. extension tags
19573 !! wikitext
19574 <nowiki><ref>foo</ref></nowiki>
19575
19576 <nowiki><ref>bar</nowiki>
19577
19578 baz<nowiki></ref></nowiki>
19579 !! html
19580 <p>&lt;ref&gt;foo&lt;/ref&gt;
19581 </p><p>&lt;ref&gt;bar
19582 </p><p>baz&lt;/ref&gt;
19583 </p>
19584 !! end
19585
19586 #### --------------- Others ---------------
19587 !! test
19588 Escaping nowikis
19589 !! wikitext
19590 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19591 !! html
19592 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19593 </p>
19594 !! end
19595
19596 ## The quote-char in the input is necessary for triggering the bug
19597 !! test
19598 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19599 !! options
19600 parsoid=wt2wt,html2wt
19601 !! wikitext
19602 foo's bar :
19603 !! html
19604 <p>foo's bar :</p>
19605 !! end
19606
19607 !! test
19608
19609 Tag-like HTML structures are passed through as text
19610 !! wikitext
19611 <x y>
19612
19613 <x.y>
19614
19615 <x-y>
19616
19617 1>2
19618
19619 x<y
19620
19621 a>b
19622
19623 1<d e>f
19624 !! html
19625 <p>&lt;x y&gt;
19626 </p><p>&lt;x.y&gt;
19627 </p><p>&lt;x-y&gt;
19628 </p><p>1&gt;2
19629 </p><p>x&lt;y
19630 </p><p>a&gt;b
19631 </p><p>1&lt;d e&gt;f
19632 </p>
19633 !! end
19634
19635
19636 # This was a bug in the PHP parser (see bug 17663 and its dups,
19637 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19638 !! test
19639 Tag names followed by punctuation should not be recognized as tags
19640 !! wikitext
19641 <s.ome> text
19642 !! html
19643 <p>&lt;s.ome&gt; text
19644 </p>
19645 !! end
19646
19647 !! test
19648 HTML tag with necessary entities in attributes
19649 !! wikitext
19650 <span title="&amp;amp;">foo</span>
19651 !! html
19652 <p><span title="&amp;amp;">foo</span>
19653 </p>
19654 !! end
19655
19656 !! test
19657 HTML tag with 'unnecessary' entity encoding in attributes
19658 !! wikitext
19659 <span title="&amp;">foo</span>
19660 !! html
19661 <p><span title="&amp;">foo</span>
19662 </p>
19663 !! end
19664
19665 !! test
19666 HTML tag with broken attribute value quoting
19667 !! wikitext
19668 <span title="Hello world>Foo</span>
19669 !! html
19670 <p><span>Foo</span>
19671 </p>
19672 !! end
19673
19674 !! test
19675 Parsoid-only: HTML tag with broken attribute value quoting
19676 !! options
19677 parsoid
19678 !! wikitext
19679 <span title="Hello world>Foo</span>
19680 !! html
19681 <p><span title="Hello world">Foo</span>
19682 </p>
19683 !! end
19684
19685 !! test
19686 Table with broken attribute value quoting
19687 !! wikitext
19688 {|
19689 | title="Hello world|Foo
19690 |}
19691 !! html
19692 <table>
19693 <tr>
19694 <td>Foo
19695 </td></tr></table>
19696
19697 !! end
19698
19699 !! test
19700 Table with broken attribute value quoting on consecutive lines
19701 !! wikitext
19702 {|
19703 | title="Hello world|Foo
19704 | style="color:red|Bar
19705 |}
19706 !! html
19707 <table>
19708 <tr>
19709 <td>Foo
19710 </td>
19711 <td>Bar
19712 </td></tr></table>
19713
19714 !! end
19715
19716 !! test
19717 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19718 !! options
19719 parsoid
19720 !! wikitext
19721 {|
19722 | title="Hello world|Foo
19723 | style="color:red|Bar
19724 |}
19725 !! html
19726 <table><tbody>
19727 <tr>
19728 <td title="Hello world">Foo
19729 </td><td style="color: red">Bar
19730 </td></tr></tbody></table>
19731
19732 !! end
19733
19734 !! test
19735 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19736 !! options
19737 parsoid
19738 !! wikitext
19739 {{}}
19740 !! html
19741 {{}}
19742 !! end
19743
19744 !! test
19745 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19746 !! options
19747 parsoid
19748 !! wikitext
19749 }}{{
19750 !! html
19751 }}{{
19752 !! end
19753
19754 !!test
19755 Accept empty td cell attribute
19756 !! wikitext
19757 {|
19758 | align="center" | foo || |
19759 |}
19760 !! html
19761 <table>
19762 <tr>
19763 <td align="center"> foo </td>
19764 <td>
19765 </td></tr></table>
19766
19767 !!end
19768
19769 !!test
19770 Non-empty attributes in th-cells
19771 !! wikitext
19772 {|
19773 ! Foo !! style="color: red" | Bar
19774 |}
19775 !! html
19776 <table>
19777 <tr>
19778 <th> Foo </th>
19779 <th style="color: red"> Bar
19780 </th></tr></table>
19781
19782 !!end
19783
19784 !!test
19785 Accept empty attributes in th-cells
19786 !! wikitext
19787 {|
19788 !| foo !!| bar
19789 |}
19790 !! html
19791 <table>
19792 <tr>
19793 <th> foo </th>
19794 <th> bar
19795 </th></tr></table>
19796
19797 !!end
19798
19799 !!test
19800 Empty table rows go away
19801 !! wikitext
19802 {|
19803 | Hello
19804 | there
19805 |- class="foo"
19806 |-
19807 |}
19808 !! html
19809 <table>
19810 <tr>
19811 <td> Hello
19812 </td>
19813 <td> there
19814 </td></tr>
19815
19816 </table>
19817
19818 !! end
19819
19820 ###
19821 ### Parsoid-centric tests for testing RTing of inter-element separators
19822 ### Edge cases not tested by existing parser tests and specific to
19823 ### Parsoid-specific serialization strategies.
19824 ###
19825
19826 !!test
19827 RT-ed inter-element separators should be valid separators
19828 !! wikitext
19829 {|
19830 |- [[foo]]
19831 |}
19832 !! html
19833 <table>
19834
19835 </table>
19836
19837 !!end
19838
19839 !!test
19840 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19841 (Parsoid-only since PHP parser relies on Tidy for correct output)
19842 !!options
19843 parsoid
19844 !! wikitext
19845 {|
19846 |<small>foo
19847 bar
19848 |}
19849
19850 {|
19851 |<small>foo<small>
19852 |}
19853 !! html
19854 !!end
19855
19856 !!test
19857 Empty TD followed by TD with tpl-generated attribute
19858 !! wikitext
19859 {|
19860 |-
19861 |
19862 |{{echo|style='color:red'}}|foo
19863 |}
19864 !! html
19865 <table>
19866
19867 <tr>
19868 <td>
19869 </td>
19870 <td>foo
19871 </td></tr></table>
19872
19873 !!end
19874
19875 !!test
19876 Indented table with an empty td
19877 !! wikitext
19878 {|
19879 |-
19880 |
19881 |foo
19882 |}
19883 !! html
19884 <table>
19885
19886 <tr>
19887 <td>
19888 </td>
19889 <td>foo
19890 </td></tr></table>
19891
19892 !!end
19893
19894 !!test
19895 Empty TR followed by a template-generated TR
19896 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19897 !!options
19898 parsoid
19899 !! wikitext
19900 {|
19901 |-
19902 {{echo|<tr><td>foo</td></tr>}}
19903 |}
19904 !! html
19905 <table>
19906 <tbody>
19907 <tr></tr>
19908 <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}}]}'>
19909 <td>foo</td></tr>
19910 </tbody></table>
19911 !!end
19912
19913 ## PHP and parsoid output differ for this, and since this is primarily
19914 ## for testing Parsoid's serializer, marking this Parsoid only
19915 !!test
19916 Empty TR followed by mixed-ws-comment line should RT correctly
19917 !!options
19918 parsoid
19919 !! wikitext
19920 {|
19921 |-
19922 <!--c-->
19923 |-
19924 <!--c--> <!--d-->
19925 |}
19926 !! html
19927 <table>
19928 <tbody>
19929 <tr></tr>
19930 <!--c-->
19931 <tr>
19932 <!--c--> </tr><!--d-->
19933 </tbody></table>
19934
19935 !!end
19936
19937 !!test
19938 Multi-line image caption generated by templates with/without trailing newlines
19939 !!options
19940 parsoid
19941 !! wikitext
19942 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19943 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19944 !! html
19945 <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>
19946 <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>
19947
19948 !!end
19949
19950 !! test
19951 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19952 !! options
19953 parsoid=html2wt
19954 !! wikitext
19955 <includeonly>foo</includeonly>
19956 new para
19957
19958 [[./Category:Foo]]
19959
19960 = new heading =
19961 !! html
19962 <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>
19963
19964 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19965 !! end
19966
19967 ## PHP emits broken html for this, and since this is primarily
19968 ## a Parsoid serializer test, marking this Parsoid only
19969 !!test
19970 Improperly nested inline or quotes tags with whitespace in between
19971 !!options
19972 parsoid
19973 !! wikitext
19974 <span> <s>x</span> </s>
19975 ''' ''x''' ''
19976 !! html
19977 <p><span> <s>x</s></span><s> </s>
19978 <b> <i>x</i></b><i> </i>
19979 </p>
19980 !!end
19981
19982 !!test
19983 Encapsulate protected attributes from wt
19984 !!options
19985 parsoid
19986 !! wikitext
19987 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19988 !! html
19989 <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>
19990 </body>
19991 !!end
19992
19993 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19994 ## Having nested or stray pre tags results in the attempt to add duplicates,
19995 ## causing an assertion fail. This test tries to prevent that situation.
19996 !!test
19997 Ensure ParagraphWrapper can deal with stray closing pre tags
19998 !!options
19999 parsoid=wt2html
20000 !! wikitext
20001 plain text</pre>
20002 !! html
20003 plain text
20004 !!end
20005
20006 !!test
20007 1. Ensure fostered text content is wrapped in spans
20008 !!options
20009 parsoid=wt2html
20010 !! wikitext
20011 <table>hi</table><table>ho</table>
20012 !! html
20013 <span>hi</span>
20014 <table></table>
20015 <span>ho</span>
20016 <table></table>
20017 !!end
20018
20019 !!test
20020 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20021 !!options
20022 parsoid=wt2html,wt2wt
20023 !! wikitext
20024 <table>
20025 <tr> || ||
20026 <td> a
20027 </table>
20028 !! html
20029 <span> || ||</span>
20030 <table>
20031 <tbody>
20032 <tr>
20033 <td> a</td></tr>
20034 </tbody></table>
20035 !!end
20036
20037 !!test
20038 Encapsulation properly handles null DSR information from foster box
20039 !!options
20040 parsoid=wt2html,wt2wt
20041 !! wikitext
20042 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20043 !! html
20044 <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;
20045 <table>foo
20046 <tr>
20047 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20048 <table>
20049 <tbody>
20050 <tr>
20051 <td>bar</td></tr></tbody></table>
20052 !!end
20053
20054 !!test
20055 1. Encapsulate foster-parented transclusion content
20056 !!options
20057 parsoid=wt2wt,wt2html
20058 !! wikitext
20059 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20060 !! html
20061 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20062 <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
20063 <tr>
20064 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20065 <table>
20066 <tbody>
20067 <tr>
20068 <td>bar</td></tr></tbody></table>
20069 !!end
20070
20071 !!test
20072 2. Encapsulate foster-parented transclusion content
20073 !!options
20074 parsoid=wt2wt,wt2html
20075 !! wikitext
20076 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20077 !! html
20078 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20079 <table>
20080 <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>
20081 <tr>
20082 <td>bar</td></tr></table>&quot;]}">foo</div>
20083 <table>
20084 <tbody>
20085 <tr>
20086 <td>bar</td></tr></tbody></table>
20087 !!end
20088
20089 !!test
20090 3. Encapsulate foster-parented transclusion content
20091 !!options
20092 parsoid=wt2wt,wt2html
20093 !! wikitext
20094 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20095 !! html
20096 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20097 <table>
20098 <div>
20099 <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>
20100 <tr>
20101 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20102 <p>foo</p></div>
20103 <table>
20104 <tbody>
20105 <tr>
20106 <td>bar</td></tr></tbody></table>
20107 !!end
20108
20109 !!test
20110 4. Encapsulate foster-parented transclusion content
20111 !!options
20112 parsoid=wt2wt,wt2html
20113 !! wikitext
20114 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20115 !! html
20116 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20117 <table>
20118 <div>
20119 <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>
20120 <tr>
20121 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20122 <p>foo</p></div>
20123 <table>
20124 <tbody>
20125 <tr>
20126 <td>bar</td></tr></tbody></table>
20127 !!end
20128
20129 !!test
20130 5. Encapsulate foster-parented transclusion content
20131 !!options
20132 parsoid=wt2wt,wt2html
20133 !! wikitext
20134 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20135 !! html
20136 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20137 <table>
20138 <tr>
20139 <td>
20140 <div>
20141 <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>
20142 <table>
20143 <tbody>
20144 <tr>
20145 <td>
20146 <div>
20147 <p>foo</p></div></td></tr></tbody></table>
20148 !!end
20149
20150 !!test
20151 6. Encapsulate foster-parented transclusion content
20152 !!options
20153 parsoid=wt2wt,wt2html
20154 !! wikitext
20155 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20156 !! html
20157 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20158 <table>
20159 <tr>
20160 <td>
20161 <div>
20162 <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>
20163 <table>
20164 <tbody>
20165 <tr>
20166 <td>
20167 <div>
20168 <p>foo</p></div></td></tr></tbody></table>
20169 <p>ok</p>
20170 !!end
20171
20172 !!test
20173 7. Encapsulate foster-parented transclusion content
20174 !!options
20175 parsoid=wt2wt,wt2html
20176 !! wikitext
20177 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20178 !! html
20179 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20180 <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;
20181 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20182 <td>bar</td></table>&quot;]}">foo</p>
20183 <table>
20184 <tbody>
20185 <tr>
20186 <td>bar</td></tr></tbody></table>
20187 !!end
20188
20189 !!test
20190 8. Encapsulate foster-parented transclusion content
20191 !!options
20192 parsoid=wt2wt,wt2html
20193 !! wikitext
20194 {{echo|a
20195 }}{|{{echo|style='color:red'}}
20196 |-
20197 |b
20198 |}
20199 !! html
20200 <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>
20201 <table>
20202 <tbody>
20203 <tr>
20204 <td>b</td></tr></tbody></table>
20205 !!end
20206
20207 !!test
20208 9. Encapsulate foster-parented transclusion content
20209 !!options
20210 parsoid=wt2wt,wt2html
20211 !! wikitext
20212 <table>{{echo|hi</table>hello}}
20213 !! html
20214 <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>
20215 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20216 !!end
20217
20218 !!test
20219 Table in fosterable position
20220 !!options
20221 parsoid=wt2html,wt2wt
20222 !! wikitext
20223 {{OpenTable}}
20224 <div>
20225 {|
20226 |}
20227 </div>
20228 |}
20229 !! html
20230 <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="{}">
20231 </span>
20232 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20233
20234 <table>
20235 </table>
20236 !!end
20237
20238 !!test
20239 Support <object> element with .data attribute
20240 !!options
20241 parsoid=html2wt
20242 !! wikitext
20243 <object data="test.swf"></object>
20244 !! html
20245 <object data="test.swf"></object>
20246 !!end
20247
20248 # -----------------------------------------------------------------
20249 # The following section of tests are primarily to spec requirements
20250 # around serialization of new/edited content.
20251 #
20252 # All these tests are marked Parsoid html2wt and html2html only
20253 # ----------------------------------------------------------------
20254
20255 !! test
20256 Image: Modifying size of an image (1)
20257 !! options
20258 parsoid={
20259 "modes": ["wt2wt"],
20260 "changes": [
20261 ["img[height]", "attr", "height", "22"],
20262 ["img[width]", "attr", "width", "200"]
20263 ]
20264 }
20265 !! wikitext
20266 [[Image:Foobar.jpg|230x230px]]
20267 !! wikitext/edited
20268 [[Image:Foobar.jpg|200x200px]]
20269 !!end
20270
20271 !! test
20272 Image: Modifying size of an image (2)
20273 !! options
20274 parsoid={
20275 "modes": ["wt2wt"],
20276 "changes": [
20277 ["img[height]", "attr", "height", "100"],
20278 ["img[width]", "attr", "width", "500"]
20279 ]
20280 }
20281 !! wikitext
20282 [[Image:Foobar.jpg|230x230px]]
20283 !! wikitext/edited
20284 [[Image:Foobar.jpg|500x500px]]
20285 !!end
20286
20287 # Change in size is ignored so long as class='mw-default-size'
20288 !! test
20289 Image: Modifying size of an image (3)
20290 !! options
20291 parsoid={
20292 "modes": ["wt2wt"],
20293 "changes": [
20294 ["figure[class]", "removeClass", "mw-default-size"],
20295 ["figure img", "attr", "height", "19"],
20296 ["figure img", "attr", "width", "170"]
20297 ]
20298 }
20299 !! wikitext
20300 [[Image:Foobar.jpg|thumb]]
20301 !! wikitext/edited
20302 [[Image:Foobar.jpg|thumb|170x170px]]
20303 !!end
20304
20305 !! test
20306 Image: Modifying alignment of an image (bug 48665)
20307 !! options
20308 parsoid={
20309 "modes": ["wt2wt"],
20310 "changes": [
20311 ["figure[class]", "removeClass", "mw-halign-right"],
20312 ["figure[class]", "addClass", "mw-halign-left"]
20313 ]
20314 }
20315 !! wikitext
20316 [[Image:Foobar.jpg|thumb|caption|right]]
20317 !! wikitext/edited
20318 [[Image:Foobar.jpg|thumb|caption|left]]
20319 !! end
20320
20321 !! test
20322 Image: Modifying mw-default-size of an frameless image (bug 62805)
20323 !! options
20324 parsoid={
20325 "modes": ["wt2wt"],
20326 "changes": [
20327 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20328 ]
20329 }
20330 !! wikitext
20331 [[Image:Foobar.jpg|frameless|right]]
20332 !! wikitext/edited
20333 [[Image:Foobar.jpg|frameless|right|220x220px]]
20334 !! end
20335
20336 !! test
20337 Image: Modifying valign of an image (bug 49221)
20338 !! options
20339 parsoid={
20340 "modes": ["wt2wt"],
20341 "changes": [
20342 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20343 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20344 ]
20345 }
20346 !! wikitext
20347 [[File:Foobar.jpg|20px|middle]]
20348 !! wikitext/edited
20349 [[File:Foobar.jpg|20px|text-top]]
20350 !! end
20351
20352 !! test
20353 Image: Modifying alt attribute of an image (bug 56400)
20354 !! options
20355 parsoid={
20356 "modes": ["wt2wt"],
20357 "changes": [
20358 ["img[alt]", "attr", "alt", "some alternate edited text"]
20359 ]
20360 }
20361 !! wikitext
20362 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20363 !! wikitext/edited
20364 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20365 !!end
20366
20367 !! test
20368 Image: Modifying caption of an image
20369 !! options
20370 parsoid={
20371 "modes": ["wt2wt"],
20372 "changes": [
20373 ["figcaption", "text", "new caption"]
20374 ]
20375 }
20376 !! wikitext
20377 [[Image:Foobar.jpg|thumb|original caption]]
20378 !! wikitext/edited
20379 [[Image:Foobar.jpg|thumb|new caption]]
20380 !!end
20381
20382 !! test
20383 Image: empty alt attribute (bug 48924)
20384 !! options
20385 parsoid
20386 !! wikitext
20387 [[File:Foobar.jpg|thumb|alt=|bar]]
20388 !! html
20389 <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>
20390 !! end
20391
20392 #!! test
20393 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20394 #!! options
20395 #parsoid=html2wt
20396 #language=ar
20397 #!! input
20398 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20399 #!! result
20400 #<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>
20401 #!! end
20402
20403 !! test
20404 Image: Block level image should have \n before and after
20405 !! options
20406 parsoid
20407 !! wikitext
20408 123
20409 [[File:Foobar.jpg|right|thumb|150x150px]]
20410 456
20411 !! html
20412 <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>
20413 !!end
20414
20415 !! test
20416 Image: New block level image should have \n before and after (existing
20417 content)
20418 !! options
20419 parsoid
20420 !! wikitext
20421 123
20422 [[File:Foobar.jpg|right|thumb|150x150px]]
20423 456
20424 !! html
20425 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20426 <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>
20427 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20428 !!end
20429
20430 !! test
20431 Image: upright option (parsoid)
20432 !! options
20433 parsoid
20434 !! wikitext
20435 [[File:Foobar.jpg|thumb|upright|caption]]
20436 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20437 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20438 !! html
20439 <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="19" width="170"/></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>
20440 !!end
20441
20442 !! test
20443 Image: upright option is ignored on inline and frame images (parsoid)
20444 !! options
20445 parsoid
20446 !! wikitext
20447 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20448 !! html
20449 <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>
20450 !!end
20451
20452 !! test
20453 Image: from basic HTML (1)
20454 !! options
20455 parsoid=html2wt
20456 !! html/parsoid
20457 <span typeof="mw:Image">
20458 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20459 </span>
20460 !! wikitext
20461 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20462 !! end
20463
20464 !! test
20465 Image: from basic HTML (2)
20466 !! options
20467 parsoid=html2wt
20468 !! html/parsoid
20469 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20470 !! wikitext
20471 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20472 !! end
20473
20474 !! test
20475 Image: from basic HTML (3)
20476 !! options
20477 parsoid=html2wt
20478 !! html/parsoid
20479 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20480 !! wikitext
20481 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20482 !! end
20483
20484 !! test
20485 Image: from basic HTML (4)
20486 !! options
20487 parsoid=html2wt
20488 !! html/parsoid
20489 <img src="File:Foobar.jpg">
20490 !! wikitext
20491 [[File:Foobar.jpg|link=]]
20492 !! end
20493
20494 !! test
20495 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20496 !! options
20497 parsoid=html2wt
20498 !! wikitext
20499 * foo
20500 !! html
20501 <ul>
20502 <li><p>foo</p></li>
20503 </ul>
20504 !! end
20505
20506 !! test
20507 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20508 !! options
20509 parsoid=html2wt
20510 !! wikitext
20511 * foo
20512 !! html
20513 <ul> <li>foo</li></ul>
20514 !! end
20515
20516 !! test
20517 Don't strip leading whitespace when handling indent-pre suppressing tags
20518 !! options
20519 parsoid=html2wt
20520 !! wikitext
20521 {|
20522 | indented row
20523 |}
20524 <blockquote>
20525 '''This is very bold of you!'''
20526
20527 {|
20528 |
20529 indented cell (no pre-wrapping!)
20530 |}
20531 </blockquote>
20532 foo
20533 <div>bar</div>
20534 !! html
20535 <table>
20536 <tr><td> indented row</td></tr>
20537 </table>
20538 <blockquote><p>
20539 <b>This is very bold of you!</b>
20540 </p>
20541 <table><tr><td>
20542 indented cell (no pre-wrapping!)
20543 </td></tr></table>
20544 </blockquote>
20545 <p>foo</p>
20546 <div>bar</div>
20547 !! end
20548
20549 !! test
20550 Strip leading whitespace when handling indent-pre inducing tags
20551 !! options
20552 parsoid=html2wt
20553 !! wikitext
20554 foo
20555 <span>bar</span>
20556
20557 <span>foo2
20558 </span>bar2
20559
20560 <div>foo</div>
20561 <span>bar</span>
20562
20563 <div>
20564 <span>foo</span>
20565 </div>
20566 !! html
20567 <p>foo</p>
20568 <span>bar</span>
20569
20570 <span>foo2
20571 </span>bar2
20572
20573 <div>foo</div>
20574 <span>bar</span>
20575
20576 <div>
20577 <span>foo</span>
20578 </div>
20579 !! end
20580
20581 !! test
20582 Lists: Add space after bullets
20583 !! options
20584 parsoid=html2wt
20585 !! wikitext
20586 * foo
20587 * bar
20588 * <span> baz</span>
20589 !! html
20590 <ul>
20591 <li>foo</li>
20592 <li> bar</li>
20593 <li><span> baz</span></li>
20594 </ul>
20595 !! end
20596
20597 !! test
20598 Lists: Dont insert newlines in a serialized list item.
20599 !! options
20600 parsoid=html2wt
20601 !! wikitext
20602 * a<br>b
20603 * c
20604 !! html
20605 <ul><li>a<br>b</li><li>c</li></ul>
20606 !! end
20607
20608 !! test
20609 Headings: Add space before/after == (Bug 51744)
20610 !! options
20611 parsoid=html2wt
20612 !! wikitext
20613 == foo ==
20614
20615 == bar ==
20616
20617 == baz ==
20618
20619 == <span> baz</span> ==
20620 !! html
20621 <h2>foo</h2>
20622 <h2> bar</h2>
20623 <h2>baz </h2>
20624 <h2><span> baz</span></h2>
20625 !! end
20626
20627 !! test
20628 Parsoid: Serialize positional parameters with = in them as named parameter
20629 !! options
20630 parsoid=html2wt
20631 !! wikitext
20632 {{echo|1 = f=oo}}
20633
20634 {{echo|1 = f=oo|2 = bar}}
20635
20636 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20637 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20638 {{echo|<nowiki>f=oo</nowiki>|bar}}
20639 !! html
20640 <p about="#mwt1" typeof="mw:Transclusion"
20641 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20642
20643 <p about="#mwt1" typeof="mw:Transclusion"
20644 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20645
20646 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20647 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20648 <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>
20649 !! end
20650
20651 !! test
20652 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20653 !! options
20654 parsoid=html2wt
20655 !! wikitext
20656 <div>a
20657 b
20658 </div>
20659 <div>a
20660 b
20661 </div>
20662 <div>
20663 a
20664
20665 b
20666 </div>
20667 !! html
20668 <div>a<p>b</p></div>
20669 <div>a
20670 <p>b</p></div>
20671 <div>
20672 a
20673 <p>b</p></div>
20674 !! end
20675
20676 !! test
20677 Substrings resembling wikitext in hrefs should not get nowiki escapes
20678 !! options
20679 parsoid=html2wt
20680 !! wikitext
20681 [[Foo''bar''baz]]
20682 !! html
20683 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20684 !! end
20685
20686 #-----------------------------
20687 # I/B quote minimization tests
20688 #-----------------------------
20689
20690 !! test
20691 1. I/B quote minimization: wikitext-only tags should be combined
20692 !! options
20693 parsoid=html2wt
20694 !! wikitext
20695 ''AB''
20696
20697 '''AB'''
20698
20699 ''A'''B'''''
20700
20701 '''A''B'''''
20702
20703 '''A''BC''D'''
20704
20705 '''''AB'''''
20706
20707 '''''AB'''''
20708
20709 '''''AB'''''
20710 !! html
20711 <p><i>A</i><i>B</i></p>
20712 <p><b>A</b><b>B</b></p>
20713 <p><i>A</i><b><i>B</i></b></p>
20714 <p><b>A</b><i><b>B</b></i></p>
20715 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20716 <p><i><b>A</b></i><i><b>B</b></i></p>
20717 <p><i><b>A</b></i><b><i>B</i></b></p>
20718 <p><b><i>A</i></b><i><b>B</b></i></p>
20719 !! end
20720
20721 !! test
20722 2. I/B quote minimization: wikitext and html tags should not be combined
20723 !! options
20724 parsoid=html2wt
20725 !! wikitext
20726 ''A''<i>B</i>
20727
20728 ''A'''''<i>B</i>'''
20729 !! html
20730 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20731 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20732 !! end
20733
20734 !! test
20735 3. I/B quote minimization: templated content stops minimization
20736 !! options
20737 parsoid=html2wt
20738 !! wikitext
20739 ''A''{{echo|''B''}}
20740
20741 ''A''{{echo|'''''B'''''}}
20742 !! html
20743 <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>
20744 <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>
20745 !! end
20746
20747 !! test
20748 4. I/B quote minimization: new content should be mimimized with adjacent old content
20749 !! options
20750 parsoid=html2wt
20751 !! wikitext
20752 ''AB''
20753
20754 '''AB'''
20755
20756 ''A'''B'''''
20757 !! html
20758 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20759 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20760 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20761 !! end
20762
20763 #------------------------------------
20764 # End of I/B quote minimization tests
20765 #------------------------------------
20766
20767 !!test
20768 Bug 54262: New entities
20769 !! options
20770 parsoid=html2wt
20771 !! wikitext
20772 &nbsp;
20773 !! html
20774 <span typeof="mw:Entity">&nbsp;</span>
20775 !! end
20776
20777 ## Note that there is no wikitext output for 'unknownproperty' ##
20778 ## Unknown magic words are silently dropped ##
20779
20780 !! test
20781 Magic words
20782 !! options
20783 parsoid=html2wt
20784 !! wikitext
20785 __TOC__
20786 __NOTOC__
20787 __FORCETOC__
20788 __INDEX__
20789 __NOINDEX__
20790 __NOGALLERY__
20791 __NOEDITSECTION__
20792 __NOTITLECONVERT__
20793 __NOCONTENTCONVERT__
20794 !! html
20795 <meta property='mw:PageProp/toc' />
20796 <meta property='mw:PageProp/notoc' />
20797 <meta property='mw:PageProp/forcetoc' />
20798 <meta property='mw:PageProp/index' />
20799 <meta property='mw:PageProp/noindex' />
20800 <meta property='mw:PageProp/nogallery' />
20801 <meta property='mw:PageProp/noeditsection' />
20802 <meta property='mw:PageProp/notitleconvert' />
20803 <meta property='mw:PageProp/nocontentconvert' />
20804 <meta property='mw:PageProp/unknownproperty' />
20805 !! end
20806
20807 !! test
20808 Consecutive <pre>s should not get merged
20809 !! options
20810 parsoid=html2wt,html2html
20811 !! wikitext
20812 a
20813
20814 b
20815
20816 c
20817
20818 d
20819
20820 e
20821
20822
20823
20824 f
20825 !! html
20826 <pre>a</pre><pre>b</pre>
20827
20828 <pre>c
20829 </pre><pre>
20830 d</pre>
20831
20832 <pre>e
20833
20834 </pre><pre>
20835
20836 f</pre>
20837 !! end
20838
20839 !! test
20840 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20841 !! options
20842 parsoid=html2wt
20843 !! wikitext
20844 [[Special:BookSources/1234567890|ISBN 1234567895]]
20845 !! html
20846 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20847 !! end
20848
20849 !! test
20850 Edited RFC links not serializable as RFC links should serialize as extlinks
20851 !! options
20852 parsoid=html2wt
20853 !! wikitext
20854 [//tools.ietf.org/html/rfc123 New RFC]
20855 !! html
20856 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20857 !! end
20858
20859 !! test
20860 Edited PMID links not serializable as PMID links should serialize as extlinks
20861 !! options
20862 parsoid=html2wt
20863 !! wikitext
20864 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20865 !! html
20866 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20867 !! end
20868
20869 !! test
20870 Edited Redirect link should emit a non-piped wikitext link
20871 !! options
20872 parsoid=html2wt
20873 !! wikitext
20874 #REDIRECT [[Bar]]
20875 !! html
20876 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20877 !! end
20878
20879 # -----------------------------------------------------------------
20880 # End of section for Parsoid-only html2wt tests for serialization
20881 # of new content
20882 # -----------------------------------------------------------------
20883
20884 TODO:
20885 more images
20886 more tables
20887 character entities
20888 and much more
20889 Try for 100% code coverage