55801aadfa08414a6896df29963c588a873aff39
[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>7
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.jpg has actual size of 1941x220
10797 # Portrait.svg has actual size of 180x240
10798 # Portrait.png has actual size of 180x240
10799 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10800 # a scalable format.
10801 # 2. Framed images always ignore size options; always render at default size.
10802 # 3. "Unspecified format" and border are the only types which can be
10803 # enlarged.
10804 # 4. Without an explicit size specification, thumbnails are
10805 # resized to a square bounding box.
10806
10807 !! test
10808 Image: "unspecified format" and border enlarge
10809 !! options
10810 parsoid=wt2html,wt2wt,html2html
10811 !! wikitext
10812 [[File:Foobar.jpg|2000px]]
10813
10814 [[File:Foobar.jpg|border|2000px]]
10815 !! html/php
10816 <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>
10817 </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>
10818 </p>
10819 !! html/parsoid
10820 <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>
10821 <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>
10822 !! end
10823
10824 !! test
10825 Image: "unspecified format" and border reduce
10826 !! options
10827 parsoid=wt2html,wt2wt,html2html
10828 !! wikitext
10829 [[File:Foobar.jpg|1000px]]
10830
10831 [[File:Foobar.jpg|border|1000px]]
10832 !! html/php
10833 <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>
10834 </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>
10835 </p>
10836 !! html/parsoid
10837 <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>
10838 <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>
10839 !! end
10840
10841 !! test
10842 Image: thumbs reduce
10843 !! options
10844 parsoid=wt2html,wt2wt,html2html
10845 !! wikitext
10846 [[File:Foobar.jpg|thumb|50px]]
10847 !! html/php
10848 <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>
10849
10850 !! html/parsoid
10851 <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>
10852 !! end
10853
10854 !! test
10855 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10856 !! options
10857 parsoid=wt2html,wt2wt,html2html
10858 !! wikitext
10859 [[File:Foobar.jpg|thumb|2000px]]
10860
10861 [[File:Foobar.svg|thumb|2000px]]
10862 !! html/php
10863 <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>
10864 <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>
10865
10866 !! html/parsoid
10867 <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>
10868 <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>
10869 !! end
10870
10871 !! test
10872 Image: frameless can reduce in size
10873 !! options
10874 parsoid=wt2html,wt2wt,html2html
10875 !! wikitext
10876 [[File:Foobar.jpg|frameless|50px]]
10877 !! html/php
10878 <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>
10879 </p>
10880 !! html/parsoid
10881 <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>
10882 !! end
10883
10884 !! test
10885 Image: bitmap frameless can't be enlarged past original size, but vector can
10886 !! options
10887 parsoid=wt2html,wt2wt,html2html
10888 !! wikitext
10889 [[File:Foobar.jpg|frameless|2000px]]
10890
10891 [[File:Foobar.svg|frameless|2000px]]
10892 !! html/php
10893 <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>
10894 </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>
10895 </p>
10896 !! html/parsoid
10897 <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>
10898 <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>
10899 !! end
10900
10901 !! test
10902 Image: framed images are always unscaled.
10903 !! options
10904 parsoid=wt2html,wt2wt,html2html
10905 !! wikitext
10906 [[File:Foobar.jpg|frame]]
10907
10908 [[File:Foobar.jpg|frame|50px]]
10909
10910 [[File:Foobar.jpg|frame|50x50px]]
10911
10912 [[File:Foobar.jpg|frame|2000px]]
10913 !! html/php
10914 <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>
10915 <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>
10916 <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>
10917 <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>
10918
10919 !! html/parsoid
10920 <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>
10921 !! end
10922
10923 !! test
10924 Image: thumbnails of the default size use a square bounding box.
10925 !! options
10926 thumbsize=220
10927 !! wikitext
10928 [[File:Foobar.jpg|thumb|landscape thumb]]
10929
10930 [[File:Foobar.jpg|frameless|landscape frameless]]
10931
10932 [[File:Portrait.png|thumb|should use 220x220px bounding box]]
10933
10934 [[File:Portrait.png|frameless|should use 220x220px bounding box]]
10935
10936 [[File:Portrait.svg|thumb|should use 220x220px bounding box]]
10937
10938 [[File:Portrait.svg|frameless|should use 220x220px bounding box]]
10939 !! html/php
10940 <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>landscape thumb</div></div></div>
10941 <p><a href="/wiki/File:Foobar.jpg" class="image" title="landscape frameless"><img alt="landscape frameless" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" 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>
10942 </p>
10943 <div class="thumb tright"><div class="thumbinner" style="width:167px;"><a href="/wiki/File:Portrait.png" class="image"><img alt="" src="http://example.com/images/thumb/9/93/Portrait.png/165px-Portrait.png" width="165" height="220" class="thumbimage" srcset="http://example.com/images/9/93/Portrait.png 1.5x, http://example.com/images/9/93/Portrait.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Portrait.png" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>should use 220x220px bounding box</div></div></div>
10944 <p><a href="/wiki/File:Portrait.png" class="image" title="should use 220x220px bounding box"><img alt="should use 220x220px bounding box" src="http://example.com/images/thumb/9/93/Portrait.png/165px-Portrait.png" width="165" height="220" srcset="http://example.com/images/9/93/Portrait.png 1.5x, http://example.com/images/9/93/Portrait.png 2x" /></a>
10945 </p>
10946 <div class="thumb tright"><div class="thumbinner" style="width:167px;"><a href="/wiki/File:Portrait.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/fc/Portrait.svg/165px-Portrait.svg.png" width="165" height="220" class="thumbimage" srcset="http://example.com/images/thumb/f/fc/Portrait.svg/247px-Portrait.svg.png 1.5x, http://example.com/images/thumb/f/fc/Portrait.svg/330px-Portrait.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Portrait.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>should use 220x220px bounding box</div></div></div>
10947 <p><a href="/wiki/File:Portrait.svg" class="image" title="should use 220x220px bounding box"><img alt="should use 220x220px bounding box" src="http://example.com/images/thumb/f/fc/Portrait.svg/165px-Portrait.svg.png" width="165" height="220" srcset="http://example.com/images/thumb/f/fc/Portrait.svg/247px-Portrait.svg.png 1.5x, http://example.com/images/thumb/f/fc/Portrait.svg/330px-Portrait.svg.png 2x" /></a>
10948 </p>
10949 !! end
10950
10951 !! test
10952 Image: bitmap thumbnails reduce only if thumb size is smaller than inherent size.
10953 !! options
10954 thumbsize=300
10955 !! wikitext
10956 [[File:Portrait.png|thumb|should use inherent 180x240px size]]
10957
10958 [[File:Portrait.png|frameless|should use inherent 180x240px size]]
10959
10960 [[File:Portrait.svg|thumb|will resize to 300x300px]]
10961
10962 [[File:Portrait.svg|frameless|will resize to 300x300px]]
10963 !! html/php
10964 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Portrait.png" class="image"><img alt="" src="http://example.com/images/9/93/Portrait.png" width="180" height="240" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Portrait.png" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>should use inherent 180x240px size</div></div></div>
10965 <p><a href="/wiki/File:Portrait.png" class="image" title="should use inherent 180x240px size"><img alt="should use inherent 180x240px size" src="http://example.com/images/9/93/Portrait.png" width="180" height="240" /></a>
10966 </p>
10967 <div class="thumb tright"><div class="thumbinner" style="width:227px;"><a href="/wiki/File:Portrait.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/fc/Portrait.svg/225px-Portrait.svg.png" width="225" height="300" class="thumbimage" srcset="http://example.com/images/thumb/f/fc/Portrait.svg/337px-Portrait.svg.png 1.5x, http://example.com/images/thumb/f/fc/Portrait.svg/450px-Portrait.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Portrait.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>will resize to 300x300px</div></div></div>
10968 <p><a href="/wiki/File:Portrait.svg" class="image" title="will resize to 300x300px"><img alt="will resize to 300x300px" src="http://example.com/images/thumb/f/fc/Portrait.svg/225px-Portrait.svg.png" width="225" height="300" srcset="http://example.com/images/thumb/f/fc/Portrait.svg/337px-Portrait.svg.png 1.5x, http://example.com/images/thumb/f/fc/Portrait.svg/450px-Portrait.svg.png 2x" /></a>
10969 </p>
10970 !! end
10971
10972 ###################
10973
10974 !! test
10975 Link to image page- image page normally doesn't exists, hence edit link
10976 Add test with existing image page
10977 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10978 !! wikitext
10979 [[:Image:test]]
10980 !! html
10981 <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>
10982 </p>
10983 !! end
10984
10985 !! test
10986 bug 18784 Link to non-existent image page with caption should use caption as link text
10987 !! wikitext
10988 [[:Image:test|caption]]
10989 !! html
10990 <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>
10991 </p>
10992 !! end
10993
10994 !! test
10995 Frameless image caption with a free URL
10996 !! wikitext
10997 [[File:Foobar.jpg|http://example.com]]
10998 !! html/php
10999 <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>
11000 </p>
11001 !! html/parsoid
11002 <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>
11003 !! end
11004
11005 !! test
11006 Thumbnail image caption with a free URL
11007 !! options
11008 thumbsize=220
11009 !! wikitext
11010 [[File:Foobar.jpg|thumb|http://example.com]]
11011 !! html/php
11012 <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>
11013
11014 !! html/parsoid
11015 <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>
11016 !! end
11017
11018 !! test
11019 Thumbnail image caption with a free URL and explicit alt
11020 !! options
11021 thumbsize=220
11022 parsoid=wt2html,wt2wt,html2html
11023 !! wikitext
11024 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11025 !! html/php
11026 <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>
11027
11028 !! html/parsoid
11029 <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>
11030 !! end
11031
11032 !! test
11033 SVG thumbnails with no language set
11034 !! options
11035 !! wikitext
11036 [[File:Foobar.svg|thumb|caption]]
11037 !! html/php
11038 <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>
11039
11040 !! html/parsoid
11041 <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>
11042 !! end
11043
11044 !! test
11045 SVG thumbnails with language de
11046 !! options
11047 parsoid=wt2html,wt2wt,html2html
11048 !! wikitext
11049 [[File:Foobar.svg|thumb|caption|lang=de]]
11050 !! html/php
11051 <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>
11052
11053 !! html/parsoid
11054 <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>
11055 !! end
11056
11057 !! test
11058 SVG thumbnails with invalid language code
11059 !! options
11060 parsoid=wt2html,wt2wt,html2html
11061 !! wikitext
11062 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11063 !! html/php
11064 <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>
11065
11066 !! html/parsoid
11067 <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>
11068 !! end
11069
11070 !! test
11071 BUG 1887: A ISBN with a thumbnail
11072 !! wikitext
11073 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11074 !! html/php
11075 <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>
11076
11077 !! html/parsoid
11078 <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>
11079 !! end
11080
11081 !! test
11082 BUG 1887: A RFC with a thumbnail
11083 !! wikitext
11084 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11085 !! html/php
11086 <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>
11087
11088 !! html/parsoid
11089 <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>
11090 !! end
11091
11092 !! test
11093 BUG 1887: A mailto link with a thumbnail
11094 !! wikitext
11095 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11096 !! html/php
11097 <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>
11098
11099 !! html/parsoid
11100 <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>
11101 !! end
11102
11103 # Pending resolution to bug 368
11104 !! test
11105 BUG 648: Frameless image caption with a link
11106 !! wikitext
11107 [[File:Foobar.jpg|text with a [[link]] in it]]
11108 !! html/php
11109 <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>
11110 </p>
11111 !! html/parsoid
11112 <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>
11113 !! end
11114
11115 !! test
11116 BUG 648: Frameless image caption with a link (suffix)
11117 !! wikitext
11118 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11119 !! html/php
11120 <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>
11121 </p>
11122 !! html/parsoid
11123 <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>
11124 !! end
11125
11126 !! test
11127 BUG 648: Frameless image caption with an interwiki link
11128 !! wikitext
11129 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11130 !! html/php
11131 <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>
11132 </p>
11133 !! html/parsoid
11134 <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>
11135 !! end
11136
11137 !! test
11138 BUG 648: Frameless image caption with a piped interwiki link
11139 !! wikitext
11140 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11141 !! html/php
11142 <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>
11143 </p>
11144 !! html/parsoid
11145 <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>
11146 !! end
11147
11148 !! test
11149 Escape HTML special chars in image alt text
11150 !! wikitext
11151 [[File:Foobar.jpg|& < > "]]
11152 !! html/php
11153 <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>
11154 </p>
11155 !! html/parsoid
11156 <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>
11157 !! end
11158
11159 !! test
11160 BUG 499: Alt text should have &#1234;, not &amp;1234;
11161 !! wikitext
11162 [[File:Foobar.jpg|&#9792;]]
11163 !! html/php
11164 <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>
11165 </p>
11166 !! html/parsoid
11167 <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>
11168 !! end
11169
11170 !! test
11171 Broken image caption with link
11172 !! options
11173 parsoid=wt2html,wt2wt,html2html
11174 !! wikitext
11175 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11176 !! html/php
11177 <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.
11178 </p>
11179 !! html/parsoid
11180 <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>
11181 !! end
11182
11183 !! test
11184 Image caption containing another image
11185 !! wikitext
11186 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11187 !! html/php
11188 <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>
11189
11190 !! html/parsoid
11191 <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>
11192 !! end
11193
11194 !! test
11195 Image: caption containing a newline
11196 !! wikitext
11197 [[File:Foobar.jpg|This
11198 *is some text]]
11199 !! html/php
11200 <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>
11201 </p>
11202 !! html/parsoid
11203 <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>
11204 !!end
11205
11206 !!test
11207 Image: caption containing leading space
11208 (The leading space should not trigger nowiki escaping in wt2wt mode)
11209 !! wikitext
11210 [[File:Foobar.jpg|thumb| bar]]
11211 !! html/php
11212 <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>
11213
11214 !! html/parsoid
11215 <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>
11216 !!end
11217
11218 !! test
11219 Image: caption containing a table
11220 !! options
11221 parsoid=wt2html,wt2wt,html2html
11222 !! wikitext
11223 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11224 {|
11225 ! Foo !! Bar
11226 |-
11227 | Foo1 || Bar1
11228 |}
11229 and some more text.]]
11230 !! html/php
11231 <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>
11232
11233 !! html/parsoid
11234 <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
11235 <table>
11236 <tbody>
11237 <tr><th>Foo </th><th>Bar</th></tr>
11238 <tr>
11239 <td>Foo1 </td>
11240 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11241 !! end
11242
11243 !! test
11244 Bug 3090: External links other than http: in image captions
11245 !! wikitext
11246 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11247 !! html/php
11248 <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>
11249
11250 !! html/parsoid
11251 <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>
11252 !! end
11253
11254 !! test
11255 Custom class
11256 !! options
11257 parsoid=wt2html,wt2wt,html2html
11258 !! wikitext
11259 [[Image:foobar.jpg|a|class=b]]
11260 !! html/php
11261 <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>
11262 </p>
11263 !! html/parsoid
11264 <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>
11265 !! end
11266
11267 !! test
11268 Localized image handling (1).
11269 !! options
11270 parsoid=wt2html,wt2wt,html2html
11271 language=es
11272 !! wikitext
11273 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11274 !! html/php
11275 <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>
11276
11277 !! html/parsoid
11278 <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>
11279 !! end
11280
11281 !! test
11282 Localized image handling (2).
11283 !! options
11284 thumbsize=220
11285 parsoid=wt2html,wt2wt,html2html
11286 language=es
11287 !! wikitext
11288 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11289 !! html/php
11290 <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>
11291
11292 !! html/parsoid
11293 <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>
11294 !! end
11295
11296 !! test
11297 "border", "frameless" and "class" attributes on an image.
11298 !! options
11299 thumbsize=220
11300 parsoid=wt2html,wt2wt,html2html
11301 !! wikitext
11302 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11303 !! html/php
11304 <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>
11305 </p>
11306 !! html/parsoid
11307 <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>
11308 !! end
11309
11310 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11311 !! test
11312 Invalid image attributes (bug 62500)
11313 !! options
11314 thumbsize=220
11315 parsoid=wt2html,wt2wt,html2html
11316 !! wikitext
11317 [[File:Foobar.jpg|thumb|float|left|caption]]
11318
11319 [[File:Foobar.jpg|thumb|righ|caption]]
11320
11321 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11322 !! html/php
11323 <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>
11324 <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>
11325 <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>
11326
11327 !! html/parsoid
11328 <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>
11329 !! end
11330
11331 !! article
11332 File:Barfoo.jpg
11333 !! text
11334 #REDIRECT [[File:Barfoo.jpg]]
11335 !! endarticle
11336
11337 !! test
11338 Redirected image
11339 !! wikitext
11340 [[Image:Barfoo.jpg]]
11341 !! html
11342 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11343 </p>
11344 !! end
11345
11346 !! test
11347 Missing image with uploads disabled
11348 !! options
11349 wgEnableUploads=0
11350 !! wikitext
11351 [[Image:Foobaz.jpg]]
11352 !! html
11353 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11354 </p>
11355 !! end
11356
11357 # Parsoid-specific testing for images
11358 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11359 # Currently imperfect due to a flaw in the Parsoid testrunner
11360 # Work in progress
11361 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11362 # image tests.
11363
11364 !! test
11365 Parsoid-specific image handling - simple image with size and middle alignment
11366 !! wikitext
11367 [[File:Foobar.jpg|middle|50px]]
11368 !! html/parsoid
11369 <p><span class="mw-valign-middle" typeof="mw:Image">
11370 <a href="File:Foobar.jpg">
11371 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11372 </a>
11373 </span>
11374 </p>
11375 !! end
11376
11377 !! test
11378 Parsoid-specific image handling - simple image with size, middle alignment,
11379 non-standard namespace alias
11380 !! options
11381 parsoid=wt2wt,wt2html,html2html
11382 !! wikitext
11383 [[Image:Foobar.jpg|middle|50px]]
11384 !! html/parsoid
11385 <p><span class="mw-valign-middle" typeof="mw:Image">
11386 <a href="File:Foobar.jpg">
11387 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11388 </a>
11389 </span>
11390 </p>
11391 !! end
11392
11393 !! test
11394 Parsoid-specific image handling - simple image with size and middle alignment
11395 (existing content)
11396 !! wikitext
11397 [[File:Foobar.jpg|50px|middle]]
11398 !! html/parsoid
11399 <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>
11400 !! end
11401
11402 !! test
11403 Parsoid-specific image handling - simple image with size and middle alignment
11404 and non-standard namespace name
11405 !! options
11406 parsoid=wt2html,wt2wt,html2html
11407 !! wikitext
11408 [[Image:Foobar.jpg|50px|middle]]
11409 !! html/parsoid
11410 <p><span class="mw-valign-middle" typeof="mw:Image">
11411 <a href="File:Foobar.jpg">
11412 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11413 </a>
11414 </span>
11415 </p>
11416 !! end
11417
11418 !! test
11419 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11420 !! wikitext
11421 [[File:Foobar.jpg|500x10px|baseline|caption]]
11422 !! html/parsoid
11423 <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>
11424 !! end
11425
11426 !! test
11427 Parsoid-specific image handling - simple image with border and size spec
11428 !! wikitext
11429 [[File:Foobar.jpg|50px|border|caption]]
11430 !! html/parsoid
11431 <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>
11432 !! end
11433
11434 !! test
11435 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11436 !! wikitext
11437 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11438 !! html/parsoid
11439 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11440 <a href="File:Foobar.jpg">
11441 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11442 </a>
11443 <figcaption>caption content</figcaption>
11444 </figure>
11445 !! end
11446
11447 !! test
11448 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11449 (existing content)
11450 !! wikitext
11451 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11452 !! html/parsoid
11453 <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>
11454 !! end
11455
11456 !! test
11457 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11458 !! wikitext
11459 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11460 !! html/parsoid
11461 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11462 <a href="File:Foobar.jpg">
11463 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11464 </a>
11465 <figcaption>caption</figcaption>
11466 </figure>
11467 !! end
11468
11469 !! test
11470 Parsoid-specific image handling - thumbnail with specific size, halign,
11471 valign, and caption (existing content)
11472 !! wikitext
11473 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11474 !! html/parsoid
11475 <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>
11476 !! end
11477
11478 !! test
11479 Parsoid-specific image handling - framed image with specific size and caption
11480 (size is ignored)
11481 !! options
11482 parsoid=wt2html,wt2wt,html2html
11483 !! wikitext
11484 [[File:Foobar.jpg|frame|500x50px|caption]]
11485 !! html/parsoid
11486 <figure typeof="mw:Image/Frame">
11487 <a href="File:Foobar.jpg">
11488 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11489 </a>
11490 <figcaption>caption</figcaption>
11491 </figure>
11492 !! end
11493
11494 !! test
11495 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11496 (size is ignored)
11497 !! options
11498 parsoid=wt2html,wt2wt,html2html
11499 !! wikitext
11500 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11501 !! html/parsoid
11502 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11503 <a href="File:Foobar.jpg">
11504 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11505 </a>
11506 <figcaption>caption</figcaption>
11507 </figure>
11508 !! end
11509
11510 !! test
11511 Parsoid-specific image handling - frameless image with specific size, border, and caption
11512 !! wikitext
11513 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11514 !! html/parsoid
11515 <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>
11516 !! end
11517
11518 !! test
11519 Parsoid-specific image handling - simple image with a formatted caption
11520 !! wikitext
11521 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11522 !! html/parsoid
11523 <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>"}'>
11524 <a href="File:Foobar.jpg">
11525 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11526 </a></span></p>
11527 !! end
11528
11529 !! test
11530 Parsoid-specific image handling - caption with a template in it
11531 !! wikitext
11532 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11533 !! html/parsoid
11534 <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>
11535 !! end
11536
11537 !! test
11538 Parsoid-specific image handling - caption with unbalanced tags in it
11539 !! options
11540 parsoid=wt2html,wt2wt,html2html
11541 !! wikitext
11542 foo
11543 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11544 bar
11545 !! html/parsoid
11546 <p>foo</p>
11547 <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>
11548 <p>bar</p>
11549 !! end
11550
11551 !! test
11552 Parsoid-specific image handling - empty caption (1)
11553 !! options
11554 parsoid=wt2html,wt2wt
11555 !! wikitext
11556 [[File:Foobar.jpg|thumb|]]
11557 !! html/parsoid
11558 <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>
11559 !! end
11560
11561 # empty captions don't get serialized unless we're in the "round trip" case
11562 !! test
11563 Parsoid-specific image handling - empty caption (2)
11564 !! options
11565 parsoid=html2wt
11566 !! html/parsoid
11567 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11568 <a href="File:Foobar.jpg">
11569 <img resource="./File:Foobar.jpg"
11570 src="//example.com/images/3/3a/Foobar.jpg"
11571 height="25" width="220"/>
11572 </a>
11573 <figcaption></figcaption>
11574 </figure>
11575 !! wikitext
11576 [[File:Foobar.jpg|thumb]]
11577 !! end
11578
11579 !! test
11580 Parsoid-specific image handling - whitespace caption
11581 !! wikitext
11582 [[File:Foobar.jpg|thumb| ]]
11583 !! html/parsoid
11584 <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>
11585 !! end
11586
11587 !! test
11588 Parsoid-specific image handling - lang option
11589 !! wikitext
11590 foo
11591 [[File:Foobar.svg|lang=de|caption]]
11592 bar
11593 !! html/parsoid
11594 <p>foo
11595 <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>
11596 bar</p>
11597 !! end
11598
11599
11600 ###
11601 ### Subpages
11602 ###
11603 !! article
11604 Subpage test/subpage
11605 !! text
11606 foo
11607 !! endarticle
11608
11609 !! test
11610 Subpage link
11611 !! options
11612 subpage title=[[Subpage test]]
11613 !! wikitext
11614 [[/subpage]]
11615 !! html
11616 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11617 </p>
11618 !! end
11619
11620 !! test
11621 Subpage noslash link
11622 !! options
11623 subpage title=[[Subpage test]]
11624 !! wikitext
11625 [[/subpage/]]
11626 !! html
11627 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11628 </p>
11629 !! end
11630
11631 # TODO: make this PHP-parser compatible!
11632 !! test
11633 Relative subpage noslash link
11634 !! options
11635 parsoid=wt2wt,wt2html,html2html
11636 subpage title=[[Subpage test/1/2/3/4]]
11637 !! wikitext
11638 [[../../subpage/]]
11639
11640 [[../../subpage]]
11641 !! html
11642 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11643 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11644 !! end
11645
11646 !! test
11647 Parsoid: dot-slash prefixed wikilinks
11648 !! wikitext
11649 [[./foo]]
11650
11651 [[././bar]]
11652
11653 [[././baz/]]
11654 !! html/php
11655 <p>[[./foo]]
11656 </p><p>[[././bar]]
11657 </p><p>[[././baz/]]
11658 </p>
11659 !! html/parsoid
11660 <p>[[./foo]]
11661 </p><p>[[././bar]]
11662 </p><p>[[././baz/]]
11663 </p>
11664 !! end
11665
11666 !! test
11667 Render invalid page names as plain text (bug 51090)
11668 !! wikitext
11669 [[./../foo|bar]]
11670 [[foo�|bar]]
11671 [[foo/.|bar]]
11672 [[foo/..|bar]]
11673 [[foo~~~bar]]
11674 [[foo>bar]]
11675 [[foo[bar]]
11676 [[.]]
11677 [[..]]
11678 [[foo././bar]]
11679
11680 [[{{echo|./../foo}}|bar]]
11681 [[{{echo|foo/.}}|bar]]
11682 [[{{echo|foo/..}}|bar]]
11683 [[{{echo|foo~~~~bar}}]]
11684 [[{{echo|foo>bar}}]]
11685 [[{{echo|foo././bar}}]]
11686 [[{{echo|foo{bar}}]]
11687 [[{{echo|foo}bar}}]]
11688 [[{{echo|foo[bar}}]]
11689 [[{{echo|foo]bar}}]]
11690 [[{{echo|foo<bar}}]]
11691 !!html/php
11692 <p>[[./../foo|bar]]
11693 [[foo�|bar]]
11694 [[foo/.|bar]]
11695 [[foo/..|bar]]
11696 [[foo~~~bar]]
11697 [[foo&gt;bar]]
11698 [[foo[bar]]
11699 [[.]]
11700 [[..]]
11701 [[foo././bar]]
11702 </p><p>[[./../foo|bar]]
11703 [[foo/.|bar]]
11704 [[foo/..|bar]]
11705 [[foo~~~~bar]]
11706 [[foo&gt;bar]]
11707 [[foo././bar]]
11708 [[foo{bar]]
11709 [[foo}bar]]
11710 [[foo[bar]]
11711 [[foo]bar]]
11712 [[foo&lt;bar]]
11713 </p>
11714 !!html/parsoid
11715 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11716 <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>
11717 !!end
11718
11719 !! test
11720 Disabled subpages
11721 !! wikitext
11722 [[/subpage]]
11723 !! html
11724 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11725 </p>
11726 !! end
11727
11728 !! test
11729 BUG 561: {{/Subpage}}
11730 !! options
11731 subpage title=[[Page]]
11732 !! wikitext
11733 {{/Subpage}}
11734 !! html
11735 <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>
11736 </p>
11737 !! end
11738
11739 ###
11740 ### Categories
11741 ###
11742 !! article
11743 Category:MediaWiki User's Guide
11744 !! text
11745 blah
11746 !! endarticle
11747
11748 !! test
11749 Link to category
11750 !! wikitext
11751 [[:Category:MediaWiki User's Guide]]
11752 !! html
11753 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11754 </p>
11755 !! end
11756
11757 !! test
11758 Simple category
11759 !! options
11760 cat
11761 !! wikitext
11762 [[Category:MediaWiki User's Guide]]
11763 !! html
11764 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11765 !! end
11766
11767 !! test
11768 PAGESINCATEGORY invalid title fatal (r33546 fix)
11769 !! wikitext
11770 {{PAGESINCATEGORY:<bogus>}}
11771 !! html
11772 <p>0
11773 </p>
11774 !! end
11775
11776 !! test
11777 Category with different sort key
11778 !! options
11779 cat
11780 !! wikitext
11781 [[Category:MediaWiki User's Guide|Foo]]
11782 !! html
11783 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11784 !! end
11785
11786 !! test
11787 Category with identical sort key
11788 !! options
11789 cat
11790 !! wikitext
11791 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11792 !! html
11793 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11794 !! end
11795
11796 !! test
11797 Category with empty sort key
11798 !! options
11799 cat
11800 pst
11801 !! wikitext
11802 [[Category:MediaWiki User's Guide|]]
11803 !! html
11804 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11805 !! end
11806
11807 !! test
11808 Category with empty sort key and parentheses
11809 !! options
11810 cat
11811 pst
11812 !! wikitext
11813 [[Category:Foo (bar)|]]
11814 !! html
11815 [[Category:Foo (bar)|Foo]]
11816 !! end
11817
11818 !! test
11819 Category with link tail
11820 !! options
11821 cat
11822 pst
11823 !! wikitext
11824 123[[Category:Foo]]456
11825 !! html
11826 123[[Category:Foo]]456
11827 !! end
11828
11829 !! test
11830 Category with template
11831 !! options
11832 cat
11833 pst
11834 !! wikitext
11835 [[Category:{{echo|Foo}}]]
11836 !! html
11837 [[Category:{{echo|Foo}}]]
11838 !! end
11839
11840 !! test
11841 Category with template in sort key
11842 !! options
11843 cat
11844 pst
11845 !! wikitext
11846 [[Category:Foo|{{echo|Bar}}]]
11847 !! html
11848 [[Category:Foo|{{echo|Bar}}]]
11849 !! end
11850
11851 !! test
11852 Category with template in sort key and title
11853 !! options
11854 cat
11855 pst
11856 !! wikitext
11857 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11858 !! html
11859 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11860 !! end
11861
11862 !! test
11863 Category / paragraph interactions
11864 !! wikitext
11865 Foo [[Category:Baz]] Bar
11866
11867 Foo [[Category:Baz]]
11868 Bar
11869
11870 Foo
11871 [[Category:Baz]]
11872 Bar
11873
11874 Foo
11875 [[Category:Baz]] Bar
11876
11877 Foo
11878 [[Category:Baz]]
11879 [[Category:Baz]]
11880 [[Category:Baz]]
11881 Bar
11882
11883 [[Category:Baz]]
11884 [[Category:Baz]]
11885 [[Category:Baz]]
11886
11887 [[Category:Baz]]
11888 {{echo|[[Category:Baz]]}}
11889 [[Category:Baz]]
11890 !! html
11891 <p>Foo Bar
11892 </p><p>Foo
11893 Bar
11894 </p><p>Foo
11895 Bar
11896 </p><p>Foo Bar
11897 </p><p>Foo
11898 Bar
11899 </p>
11900 !! end
11901
11902 !! test
11903 Parsoid: Serialize link to category page with colon escape
11904 !! options
11905 parsoid
11906 !! wikitext
11907
11908 [[:Category:Foo]]
11909 [[:Category:Foo|Bar]]
11910 !! html
11911 <p>
11912 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11913 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11914 </p>
11915 !! end
11916
11917 !! test
11918 Parsoid: Link prefix/suffixes aren't applied to category links
11919 !! options
11920 parsoid=wt2html,wt2wt,html2html
11921 language=is
11922 !! wikitext
11923 x[[Category:Foo]]y
11924 !! html
11925 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11926 !! end
11927
11928 !! test
11929 Parsoid: Serialize link to file page with colon escape
11930 !! options
11931 parsoid
11932 !! wikitext
11933
11934 [[:File:Foo.png]]
11935 [[:File:Foo.png|Bar]]
11936 !! html
11937 <p>
11938 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11939 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11940 </p>
11941 !! end
11942
11943 !! test
11944 Parsoid: Serialize a genuine category link without colon escape
11945 !! options
11946 parsoid
11947 !! wikitext
11948 [[Category:Foo]]
11949 [[Category:Foo|Bar]]
11950 !! html
11951 <link rel="mw:PageProp/Category" href="Category:Foo">
11952 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11953 !! end
11954
11955 !! test
11956 Parsoid: Defaultsort
11957 !! options
11958 parsoid
11959 !! wikitext
11960 {{DEFAULTSORT:Foo}}
11961 !! html
11962 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11963 !! end
11964
11965 ###
11966 ### Inter-language links
11967 ###
11968 !! test
11969 Inter-language links
11970 !! options
11971 ill
11972 !! wikitext
11973 [[es:Alimento]]
11974 [[fr:Nourriture]]
11975 [[zh:&#39135;&#21697;]]
11976 !! html
11977 es:Alimento fr:Nourriture zh:食品
11978 !! end
11979
11980 !! test
11981 Duplicate interlanguage links (bug 24502)
11982 !! options
11983 ill
11984 !! wikitext
11985 [[es:1]]
11986 [[es:2]]
11987 [[fr:1]]
11988 [[fr:2]]
11989 !! html
11990 es:1 fr:1
11991 !! end
11992
11993 ###
11994 ### Sections
11995 ###
11996 !! test
11997 Basic section headings
11998 !! wikitext
11999 == Headline 1 ==
12000 Some text
12001
12002 ==Headline 2==
12003 More
12004 ===Smaller headline===
12005 Blah blah
12006 !! html
12007 <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>
12008 <p>Some text
12009 </p>
12010 <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>
12011 <p>More
12012 </p>
12013 <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>
12014 <p>Blah blah
12015 </p>
12016 !! end
12017
12018 !! test
12019 Section headings with TOC
12020 !! wikitext
12021 == Headline 1 ==
12022 === Subheadline 1 ===
12023 ===== Skipping a level =====
12024 ====== Skipping a level ======
12025
12026 == Headline 2 ==
12027 Some text
12028 ===Another headline===
12029 !! html
12030 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12031 <ul>
12032 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12033 <ul>
12034 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12035 <ul>
12036 <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>
12037 <ul>
12038 <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>
12039 </ul>
12040 </li>
12041 </ul>
12042 </li>
12043 </ul>
12044 </li>
12045 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12046 <ul>
12047 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12048 </ul>
12049 </li>
12050 </ul>
12051 </div>
12052
12053 <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>
12054 <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>
12055 <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>
12056 <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>
12057 <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>
12058 <p>Some text
12059 </p>
12060 <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>
12061
12062 !! end
12063
12064 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12065 !! test
12066 Handling of sections up to level 6 and beyond
12067 !! wikitext
12068 = Level 1 Heading=
12069 == Level 2 Heading==
12070 === Level 3 Heading===
12071 ==== Level 4 Heading====
12072 ===== Level 5 Heading=====
12073 ====== Level 6 Heading======
12074 ======= Level 7 Heading=======
12075 ======== Level 8 Heading========
12076 ========= Level 9 Heading=========
12077 ========== Level 10 Heading==========
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="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12082 <ul>
12083 <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>
12084 <ul>
12085 <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>
12086 <ul>
12087 <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>
12088 <ul>
12089 <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>
12090 <ul>
12091 <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>
12092 <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>
12093 <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>
12094 <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>
12095 <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>
12096 </ul>
12097 </li>
12098 </ul>
12099 </li>
12100 </ul>
12101 </li>
12102 </ul>
12103 </li>
12104 </ul>
12105 </li>
12106 </ul>
12107 </div>
12108
12109 <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>
12110 <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>
12111 <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>
12112 <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>
12113 <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>
12114 <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>
12115 <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>
12116 <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>
12117 <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>
12118 <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>
12119
12120 !! end
12121
12122 !! test
12123 TOC regression (bug 9764)
12124 !! wikitext
12125 == title 1 ==
12126 === title 1.1 ===
12127 ==== title 1.1.1 ====
12128 === title 1.2 ===
12129 == title 2 ==
12130 === title 2.1 ===
12131 !! html
12132 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12133 <ul>
12134 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12135 <ul>
12136 <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>
12137 <ul>
12138 <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>
12139 </ul>
12140 </li>
12141 <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>
12142 </ul>
12143 </li>
12144 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12145 <ul>
12146 <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>
12147 </ul>
12148 </li>
12149 </ul>
12150 </div>
12151
12152 <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>
12153 <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>
12154 <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>
12155 <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>
12156 <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>
12157 <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>
12158
12159 !! end
12160
12161 !! test
12162 TOC with wgMaxTocLevel=3 (bug 6204)
12163 !! options
12164 wgMaxTocLevel=3
12165 !! wikitext
12166 == title 1 ==
12167 === title 1.1 ===
12168 ==== title 1.1.1 ====
12169 === title 1.2 ===
12170 == title 2 ==
12171 === title 2.1 ===
12172 !! html
12173 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12174 <ul>
12175 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12176 <ul>
12177 <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>
12178 <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>
12179 </ul>
12180 </li>
12181 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12182 <ul>
12183 <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>
12184 </ul>
12185 </li>
12186 </ul>
12187 </div>
12188
12189 <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>
12190 <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>
12191 <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>
12192 <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>
12193 <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>
12194 <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>
12195
12196 !! end
12197
12198 !! test
12199 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12200 !! options
12201 wgMaxTocLevel=3
12202 !! wikitext
12203 ==Section 1==
12204 ===Section 1.1===
12205 ====Section 1.1.1====
12206 ====Section 1.1.1.1====
12207 ==Section 2==
12208 !! html
12209 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12210 <ul>
12211 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12212 <ul>
12213 <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>
12214 </ul>
12215 </li>
12216 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12217 </ul>
12218 </div>
12219
12220 <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>
12221 <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>
12222 <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>
12223 <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>
12224 <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>
12225
12226 !! end
12227
12228
12229 !! test
12230 Resolving duplicate section names
12231 !! wikitext
12232 == Foo bar ==
12233 == Foo bar ==
12234 !! html
12235 <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>
12236 <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>
12237
12238 !! end
12239
12240 !! test
12241 Resolving duplicate section names with differing case (bug 10721)
12242 !! wikitext
12243 == Foo bar ==
12244 == Foo Bar ==
12245 !! html
12246 <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>
12247 <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>
12248
12249 !! end
12250
12251 !! article
12252 Template:sections
12253 !! text
12254 ===Section 1===
12255 ==Section 2==
12256 !! endarticle
12257
12258 !! test
12259 Template with sections, __NOTOC__
12260 !! wikitext
12261 __NOTOC__
12262 ==Section 0==
12263 {{sections}}
12264 ==Section 4==
12265 !! html
12266 <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>
12267 <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>
12268 <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>
12269 <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>
12270
12271 !! end
12272
12273 !! test
12274 __NOEDITSECTION__ keyword
12275 !! wikitext
12276 __NOEDITSECTION__
12277 ==Section 1==
12278 ==Section 2==
12279 !! html
12280 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12281 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12282
12283 !! end
12284
12285 !! test
12286 Link inside a section heading
12287 !! wikitext
12288 ==Section with a [[Main Page|link]] in it==
12289 !! html
12290 <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>
12291
12292 !! end
12293
12294 !! test
12295 TOC regression (bug 12077)
12296 !! wikitext
12297 __TOC__
12298 == title 1 ==
12299 === title 1.1 ===
12300 == title 2 ==
12301 !! html
12302 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12303 <ul>
12304 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12305 <ul>
12306 <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>
12307 </ul>
12308 </li>
12309 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12310 </ul>
12311 </div>
12312
12313 <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>
12314 <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>
12315 <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>
12316
12317 !! end
12318
12319 !! test
12320 BUG 1219 URL next to image (good)
12321 !! wikitext
12322 http://example.com [[Image:foobar.jpg]]
12323 !! html
12324 <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>
12325 </p>
12326 !!end
12327
12328 !! test
12329 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12330 !! wikitext
12331 ===
12332 The line above must have a trailing space!
12333 === <!--
12334 --> <!-- -->
12335 But just in case it doesn't...
12336 !! html
12337 <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>
12338 <p>The line above must have a trailing space!
12339 </p>
12340 <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>
12341 <p>But just in case it doesn't...
12342 </p>
12343 !! end
12344
12345 !! test
12346 Header with special characters (bug 25462)
12347 !! wikitext
12348 The tooltips shall not show entities to the user (ie. be double escaped)
12349
12350 == text > text ==
12351 section 1
12352
12353 == text < text ==
12354 section 2
12355
12356 == text & text ==
12357 section 3
12358
12359 == text ' text ==
12360 section 4
12361
12362 == text " text ==
12363 section 5
12364 !! html
12365 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12366 </p>
12367 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12368 <ul>
12369 <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>
12370 <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>
12371 <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>
12372 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12373 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12374 </ul>
12375 </div>
12376
12377 <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>
12378 <p>section 1
12379 </p>
12380 <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>
12381 <p>section 2
12382 </p>
12383 <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>
12384 <p>section 3
12385 </p>
12386 <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>
12387 <p>section 4
12388 </p>
12389 <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>
12390 <p>section 5
12391 </p>
12392 !! end
12393
12394 !! test
12395 Headers with excess '=' characters
12396 (Are similar tests necessary beyond the 1st level?)
12397 !! wikitext
12398 =foo==
12399 ==foo=
12400 =''italic'' heading==
12401 ==''italic'' heading=
12402 !! html
12403 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12404 <ul>
12405 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12406 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12407 <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>
12408 <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>
12409 </ul>
12410 </div>
12411
12412 <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>
12413 <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>
12414 <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>
12415 <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>
12416
12417 !! end
12418
12419 !! test
12420 HTML headers vs TOC (bug 23393)
12421 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12422 !! wikitext
12423 <h1>Header 1</h1>
12424 == Header 1.1 ==
12425 == Header 1.2 ==
12426
12427 <h1>Header 2
12428 </h1>
12429 == Header 2.1 ==
12430 == Header 2.2 ==
12431 __NOEDITSECTION__
12432 !! html
12433 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12434 <ul>
12435 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12436 <ul>
12437 <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>
12438 <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>
12439 </ul>
12440 </li>
12441 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12442 <ul>
12443 <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>
12444 <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>
12445 </ul>
12446 </li>
12447 </ul>
12448 </div>
12449
12450 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12451 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12452 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12453 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12454 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12455 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12456
12457 !! end
12458
12459 !! test
12460 Single-line or multiline-comments can follow headings
12461 !! options
12462 parsoid=wt2html,wt2wt
12463 !! wikitext
12464 ==foo==<!---->
12465 ==bar==<!--c1-->
12466 ==baz==<!--
12467 c2
12468 c3-->
12469 !! html
12470 <h2><span class="mw-headline" id="foo">foo</span></h2>
12471 <h2><span class="mw-headline" id="bar">bar</span></h2>
12472 <h2><span class="mw-headline" id="baz">baz</span></h2>
12473
12474 !! end
12475
12476 !! test
12477 BUG 1219 URL next to image (broken)
12478 !! wikitext
12479 http://example.com[[Image:foobar.jpg]]
12480 !! html
12481 <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>
12482 </p>
12483 !!end
12484
12485 !! test
12486 Bug 1186 news: in the middle of text
12487 !! wikitext
12488 http://en.wikinews.org/wiki/Wikinews:Workplace
12489 !! html
12490 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12491 </p>
12492 !!end
12493
12494
12495 !! test
12496 Namespaced link must have a title
12497 !! wikitext
12498 [[Project:]]
12499 !! html
12500 <p>[[Project:]]
12501 </p>
12502 !!end
12503
12504 !! test
12505 Namespaced link must have a title (bad fragment version)
12506 !! wikitext
12507 [[Project:#fragment]]
12508 !! html
12509 <p>[[Project:#fragment]]
12510 </p>
12511 !!end
12512
12513
12514 ###
12515 ### HTML tags and HTML attributes
12516 ###
12517
12518 !! test
12519 div with no attributes
12520 !! wikitext
12521 <div>HTML rocks</div>
12522 !! html
12523 <div>HTML rocks</div>
12524
12525 !! end
12526
12527 !! test
12528 div with double-quoted attribute
12529 !! wikitext
12530 <div id="rock">HTML rocks</div>
12531 !! html
12532 <div id="rock">HTML rocks</div>
12533
12534 !! end
12535
12536 !! test
12537 div with single-quoted attribute
12538 !! wikitext
12539 <div id='rock'>HTML rocks</div>
12540 !! html
12541 <div id="rock">HTML rocks</div>
12542
12543 !! end
12544
12545 !! test
12546 div with unquoted attribute
12547 !! wikitext
12548 <div id=rock>HTML rocks</div>
12549 !! html
12550 <div id="rock">HTML rocks</div>
12551
12552 !! end
12553
12554 !! test
12555 div with illegal double attributes
12556 !! wikitext
12557 <div id="a" id="b">HTML rocks</div>
12558 !! html
12559 <div id="b">HTML rocks</div>
12560
12561 !!end
12562
12563 # FIXME: produce empty string instead of "class" in the PHP parser, following
12564 # the HTML5 spec.
12565 !! test
12566 div with empty attribute value, space before equals
12567 !! options
12568 parsoid
12569 !! wikitext
12570 <div class =>HTML rocks</div>
12571 !! html
12572 <div class="">HTML rocks</div>
12573
12574 !! end
12575
12576 # The PHP parser escapes the opening brace to &#123; for some reason, so
12577 # disabled this test for it.
12578 !! test
12579 div with braces in attribute value
12580 !! options
12581 parsoid
12582 !! wikitext
12583 <div title="{}">Foo</div>
12584 !! html
12585 <div title="{}">Foo</div>
12586 !! end
12587
12588 # This it very inconsistent in the PHP parser: it returns
12589 # class="class" if there is a space between the name and the equal sign (see
12590 # 'div with empty attribute value, space before equals'), but strips the
12591 # attribute completely if the space is missing. We hope that not much content
12592 # depends on this, so are implementing the behavior below in Parsoid for
12593 # consistencies' sake. Disabled for the PHP parser.
12594 # FIXME: fix this behavior in the PHP parser?
12595 !! test
12596 div with empty attribute value, no space before equals
12597 !! options
12598 parsoid
12599 !! wikitext
12600 <div class=>HTML rocks</div>
12601 !! html
12602 <div class="">HTML rocks</div>
12603
12604 !! end
12605
12606 !! test
12607 HTML multiple attributes correction
12608 !! wikitext
12609 <p class="error" class="awesome">Awesome!</p>
12610 !! html
12611 <p class="awesome">Awesome!</p>
12612
12613 !!end
12614
12615 !! test
12616 Table multiple attributes correction
12617 !! wikitext
12618 {|
12619 !+ class="error" class="awesome"| status
12620 |}
12621 !! html
12622 <table>
12623 <tr>
12624 <th class="awesome"> status
12625 </th></tr></table>
12626
12627 !!end
12628
12629 !! test
12630 DIV IN UPPERCASE
12631 !! wikitext
12632 <DIV ID="x">HTML ROCKS</DIV>
12633 !! html
12634 <div id="x">HTML ROCKS</div>
12635
12636 !!end
12637
12638 !! test
12639 Non-ASCII pseudo-tags are rendered as text
12640 !! wikitext
12641 <khyô>
12642 !! html
12643 <p>&lt;khyô&gt;
12644 </p>
12645 !! end
12646
12647 !! test
12648 Pseudo-tag with URL 'name' renders as url link
12649 !! wikitext
12650 <http://example.com/>
12651 !! html
12652 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12653 </p>
12654 !! end
12655
12656 !! test
12657 text with amp in the middle of nowhere
12658 !! wikitext
12659 Remember AT&T?
12660 !! html
12661 <p>Remember AT&amp;T?
12662 </p>
12663 !! end
12664
12665 !! test
12666 text with character entity: eacute
12667 !! wikitext
12668 I always thought &eacute; was a cute letter.
12669 !! html
12670 <p>I always thought &#233; was a cute letter.
12671 </p>
12672 !! end
12673
12674 !! test
12675 text with entity-escaped character entity-like string: eacute
12676 !! wikitext
12677 I always thought &amp;eacute; was a cute letter.
12678 !! html
12679 <p>I always thought &amp;eacute; was a cute letter.
12680 </p>
12681 !! end
12682
12683 !! test
12684 text with undefined character entity: xacute
12685 !! wikitext
12686 I always thought &xacute; was a cute letter.
12687 !! html
12688 <p>I always thought &amp;xacute; was a cute letter.
12689 </p>
12690 !! end
12691
12692 # TODO: generalize to PHP parser?
12693 !! test
12694 HTML5 tags
12695 !! options
12696 parsoid
12697 !! wikitext
12698 <data value="5">five</data>
12699 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12700 <mark>This highlighted text</mark>
12701 !! html
12702 <p><data value="5">five</data>
12703 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12704 <mark>This highlighted text</mark></p>
12705 !! end
12706
12707 !! test
12708 HTML tag with leading space is parsed as text
12709 !! wikitext
12710 < div>foo< /div>
12711 !! html
12712 <p>&lt; div&gt;foo&lt; /div&gt;
12713 </p>
12714 !! end
12715
12716 ###
12717 ### Nesting tests (see bug 41545, 50604, 51081)
12718 ###
12719
12720 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12721 # Note that html2wt is considerably more difficult if we use <b> in
12722 # the test case, instead of <big>
12723 !! test
12724 Ensure that HTML adoption agency algorithm is properly implemented.
12725 !! wikitext
12726 <big>X<big>Y</big>Z</big>
12727 !! html
12728 <p><big>X<big>Y</big>Z</big>
12729 </p>
12730 !! end
12731
12732 # This was bug 41545 in the PHP parser.
12733 !! test
12734 Nesting of <kbd>
12735 !! wikitext
12736 <kbd>X<kbd>Y</kbd>Z</kbd>
12737 !! html
12738 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12739 </p>
12740 !! end
12741
12742 # The following cases were bug 51081 in the PHP parser.
12743 # Note that there are some other nestable tags (b, i, etc) which are
12744 # not covered; see bug 51081 for discussion.
12745 !! test
12746 Nesting of <em>
12747 !! wikitext
12748 <em>X<em>Y</em>Z</em>
12749 !! html
12750 <p><em>X<em>Y</em>Z</em>
12751 </p>
12752 !! end
12753
12754 !! test
12755 Nesting of <strong>
12756 !! wikitext
12757 <strong>X<strong>Y</strong>Z</strong>
12758 !! html
12759 <p><strong>X<strong>Y</strong>Z</strong>
12760 </p>
12761 !! end
12762
12763 !! test
12764 Nesting of <q>
12765 !! wikitext
12766 <q>X<q>Y</q>Z</q>
12767 !! html
12768 <p><q>X<q>Y</q>Z</q>
12769 </p>
12770 !! end
12771
12772 !! test
12773 Nesting of <ruby>
12774 !! wikitext
12775 <ruby>X<ruby>Y</ruby>Z</ruby>
12776 !! html
12777 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12778 </p>
12779 !! end
12780
12781 !! test
12782 Nesting of <bdo>
12783 !! wikitext
12784 <bdo>X<bdo>Y</bdo>Z</bdo>
12785 !! html
12786 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12787 </p>
12788 !! end
12789
12790
12791 ###
12792 ### Media links
12793 ###
12794
12795 !! test
12796 Media link
12797 !! wikitext
12798 [[Media:Foobar.jpg]]
12799 !! html
12800 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12801 </p>
12802 !! end
12803
12804 !! test
12805 Media link with text
12806 !! wikitext
12807 [[Media:Foobar.jpg|A neat file to look at]]
12808 !! html
12809 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12810 </p>
12811 !! end
12812
12813 # FIXME: this is still bad HTML tag nesting
12814 !! test
12815 Media link with nasty text
12816 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12817 !! wikitext
12818 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12819 !! html
12820 <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>
12821
12822 !! end
12823
12824 !! test
12825 Media link to nonexistent file (bug 1702)
12826 !! wikitext
12827 [[Media:No such.jpg]]
12828 !! html
12829 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12830 </p>
12831 !! end
12832
12833 !! test
12834 Image link to nonexistent file (bug 1850 - good)
12835 !! wikitext
12836 [[Image:No such.jpg]]
12837 !! html
12838 <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>
12839 </p>
12840 !! end
12841
12842 !! test
12843 :Image link to nonexistent file (bug 1850 - bad)
12844 !! wikitext
12845 [[:Image:No such.jpg]]
12846 !! html
12847 <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>
12848 </p>
12849 !! end
12850
12851
12852
12853 !! test
12854 Character reference normalization in link text (bug 1938)
12855 !! wikitext
12856 [[Main Page|this&that]]
12857 !! html
12858 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12859 </p>
12860 !!end
12861
12862 !! article
12863 אַ
12864 !! text
12865 Test for unicode normalization
12866
12867 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12868 !! endarticle
12869
12870 !! test
12871 (bug 19451) Links should refer to the normalized form.
12872 !! wikitext
12873 [[&#xFB2E;]]
12874 [[&#x5d0;&#x5b7;]]
12875 [[&#x5d0;ַ]]
12876 [[א&#x5b7;]]
12877 [[אַ]]
12878 !! html
12879 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12880 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12881 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12882 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12883 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12884 </p>
12885 !! end
12886
12887 !! test
12888 Empty attribute crash test (bug 2067)
12889 !! wikitext
12890 <font color="">foo</font>
12891 !! html
12892 <p><font color="">foo</font>
12893 </p>
12894 !! end
12895
12896 !! test
12897 Empty attribute crash test single-quotes (bug 2067)
12898 !! wikitext
12899 <font color=''>foo</font>
12900 !! html
12901 <p><font color="">foo</font>
12902 </p>
12903 !! end
12904
12905 !! test
12906 Attribute test: equals, then nothing
12907 !! wikitext
12908 <font color=>foo</font>
12909 !! html
12910 <p><font>foo</font>
12911 </p>
12912 !! end
12913
12914 !! test
12915 Attribute test: unquoted value
12916 !! wikitext
12917 <font color=x>foo</font>
12918 !! html
12919 <p><font color="x">foo</font>
12920 </p>
12921 !! end
12922
12923 !! test
12924 Attribute test: unquoted but illegal value (hash)
12925 !! wikitext
12926 <font color=#x>foo</font>
12927 !! html
12928 <p><font color="#x">foo</font>
12929 </p>
12930 !! end
12931
12932 !! test
12933 Attribute test: no value
12934 !! wikitext
12935 <font color>foo</font>
12936 !! html
12937 <p><font color="color">foo</font>
12938 </p>
12939 !! end
12940
12941 !! test
12942 Bug 2095: link with three closing brackets
12943 !! wikitext
12944 [[Main Page]]]
12945 !! html/php
12946 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12947 </p>
12948 !! html/parsoid
12949 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12950 !! end
12951
12952 !! test
12953 Bug 2095: link with pipe and three closing brackets
12954 !! wikitext
12955 [[Main Page|link]]]
12956 !! html/php
12957 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12958 </p>
12959 !! html/parsoid
12960 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12961 !! end
12962
12963 !! test
12964 Bug 2095: link with pipe and three closing brackets, version 2
12965 !! wikitext
12966 [[Main Page|[http://example.com/]]]
12967 !! html/php
12968 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12969 </p>
12970 !! html/parsoid
12971 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12972 !! end
12973
12974
12975 ###
12976 ### Safety
12977 ###
12978
12979 !! article
12980 Template:Dangerous attribute
12981 !! text
12982 " onmouseover="alert(document.cookie)
12983 !! endarticle
12984
12985 !! article
12986 Template:Dangerous style attribute
12987 !! text
12988 border-size: expression(alert(document.cookie))
12989 !! endarticle
12990
12991 !! article
12992 Template:Div style
12993 !! text
12994 <div style="float: right; {{{1}}}">Magic div</div>
12995 !! endarticle
12996
12997 !! test
12998 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12999 !! wikitext
13000 <div title="{{test}}"></div>
13001 !! html
13002 <div title="This is a test template"></div>
13003
13004 !! end
13005
13006 !! test
13007 Bug 2304: HTML attribute safety (dangerous template; 2309)
13008 !! wikitext
13009 <div title="{{dangerous attribute}}"></div>
13010 !! html
13011 <div title=""></div>
13012
13013 !! end
13014
13015 !! test
13016 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13017 !! wikitext
13018 <div style="{{dangerous style attribute}}"></div>
13019 !! html
13020 <div style="/* insecure input */"></div>
13021
13022 !! end
13023
13024 !! test
13025 Bug 2304: HTML attribute safety (safe parameter; 2309)
13026 !! wikitext
13027 {{div style|width: 200px}}
13028 !! html
13029 <div style="float: right; width: 200px">Magic div</div>
13030
13031 !! end
13032
13033 !! test
13034 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13035 !! wikitext
13036 {{div style|width: expression(alert(document.cookie))}}
13037 !! html
13038 <div style="/* insecure input */">Magic div</div>
13039
13040 !! end
13041
13042 !! test
13043 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13044 !! wikitext
13045 {{div style|"><script>alert(document.cookie)</script>}}
13046 !! html
13047 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13048
13049 !! end
13050
13051 !! test
13052 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13053 !! wikitext
13054 {{div style|" ><script>alert(document.cookie)</script>}}
13055 !! html
13056 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13057
13058 !! end
13059
13060 !! test
13061 Bug 2304: HTML attribute safety (link)
13062 !! wikitext
13063 <div title="[[Main Page]]"></div>
13064 !! html
13065 <div title="&#91;&#91;Main Page]]"></div>
13066
13067 !! end
13068
13069 !! test
13070 Bug 2304: HTML attribute safety (italics)
13071 !! wikitext
13072 <div title="''foobar''"></div>
13073 !! html
13074 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13075
13076 !! end
13077
13078 !! test
13079 Bug 2304: HTML attribute safety (bold)
13080 !! wikitext
13081 <div title="'''foobar'''"></div>
13082 !! html
13083 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13084
13085 !! end
13086
13087
13088 !! test
13089 Bug 2304: HTML attribute safety (ISBN)
13090 !! wikitext
13091 <div title="ISBN 1234567890"></div>
13092 !! html
13093 <div title="&#73;SBN 1234567890"></div>
13094
13095 !! end
13096
13097 !! test
13098 Bug 2304: HTML attribute safety (RFC)
13099 !! wikitext
13100 <div title="RFC 1234"></div>
13101 !! html
13102 <div title="&#82;FC 1234"></div>
13103
13104 !! end
13105
13106 !! test
13107 Bug 2304: HTML attribute safety (PMID)
13108 !! wikitext
13109 <div title="PMID 1234567890"></div>
13110 !! html
13111 <div title="&#80;MID 1234567890"></div>
13112
13113 !! end
13114
13115 !! test
13116 Bug 2304: HTML attribute safety (web link)
13117 !! wikitext
13118 <div title="http://example.com/"></div>
13119 !! html
13120 <div title="http&#58;//example.com/"></div>
13121
13122 !! end
13123
13124 !! test
13125 Bug 2304: HTML attribute safety (named web link)
13126 !! wikitext
13127 <div title="[http://example.com/ link]"></div>
13128 !! html
13129 <div title="&#91;http&#58;//example.com/ link]"></div>
13130
13131 !! end
13132
13133 !! test
13134 Bug 3244: HTML attribute safety (extension; safe)
13135 !! wikitext
13136 <div style="<nowiki>background:blue</nowiki>"></div>
13137 !! html
13138 <div style="background:blue"></div>
13139
13140 !! end
13141
13142 !! test
13143 Bug 3244: HTML attribute safety (extension; unsafe)
13144 !! wikitext
13145 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13146 !! html
13147 <div style="/* insecure input */"></div>
13148
13149 !! end
13150
13151 # More MSIE fun discovered by Tom Gilder
13152
13153 !! test
13154 MSIE CSS safety test: spurious slash
13155 !! wikitext
13156 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13157 !! html
13158 <div style="/* insecure input */">evil</div>
13159
13160 !! end
13161
13162 !! test
13163 MSIE CSS safety test: hex code
13164 !! wikitext
13165 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13166 !! html
13167 <div style="/* insecure input */">evil</div>
13168
13169 !! end
13170
13171 !! test
13172 MSIE CSS safety test: comment in url
13173 !! wikitext
13174 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13175 !! html
13176 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13177
13178 !! end
13179
13180 !! test
13181 MSIE CSS safety test: comment in expression
13182 !! wikitext
13183 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13184 !! html
13185 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13186
13187 !! end
13188
13189 !! test
13190 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13191 !! wikitext
13192 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13193 !! html
13194 <p style="/* invalid control char */">A</p>
13195
13196 !! end
13197
13198 !! test
13199 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13200 !! wikitext
13201 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13202 <div style="top:EXPRESSION(alert())">B</div>
13203 !! html
13204 <p style="/* insecure input */">A</p>
13205 <div style="/* insecure input */">B</div>
13206
13207 !! end
13208
13209 !! test
13210 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13211 !! wikitext
13212 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13213 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13214 !! html
13215 <div style="/* insecure input */">A</div>
13216 <p style="/* insecure input */">B</p>
13217
13218 !! end
13219
13220 !! test
13221 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13222 !! wikitext
13223 <div style="background-image:url⁽javascript:alert())">A</div>
13224 <div style="background-image:url₍javascript:alert())">B</div>
13225 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13226 !! html
13227 <div style="/* insecure input */">A</div>
13228 <div style="/* insecure input */">B</div>
13229 <p style="/* insecure input */">C</p>
13230
13231 !! end
13232
13233 !! test
13234 Opera -o-link CSS
13235 !! wikitext
13236 <div
13237 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;"
13238 style="-o-link:attr(title);-o-link-source:current">X</div>
13239 !! html
13240 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13241
13242 !! end
13243
13244 !! test
13245 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13246 !! wikitext
13247 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13248 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13249 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13250 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13251 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13252 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13253 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13254 !! html
13255 <p style="/* insecure input */">A</p>
13256 <p style="/* insecure input */">B</p>
13257 <p style="/* insecure input */">C</p>
13258 <p style="/* insecure input */">D</p>
13259 <p style="/* insecure input */">E</p>
13260 <p style="/* insecure input */">F</p>
13261 <p style="/* insecure input */">G</p>
13262
13263 !! end
13264
13265 !! test
13266 Table attribute legitimate extension
13267 !! wikitext
13268 {|
13269 !+ style="<nowiki>color:blue</nowiki>"| status
13270 |}
13271 !! html
13272 <table>
13273 <tr>
13274 <th style="color:blue"> status
13275 </th></tr></table>
13276
13277 !!end
13278
13279 !! test
13280 Table attribute safety
13281 !! wikitext
13282 {|
13283 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13284 |}
13285 !! html
13286 <table>
13287 <tr>
13288 <th style="/* insecure input */"> status
13289 </th></tr></table>
13290
13291 !! end
13292
13293 !! test
13294 CSS line continuation 1
13295 !! wikitext
13296 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13297 !! html
13298 <div style="/* insecure input */"></div>
13299
13300 !! end
13301
13302 !! test
13303 CSS line continuation 2
13304 !! wikitext
13305 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13306 !! html
13307 <div style="/* insecure input */"></div>
13308
13309 !! end
13310
13311 !! article
13312 Template:Identity
13313 !! text
13314 {{{1}}}
13315 !! endarticle
13316
13317 !! test
13318 Expansion of multi-line templates in attribute values (bug 6255)
13319 !! wikitext
13320 <div style="background: {{identity|#00FF00}}">-</div>
13321 !! html
13322 <div style="background: #00FF00">-</div>
13323
13324 !! end
13325
13326
13327 !! test
13328 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13329 !! wikitext
13330 <div style="background:
13331 #00FF00">-</div>
13332 !! html
13333 <div style="background: #00FF00">-</div>
13334
13335 !! end
13336
13337 !! test
13338 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13339 !! wikitext
13340 <div style="background: &#10;#00FF00">-</div>
13341 !! html
13342 <div style="background: &#10;#00FF00">-</div>
13343
13344 !! end
13345
13346 ###
13347 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13348 ###
13349 !! test
13350 Parser hook: empty input
13351 !! wikitext
13352 <tag></tag>
13353 !! html
13354 <pre>
13355 ''
13356 array (
13357 )
13358 </pre>
13359
13360 !! end
13361
13362 !! test
13363 Parser hook: empty input using terminated empty elements
13364 !! wikitext
13365 <tag/>
13366 !! html
13367 <pre>
13368 NULL
13369 array (
13370 )
13371 </pre>
13372
13373 !! end
13374
13375 !! test
13376 Parser hook: empty input using terminated empty elements (space before)
13377 !! wikitext
13378 <tag />
13379 !! html
13380 <pre>
13381 NULL
13382 array (
13383 )
13384 </pre>
13385
13386 !! end
13387
13388 !! test
13389 Parser hook: basic input
13390 !! wikitext
13391 <tag>input</tag>
13392 !! html
13393 <pre>
13394 'input'
13395 array (
13396 )
13397 </pre>
13398
13399 !! end
13400
13401
13402 !! test
13403 Parser hook: case insensitive
13404 !! wikitext
13405 <TAG>input</TAG>
13406 !! html
13407 <pre>
13408 'input'
13409 array (
13410 )
13411 </pre>
13412
13413 !! end
13414
13415
13416 !! test
13417 Parser hook: case insensitive, redux
13418 !! wikitext
13419 <TaG>input</TAg>
13420 !! html
13421 <pre>
13422 'input'
13423 array (
13424 )
13425 </pre>
13426
13427 !! end
13428
13429 !! test
13430 Parser hook: nested tags
13431 !! options
13432 noxml
13433 !! wikitext
13434 <tag><tag></tag></tag>
13435 !! html
13436 <pre>
13437 '<tag>'
13438 array (
13439 )
13440 </pre>&lt;/tag&gt;
13441
13442 !! end
13443
13444 !! test
13445 Parser hook: basic arguments
13446 !! wikitext
13447 <tag width=200 height = "100" depth = '50' square></tag>
13448 !! html
13449 <pre>
13450 ''
13451 array (
13452 'width' => '200',
13453 'height' => '100',
13454 'depth' => '50',
13455 'square' => 'square',
13456 )
13457 </pre>
13458
13459 !! end
13460
13461 !! test
13462 Parser hook: argument containing a forward slash (bug 5344)
13463 !! wikitext
13464 <tag filename='/tmp/bla'></tag>
13465 !! html
13466 <pre>
13467 ''
13468 array (
13469 'filename' => '/tmp/bla',
13470 )
13471 </pre>
13472
13473 !! end
13474
13475 !! test
13476 Parser hook: empty input using terminated empty elements (bug 2374)
13477 !! wikitext
13478 <tag foo=bar/>text
13479 !! html
13480 <pre>
13481 NULL
13482 array (
13483 'foo' => 'bar',
13484 )
13485 </pre>text
13486
13487 !! end
13488
13489 # </tag> should be output literally since there is no matching tag that begins it
13490 !! test
13491 Parser hook: basic arguments using terminated empty elements (bug 2374)
13492 !! wikitext
13493 <tag width=200 height = "100" depth = '50' square/>
13494 other stuff
13495 </tag>
13496 !! html
13497 <pre>
13498 NULL
13499 array (
13500 'width' => '200',
13501 'height' => '100',
13502 'depth' => '50',
13503 'square' => 'square',
13504 )
13505 </pre>
13506 <p>other stuff
13507 &lt;/tag&gt;
13508 </p>
13509 !! end
13510
13511 ###
13512 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13513 ###
13514
13515 !! test
13516 Parser hook: static parser hook not inside a comment
13517 !! wikitext
13518 <statictag>hello, world</statictag>
13519 <statictag action=flush/>
13520 !! html
13521 <p>hello, world
13522 </p>
13523 !! end
13524
13525
13526 !! test
13527 Parser hook: static parser hook inside a comment
13528 !! wikitext
13529 <!-- <statictag>hello, world</statictag> -->
13530 <statictag action=flush/>
13531 !! html
13532 <p><br />
13533 </p>
13534 !! end
13535
13536 # Nested template calls; this case was broken by Parser.php rev 1.506,
13537 # since reverted.
13538
13539 !! article
13540 Template:One-parameter
13541 !! text
13542 (My parameter is: {{{1}}})
13543 !! endarticle
13544
13545 !! article
13546 Template:Map-one-parameter
13547 !! text
13548 {{{{{1}}}|{{{2}}}}}
13549 !! endarticle
13550
13551 !! test
13552 Nested template calls
13553 !! wikitext
13554 {{Map-one-parameter|One-parameter|param}}
13555 !! html
13556 <p>(My parameter is: param)
13557 </p>
13558 !! end
13559
13560
13561 ###
13562 ### Sanitizer
13563 ###
13564 !! test
13565 Sanitizer: Closing of open tags
13566 !! wikitext
13567 <s></s><table></table>
13568 !! html
13569 <s></s><table></table>
13570
13571 !! end
13572
13573 !! test
13574 Sanitizer: Closing of open but not closed tags
13575 !! wikitext
13576 <s>foo
13577 !! html
13578 <p><s>foo</s>
13579 </p>
13580 !! end
13581
13582 !! test
13583 Sanitizer: Closing of closed but not open tags
13584 !! wikitext
13585 </s>
13586 !! html
13587 <p>&lt;/s&gt;
13588 </p>
13589 !! end
13590
13591 !! test
13592 Sanitizer: Closing of closed but not open table tags
13593 !! wikitext
13594 Table not started</td></tr></table>
13595 !! html
13596 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13597 </p>
13598 !! end
13599
13600 !! test
13601 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13602 !! wikitext
13603 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13604 !! html
13605 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13606 </p>
13607 !! end
13608
13609 !! test
13610 Sanitizer: Validating the contents of the id attribute (bug 4515)
13611 !! options
13612 disabled
13613 !! wikitext
13614 <br id=9 />
13615 !! html
13616 Something, but definitely not <br id="9" />...
13617 !! end
13618
13619 !! test
13620 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13621 !! options
13622 disabled
13623 !! wikitext
13624 <br id="foo" /><br id="foo" />
13625 !! html
13626 Something need to be done. foo-2 ?
13627 !! end
13628
13629 !! test
13630 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13631 !! wikitext
13632 <div itemscope>
13633 <meta itemprop="hello" content="world">
13634 <meta http-equiv="refresh" content="5">
13635 <meta itemprop="hello" http-equiv="refresh" content="5">
13636 <link itemprop="hello" href="{{SERVER}}">
13637 <link rel="stylesheet" href="{{SERVER}}">
13638 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13639 </div>
13640 !! html
13641 <div itemscope="itemscope">
13642 <p> <meta itemprop="hello" content="world" />
13643 &lt;meta http-equiv="refresh" content="5"&gt;
13644 <meta itemprop="hello" content="5" />
13645 </p>
13646 <link itemprop="hello" href="http&#58;//example.org" />
13647 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13648 <link itemprop="hello" href="http&#58;//example.org" />
13649 </div>
13650
13651 !! end
13652
13653 !! test
13654 Language converter: output gets cut off unexpectedly (bug 5757)
13655 !! options
13656 language=zh
13657 !! wikitext
13658 this bit is safe: }-
13659
13660 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13661
13662 then we get cut off here: }-
13663
13664 all additional text is vanished
13665 !! html
13666 <p>this bit is safe: }-
13667 </p><p>but if we add a conversion instance: xxx
13668 </p><p>then we get cut off here: }-
13669 </p><p>all additional text is vanished
13670 </p>
13671 !! end
13672
13673 !! test
13674 Self closed html pairs (bug 5487)
13675 !! options
13676 !! wikitext
13677 <center><font id="bug" />Centered text</center>
13678 <div><font id="bug2" />In div text</div>
13679 !! html
13680 <center>&lt;font id="bug" /&gt;Centered text</center>
13681 <div>&lt;font id="bug2" /&gt;In div text</div>
13682
13683 !! end
13684
13685 #
13686 #
13687 #
13688
13689 !! test
13690 Punctuation: nbsp before exclamation
13691 !! wikitext
13692 C'est grave !
13693 !! html
13694 <p>C'est grave&#160;!
13695 </p>
13696 !! end
13697
13698 !! test
13699 Punctuation: CSS !important (bug 11874)
13700 !! wikitext
13701 <div style="width:50% !important">important</div>
13702 !! html
13703 <div style="width:50% !important">important</div>
13704
13705 !!end
13706
13707 !! test
13708 Punctuation: CSS ! important (bug 11874; with space after)
13709 !! wikitext
13710 <div style="width:50% ! important">important</div>
13711 !! html
13712 <div style="width:50% ! important">important</div>
13713
13714 !!end
13715
13716
13717 !! test
13718 HTML bullet list, closed tags (bug 5497)
13719 !! wikitext
13720 <ul>
13721 <li>One</li>
13722 <li>Two</li>
13723 </ul>
13724 !! html
13725 <ul>
13726 <li>One</li>
13727 <li>Two</li>
13728 </ul>
13729
13730 !! end
13731
13732 !! test
13733 HTML bullet list, unclosed tags (bug 5497)
13734 !! options
13735 disabled
13736 !! wikitext
13737 <ul>
13738 <li>One
13739 <li>Two
13740 </ul>
13741 !! html
13742 <ul>
13743 <li>One
13744 </li>
13745 <li>Two
13746 </li>
13747 </ul>
13748
13749 !! end
13750
13751 !! test
13752 HTML ordered list, closed tags (bug 5497)
13753 !! wikitext
13754 <ol>
13755 <li>One</li>
13756 <li>Two</li>
13757 </ol>
13758 !! html
13759 <ol>
13760 <li>One</li>
13761 <li>Two</li>
13762 </ol>
13763
13764 !! end
13765
13766 !! test
13767 HTML ordered list, unclosed tags (bug 5497)
13768 !! options
13769 disabled
13770 !! wikitext
13771 <ol>
13772 <li>One
13773 <li>Two
13774 </ol>
13775 !! html
13776 <ol>
13777 <li>One
13778 </li>
13779 <li>Two
13780 </li>
13781 </ol>
13782
13783 !! end
13784
13785 !! test
13786 HTML nested bullet list, closed tags (bug 5497)
13787 !! wikitext
13788 <ul>
13789 <li>One</li>
13790 <li>Two:
13791 <ul>
13792 <li>Sub-one</li>
13793 <li>Sub-two</li>
13794 </ul>
13795 </li>
13796 </ul>
13797 !! html
13798 <ul>
13799 <li>One</li>
13800 <li>Two:
13801 <ul>
13802 <li>Sub-one</li>
13803 <li>Sub-two</li>
13804 </ul>
13805 </li>
13806 </ul>
13807
13808 !! end
13809
13810 !! test
13811 HTML nested bullet list, open tags (bug 5497)
13812 !! options
13813 disabled
13814 !! wikitext
13815 <ul>
13816 <li>One
13817 <li>Two:
13818 <ul>
13819 <li>Sub-one
13820 <li>Sub-two
13821 </ul>
13822 </ul>
13823 !! html
13824 <ul>
13825 <li>One
13826 </li>
13827 <li>Two:
13828 <ul>
13829 <li>Sub-one
13830 </li>
13831 <li>Sub-two
13832 </li>
13833 </ul>
13834 </li>
13835 </ul>
13836
13837 !! end
13838
13839 !! test
13840 HTML nested ordered list, closed tags (bug 5497)
13841 !! wikitext
13842 <ol>
13843 <li>One</li>
13844 <li>Two:
13845 <ol>
13846 <li>Sub-one</li>
13847 <li>Sub-two</li>
13848 </ol>
13849 </li>
13850 </ol>
13851 !! html
13852 <ol>
13853 <li>One</li>
13854 <li>Two:
13855 <ol>
13856 <li>Sub-one</li>
13857 <li>Sub-two</li>
13858 </ol>
13859 </li>
13860 </ol>
13861
13862 !! end
13863
13864 !! test
13865 HTML nested ordered list, open tags (bug 5497)
13866 !! options
13867 disabled
13868 !! wikitext
13869 <ol>
13870 <li>One
13871 <li>Two:
13872 <ol>
13873 <li>Sub-one
13874 <li>Sub-two
13875 </ol>
13876 </ol>
13877 !! html
13878 <ol>
13879 <li>One
13880 </li>
13881 <li>Two:
13882 <ol>
13883 <li>Sub-one
13884 </li>
13885 <li>Sub-two
13886 </li>
13887 </ol>
13888 </li>
13889 </ol>
13890
13891 !! end
13892
13893 !! test
13894 HTML ordered list item with parameters oddity
13895 !! wikitext
13896 <ol><li id="fragment">One</li>
13897 </ol>
13898 !! html
13899 <ol><li id="fragment">One</li>
13900 </ol>
13901
13902 !! end
13903
13904 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13905 !!test
13906 bug 5918: autonumbering
13907 !! wikitext
13908 [http://first/] [http://second] [ftp://ftp]
13909
13910 ftp://inlineftp
13911
13912 [mailto:enclosed@mail.tld With target]
13913
13914 [mailto:enclosed@mail.tld]
13915
13916 mailto:inline@mail.tld
13917 !! html/php
13918 <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>
13919 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13920 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13921 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13922 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13923 </p>
13924 !! html/parsoid
13925 <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>
13926 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13927 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13928 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13929 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13930 !! end
13931
13932
13933 #
13934 # Security and HTML correctness
13935 # From Nick Jenkins' fuzz testing
13936 #
13937
13938 !! test
13939 Fuzz testing: Parser13
13940 !! wikitext
13941 {|
13942 | http://a|
13943 !! html
13944 <table>
13945 <tr>
13946 <td>
13947 </td>
13948 </tr>
13949 </table>
13950
13951 !! end
13952
13953 !! test
13954 Fuzz testing: Parser14
13955 !! wikitext
13956 == onmouseover= ==
13957 http://__TOC__
13958 !! html
13959 <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>
13960 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13961 <ul>
13962 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13963 </ul>
13964 </div>
13965
13966
13967 !! end
13968
13969 !! test
13970 Fuzz testing: Parser14-table
13971 !! wikitext
13972 ==a==
13973 {| STYLE=__TOC__
13974 !! html
13975 <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>
13976 <table style="&#95;_TOC&#95;_">
13977 <tr><td></td></tr>
13978 </table>
13979
13980 !! end
13981
13982 # Known to produce bogus xml (extra </td>)
13983 !! test
13984 Fuzz testing: Parser16
13985 !! options
13986 noxml
13987 !! wikitext
13988 {|
13989 !https://||||||
13990 !! html
13991 <table>
13992 <tr>
13993 <th>https://</th>
13994 <th></th>
13995 <th></th>
13996 <th>
13997 </td>
13998 </tr>
13999 </table>
14000
14001 !! end
14002
14003 !! test
14004 Fuzz testing: Parser21
14005 !! wikitext
14006 {|
14007 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14008 |
14009 !! html
14010 <table>
14011 <tr>
14012 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14013 </th>
14014 <td>
14015 </td>
14016 </tr>
14017 </table>
14018
14019 !! end
14020
14021 !! test
14022 Fuzz testing: Parser22
14023 !! wikitext
14024 http://===r:::https://b
14025
14026 {|
14027 !! html
14028 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14029 </p>
14030 <table>
14031 <tr><td></td></tr>
14032 </table>
14033
14034 !! end
14035
14036 # Known to produce bad XML for now
14037 !! test
14038 Fuzz testing: Parser24
14039 !! options
14040 noxml
14041 !! wikitext
14042 {|
14043 {{{|
14044 <u CLASS=
14045 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14046 <br style="onmouseover='alert(document.cookie);' " />
14047
14048 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14049 |
14050 !! html
14051 <table>
14052 {{{|
14053 <u class="&#124;">}}}} &gt;
14054 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14055
14056 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14057 <tr>
14058 <td></u>
14059 </td>
14060 </tr>
14061 </table>
14062
14063 !! end
14064
14065 # Note: the current result listed for this is not what the original one was,
14066 # but the original bug was JavaScript injection, which is fixed in any case.
14067 # It's not clear that the original result listed was any more correct than the
14068 # current one. Original result:
14069 # <p>{{{|
14070 # </p>
14071 # <li class="&#124;&#124;">
14072 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14073 !!test
14074 Fuzz testing: Parser25 (bug 6055)
14075 !! wikitext
14076 {{{
14077 |
14078 <LI CLASS=||
14079 >
14080 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14081 !! html
14082 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14083 </p>
14084 !! end
14085
14086 !!test
14087 Fuzz testing: URL adjacent extension (with space, clean)
14088 !! options
14089 !! wikitext
14090 http://example.com <nowiki>junk</nowiki>
14091 !! html
14092 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14093 </p>
14094 !!end
14095
14096 !!test
14097 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14098 !! options
14099 !! wikitext
14100 http://example.com<nowiki>junk</nowiki>
14101 !! html
14102 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14103 </p>
14104 !!end
14105
14106 !!test
14107 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14108 !! options
14109 !! wikitext
14110 http://example.com<pre>junk</pre>
14111 !! html
14112 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14113
14114 !!end
14115
14116 !!test
14117 Fuzz testing: image with bogus manual thumbnail
14118 !! wikitext
14119 [[Image:foobar.jpg|thumbnail= ]]
14120 !! html/php
14121 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14122
14123 !! html/parsoid
14124 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14125 !!end
14126
14127 !! test
14128 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14129 !! wikitext
14130 <pre dir="&#10;"></pre>
14131 !! html
14132 <pre dir="&#10;"></pre>
14133
14134 !! end
14135
14136 !! test
14137 Parsing optional HTML elements (Bug 6171)
14138 !! options
14139 !! wikitext
14140 <table>
14141 <tr>
14142 <td> Some tabular data</td>
14143 <td> More tabular data ...
14144 <td> And yet som tabular data</td>
14145 </tr>
14146 </table>
14147 !! html
14148 <table>
14149 <tr>
14150 <td> Some tabular data</td>
14151 <td> More tabular data ...
14152 </td><td> And yet som tabular data</td>
14153 </tr>
14154 </table>
14155
14156 !! end
14157
14158 !! test
14159 Correct handling of <td>, <tr> (Bug 6171)
14160 !! options
14161 !! wikitext
14162 <table>
14163 <tr>
14164 <td> Some tabular data</td>
14165 <td> More tabular data ...</td>
14166 <td> And yet som tabular data</td>
14167 </tr>
14168 </table>
14169 !! html
14170 <table>
14171 <tr>
14172 <td> Some tabular data</td>
14173 <td> More tabular data ...</td>
14174 <td> And yet som tabular data</td>
14175 </tr>
14176 </table>
14177
14178 !! end
14179
14180
14181 !! test
14182 Parsing crashing regression (fr:JavaScript)
14183 !! wikitext
14184 </body></x>
14185 !! html
14186 <p>&lt;/body&gt;&lt;/x&gt;
14187 </p>
14188 !! end
14189
14190 !! test
14191 Inline wiki vs wiki block nesting
14192 !! wikitext
14193 '''Bold paragraph
14194
14195 New wiki paragraph
14196 !! html
14197 <p><b>Bold paragraph</b>
14198 </p><p>New wiki paragraph
14199 </p>
14200 !! end
14201
14202 !! test
14203 Inline HTML vs wiki block nesting
14204 !! options
14205 disabled
14206 !! wikitext
14207 <b>Bold paragraph
14208
14209 New wiki paragraph
14210 !! html
14211 <p><b>Bold paragraph</b>
14212 </p><p>New wiki paragraph
14213 </p>
14214 !! end
14215
14216 # Original result was this:
14217 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14218 # </p>
14219 # While that might be marginally more intuitive, maybe, the six-apostrophe
14220 # construct is clearly pathological and the result stated here (which is what
14221 # the parser actually does) is about as reasonable as anything.
14222 !!test
14223 Mixing markup for italics and bold
14224 !! options
14225 !! wikitext
14226 '''bold''''''bold''bolditalics'''''
14227 !! html
14228 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14229 </p>
14230 !! end
14231
14232
14233 !! article
14234 Xyzzyx
14235 !! text
14236 Article for special page transclusion test
14237 !! endarticle
14238
14239 !! test
14240 Special page transclusion
14241 !! options
14242 !! wikitext
14243 {{Special:Prefixindex/Xyzzyx}}
14244 !! html
14245 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14246
14247 !! end
14248
14249 !! test
14250 Special page transclusion twice (bug 5021)
14251 !! options
14252 !! wikitext
14253 {{Special:Prefixindex/Xyzzyx}}
14254 {{Special:Prefixindex/Xyzzyx}}
14255 !! html
14256 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14257 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14258
14259 !! end
14260
14261 !! test
14262 Transclusion of default MediaWiki message
14263 !! wikitext
14264 {{MediaWiki:Mainpage}}
14265 !! html
14266 <p>Main Page
14267 </p>
14268 !! end
14269
14270 !! test
14271 Transclusion of nonexistent MediaWiki message
14272 !! wikitext
14273 {{MediaWiki:Mainpagexxx}}
14274 !! html
14275 <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>
14276 </p>
14277 !! end
14278
14279 !! test
14280 Transclusion of MediaWiki message with underscore
14281 !! wikitext
14282 {{MediaWiki:history_short}}
14283 !! html
14284 <p>History
14285 </p>
14286 !! end
14287
14288 !! test
14289 Transclusion of MediaWiki message with space
14290 !! wikitext
14291 {{MediaWiki:history short}}
14292 !! html
14293 <p>History
14294 </p>
14295 !! end
14296
14297 !! test
14298 Invalid header with following text
14299 !! wikitext
14300 = x = y
14301 !! html
14302 <p>= x = y
14303 </p>
14304 !! end
14305
14306
14307 !! test
14308 Section extraction test (section 0)
14309 !! options
14310 section=0
14311 !! wikitext
14312 start
14313 ==a==
14314 ===aa===
14315 ====aaa====
14316 ==b==
14317 ===ba===
14318 ===bb===
14319 ====bba====
14320 ===bc===
14321 ==c==
14322 ===ca===
14323 !! html
14324 start
14325 !! end
14326
14327 !! test
14328 Section extraction test (section 1)
14329 !! options
14330 section=1
14331 !! wikitext
14332 start
14333 ==a==
14334 ===aa===
14335 ====aaa====
14336 ==b==
14337 ===ba===
14338 ===bb===
14339 ====bba====
14340 ===bc===
14341 ==c==
14342 ===ca===
14343 !! html
14344 ==a==
14345 ===aa===
14346 ====aaa====
14347 !! end
14348
14349 !! test
14350 Section extraction test (section 2)
14351 !! options
14352 section=2
14353 !! wikitext
14354 start
14355 ==a==
14356 ===aa===
14357 ====aaa====
14358 ==b==
14359 ===ba===
14360 ===bb===
14361 ====bba====
14362 ===bc===
14363 ==c==
14364 ===ca===
14365 !! html
14366 ===aa===
14367 ====aaa====
14368 !! end
14369
14370 !! test
14371 Section extraction test (section 3)
14372 !! options
14373 section=3
14374 !! wikitext
14375 start
14376 ==a==
14377 ===aa===
14378 ====aaa====
14379 ==b==
14380 ===ba===
14381 ===bb===
14382 ====bba====
14383 ===bc===
14384 ==c==
14385 ===ca===
14386 !! html
14387 ====aaa====
14388 !! end
14389
14390 !! test
14391 Section extraction test (section 4)
14392 !! options
14393 section=4
14394 !! wikitext
14395 start
14396 ==a==
14397 ===aa===
14398 ====aaa====
14399 ==b==
14400 ===ba===
14401 ===bb===
14402 ====bba====
14403 ===bc===
14404 ==c==
14405 ===ca===
14406 !! html
14407 ==b==
14408 ===ba===
14409 ===bb===
14410 ====bba====
14411 ===bc===
14412 !! end
14413
14414 !! test
14415 Section extraction test (section 5)
14416 !! options
14417 section=5
14418 !! wikitext
14419 start
14420 ==a==
14421 ===aa===
14422 ====aaa====
14423 ==b==
14424 ===ba===
14425 ===bb===
14426 ====bba====
14427 ===bc===
14428 ==c==
14429 ===ca===
14430 !! html
14431 ===ba===
14432 !! end
14433
14434 !! test
14435 Section extraction test (section 6)
14436 !! options
14437 section=6
14438 !! wikitext
14439 start
14440 ==a==
14441 ===aa===
14442 ====aaa====
14443 ==b==
14444 ===ba===
14445 ===bb===
14446 ====bba====
14447 ===bc===
14448 ==c==
14449 ===ca===
14450 !! html
14451 ===bb===
14452 ====bba====
14453 !! end
14454
14455 !! test
14456 Section extraction test (section 7)
14457 !! options
14458 section=7
14459 !! wikitext
14460 start
14461 ==a==
14462 ===aa===
14463 ====aaa====
14464 ==b==
14465 ===ba===
14466 ===bb===
14467 ====bba====
14468 ===bc===
14469 ==c==
14470 ===ca===
14471 !! html
14472 ====bba====
14473 !! end
14474
14475 !! test
14476 Section extraction test (section 8)
14477 !! options
14478 section=8
14479 !! wikitext
14480 start
14481 ==a==
14482 ===aa===
14483 ====aaa====
14484 ==b==
14485 ===ba===
14486 ===bb===
14487 ====bba====
14488 ===bc===
14489 ==c==
14490 ===ca===
14491 !! html
14492 ===bc===
14493 !! end
14494
14495 !! test
14496 Section extraction test (section 9)
14497 !! options
14498 section=9
14499 !! wikitext
14500 start
14501 ==a==
14502 ===aa===
14503 ====aaa====
14504 ==b==
14505 ===ba===
14506 ===bb===
14507 ====bba====
14508 ===bc===
14509 ==c==
14510 ===ca===
14511 !! html
14512 ==c==
14513 ===ca===
14514 !! end
14515
14516 !! test
14517 Section extraction test (section 10)
14518 !! options
14519 section=10
14520 !! wikitext
14521 start
14522 ==a==
14523 ===aa===
14524 ====aaa====
14525 ==b==
14526 ===ba===
14527 ===bb===
14528 ====bba====
14529 ===bc===
14530 ==c==
14531 ===ca===
14532 !! html
14533 ===ca===
14534 !! end
14535
14536 !! test
14537 Section extraction test (nonexistent section 11)
14538 !! options
14539 section=11
14540 !! wikitext
14541 start
14542 ==a==
14543 ===aa===
14544 ====aaa====
14545 ==b==
14546 ===ba===
14547 ===bb===
14548 ====bba====
14549 ===bc===
14550 ==c==
14551 ===ca===
14552 !! html
14553 !! end
14554
14555 !! test
14556 Section extraction test with bogus heading (section 1)
14557 !! options
14558 section=1
14559 !! wikitext
14560 ==a==
14561 ==bogus== not a legal section
14562 ==b==
14563 !! html
14564 ==a==
14565 ==bogus== not a legal section
14566 !! end
14567
14568 !! test
14569 Section extraction test with bogus heading (section 2)
14570 !! options
14571 section=2
14572 !! wikitext
14573 ==a==
14574 ==bogus== not a legal section
14575 ==b==
14576 !! html
14577 ==b==
14578 !! end
14579
14580 !! test
14581 Section extraction test with comment after heading (section 1)
14582 !! options
14583 section=1
14584 !! wikitext
14585 ==a==
14586 ==b== <!-- -->
14587 ==c==
14588 !! html
14589 ==a==
14590 !! end
14591
14592 !! test
14593 Section extraction test with comment after heading (section 2)
14594 !! options
14595 section=2
14596 !! wikitext
14597 ==a==
14598 ==b== <!-- -->
14599 ==c==
14600 !! html
14601 ==b== <!-- -->
14602 !! end
14603
14604 !! test
14605 Section extraction test with bogus <nowiki> heading (section 1)
14606 !! options
14607 section=1
14608 !! wikitext
14609 ==a==
14610 ==bogus== <nowiki>not a legal section</nowiki>
14611 ==b==
14612 !! html
14613 ==a==
14614 ==bogus== <nowiki>not a legal section</nowiki>
14615 !! end
14616
14617 !! test
14618 Section extraction test with bogus <nowiki> heading (section 2)
14619 !! options
14620 section=2
14621 !! wikitext
14622 ==a==
14623 ==bogus== <nowiki>not a legal section</nowiki>
14624 ==b==
14625 !! html
14626 ==b==
14627 !! end
14628
14629
14630 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14631 # instead of respecting commented sections
14632 !! test
14633 Section extraction prefixed by comment (section 1)
14634 !! options
14635 section=1
14636 !! wikitext
14637 <!-- -->==sec1==
14638 ==sec2==
14639 !! html
14640 ==sec2==
14641 !!end
14642
14643 !! test
14644 Section extraction prefixed by comment (section 2)
14645 !! options
14646 section=2
14647 !! wikitext
14648 <!-- -->==sec1==
14649 ==sec2==
14650 !! html
14651
14652 !!end
14653
14654
14655 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14656 # instead of respecting HTML-style headings
14657 !! test
14658 Section extraction, mixed wiki and html (section 1)
14659 !! options
14660 section=1
14661 !! wikitext
14662 <h2>unmarked</h2>
14663 unmarked
14664 ==1==
14665 one
14666 ==2==
14667 two
14668 !! html
14669 ==1==
14670 one
14671 !! end
14672
14673 !! test
14674 Section extraction, mixed wiki and html (section 2)
14675 !! options
14676 section=2
14677 !! wikitext
14678 <h2>unmarked</h2>
14679 unmarked
14680 ==1==
14681 one
14682 ==2==
14683 two
14684 !! html
14685 ==2==
14686 two
14687 !! end
14688
14689
14690 # Formerly testing for bug 3342
14691 !! test
14692 Section extraction, heading surrounded by <noinclude>
14693 !! options
14694 section=1
14695 !! wikitext
14696 <noinclude>==unmarked==</noinclude>
14697 ==marked==
14698 !! html
14699 ==marked==
14700 !!end
14701
14702 # Test behavior of bug 19910
14703 !! test
14704 Sectiion with all-equals
14705 !! options
14706 section=2
14707 !! wikitext
14708 ===
14709 The line above must have a trailing space
14710 === <!--
14711 --> <!-- -->
14712 But just in case it doesn't...
14713 !! html
14714 === <!--
14715 --> <!-- -->
14716 But just in case it doesn't...
14717 !! end
14718
14719 !! test
14720 Section replacement test (section 0)
14721 !! options
14722 replace=0,"xxx"
14723 !! wikitext
14724 start
14725 ==a==
14726 ===aa===
14727 ====aaa====
14728 ==b==
14729 ===ba===
14730 ===bb===
14731 ====bba====
14732 ===bc===
14733 ==c==
14734 ===ca===
14735 !! html
14736 xxx
14737
14738 ==a==
14739 ===aa===
14740 ====aaa====
14741 ==b==
14742 ===ba===
14743 ===bb===
14744 ====bba====
14745 ===bc===
14746 ==c==
14747 ===ca===
14748 !! end
14749
14750 !! test
14751 Section replacement test (section 1)
14752 !! options
14753 replace=1,"xxx"
14754 !! wikitext
14755 start
14756 ==a==
14757 ===aa===
14758 ====aaa====
14759 ==b==
14760 ===ba===
14761 ===bb===
14762 ====bba====
14763 ===bc===
14764 ==c==
14765 ===ca===
14766 !! html
14767 start
14768 xxx
14769
14770 ==b==
14771 ===ba===
14772 ===bb===
14773 ====bba====
14774 ===bc===
14775 ==c==
14776 ===ca===
14777 !! end
14778
14779 !! test
14780 Section replacement test (section 2)
14781 !! options
14782 replace=2,"xxx"
14783 !! wikitext
14784 start
14785 ==a==
14786 ===aa===
14787 ====aaa====
14788 ==b==
14789 ===ba===
14790 ===bb===
14791 ====bba====
14792 ===bc===
14793 ==c==
14794 ===ca===
14795 !! html
14796 start
14797 ==a==
14798 xxx
14799
14800 ==b==
14801 ===ba===
14802 ===bb===
14803 ====bba====
14804 ===bc===
14805 ==c==
14806 ===ca===
14807 !! end
14808
14809 !! test
14810 Section replacement test (section 3)
14811 !! options
14812 replace=3,"xxx"
14813 !! wikitext
14814 start
14815 ==a==
14816 ===aa===
14817 ====aaa====
14818 ==b==
14819 ===ba===
14820 ===bb===
14821 ====bba====
14822 ===bc===
14823 ==c==
14824 ===ca===
14825 !! html
14826 start
14827 ==a==
14828 ===aa===
14829 xxx
14830
14831 ==b==
14832 ===ba===
14833 ===bb===
14834 ====bba====
14835 ===bc===
14836 ==c==
14837 ===ca===
14838 !! end
14839
14840 !! test
14841 Section replacement test (section 4)
14842 !! options
14843 replace=4,"xxx"
14844 !! wikitext
14845 start
14846 ==a==
14847 ===aa===
14848 ====aaa====
14849 ==b==
14850 ===ba===
14851 ===bb===
14852 ====bba====
14853 ===bc===
14854 ==c==
14855 ===ca===
14856 !! html
14857 start
14858 ==a==
14859 ===aa===
14860 ====aaa====
14861 xxx
14862
14863 ==c==
14864 ===ca===
14865 !! end
14866
14867 !! test
14868 Section replacement test (section 5)
14869 !! options
14870 replace=5,"xxx"
14871 !! wikitext
14872 start
14873 ==a==
14874 ===aa===
14875 ====aaa====
14876 ==b==
14877 ===ba===
14878 ===bb===
14879 ====bba====
14880 ===bc===
14881 ==c==
14882 ===ca===
14883 !! html
14884 start
14885 ==a==
14886 ===aa===
14887 ====aaa====
14888 ==b==
14889 xxx
14890
14891 ===bb===
14892 ====bba====
14893 ===bc===
14894 ==c==
14895 ===ca===
14896 !! end
14897
14898 !! test
14899 Section replacement test (section 6)
14900 !! options
14901 replace=6,"xxx"
14902 !! wikitext
14903 start
14904 ==a==
14905 ===aa===
14906 ====aaa====
14907 ==b==
14908 ===ba===
14909 ===bb===
14910 ====bba====
14911 ===bc===
14912 ==c==
14913 ===ca===
14914 !! html
14915 start
14916 ==a==
14917 ===aa===
14918 ====aaa====
14919 ==b==
14920 ===ba===
14921 xxx
14922
14923 ===bc===
14924 ==c==
14925 ===ca===
14926 !! end
14927
14928 !! test
14929 Section replacement test (section 7)
14930 !! options
14931 replace=7,"xxx"
14932 !! wikitext
14933 start
14934 ==a==
14935 ===aa===
14936 ====aaa====
14937 ==b==
14938 ===ba===
14939 ===bb===
14940 ====bba====
14941 ===bc===
14942 ==c==
14943 ===ca===
14944 !! html
14945 start
14946 ==a==
14947 ===aa===
14948 ====aaa====
14949 ==b==
14950 ===ba===
14951 ===bb===
14952 xxx
14953
14954 ===bc===
14955 ==c==
14956 ===ca===
14957 !! end
14958
14959 !! test
14960 Section replacement test (section 8)
14961 !! options
14962 replace=8,"xxx"
14963 !! wikitext
14964 start
14965 ==a==
14966 ===aa===
14967 ====aaa====
14968 ==b==
14969 ===ba===
14970 ===bb===
14971 ====bba====
14972 ===bc===
14973 ==c==
14974 ===ca===
14975 !! html
14976 start
14977 ==a==
14978 ===aa===
14979 ====aaa====
14980 ==b==
14981 ===ba===
14982 ===bb===
14983 ====bba====
14984 xxx
14985
14986 ==c==
14987 ===ca===
14988 !!end
14989
14990 !! test
14991 Section replacement test (section 9)
14992 !! options
14993 replace=9,"xxx"
14994 !! wikitext
14995 start
14996 ==a==
14997 ===aa===
14998 ====aaa====
14999 ==b==
15000 ===ba===
15001 ===bb===
15002 ====bba====
15003 ===bc===
15004 ==c==
15005 ===ca===
15006 !! html
15007 start
15008 ==a==
15009 ===aa===
15010 ====aaa====
15011 ==b==
15012 ===ba===
15013 ===bb===
15014 ====bba====
15015 ===bc===
15016 xxx
15017 !! end
15018
15019 !! test
15020 Section replacement test (section 10)
15021 !! options
15022 replace=10,"xxx"
15023 !! wikitext
15024 start
15025 ==a==
15026 ===aa===
15027 ====aaa====
15028 ==b==
15029 ===ba===
15030 ===bb===
15031 ====bba====
15032 ===bc===
15033 ==c==
15034 ===ca===
15035 !! html
15036 start
15037 ==a==
15038 ===aa===
15039 ====aaa====
15040 ==b==
15041 ===ba===
15042 ===bb===
15043 ====bba====
15044 ===bc===
15045 ==c==
15046 xxx
15047 !! end
15048
15049 !! test
15050 Section replacement test with initial whitespace (bug 13728)
15051 !! options
15052 replace=2,"xxx"
15053 !! wikitext
15054 Preformatted initial line
15055 ==a==
15056 ===a===
15057 !! html
15058 Preformatted initial line
15059 ==a==
15060 xxx
15061 !! end
15062
15063
15064 !! test
15065 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15066 !! options
15067 section=1
15068 !! wikitext
15069 ==a==
15070 a
15071 !! html
15072 ==a==
15073 a
15074 !! end
15075
15076 !! test
15077 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15078 !! options
15079 section=1
15080 !! wikitext
15081 ==a==
15082 a
15083 !! html
15084 ==a==
15085 a
15086 !! end
15087
15088
15089 !! test
15090 Section extraction, <pre> around bogus header (bug 10309)
15091 !! options
15092 noxml section=2
15093 !! wikitext
15094 == Section One ==
15095 <pre>
15096 =======
15097 </pre>
15098
15099 == Section Two ==
15100 stuff
15101 !! html
15102 == Section Two ==
15103 stuff
15104 !! end
15105
15106 !! test
15107 Section replacement, <pre> around bogus header (bug 10309)
15108 !! options
15109 noxml replace=2,"xxx"
15110 !! wikitext
15111 == Section One ==
15112 <pre>
15113 =======
15114 </pre>
15115
15116 == Section Two ==
15117 stuff
15118 !! html
15119 == Section One ==
15120 <pre>
15121 =======
15122 </pre>
15123
15124 xxx
15125 !! end
15126
15127
15128
15129 !! test
15130 Handling of &#x0A; in URLs
15131 !! wikitext
15132 ** irc://&#x0A;a
15133 !! html/php
15134 <ul>
15135 <li><ul>
15136 <li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
15137 </li>
15138 </ul>
15139 </li>
15140 </ul>
15141
15142 !! html/parsoid
15143 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15144 a">irc://
15145 a</a></li></ul></li></ul>
15146 !! end
15147
15148 !! test
15149 Handling of %0A in URLs
15150 !! wikitext
15151 ** irc://%0Aa
15152 !! html/php
15153 <ul>
15154 <li><ul>
15155 <li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
15156 </li>
15157 </ul>
15158 </li>
15159 </ul>
15160
15161 !! html/parsoid
15162 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15163 !! end
15164
15165
15166 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15167 !! test
15168 5 quotes, code coverage +1 line
15169 !! options
15170 parsoid=wt2html
15171 !! wikitext
15172 '''''
15173 !! html/php
15174 !! html/parsoid
15175 <p><b><i></i></b></p>
15176 !! end
15177
15178 # same html as previous, but wikitext adjusted to match parsoid html2wt
15179 # note that wt2html and html2html will put the <i> before the <b>
15180 !! test
15181 5 quotes, code coverage +1 line w/ nowiki (1)
15182 !! options
15183 parsoid=wt2wt,html2wt
15184 !! wikitext
15185 '''''<nowiki/>'''''
15186 !! html/php
15187 <p><i></i>
15188 </p>
15189 !! html/parsoid
15190 <p><b><i></i></b></p>
15191 !! end
15192
15193 # same as previous, just swapping the <i> and <b>
15194 !! test
15195 5 quotes, code coverage +1 line w/ nowiki (2)
15196 !! wikitext
15197 '''''<nowiki/>'''''
15198 !! html/php
15199 <p><i></i>
15200 </p>
15201 !! html/parsoid
15202 <p><i><b></b></i></p>
15203 !! end
15204
15205 !! test
15206 Special:Search page linking.
15207 !! wikitext
15208 {{Special:search}}
15209 !! html
15210 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15211 </p>
15212 !! end
15213
15214 !! test
15215 Say the magic word
15216 !! options
15217 title=[[Parser test]]
15218 !! wikitext
15219 * {{PAGENAME}}
15220 * {{PAGENAMEE}}
15221 * {{FULLPAGENAME}}
15222 * {{FULLPAGENAMEE}}
15223 * {{BASEPAGENAME}}
15224 * {{BASEPAGENAMEE}}
15225 * {{SUBPAGENAME}}
15226 * {{SUBPAGENAMEE}}
15227 * {{ROOTPAGENAME}}
15228 * {{ROOTPAGENAMEE}}
15229 * {{TALKPAGENAME}}
15230 * {{TALKPAGENAMEE}}
15231 * {{SUBJECTPAGENAME}}
15232 * {{SUBJECTPAGENAMEE}}
15233 * {{NAMESPACEE}}
15234 * {{NAMESPACE}}
15235 * {{NAMESPACENUMBER}}
15236 * {{TALKSPACE}}
15237 * {{TALKSPACEE}}
15238 * {{SUBJECTSPACE}}
15239 * {{SUBJECTSPACEE}}
15240 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15241 !! html
15242 <ul>
15243 <li> Parser test
15244 </li>
15245 <li> Parser_test
15246 </li>
15247 <li> Parser test
15248 </li>
15249 <li> Parser_test
15250 </li>
15251 <li> Parser test
15252 </li>
15253 <li> Parser_test
15254 </li>
15255 <li> Parser test
15256 </li>
15257 <li> Parser_test
15258 </li>
15259 <li> Parser test
15260 </li>
15261 <li> Parser_test
15262 </li>
15263 <li> Talk:Parser test
15264 </li>
15265 <li> Talk:Parser_test
15266 </li>
15267 <li> Parser test
15268 </li>
15269 <li> Parser_test
15270 </li>
15271 <li>
15272 </li>
15273 <li>
15274 </li>
15275 <li> 0
15276 </li>
15277 <li> Talk
15278 </li>
15279 <li> Talk
15280 </li>
15281 <li>
15282 </li>
15283 <li>
15284 </li>
15285 <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>
15286 </li>
15287 </ul>
15288
15289 !! end
15290 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15291
15292 !! test
15293 Gallery
15294 !! wikitext
15295 <gallery>
15296 image1.png |
15297 image2.gif|||||
15298
15299 image3|
15300 image4 |300px| centre
15301 image5.svg| http://///////
15302 [[x|xx]]]]
15303 * image6
15304 </gallery>
15305 !! html
15306 <ul class="gallery mw-gallery-traditional">
15307 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15308 <div class="thumb" style="height: 150px;">Image1.png</div>
15309 <div class="gallerytext">
15310 </div>
15311 </div></li>
15312 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15313 <div class="thumb" style="height: 150px;">Image2.gif</div>
15314 <div class="gallerytext">
15315 <p>||||
15316 </p>
15317 </div>
15318 </div></li>
15319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15320 <div class="thumb" style="height: 150px;">Image3</div>
15321 <div class="gallerytext">
15322 </div>
15323 </div></li>
15324 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15325 <div class="thumb" style="height: 150px;">Image4</div>
15326 <div class="gallerytext">
15327 <p>300px| centre
15328 </p>
15329 </div>
15330 </div></li>
15331 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15332 <div class="thumb" style="height: 150px;">Image5.svg</div>
15333 <div class="gallerytext">
15334 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15335 </p>
15336 </div>
15337 </div></li>
15338 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15339 <div class="thumb" style="height: 150px;">* image6</div>
15340 <div class="gallerytext">
15341 </div>
15342 </div></li>
15343 </ul>
15344
15345 !! end
15346
15347 !! test
15348 Gallery (with options)
15349 !! wikitext
15350 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15351 File:Nonexistant.jpg|caption
15352 File:Nonexistant.jpg
15353 image:foobar.jpg|some '''caption''' [[Main Page]]
15354 image:foobar.jpg
15355 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15356 </gallery>
15357 !! html
15358 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15359 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15360 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15361 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15362 <div class="gallerytext">
15363 <p>caption
15364 </p>
15365 </div>
15366 </div></li>
15367 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15368 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15369 <div class="gallerytext">
15370 </div>
15371 </div></li>
15372 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15373 <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>
15374 <div class="gallerytext">
15375 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15376 </p>
15377 </div>
15378 </div></li>
15379 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15380 <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>
15381 <div class="gallerytext">
15382 </div>
15383 </div></li>
15384 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15385 <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>
15386 <div class="gallerytext">
15387 <p>Blabla|blabla.
15388 </p>
15389 </div>
15390 </div></li>
15391 </ul>
15392
15393 !! end
15394
15395 !! test
15396 Gallery with wikitext inside caption
15397 !! wikitext
15398 <gallery>
15399 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15400 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15401 </gallery>
15402 !! html
15403 <ul class="gallery mw-gallery-traditional">
15404 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15405 <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>
15406 <div class="gallerytext">
15407 <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>
15408 </p>
15409 </div>
15410 </div></li>
15411 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15412 <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>
15413 <div class="gallerytext">
15414 <p>This is a test template
15415 </p>
15416 </div>
15417 </div></li>
15418 </ul>
15419
15420 !! end
15421
15422 !! test
15423 gallery (with showfilename option)
15424 !! wikitext
15425 <gallery showfilename>
15426 File:Nonexistant.jpg|caption
15427 File:Nonexistant.jpg
15428 image:foobar.jpg|some '''caption''' [[Main Page]]
15429 File:Foobar.jpg
15430 </gallery>
15431 !! html
15432 <ul class="gallery mw-gallery-traditional">
15433 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15434 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15435 <div class="gallerytext">
15436 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15437 caption
15438 </p>
15439 </div>
15440 </div></li>
15441 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15442 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15443 <div class="gallerytext">
15444 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15445 </p>
15446 </div>
15447 </div></li>
15448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15449 <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>
15450 <div class="gallerytext">
15451 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15452 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15453 </p>
15454 </div>
15455 </div></li>
15456 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15457 <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>
15458 <div class="gallerytext">
15459 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15460 </p>
15461 </div>
15462 </div></li>
15463 </ul>
15464
15465 !! end
15466
15467 !! test
15468 Gallery (with namespace-less filenames)
15469 !! wikitext
15470 <gallery>
15471 File:Nonexistant.jpg
15472 Nonexistant.jpg
15473 image:foobar.jpg
15474 foobar.jpg
15475 </gallery>
15476 !! html
15477 <ul class="gallery mw-gallery-traditional">
15478 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15479 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15480 <div class="gallerytext">
15481 </div>
15482 </div></li>
15483 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15484 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15485 <div class="gallerytext">
15486 </div>
15487 </div></li>
15488 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15489 <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>
15490 <div class="gallerytext">
15491 </div>
15492 </div></li>
15493 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15494 <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>
15495 <div class="gallerytext">
15496 </div>
15497 </div></li>
15498 </ul>
15499
15500 !! end
15501
15502 !! test
15503 HTML Hex character encoding (spells the word "JavaScript")
15504 !! options
15505 parsoid=wt2html,wt2wt,html2html
15506 !! wikitext
15507 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15508 !! html/php
15509 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15510 </p>
15511 !! html/parsoid
15512 <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>
15513 !! end
15514
15515 !! test
15516 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15517 !! wikitext
15518 &#xsee;&#XSEE;
15519 !! html/php
15520 <p>&amp;#xsee;&amp;#XSEE;
15521 </p>
15522 !! html/parsoid
15523 <p>&amp;#xsee;&amp;#XSEE;</p>
15524 !! end
15525
15526 !! test
15527 HTML Hex character encoding mixed case
15528 !! options
15529 parsoid=wt2html,wt2wt,html2html
15530 !! wikitext
15531 &#xEE;&#Xee;
15532 !! html/php
15533 <p>&#xee;&#xee;
15534 </p>
15535 !! html/parsoid
15536 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15537 !! end
15538
15539 !! test
15540 __FORCETOC__ override
15541 !! wikitext
15542 __NEWSECTIONLINK__
15543 __FORCETOC__
15544 !! html
15545 <p><br />
15546 </p>
15547 !! end
15548
15549 !! test
15550 ISBN code coverage
15551 !! wikitext
15552 ISBN 978-0-1234-56&#x20;789
15553 !! html
15554 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15555 </p>
15556 !! end
15557
15558 !! test
15559 ISBN followed by 5 spaces
15560 !! wikitext
15561 ISBN
15562 !! html
15563 <p>ISBN
15564 </p>
15565 !! end
15566
15567 !! test
15568 Double ISBN
15569 !! wikitext
15570 ISBN ISBN 1234567890
15571 !! html
15572 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15573 </p>
15574 !! end
15575
15576 !! test
15577 ISBN with an X
15578 !! wikitext
15579 ISBN 3-462-04561-X
15580 !! html
15581 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15582 </p>
15583 !! end
15584
15585 !! test
15586 ISBN with empty prefix (parsoid test)
15587 !! wikitext
15588 ISBN 1234567890
15589 !! html/parsoid
15590 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15591 !! end
15592
15593 !! test
15594 Bug 22905: <abbr> followed by ISBN followed by </a>
15595 !! wikitext
15596 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15597 !! html
15598 <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>
15599 </p>
15600 !! end
15601
15602 !! test
15603 Double RFC
15604 !! wikitext
15605 RFC RFC 1234
15606 !! html
15607 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15608 </p>
15609 !! end
15610
15611 !! test
15612 Double RFC with a wiki link
15613 !! wikitext
15614 RFC [[RFC 1234]]
15615 !! html
15616 <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>
15617 </p>
15618 !! end
15619
15620 !! test
15621 RFC code coverage
15622 !! wikitext
15623 RFC 983&#x20;987
15624 !! html
15625 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15626 </p>
15627 !! end
15628
15629 !! test
15630 Centre-aligned image
15631 !! wikitext
15632 [[Image:foobar.jpg|centre]]
15633 !! html
15634 <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>
15635
15636 !!end
15637
15638 !! test
15639 None-aligned image
15640 !! wikitext
15641 [[Image:foobar.jpg|none]]
15642 !! html
15643 <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>
15644
15645 !!end
15646
15647 !! test
15648 Width + Height sized image (using px) (height is ignored)
15649 !! wikitext
15650 [[Image:foobar.jpg|640x480px]]
15651 !! html
15652 <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>
15653 </p>
15654 !!end
15655
15656 !! test
15657 Width-sized image (using px, no following whitespace)
15658 !! wikitext
15659 [[Image:foobar.jpg|640px]]
15660 !! html
15661 <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>
15662 </p>
15663 !!end
15664
15665 !! test
15666 Width-sized image (using px, with following whitespace - test regression from r39467)
15667 !! wikitext
15668 [[Image:foobar.jpg|640px ]]
15669 !! html
15670 <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>
15671 </p>
15672 !!end
15673
15674 !! test
15675 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15676 !! wikitext
15677 [[Image:foobar.jpg| 640px]]
15678 !! html
15679 <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>
15680 </p>
15681 !!end
15682
15683 !! test
15684 Image with page parameter
15685 !! options
15686 djvu
15687 !! wikitext
15688 [[File:LoremIpsum.djvu|page=2]]
15689 !! html
15690 <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>
15691 </p>
15692 !! end
15693
15694 !! test
15695 Another italics / bold test
15696 !! wikitext
15697 ''' ''x'
15698 !! html
15699 <pre>'<i> </i>x'
15700 </pre>
15701 !!end
15702
15703 # Note the results may be incorrect, as parserTest output included this:
15704 # XML error: Mismatched tag at byte 6120:
15705 # ...<dd> </dt></dl> </dd...
15706 !! test
15707 dt/dd/dl test
15708 !! options
15709 disabled
15710 !! wikitext
15711 :;;;::
15712 !! html
15713 <dl>
15714 <dd><dl>
15715 <dt><dl>
15716 <dt><dl>
15717 <dt><dl>
15718 <dd><dl>
15719 <dd>
15720 </dd>
15721 </dl>
15722 </dd>
15723 </dl>
15724 </dt>
15725 </dl>
15726 </dt>
15727 </dl>
15728 </dt>
15729 </dl>
15730 </dd>
15731 </dl>
15732
15733 !!end
15734
15735
15736 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15737 !! test
15738 Images with the "|" character in the comment
15739 !! wikitext
15740 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15741 !! html/php
15742 <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>
15743
15744 !! html/parsoid
15745 <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>
15746 !! end
15747
15748 !! test
15749 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15750 !! wikitext
15751 <html><script>alert(1);</script></html>
15752 !! html
15753 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15754 </p>
15755 !! end
15756
15757 !! test
15758 HTML with raw HTML ($wgRawHtml==true)
15759 !! options
15760 wgRawHtml=1
15761 !! wikitext
15762 <html><script>alert(1);</script></html>
15763 !! html
15764 <p><script>alert(1);</script>
15765 </p>
15766 !! end
15767
15768 !! test
15769 Parents of subpages, one level up
15770 !! options
15771 subpage title=[[Subpage test/L1/L2/L3]]
15772 !! wikitext
15773 [[../|L2]]
15774 !! html
15775 <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>
15776 </p>
15777 !! end
15778
15779
15780 !! test
15781 Parents of subpages, one level up, not named
15782 !! options
15783 subpage title=[[Subpage test/L1/L2/L3]]
15784 !! wikitext
15785 [[../]]
15786 !! html
15787 <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>
15788 </p>
15789 !! end
15790
15791
15792
15793 !! test
15794 Parents of subpages, two levels up
15795 !! options
15796 subpage title=[[Subpage test/L1/L2/L3]]
15797 !! wikitext
15798 [[../../|L1]]2
15799
15800 [[../../|L1]]l
15801 !! html
15802 <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
15803 </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>
15804 </p>
15805 !! end
15806
15807 !! test
15808 Parents of subpages, two levels up, without trailing slash or name.
15809 !! options
15810 subpage title=[[Subpage test/L1/L2/L3]]
15811 !! wikitext
15812 [[../..]]
15813 !! html
15814 <p>[[../..]]
15815 </p>
15816 !! end
15817
15818 !! test
15819 Parents of subpages, two levels up, with lots of extra trailing slashes.
15820 !! options
15821 subpage title=[[Subpage test/L1/L2/L3]]
15822 !! wikitext
15823 [[../../////]]
15824 !! html
15825 <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>
15826 </p>
15827 !! end
15828
15829 !! article
15830 Subpage test/L1/L2/L3Sibling
15831 !! text
15832 Sibling article
15833 !! endarticle
15834
15835 !! test
15836 Transclusion of a sibling page (one level up)
15837 !! options
15838 subpage title=[[Subpage test/L1/L2/L3]]
15839 !! wikitext
15840 {{../L3Sibling}}
15841 !! html
15842 <p>Sibling article
15843 </p>
15844 !! end
15845
15846 !! test
15847 Transclusion of a child page
15848 !! options
15849 subpage title=[[Subpage test/L1/L2]]
15850 !! wikitext
15851 {{/L3Sibling}}
15852 !! html
15853 <p>Sibling article
15854 </p>
15855 !! end
15856
15857 !! test
15858 Non-transclusion because of too many up levels
15859 !! options
15860 subpage title=[[Subpage test/L1/L2/L3]]
15861 !! wikitext
15862 {{../../../../More than parent}}
15863 !! html
15864 <p>{{../../../../More than parent}}
15865 </p>
15866 !! end
15867
15868 !! test
15869 Definition list code coverage
15870 !! wikitext
15871 ; title : def
15872 ; title : def
15873 ;title: def
15874 !! html
15875 <dl>
15876 <dt> title &#160;</dt>
15877 <dd> def
15878 </dd>
15879 <dt> title&#160;</dt>
15880 <dd> def
15881 </dd>
15882 <dt>title</dt>
15883 <dd> def
15884 </dd>
15885 </dl>
15886
15887 !! end
15888
15889 !! test
15890 Don't fall for the self-closing div
15891 !! wikitext
15892 <div>hello world</div/>
15893 !! html
15894 <div>hello world</div>
15895
15896 !! end
15897
15898 !! test
15899 MSGNW magic word
15900 !! wikitext
15901 {{MSGNW:msg}}
15902 !! html
15903 <p>&#91;&#91;:Template:Msg&#93;&#93;
15904 </p>
15905 !! end
15906
15907 !! test
15908 RAW magic word
15909 !! wikitext
15910 {{RAW:QUERTY}}
15911 !! html
15912 <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>
15913 </p>
15914 !! end
15915
15916 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15917 !! test
15918 Always escape literal '>' in output, not just after '<'
15919 !! wikitext
15920 ><>
15921 !! html
15922 <p>&gt;&lt;&gt;
15923 </p>
15924 !! end
15925
15926 !! test
15927 Template caching
15928 !! wikitext
15929 {{Test}}
15930 {{Test}}
15931 !! html
15932 <p>This is a test template
15933 This is a test template
15934 </p>
15935 !! end
15936
15937
15938 !! article
15939 MediaWiki:Fake
15940 !! text
15941 ==header==
15942 !! endarticle
15943
15944 !! test
15945 Inclusion of !userCanEdit() content
15946 !! wikitext
15947 {{MediaWiki:Fake}}
15948 !! html
15949 <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>
15950
15951 !! end
15952
15953
15954 !! test
15955 Out-of-order TOC heading levels
15956 !! wikitext
15957 ==2==
15958 ======6======
15959 ===3===
15960 =1=
15961 =====5=====
15962 ==2==
15963 !! html
15964 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15965 <ul>
15966 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15967 <ul>
15968 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15969 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15970 </ul>
15971 </li>
15972 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15973 <ul>
15974 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15975 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15976 </ul>
15977 </li>
15978 </ul>
15979 </div>
15980
15981 <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>
15982 <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>
15983 <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>
15984 <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>
15985 <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>
15986 <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>
15987
15988 !! end
15989
15990
15991 !! test
15992 ISBN with a dummy number
15993 !! wikitext
15994 ISBN ---
15995 !! html
15996 <p>ISBN ---
15997 </p>
15998 !! end
15999
16000
16001 !! test
16002 ISBN with space-delimited number
16003 !! wikitext
16004 ISBN 92 9017 032 8
16005 !! html
16006 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16007 </p>
16008 !! end
16009
16010
16011 !! test
16012 ISBN with multiple spaces, no number
16013 !! wikitext
16014 ISBN foo
16015 !! html
16016 <p>ISBN foo
16017 </p>
16018 !! end
16019
16020
16021 !! test
16022 ISBN length
16023 !! wikitext
16024 ISBN 123456789
16025
16026 ISBN 1234567890
16027
16028 ISBN 12345678901
16029 !! html
16030 <p>ISBN 123456789
16031 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16032 </p><p>ISBN 12345678901
16033 </p>
16034 !! end
16035
16036
16037 !! test
16038 ISBN with trailing year (bug 8110)
16039 !! wikitext
16040 ISBN 1-234-56789-0 - 2006
16041
16042 ISBN 1 234 56789 0 - 2006
16043 !! html
16044 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16045 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16046 </p>
16047 !! end
16048
16049
16050 !! test
16051 anchorencode
16052 !! wikitext
16053 {{anchorencode:foo bar©#%n}}
16054 !! html
16055 <p>foo_bar.C2.A9.23.25n
16056 </p>
16057 !! end
16058
16059 !! test
16060 anchorencode trims spaces
16061 !! wikitext
16062 {{anchorencode: __pretty__please__}}
16063 !! html
16064 <p>pretty_please
16065 </p>
16066 !! end
16067
16068 !! test
16069 anchorencode deals with links
16070 !! wikitext
16071 {{anchorencode: [[hello|world]] [[hi]]}}
16072 !! html
16073 <p>world_hi
16074 </p>
16075 !! end
16076
16077 !! test
16078 anchorencode deals with templates
16079 !! wikitext
16080 {{anchorencode: {{Foo}} }}
16081 !! html
16082 <p>FOO
16083 </p>
16084 !! end
16085
16086 !! test
16087 anchorencode encodes like the TOC generator: (bug 18431)
16088 !! wikitext
16089 === _ +:.3A%3A&&amp;]] ===
16090 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16091 __NOEDITSECTION__
16092 !! html
16093 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16094 <p>.2B:.3A.253A.26.26.5D.5D
16095 </p>
16096 !! end
16097
16098 !! test
16099 Bug 6200: blockquotes and paragraph formatting
16100 !! wikitext
16101 <blockquote>
16102 foo
16103 </blockquote>
16104
16105 bar
16106
16107 baz
16108 !! html
16109 <blockquote>
16110 <p>foo
16111 </p>
16112 </blockquote>
16113 <p>bar
16114 </p>
16115 <pre>baz
16116 </pre>
16117 !! end
16118
16119 !! test
16120 Bug 8293: Use of center tag ruins paragraph formatting
16121 !! wikitext
16122 <center>
16123 foo
16124 </center>
16125
16126 bar
16127
16128 baz
16129 !! html
16130 <center>
16131 <p>foo
16132 </p>
16133 </center>
16134 <p>bar
16135 </p>
16136 <pre>baz
16137 </pre>
16138 !! end
16139
16140 !!test
16141 Parsing of overlapping (improperly nested) inline html tags
16142 !! wikitext
16143 <span><s>x</span></s>
16144 !! html/php
16145 <p><span><s>x&lt;/span&gt;</s></span>
16146 </p>
16147 !! html/parsoid
16148 <p><span><s>x</s></span>
16149 </p>
16150 !!end
16151
16152 ###
16153 ### Language variants related tests
16154 ###
16155 !! test
16156 Self-link in language variants
16157 !! options
16158 title=[[Dunav]] language=sr
16159 !! wikitext
16160 Both [[Dunav]] and [[Дунав]] are names for this river.
16161 !! html
16162 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16163 </p>
16164 !!end
16165
16166 !! article
16167 Дуна
16168 !! text
16169 content
16170 !! endarticle
16171
16172 !! test
16173 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16174 !! options
16175 title=[[Duna]] language=sr
16176 !! wikitext
16177 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16178 !! html
16179 <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.
16180 </p>
16181 !! end
16182
16183 !! test
16184 Link to a section of a variant of this title shouldn't be parsed as self-link
16185 !! options
16186 title=[[Duna]] language=sr
16187 !! wikitext
16188 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16189 !! html
16190 <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.
16191 </p>
16192 !! end
16193
16194 !! test
16195 Link to pages in language variants
16196 !! options
16197 language=sr
16198 !! wikitext
16199 Main Page can be written as [[Маин Паге]]
16200 !! html
16201 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16202 </p>
16203 !!end
16204
16205
16206 !! test
16207 Multiple links to pages in language variants
16208 !! options
16209 language=sr
16210 !! wikitext
16211 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16212 !! html
16213 <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>.
16214 </p>
16215 !!end
16216
16217
16218 !! test
16219 Simple template in language variants
16220 !! options
16221 language=sr
16222 !! wikitext
16223 {{тест}}
16224 !! html
16225 <p>This is a test template
16226 </p>
16227 !! end
16228
16229
16230 !! test
16231 Template with explicit namespace in language variants
16232 !! options
16233 language=sr
16234 !! wikitext
16235 {{Template:тест}}
16236 !! html
16237 <p>This is a test template
16238 </p>
16239 !! end
16240
16241
16242 !! test
16243 Basic test for template parameter in language variants
16244 !! options
16245 language=sr
16246 !! wikitext
16247 {{парамтест|param=foo}}
16248 !! html
16249 <p>This is a test template with parameter foo
16250 </p>
16251 !! end
16252
16253
16254 !! test
16255 Simple category in language variants
16256 !! options
16257 language=sr cat
16258 !! wikitext
16259 [[Category:МедиаWики Усер'с Гуиде]]
16260 !! html
16261 <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>
16262 !! end
16263
16264
16265 !! article
16266 Category:分类
16267 !! text
16268 blah
16269 !! endarticle
16270
16271 !! article
16272 Category:分類
16273 !! text
16274 blah
16275 !! endarticle
16276
16277 !! test
16278 Don't convert blue categorylinks to another variant (bug 33210)
16279 !! options
16280 language=zh cat
16281 !! wikitext
16282 [[A]][[Category:分类]]
16283 !! html
16284 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16285 !! end
16286
16287
16288 !! test
16289 Stripping -{}- tags (language variants)
16290 !! options
16291 language=sr
16292 !! wikitext
16293 Latin proverb: -{Ne nuntium necare}-
16294 !! html
16295 <p>Latin proverb: Ne nuntium necare
16296 </p>
16297 !! end
16298
16299
16300 !! test
16301 Prevent conversion with -{}- tags (language variants)
16302 !! options
16303 language=sr variant=sr-ec
16304 !! wikitext
16305 Latinski: -{Ne nuntium necare}-
16306 !! html
16307 <p>Латински: Ne nuntium necare
16308 </p>
16309 !! end
16310
16311
16312 !! test
16313 Prevent conversion of text with -{}- tags (language variants)
16314 !! options
16315 language=sr variant=sr-ec
16316 !! wikitext
16317 Latinski: -{Ne nuntium necare}-
16318 !! html
16319 <p>Латински: Ne nuntium necare
16320 </p>
16321 !! end
16322
16323
16324 !! test
16325 Prevent conversion of links with -{}- tags (language variants)
16326 !! options
16327 language=sr variant=sr-ec
16328 !! wikitext
16329 -{[[Main Page]]}-
16330 !! html
16331 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16332 </p>
16333 !! end
16334
16335
16336 !! test
16337 -{}- tags within headlines (within html for parserConvert())
16338 !! options
16339 language=sr variant=sr-ec
16340 !! wikitext
16341 == -{Naslov}- ==
16342 !! html
16343 <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>
16344
16345 !! end
16346
16347
16348 !! test
16349 Explicit definition of language variant alternatives
16350 !! options
16351 language=zh variant=zh-tw
16352 !! wikitext
16353 -{zh:China;zh-tw:Taiwan}-, not China
16354 !! html
16355 <p>Taiwan, not China
16356 </p>
16357 !! end
16358
16359
16360 !! test
16361 Conversion around HTML tags
16362 !! options
16363 language=sr variant=sr-ec
16364 !! wikitext
16365 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16366 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16367 !! html
16368 <p>
16369 <span title="ЛаCтин">ски</span>
16370 </p>
16371 !! end
16372
16373
16374 !! test
16375 Explicit session-wise language variant mapping (A flag and - flag)
16376 !! options
16377 language=zh variant=zh-tw
16378 !! wikitext
16379 Taiwan is not China.
16380 But -{A|zh:China;zh-tw:Taiwan}- is China,
16381 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16382 and -{China}- is China.
16383 !! html
16384 <p>Taiwan is not China.
16385 But Taiwan is Taiwan,
16386 (This should be stripped!)
16387 and China is China.
16388 </p>
16389 !! end
16390
16391 !! test
16392 Explicit session-wise language variant mapping (H flag for hide)
16393 !! options
16394 language=zh variant=zh-tw
16395 !! wikitext
16396 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16397 Taiwan is China.
16398 !! html
16399 <p>(This should be stripped!)
16400 Taiwan is Taiwan.
16401 </p>
16402 !! end
16403
16404 !! test
16405 Adding explicit conversion rule for title (T flag)
16406 !! options
16407 language=zh variant=zh-tw showtitle
16408 !! wikitext
16409 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16410 !! html
16411 Taiwan
16412 <p>Should be stripped!
16413 </p>
16414 !! end
16415
16416 !! test
16417 Testing that changing the language variant here in the tests actually works
16418 !! options
16419 language=zh variant=zh showtitle
16420 !! wikitext
16421 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16422 !! html
16423 China
16424 <p>Should be stripped!
16425 </p>
16426 !! end
16427
16428 !! test
16429 Recursive conversion of alt and title attrs shouldn't clear converter state
16430 !! options
16431 language=zh variant=zh-cn showtitle
16432 !! wikitext
16433 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16434 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16435 !! html
16436 China
16437 <p>
16438 Should be stripped<span title="Exclamation">!</span>
16439 </p>
16440 !! end
16441
16442 !! test
16443 Bug 24072: more test on conversion rule for title
16444 !! options
16445 language=zh variant=zh-tw showtitle
16446 !! wikitext
16447 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16448 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16449 !! html
16450 Taiwan
16451 <p>This should be stripped!
16452 This won't take interferes with the title rule.
16453 </p>
16454 !! end
16455
16456 !! test
16457 Partly disable title conversion if variant == main language code
16458 !! options
16459 language=zh variant=zh title=[[ZH]] showtitle
16460 !! wikitext
16461 -{T|zh-cn:CN;zh-tw:TW}-
16462 !! html
16463 ZH
16464 <p>
16465 </p>
16466 !! end
16467
16468 !! test
16469 Partly disable title conversion if variant == main language code, more
16470 !! options
16471 language=zh variant=zh title=[[ZH]] showtitle
16472 !! wikitext
16473 -{T|TW}-
16474 !! html
16475 ZH
16476 <p>
16477 </p>
16478 !! end
16479
16480 !! test
16481 Raw output of variant escape tags (R flag)
16482 !! options
16483 language=zh variant=zh-tw
16484 !! wikitext
16485 Raw: -{R|zh:China;zh-tw:Taiwan}-
16486 !! html
16487 <p>Raw: zh:China;zh-tw:Taiwan
16488 </p>
16489 !! end
16490
16491 !! test
16492 Nested using of manual convert syntax
16493 !! options
16494 language=zh variant=zh-hk
16495 !! wikitext
16496 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16497 !! html
16498 <p>Nested: Hello Hong Kong!
16499 </p>
16500 !! end
16501
16502 !! test
16503 Proper conversion of text in external links
16504 !! options
16505 language=sr variant=sr-ec
16506 !! wikitext
16507 http://www.google.com
16508 gopher://www.google.com
16509 [http://www.google.com http://www.google.com]
16510 [gopher://www.google.com gopher://www.google.com]
16511 [https://www.google.com irc://www.google.com]
16512 [ftp://www.google.com www.google.com/ftp://dir]
16513 [//www.google.com www.google.com]
16514 !! html
16515 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16516 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16517 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16518 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16519 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16520 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16521 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16522 </p>
16523 !! end
16524
16525 !! test
16526 Do not convert roman numbers to language variants
16527 !! options
16528 language=sr variant=sr-ec
16529 !! wikitext
16530 Fridrih IV je car.
16531 !! html
16532 <p>Фридрих IV је цар.
16533 </p>
16534 !! end
16535
16536 !! test
16537 Unclosed language converter markup "-{"
16538 !! options
16539 language=sr
16540 !! wikitext
16541 -{T|hello
16542 !! html
16543 <p>-{T|hello
16544 </p>
16545 !! end
16546
16547 !! test
16548 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16549 !! options
16550 language=sr
16551 !! wikitext
16552 -{R|=&gt;}-
16553 !! html
16554 <p>=&gt;
16555 </p>
16556 !!end
16557
16558 !! test
16559 Don't break link parsing if language converter markup is in the caption.
16560 !! options
16561 language=sr variant=sr-ec
16562 !! wikitext
16563 [[Main Page|-{R|main page}-]]
16564 !! html
16565 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16566 </p>
16567 !! end
16568
16569 # This test is currently broken in the PHP parser (bug 52661)
16570 !! test
16571 Don't break image parsing if language converter markup is in the caption.
16572 !! options
16573 language=sr
16574 disabled
16575 !! wikitext
16576 [[File:Foobar.jpg|-{R|caption}-]]
16577 !! html
16578 <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>
16579 </p>
16580 !! end
16581
16582 # This test is currently broken in the PHP parser (bug 52661)
16583 !! test
16584 Don't break list handling if language converter markup is in the item.
16585 !! options
16586 language=zh variant=zh-cn
16587 disabled
16588 !! wikitext
16589 ;-{zh-cn:AAA;zh-tw:BBB}-
16590 !! html
16591 <dl><dt>AAA
16592 </dt></dl>
16593
16594 !! end
16595
16596 # This test is currently broken in the PHP parser (bug 52661)
16597 !! test
16598 Don't break table handling if language converter markup is in the cell.
16599 !! options
16600 language=sr variant=sr-ec
16601 disabled
16602 !! wikitext
16603 {|
16604 |-
16605 | -{R|B}-
16606 |}
16607 !! html
16608 <table>
16609
16610 <tr>
16611 <td> B
16612 </td></tr></table>
16613
16614 !! end
16615
16616 !! test
16617 Bug 529: Uncovered bullet
16618 !! wikitext
16619 * Foo {{bullet}}
16620 !! html
16621 <ul>
16622 <li> Foo
16623 </li>
16624 <li> Bar
16625 </li>
16626 </ul>
16627
16628 !! end
16629
16630 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16631 # Templates in Wikipedia rely on this behavior, as tidy has always been
16632 # enabled there. These tests are normally run *without* tidy, so specify the
16633 # full output here.
16634 # To test realistic parsing behavior, apply a tidy-like transformation to both
16635 # the expected output and your parser's output.
16636 !! test
16637 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16638 !! wikitext
16639 ******* Foo {{bullet}}
16640 !! html
16641 <ul>
16642 <li><ul>
16643 <li><ul>
16644 <li><ul>
16645 <li><ul>
16646 <li><ul>
16647 <li><ul>
16648 <li> Foo
16649 </li>
16650 </ul>
16651 </li>
16652 </ul>
16653 </li>
16654 </ul>
16655 </li>
16656 </ul>
16657 </li>
16658 </ul>
16659 </li>
16660 </ul>
16661 </li>
16662 <li> Bar
16663 </li>
16664 </ul>
16665
16666 !! end
16667
16668 !! test
16669 Bug 529: Uncovered table already at line-start
16670 !! wikitext
16671 x
16672
16673 {{table}}
16674 y
16675 !! html
16676 <p>x
16677 </p>
16678 <table>
16679 <tr>
16680 <td> 1 </td>
16681 <td> 2
16682 </td></tr>
16683 <tr>
16684 <td> 3 </td>
16685 <td> 4
16686 </td></tr></table>
16687 <p>y
16688 </p>
16689 !! end
16690
16691 !! test
16692 Bug 529: Uncovered bullet in parser function result
16693 !! wikitext
16694 * Foo {{lc:{{bullet}} }}
16695 !! html
16696 <ul>
16697 <li> Foo
16698 </li>
16699 <li> bar
16700 </li>
16701 </ul>
16702
16703 !! end
16704
16705 !! test
16706 Bug 5678: Double-parsed template argument
16707 !! wikitext
16708 {{lc:{{{1}}}|hello}}
16709 !! html
16710 <p>{{{1}}}
16711 </p>
16712 !! end
16713
16714 !! test
16715 Bug 5678: Double-parsed template invocation
16716 !! wikitext
16717 {{lc:{{paramtest {{!}} param = hello }} }}
16718 !! html
16719 <p>{{paramtest | param = hello }}
16720 </p>
16721 !! end
16722
16723 !! test
16724 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16725 !! options
16726 language=cs
16727 title=[[Main Page]]
16728 !! wikitext
16729 {{PRVNÍVELKÉ:ěščř}}
16730 {{prvnívelké:ěščř}}
16731 {{PRVNÍMALÉ:ěščř}}
16732 {{prvnímalé:ěščř}}
16733 {{MALÁ:ěščř}}
16734 {{malá:ěščř}}
16735 {{VELKÁ:ěščř}}
16736 {{velká:ěščř}}
16737 !! html
16738 <p>Ěščř
16739 Ěščř
16740 ěščř
16741 ěščř
16742 ěščř
16743 ěščř
16744 ĚŠČŘ
16745 ĚŠČŘ
16746 </p>
16747 !! end
16748
16749 !! test
16750 Morwen/13: Unclosed link followed by heading
16751 !! wikitext
16752 [[link
16753 ==heading==
16754 !! html
16755 <p>[[link
16756 </p>
16757 <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>
16758
16759 !! end
16760
16761 !! test
16762 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16763 !! wikitext
16764 {{foo|
16765 =heading=
16766 !! html
16767 <p>{{foo|
16768 </p>
16769 <h1><span class="mw-headline" id="heading">heading</span></h1>
16770
16771 !! end
16772
16773 !! test
16774 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16775 !! wikitext
16776 {{foo|
16777 ==heading==
16778 !! html
16779 <p>{{foo|
16780 </p>
16781 <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>
16782
16783 !! end
16784
16785 !! test
16786 Tildes in comments
16787 !! options
16788 pst
16789 !! wikitext
16790 <!-- ~~~~ -->
16791 !! html
16792 <!-- ~~~~ -->
16793 !! end
16794
16795 !! test
16796 Paragraphs inside divs (no extra line breaks)
16797 !! wikitext
16798 <div>Line one
16799
16800 Line two</div>
16801 !! html
16802 <div>Line one
16803 Line two</div>
16804
16805 !! end
16806
16807 !! test
16808 Paragraphs inside divs (extra line break on open)
16809 !! wikitext
16810 <div>
16811 Line one
16812
16813 Line two</div>
16814 !! html
16815 <div>
16816 <p>Line one
16817 </p>
16818 Line two</div>
16819
16820 !! end
16821
16822 !! test
16823 Paragraphs inside divs (extra line break on close)
16824 !! wikitext
16825 <div>Line one
16826
16827 Line two
16828 </div>
16829 !! html
16830 <div>Line one
16831 <p>Line two
16832 </p>
16833 </div>
16834
16835 !! end
16836
16837 !! test
16838 Paragraphs inside divs (extra line break on open and close)
16839 !! wikitext
16840 <div>
16841 Line one
16842
16843 Line two
16844 </div>
16845 !! html
16846 <div>
16847 <p>Line one
16848 </p><p>Line two
16849 </p>
16850 </div>
16851
16852 !! end
16853
16854 !! test
16855 Nesting tags, paragraphs on lines which begin with <div>
16856 !! options
16857 disabled
16858 !! wikitext
16859 <div></div><strong>A
16860 B</strong>
16861 !! html
16862 <div></div>
16863 <p><strong>A
16864 B</strong>
16865 </p>
16866 !! end
16867
16868 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16869 !! test
16870 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16871 !! wikitext
16872 <blockquote>Line one
16873
16874 Line two</blockquote>
16875 !! html
16876 <blockquote>Line one
16877 Line two</blockquote>
16878
16879 !! end
16880
16881 !! test
16882 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16883 !! wikitext
16884 <blockquote>
16885 Line one
16886
16887 Line two</blockquote>
16888 !! html
16889 <blockquote>
16890 <p>Line one
16891 </p>
16892 Line two</blockquote>
16893
16894 !! end
16895
16896 !! test
16897 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16898 !! wikitext
16899 <blockquote>Line one
16900
16901 Line two
16902 </blockquote>
16903 !! html
16904 <blockquote>Line one
16905 <p>Line two
16906 </p>
16907 </blockquote>
16908
16909 !! end
16910
16911 !! test
16912 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16913 !! wikitext
16914 <blockquote>
16915 Line one
16916
16917 Line two
16918 </blockquote>
16919 !! html
16920 <blockquote>
16921 <p>Line one
16922 </p><p>Line two
16923 </p>
16924 </blockquote>
16925
16926 !! end
16927
16928 !! test
16929 Paragraphs inside blockquotes/divs (no extra line breaks)
16930 !! wikitext
16931 <blockquote><div>Line one
16932
16933 Line two</div></blockquote>
16934 !! html
16935 <blockquote><div>Line one
16936 Line two</div></blockquote>
16937
16938 !! end
16939
16940 !! test
16941 Paragraphs inside blockquotes/divs (extra line break on open)
16942 !! wikitext
16943 <blockquote><div>
16944 Line one
16945
16946 Line two</div></blockquote>
16947 !! html
16948 <blockquote><div>
16949 <p>Line one
16950 </p>
16951 Line two</div></blockquote>
16952
16953 !! end
16954
16955 !! test
16956 Paragraphs inside blockquotes/divs (extra line break on close)
16957 !! wikitext
16958 <blockquote><div>Line one
16959
16960 Line two
16961 </div></blockquote>
16962 !! html
16963 <blockquote><div>Line one
16964 <p>Line two
16965 </p>
16966 </div></blockquote>
16967
16968 !! end
16969
16970 !! test
16971 Paragraphs inside blockquotes/divs (extra line break on open and close)
16972 !! wikitext
16973 <blockquote><div>
16974 Line one
16975
16976 Line two
16977 </div></blockquote>
16978 !! html
16979 <blockquote><div>
16980 <p>Line one
16981 </p><p>Line two
16982 </p>
16983 </div></blockquote>
16984
16985 !! end
16986
16987 !! test
16988 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16989 !! options
16990 wgLinkHolderBatchSize=0
16991 !! wikitext
16992 [[meatball:1]]
16993 [[meatball:2]]
16994 [[meatball:3]]
16995 !! html
16996 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16997 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16998 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16999 </p>
17000 !! end
17001
17002 !! test
17003 Free external link invading image caption
17004 !! wikitext
17005 [[Image:Foobar.jpg|thumb|http://x|hello]]
17006 !! html
17007 <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>
17008
17009 !! end
17010
17011 !! test
17012 Bug 15196: localised external link numbers
17013 !! options
17014 language=fa
17015 !! wikitext
17016 [http://en.wikipedia.org/]
17017 !! html/php
17018 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17019 </p>
17020 !! html/parsoid
17021 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17022 !! end
17023
17024 !! test
17025 Multibyte character in padleft
17026 !! wikitext
17027 {{padleft:-Hello|7|Æ}}
17028 !! html
17029 <p>Æ-Hello
17030 </p>
17031 !! end
17032
17033 !! test
17034 Multibyte character in padright
17035 !! wikitext
17036 {{padright:Hello-|7|Æ}}
17037 !! html
17038 <p>Hello-Æ
17039 </p>
17040 !! end
17041
17042 !!test
17043 formatdate parser function
17044 !! wikitext
17045 {{#formatdate:2009-03-24}}
17046 !! html
17047 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17048 </p>
17049 !! end
17050
17051 !!test
17052 formatdate parser function, with default format
17053 !! wikitext
17054 {{#formatdate:2009-03-24|mdy}}
17055 !! html
17056 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17057 </p>
17058 !! end
17059
17060 !! test
17061 Spacing of numbers in formatted dates
17062 !! wikitext
17063 {{#formatdate:January 15}}
17064 !! html
17065 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17066 </p>
17067 !! end
17068
17069 !! test
17070 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
17071 !! options
17072 language=nl title=[[MediaWiki:Common.css]]
17073 !! wikitext
17074 {{#formatdate:2009-03-24|dmy}}
17075 !! html
17076 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17077 </p>
17078 !! end
17079
17080 #
17081 #
17082 #
17083
17084 #
17085 # Edit comments
17086 #
17087
17088 !! test
17089 Edit comment with link
17090 !! options
17091 comment
17092 !! wikitext
17093 I like the [[Main Page]] a lot
17094 !! html
17095 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17096 !!end
17097
17098 !! test
17099 Edit comment with link and link text
17100 !! options
17101 comment
17102 !! wikitext
17103 I like the [[Main Page|best pages]] a lot
17104 !! html
17105 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17106 !!end
17107
17108 !! test
17109 Edit comment with link and link text with suffix
17110 !! options
17111 comment
17112 !! wikitext
17113 I like the [[Main Page|best page]]s a lot
17114 !! html
17115 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17116 !!end
17117
17118 !! test
17119 Edit comment with section link (non-local, eg in history list)
17120 !! options
17121 comment title=[[Main Page]]
17122 !! wikitext
17123 /* External links */ removed bogus entries
17124 !! html
17125 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17126 !!end
17127
17128 !! test
17129 Edit comment with section link and text before it (non-local, eg in history list)
17130 !! options
17131 comment title=[[Main Page]]
17132 !! wikitext
17133 pre-comment text /* External links */ removed bogus entries
17134 !! html
17135 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>
17136 !!end
17137
17138 !! test
17139 Edit comment with section link (local, eg in diff view)
17140 !! options
17141 comment local title=[[Main Page]]
17142 !! wikitext
17143 /* External links */ removed bogus entries
17144 !! html
17145 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17146 !!end
17147
17148 !! test
17149 Edit comment with subpage link (bug 14080)
17150 !! options
17151 comment
17152 subpage
17153 title=[[Subpage test]]
17154 !! wikitext
17155 Poked at a [[/subpage]] here...
17156 !! html
17157 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17158 !!end
17159
17160 !! test
17161 Edit comment with subpage link and link text (bug 14080)
17162 !! options
17163 comment
17164 subpage
17165 title=[[Subpage test]]
17166 !! wikitext
17167 Poked at a [[/subpage|neat little page]] here...
17168 !! html
17169 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17170 !!end
17171
17172 !! test
17173 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17174 !! options
17175 comment
17176 title=[[Subpage test]]
17177 !! wikitext
17178 Poked at a [[/subpage]] here...
17179 !! html
17180 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...
17181 !!end
17182
17183 !! test
17184 Edit comment with bare anchor link (local, as on diff)
17185 !! options
17186 comment
17187 local
17188 title=[[Main Page]]
17189 !! wikitext
17190 [[#section]]
17191 !! html
17192 <a href="#section">#section</a>
17193 !! end
17194
17195 !! test
17196 Edit comment with bare anchor link (non-local, as on history)
17197 !! options
17198 comment
17199 title=[[Main Page]]
17200 !! wikitext
17201 [[#section]]
17202 !! html
17203 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17204 !! end
17205
17206 !! test
17207 Anchor starting with underscore
17208 !! wikitext
17209 [[#_ref|One]]
17210 !! html
17211 <p><a href="#_ref">One</a>
17212 </p>
17213 !! end
17214
17215 !! test
17216 Id starting with underscore
17217 !! wikitext
17218 <div id="_ref"></div>
17219 !! html
17220 <div id="_ref"></div>
17221
17222 !! end
17223
17224 !! test
17225 Space normalisation on autocomment (bug 22784)
17226 !! options
17227 comment
17228 title=[[Main Page]]
17229 !! wikitext
17230 /* __hello__world__ */
17231 !! html
17232 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17233 !! end
17234
17235 !! test
17236 percent-encoding and + signs in comments (Bug 26410)
17237 !! options
17238 comment
17239 !! wikitext
17240 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17241 !! html
17242 <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>
17243 !! end
17244
17245 !! test
17246 Bad images - basic functionality
17247 !! options
17248 disabled
17249 !! wikitext
17250 [[File:Bad.jpg]]
17251 !! html
17252 !! end
17253
17254 !! test
17255 Bad images - bug 16039: text after bad image disappears
17256 !! options
17257 disabled
17258 !! wikitext
17259 Foo bar
17260 [[File:Bad.jpg]]
17261 Bar foo
17262 !! html
17263 <p>Foo bar
17264 </p><p>Bar foo
17265 </p>
17266 !! end
17267
17268 !! test
17269 Verify that displaytitle works (bug #22501) no displaytitle
17270 !! options
17271 showtitle
17272 !! config
17273 wgAllowDisplayTitle=true
17274 wgRestrictDisplayTitle=false
17275 !! wikitext
17276 this is not the the title
17277 !! html
17278 Parser test
17279 <p>this is not the the title
17280 </p>
17281 !! end
17282
17283 !! test
17284 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17285 !! options
17286 showtitle
17287 title=[[Screen]]
17288 !! config
17289 wgAllowDisplayTitle=true
17290 wgRestrictDisplayTitle=false
17291 !! wikitext
17292 this is not the the title
17293 {{DISPLAYTITLE:whatever}}
17294 !! html
17295 whatever
17296 <p>this is not the the title
17297 </p>
17298 !! end
17299
17300 !! test
17301 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17302 !! options
17303 showtitle
17304 title=[[Screen]]
17305 !! config
17306 wgAllowDisplayTitle=true
17307 wgRestrictDisplayTitle=true
17308 !! wikitext
17309 this is not the the title
17310 {{DISPLAYTITLE:whatever}}
17311 !! html
17312 Screen
17313 <p>this is not the the title
17314 </p>
17315 !! end
17316
17317 !! test
17318 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17319 !! options
17320 showtitle
17321 title=[[Screen]]
17322 !! config
17323 wgAllowDisplayTitle=true
17324 wgRestrictDisplayTitle=true
17325 !! wikitext
17326 this is not the the title
17327 {{DISPLAYTITLE:screen}}
17328 !! html
17329 screen
17330 <p>this is not the the title
17331 </p>
17332 !! end
17333
17334 !! test
17335 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17336 !! options
17337 showtitle
17338 title=[[Screen]]
17339 !! config
17340 wgAllowDisplayTitle=false
17341 !! wikitext
17342 this is not the the title
17343 {{DISPLAYTITLE:screen}}
17344 !! html
17345 Screen
17346 <p>this is not the the title
17347 <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>
17348 </p>
17349 !! end
17350
17351 !! test
17352 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17353 !! options
17354 showtitle
17355 title=[[Screen]]
17356 !! config
17357 wgAllowDisplayTitle=false
17358 !! wikitext
17359 this is not the the title
17360 !! html
17361 Screen
17362 <p>this is not the the title
17363 </p>
17364 !! end
17365
17366 !! test
17367 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17368 !! options
17369 showtitle
17370 title=[[Screen]]
17371 !! config
17372 wgAllowDisplayTitle=true
17373 wgRestrictDisplayTitle=true
17374 !! wikitext
17375 this is not the the title
17376 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17377 !! html
17378 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17379 <p>this is not the the title
17380 </p>
17381 !! end
17382
17383 !! test
17384 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17385 !! options
17386 showtitle
17387 title=[[Screen]]
17388 !! config
17389 wgAllowDisplayTitle=true
17390 wgRestrictDisplayTitle=true
17391 !! wikitext
17392 this is not the the title
17393 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17394 !! html
17395 <span style="color: red;">s</span>creen
17396 <p>this is not the the title
17397 </p>
17398 !! end
17399
17400 !! test
17401 preload: check <noinclude> and <includeonly>
17402 !! options
17403 preload
17404 !! wikitext
17405 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17406 !! html
17407 Hello kind world.
17408 !! end
17409
17410 !! test
17411 preload: check <onlyinclude>
17412 !! options
17413 preload
17414 !! wikitext
17415 Goodbye <onlyinclude>Hello world</onlyinclude>
17416 !! html
17417 Hello world
17418 !! end
17419
17420 !! test
17421 preload: can pass tags through if we want to
17422 !! options
17423 preload
17424 !! wikitext
17425 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17426 !! html
17427 <includeonly>Hello world</includeonly>
17428 !! end
17429
17430 !! test
17431 preload: check that it doesn't try to do tricks
17432 !! options
17433 preload
17434 !! wikitext
17435 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17436 !! html
17437 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17438 !! end
17439
17440 !! test
17441 Play a bit with r67090 and bug 3158
17442 !! options
17443 disabled
17444 !! wikitext
17445 <div style="width:50% !important">&nbsp;</div>
17446 <div style="width:50%&nbsp;!important">&nbsp;</div>
17447 <div style="width:50%&#160;!important">&nbsp;</div>
17448 <div style="border : solid;">&nbsp;</div>
17449 !! html
17450 <div style="width:50% !important">&nbsp;</div>
17451 <div style="width:50% !important">&nbsp;</div>
17452 <div style="width:50% !important">&nbsp;</div>
17453 <div style="border&#160;: solid;">&nbsp;</div>
17454
17455 !! end
17456
17457 !! test
17458 HTML5 data attributes
17459 !! wikitext
17460 <span data-foo="bar">Baz</span>
17461 <p data-abc-def_hij="">Quuz</p>
17462 !! html
17463 <p><span data-foo="bar">Baz</span>
17464 </p>
17465 <p data-abc-def_hij="">Quuz</p>
17466
17467 !! end
17468
17469 !! test
17470 percent-encoding and + signs in internal links (Bug 26410)
17471 !! wikitext
17472 [[User:+%]] [[Page+title%]]
17473 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17474 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17475 [[%33%45]] [[%33%45+]]
17476 !! html
17477 <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>
17478 <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>
17479 <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>
17480 <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>
17481 </p>
17482 !! end
17483
17484 !! test
17485 Special characters in embedded file links (bug 27679)
17486 !! wikitext
17487 [[File:Contains & ampersand.jpg]]
17488 [[File:Does not exist.jpg|Title with & ampersand]]
17489 !! html
17490 <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>
17491 <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>
17492 </p>
17493 !! end
17494
17495
17496 !! test
17497 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17498 !! wikitext
17499 Text&apos;s been normalized?
17500 !! html
17501 <p>Text&#39;s been normalized?
17502 </p>
17503 !! end
17504
17505 !! test
17506 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17507 !! wikitext
17508 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17509 !! html
17510 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17511 </p>
17512 !! end
17513
17514 !! test
17515 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17516 !! wikitext
17517 [http://www.example.org/ ideograms]
17518 !! html
17519 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17520 </p>
17521 !! end
17522
17523 !! test
17524 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17525 !! wikitext
17526 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17527 !! html
17528 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17529 </p>
17530 !! end
17531
17532 !! article
17533 Mediawiki:loop1
17534 !! text
17535 {{Identical|A}}
17536 !! endarticle
17537
17538 !! article
17539 Mediawiki:loop2
17540 !! text
17541 {{Identical|B}}
17542 !! endarticle
17543
17544 !! article
17545 Template:Identical
17546 !! text
17547 {{int:loop1}}
17548 {{int:loop2}}
17549 !! endarticle
17550
17551 !! test
17552 Bug 31098 Template which includes system messages which includes the template
17553 !! wikitext
17554 {{Identical}}
17555 !! html
17556 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17557 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17558 </p>
17559 !! end
17560
17561 !! test
17562 Bug31490 Turkish: ucfirst 'blah'
17563 !! options
17564 language=tr
17565 !! wikitext
17566 {{ucfirst:blah}}
17567 !! html
17568 <p>Blah
17569 </p>
17570 !! end
17571
17572 !! test
17573 Bug31490 Turkish: ucfirst 'ix'
17574 !! options
17575 language=tr
17576 !! wikitext
17577 {{ucfirst:ix}}
17578 !! html
17579 <p>İx
17580 </p>
17581 !! end
17582
17583 !! test
17584 Bug31490 Turkish: lcfirst 'BLAH'
17585 !! options
17586 language=tr
17587 !! wikitext
17588 {{lcfirst:BLAH}}
17589 !! html
17590 <p>bLAH
17591 </p>
17592 !! end
17593
17594 !! test
17595 Bug31490 Turkish: ucfırst (with a dotless i)
17596 !! options
17597 language=tr
17598 !! wikitext
17599 {{ucfırst:blah}}
17600 !! html
17601 <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>
17602 </p>
17603 !! end
17604
17605 !! test
17606 Bug31490 ucfırst (with a dotless i) with English language
17607 !! options
17608 language=en
17609 !! wikitext
17610 {{ucfırst:blah}}
17611 !! html
17612 <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>
17613 </p>
17614 !! end
17615
17616 !! test
17617 Bug 26375: TOC with italics
17618 !! options
17619 title=[[Main Page]]
17620 !! wikitext
17621 __TOC__
17622 == ''Lost'' episodes ==
17623 !! html
17624 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17625 <ul>
17626 <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>
17627 </ul>
17628 </div>
17629
17630 <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>
17631
17632 !! end
17633
17634 !! test
17635 Bug 26375: TOC with bold
17636 !! options
17637 title=[[Main Page]]
17638 !! wikitext
17639 __TOC__
17640 == '''should be bold''' then normal text ==
17641 !! html
17642 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17643 <ul>
17644 <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>
17645 </ul>
17646 </div>
17647
17648 <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>
17649
17650 !! end
17651
17652 !! test
17653 Bug 33845: Headings become cursive in TOC when they contain an image
17654 !! options
17655 title=[[Main Page]]
17656 !! wikitext
17657 __TOC__
17658 == Image [[Image:foobar.jpg]] ==
17659 !! html
17660 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17661 <ul>
17662 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17663 </ul>
17664 </div>
17665
17666 <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>
17667
17668 !! end
17669
17670 !! test
17671 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17672 !! options
17673 title=[[Main Page]]
17674 !! wikitext
17675 __TOC__
17676 == <blockquote>Quote</blockquote> ==
17677 !! html
17678 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17679 <ul>
17680 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17681 </ul>
17682 </div>
17683
17684 <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>
17685
17686 !! end
17687
17688 !! test
17689 Unclosed tags in TOC
17690 !! options
17691 title=[[Main Page]]
17692 !! wikitext
17693 __TOC__
17694 == Proof: 2 < 3 ==
17695 <small>Hanc marginis exiguitas non caperet.</small>
17696 QED
17697 !! html
17698 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17699 <ul>
17700 <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>
17701 </ul>
17702 </div>
17703
17704 <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>
17705 <p><small>Hanc marginis exiguitas non caperet.</small>
17706 QED
17707 </p>
17708 !! end
17709
17710 !! test
17711 Multiple tags in TOC
17712 !! wikitext
17713 __TOC__
17714 == <i>Foo</i> <b>Bar</b> ==
17715
17716 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17717 !! html
17718 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17719 <ul>
17720 <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>
17721 <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>
17722 </ul>
17723 </div>
17724
17725 <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>
17726 <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>
17727
17728 !! end
17729
17730 !! test
17731 Tags with parameters in TOC
17732 !! wikitext
17733 __TOC__
17734 == <sup class="in-h2">Hello</sup> ==
17735
17736 == <sup class="a > b">Evilbye</sup> ==
17737 !! html
17738 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17739 <ul>
17740 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17741 <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>
17742 </ul>
17743 </div>
17744
17745 <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>
17746 <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>
17747
17748 !! end
17749
17750 !! test
17751 span tags with directionality in TOC
17752 !! wikitext
17753 __TOC__
17754 == <span dir="ltr">C++</span> ==
17755
17756 == <span dir="rtl">זבנג!</span> ==
17757
17758 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17759
17760 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17761
17762 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17763 !! html
17764 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17765 <ul>
17766 <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>
17767 <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>
17768 <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>
17769 <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>
17770 <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>
17771 </ul>
17772 </div>
17773
17774 <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>
17775 <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>
17776 <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>
17777 <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>
17778 <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>
17779
17780 !! end
17781
17782 !! article
17783 MediaWiki:Bug32057
17784 !! text
17785 == {{int:headline_sample}} ==
17786 !! endarticle
17787
17788 !! test
17789 Bug 32057: Title needed when expanding <h> nodes.
17790 !! options
17791 title=[[Main Page]]
17792 !! wikitext
17793 {{int:Bug32057}}
17794 !! html
17795 <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>
17796
17797 !! end
17798
17799 !! test
17800 Strip marker in urlencode
17801 !! wikitext
17802 {{urlencode:x<nowiki/>y}}
17803 {{urlencode:x<nowiki/>y|wiki}}
17804 {{urlencode:x<nowiki/>y|path}}
17805 !! html
17806 <p>xy
17807 xy
17808 xy
17809 </p>
17810 !! end
17811
17812 !! test
17813 Strip marker in lc
17814 !! wikitext
17815 {{lc:x<nowiki/>y}}
17816 !! html
17817 <p>xy
17818 </p>
17819 !! end
17820
17821 !! test
17822 Strip marker in uc
17823 !! wikitext
17824 {{uc:x<nowiki/>y}}
17825 !! html
17826 <p>XY
17827 </p>
17828 !! end
17829
17830 !! test
17831 Strip marker in formatNum
17832 !! wikitext
17833 {{formatnum:1<nowiki/>2}}
17834 {{formatnum:1<nowiki/>2|R}}
17835 !! html
17836 <p>12
17837 12
17838 </p>
17839 !! end
17840
17841 !! test
17842 Check noCommafy in formatNum
17843 !! options
17844 language=be-tarask
17845 !! wikitext
17846 {{formatnum:123456.78}}
17847 {{formatnum:123456.78|NOSEP}}
17848 !! html
17849 <p>123 456,78
17850 123456.78
17851 </p>
17852 !! end
17853
17854 !! test
17855 Wrong option for formatNum (bug 56199)
17856 !! wikitext
17857 {{formatnum:1,234.56|Random}}
17858 {{formatnum:1,234.56|EVERYTHING}}
17859 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17860 !! html
17861 <p>1,234.56
17862 1,234.56
17863 1,234.56
17864 </p>
17865 !! end
17866
17867 !! test
17868 Strip marker in grammar
17869 !! options
17870 language=fi
17871 !! wikitext
17872 {{grammar:elative|foo<nowiki/>bar}}
17873 !! html
17874 <p>foobarista
17875 </p>
17876 !! end
17877
17878 !! test
17879 Strip marker in padleft
17880 !! wikitext
17881 {{padleft:|2|x<nowiki/>y}}
17882 !! html
17883 <p>xy
17884 </p>
17885 !! end
17886
17887 !! test
17888 Strip marker in padright
17889 !! wikitext
17890 {{padright:|2|x<nowiki/>y}}
17891 !! html
17892 <p>xy
17893 </p>
17894 !! end
17895
17896 !! test
17897 Strip marker in anchorencode
17898 !! wikitext
17899 {{anchorencode:x<nowiki/>y}}
17900 !! html
17901 <p>xy
17902 </p>
17903 !! end
17904
17905 !! test
17906 nowiki inside link inside heading (bug 18295)
17907 !! wikitext
17908 ==[[foo|x<nowiki>y</nowiki>z]]==
17909 !! html
17910 <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>
17911
17912 !! end
17913
17914 !! test
17915 new support for bdi element (bug 31817)
17916 !! wikitext
17917 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17918 !! html
17919 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17920
17921 !!end
17922
17923 !! test
17924 Ignore pipe between table row attributes
17925 !! wikitext
17926 {|
17927 | quux
17928 |- id=foo | style='color: red'
17929 | bar
17930 |}
17931 !! html
17932 <table>
17933 <tr>
17934 <td> quux
17935 </td></tr>
17936 <tr id="foo" style="color: red">
17937 <td> bar
17938 </td></tr></table>
17939
17940 !! end
17941
17942 !!test
17943 Gallery override link with WikiLink (bug 34852)
17944 !! wikitext
17945 <gallery>
17946 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17947 </gallery>
17948 !! html
17949 <ul class="gallery mw-gallery-traditional">
17950 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17951 <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>
17952 <div class="gallerytext">
17953 <p>caption
17954 </p>
17955 </div>
17956 </div></li>
17957 </ul>
17958
17959 !! end
17960
17961 !!test
17962 Gallery override link with absolute external link (bug 34852)
17963 !! wikitext
17964 <gallery>
17965 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17966 </gallery>
17967 !! html
17968 <ul class="gallery mw-gallery-traditional">
17969 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17970 <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>
17971 <div class="gallerytext">
17972 <p>caption
17973 </p>
17974 </div>
17975 </div></li>
17976 </ul>
17977
17978 !! end
17979
17980 !!test
17981 Gallery override link with malicious javascript (bug 34852)
17982 !! wikitext
17983 <gallery>
17984 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17985 </gallery>
17986 !! html
17987 <ul class="gallery mw-gallery-traditional">
17988 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17989 <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>
17990 <div class="gallerytext">
17991 <p>caption
17992 </p>
17993 </div>
17994 </div></li>
17995 </ul>
17996
17997 !! end
17998
17999 !!test
18000 Gallery with invalid title as link (bug 43964)
18001 !! wikitext
18002 <gallery>
18003 File:foobar.jpg|link=<
18004 </gallery>
18005 !! html
18006 <ul class="gallery mw-gallery-traditional">
18007 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18008 <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>
18009 <div class="gallerytext">
18010 </div>
18011 </div></li>
18012 </ul>
18013
18014 !! end
18015
18016 !!test
18017 Language parser function
18018 !! wikitext
18019 {{#language:ar}}
18020 !! html
18021 <p>العربية
18022 </p>
18023 !! end
18024
18025 !!test
18026 Padleft and padright as substr
18027 !! wikitext
18028 {{padleft:|3|abcde}}
18029 {{padright:|3|abcde}}
18030 !! html
18031 <p>abc
18032 abc
18033 </p>
18034 !! end
18035
18036 !!test
18037 Special parser function
18038 !! wikitext
18039 {{#special:RandomPage}}
18040 {{#special:BaDtItLe}}
18041 {{#special:Foobar}}
18042 !! html
18043 <p>Special:Random
18044 Special:Badtitle
18045 Special:Foobar
18046 </p>
18047 !! end
18048
18049 !!test
18050 Bug 34939 - Case insensitive link parsing ([HttP://])
18051 !! wikitext
18052 [HttP://MediaWiki.Org/]
18053 !! html/php
18054 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18055 </p>
18056 !! html/parsoid
18057 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18058 !! end
18059
18060 !!test
18061 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18062 !! wikitext
18063 [HttP://MediaWiki.Org/ MediaWiki]
18064 !! html
18065 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18066 </p>
18067 !! end
18068
18069 !!test
18070 Bug 34939 - Case insensitive link parsing (HttP://)
18071 !! wikitext
18072 HttP://MediaWiki.Org/
18073 !! html/php
18074 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18075 </p>
18076 !! html/parsoid
18077 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18078 !! end
18079
18080 !!test
18081 Disable TOC
18082 !! options
18083 notoc
18084 !! wikitext
18085 Lead
18086 == Section 1 ==
18087 == Section 2 ==
18088 == Section 3 ==
18089 == Section 4 ==
18090 == Section 5 ==
18091 !! html
18092 <p>Lead
18093 </p>
18094
18095 <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>
18096 <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>
18097 <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>
18098 <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>
18099 <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>
18100
18101 !! end
18102
18103
18104 ###
18105 ### Parsoids-specific tests
18106 ### Parsoid-PHP parser incompatibilities
18107 ###
18108 !!test
18109 1. SOL-sensitive wikitext tokens as template-args
18110 !!options
18111 parsoid=wt2html,wt2wt
18112 !! wikitext
18113 {{echo|*a}}
18114 {{echo|#a}}
18115 {{echo|:a}}
18116 !! html
18117 <span about="#mwt1" typeof="mw:Transclusion">
18118 </span><ul about="#mwt1"><li>a</li>
18119 </ul>
18120 <span about="#mwt2" typeof="mw:Transclusion">
18121 </span><ol about="#mwt2"><li>a</li>
18122 </ol>
18123 <span about="#mwt3" typeof="mw:Transclusion">
18124 </span><dl about="#mwt3"><dd>a</dd>
18125 </dl>
18126 !!end
18127
18128 #### ----------------------------------------------------------------
18129 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18130 #### tags. Parsoid's output for these tags differs from that of the
18131 #### PHP parser.
18132 #### ----------------------------------------------------------------
18133
18134 !!test
18135 Ref: 1. ref-location should be replaced with an index span
18136 !!options
18137 parsoid
18138 !! wikitext
18139 A <ref>foo</ref>
18140 B <ref name="x">foo</ref>
18141 C <ref name="y" />
18142 !! html
18143 <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>
18144 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>
18145 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>
18146 !!end
18147
18148 !!test
18149 Ref: 2. ref-tags with identical names should all get the same index
18150 !!options
18151 parsoid
18152 !! wikitext
18153 A <ref name="x">foo</ref>
18154 B <ref name="x" />
18155 !! html
18156 <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>
18157 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>
18158 !!end
18159
18160 !!test
18161 Ref: 3. spaces in ref-names should be ignored
18162 !!options
18163 parsoid
18164 !! wikitext
18165 A <ref name="x">foo</ref>
18166 B <ref name=" x " />
18167 C <ref name= x />
18168 !! html
18169 <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>
18170 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>
18171 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>
18172 !!end
18173
18174 !!test
18175 Ref: 4. 'constructor' should be accepted as a valid ref-name
18176 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18177 !!options
18178 parsoid
18179 !! wikitext
18180 A <ref name="constructor">foo</ref>
18181 !! html
18182 <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>
18183 !!end
18184
18185 !!test
18186 Ref: 5. body should accept generic wikitext
18187 !!options
18188 parsoid
18189 !! wikitext
18190 A <ref>
18191 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18192 </ref>
18193
18194 <references />
18195 !! html
18196 <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>
18197
18198 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18199 <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>
18200 </li>
18201 </ol>
18202 !!end
18203
18204 !!test
18205 Ref: 6. indent-pres should not be output in ref-body
18206 !!options
18207 parsoid
18208 !! wikitext
18209 A <ref>
18210 foo
18211 bar
18212 baz
18213 </ref>
18214
18215 <references />
18216 !! html
18217 <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>
18218
18219 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18220 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18221 bar
18222 baz
18223 </li>
18224 </ol>
18225 !!end
18226
18227 !!test
18228 Ref: 7. No p-wrapping in ref-body
18229 !!options
18230 parsoid
18231 !! wikitext
18232 A <ref>
18233 foo
18234
18235 bar
18236
18237
18238 baz
18239
18240
18241
18242 booz
18243 </ref>
18244
18245 <references />
18246 !! html
18247 <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>
18248
18249 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18250 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18251
18252 bar
18253
18254
18255 baz
18256
18257
18258
18259 booz
18260 </li>
18261 </ol>
18262 !!end
18263
18264 !!test
18265 Ref: 8. transclusion wikitext has lower precedence
18266 !!options
18267 parsoid
18268 !! wikitext
18269 A <ref> foo {{echo|</ref> B C}}
18270
18271 <references />
18272 !! html
18273 <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>
18274 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18275 <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>
18276 </ol>
18277 !!end
18278
18279 !!test
18280 Ref: 9. unclosed comments should not leak out of ref-body
18281 !!options
18282 parsoid
18283 !! wikitext
18284 A <ref> foo <!--</ref> B C
18285 <references />
18286 !! html
18287 <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>
18288 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18289 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18290 </ol>
18291 !!end
18292
18293 !!test
18294 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18295 !!options
18296 parsoid
18297 !! wikitext
18298 A <ref> <b> foo </ref> B C
18299
18300 <references />
18301 !! html
18302 <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>
18303
18304
18305 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18306 <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>
18307 </ol>
18308 !!end
18309
18310 !!test
18311 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18312 !!options
18313 parsoid
18314 !! wikitext
18315 A <ref>foo</ref> B
18316 C <ref>bar</ref> D
18317 !! html
18318 <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
18319 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>
18320 !!end
18321
18322 !!test
18323 Ref: 12. ref-tags act as trailing newline migration barrier
18324 !!options
18325 parsoid
18326 !! wikitext
18327 <!--the newline at the end of this line moves out of the p-tag-->a
18328
18329 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18330 <ref />
18331
18332 c
18333 !! html
18334 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18335
18336
18337 <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>
18338 <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>
18339
18340
18341 <p>c</p>
18342 !!end
18343
18344 !!test
18345 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18346 !!options
18347 parsoid
18348 !! wikitext
18349 <ref>foo</ref> A
18350 <ref>bar
18351 </ref> B
18352 !! html
18353 <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
18354 <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>
18355 !!end
18356
18357 !!test
18358 Ref: 14. A nested ref-tag should be emitted as plain text
18359 !!options
18360 parsoid
18361 !! wikitext
18362 <ref>foo <ref>bar</ref> baz</ref>
18363
18364 <references />
18365 !! html
18366 <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>
18367
18368 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18369 <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>
18370 </ol>
18371 !!end
18372
18373 !!test
18374 Ref: 15. ref-tags with identical names should get identical indexes
18375 !!options
18376 parsoid
18377 !! wikitext
18378 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18379 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18380
18381 <references />
18382 !! html
18383 <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>
18384 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>
18385
18386 <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>
18387 </ol>
18388 !!end
18389
18390 ## We don't bother wt2wt-ing non-standard whitespace
18391 !!test
18392 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18393 !!options
18394 parsoid=wt2html
18395 !! wikitext
18396 A <ref >foo</ref >
18397
18398 <references />
18399 !! html
18400 <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>
18401
18402 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18403 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18404 !!end
18405
18406 !!test
18407 References: 1. references tag without any refs should be handled properly
18408 !!options
18409 parsoid
18410 !! wikitext
18411 <references />
18412 !! html
18413 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18414 !!end
18415
18416 !!test
18417 References: 2. references tag with group only outputs references from that group
18418 !!options
18419 parsoid
18420 !! wikitext
18421 A <ref group="a">foo</ref>
18422 B <ref group="b">bar</ref>
18423
18424 <references group="a" />
18425 !! html
18426 <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>
18427 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>
18428
18429 <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>
18430 </ol>
18431 !!end
18432
18433 !!test
18434 References: 3. ref list should be cleared after processing references
18435 !!options
18436 parsoid
18437 !! wikitext
18438 A <ref>foo</ref>
18439
18440 <references />
18441
18442 B <ref>bar</ref>
18443
18444 <references />
18445 !! html
18446 <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>
18447
18448 <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>
18449 </ol>
18450
18451 <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>
18452
18453 <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>
18454 </ol>
18455 !!end
18456
18457 !!test
18458 References: 4. only referenced group should be cleared after processing references
18459 !!options
18460 parsoid
18461 !! wikitext
18462 A <ref group="a">afoo</ref>
18463 B <ref>bfoo</ref>
18464
18465 <references group="a" />
18466
18467 C <ref>cfoo</ref>
18468
18469 <references />
18470 !! html
18471 <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>
18472 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>
18473
18474 <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>
18475 </ol>
18476
18477 <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>
18478
18479 <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>
18480 </ol>
18481 !!end
18482
18483 !!test
18484 References: 5. ref tags in references should be processed while ignoring all other content
18485 !!options
18486 parsoid
18487 !! wikitext
18488 A <ref name="a" />
18489 B <ref name="b">bar</ref>
18490
18491 <references>
18492 <ref name="a">foo</ref>
18493 This should just get lost.
18494 </references>
18495 !! html
18496 <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>
18497 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>
18498
18499
18500 <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":{}}'>
18501 <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>
18502 <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>
18503 </ol>
18504 !!end
18505
18506 !!test
18507 References: 6. <references /> from a transclusion
18508 !!options
18509 parsoid
18510 !! wikitext
18511 <ref>Foo</ref> {{echo|<references />}}
18512 !! html
18513 <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>
18514 !!end
18515
18516 !! test
18517 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18518 !! options
18519 parsoid
18520 !! wikitext
18521 A <ref>foo bar for a</ref>
18522 B <ref group="X" name="b" />
18523
18524 <references />
18525
18526 <references group="X">
18527 <ref name="b">foo</ref>
18528 </references>
18529 !! html
18530 <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>
18531 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>
18532
18533 <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>
18534
18535 <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>
18536 !! end
18537
18538 !! test
18539 Entities in ref name
18540 !! options
18541 parsoid
18542 !! wikitext
18543 <ref name="test &amp; me">hi</ref>
18544 !! html
18545 <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>
18546 !! end
18547
18548 # This test is wt2html only because we're permitting the serializer to produce
18549 # dirty diffs, normalizing the unclosed references to the self-closed version.
18550 !! test
18551 Generate references for unclosed references tag
18552 !! options
18553 parsoid=wt2html
18554 !! wikitext
18555 a<ref>foo</ref>
18556
18557 <references>
18558 !! html
18559 <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>
18560
18561
18562 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18563 <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>
18564 !! end
18565
18566 !! test
18567 New reference serializes on its own line
18568 !! options
18569 parsoid=wt2wt,html2wt
18570 !! wikitext
18571 foo
18572 <references />
18573 !! html
18574 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18575 !! end
18576
18577 #### ----------------------------------------------------------------
18578 #### The following section of tests are primarily to test
18579 #### wikitext escaping capabilities of Parsoid. Given that
18580 #### escaping can be done any number of ways, the wikitext (input)
18581 #### is always adjusted to reflect how Parsoid adds nowiki
18582 #### escape tags.
18583 ####
18584 #### We are marking several tests as parsoid-only since the
18585 #### HTML in the result section is different from what the
18586 #### PHP parser generates for it.
18587 #### ----------------------------------------------------------------
18588
18589
18590 #### --------------- Headings ---------------
18591 #### 0. Unnested
18592 #### 1. Nested inside html <h1>=foo=</h1>
18593 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18594 #### 3. Nested inside html with wikitext split by html tags
18595 #### 4. No escape needed
18596 #### 5. Empty headings <h1></h1>
18597 #### 6. Heading chars in SOL context
18598 #### ----------------------------------------
18599 !! test
18600 Headings: 0. Unnested
18601 !! options
18602 parsoid
18603 !! wikitext
18604 <nowiki>=foo=</nowiki>
18605
18606 <nowiki> =foo= </nowiki>
18607 <!--cmt-->
18608 <nowiki>=foo=</nowiki>
18609
18610 =foo''a''<nowiki>=</nowiki>
18611 !! html
18612 <p><span typeof="mw:Nowiki">=foo=</span></p>
18613
18614 <p><span typeof="mw:Nowiki"> =foo= </span>
18615 <!--cmt-->
18616 <span typeof="mw:Nowiki">=foo=</span></p>
18617
18618 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18619 !!end
18620
18621 !! test
18622 Headings: 1. Nested inside html
18623 (New headings and existing headings are handled differently)
18624 !! options
18625 parsoid=html2wt
18626 !! wikitext
18627 = =foo= =
18628
18629 == =foo= ==
18630
18631 === =foo= ===
18632
18633 =<nowiki>=foo=</nowiki>=
18634 ==<nowiki>=foo=</nowiki>==
18635 ===<nowiki>=foo=</nowiki>===
18636 ====<nowiki>=foo=</nowiki>====
18637 =====<nowiki>=foo=</nowiki>=====
18638 ======<nowiki>=foo=</nowiki>======
18639
18640 !! html
18641 <h1>=foo=</h1>
18642 <h2>=foo=</h2>
18643 <h3>=foo=</h3>
18644
18645 <h1 data-parsoid='{}'>=foo=</h1>
18646 <h2 data-parsoid='{}'>=foo=</h2>
18647 <h3 data-parsoid='{}'>=foo=</h3>
18648 <h4 data-parsoid='{}'>=foo=</h4>
18649 <h5 data-parsoid='{}'>=foo=</h5>
18650 <h6 data-parsoid='{}'>=foo=</h6>
18651 !!end
18652
18653 !! test
18654 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18655 !! options
18656 parsoid=html2wt
18657 !! wikitext
18658 = foo =
18659 <nowiki>*</nowiki>bar
18660
18661 = foo =
18662 =bar
18663
18664 = foo =
18665 <nowiki>=bar=</nowiki>
18666 !! html
18667 <h1>foo</h1>*bar
18668 <h1>foo</h1>=bar
18669 <h1>foo</h1>=bar=
18670 !!end
18671
18672 !! test
18673 Headings: 3. Nested inside html with wikitext split by html tags
18674 !! options
18675 parsoid=html2wt
18676 !! wikitext
18677 = ='''bold'''<nowiki>foo=</nowiki> =
18678 !! html
18679 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18680 !!end
18681
18682 !! test
18683 Headings: 4a. No escaping needed (testing just h1 and h2)
18684 !! options
18685 parsoid=html2wt
18686 !! wikitext
18687 = =foo =
18688
18689 = foo= =
18690
18691 = =foo= =
18692
18693 = =foo= bar =
18694
18695 == =foo ==
18696
18697 == foo= ==
18698
18699 = ''=''foo= =
18700
18701 = <nowiki>=</nowiki> =
18702 !! html
18703 <h1>=foo</h1>
18704 <h1>foo=</h1>
18705 <h1> =foo= </h1>
18706 <h1>=foo= bar</h1>
18707 <h2>=foo</h2>
18708 <h2>foo=</h2>
18709 <h1><i>=</i>foo=</h1>
18710 <h1><span typeof="mw:Nowiki">=</span></h1>
18711 !!end
18712
18713 !! test
18714 Headings: 4b. No escaping needed (inside p-tags)
18715 !! options
18716 parsoid=html2wt
18717 !! wikitext
18718 ===
18719 =foo= x
18720 =foo= <s></s>
18721 !! html
18722 <p>===
18723 =foo= x
18724 =foo= <s></s>
18725 </p>
18726 !!end
18727
18728 !! test
18729 Headings: 5. Empty headings
18730 !! options
18731 parsoid
18732 !! wikitext
18733 =<nowiki/>=
18734
18735 ==<nowiki/>==
18736
18737 ===<nowiki/>===
18738
18739 ====<nowiki/>====
18740
18741 =====<nowiki/>=====
18742
18743 ======<nowiki/>======
18744 !! html
18745 <h1></h1>
18746 <h2></h2>
18747 <h3></h3>
18748 <h4></h4>
18749 <h5></h5>
18750 <h6></h6>
18751 !!end
18752
18753 !! test
18754 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18755 !! options
18756 parsoid
18757 !! wikitext
18758 <nowiki>=a=</nowiki>
18759
18760 <nowiki>=a=</nowiki>
18761
18762 <nowiki>=a=</nowiki>
18763
18764 <nowiki>=a=</nowiki>
18765 !! html
18766 <p>=a=</p>
18767 <p>=a= </p>
18768 <p>=a= </p>
18769 <p>=a= </p>
18770 !!end
18771
18772 !! test
18773 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18774 !! options
18775 parsoid
18776 !! wikitext
18777 <nowiki>=a=
18778 b</nowiki>
18779
18780 <nowiki>=a=
18781 b</nowiki>
18782
18783 <nowiki>=a=
18784 b</nowiki>
18785
18786 <nowiki>=a=
18787 b</nowiki>
18788 !! html
18789 <p>=a=
18790 b</p>
18791 <p>=a=
18792 b</p>
18793 <p>=a=
18794 b</p>
18795 <p>=a=
18796 b</p>
18797 </p>
18798 !!end
18799
18800 !! test
18801 Headings: 6c. Heading chars in SOL context (leading newline break)
18802 !! options
18803 parsoid
18804 !! wikitext
18805 a
18806 <nowiki>=b=</nowiki>
18807 !! html
18808 <p>a
18809 =b=</p>
18810 !!end
18811
18812 !! test
18813 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18814 !! options
18815 parsoid
18816 !! wikitext
18817 <!--c0--><nowiki>=a=</nowiki>
18818
18819 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18820 !! html
18821 <p><!--c0-->=a=</p>
18822 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18823 !!end
18824
18825 !! test
18826 Headings: 6d. Heading chars in SOL context (No escaping needed)
18827 !! options
18828 parsoid=html2wt
18829 !! wikitext
18830 =a=<div>b</div>
18831 !! html
18832 =a=<div>b</div>
18833 !!end
18834
18835 #### --------------- Lists ---------------
18836 #### 0. Outside nests (*foo, etc.)
18837 #### 1. Nested inside html <ul><li>*foo</li></ul>
18838 #### 2. Inside definition lists
18839 #### 3. Only bullets at start should be escaped
18840 #### 4. No escapes needed
18841 #### 5. No unnecessary escapes
18842 #### 6. Escape bullets in SOL position
18843 #### 7. Escape bullets in a multi-line context
18844 #### ----------------------------------------
18845
18846 !! test
18847 Lists: 0. Outside nests
18848 !! wikitext
18849 <nowiki>*</nowiki>foo
18850
18851 <nowiki>#</nowiki>foo
18852 !! html
18853 <p>*foo
18854 </p><p>#foo
18855 </p>
18856 !!end
18857
18858 !! test
18859 Lists: 1. Nested inside html
18860 !! wikitext
18861 *<nowiki>*foo</nowiki>
18862
18863 *<nowiki>#foo</nowiki>
18864
18865 *<nowiki>:foo</nowiki>
18866
18867 *<nowiki>;foo</nowiki>
18868
18869 #<nowiki>*foo</nowiki>
18870
18871 #<nowiki>#foo</nowiki>
18872
18873 #<nowiki>:foo</nowiki>
18874
18875 #<nowiki>;foo</nowiki>
18876 !! html
18877 <ul>
18878 <li>*foo
18879 </li>
18880 </ul>
18881 <ul>
18882 <li>#foo
18883 </li>
18884 </ul>
18885 <ul>
18886 <li>:foo
18887 </li>
18888 </ul>
18889 <ul>
18890 <li>;foo
18891 </li>
18892 </ul>
18893 <ol>
18894 <li>*foo
18895 </li>
18896 </ol>
18897 <ol>
18898 <li>#foo
18899 </li>
18900 </ol>
18901 <ol>
18902 <li>:foo
18903 </li>
18904 </ol>
18905 <ol>
18906 <li>;foo
18907 </li>
18908 </ol>
18909
18910 !!end
18911
18912 !! test
18913 Lists: 2. Inside definition lists
18914 !! wikitext
18915 ;<nowiki>;foo</nowiki>
18916
18917 ;<nowiki>:foo</nowiki>
18918
18919 ;<nowiki>:foo</nowiki>
18920 :bar
18921
18922 :<nowiki>:foo</nowiki>
18923 !! html
18924 <dl>
18925 <dt>;foo
18926 </dt>
18927 </dl>
18928 <dl>
18929 <dt>:foo
18930 </dt>
18931 </dl>
18932 <dl>
18933 <dt>:foo
18934 </dt>
18935 <dd>bar
18936 </dd>
18937 </dl>
18938 <dl>
18939 <dd>:foo
18940 </dd>
18941 </dl>
18942
18943 !!end
18944
18945 !! test
18946 Lists: 3. Only bullets at start of text should be escaped
18947 !! wikitext
18948 *<nowiki>*foo*bar</nowiki>
18949
18950 *<nowiki>*foo</nowiki>''it''*bar
18951 !! html
18952 <ul>
18953 <li>*foo*bar
18954 </li>
18955 </ul>
18956 <ul>
18957 <li>*foo<i>it</i>*bar
18958 </li>
18959 </ul>
18960
18961 !!end
18962
18963 !! test
18964 Lists: 4. No escapes needed
18965 !! options
18966 parsoid
18967 !! wikitext
18968 *foo*bar
18969
18970 *''foo''*bar
18971
18972 *[[Foo]]: bar
18973
18974 *[[Foo]]*bar
18975 !! html
18976 <ul>
18977 <li>foo*bar
18978 </li>
18979 </ul>
18980 <ul>
18981 <li><i>foo</i>*bar
18982 </li>
18983 </ul>
18984 <ul>
18985 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18986 </li>
18987 </ul>
18988 <ul>
18989 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18990 </li>
18991 </ul>
18992 !!end
18993
18994 !! test
18995 Lists: 5. No unnecessary escapes
18996 !! wikitext
18997 * bar <span><nowiki>[[foo]]</nowiki></span>
18998
18999 *=bar <span><nowiki>[[foo]]</nowiki></span>
19000
19001 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19002
19003 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19004
19005 *=bar <span>foo]]</span>=
19006
19007 * <s></s>: a
19008 !! html
19009 <ul>
19010 <li> bar <span>[[foo]]</span>
19011 </li>
19012 </ul>
19013 <ul>
19014 <li>=bar <span>[[foo]]</span>
19015 </li>
19016 </ul>
19017 <ul>
19018 <li>[[bar <span>[[foo]]</span>
19019 </li>
19020 </ul>
19021 <ul>
19022 <li>]]bar <span>[[foo]]</span>
19023 </li>
19024 </ul>
19025 <ul>
19026 <li>=bar <span>foo]]</span>=
19027 </li>
19028 </ul>
19029 <ul>
19030 <li> <s></s>: a
19031 </li>
19032 </ul>
19033
19034 !!end
19035
19036 !! test
19037 Lists: 6. Escape bullets in SOL position
19038 !! options
19039 parsoid
19040 !! wikitext
19041 <!--cmt--><nowiki>*foo</nowiki>
19042 !! html
19043 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19044 !!end
19045
19046 !! test
19047 Lists: 7. Escape bullets in a multi-line context
19048 !! wikitext
19049 a
19050 <nowiki>*</nowiki>b
19051 !! html
19052 <p>a
19053 *b
19054 </p>
19055 !!end
19056
19057 #### --------------- HRs ---------------
19058 #### 1. Single line
19059 #### -----------------------------------
19060
19061 !! test
19062 HRs: 1. Single line
19063 !! options
19064 parsoid
19065 !! wikitext
19066 ----<nowiki>----</nowiki>
19067 ----=foo=
19068 ----*foo
19069 !! html
19070 <hr><span typeof="mw:Nowiki">----</span>
19071 <hr>=foo=
19072 <hr>*foo
19073 !! end
19074
19075 #### --------------- Tables ---------------
19076 #### 1a. Simple example
19077 #### 1b. No escaping needed (!foo)
19078 #### 1c. No escaping needed (|foo)
19079 #### 1d. No escaping needed (|}foo)
19080 ####
19081 #### 2a. Nested in td (<td>foo|bar</td>)
19082 #### 2b. Nested in td (<td>foo||bar</td>)
19083 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19084 ####
19085 #### 3a. Nested in th (<th>foo!bar</th>)
19086 #### 3b. Nested in th (<th>foo!!bar</th>)
19087 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19088 ####
19089 #### 4a. Escape -
19090 #### 4b. Escape +
19091 #### 4c. No escaping needed
19092 #### --------------------------------------
19093
19094 !! test
19095 Tables: 1a. Simple example
19096 !! wikitext
19097 <nowiki>{|
19098 |}</nowiki>
19099 !! html
19100 <p>{|
19101 |}
19102 </p>
19103 !! end
19104
19105 !! test
19106 Tables: 1b. No escaping needed
19107 !! wikitext
19108 !foo
19109 !! html
19110 <p>!foo
19111 </p>
19112 !! end
19113
19114 !! test
19115 Tables: 1c. No escaping needed
19116 !! wikitext
19117 |foo
19118 !! html
19119 <p>|foo
19120 </p>
19121 !! end
19122
19123 !! test
19124 Tables: 1d. No escaping needed
19125 !! wikitext
19126 |}foo
19127 !! html
19128 <p>|}foo
19129 </p>
19130 !! end
19131
19132 !! test
19133 Tables: 2a. Nested in td
19134 !! options
19135 parsoid=html2wt
19136 !! wikitext
19137 {|
19138 |<nowiki>foo|bar</nowiki>
19139 |-
19140 |x<div><nowiki>a|b</nowiki></div>
19141 |}
19142 !! html
19143 <table><tbody><tr>
19144 <td>foo|bar</td></tr>
19145 <tr><td>x<div>a|b</div></td>
19146 </tbody></table>
19147 !! end
19148
19149 !! test
19150 Tables: 2b. Nested in td
19151 !! options
19152 parsoid
19153 !! wikitext
19154 {|
19155 |<nowiki>foo||bar</nowiki>
19156 |''it''<nowiki>foo||bar</nowiki>
19157 |}
19158 !! html
19159 <table><tbody><tr>
19160 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19161 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19162 !! end
19163
19164 !! test
19165 Tables: 2c. Nested in td -- no escaping needed
19166 !! options
19167 parsoid
19168 !! wikitext
19169 {|
19170 |foo!!bar
19171 |}
19172 !! html
19173 <table><tbody><tr><td>foo!!bar
19174 </td></tr></tbody></table>
19175
19176 !! end
19177
19178 !! test
19179 Tables: 3a. Nested in th
19180 !! options
19181 parsoid
19182 !! wikitext
19183 {|
19184 !foo!bar
19185 |}
19186 !! html
19187 <table><tbody><tr><th>foo!bar
19188 </th></tr></tbody></table>
19189
19190 !! end
19191
19192 !! test
19193 Tables: 3b. Nested in th
19194 !! options
19195 parsoid
19196 !! wikitext
19197 {|
19198 !<nowiki>foo!!bar</nowiki>
19199 |}
19200 !! html
19201 <table>
19202 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19203 </tbody></table>
19204 !! end
19205
19206 !! test
19207 Tables: 3c. Nested in th -- no escaping needed
19208 !! options
19209 parsoid
19210 !! wikitext
19211 {|
19212 !<nowiki>foo||bar</nowiki>
19213 |}
19214 !! html
19215 <table><tbody><tr>
19216 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19217 !! end
19218
19219 !! test
19220 Tables: 4a. Escape -
19221 !! options
19222 parsoid
19223 !! wikitext
19224 {|
19225 !-bar
19226 |-
19227 |<nowiki>-bar</nowiki>
19228 |}
19229 !! html
19230 <table><tbody>
19231 <tr><th>-bar</th></tr>
19232 <tr>
19233 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19234 !! end
19235
19236 !! test
19237 Tables: 4b. Escape +
19238 !! options
19239 parsoid
19240 !! wikitext
19241 {|
19242 !+bar
19243 |-
19244 |<nowiki>+bar</nowiki>
19245 |}
19246 !! html
19247 <table><tbody>
19248 <tr><th>+bar</th></tr>
19249 <tr>
19250 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19251 !! end
19252
19253 !! test
19254 Tables: 4c. No escaping needed
19255 !! options
19256 parsoid
19257 !! wikitext
19258 {|
19259 |foo-bar
19260 |foo+bar
19261 |-
19262 |''foo''-bar
19263 |''foo''+bar
19264 |-
19265 |foo
19266 bar|baz
19267 +bar
19268 -bar
19269 |-
19270 |x
19271 <div>a|b</div>
19272 |}
19273 !! html
19274 <table><tbody>
19275 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19276 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19277 <tr><td>foo
19278 <p>bar|baz
19279 +bar
19280 -bar</p></td></tr>
19281 <tr><td>x
19282 <div>a|b</div></td>
19283 </tbody></table>
19284 !! end
19285
19286 !! test
19287 Tables: 4d. No escaping needed
19288 !! options
19289 parsoid
19290 !! wikitext
19291 {|
19292 |[[Foo]]-bar
19293 ||+1
19294 ||-2
19295 |}
19296 !! html
19297 <table>
19298 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19299 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19300 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19301 </tbody></table>
19302 !! end
19303
19304 !! test
19305 Tables: Digest broken attributes on table and tr tag
19306 !! options
19307 parsoid=wt2html
19308 !! wikitext
19309 {| || |} ++
19310 |- || || ++ --
19311 |- > [
19312 |}
19313 !! html
19314 <table>
19315 <tbody>
19316 <tr></tr>
19317 <tr></tr>
19318 </tbody></table>
19319 !! end
19320
19321 #### --------------- Links ----------------
19322 #### 1. Quote marks in link text
19323 #### 2. Wikilinks: Escapes needed
19324 #### 3. Wikilinks: No escapes needed
19325 #### 4. Extlinks: Escapes needed
19326 #### 5. Extlinks: No escapes needed
19327 #### --------------------------------------
19328 !! test
19329 Links 1. Quote marks in link text
19330 !! options
19331 parsoid
19332 !! wikitext
19333 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19334 !! html
19335 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19336 !! end
19337
19338 !! test
19339 Links 2. WikiLinks: Escapes needed
19340 !! options
19341 parsoid
19342 !! wikitext
19343 [[Foo|[Foobar]]]
19344 [[Foo|<nowiki>Foobar]</nowiki>]]
19345 [[Foo|x [Foobar] x]]
19346 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19347 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19348 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19349 [[Foo|<nowiki>|Bar</nowiki>]]
19350 [[Foo|<nowiki>]]bar</nowiki>]]
19351 [[Foo|<nowiki>[[bar</nowiki>]]
19352 [[Foo|<nowiki>x [[ y</nowiki>]]
19353 [[Foo|<nowiki>x ]] y</nowiki>]]
19354 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19355 !! html
19356 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19357 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19358 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19359 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19360 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19361 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19362 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19363 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19364 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19365 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19366 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19367 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19368 !! end
19369
19370 !! test
19371 Links 3. WikiLinks: No escapes needed
19372 !! options
19373 parsoid
19374 !! wikitext
19375 [[Foo|[Foobar]]
19376 [[Foo|foo|bar]]
19377 !! html
19378 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19379 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19380 !! end
19381
19382 !! test
19383 Links 4. ExtLinks: Escapes needed
19384 !! options
19385 parsoid
19386 !! wikitext
19387 [http://google.com <nowiki>[google]</nowiki>]
19388 [http://google.com <nowiki>google]</nowiki>]
19389
19390 <nowiki>[http://google.com]</nowiki>
19391
19392 <nowiki>[http://google.com google]</nowiki>
19393
19394 !! html
19395 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19396 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19397 <p>[http://google.com]</p>
19398 <p>[http://google.com google]</p>
19399 !! end
19400
19401 !! test
19402 Links 5. ExtLinks: No escapes needed
19403 !! options
19404 parsoid
19405 !! wikitext
19406 [http://google.com [google]
19407 !! html
19408 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19409 !! end
19410
19411 #### --------------- Quotes ---------------
19412 #### 1. Quotes inside <b> and <i>
19413 #### 2. Link fragments separated by <i> and <b> tags
19414 #### 3. Link fragments inside <i> and <b>
19415 #### 4. No escaping needed
19416 #### --------------------------------------
19417 !! test
19418 1. Quotes inside <b> and <i>
19419 !! options
19420 parsoid=html2wt,wt2wt
19421 !! wikitext
19422 ''<nowiki>'foo'</nowiki>''
19423 ''<nowiki>''foo''</nowiki>''
19424 ''<nowiki>'''foo'''</nowiki>''
19425 ''foo''<nowiki/>'s
19426 '''<nowiki>'foo'</nowiki>'''
19427 '''<nowiki>''foo''</nowiki>'''
19428 '''<nowiki>'''foo'''</nowiki>'''
19429 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19430 '''foo'''<nowiki/>'s
19431 '''foo''
19432 ''foo''<nowiki/>'
19433 '<nowiki/>''foo''<nowiki/>'
19434 ''''foo'''
19435 '''foo'''<nowiki/>'
19436 '<nowiki/>'''foo'''<nowiki/>'
19437 ''fools'<span> errand</span>''
19438 ''<span>fool</span>'s errand''
19439 !! html
19440 <p><i>'foo'</i>
19441 <i>''foo''</i>
19442 <i>'''foo'''</i>
19443 <i>foo</i>'s
19444 <b>'foo'</b>
19445 <b>''foo''</b>
19446 <b>'''foo'''</b>
19447 <b>foo'<i>bar'</i>baz</b>
19448 <b>foo</b>'s
19449 '<i>foo</i>
19450 <i>foo</i>'
19451 '<i>foo</i>'
19452 '<b>foo</b>
19453 <b>foo</b>'
19454 '<b>foo</b>'</p>
19455 <i>fools'<span> errand</span></i>
19456 <i><span>fool</span>'s errand</i>
19457 !! end
19458
19459 !! test
19460 2. Link fragments separated by <i> and <b> tags
19461 !! wikitext
19462 [[''foo''<nowiki>hello]]</nowiki>
19463
19464 [['''foo'''<nowiki>hello]]</nowiki>
19465 !! html
19466 <p>[[<i>foo</i>hello]]
19467 </p><p>[[<b>foo</b>hello]]
19468 </p>
19469 !! end
19470
19471 !! test
19472 3. Link fragments inside <i> and <b>
19473 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19474 this is one of the shortcomings of this format)
19475 !! wikitext
19476 ''[[foo''<nowiki>]]</nowiki>
19477
19478 '''[[foo'''<nowiki>]]</nowiki>
19479 !! html
19480 <p><i>[[foo</i>]]
19481 </p><p><b>[[foo</b>]]
19482 </p>
19483 !! end
19484
19485 !! test
19486 4. No escaping needed
19487 !! wikitext
19488 '<span>''bar''</span>'
19489 '<span>'''bar'''</span>'
19490 !! html
19491 <p>'<span><i>bar</i></span>'
19492 '<span><b>bar</b></span>'
19493 </p>
19494 !! end
19495
19496 #### ----------- Paragraphs ---------------
19497 #### 1. No unnecessary escapes
19498 #### --------------------------------------
19499
19500 !! test
19501 1. No unnecessary escapes
19502 !! wikitext
19503 bar <span><nowiki>[[foo]]</nowiki></span>
19504
19505 =bar <span><nowiki>[[foo]]</nowiki></span>
19506
19507 [[bar <span><nowiki>[[foo]]</nowiki></span>
19508
19509 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19510
19511 =bar <span>foo]]</span><nowiki>=</nowiki>
19512 !! html
19513 <p>bar <span>[[foo]]</span>
19514 </p><p>=bar <span>[[foo]]</span>
19515 </p><p>[[bar <span>[[foo]]</span>
19516 </p><p>]]bar <span>[[foo]]</span>
19517 </p><p>=bar <span>foo]]</span>=
19518 </p>
19519 !!end
19520
19521 #### ----------------------- PRE --------------------------
19522 #### 1. Leading whitespace in SOL context should be escaped
19523 #### ------------------------------------------------------
19524 !! test
19525 1. Leading whitespace in SOL context should be escaped
19526 !! options
19527 parsoid
19528 !! wikitext
19529 <nowiki> </nowiki>a
19530
19531 <nowiki> </nowiki> a
19532
19533 <nowiki> </nowiki>a(tab)
19534
19535 <nowiki> </nowiki> a
19536 <!--cmt-->
19537 <nowiki> </nowiki> a
19538
19539 a
19540 <nowiki> </nowiki>b
19541
19542 a
19543 <nowiki> </nowiki>b
19544
19545 a
19546 <nowiki> </nowiki> b
19547 !! html
19548 <p> a</p>
19549 <p> a</p>
19550 <p> a(tab)</p>
19551 <p> a</p>
19552 <p><!--cmt--> a</p>
19553 <p>a
19554 b</p>
19555 <p>a
19556 b</p>
19557 <p>a
19558 b</p>
19559 !! end
19560
19561 #### --------------- Behavior Switches --------------------
19562 !! test
19563 1. Valid behavior switches should be escaped
19564 !! options
19565 parsoid=html2wt
19566 !! wikitext
19567 <nowiki>__TOC__</nowiki>
19568 !! html
19569 __TOC__
19570 !! end
19571
19572 !! test
19573 2. Invalid behavior switches should not be escaped
19574 !! options
19575 parsoid=html2wt
19576 !! wikitext
19577 __TOO__
19578 __|__
19579 !! html
19580 __TOO__
19581 __|__
19582 !! end
19583
19584 #### --------------- HTML tags ---------------
19585 #### 1. a tags
19586 #### 2. other tags
19587 #### 3. multi-line html tag
19588 #### 4. extension tags
19589 #### -----------------------------------------
19590 !! test
19591 1. a tags
19592 !! options
19593 parsoid
19594 !! wikitext
19595 <a href="http://google.com">google</a>
19596 !! html
19597 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19598 !! end
19599
19600 !! test
19601 2. other tags
19602 !! wikitext
19603 <nowiki><div>foo</div>
19604 <div style="color:red">foo</div></nowiki>
19605 !! html
19606 <p>&lt;div&gt;foo&lt;/div&gt;
19607 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19608 </p>
19609 !! end
19610
19611 !! test
19612 3. multi-line html tag
19613 !! wikitext
19614 <nowiki><div
19615 >foo</div
19616 ></nowiki>
19617 !! html
19618 <p>&lt;div
19619 &gt;foo&lt;/div
19620 &gt;
19621 </p>
19622 !! end
19623
19624 !! test
19625 4. extension tags
19626 !! wikitext
19627 <nowiki><ref>foo</ref></nowiki>
19628
19629 <nowiki><ref>bar</nowiki>
19630
19631 baz<nowiki></ref></nowiki>
19632 !! html
19633 <p>&lt;ref&gt;foo&lt;/ref&gt;
19634 </p><p>&lt;ref&gt;bar
19635 </p><p>baz&lt;/ref&gt;
19636 </p>
19637 !! end
19638
19639 #### --------------- Others ---------------
19640 !! test
19641 Escaping nowikis
19642 !! wikitext
19643 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19644 !! html
19645 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19646 </p>
19647 !! end
19648
19649 ## The quote-char in the input is necessary for triggering the bug
19650 !! test
19651 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19652 !! options
19653 parsoid=wt2wt,html2wt
19654 !! wikitext
19655 foo's bar :
19656 !! html
19657 <p>foo's bar :</p>
19658 !! end
19659
19660 !! test
19661
19662 Tag-like HTML structures are passed through as text
19663 !! wikitext
19664 <x y>
19665
19666 <x.y>
19667
19668 <x-y>
19669
19670 1>2
19671
19672 x<y
19673
19674 a>b
19675
19676 1<d e>f
19677 !! html
19678 <p>&lt;x y&gt;
19679 </p><p>&lt;x.y&gt;
19680 </p><p>&lt;x-y&gt;
19681 </p><p>1&gt;2
19682 </p><p>x&lt;y
19683 </p><p>a&gt;b
19684 </p><p>1&lt;d e&gt;f
19685 </p>
19686 !! end
19687
19688
19689 # This was a bug in the PHP parser (see bug 17663 and its dups,
19690 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19691 !! test
19692 Tag names followed by punctuation should not be recognized as tags
19693 !! wikitext
19694 <s.ome> text
19695 !! html
19696 <p>&lt;s.ome&gt; text
19697 </p>
19698 !! end
19699
19700 !! test
19701 HTML tag with necessary entities in attributes
19702 !! wikitext
19703 <span title="&amp;amp;">foo</span>
19704 !! html
19705 <p><span title="&amp;amp;">foo</span>
19706 </p>
19707 !! end
19708
19709 !! test
19710 HTML tag with 'unnecessary' entity encoding in attributes
19711 !! wikitext
19712 <span title="&amp;">foo</span>
19713 !! html
19714 <p><span title="&amp;">foo</span>
19715 </p>
19716 !! end
19717
19718 !! test
19719 HTML tag with broken attribute value quoting
19720 !! wikitext
19721 <span title="Hello world>Foo</span>
19722 !! html
19723 <p><span>Foo</span>
19724 </p>
19725 !! end
19726
19727 !! test
19728 Parsoid-only: HTML tag with broken attribute value quoting
19729 !! options
19730 parsoid
19731 !! wikitext
19732 <span title="Hello world>Foo</span>
19733 !! html
19734 <p><span title="Hello world">Foo</span>
19735 </p>
19736 !! end
19737
19738 !! test
19739 Table with broken attribute value quoting
19740 !! wikitext
19741 {|
19742 | title="Hello world|Foo
19743 |}
19744 !! html
19745 <table>
19746 <tr>
19747 <td>Foo
19748 </td></tr></table>
19749
19750 !! end
19751
19752 !! test
19753 Table with broken attribute value quoting on consecutive lines
19754 !! wikitext
19755 {|
19756 | title="Hello world|Foo
19757 | style="color:red|Bar
19758 |}
19759 !! html
19760 <table>
19761 <tr>
19762 <td>Foo
19763 </td>
19764 <td>Bar
19765 </td></tr></table>
19766
19767 !! end
19768
19769 !! test
19770 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19771 !! options
19772 parsoid
19773 !! wikitext
19774 {|
19775 | title="Hello world|Foo
19776 | style="color:red|Bar
19777 |}
19778 !! html
19779 <table><tbody>
19780 <tr>
19781 <td title="Hello world">Foo
19782 </td><td style="color: red">Bar
19783 </td></tr></tbody></table>
19784
19785 !! end
19786
19787 !! test
19788 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19789 !! options
19790 parsoid
19791 !! wikitext
19792 {{}}
19793 !! html
19794 {{}}
19795 !! end
19796
19797 !! test
19798 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19799 !! options
19800 parsoid
19801 !! wikitext
19802 }}{{
19803 !! html
19804 }}{{
19805 !! end
19806
19807 !!test
19808 Accept empty td cell attribute
19809 !! wikitext
19810 {|
19811 | align="center" | foo || |
19812 |}
19813 !! html
19814 <table>
19815 <tr>
19816 <td align="center"> foo </td>
19817 <td>
19818 </td></tr></table>
19819
19820 !!end
19821
19822 !!test
19823 Non-empty attributes in th-cells
19824 !! wikitext
19825 {|
19826 ! Foo !! style="color: red" | Bar
19827 |}
19828 !! html
19829 <table>
19830 <tr>
19831 <th> Foo </th>
19832 <th style="color: red"> Bar
19833 </th></tr></table>
19834
19835 !!end
19836
19837 !!test
19838 Accept empty attributes in th-cells
19839 !! wikitext
19840 {|
19841 !| foo !!| bar
19842 |}
19843 !! html
19844 <table>
19845 <tr>
19846 <th> foo </th>
19847 <th> bar
19848 </th></tr></table>
19849
19850 !!end
19851
19852 !!test
19853 Empty table rows go away
19854 !! wikitext
19855 {|
19856 | Hello
19857 | there
19858 |- class="foo"
19859 |-
19860 |}
19861 !! html
19862 <table>
19863 <tr>
19864 <td> Hello
19865 </td>
19866 <td> there
19867 </td></tr>
19868
19869 </table>
19870
19871 !! end
19872
19873 ###
19874 ### Parsoid-centric tests for testing RTing of inter-element separators
19875 ### Edge cases not tested by existing parser tests and specific to
19876 ### Parsoid-specific serialization strategies.
19877 ###
19878
19879 !!test
19880 RT-ed inter-element separators should be valid separators
19881 !! wikitext
19882 {|
19883 |- [[foo]]
19884 |}
19885 !! html
19886 <table>
19887
19888 </table>
19889
19890 !!end
19891
19892 !!test
19893 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19894 (Parsoid-only since PHP parser relies on Tidy for correct output)
19895 !!options
19896 parsoid
19897 !! wikitext
19898 {|
19899 |<small>foo
19900 bar
19901 |}
19902
19903 {|
19904 |<small>foo<small>
19905 |}
19906 !! html
19907 !!end
19908
19909 !!test
19910 Empty TD followed by TD with tpl-generated attribute
19911 !! wikitext
19912 {|
19913 |-
19914 |
19915 |{{echo|style='color:red'}}|foo
19916 |}
19917 !! html
19918 <table>
19919
19920 <tr>
19921 <td>
19922 </td>
19923 <td>foo
19924 </td></tr></table>
19925
19926 !!end
19927
19928 !!test
19929 Indented table with an empty td
19930 !! wikitext
19931 {|
19932 |-
19933 |
19934 |foo
19935 |}
19936 !! html
19937 <table>
19938
19939 <tr>
19940 <td>
19941 </td>
19942 <td>foo
19943 </td></tr></table>
19944
19945 !!end
19946
19947 !!test
19948 Empty TR followed by a template-generated TR
19949 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19950 !!options
19951 parsoid
19952 !! wikitext
19953 {|
19954 |-
19955 {{echo|<tr><td>foo</td></tr>}}
19956 |}
19957 !! html
19958 <table>
19959 <tbody>
19960 <tr></tr>
19961 <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}}]}'>
19962 <td>foo</td></tr>
19963 </tbody></table>
19964 !!end
19965
19966 ## PHP and parsoid output differ for this, and since this is primarily
19967 ## for testing Parsoid's serializer, marking this Parsoid only
19968 !!test
19969 Empty TR followed by mixed-ws-comment line should RT correctly
19970 !!options
19971 parsoid
19972 !! wikitext
19973 {|
19974 |-
19975 <!--c-->
19976 |-
19977 <!--c--> <!--d-->
19978 |}
19979 !! html
19980 <table>
19981 <tbody>
19982 <tr></tr>
19983 <!--c-->
19984 <tr>
19985 <!--c--> </tr><!--d-->
19986 </tbody></table>
19987
19988 !!end
19989
19990 !!test
19991 Multi-line image caption generated by templates with/without trailing newlines
19992 !!options
19993 parsoid
19994 !! wikitext
19995 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19996 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19997 !! html
19998 <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>
19999 <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>
20000
20001 !!end
20002
20003 !! test
20004 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20005 !! options
20006 parsoid=html2wt
20007 !! wikitext
20008 <includeonly>foo</includeonly>
20009 new para
20010
20011 [[./Category:Foo]]
20012
20013 = new heading =
20014 !! html
20015 <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>
20016
20017 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20018 !! end
20019
20020 ## PHP emits broken html for this, and since this is primarily
20021 ## a Parsoid serializer test, marking this Parsoid only
20022 !!test
20023 Improperly nested inline or quotes tags with whitespace in between
20024 !!options
20025 parsoid
20026 !! wikitext
20027 <span> <s>x</span> </s>
20028 ''' ''x''' ''
20029 !! html
20030 <p><span> <s>x</s></span><s> </s>
20031 <b> <i>x</i></b><i> </i>
20032 </p>
20033 !!end
20034
20035 !!test
20036 Encapsulate protected attributes from wt
20037 !!options
20038 parsoid
20039 !! wikitext
20040 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20041 !! html
20042 <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>
20043 </body>
20044 !!end
20045
20046 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20047 ## Having nested or stray pre tags results in the attempt to add duplicates,
20048 ## causing an assertion fail. This test tries to prevent that situation.
20049 !!test
20050 Ensure ParagraphWrapper can deal with stray closing pre tags
20051 !!options
20052 parsoid=wt2html
20053 !! wikitext
20054 plain text</pre>
20055 !! html
20056 plain text
20057 !!end
20058
20059 !!test
20060 1. Ensure fostered text content is wrapped in spans
20061 !!options
20062 parsoid=wt2html
20063 !! wikitext
20064 <table>hi</table><table>ho</table>
20065 !! html
20066 <span>hi</span>
20067 <table></table>
20068 <span>ho</span>
20069 <table></table>
20070 !!end
20071
20072 !!test
20073 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20074 !!options
20075 parsoid=wt2html,wt2wt
20076 !! wikitext
20077 <table>
20078 <tr> || ||
20079 <td> a
20080 </table>
20081 !! html
20082 <span> || ||</span>
20083 <table>
20084 <tbody>
20085 <tr>
20086 <td> a</td></tr>
20087 </tbody></table>
20088 !!end
20089
20090 !!test
20091 Encapsulation properly handles null DSR information from foster box
20092 !!options
20093 parsoid=wt2html,wt2wt
20094 !! wikitext
20095 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20096 !! html
20097 <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;
20098 <table>foo
20099 <tr>
20100 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20101 <table>
20102 <tbody>
20103 <tr>
20104 <td>bar</td></tr></tbody></table>
20105 !!end
20106
20107 !!test
20108 1. Encapsulate foster-parented transclusion content
20109 !!options
20110 parsoid=wt2wt,wt2html
20111 !! wikitext
20112 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20113 !! html
20114 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20115 <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
20116 <tr>
20117 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20118 <table>
20119 <tbody>
20120 <tr>
20121 <td>bar</td></tr></tbody></table>
20122 !!end
20123
20124 !!test
20125 2. Encapsulate foster-parented transclusion content
20126 !!options
20127 parsoid=wt2wt,wt2html
20128 !! wikitext
20129 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20130 !! html
20131 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20132 <table>
20133 <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>
20134 <tr>
20135 <td>bar</td></tr></table>&quot;]}">foo</div>
20136 <table>
20137 <tbody>
20138 <tr>
20139 <td>bar</td></tr></tbody></table>
20140 !!end
20141
20142 !!test
20143 3. Encapsulate foster-parented transclusion content
20144 !!options
20145 parsoid=wt2wt,wt2html
20146 !! wikitext
20147 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20148 !! html
20149 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20150 <table>
20151 <div>
20152 <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>
20153 <tr>
20154 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20155 <p>foo</p></div>
20156 <table>
20157 <tbody>
20158 <tr>
20159 <td>bar</td></tr></tbody></table>
20160 !!end
20161
20162 !!test
20163 4. Encapsulate foster-parented transclusion content
20164 !!options
20165 parsoid=wt2wt,wt2html
20166 !! wikitext
20167 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20168 !! html
20169 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20170 <table>
20171 <div>
20172 <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>
20173 <tr>
20174 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20175 <p>foo</p></div>
20176 <table>
20177 <tbody>
20178 <tr>
20179 <td>bar</td></tr></tbody></table>
20180 !!end
20181
20182 !!test
20183 5. Encapsulate foster-parented transclusion content
20184 !!options
20185 parsoid=wt2wt,wt2html
20186 !! wikitext
20187 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20188 !! html
20189 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20190 <table>
20191 <tr>
20192 <td>
20193 <div>
20194 <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>
20195 <table>
20196 <tbody>
20197 <tr>
20198 <td>
20199 <div>
20200 <p>foo</p></div></td></tr></tbody></table>
20201 !!end
20202
20203 !!test
20204 6. Encapsulate foster-parented transclusion content
20205 !!options
20206 parsoid=wt2wt,wt2html
20207 !! wikitext
20208 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20209 !! html
20210 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20211 <table>
20212 <tr>
20213 <td>
20214 <div>
20215 <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>
20216 <table>
20217 <tbody>
20218 <tr>
20219 <td>
20220 <div>
20221 <p>foo</p></div></td></tr></tbody></table>
20222 <p>ok</p>
20223 !!end
20224
20225 !!test
20226 7. Encapsulate foster-parented transclusion content
20227 !!options
20228 parsoid=wt2wt,wt2html
20229 !! wikitext
20230 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20231 !! html
20232 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20233 <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;
20234 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20235 <td>bar</td></table>&quot;]}">foo</p>
20236 <table>
20237 <tbody>
20238 <tr>
20239 <td>bar</td></tr></tbody></table>
20240 !!end
20241
20242 !!test
20243 8. Encapsulate foster-parented transclusion content
20244 !!options
20245 parsoid=wt2wt,wt2html
20246 !! wikitext
20247 {{echo|a
20248 }}{|{{echo|style='color:red'}}
20249 |-
20250 |b
20251 |}
20252 !! html
20253 <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>
20254 <table>
20255 <tbody>
20256 <tr>
20257 <td>b</td></tr></tbody></table>
20258 !!end
20259
20260 !!test
20261 9. Encapsulate foster-parented transclusion content
20262 !!options
20263 parsoid=wt2wt,wt2html
20264 !! wikitext
20265 <table>{{echo|hi</table>hello}}
20266 !! html
20267 <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>
20268 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20269 !!end
20270
20271 !!test
20272 Table in fosterable position
20273 !!options
20274 parsoid=wt2html,wt2wt
20275 !! wikitext
20276 {{OpenTable}}
20277 <div>
20278 {|
20279 |}
20280 </div>
20281 |}
20282 !! html
20283 <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="{}">
20284 </span>
20285 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20286
20287 <table>
20288 </table>
20289 !!end
20290
20291 !!test
20292 Support <object> element with .data attribute
20293 !!options
20294 parsoid=html2wt
20295 !! wikitext
20296 <object data="test.swf"></object>
20297 !! html
20298 <object data="test.swf"></object>
20299 !!end
20300
20301 # -----------------------------------------------------------------
20302 # The following section of tests are primarily to spec requirements
20303 # around serialization of new/edited content.
20304 #
20305 # All these tests are marked Parsoid html2wt and html2html only
20306 # ----------------------------------------------------------------
20307
20308 !! test
20309 Image: Modifying size of an image (1)
20310 !! options
20311 parsoid={
20312 "modes": ["wt2wt"],
20313 "changes": [
20314 ["img[height]", "attr", "height", "22"],
20315 ["img[width]", "attr", "width", "200"]
20316 ]
20317 }
20318 !! wikitext
20319 [[Image:Foobar.jpg|230x230px]]
20320 !! wikitext/edited
20321 [[Image:Foobar.jpg|200x200px]]
20322 !!end
20323
20324 !! test
20325 Image: Modifying size of an image (2)
20326 !! options
20327 parsoid={
20328 "modes": ["wt2wt"],
20329 "changes": [
20330 ["img[height]", "attr", "height", "100"],
20331 ["img[width]", "attr", "width", "500"]
20332 ]
20333 }
20334 !! wikitext
20335 [[Image:Foobar.jpg|230x230px]]
20336 !! wikitext/edited
20337 [[Image:Foobar.jpg|500x500px]]
20338 !!end
20339
20340 # Change in size is ignored so long as class='mw-default-size'
20341 !! test
20342 Image: Modifying size of an image (3)
20343 !! options
20344 parsoid={
20345 "modes": ["wt2wt"],
20346 "changes": [
20347 ["figure[class]", "removeClass", "mw-default-size"],
20348 ["figure img", "attr", "height", "19"],
20349 ["figure img", "attr", "width", "170"]
20350 ]
20351 }
20352 !! wikitext
20353 [[Image:Foobar.jpg|thumb]]
20354 !! wikitext/edited
20355 [[Image:Foobar.jpg|thumb|170x170px]]
20356 !!end
20357
20358 !! test
20359 Image: Modifying alignment of an image (bug 48665)
20360 !! options
20361 parsoid={
20362 "modes": ["wt2wt"],
20363 "changes": [
20364 ["figure[class]", "removeClass", "mw-halign-right"],
20365 ["figure[class]", "addClass", "mw-halign-left"]
20366 ]
20367 }
20368 !! wikitext
20369 [[Image:Foobar.jpg|thumb|caption|right]]
20370 !! wikitext/edited
20371 [[Image:Foobar.jpg|thumb|caption|left]]
20372 !! end
20373
20374 !! test
20375 Image: Modifying mw-default-size of an frameless image (bug 62805)
20376 !! options
20377 parsoid={
20378 "modes": ["wt2wt"],
20379 "changes": [
20380 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20381 ]
20382 }
20383 !! wikitext
20384 [[Image:Foobar.jpg|frameless|right]]
20385 !! wikitext/edited
20386 [[Image:Foobar.jpg|frameless|right|220x220px]]
20387 !! end
20388
20389 !! test
20390 Image: Modifying valign of an image (bug 49221)
20391 !! options
20392 parsoid={
20393 "modes": ["wt2wt"],
20394 "changes": [
20395 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20396 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20397 ]
20398 }
20399 !! wikitext
20400 [[File:Foobar.jpg|20px|middle]]
20401 !! wikitext/edited
20402 [[File:Foobar.jpg|20px|text-top]]
20403 !! end
20404
20405 !! test
20406 Image: Modifying alt attribute of an image (bug 56400)
20407 !! options
20408 parsoid={
20409 "modes": ["wt2wt"],
20410 "changes": [
20411 ["img[alt]", "attr", "alt", "some alternate edited text"]
20412 ]
20413 }
20414 !! wikitext
20415 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20416 !! wikitext/edited
20417 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20418 !!end
20419
20420 !! test
20421 Image: Modifying caption of an image
20422 !! options
20423 parsoid={
20424 "modes": ["wt2wt"],
20425 "changes": [
20426 ["figcaption", "text", "new caption"]
20427 ]
20428 }
20429 !! wikitext
20430 [[Image:Foobar.jpg|thumb|original caption]]
20431 !! wikitext/edited
20432 [[Image:Foobar.jpg|thumb|new caption]]
20433 !!end
20434
20435 !! test
20436 Image: empty alt attribute (bug 48924)
20437 !! options
20438 parsoid
20439 !! wikitext
20440 [[File:Foobar.jpg|thumb|alt=|bar]]
20441 !! html
20442 <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>
20443 !! end
20444
20445 #!! test
20446 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20447 #!! options
20448 #parsoid=html2wt
20449 #language=ar
20450 #!! input
20451 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20452 #!! result
20453 #<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>
20454 #!! end
20455
20456 !! test
20457 Image: Block level image should have \n before and after
20458 !! options
20459 parsoid
20460 !! wikitext
20461 123
20462 [[File:Foobar.jpg|right|thumb|150x150px]]
20463 456
20464 !! html
20465 <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>
20466 !!end
20467
20468 !! test
20469 Image: New block level image should have \n before and after (existing
20470 content)
20471 !! options
20472 parsoid
20473 !! wikitext
20474 123
20475 [[File:Foobar.jpg|right|thumb|150x150px]]
20476 456
20477 !! html
20478 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20479 <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>
20480 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20481 !!end
20482
20483 !! test
20484 Image: upright option (parsoid)
20485 !! options
20486 parsoid
20487 !! wikitext
20488 [[File:Foobar.jpg|thumb|upright|caption]]
20489 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20490 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20491 !! html
20492 <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>
20493 !!end
20494
20495 !! test
20496 Image: upright option is ignored on inline and frame images (parsoid)
20497 !! options
20498 parsoid
20499 !! wikitext
20500 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20501 !! html
20502 <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>
20503 !!end
20504
20505 !! test
20506 Image: from basic HTML (1)
20507 !! options
20508 parsoid=html2wt
20509 !! html/parsoid
20510 <span typeof="mw:Image">
20511 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20512 </span>
20513 !! wikitext
20514 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20515 !! end
20516
20517 !! test
20518 Image: from basic HTML (2)
20519 !! options
20520 parsoid=html2wt
20521 !! html/parsoid
20522 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20523 !! wikitext
20524 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20525 !! end
20526
20527 !! test
20528 Image: from basic HTML (3)
20529 !! options
20530 parsoid=html2wt
20531 !! html/parsoid
20532 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20533 !! wikitext
20534 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20535 !! end
20536
20537 !! test
20538 Image: from basic HTML (4)
20539 !! options
20540 parsoid=html2wt
20541 !! html/parsoid
20542 <img src="File:Foobar.jpg">
20543 !! wikitext
20544 [[File:Foobar.jpg|link=]]
20545 !! end
20546
20547 !! test
20548 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20549 !! options
20550 parsoid=html2wt
20551 !! wikitext
20552 * foo
20553 !! html
20554 <ul>
20555 <li><p>foo</p></li>
20556 </ul>
20557 !! end
20558
20559 !! test
20560 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20561 !! options
20562 parsoid=html2wt
20563 !! wikitext
20564 * foo
20565 !! html
20566 <ul> <li>foo</li></ul>
20567 !! end
20568
20569 !! test
20570 Don't strip leading whitespace when handling indent-pre suppressing tags
20571 !! options
20572 parsoid=html2wt
20573 !! wikitext
20574 {|
20575 | indented row
20576 |}
20577 <blockquote>
20578 '''This is very bold of you!'''
20579
20580 {|
20581 |
20582 indented cell (no pre-wrapping!)
20583 |}
20584 </blockquote>
20585 foo
20586 <div>bar</div>
20587 !! html
20588 <table>
20589 <tr><td> indented row</td></tr>
20590 </table>
20591 <blockquote><p>
20592 <b>This is very bold of you!</b>
20593 </p>
20594 <table><tr><td>
20595 indented cell (no pre-wrapping!)
20596 </td></tr></table>
20597 </blockquote>
20598 <p>foo</p>
20599 <div>bar</div>
20600 !! end
20601
20602 !! test
20603 Strip leading whitespace when handling indent-pre inducing tags
20604 !! options
20605 parsoid=html2wt
20606 !! wikitext
20607 foo
20608 <span>bar</span>
20609
20610 <span>foo2
20611 </span>bar2
20612
20613 <div>foo</div>
20614 <span>bar</span>
20615
20616 <div>
20617 <span>foo</span>
20618 </div>
20619 !! html
20620 <p>foo</p>
20621 <span>bar</span>
20622
20623 <span>foo2
20624 </span>bar2
20625
20626 <div>foo</div>
20627 <span>bar</span>
20628
20629 <div>
20630 <span>foo</span>
20631 </div>
20632 !! end
20633
20634 !! test
20635 Lists: Add space after bullets
20636 !! options
20637 parsoid=html2wt
20638 !! wikitext
20639 * foo
20640 * bar
20641 * <span> baz</span>
20642 !! html
20643 <ul>
20644 <li>foo</li>
20645 <li> bar</li>
20646 <li><span> baz</span></li>
20647 </ul>
20648 !! end
20649
20650 !! test
20651 Lists: Dont insert newlines in a serialized list item.
20652 !! options
20653 parsoid=html2wt
20654 !! wikitext
20655 * a<br>b
20656 * c
20657 !! html
20658 <ul><li>a<br>b</li><li>c</li></ul>
20659 !! end
20660
20661 !! test
20662 Headings: Add space before/after == (Bug 51744)
20663 !! options
20664 parsoid=html2wt
20665 !! wikitext
20666 == foo ==
20667
20668 == bar ==
20669
20670 == baz ==
20671
20672 == <span> baz</span> ==
20673 !! html
20674 <h2>foo</h2>
20675 <h2> bar</h2>
20676 <h2>baz </h2>
20677 <h2><span> baz</span></h2>
20678 !! end
20679
20680 !! test
20681 Parsoid: Serialize positional parameters with = in them as named parameter
20682 !! options
20683 parsoid=html2wt
20684 !! wikitext
20685 {{echo|1 = f=oo}}
20686
20687 {{echo|1 = f=oo|2 = bar}}
20688
20689 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20690 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20691 {{echo|<nowiki>f=oo</nowiki>|bar}}
20692 !! html
20693 <p about="#mwt1" typeof="mw:Transclusion"
20694 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20695
20696 <p about="#mwt1" typeof="mw:Transclusion"
20697 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20698
20699 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20700 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20701 <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>
20702 !! end
20703
20704 !! test
20705 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20706 !! options
20707 parsoid=html2wt
20708 !! wikitext
20709 <div>a
20710 b
20711 </div>
20712 <div>a
20713 b
20714 </div>
20715 <div>
20716 a
20717
20718 b
20719 </div>
20720 !! html
20721 <div>a<p>b</p></div>
20722 <div>a
20723 <p>b</p></div>
20724 <div>
20725 a
20726 <p>b</p></div>
20727 !! end
20728
20729 !! test
20730 Substrings resembling wikitext in hrefs should not get nowiki escapes
20731 !! options
20732 parsoid=html2wt
20733 !! wikitext
20734 [[Foo''bar''baz]]
20735 !! html
20736 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20737 !! end
20738
20739 #-----------------------------
20740 # I/B quote minimization tests
20741 #-----------------------------
20742
20743 !! test
20744 1. I/B quote minimization: wikitext-only tags should be combined
20745 !! options
20746 parsoid=html2wt
20747 !! wikitext
20748 ''AB''
20749
20750 '''AB'''
20751
20752 ''A'''B'''''
20753
20754 '''A''B'''''
20755
20756 '''A''BC''D'''
20757
20758 '''''AB'''''
20759
20760 '''''AB'''''
20761
20762 '''''AB'''''
20763 !! html
20764 <p><i>A</i><i>B</i></p>
20765 <p><b>A</b><b>B</b></p>
20766 <p><i>A</i><b><i>B</i></b></p>
20767 <p><b>A</b><i><b>B</b></i></p>
20768 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20769 <p><i><b>A</b></i><i><b>B</b></i></p>
20770 <p><i><b>A</b></i><b><i>B</i></b></p>
20771 <p><b><i>A</i></b><i><b>B</b></i></p>
20772 !! end
20773
20774 !! test
20775 2. I/B quote minimization: wikitext and html tags should not be combined
20776 !! options
20777 parsoid=html2wt
20778 !! wikitext
20779 ''A''<i>B</i>
20780
20781 ''A'''''<i>B</i>'''
20782 !! html
20783 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20784 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20785 !! end
20786
20787 !! test
20788 3. I/B quote minimization: templated content stops minimization
20789 !! options
20790 parsoid=html2wt
20791 !! wikitext
20792 ''A''{{echo|''B''}}
20793
20794 ''A''{{echo|'''''B'''''}}
20795 !! html
20796 <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>
20797 <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>
20798 !! end
20799
20800 !! test
20801 4. I/B quote minimization: new content should be mimimized with adjacent old content
20802 !! options
20803 parsoid=html2wt
20804 !! wikitext
20805 ''AB''
20806
20807 '''AB'''
20808
20809 ''A'''B'''''
20810 !! html
20811 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20812 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20813 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20814 !! end
20815
20816 #------------------------------------
20817 # End of I/B quote minimization tests
20818 #------------------------------------
20819
20820 !!test
20821 Bug 54262: New entities
20822 !! options
20823 parsoid=html2wt
20824 !! wikitext
20825 &nbsp;
20826 !! html
20827 <span typeof="mw:Entity">&nbsp;</span>
20828 !! end
20829
20830 ## Note that there is no wikitext output for 'unknownproperty' ##
20831 ## Unknown magic words are silently dropped ##
20832
20833 !! test
20834 Magic words
20835 !! options
20836 parsoid=html2wt
20837 !! wikitext
20838 __TOC__
20839 __NOTOC__
20840 __FORCETOC__
20841 __INDEX__
20842 __NOINDEX__
20843 __NOGALLERY__
20844 __NOEDITSECTION__
20845 __NOTITLECONVERT__
20846 __NOCONTENTCONVERT__
20847 !! html
20848 <meta property='mw:PageProp/toc' />
20849 <meta property='mw:PageProp/notoc' />
20850 <meta property='mw:PageProp/forcetoc' />
20851 <meta property='mw:PageProp/index' />
20852 <meta property='mw:PageProp/noindex' />
20853 <meta property='mw:PageProp/nogallery' />
20854 <meta property='mw:PageProp/noeditsection' />
20855 <meta property='mw:PageProp/notitleconvert' />
20856 <meta property='mw:PageProp/nocontentconvert' />
20857 <meta property='mw:PageProp/unknownproperty' />
20858 !! end
20859
20860 !! test
20861 Consecutive <pre>s should not get merged
20862 !! options
20863 parsoid=html2wt,html2html
20864 !! wikitext
20865 a
20866
20867 b
20868
20869 c
20870
20871 d
20872
20873 e
20874
20875
20876
20877 f
20878 !! html
20879 <pre>a</pre><pre>b</pre>
20880
20881 <pre>c
20882 </pre><pre>
20883 d</pre>
20884
20885 <pre>e
20886
20887 </pre><pre>
20888
20889 f</pre>
20890 !! end
20891
20892 !! test
20893 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20894 !! options
20895 parsoid=html2wt
20896 !! wikitext
20897 [[Special:BookSources/1234567890|ISBN 1234567895]]
20898 !! html
20899 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20900 !! end
20901
20902 !! test
20903 Edited RFC links not serializable as RFC links should serialize as extlinks
20904 !! options
20905 parsoid=html2wt
20906 !! wikitext
20907 [//tools.ietf.org/html/rfc123 New RFC]
20908 !! html
20909 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20910 !! end
20911
20912 !! test
20913 Edited PMID links not serializable as PMID links should serialize as extlinks
20914 !! options
20915 parsoid=html2wt
20916 !! wikitext
20917 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20918 !! html
20919 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20920 !! end
20921
20922 !! test
20923 Edited Redirect link should emit a non-piped wikitext link
20924 !! options
20925 parsoid=html2wt
20926 !! wikitext
20927 #REDIRECT [[Bar]]
20928 !! html
20929 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20930 !! end
20931
20932 # -----------------------------------------------------------------
20933 # End of section for Parsoid-only html2wt tests for serialization
20934 # of new content
20935 # -----------------------------------------------------------------
20936
20937 TODO:
20938 more images
20939 more tables
20940 character entities
20941 and much more
20942 Try for 100% code coverage