Merge "Add HKDF as a fast, random number source"
[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><li> Item 1</li>
417 <li> Item 2</li></ul>
418
419 !! end
420
421 !! test
422 Italics and bold
423 !! wikitext
424 * plain
425 * plain''italic''plain
426 * plain''italic''plain''italic''plain
427 * plain'''bold'''plain
428 * plain'''bold'''plain'''bold'''plain
429 * plain''italic''plain'''bold'''plain
430 * plain'''bold'''plain''italic''plain
431 * plain''italic'''bold-italic'''italic''plain
432 * plain'''bold''bold-italic''bold'''plain
433 * plain'''''bold-italic'''italic''plain
434 * plain'''''bold-italic''bold'''plain
435 * plain''italic'''bold-italic'''''plain
436 * plain'''bold''bold-italic'''''plain
437 * plain l'''italic''plain
438 * plain l''''bold''' plain
439 !! html
440 <ul><li> plain</li>
441 <li> plain<i>italic</i>plain</li>
442 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
443 <li> plain<b>bold</b>plain</li>
444 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
445 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
446 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
447 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
448 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
449 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
450 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
451 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
452 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
453 <li> plain l'<i>italic</i>plain</li>
454 <li> plain l'<b>bold</b> plain</li></ul>
455
456 !! end
457
458 # this example taken from the [[simple:Moon]] article (bug 47326)
459 !! test
460 Italics and possessives (1)
461 !! wikitext
462 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
463 !! html
464 <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
465 </p>
466 !! end
467
468 # this example taken from [[en:Flaming Pie]] (bug 49926)
469 !! test
470 Italics and possessives (2)
471 !! wikitext
472 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
473 !! html
474 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
475 </p>
476 !! end
477
478 # this example taken from [[en:Dictionary]] (bug 49926)
479 !! test
480 Italics and possessives (3)
481 !! wikitext
482 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''.
483 !! html
484 <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>.
485 </p>
486 !! end
487
488
489 ###
490 ### 2-quote opening sequence tests
491 ###
492 !! test
493 Italics and bold: 2-quote opening sequence: (2,2)
494 !! wikitext
495 ''foo''
496 !! html
497 <p><i>foo</i>
498 </p>
499 !!end
500
501
502 !! test
503 Italics and bold: 2-quote opening sequence: (2,3)
504 !! options
505 parsoid=wt2html
506 !! wikitext
507 ''foo'''
508 !! html/*
509 <p><i>foo'</i>
510 </p>
511 !!end
512
513
514 # same html as previous, but wikitext adjusted to match parsoid html2wt
515 !! test
516 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
517 !! wikitext
518 ''<nowiki>foo'</nowiki>''
519 !! html
520 <p><i>foo'</i>
521 </p>
522 !! end
523
524
525 !! test
526 Italics and bold: 2-quote opening sequence: (2,4)
527 !! options
528 parsoid=wt2html
529 !! wikitext
530 ''foo''''
531 !! html/*
532 <p><i>foo''</i>
533 </p>
534 !!end
535
536
537 # same html as previous, but wikitext adjusted to match parsoid html2wt
538 !! test
539 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
540 !! wikitext
541 ''<nowiki>foo''</nowiki>''
542 !! html
543 <p><i>foo''</i>
544 </p>
545 !! end
546
547
548 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
549 !! test
550 Italics and bold: 2-quote opening sequence: (2,5)
551 !! options
552 parsoid=wt2html
553 !! wikitext
554 ''foo'''''
555 !! html/php
556 <p><i>foo</i>
557 </p>
558 !! html/parsoid
559 <p><i>foo</i><b></b>
560 </p>
561 !!end
562
563 # same html as previous, but wikitext adjusted to match parsoid html2wt
564 !! test
565 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
566 !! wikitext
567 ''foo'''''<nowiki/>'''
568 !! html/php
569 <p><i>foo</i>
570 </p>
571 !! html/parsoid
572 <p><i>foo</i><b></b>
573 </p>
574 !! end
575
576
577 ###
578 ### 3-quote opening sequence tests
579 ###
580
581 !! test
582 Italics and bold: 3-quote opening sequence: (3,2)
583 !! wikitext
584 '''foo''
585 !! html
586 <p>'<i>foo</i>
587 </p>
588 !!end
589
590
591 !! test
592 Italics and bold: 3-quote opening sequence: (3,3)
593 !! wikitext
594 '''foo'''
595 !! html
596 <p><b>foo</b>
597 </p>
598 !!end
599
600
601 !! test
602 Italics and bold: 3-quote opening sequence: (3,4)
603 !! options
604 parsoid=wt2html
605 !! wikitext
606 '''foo''''
607 !! html/*
608 <p><b>foo'</b>
609 </p>
610 !!end
611
612
613 # same html as previous, but wikitext adjusted to match parsoid html2wt
614 !! test
615 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
616 !! wikitext
617 '''<nowiki>foo'</nowiki>'''
618 !! html
619 <p><b>foo'</b>
620 </p>
621 !! end
622
623
624 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
625 !! test
626 Italics and bold: 3-quote opening sequence: (3,5)
627 !! options
628 parsoid=wt2html
629 !! wikitext
630 '''foo'''''
631 !! html/php
632 <p><b>foo</b>
633 </p>
634 !! html/parsoid
635 <p><b>foo</b><i></i>
636 </p>
637 !!end
638
639 # same html as previous, but wikitext adjusted to match parsoid html2wt
640 !! test
641 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
642 !! wikitext
643 '''foo'''''<nowiki/>''
644 !! html/php
645 <p><b>foo</b>
646 </p>
647 !! html/parsoid
648 <p><b>foo</b><i></i>
649 </p>
650 !! end
651
652
653 ###
654 ### 4-quote opening sequence tests
655 ###
656
657 !! test
658 Italics and bold: 4-quote opening sequence: (4,2)
659 !! options
660 parsoid=wt2html
661 !! wikitext
662 ''''foo''
663 !! html/*
664 <p>''<i>foo</i>
665 </p>
666 !!end
667
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
672 !! wikitext
673 <nowiki>''</nowiki>''foo''
674 !! html
675 <p>''<i>foo</i>
676 </p>
677 !! end
678
679
680 !! test
681 Italics and bold: 4-quote opening sequence: (4,3)
682 !! wikitext
683 ''''foo'''
684 !! html
685 <p>'<b>foo</b>
686 </p>
687 !!end
688
689
690 !! test
691 Italics and bold: 4-quote opening sequence: (4,4)
692 !! options
693 parsoid=wt2html
694 !! wikitext
695 ''''foo''''
696 !! html/*
697 <p>'<b>foo'</b>
698 </p>
699 !!end
700
701
702 # same html as previous, but wikitext adjusted to match parsoid html2wt
703 !! test
704 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
705 !! wikitext
706 ''''<nowiki>foo'</nowiki>'''
707 !! html
708 <p>'<b>foo'</b>
709 </p>
710 !! end
711
712
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 4-quote opening sequence: (4,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 ''''foo'''''
720 !! html/php
721 <p>'<b>foo</b>
722 </p>
723 !! html/parsoid
724 <p>'<b>foo</b><i></i>
725 </p>
726 !!end
727
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
731 !! wikitext
732 ''''foo'''''<nowiki/>''
733 !! html/php
734 <p>'<b>foo</b>
735 </p>
736 !! html/parsoid
737 <p>'<b>foo</b><i></i>
738 </p>
739 !! end
740
741
742 ###
743 ### 5-quote opening sequence tests
744 ###
745
746 !! test
747 Italics and bold: 5-quote opening sequence: (5,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''''foo''
752 !! html/*
753 <p><b><i>foo</i></b>
754 </p>
755 !!end
756
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 # skipping wt2html and html2html because it wants to put <i> before <b>
760 !! test
761 Italics and bold: 5-quote opening sequence: (5,2+3)
762 !! options
763 parsoid=wt2wt,html2wt
764 !! wikitext
765 '''''foo'''''
766 !! html/*
767 <p><b><i>foo</i></b>
768 </p>
769 !! end
770
771 !! test
772 Italics and bold: 5-quote opening sequence: (5,3)
773 !! options
774 parsoid=wt2html
775 !! wikitext
776 '''''foo'''
777 !! html/*
778 <p><i><b>foo</b></i>
779 </p>
780 !!end
781
782
783 # same html as previous, but wikitext adjusted to match parsoid html2wt
784 !! test
785 Italics and bold: 5-quote opening sequence: (5,3+2)
786 !! wikitext
787 '''''foo'''''
788 !! html
789 <p><i><b>foo</b></i>
790 </p>
791 !! end
792
793
794 !! test
795 Italics and bold: 5-quote opening sequence: (5,4)
796 !! options
797 parsoid=wt2html
798 !! wikitext
799 '''''foo''''
800 !! html/*
801 <p><i><b>foo'</b></i>
802 </p>
803 !!end
804
805
806 # same html as previous, but wikitext adjusted to match parsoid html2wt
807 !! test
808 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
809 !! wikitext
810 '''''<nowiki>foo'</nowiki>'''''
811 !! html
812 <p><i><b>foo'</b></i>
813 </p>
814 !! end
815
816
817 !! test
818 Italics and bold: 5-quote opening sequence: (5,5)
819 !! wikitext
820 '''''foo'''''
821 !! html
822 <p><i><b>foo</b></i>
823 </p>
824 !!end
825
826 ###
827 ### multiple quote sequences in a line
828 ###
829 !! test
830 Italics and bold: multiple quote sequences: (2,4,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 ''foo''''bar''
835 !! html/*
836 <p><i>foo'<b>bar</b></i>
837 </p>
838 !!end
839
840
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
844 !! wikitext
845 ''<nowiki>foo'</nowiki>'''bar'''''
846 !! html
847 <p><i>foo'<b>bar</b></i>
848 </p>
849 !! end
850
851
852 !! test
853 Italics and bold: multiple quote sequences: (2,4,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 ''foo''''bar'''
858 !! html/*
859 <p><i>foo'<b>bar</b></i>
860 </p>
861 !!end
862
863
864 # same html as previous, but wikitext adjusted to match parsoid html2wt
865 !! test
866 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
867 !! wikitext
868 ''<nowiki>foo'</nowiki>'''bar'''''
869 !! html
870 <p><i>foo'<b>bar</b></i>
871 </p>
872 !! end
873
874
875 !! test
876 Italics and bold: multiple quote sequences: (2,4,4)
877 !! options
878 parsoid=wt2html
879 !! wikitext
880 ''foo''''bar''''
881 !! html/*
882 <p><i>foo'<b>bar'</b></i>
883 </p>
884 !!end
885
886
887 # same html as previous, but wikitext adjusted to match parsoid html2wt
888 !! test
889 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
890 !! wikitext
891 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
892 !! html
893 <p><i>foo'<b>bar'</b></i>
894 </p>
895 !! end
896
897
898 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
899 !! test
900 Italics and bold: multiple quote sequences: (3,4,2)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 '''foo''''bar''
905 !! html/php
906 <p><b>foo'</b>bar
907 </p>
908 !! html/parsoid
909 <p><b>foo'</b>bar<i></i>
910 </p>
911 !!end
912
913 # same html as previous, but wikitext adjusted to match parsoid html2wt
914 !! test
915 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
916 !! options
917 parsoid
918 !! wikitext
919 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
920 !! html/php
921 <p><b>foo'</b>bar
922 </p>
923 !! html/parsoid
924 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
925 </p>
926 !! end
927
928
929 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
930 !! test
931 Italics and bold: multiple quote sequences: (3,4,3)
932 !! options
933 parsoid=wt2html
934 !! wikitext
935 '''foo''''bar'''
936 !! html/php
937 <p><b>foo'</b>bar
938 </p>
939 !! html/parsoid
940 <p><b>foo'</b>bar<b></b>
941 </p>
942 !!end
943
944 # same html as previous, but wikitext adjusted to match parsoid html2wt
945 !! test
946 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
947 !! wikitext
948 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
949 !! html/php
950 <p><b>foo'</b>bar
951 </p>
952 !! html/parsoid
953 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
954 </p>
955 !! end
956
957 ###
958 ### other quote tests
959 ###
960 !! test
961 Italics and bold: other quote tests: (2,3,5)
962 !! wikitext
963 ''this is about '''foo's family'''''
964 !! html
965 <p><i>this is about <b>foo's family</b></i>
966 </p>
967 !!end
968
969
970 !! test
971 Italics and bold: other quote tests: (2,(3,3),2)
972 !! wikitext
973 ''this is about '''foo's''' family''
974 !! html
975 <p><i>this is about <b>foo's</b> family</i>
976 </p>
977 !!end
978
979
980 !! test
981 Italics and bold: other quote tests: (3,2,3,2)
982 !! options
983 parsoid=wt2html
984 !! wikitext
985 '''this is about ''foo'''s family''
986 !! html/*
987 <p><b>this is about <i>foo</i></b><i>s family</i>
988 </p>
989 !!end
990
991
992 # same html as previous, but wikitext adjusted to match parsoid html2wt
993 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
994 !! test
995 Italics and bold: other quote tests: (3,2,3+2+2,2)
996 !! options
997 parsoid
998 !! wikitext
999 '''this is about ''foo'''''<nowiki/>''s family''
1000 !! html/*
1001 <p><b>this is about <i>foo</i></b><i>s family</i>
1002 </p>
1003 !! end
1004
1005
1006 !! test
1007 Italics and bold: other quote tests: (3,2,3,3)
1008 !! options
1009 !! wikitext
1010 '''this is about ''foo'''s family'''
1011 !! html
1012 <p>'<i>this is about </i>foo<b>s family</b>
1013 </p>
1014 !!end
1015
1016
1017 !! test
1018 Italics and bold: other quote tests: (3,(2,2),3)
1019 !! wikitext
1020 '''this is about ''foo's'' family'''
1021 !! html
1022 <p><b>this is about <i>foo's</i> family</b>
1023 </p>
1024 !!end
1025
1026
1027 !! test
1028 Italicized possessive
1029 !! wikitext
1030 The ''[[Main Page]]'''s talk page.
1031 !! html
1032 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1033 </p>
1034 !! end
1035
1036 !! test
1037 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1038 (Requires tidy for PHP parser output to be fixed up)
1039 !! options
1040 parsoid=wt2html,wt2wt
1041 !! wikitext
1042 {|
1043 !''a!!''b
1044 |''a||''b
1045 |}
1046 !! html
1047 <table>
1048 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1049 <td><i>a</i></td><td><i>b</i></td></tr>
1050 </tbody></table>
1051 !! end
1052
1053 ###
1054 ### Non-html5 tags
1055 ###
1056
1057 !! test
1058 Non-html5 tags should be accepted
1059 !! wikitext
1060 <center>''foo''</center>
1061 <big>''foo''</big>
1062 <font>''foo''</font>
1063 <strike>''foo''</strike>
1064 <tt>''foo''</tt>
1065 !! html
1066 <center><i>foo</i></center>
1067 <p><big><i>foo</i></big>
1068 <font><i>foo</i></font>
1069 <strike><i>foo</i></strike>
1070 <tt><i>foo</i></tt>
1071 </p>
1072 !! end
1073
1074 !! test
1075 <wbr> is valid wikitext (bug 52468)
1076 !! wikitext
1077 <wbr>
1078 !! html
1079 <p><wbr />
1080 </p>
1081 !! end
1082
1083 # <strike> is HTML4, <s> is HTML4/5.
1084 !! test
1085 <s> or <strike> for strikethrough
1086 !! wikitext
1087 <strike>strike</strike>
1088
1089 <s>s</s>
1090 !! html
1091 <p><strike>strike</strike>
1092 </p><p><s>s</s>
1093 </p>
1094 !! end
1095
1096 !! test
1097 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1098 !! wikitext
1099 <b→> doesn't work! </b→>
1100
1101 <bä> doesn't work! </bä>
1102
1103 <boo> works fine </boo>
1104
1105 <s.foo>s.foo</s.foo>
1106
1107 <sub-ID#1>
1108 !! html
1109 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1110 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1111 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1112 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1113 </p><p>&lt;sub-ID#1&gt;
1114 </p>
1115 !! end
1116
1117 !! test
1118 Isolated close tags should be treated as literal text (bug 52760)
1119 !! wikitext
1120 </b>
1121
1122 <s.foo>s</s>
1123 !! html
1124 <p>&lt;/b&gt;
1125 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1126 </p>
1127 !! end
1128
1129 ###
1130 ### Special characters
1131 ###
1132
1133 !! test
1134 Bare pipe character (bug 52363)
1135 !! wikitext
1136 |
1137 !! html
1138 <p>|
1139 </p>
1140 !! end
1141
1142 !! test
1143 Bare pipe character from a template (bug 52363)
1144 !! wikitext
1145 {{pipe}}
1146 !! html
1147 <p>|
1148 </p>
1149 !! end
1150
1151 ###
1152 ### <nowiki> test cases
1153 ###
1154
1155 !! test
1156 <nowiki> unordered list
1157 !! wikitext
1158 <nowiki>* This is not an unordered list item.</nowiki>
1159 !! html
1160 <p>* This is not an unordered list item.
1161 </p>
1162 !! end
1163
1164 !! test
1165 <nowiki> spacing
1166 !! wikitext
1167 <nowiki>Lorem ipsum dolor
1168
1169 sed abit.
1170 sed nullum.
1171
1172 :and a colon
1173 </nowiki>
1174 !! html
1175 <p>Lorem ipsum dolor
1176
1177 sed abit.
1178 sed nullum.
1179
1180 :and a colon
1181
1182 </p>
1183 !! end
1184
1185 !! test
1186 nowiki 3
1187 !! wikitext
1188 :There is not nowiki.
1189 :There is <nowiki>nowiki</nowiki>.
1190
1191 #There is not nowiki.
1192 #There is <nowiki>nowiki</nowiki>.
1193
1194 *There is not nowiki.
1195 *There is <nowiki>nowiki</nowiki>.
1196 !! html
1197 <dl><dd>There is not nowiki.</dd>
1198 <dd>There is nowiki.</dd></dl>
1199 <ol><li>There is not nowiki.</li>
1200 <li>There is nowiki.</li></ol>
1201 <ul><li>There is not nowiki.</li>
1202 <li>There is nowiki.</li></ul>
1203
1204 !! end
1205
1206 !! test
1207 Entities inside <nowiki>
1208 !! wikitext
1209 <nowiki>&lt;</nowiki>
1210 !! html
1211 <p>&lt;
1212 </p>
1213 !! end
1214
1215 !! test
1216 Entities inside template parameters
1217 !! options
1218 parsoid
1219 !! wikitext
1220 {{echo|&ndash;}}
1221 !! html
1222 <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>
1223 </p>
1224 !! end
1225
1226 ###
1227 ### Comments
1228 ###
1229 !! test
1230 Comments and Indent-Pre
1231 !! wikitext
1232 <!-- comment 1 --> asdf
1233
1234 <!-- comment 1 --> asdf
1235 <!-- comment 2 -->
1236
1237 <!-- comment 1 --> asdf
1238 <!-- comment 2 -->xyz
1239
1240 <!-- comment 1 --> asdf
1241 <!-- comment 2 --> xyz
1242 !! html
1243 <pre>asdf
1244 </pre>
1245 <pre>asdf
1246 </pre>
1247 <pre>asdf
1248 </pre>
1249 <p>xyz
1250 </p>
1251 <pre>asdf
1252 xyz
1253 </pre>
1254 !! end
1255
1256 !! test
1257 Comment test 2a
1258 !! wikitext
1259 asdf
1260 <!-- comment 1 -->
1261 jkl
1262 !! html
1263 <p>asdf
1264 jkl
1265 </p>
1266 !! end
1267
1268 !! test
1269 Comment test 2b
1270 !! wikitext
1271 asdf
1272 <!-- comment 1 -->
1273
1274 jkl
1275 !! html
1276 <p>asdf
1277 </p><p>jkl
1278 </p>
1279 !! end
1280
1281 !! test
1282 Comment test 3
1283 !! wikitext
1284 asdf
1285 <!-- comment 1 -->
1286 <!-- comment 2 -->
1287 jkl
1288 !! html
1289 <p>asdf
1290 jkl
1291 </p>
1292 !! end
1293
1294 !! test
1295 Comment test 4
1296 !! wikitext
1297 asdf<!-- comment 1 -->jkl
1298 !! html
1299 <p>asdfjkl
1300 </p>
1301 !! end
1302
1303 !! test
1304 Comment spacing
1305 !! wikitext
1306 a
1307 <!-- foo --> b <!-- bar -->
1308 c
1309 !! html
1310 <p>a
1311 </p>
1312 <pre> b
1313 </pre>
1314 <p>c
1315 </p>
1316 !! end
1317
1318 !! test
1319 Comment whitespace
1320 !! wikitext
1321 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1322 !! html
1323
1324 !! end
1325
1326 !! test
1327 Comment semantics and delimiters
1328 !! wikitext
1329 <!-- --><!----><!-----><!------>
1330 !! html
1331
1332 !! end
1333
1334 !! test
1335 Comment semantics and delimiters, redux
1336 !! wikitext
1337 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1338 -- foo -- funky huh? ... -->
1339 !! html
1340
1341 !! end
1342
1343 !! test
1344 Comment semantics and delimiters: directors cut
1345 !! wikitext
1346 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1347 everything starting with < followed by !-- until the first -- and > we see,
1348 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1349 -->-->
1350 !! html
1351 <p>--&gt;
1352 </p>
1353 !! end
1354
1355 !! test
1356 Comment semantics: nesting
1357 !! wikitext
1358 <!--<!-- no, we're not going to do anything fancy here -->-->
1359 !! html
1360 <p>--&gt;
1361 </p>
1362 !! end
1363
1364 !! test
1365 Comment semantics: unclosed comment at end
1366 !! wikitext
1367 <!--This comment will run out to the end of the document
1368 !! html
1369
1370 !! end
1371
1372 !! test
1373 Comment in template title
1374 !! wikitext
1375 {{f<!---->oo}}
1376 !! html
1377 <p>FOO
1378 </p>
1379 !! end
1380
1381 !! test
1382 Comment on its own line post-expand
1383 !! wikitext
1384 a
1385 {{blank}}<!---->
1386 b
1387 !! html
1388 <p>a
1389 </p><p>b
1390 </p>
1391 !! end
1392
1393 !! test
1394 Comment on its own line post-expand with non-significant whitespace
1395 !! wikitext
1396 a
1397 {{blank}} <!---->
1398 b
1399 !! html
1400 <p>a
1401 </p><p>b
1402 </p>
1403 !! end
1404
1405 !! test
1406 Multiple comments should still parse as SOL-transparent
1407 !! options
1408 parsoid=wt2html,wt2wt
1409 !! wikitext
1410 <!--c1-->*a
1411 <!--c2--><!--c3--><!--c4-->*b
1412 !! html
1413 <ul>
1414 <li>a
1415 </li>
1416 <li>b
1417 </li>
1418 </ul>
1419 !! end
1420
1421 ###
1422 ### paragraph wrapping tests
1423 ###
1424 !! test
1425 No block tags
1426 !! wikitext
1427 a
1428
1429 b
1430 !! html
1431 <p>a
1432 </p><p>b
1433 </p>
1434 !! end
1435
1436 !! test
1437 Block tag on one line (<div>)
1438 !! wikitext
1439 a <div>foo</div>
1440
1441 b
1442 !! html
1443 a <div>foo</div>
1444 <p>b
1445 </p>
1446 !! end
1447
1448 !! test
1449 Block tag on one line (<blockquote>)
1450 !! wikitext
1451 a <blockquote>foo</blockquote>
1452
1453 b
1454 !! html
1455 a <blockquote>foo</blockquote>
1456 <p>b
1457 </p>
1458 !! end
1459
1460 !! test
1461 Block tag on both lines (<div>)
1462 !! wikitext
1463 a <div>foo</div>
1464
1465 b <div>foo</div>
1466 !! html
1467 a <div>foo</div>
1468 b <div>foo</div>
1469
1470 !! end
1471
1472 !! test
1473 Block tag on both lines (<blockquote>)
1474 !! wikitext
1475 a <blockquote>foo</blockquote>
1476
1477 b <blockquote>foo</blockquote>
1478 !! html
1479 a <blockquote>foo</blockquote>
1480 b <blockquote>foo</blockquote>
1481
1482 !! end
1483
1484 !! test
1485 Multiple lines without block tags
1486 !! wikitext
1487 <div>foo</div> a
1488 b
1489 c
1490 d<!--foo--> e
1491 x <div>foo</div> z
1492 !! html
1493 <div>foo</div> a
1494 <p>b
1495 c
1496 d e
1497 </p>
1498 x <div>foo</div> z
1499
1500 !! end
1501
1502 !! test
1503 Empty lines between lines with block tags
1504 !! wikitext
1505 <div></div>
1506
1507
1508 <div></div>a
1509
1510 b
1511 <div>a</div>b
1512
1513 <div>b</div>d
1514
1515
1516 <div>e</div>
1517 !! html
1518 <div></div>
1519 <p><br />
1520 </p>
1521 <div></div>a
1522 <p>b
1523 </p>
1524 <div>a</div>b
1525 <div>b</div>d
1526 <p><br />
1527 </p>
1528 <div>e</div>
1529
1530 !! end
1531
1532 ## PHP parser emits output which is broken
1533 !! test
1534 Unclosed HTML p-tags should be handled properly
1535 !! wikitext
1536 <div><p>foo</div>
1537 a
1538
1539 b
1540 !! html/parsoid
1541 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1542 <p>a</p>
1543 <p>b</p>
1544 !! end
1545
1546 ###
1547 ### Preformatted text
1548 ###
1549 !! test
1550 Preformatted text
1551 !! wikitext
1552 This is some
1553 Preformatted text
1554 With ''italic''
1555 And '''bold'''
1556 And a [[Main Page|link]]
1557 !! html
1558 <pre>This is some
1559 Preformatted text
1560 With <i>italic</i>
1561 And <b>bold</b>
1562 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1563 </pre>
1564 !! end
1565
1566 !! test
1567 Tabs don't trigger preformatted text
1568 !! wikitext
1569 This is not
1570 preformatted text.
1571 This is preformatted text.
1572 So is this.
1573 !! html
1574 <p> This is not
1575 preformatted text.
1576 </p>
1577 <pre>This is preformatted text.
1578 So is this.
1579 </pre>
1580 !! end
1581
1582 !! test
1583 Ident preformatting with inline content
1584 !! wikitext
1585 a
1586 ''b''
1587 !! html
1588 <pre>a
1589 <i>b</i>
1590 </pre>
1591 !! end
1592
1593 !! test
1594 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1595 !! wikitext
1596 <pre><nowiki>
1597 <b>
1598 <cite>
1599 <em>
1600 </nowiki></pre>
1601 !! html
1602 <pre>
1603 &lt;b&gt;
1604 &lt;cite&gt;
1605 &lt;em&gt;
1606 </pre>
1607
1608 !! end
1609
1610 !! test
1611 Regression with preformatted in <center>
1612 !! wikitext
1613 <center>
1614 Blah
1615 </center>
1616 !! html
1617 <center>
1618 <pre>Blah
1619 </pre>
1620 </center>
1621
1622 !! end
1623
1624 !! test
1625 Bug 52763: Preformatted in <blockquote>
1626 !! wikitext
1627 <blockquote>
1628 Blah
1629 {|
1630 |
1631 indented cell (no pre-wrapping!)
1632 |}
1633 </blockquote>
1634 !! html
1635 <blockquote>
1636 <p> Blah
1637 </p>
1638 <table>
1639 <tr>
1640 <td>
1641 <p> indented cell (no pre-wrapping!)
1642 </p>
1643 </td></tr></table>
1644 </blockquote>
1645
1646 !! end
1647
1648 !! test
1649 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1650 !! wikitext
1651 <blockquote>
1652 Foo
1653
1654 Bar
1655 </blockquote>
1656 !! html
1657 <blockquote>
1658 <p>Foo
1659 </p><p>Bar
1660 </p>
1661 </blockquote>
1662
1663 !! end
1664
1665 !! test
1666 Bug 15491: <ins>/<del> in blockquote
1667 !! wikitext
1668 <blockquote>
1669 Foo <del>bar</del> <ins>baz</ins> quux
1670 </blockquote>
1671 !! html
1672 <blockquote>
1673 <p>Foo <del>bar</del> <ins>baz</ins> quux
1674 </p>
1675 </blockquote>
1676
1677 !! end
1678
1679 # Note that the p-wrapping is newline sensitive, which could be
1680 # considered a bug: tidy will wrap only the 'Foo' in the example
1681 # below in a <p> tag. (see comment 23-25 of bug #6200)
1682 !! test
1683 Bug 15491: <ins>/<del> in blockquote (2)
1684 !! wikitext
1685 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1686 </blockquote>
1687 !! html
1688 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1689 </blockquote>
1690
1691 !! end
1692
1693 !! test
1694 <pre> with attributes (bug 3202)
1695 !! wikitext
1696 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1697 !! html
1698 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1699
1700 !! end
1701
1702 !! test
1703 <pre> with width attribute (bug 3202)
1704 !! wikitext
1705 <pre width="8">Narrow screen goodies</pre>
1706 !! html
1707 <pre width="8">Narrow screen goodies</pre>
1708
1709 !! end
1710
1711 !! test
1712 <pre> with forbidden attribute (bug 3202)
1713 !! wikitext
1714 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1715 !! html
1716 <pre width="8">Narrow screen goodies</pre>
1717
1718 !! end
1719
1720 !! test
1721 Entities inside <pre>
1722 !! wikitext
1723 <pre>&lt;</pre>
1724 !! html
1725 <pre>&lt;</pre>
1726
1727 !! end
1728
1729 !! test
1730 <pre> with forbidden attribute values (bug 3202)
1731 !! wikitext
1732 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1733 !! html
1734 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1735
1736 !! end
1737
1738 !! test
1739 <nowiki> inside <pre> (bug 13238)
1740 !! wikitext
1741 <pre>
1742 <nowiki>
1743 </pre>
1744 <pre>
1745 <nowiki></nowiki>
1746 </pre>
1747 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1748 !! html
1749 <pre>
1750 &lt;nowiki&gt;
1751 </pre>
1752 <pre>
1753
1754 </pre>
1755 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1756
1757 !! end
1758
1759 !! test
1760 <nowiki> and <pre> preference (first one wins)
1761 !! wikitext
1762 <pre>
1763 <nowiki>
1764 </pre>
1765 </nowiki>
1766 </pre>
1767
1768 <nowiki>
1769 <pre>
1770 <nowiki>
1771 </pre>
1772 </nowiki>
1773 </pre>
1774
1775 !! html
1776 <pre>
1777 &lt;nowiki&gt;
1778 </pre>
1779 <p>&lt;/nowiki&gt;
1780 &lt;/pre&gt;
1781 </p><p>
1782 &lt;pre&gt;
1783 &lt;nowiki&gt;
1784 &lt;/pre&gt;
1785
1786 &lt;/pre&gt;
1787 </p>
1788 !! end
1789
1790 !! test
1791 </pre> inside nowiki
1792 !! wikitext
1793 <nowiki></pre></nowiki>
1794 !! html
1795 <p>&lt;/pre&gt;
1796 </p>
1797 !! end
1798
1799 !! test
1800 Empty pre; pre inside other HTML tags (bug 54946)
1801 !! wikitext
1802 a
1803
1804 <div><pre>
1805 foo
1806 </pre></div>
1807 <pre></pre>
1808 !! html
1809 <p>a
1810 </p>
1811 <div><pre>
1812 foo
1813 </pre></div>
1814 <pre></pre>
1815
1816 !! end
1817
1818 !! test
1819 HTML pre followed by indent-pre
1820 !! wikitext
1821 <pre>foo</pre>
1822 bar
1823 !! html
1824 <pre>foo</pre>
1825 <pre>bar
1826 </pre>
1827 !! end
1828
1829 !!test
1830 Block tag pre
1831 !!options
1832 parsoid
1833 !! wikitext
1834 <p><pre>foo</pre></p>
1835 !! html
1836 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1837 !!end
1838
1839 !!test
1840 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1841 !! wikitext
1842 {{echo|}}
1843 !! html
1844
1845 !!end
1846
1847 !!test
1848 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1849 !! wikitext
1850 {{echo|
1851 foo}}
1852 !! html
1853 <p>foo
1854 </p>
1855 !!end
1856
1857 !! test
1858 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1859 !! wikitext
1860 {{echo|a
1861 b}}
1862 !! html
1863 <pre>a
1864 </pre>
1865 <p>b
1866 </p>
1867 !!end
1868
1869 !! test
1870 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1871 !! wikitext
1872 {{echo|a
1873 b
1874 c
1875 d
1876 e
1877 }}
1878 !! html
1879 <pre>a
1880 </pre>
1881 <p>b
1882 c
1883 </p>
1884 <pre>d
1885 </pre>
1886 <p>e
1887 </p>
1888 !!end
1889
1890 !!test
1891 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1892 !! wikitext
1893 {{echo| foo}}
1894
1895 {{echo| foo}}{{echo| bar}}
1896
1897 {{echo| foo}}
1898 {{echo| bar}}
1899
1900 {{echo|<!--cmt--> foo}}
1901
1902 <!--cmt-->{{echo| foo}}
1903
1904 {{echo|{{echo| }}bar}}
1905 !! html
1906 <pre>foo
1907 </pre>
1908 <pre>foo bar
1909 </pre>
1910 <pre>foo
1911 bar
1912 </pre>
1913 <pre>foo
1914 </pre>
1915 <pre>foo
1916 </pre>
1917 <pre>bar
1918 </pre>
1919 !!end
1920
1921 !! test
1922 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1923 !! wikitext
1924 {{echo| }}a
1925
1926 {{echo|
1927 }}a
1928
1929 {{echo|
1930 b}}
1931
1932 {{echo|a
1933 }}b
1934
1935 {{echo|a
1936 }} b
1937 !! html
1938 <pre>a
1939 </pre>
1940 <p><br />
1941 </p>
1942 <pre>a
1943 </pre>
1944 <p><br />
1945 </p>
1946 <pre>b
1947 </pre>
1948 <p>a
1949 </p>
1950 <pre>b
1951 </pre>
1952 <p>a
1953 </p>
1954 <pre>b
1955 </pre>
1956 !!end
1957
1958 !! test
1959 Things that look like <pre> tags aren't treated as such
1960 !! wikitext
1961 Barack Obama <President> of the United States
1962 <President></President>
1963 !! html
1964 <p>Barack Obama &lt;President&gt; of the United States
1965 &lt;President&gt;&lt;/President&gt;
1966 </p>
1967 !! end
1968
1969 ## PHP parser discards the "<pre " string
1970 !! test
1971 Handle broken pre-like tags (bug 64025)
1972 !! options
1973 parsoid=wt2html
1974 !! wikitext
1975 {{echo|<pre <pre>x</pre>}}
1976
1977 <table><pre </table>
1978 !! html/php
1979 <pre>x</pre>
1980 <table><pre></pre></table>
1981
1982 !! html/parsoid
1983 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
1984 <pre>x</pre>
1985
1986 <span>&lt;pre </span>
1987 <table></table>
1988 !! end
1989
1990 !! test
1991 Parsoid: handle pre with space after attribute
1992 !! options
1993 parsoid=wt2html
1994 !! wikitext
1995 <pre style="width:50%;" >{{echo|foo}}</pre>
1996 !! html
1997 <pre style="width:50%;">{{echo|foo}}</pre>
1998 !! end
1999
2000 # TODO / maybe: fix wt2wt for this
2001 !! test
2002 Parsoid: Don't paragraph-wrap fosterable content
2003 !! options
2004 parsoid=wt2html
2005 !! wikitext
2006 {|
2007 <td></td>
2008 <td></td>
2009
2010
2011
2012 |}
2013 !! html
2014 <table>
2015
2016 <tbody>
2017 <tr>
2018 <td></td>
2019
2020 <td></td></tr>
2021
2022
2023
2024 </tbody></table>
2025 !! end
2026
2027 !! test
2028 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 {|
2033 <td>
2034 <td>
2035 </td>
2036
2037
2038
2039 |}
2040 !! html
2041 <table>
2042
2043 <tbody>
2044 <tr>
2045 <td></td>
2046
2047 <td>
2048 </td></tr>
2049
2050
2051
2052 </tbody></table>
2053 !! end
2054
2055
2056 #--------------------------------------------------------------------
2057 # Transclusion parameter whitespace stripping tests
2058 # Behavior is different for positional and named parameters
2059 #--------------------------------------------------------------------
2060 !! test
2061 Templates: Strip leading and trailing whitespace from named-param values
2062 !! wikitext
2063 {{echo|1= a }}
2064
2065 {{echo|1= {{echo|b}} }}
2066
2067 {{echo| 1 =
2068 c }}
2069
2070 {{echo| 1 =
2071 * d
2072 }}
2073 !! html
2074 <p>a
2075 </p><p>b
2076 </p><p>c
2077 </p>
2078 <ul><li> d</li></ul>
2079
2080 !! end
2081
2082 !! test
2083 Templates: Don't strip whitespace from positional-param values
2084 !! wikitext
2085 {{echo|a }}
2086
2087 {{echo|{{echo|b}} }}
2088
2089 {{echo| c
2090 }}
2091
2092 {{echo| {{echo|d}}
2093 }}
2094
2095 {{echo|
2096 e}}
2097
2098 {{echo|
2099 * f}}
2100
2101 {{echo|
2102 }}g
2103 !! html
2104 <p>a
2105 </p><p>b
2106 </p>
2107 <pre>c
2108 </pre>
2109 <p><br />
2110 </p>
2111 <pre>d
2112 </pre>
2113 <p><br />
2114 </p>
2115 <pre>e
2116 </pre>
2117 <p><br />
2118 </p>
2119 <ul><li> f</li></ul>
2120 <p><br />
2121 </p>
2122 <pre>g
2123 </pre>
2124 !! end
2125
2126 !! test
2127 Templates: Handle empty comment-and-ws-only lines correctly
2128 !! wikitext
2129 {{echo|foo
2130 <!--should be ignored-->
2131 <!--should be ignored as well-->
2132 bar}}
2133 !! html
2134 <p>foo
2135 bar
2136 </p>
2137 !! end
2138
2139 !! test
2140 Templates: Handle comments in the target
2141 !! wikitext
2142 {{echo
2143 <!-- should be ignored -->
2144 |foo}}
2145
2146 {{echo<!-- should be ignored -->
2147 |foo}}
2148
2149 {{echo<!-- should be ignored -->|foo}}
2150
2151 {{<!-- should be ignored -->echo|foo}}
2152 !!html/parsoid
2153 <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>
2154
2155 <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>
2156
2157 <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>
2158
2159 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2160 !!end
2161
2162 #--------------------------------------------------------------------
2163 # Transclusion parameter escaping tests
2164 #--------------------------------------------------------------------
2165 !! test
2166 Templates: Parsoid parameter escaping test 1
2167 !! options
2168 parsoid
2169 !! wikitext
2170 {{echo|[foo]|{{echo|[bar]}}}}
2171 !! html
2172 <p about="#mwt1" typeof="mw:Transclusion"
2173 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2174 !! end
2175
2176 !! test
2177 Parsoid: Pipes in external links in template parameter
2178 !! options
2179 parsoid
2180 !! wikitext
2181 {{echo|[{{echo|http://example.com}} link]}}
2182 !! html
2183 <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>
2184 !! end
2185
2186 !! test
2187 Parsoid: pipe in transclusion parameter
2188 !! options
2189 parsoid
2190 !! wikitext
2191 {{echo|http://foo.com/a&#124;b}}
2192 !! html
2193 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2194 typeof="mw:Transclusion"
2195 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>
2196 !! end
2197
2198 !! test
2199 Parsoid: Pipe in external link target and content in template parameter
2200 !! options
2201 parsoid=html2wt,wt2wt
2202 !! wikitext
2203 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2204 !! html
2205 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2206 typeof="mw:Transclusion"
2207 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2208 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2209 !! end
2210
2211 !! test
2212 Templates: Don't escape already nowiki-escaped text in template parameters
2213 !! options
2214 parsoid=html2wt,wt2wt
2215 !! wikitext
2216 {{echo|foo<nowiki>|</nowiki>bar}}
2217 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2218 {{echo|<nowiki></nowiki>}}
2219 !! html
2220 <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>
2221 <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>
2222 <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>
2223 </p>
2224 !! end
2225
2226 ## Bug 52824
2227 !! test
2228 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2229 !! options
2230 parsoid=html2wt,wt2wt
2231 !! wikitext
2232 {{echo|{{echo|1=bar}}}}
2233 !! html
2234 <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>
2235 !! end
2236
2237 ## Bug 56733
2238 !! test
2239 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2240 !! options
2241 parsoid
2242 !! wikitext
2243 {{echo|a : b}}
2244 !! html
2245 <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>
2246 !! end
2247
2248 ###
2249 ### Parsoid-centric tests for testing RT edge cases for pre
2250 ###
2251
2252 !!test
2253 1a. Indent-Pre and Comments
2254 !! wikitext
2255 a
2256 <!--a-->
2257 c
2258 !! html
2259 <pre>a
2260 </pre>
2261 <p>c
2262 </p>
2263 !!end
2264
2265 !!test
2266 1b. Indent-Pre and Comments
2267 !! wikitext
2268 a
2269 <!--a-->
2270 c
2271 !! html
2272 <pre>a
2273 </pre>
2274 <p>c
2275 </p>
2276 !!end
2277
2278 !!test
2279 1c. Indent-Pre and Comments
2280 !! wikitext
2281 <!--a--> a
2282
2283 <!--a--> a
2284 !! html
2285 <pre> a
2286 </pre>
2287 <pre> a
2288 </pre>
2289 !!end
2290
2291 !!test
2292 1d. Indent-Pre and Comments
2293 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2294 !! wikitext
2295 <!--a--> a
2296
2297 <!--b-->b
2298 !! html
2299 <pre>a
2300 </pre>
2301 <pre>b
2302 </pre>
2303 !!end
2304
2305 !!test
2306 2a. Indent-Pre and tables
2307 !! wikitext
2308 {|
2309 |-
2310 !h1!!h2
2311 |foo||bar
2312 |}
2313 !! html
2314 <table>
2315
2316 <tr>
2317 <th>h1</th>
2318 <th>h2
2319 </th>
2320 <td>foo</td>
2321 <td>bar
2322 </td></tr></table>
2323
2324 !!end
2325
2326 !!test
2327 2b. Indent-Pre and tables
2328 !! wikitext
2329 {|
2330 |-
2331 |foo
2332 |}
2333 !! html
2334 <table>
2335
2336 <tr>
2337 <td>foo
2338 </td></tr></table>
2339
2340 !!end
2341
2342 !!test
2343 2c. Indent-Pre and tables (bug 42252)
2344 !! wikitext
2345 {|
2346 |+ foo
2347 ! | bar
2348 |}
2349 !! html
2350 <table>
2351 <caption> foo
2352 </caption>
2353 <tr>
2354 <th> bar
2355 </th></tr></table>
2356
2357 !!end
2358
2359 !!test
2360 3a. Indent-Pre and block tags (single-line html)
2361 !! wikitext
2362 a <p> foo </p>
2363 b <div> foo </div>
2364 c <blockquote> foo </blockquote>
2365 <span> foo </span>
2366 !! html
2367 a <p> foo </p>
2368 b <div> foo </div>
2369 c <blockquote> foo </blockquote>
2370 <pre><span> foo </span>
2371 </pre>
2372 !!end
2373
2374 !!test
2375 3b. Indent-Pre and block tags (multi-line html)
2376 !! wikitext
2377 a <span>foo</span>
2378 b <div> foo </div>
2379 !! html
2380 <pre>a <span>foo</span>
2381 </pre>
2382 b <div> foo </div>
2383
2384 !!end
2385
2386 !!test
2387 3c. Indent-Pre and block tags (pre-content on separate line)
2388 !! wikitext
2389 <p>
2390 foo
2391 </p>
2392
2393 <div>
2394 foo
2395 </div>
2396
2397 <center>
2398 foo
2399 </center>
2400
2401 <blockquote>
2402 foo
2403 </blockquote>
2404
2405 <blockquote>
2406 <pre>
2407 foo
2408 </pre>
2409 </blockquote>
2410
2411 <table><tr><td>
2412 foo
2413 </td></tr></table>
2414
2415 <ul><li>
2416 foo
2417 </li></ul>
2418
2419 !! html
2420 <p>
2421 foo
2422 </p>
2423 <div>
2424 <pre>foo
2425 </pre>
2426 </div>
2427 <center>
2428 <pre>foo
2429 </pre>
2430 </center>
2431 <blockquote>
2432 <p> foo
2433 </p>
2434 </blockquote>
2435 <blockquote>
2436 <pre>
2437 foo
2438 </pre>
2439 </blockquote>
2440 <table><tr><td>
2441 <pre>foo
2442 </pre>
2443 </td></tr></table>
2444 <ul><li>
2445 foo
2446 </li></ul>
2447
2448 !!end
2449
2450 !!test
2451 4. Indent-Pre and extension tags
2452 !! wikitext
2453 a <gallery>
2454 File:foobar.jpg
2455 </gallery>
2456 !! html
2457 a <ul class="gallery mw-gallery-traditional">
2458 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2459 <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>
2460 <div class="gallerytext">
2461 </div>
2462 </div></li>
2463 </ul>
2464
2465 !!end
2466
2467 !! test
2468 Leading pipes outside of tables
2469 !! options
2470 parsoid
2471 !! wikitext
2472 | foo
2473 !! html
2474 <p>| foo</p>
2475 !! end
2476
2477 !! test
2478 Leading pipes outside of tables 2
2479 !! options
2480 parsoid
2481 !! wikitext
2482 a
2483 | foo
2484 b
2485 !! html
2486 <p>a
2487 | foo
2488 b</p>
2489 !! end
2490
2491 !! test
2492 Leading pipes outside of tables 3
2493 !! options
2494 parsoid
2495 !! wikitext
2496 a
2497 | class="foo bar" | baz
2498 b
2499 !! html
2500 <p>a
2501 | class="foo bar" | baz
2502 b</p>
2503 !! end
2504
2505 !!test
2506 Render paragraphs when indent-pre is suppressed in blocklevels
2507 !! wikitext
2508 <blockquote>
2509 foo
2510
2511 bar
2512 </blockquote>
2513 !! html
2514 <blockquote>
2515 <p> foo
2516 </p><p> bar
2517 </p>
2518 </blockquote>
2519
2520 !!end
2521
2522 !!test
2523 4. Multiple spaces at start-of-line
2524 !! wikitext
2525 <p> foo </p>
2526 foo
2527 {|
2528 |foo
2529 |}
2530 !! html
2531 <p> foo </p>
2532 <pre> foo
2533 </pre>
2534 <table>
2535 <tr>
2536 <td>foo
2537 </td></tr></table>
2538
2539 !!end
2540
2541 ## NOTE: the leading white-space chars on empty line are significant
2542 !! test
2543 5a. White-space in indent-pre
2544 !! wikitext
2545 a<br />
2546
2547 b
2548 !! html
2549 <pre>a<br />
2550
2551 b
2552 </pre>
2553 !! end
2554
2555 ## NOTE: the leading white-space chars on empty line are significant
2556 !! test
2557 5b. White-space in indent-pre
2558 !! wikitext
2559 a
2560
2561 b
2562
2563
2564 c
2565 !! html
2566 <pre>a
2567
2568 b
2569
2570
2571 c
2572 </pre>
2573 !! end
2574
2575 !! test
2576 5c. White-space in indent-pre
2577 !! wikitext
2578 ''a''
2579 ''b''
2580 ''c''
2581 !! html
2582 <pre><i>a</i>
2583 <i>b</i>
2584 <i>c</i>
2585 </pre>
2586 !! end
2587
2588 !! test
2589 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2590 !! wikitext
2591 a
2592
2593 <!-- continue -->
2594 b
2595
2596 c
2597
2598 d
2599 !! html
2600 <pre>a
2601
2602 b
2603 </pre>
2604 <pre>c
2605
2606 </pre>
2607 <p>d
2608 </p>
2609 !! end
2610
2611 !! test
2612 7a. Indent-pre and category links
2613 !! options
2614 parsoid=wt2html,wt2wt
2615 !! wikitext
2616 [[Category:foo]] <!-- No pre-wrapping -->
2617 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2618 !! html
2619 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2620 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2621 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2622 !! end
2623
2624 !! test
2625 7b. Indent-pre and category links
2626 !! options
2627 parsoid=wt2html,wt2wt
2628 !! wikitext
2629 [[Category:foo]] a
2630 [[Category:foo]] {{echo|b}}
2631 !! html
2632 <pre>
2633 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2634
2635 <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>
2636 !! end
2637
2638 ###
2639 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2640 ###
2641
2642 !!test
2643 HTML-pre: 1. embedded newlines
2644 !! wikitext
2645 <pre>foo</pre>
2646
2647 <pre>
2648 foo
2649 </pre>
2650
2651 <pre>
2652
2653 foo
2654 </pre>
2655
2656 <pre>
2657
2658
2659 foo
2660 </pre>
2661 !! html
2662 <pre>foo</pre>
2663 <pre>
2664 foo
2665 </pre>
2666 <pre>
2667
2668 foo
2669 </pre>
2670 <pre>
2671
2672
2673 foo
2674 </pre>
2675
2676 !! html/parsoid
2677 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2678
2679 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2680 foo
2681 </pre>
2682
2683 <pre data-parsoid='{"stx":"html"}'>
2684
2685 foo
2686 </pre>
2687
2688 <pre data-parsoid='{"stx":"html"}'>
2689
2690
2691 foo
2692 </pre>
2693 !!end
2694
2695 !! test
2696 HTML-pre: big spaces
2697 !! wikitext
2698 <pre>
2699
2700
2701
2702
2703 haha
2704
2705
2706
2707
2708 haha
2709
2710
2711
2712
2713 </pre>
2714 !! html
2715 <pre>
2716
2717
2718
2719
2720 haha
2721
2722
2723
2724
2725 haha
2726
2727
2728
2729
2730 </pre>
2731
2732 !! html/parsoid
2733 <pre data-parsoid='{"stx":"html"}'>
2734
2735
2736
2737
2738 haha
2739
2740
2741
2742
2743 haha
2744
2745
2746
2747
2748 </pre>
2749 !! end
2750
2751 !!test
2752 HTML-pre: 2: indented text
2753 !! wikitext
2754 <pre>
2755 foo
2756 </pre>
2757 !! html
2758 <pre>
2759 foo
2760 </pre>
2761
2762 !!end
2763
2764 !!test
2765 HTML-pre: 3: other wikitext
2766 !! wikitext
2767 <pre>
2768 * foo
2769 # bar
2770 = no-h =
2771 '' no-italic ''
2772 [[ NoLink ]]
2773 </pre>
2774 !! html
2775 <pre>
2776 * foo
2777 # bar
2778 = no-h =
2779 '' no-italic ''
2780 [[ NoLink ]]
2781 </pre>
2782
2783 !!end
2784
2785 ###
2786 ### Definition lists
2787 ###
2788 !! test
2789 Simple definition
2790 !! wikitext
2791 ; name : Definition
2792 !! html
2793 <dl><dt> name&#160;</dt>
2794 <dd> Definition</dd></dl>
2795
2796 !! end
2797
2798 !! test
2799 Definition list for indentation only
2800 !! wikitext
2801 : Indented text
2802 !! html
2803 <dl><dd> Indented text</dd></dl>
2804
2805 !! end
2806
2807 !! test
2808 Definition list with no space
2809 !! wikitext
2810 ;name:Definition
2811 !! html
2812 <dl><dt>name</dt>
2813 <dd>Definition</dd></dl>
2814
2815 !!end
2816
2817 !! test
2818 Definition list with URL link
2819 !! wikitext
2820 ; http://example.com/ : definition
2821 !! html
2822 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2823 <dd> definition</dd></dl>
2824
2825 !! end
2826
2827 !! test
2828 Definition list with bracketed URL link
2829 !! wikitext
2830 ;[http://www.example.com/ Example]:Something about it
2831 !! html
2832 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2833 <dd>Something about it</dd></dl>
2834
2835 !! end
2836
2837 !! test
2838 Definition list with wikilink containing colon
2839 !! wikitext
2840 ; [[Help:FAQ]]: The least-read page on Wikipedia
2841 !! html
2842 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
2843 <dd> The least-read page on Wikipedia</dd></dl>
2844
2845 !! end
2846
2847 # At Brion's and JeLuF's insistence... :)
2848 !! test
2849 Definition list with news link containing colon
2850 !! wikitext
2851 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2852 !! html
2853 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2854 <dd> This isn't even a real newsgroup!</dd></dl>
2855
2856 !! end
2857
2858 !! test
2859 Malformed definition list with colon
2860 !! wikitext
2861 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2862 !! html
2863 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
2864
2865 !! end
2866
2867 !! test
2868 Definition lists: colon in external link text
2869 !! wikitext
2870 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2871 !! html
2872 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2873 <dd> OK, I made that up</dd></dl>
2874
2875 !! end
2876
2877 !! test
2878 Definition lists: colon in HTML attribute
2879 !! wikitext
2880 ;<b style="display: inline">bold</b>
2881 !! html
2882 <dl><dt><b style="display: inline">bold</b></dt></dl>
2883
2884 !! end
2885
2886 !! test
2887 Definition lists: self-closed tag
2888 !! wikitext
2889 ;one<br/>two : two-line fun
2890 !! html
2891 <dl><dt>one<br />two&#160;</dt>
2892 <dd> two-line fun</dd></dl>
2893
2894 !! end
2895
2896 !! test
2897 Bug 11748: Literal closing tags
2898 !! wikitext
2899 <dl>
2900 <dt>test 1</dt>
2901 <dd>test test test test test</dd>
2902 <dt>test 2</dt>
2903 <dd>test test test test test</dd>
2904 </dl>
2905 !! html
2906 <dl>
2907 <dt>test 1</dt>
2908 <dd>test test test test test</dd>
2909 <dt>test 2</dt>
2910 <dd>test test test test test</dd>
2911 </dl>
2912
2913 !! end
2914
2915 !! test
2916 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2917 !! wikitext
2918 <ul><li>
2919 ; term : description
2920 * unordered
2921 </li></ul>
2922 !! html
2923 <ul><li>
2924 <dl><dt> term&#160;</dt>
2925 <dd> description</dd></dl>
2926 <ul><li> unordered</li></ul>
2927 </li></ul>
2928
2929 !! end
2930
2931 !! test
2932
2933 Definition list with empty definition and following paragraph
2934 !! wikitext
2935 ; term:
2936 Paragraph text
2937 !! html
2938 <dl><dt> term</dt>
2939 <dd></dd></dl>
2940 <p>Paragraph text
2941 </p>
2942 !! end
2943
2944 !! test
2945 Nested definition lists using html syntax
2946 !! wikitext
2947 <dl><dt>x</dt>
2948 <dd>a</dd>
2949 <dd>b</dd></dl>
2950
2951 !! end
2952
2953 !! test
2954 Definition Lists: No nesting: Multiple dd's
2955 !! wikitext
2956 ;x
2957 :a
2958 :b
2959 !! html
2960 <dl><dt>x</dt>
2961 <dd>a</dd>
2962 <dd>b</dd></dl>
2963
2964 !! end
2965
2966 !! test
2967 Definition Lists: Indentation: Regular
2968 !! wikitext
2969 :i1
2970 ::i2
2971 :::i3
2972 !! html
2973 <dl><dd>i1
2974 <dl><dd>i2
2975 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
2976
2977 !! end
2978
2979 !! test
2980 Definition Lists: Indentation: Missing 1st level
2981 !! wikitext
2982 ::i2
2983 :::i3
2984 !! html
2985 <dl><dd><dl><dd>i2
2986 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
2987
2988 !! end
2989
2990 !! test
2991 Definition Lists: Indentation: Multi-level indent
2992 !! wikitext
2993 :::i3
2994 !! html
2995 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
2996
2997 !! end
2998
2999 !! test
3000 Definition Lists: Hacky use to indent tables
3001 !! wikitext
3002 ::{|
3003 |foo
3004 |bar
3005 |}
3006 this text
3007 should be left alone
3008 !! html
3009 <dl><dd><dl><dd><table>
3010 <tr>
3011 <td>foo
3012 </td>
3013 <td>bar
3014 </td></tr></table></dd></dl></dd></dl>
3015 <p>this text
3016 should be left alone
3017 </p>
3018 !! end
3019
3020 !! test
3021 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3022 !! wikitext
3023 <!-- foo -->
3024 ::{|
3025 |foo
3026 |bar
3027 |}<!-- bar -->
3028 this text
3029 should be left alone
3030 !! html/parsoid
3031 <!-- foo -->
3032 <dl><dd><dl><dd><table><tr>
3033 <td>foo</td>
3034 <td>bar</td>
3035 </tr></table><!-- bar --></dd></dl></dd></dl>
3036 <p>this text
3037 should be left alone</p>
3038 !! end
3039
3040 !! test
3041 Definition Lists: Hacky use to indent tables, with comment before table
3042 !! wikitext
3043 ::<!-- foo -->{|
3044 |foo
3045 |}
3046 !! html/parsoid
3047 <dl><dd><dl><dd><!-- foo --><table><tr>
3048 <td>foo</td>
3049 </tr></table></dd></dl></dd></dl>
3050 !! end
3051
3052 # Bug 52473
3053 !! test
3054 Definition Lists: Hacky use to indent tables (WS-insensitive)
3055 !! options
3056 parsoid
3057 !! wikitext
3058 : {|
3059 |a
3060 |}
3061 !! html
3062 <dl>
3063 <dd> <table><tr><td>a</td></tr></table> </dd>
3064 </dl>
3065 !! end
3066 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3067 ## as an empty dt item. It also ignores all but the last ";" when followed
3068 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3069 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3070 ## ";"s.
3071 ##
3072 ## Ex: ";;t2 ::d2" is transformed into:
3073 ##
3074 ## <dl>
3075 ## <dt>t2 </dt>
3076 ## <dd>
3077 ## <dl>
3078 ## <dt></dt>
3079 ## <dd>d2</dd>
3080 ## </dl>
3081 ## </dd>
3082 ## </dl>
3083 ##
3084 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3085 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3086 ##
3087 ## <dl>
3088 ## <dt>
3089 ## <dl>
3090 ## <dt>t2 </dt>
3091 ## <dd>:d2</dd>
3092 ## </dl>
3093 ## </dt>
3094 ## </dl>
3095 ##
3096 ## All Parsoid only definition list tests have this difference.
3097 ##
3098 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3099 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3100
3101 !! test
3102 Table / list interaction: indented table with lists in table contents
3103 !! wikitext
3104 :{|
3105 |-
3106 | a
3107 * b
3108 |-
3109 | c
3110 * d
3111 |}
3112 !! html
3113 <dl><dd><table>
3114
3115 <tr>
3116 <td> a
3117 <ul><li> b</li></ul>
3118 </td></tr>
3119 <tr>
3120 <td> c
3121 <ul><li> d</li></ul>
3122 </td></tr></table></dd></dl>
3123
3124 !! end
3125
3126 !!test
3127 Table / list interaction: lists nested in tables nested in indented lists
3128 !! wikitext
3129 :{|
3130 |
3131 :a
3132 :b
3133 |
3134 *c
3135 *d
3136 |}
3137
3138 *e
3139 *f
3140 !! html
3141 <dl><dd><table>
3142 <tr>
3143 <td>
3144 <dl><dd>a</dd>
3145 <dd>b</dd></dl>
3146 </td>
3147 <td>
3148 <ul><li>c</li>
3149 <li>d</li></ul>
3150 </td></tr></table></dd></dl>
3151 <ul><li>e</li>
3152 <li>f</li></ul>
3153
3154 !!end
3155
3156 !! test
3157 Definition Lists: Nesting: Multi-level (Parsoid only)
3158 !! options
3159 parsoid
3160 !! wikitext
3161 ;t1 :d1
3162 ;;t2 ::d2
3163 ;;;t3 :::d3
3164 !! html
3165 <dl>
3166 <dt>t1 </dt>
3167 <dd>d1</dd>
3168 <dt>
3169 <dl>
3170 <dt>t2 </dt>
3171 <dd>:d2</dd>
3172 <dt>
3173 <dl>
3174 <dt>t3 </dt>
3175 <dd>::d3</dd>
3176 </dl>
3177 </dt>
3178 </dl>
3179 </dt>
3180 </dl>
3181
3182
3183 !! end
3184
3185
3186 !! test
3187 Definition Lists: Nesting: Test 2 (Parsoid only)
3188 !! options
3189 parsoid
3190 !! wikitext
3191 ;t1
3192 ::d2
3193 !! html
3194 <dl>
3195 <dt>t1</dt>
3196 <dd>
3197 <dl>
3198 <dd>d2</dd>
3199 </dl>
3200 </dd>
3201 </dl>
3202
3203 !! end
3204
3205
3206 !! test
3207 Definition Lists: Nesting: Test 3 (Parsoid only)
3208 !! options
3209 parsoid
3210 !! wikitext
3211 :;t1
3212 ::::d2
3213 !! html
3214 <dl>
3215 <dd>
3216 <dl>
3217 <dt>t1</dt>
3218 <dd>
3219 <dl>
3220 <dd>
3221 <dl>
3222 <dd>d2</dd>
3223 </dl>
3224 </dd>
3225 </dl>
3226 </dd>
3227 </dl>
3228 </dd>
3229 </dl>
3230
3231 !! end
3232
3233
3234 !! test
3235 Definition Lists: Nesting: Test 4
3236 !! wikitext
3237 ::;t3
3238 :::d3
3239 !! html
3240 <dl><dd><dl><dd><dl><dt>t3</dt>
3241 <dd>d3</dd></dl></dd></dl></dd></dl>
3242
3243 !! end
3244
3245
3246 ## The Parsoid team believes the following three test exposes a
3247 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3248 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3249 !! test
3250 Definition Lists: Mixed Lists: Test 1
3251 !! wikitext
3252 :;* foo
3253 ::* bar
3254 :; baz
3255 !! html/php
3256 <dl><dd><dl><dt><ul><li> foo</li>
3257 <li> bar</li></ul></dt></dl>
3258 <dl><dt> baz</dt></dl></dd></dl>
3259
3260 !! html/parsoid
3261 <dl>
3262 <dd><dl>
3263 <dt><ul>
3264 <li> foo
3265 </li>
3266 </ul></dt>
3267 <dd><ul>
3268 <li> bar
3269 </li>
3270 </ul></dd>
3271 <dt> baz</dt>
3272 </dl></dd>
3273 </dl>
3274 !! end
3275
3276 !! test
3277 Definition Lists: Mixed Lists: Test 2
3278 !! wikitext
3279 *: d1
3280 *: d2
3281 !! html
3282 <ul><li><dl><dd> d1</dd>
3283 <dd> d2</dd></dl></li></ul>
3284
3285 !! end
3286
3287
3288 !! test
3289 Definition Lists: Mixed Lists: Test 3
3290 !! wikitext
3291 *::: d1
3292 *::: d2
3293 !! html
3294 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3295 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3296
3297 !! end
3298
3299
3300 !! test
3301 Definition Lists: Mixed Lists: Test 4
3302 !! wikitext
3303 *;d1 :d2
3304 *;d3 :d4
3305 !! html
3306 <ul><li><dl><dt>d1&#160;</dt>
3307 <dd>d2</dd>
3308 <dt>d3&#160;</dt>
3309 <dd>d4</dd></dl></li></ul>
3310
3311 !! end
3312
3313
3314 !! test
3315 Definition Lists: Mixed Lists: Test 5
3316 !! wikitext
3317 *:d1
3318 *:: d2
3319 !! html
3320 <ul><li><dl><dd>d1
3321 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3322
3323 !! end
3324
3325
3326 !! test
3327 Definition Lists: Mixed Lists: Test 6
3328 !! wikitext
3329 #*:d1
3330 #*::: d3
3331 !! html
3332 <ol><li><ul><li><dl><dd>d1
3333 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3334
3335 !! end
3336
3337
3338 !! test
3339 Definition Lists: Mixed Lists: Test 7
3340 !! wikitext
3341 :* d1
3342 :* d2
3343 !! html
3344 <dl><dd><ul><li> d1</li>
3345 <li> d2</li></ul></dd></dl>
3346
3347 !! end
3348
3349
3350 !! test
3351 Definition Lists: Mixed Lists: Test 8
3352 !! wikitext
3353 :* d1
3354 ::* d2
3355 !! html
3356 <dl><dd><ul><li> d1</li></ul>
3357 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3358
3359 !! end
3360
3361
3362 !! test
3363 Definition Lists: Mixed Lists: Test 9
3364 !! wikitext
3365 *;foo :bar
3366 !! html
3367 <ul><li><dl><dt>foo&#160;</dt>
3368 <dd>bar</dd></dl></li></ul>
3369
3370 !! end
3371
3372
3373 !! test
3374 Definition Lists: Mixed Lists: Test 10
3375 !! wikitext
3376 *#;foo :bar
3377 !! html
3378 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3379 <dd>bar</dd></dl></li></ol></li></ul>
3380
3381 !! end
3382
3383 # The Parsoid team disagrees with the PHP parser's seemingly-random
3384 # rules regarding dd/dt on the next two tests. Parsoid is more
3385 # consistent, and recognizes the shared nesting and keeps the
3386 # still-open tags around until the nesting is complete.
3387
3388 !! test
3389 Definition Lists: Mixed Lists: Test 11
3390 !! wikitext
3391 *#*#;*;;foo :bar
3392 *#*#;boo :baz
3393 !! html/php
3394 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3395 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3396 <dl><dt>boo&#160;</dt>
3397 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3398
3399 !! html/parsoid
3400 <ul>
3401 <li>
3402 <ol>
3403 <li>
3404 <ul>
3405 <li>
3406 <ol>
3407 <li>
3408 <dl>
3409 <dt>
3410 <ul>
3411 <li>
3412 <dl>
3413 <dt>
3414 <dl>
3415 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3416 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3417 </dl></dt>
3418 </dl></li>
3419 </ul></dt>
3420 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3421 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3422 </dl></li>
3423 </ol></li>
3424 </ul></li>
3425 </ol></li>
3426 </ul>
3427 !! end
3428
3429
3430 !! test
3431 Definition Lists: Weird Ones: Test 1
3432 !! wikitext
3433 *#;*::;; foo : bar (who uses this?)
3434 !! html/php
3435 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3436 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3437
3438 !! html/parsoid
3439 <ul>
3440 <li>
3441 <ol>
3442 <li>
3443 <dl>
3444 <dt>
3445 <ul>
3446 <li>
3447 <dl>
3448 <dd>
3449 <dl>
3450 <dd>
3451 <dl>
3452 <dt>
3453 <dl>
3454 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3455 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3456 </dl></dt>
3457 </dl></dd>
3458 </dl></dd>
3459 </dl></li>
3460 </ul></dt>
3461 </dl></li>
3462 </ol></li>
3463 </ul>
3464 !! end
3465
3466 ###
3467 ### External links
3468 ###
3469 !! test
3470 External links: non-bracketed
3471 !! wikitext
3472 Non-bracketed: http://example.com
3473 !! html
3474 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3475 </p>
3476 !! end
3477
3478 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3479 !! test
3480 External links: numbered
3481 !! wikitext
3482 Numbered: [http://example.com]
3483 Numbered: [http://example.net]
3484 Numbered: [http://example.com]
3485 !! html/php
3486 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3487 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3488 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3489 </p>
3490 !! html/parsoid
3491 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3492 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3493 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3494 !!end
3495
3496 !! test
3497 External links: specified text
3498 !! wikitext
3499 Specified text: [http://example.com link]
3500 !! html
3501 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3502 </p>
3503 !!end
3504
3505 !! test
3506 External links: trail
3507 !! wikitext
3508 Linktrails should not work for external links: [http://example.com link]s
3509 !! html
3510 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3511 </p>
3512 !! end
3513
3514 !! test
3515 External links: dollar sign in URL
3516 !! wikitext
3517 http://example.com/1$2345
3518 !! html
3519 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3520 </p>
3521 !! end
3522
3523 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3524 !! test
3525 External links: dollar sign in URL (autonumber)
3526 !! wikitext
3527 [http://example.com/1$2345]
3528 !! html/php
3529 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3530 </p>
3531 !! html/parsoid
3532 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3533 !!end
3534
3535 !! test
3536 External links: open square bracket forbidden in URL (bug 4377)
3537 !! options
3538 parsoid=wt2html,wt2wt,html2html
3539 !! wikitext
3540 http://example.com/1[2345
3541 !! html/php
3542 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3543 </p>
3544 !! html/parsoid
3545 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3546 !! end
3547
3548 !! test
3549 External links: open square bracket forbidden in URL (named) (bug 4377)
3550 !! options
3551 parsoid=wt2html,html2html
3552 !! wikitext
3553 [http://example.com/1[2345]
3554 !! html/php
3555 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3556 </p>
3557 !! html/parsoid
3558 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3559 !!end
3560
3561 # parsoid adds a space before the link name
3562 !! test
3563 External links: open square bracket forbidden in URL (named) (bug 4377)
3564 Parsoid variant.
3565 !! wikitext
3566 [http://example.com/1 [2345]
3567 !! html
3568 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3569 </p>
3570 !!end
3571
3572 !! test
3573 External links: nowiki in URL link text (bug 6230)
3574 !! wikitext
3575 [http://example.com/ <nowiki>''example site''</nowiki>]
3576 !! html
3577 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3578 </p>
3579 !! end
3580
3581 !! test
3582 External links: newline forbidden in text (bug 6230 regression check)
3583 !! wikitext
3584 [http://example.com/ first
3585 second]
3586 !! html
3587 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3588 second]
3589 </p>
3590 !!end
3591
3592 !! test
3593 External links: Pipe char between url and text
3594 !! wikitext
3595 [http://example.com | link]
3596 !! html
3597 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3598 </p>
3599 !!end
3600
3601 !! test
3602 External links: protocol-relative URL in brackets
3603 !! wikitext
3604 [//example.com/ Test]
3605 !! html
3606 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3607 </p>
3608 !! end
3609
3610 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3611 !! test
3612 External links: protocol-relative URL in brackets without text
3613 !! wikitext
3614 [//example.com]
3615 !! html/php
3616 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3617 </p>
3618 !! html/parsoid
3619 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3620 !! end
3621
3622 !! test
3623 External links: protocol-relative URL in free text is left alone
3624 !! wikitext
3625 //example.com/Foo
3626 !! html
3627 <p>//example.com/Foo
3628 </p>
3629 !!end
3630
3631 !! test
3632 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3633 !! wikitext
3634 foo//example.com/Foo
3635 !! html
3636 <p>foo//example.com/Foo
3637 </p>
3638 !! end
3639
3640 !! test
3641 External links: with no contents
3642 !! wikitext
3643 [http://en.wikipedia.org/wiki/Foo]
3644
3645 [[wikipedia:Foo|Bar]]
3646
3647 [[wikipedia:Foo|<span>Bar</span>]]
3648 !! html/parsoid
3649 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3650 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3651 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3652 !! end
3653
3654 !! test
3655 External image
3656 !! wikitext
3657 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3658 !! html
3659 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3660 </p>
3661 !! end
3662
3663 !! test
3664 External image from https
3665 !! wikitext
3666 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3667 !! html
3668 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3669 </p>
3670 !! end
3671
3672 !! test
3673 External image (when not allowed)
3674 !! options
3675 wgAllowExternalImages=0
3676 !! wikitext
3677 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3678 !! html
3679 <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>
3680 </p>
3681 !! end
3682
3683 !! test
3684 Link to non-http image, no img tag
3685 !! wikitext
3686 Link to non-http image, no img tag: ftp://example.com/test.jpg
3687 !! html
3688 <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>
3689 </p>
3690 !! end
3691
3692 !! test
3693 External links: terminating separator
3694 !! wikitext
3695 Terminating separator: http://example.com/thing,
3696 !! html
3697 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3698 </p>
3699 !! end
3700
3701 !! test
3702 External links: intervening separator
3703 !! wikitext
3704 Intervening separator: http://example.com/1,2,3
3705 !! html
3706 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3707 </p>
3708 !! end
3709
3710 !! test
3711 External links: old bug with URL in query
3712 !! wikitext
3713 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3714 !! html
3715 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3716 </p>
3717 !! end
3718
3719 !! test
3720 External links: old URL-in-URL bug, mixed protocols
3721 !! wikitext
3722 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3723 !! html
3724 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3725 </p>
3726 !!end
3727
3728 !! test
3729 External links: URL in text
3730 !! wikitext
3731 URL in text: [http://example.com http://example.com]
3732 !! html
3733 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3734 </p>
3735 !! end
3736
3737 !! test
3738 External links: Clickable images
3739 !! wikitext
3740 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3741 !! html
3742 <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>
3743 </p>
3744 !!end
3745
3746 !! test
3747 External links: raw ampersand
3748 !! wikitext
3749 Old &amp; use: http://x&y
3750 !! html
3751 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3752 </p>
3753 !! end
3754
3755 !! test
3756 External links: encoded ampersand
3757 !! wikitext
3758 Old &amp; use: http://x&amp;y
3759 !! html/php
3760 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3761 </p>
3762 !! html/parsoid
3763 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3764 !! end
3765
3766 !! test
3767 External links: encoded equals (bug 6102)
3768 !! wikitext
3769 http://example.com/?foo&#61;bar
3770 !! html/php
3771 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3772 </p>
3773 !! html/parsoid
3774 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3775 !! end
3776
3777 ##
3778 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3779 ## does it number them. As discussed in bug 53505, we can identify
3780 ## autonumbered links via CSS.
3781 ##
3782
3783 !! test
3784 External links: [raw ampersand]
3785 !! wikitext
3786 Old &amp; use: [http://x&y]
3787 !! html/php
3788 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3789 </p>
3790 !! html/parsoid
3791 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3792 !! end
3793
3794 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3795 # mode will return the [raw ampersand] wikitext
3796 !! test
3797 External links: [encoded ampersand]
3798 !! options
3799 parsoid=wt2html,wt2wt,html2html
3800 !! wikitext
3801 Old &amp; use: [http://x&amp;y]
3802 !! html/php
3803 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3804 </p>
3805 !! html/parsoid
3806 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3807 !! end
3808
3809 !! test
3810 External links: [raw equals]
3811 !! wikitext
3812 [http://example.com/?foo=bar]
3813 !! html/php
3814 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3815 </p>
3816 !! html/parsoid
3817 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3818 !! end
3819
3820 # note that parsoid html is identical to [raw equals] case; so html2wt
3821 # mode will return the [raw equals] wikitext
3822 !! test
3823 External links: [encoded equals] (bug 6102)
3824 !! options
3825 parsoid=wt2html,wt2wt,html2html
3826 !! wikitext
3827 [http://example.com/?foo&#61;bar]
3828 !! html/php
3829 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3830 </p>
3831 !! html/parsoid
3832 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3833 !! end
3834
3835 # xxx parsoid strips the IDN character, so the round-trip tests will
3836 # obviously fail and are disabled. --cscott
3837 !! test
3838 External links: [IDN ignored character reference in hostname; strip it right off]
3839 !! options
3840 parsoid=wt2html,wt2wt,html2html
3841 !! wikitext
3842 [http://e&zwnj;xample.com/]
3843 !! html/php
3844 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3845 </p>
3846 !! html/parsoid
3847 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3848 !! end
3849
3850 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3851 # Where an external link could easily circumvent the sanitization of the text of
3852 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3853 # test demands a higher standard. That's a bit strange.
3854 #
3855 # Example:
3856 #
3857 # http://e‌xample.com -> [http://example.com|http://example.com]
3858 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3859 #
3860 # The first example is sanitized, but the second is not. Any security benefits
3861 # from this production are trivial to circumvent. Either remove this test and
3862 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3863 # the test accordingly.
3864 #
3865 # All our love,
3866 # The Parsoid team.
3867 # xxx parsoid strips the IDN character, so the round-trip tests will
3868 # obviously fail and are disabled. --cscott
3869 !! test
3870 External links: IDN ignored character reference in hostname; strip it right off
3871 !! options
3872 parsoid=wt2html,html2html
3873 !! wikitext
3874 http://e&zwnj;xample.com/
3875 !! html/php
3876 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3877 </p>
3878 !! html/parsoid
3879 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
3880 !! end
3881
3882 !! test
3883 External links: www.jpeg.org (bug 554)
3884 !! wikitext
3885 http://www.jpeg.org
3886 !! html
3887 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3888 </p>
3889 !! end
3890
3891 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3892 !! test
3893 External links: URL within URL (original bug 2)
3894 !! wikitext
3895 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3896 !! html/php
3897 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3898 </p>
3899 !! html/parsoid
3900 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
3901 !! end
3902
3903 !! test
3904 BUG 361: URL inside bracketed URL
3905 !! wikitext
3906 [http://www.example.com/foo http://www.example.com/bar]
3907 !! html
3908 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3909 </p>
3910 !! end
3911
3912 !! test
3913 BUG 361: URL within URL, not bracketed
3914 !! wikitext
3915 http://www.example.com/foo?=http://www.example.com/bar
3916 !! html
3917 <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>
3918 </p>
3919 !! end
3920
3921 !! test
3922 BUG 289: ">"-token in URL-tail
3923 !! wikitext
3924 http://www.example.com/<hello>
3925 !! html
3926 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3927 </p>
3928 !!end
3929
3930 !! test
3931 BUG 289: literal ">"-token in URL-tail
3932 !! wikitext
3933 http://www.example.com/<b>html</b>
3934 !! html
3935 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3936 </p>
3937 !!end
3938
3939 !! test
3940 BUG 289: ">"-token in bracketed URL
3941 !! wikitext
3942 [http://www.example.com/<hello> stuff]
3943 !! html
3944 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3945 </p>
3946 !!end
3947
3948 !! test
3949 BUG 289: literal ">"-token in bracketed URL
3950 !! wikitext
3951 [http://www.example.com/<b>html</b> stuff]
3952 !! html
3953 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3954 </p>
3955 !!end
3956
3957 !! test
3958 BUG 289: literal double quote at end of URL
3959 !! wikitext
3960 http://www.example.com/"hello"
3961 !! html
3962 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3963 </p>
3964 !!end
3965
3966 !! test
3967 BUG 289: literal double quote in bracketed URL
3968 !! wikitext
3969 [http://www.example.com/"hello" stuff]
3970 !! html
3971 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3972 </p>
3973 !!end
3974
3975 !! test
3976 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3977 !! wikitext
3978 [http://www.example.com test]
3979 !! html
3980 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3981 </p>
3982 !! end
3983
3984 !! test
3985 External links: link text with spaces
3986 !! wikitext
3987 [http://www.example.com a b c]
3988 [http://www.example.com ''a'' ''b'']
3989 !! html
3990 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3991 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3992 </p>
3993 !! end
3994
3995 !! test
3996 External links: wiki links within external link (Bug 3695)
3997 !! wikitext
3998 [http://example.com [[wikilink]] embedded in ext link]
3999 !! html/php
4000 <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>
4001 </p>
4002 !! html/parsoid
4003 <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>
4004 !! end
4005
4006 !! test
4007 BUG 787: Links with one slash after the url protocol are invalid
4008 !! wikitext
4009 http:/example.com
4010
4011 [http:/example.com title]
4012 !! html
4013 <p>http:/example.com
4014 </p><p>[http:/example.com title]
4015 </p>
4016 !! end
4017
4018 !! test
4019 Bracketed external links with template-generated invalid target
4020 !! wikitext
4021 [{{echo|http:/example.com}} title]
4022 !! html
4023 <p>[http:/example.com title]
4024 </p>
4025 !! end
4026
4027 !! test
4028 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4029 !! wikitext
4030 ''[http://example.com text'']
4031 [http://example.com '''text]'''
4032 ''Something [http://example.com in italic'']
4033 ''Something [http://example.com mixed''''', even bold]'''
4034 '''''Now [http://example.com both''''']
4035 !! html
4036 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4037 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4038 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4039 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4040 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4041 </p>
4042 !! end
4043
4044
4045 !! test
4046 Bug 4781: %26 in URL
4047 !! wikitext
4048 http://www.example.com/?title=AT%26T
4049 !! html/php
4050 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4051 </p>
4052 !! html/parsoid
4053 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4054 !! end
4055
4056 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4057 # % is actually legal in HTML5. Any change in output would need testing though.
4058 !! test
4059 Bug 4781, 5267: %25 in URL
4060 !! wikitext
4061 http://www.example.com/?title=100%25_Bran
4062 !! html/php
4063 <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>
4064 </p>
4065 !! html/parsoid
4066 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4067 !! end
4068
4069 !! test
4070 Bug 4781, 5267: %28, %29 in URL
4071 !! wikitext
4072 http://www.example.com/?title=Ben-Hur_%281959_film%29
4073 !! html/php
4074 <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>
4075 </p>
4076 !! html/parsoid
4077 <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>
4078 !! end
4079
4080
4081 !! test
4082 Bug 4781: %26 in autonumber URL
4083 !! wikitext
4084 [http://www.example.com/?title=AT%26T]
4085 !! html/php
4086 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4087 </p>
4088 !! html/parsoid
4089 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4090 !! end
4091
4092 !! test
4093 Bug 4781, 5267: %26 in autonumber URL
4094 !! wikitext
4095 [http://www.example.com/?title=100%25_Bran]
4096 !! html/php
4097 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4098 </p>
4099 !! html/parsoid
4100 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4101 !! end
4102
4103 !! test
4104 Bug 4781, 5267: %28, %29 in autonumber URL
4105 !! wikitext
4106 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4107 !! html/php
4108 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4109 </p>
4110 !! html/parsoid
4111 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4112 !! end
4113
4114
4115 !! test
4116 Bug 4781: %26 in bracketed URL
4117 !! wikitext
4118 [http://www.example.com/?title=AT%26T link]
4119 !! html/php
4120 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4121 </p>
4122 !! html/parsoid
4123 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4124 !! end
4125
4126 !! test
4127 Bug 4781, 5267: %25 in bracketed URL
4128 !! wikitext
4129 [http://www.example.com/?title=100%25_Bran link]
4130 !! html
4131 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4132 </p>
4133 !! end
4134
4135 !! test
4136 Bug 4781, 5267: %28, %29 in bracketed URL
4137 !! wikitext
4138 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4139 !! html/php
4140 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4141 </p>
4142 !! html/parsoid
4143 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4144 !! end
4145
4146 # Note that parsoid does not munge anchor text; all non-space
4147 # characters are valid in HTML5 ids.
4148 !! test
4149 Anchor containing a #. (bug 63430)
4150 !! wikitext
4151 [[Main Page#And#Link]]
4152 !! html/php
4153 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
4154 </p>
4155 !! html/parsoid
4156 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
4157 !! end
4158
4159 # Note that parsoid does not munge anchor text; all non-space
4160 # characters are valid in HTML5 ids.
4161 !! test
4162 Anchor containing a #. (bug 63430)
4163 !! wikitext
4164 [[Main Page#And#Link]]
4165 !! html/php
4166 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
4167 </p>
4168 !! html/parsoid
4169 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
4170 !! end
4171
4172 !! test
4173 External link containing a period in the anchor. (bug 63947)
4174 !! wikitext
4175 [//foo.org/bar#baz. bang]
4176
4177 [//foo.org/bar. bang]
4178 !! html/php
4179 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4180 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4181 </p>
4182 !! html/parsoid
4183 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4184 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4185 !! end
4186
4187 !! test
4188 External link containing a single quote. (bug 63947)
4189 !! wikitext
4190 [//foo.org/bar'baz]
4191
4192 [//foo.org/bar'baz bang]
4193 !! html/php
4194 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4195 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4196 </p>
4197 !! html/parsoid
4198 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4199 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4200 !! end
4201
4202
4203 !! test
4204 External link containing a period in the anchor. (bug 63947)
4205 !! wikitext
4206 [//foo.org/bar#baz. bang]
4207
4208 [//foo.org/bar. bang]
4209 !! html/php
4210 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4211 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4212 </p>
4213 !! html/parsoid
4214 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4215 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4216 !! end
4217
4218 !! test
4219 External link containing a single quote. (bug 63947)
4220 !! wikitext
4221 [//foo.org/bar'baz]
4222
4223 [//foo.org/bar'baz bang]
4224 !! html/php
4225 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4226 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4227 </p>
4228 !! html/parsoid
4229 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4230 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4231 !! end
4232
4233
4234 !! test
4235 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4236 !! wikitext
4237 Some [http://example.com/ pretty ''italics'' and stuff]!
4238 !! html
4239 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4240 </p>
4241 !! end
4242
4243 !! test
4244 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4245 !! wikitext
4246 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4247 !! html
4248 <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>
4249 </p>
4250 !! end
4251
4252 !! test
4253 External link containing double-single-quotes with no space separating the url from text in italics
4254 !! wikitext
4255 [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]].]
4256 !! html/php
4257 <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>
4258 </p>
4259 !! html/parsoid
4260 <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>
4261 !! end
4262
4263 !! test
4264 External link with comments in link text
4265 !! wikitext
4266 [http://www.google.com Google <!-- comment -->]
4267 !! html
4268 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4269 </p>
4270 !! end
4271
4272 !! test
4273 URL-encoding in URL functions (single parameter)
4274 !! wikitext
4275 {{localurl:Some page|amp=&}}
4276 !! html
4277 <p>/index.php?title=Some_page&amp;amp=&amp;
4278 </p>
4279 !! end
4280
4281 !! test
4282 URL-encoding in URL functions (multiple parameters)
4283 !! wikitext
4284 {{localurl:Some page|q=?&amp=&}}
4285 !! html
4286 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4287 </p>
4288 !! end
4289
4290 !! test
4291 Brackets in urls
4292 !! wikitext
4293 http://example.com/index.php?foozoid%5B%5D=bar
4294
4295 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4296 !! html/php
4297 <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>
4298 </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>
4299 </p>
4300 !! html/parsoid
4301 <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>
4302
4303 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4304 !! end
4305
4306 !! test
4307 IPv6 urls (bug 21261)
4308 !! options
4309 disabled
4310 !! wikitext
4311 http://[2404:130:0:1000::187:2]/index.php
4312 !! html
4313 <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>
4314 </p>
4315 !! end
4316
4317 !! test
4318 Non-extlinks in brackets
4319 !! wikitext
4320 [foo]
4321 [foo bar]
4322 [foo ''bar'']
4323 [fool's] errand
4324 [fool's errand]
4325 [{{echo|foo}}]
4326 [{{echo|foo}} bar]
4327 [{{echo|foo}} ''bar'']
4328 [{{echo|foo}}l's] errand
4329 [{{echo|foo}}l's errand]
4330 [url={{echo|foo}}]
4331 [url=http://example.com]
4332 !! html
4333 <p>[foo]
4334 [foo bar]
4335 [foo <i>bar</i>]
4336 [fool's] errand
4337 [fool's errand]
4338 [foo]
4339 [foo bar]
4340 [foo <i>bar</i>]
4341 [fool's] errand
4342 [fool's errand]
4343 [url=foo]
4344 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4345 </p>
4346 !! end
4347
4348 !! test
4349 Percent encoding in external links
4350 !! wikitext
4351 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4352 !! html/php
4353 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4354 </p>
4355 !! html/parsoid
4356 <p><a rel="mw:ExtLink"
4357 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4358 !! end
4359
4360 !! test
4361 Use url link syntax for links where the content is equal the link target
4362 !! wikitext
4363 http://example.com
4364 !! html/php
4365 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4366 </p>
4367 !! html/parsoid
4368 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4369 !! end
4370
4371 !! test
4372 Parenthesis in external links, especially URL links
4373 !! wikitext
4374 http://example.com)
4375
4376 http://example.com/test)
4377
4378 http://example.com/(test)
4379
4380 http://example.com/((test)
4381
4382 (http://example.com/(test))
4383
4384 (http://example.com/(test)))))
4385
4386 http://example.com/a)b
4387
4388 [http://example.com) foo]
4389 !! html/php
4390 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4391 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4392 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4393 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4394 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4395 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4396 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4397 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4398 </p>
4399 !! html/parsoid
4400 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4401 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4402 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4403 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4404 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4405 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4406 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4407 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4408 !! end
4409
4410 !! test
4411 Parenthesis in external links, w/ transclusion or comment
4412 !! wikitext
4413 (http://example.com/{{echo|hi}})
4414
4415 (http://example.com<!-- hi -->)
4416 !! html/php
4417 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4418 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4419 </p>
4420 !! html/parsoid
4421 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4422
4423 <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>
4424 !! end
4425
4426 ###
4427 ### Quotes
4428 ###
4429
4430 !! test
4431 Quotes
4432 !! wikitext
4433 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4434
4435 Normal text. '''''Bold italic text.''''' Normal text.
4436 !! html
4437 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4438 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4439 </p>
4440 !! end
4441
4442
4443 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4444 # parser strips. The wikitext contains just the first half of the bold
4445 # quote pair.
4446 !! test
4447 Unclosed and unmatched quotes
4448 !! wikitext
4449 '''''Bold italic text '''with bold deactivated''' in between.'''''
4450
4451 '''''Bold italic text ''with italic deactivated'' in between.'''''
4452
4453 '''Bold text..
4454
4455 ..spanning two paragraphs (should not work).'''
4456
4457 '''Bold tag left open
4458
4459 ''Italic tag left open
4460
4461 Normal text.
4462
4463 <!-- Unmatching number of opening, closing tags: -->
4464 '''This year''''s election ''should'' beat '''last year''''s.
4465
4466 ''Tom'''s car is bigger than ''Susan'''s.
4467
4468 Plain ''italic'''s plain
4469 !! html/php
4470 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4471 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4472 </p><p><b>Bold text..</b>
4473 </p><p>..spanning two paragraphs (should not work).
4474 </p><p><b>Bold tag left open</b>
4475 </p><p><i>Italic tag left open</i>
4476 </p><p>Normal text.
4477 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4478 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4479 </p><p>Plain <i>italic'</i>s plain
4480 </p>
4481 !! html/parsoid
4482 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4483 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4484 </p><p><b>Bold text..</b>
4485 </p><p>..spanning two paragraphs (should not work).<b></b>
4486 </p><p><b>Bold tag left open</b>
4487 </p><p><i>Italic tag left open</i>
4488 </p><p>Normal text.
4489 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4490 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4491 </p><p>Plain <i>italic'</i>s plain
4492 </p>
4493 !! end
4494
4495 ###
4496 ### Tables
4497 ###
4498 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4499 ###
4500
4501 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4502 # is the bare minimum required by the spec, see:
4503 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4504 # Parsoid team replies: empty table tags are legal in HTML5
4505 !! test
4506 A table with no data.
4507 !! options
4508 parsoid=wt2html
4509 !! wikitext
4510 {||}
4511 !! html/php
4512
4513 !! html/parsoid
4514 <table></table>
4515
4516 !! end
4517
4518 !! test
4519 A table with stray table end tags on start tag line (wt2html)
4520 !! options
4521 parsoid=wt2html
4522 !! wikitext
4523 {|style="color: red;"|}
4524
4525 {|style="color: red;" |}
4526 |foo
4527 |}
4528
4529 {|style="color: red;"|} id="foo"
4530 |foo
4531 |}
4532
4533 {|style="color: red;" |} id="foo"
4534 |foo
4535 |}
4536 !! html
4537 <table style="color: red;"></table>
4538
4539 <table style="color: red;">
4540 <tbody><tr>
4541 <td>foo</td>
4542 </tr></tbody>
4543 </table>
4544
4545 <table style="color: red;" id="foo">
4546 <tbody><tr>
4547 <td>foo</td>
4548 </tr></tbody>
4549 </table>
4550
4551 <table style="color: red;" id="foo">
4552 <tbody><tr>
4553 <td>foo</td>
4554 </tr></tbody>
4555 </table>
4556
4557 !! end
4558
4559 !! test
4560 A table with no data (take 2)
4561 !! wikitext
4562 {|
4563 |}
4564 !! html/parsoid
4565 <table></table>
4566 !! end
4567
4568 # A table with nothing but a caption is invalid XHTML, we might want to render
4569 # this as <p>caption</p>
4570 # Parsoid team replies: table with only a caption is legal in HTML5
4571 !! test
4572 A table with nothing but a caption
4573 !! wikitext
4574 {|
4575 |+ caption
4576 |}
4577 !! html/php
4578 <table>
4579 <caption> caption
4580 </caption><tr><td></td></tr></table>
4581
4582 !! html/parsoid
4583 <table><caption> caption</caption></table>
4584 !! end
4585
4586 !! test
4587 A table with caption with default-spaced attributes and a table row
4588 !! wikitext
4589 {|
4590 |+ style="color: red;" | caption1
4591 |-
4592 | foo
4593 |}
4594 !! html
4595 <table>
4596 <caption style="color: red;"> caption1
4597 </caption>
4598 <tr>
4599 <td> foo
4600 </td></tr></table>
4601
4602 !! end
4603
4604 !! test
4605 A table with captions with non-default spaced attributes and a table row
4606 !! wikitext
4607 {|
4608 |+style="color: red;"|caption2
4609 |+ style="color: red;"| caption3
4610 |-
4611 | foo
4612 |}
4613 !! html
4614 <table>
4615 <caption style="color: red;">caption2
4616 </caption>
4617 <caption style="color: red;"> caption3
4618 </caption>
4619 <tr>
4620 <td> foo
4621 </td></tr></table>
4622
4623 !! end
4624
4625 !! test
4626 Table td-cell syntax variations
4627 !! wikitext
4628 {|
4629 | foo bar foo | baz
4630 | foo bar foo || baz
4631 | style='color:red;' | baz
4632 | style='color:red;' || baz
4633 |}
4634 !! html
4635 <table>
4636 <tr>
4637 <td> baz
4638 </td>
4639 <td> foo bar foo </td>
4640 <td> baz
4641 </td>
4642 <td style="color:red;"> baz
4643 </td>
4644 <td> style='color:red;' </td>
4645 <td> baz
4646 </td></tr></table>
4647
4648 !! end
4649
4650 !! test
4651 Simple table
4652 !! wikitext
4653 {|
4654 | 1 || 2
4655 |-
4656 | 3 || 4
4657 |}
4658 !! html
4659 <table>
4660 <tr>
4661 <td> 1 </td>
4662 <td> 2
4663 </td></tr>
4664 <tr>
4665 <td> 3 </td>
4666 <td> 4
4667 </td></tr></table>
4668
4669 !! end
4670
4671 !! test
4672 Simple table but with multiple dashes for row wikitext
4673 !! wikitext
4674 {|
4675 | foo
4676 |-----
4677 | bar
4678 |}
4679 !! html
4680 <table>
4681 <tr>
4682 <td> foo
4683 </td></tr>
4684 <tr>
4685 <td> bar
4686 </td></tr></table>
4687
4688 !! end
4689 !! test
4690 Multiplication table
4691 !! wikitext
4692 {| border="1" cellpadding="2"
4693 |+Multiplication table
4694 |-
4695 ! &times; !! 1 !! 2 !! 3
4696 |-
4697 ! 1
4698 | 1 || 2 || 3
4699 |-
4700 ! 2
4701 | 2 || 4 || 6
4702 |-
4703 ! 3
4704 | 3 || 6 || 9
4705 |-
4706 ! 4
4707 | 4 || 8 || 12
4708 |-
4709 ! 5
4710 | 5 || 10 || 15
4711 |}
4712 !! html
4713 <table border="1" cellpadding="2">
4714 <caption>Multiplication table
4715 </caption>
4716 <tr>
4717 <th> &#215; </th>
4718 <th> 1 </th>
4719 <th> 2 </th>
4720 <th> 3
4721 </th></tr>
4722 <tr>
4723 <th> 1
4724 </th>
4725 <td> 1 </td>
4726 <td> 2 </td>
4727 <td> 3
4728 </td></tr>
4729 <tr>
4730 <th> 2
4731 </th>
4732 <td> 2 </td>
4733 <td> 4 </td>
4734 <td> 6
4735 </td></tr>
4736 <tr>
4737 <th> 3
4738 </th>
4739 <td> 3 </td>
4740 <td> 6 </td>
4741 <td> 9
4742 </td></tr>
4743 <tr>
4744 <th> 4
4745 </th>
4746 <td> 4 </td>
4747 <td> 8 </td>
4748 <td> 12
4749 </td></tr>
4750 <tr>
4751 <th> 5
4752 </th>
4753 <td> 5 </td>
4754 <td> 10 </td>
4755 <td> 15
4756 </td></tr></table>
4757
4758 !! end
4759
4760 !! test
4761 Accept "||" in table headings
4762 !! wikitext
4763 {|
4764 !h1 || h2
4765 |}
4766 !! html
4767 <table>
4768 <tr>
4769 <th>h1 </th>
4770 <th> h2
4771 </th></tr></table>
4772
4773 !! end
4774
4775 !! test
4776 Accept "||" in indented table headings
4777 !! wikitext
4778 :{|
4779 !h1 || h2
4780 |}
4781 !! html
4782 <dl><dd><table>
4783 <tr>
4784 <th>h1 </th>
4785 <th> h2
4786 </th></tr></table></dd></dl>
4787
4788 !! end
4789
4790 !! test
4791 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4792 !! wikitext
4793 {|
4794 !| h1
4795 || a
4796 |}
4797 !! html
4798 <table>
4799 <tr>
4800 <th> h1
4801 </th>
4802 <td> a
4803 </td></tr></table>
4804
4805 !! end
4806
4807 !!test
4808 Accept "| !" at start of line in tables (ignore !-attribute)
4809 !! wikitext
4810 {|
4811 |-
4812 | !style="color:red" | bar
4813 |}
4814 !! html
4815 <table>
4816
4817 <tr>
4818 <td> bar
4819 </td></tr></table>
4820
4821 !!end
4822
4823 !!test
4824 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 +/-
4825 !! wikitext
4826 {|
4827 |-
4828 |style='color:red;'|+1
4829 |style='color:blue;'|-1
4830 |-
4831 | 1 || 2 || 3
4832 | 1 ||+2 ||-3
4833 |-
4834 | +1
4835 | -1
4836 |}
4837 !! html
4838 <table>
4839
4840 <tr>
4841 <td style="color:red;">+1
4842 </td>
4843 <td style="color:blue;">-1
4844 </td></tr>
4845 <tr>
4846 <td> 1 </td>
4847 <td> 2 </td>
4848 <td> 3
4849 </td>
4850 <td> 1 </td>
4851 <td>+2 </td>
4852 <td>-3
4853 </td></tr>
4854 <tr>
4855 <td> +1
4856 </td>
4857 <td> -1
4858 </td></tr></table>
4859
4860 !!end
4861
4862 !! test
4863 Table rowspan
4864 !! wikitext
4865 {| border=1
4866 | Cell 1, row 1
4867 |rowspan=2| Cell 2, row 1 (and 2)
4868 | Cell 3, row 1
4869 |-
4870 | Cell 1, row 2
4871 | Cell 3, row 2
4872 |}
4873 !! html
4874 <table border="1">
4875 <tr>
4876 <td> Cell 1, row 1
4877 </td>
4878 <td rowspan="2"> Cell 2, row 1 (and 2)
4879 </td>
4880 <td> Cell 3, row 1
4881 </td></tr>
4882 <tr>
4883 <td> Cell 1, row 2
4884 </td>
4885 <td> Cell 3, row 2
4886 </td></tr></table>
4887
4888 !! end
4889
4890 !! test
4891 Nested table
4892 !! wikitext
4893 {| border=1
4894 | &alpha;
4895 |
4896 {| bgcolor=#ABCDEF border=2
4897 |nested
4898 |-
4899 |table
4900 |}
4901 |the original table again
4902 |}
4903 !! html
4904 <table border="1">
4905 <tr>
4906 <td> &#945;
4907 </td>
4908 <td>
4909 <table bgcolor="#ABCDEF" border="2">
4910 <tr>
4911 <td>nested
4912 </td></tr>
4913 <tr>
4914 <td>table
4915 </td></tr></table>
4916 </td>
4917 <td>the original table again
4918 </td></tr></table>
4919
4920 !! end
4921
4922 !! test
4923 Invalid attributes in table cell (bug 1830)
4924 !! wikitext
4925 {|
4926 |Cell:|broken
4927 |}
4928 !! html
4929 <table>
4930 <tr>
4931 <td>broken
4932 </td></tr></table>
4933
4934 !! end
4935
4936
4937 # The "|}" to close the table is missing from the input, so parsoid's
4938 # *2wt modes will fail.
4939 !! test
4940 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4941 !! options
4942 parsoid=wt2html,html2html
4943 !! wikitext
4944 {|
4945 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4946 !! html/php
4947 <table>
4948 <tr>
4949 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4950 <td>]" onmouseover="alert(document.cookie)"&gt;test
4951 </td>
4952 </tr>
4953 </table>
4954
4955 !! html/parsoid
4956 <table><tbody>
4957 <tr>
4958 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
4959 !! end
4960
4961
4962 !! test
4963 Indented table markup mixed with indented pre content (proposed in bug 6200)
4964 !! wikitext
4965 <table>
4966 <tr>
4967 <td>
4968 Text that should be rendered preformatted
4969 </td>
4970 </tr>
4971 </table>
4972 !! html
4973 <table>
4974 <tr>
4975 <td>
4976 <pre>Text that should be rendered preformatted
4977 </pre>
4978 </td>
4979 </tr>
4980 </table>
4981
4982 !! end
4983
4984 !! test
4985 Template-generated table cell attributes and cell content
4986 !! wikitext
4987 {|
4988 |{{table_attribs}}
4989 | {{table_attribs}}
4990 |}
4991 !! html
4992 <table>
4993 <tr>
4994 <td style="color: red"> Foo
4995 </td>
4996 <td style="color: red"> Foo
4997 </td></tr></table>
4998
4999 !! end
5000
5001 !! test
5002 Template-generated table cell attributes and cell content (2)
5003 !! wikitext
5004 {|
5005 |align=center {{table_attribs}}
5006 |}
5007 !! html
5008 <table>
5009 <tr>
5010 <td align="center" style="color: red"> Foo
5011 </td></tr></table>
5012
5013 !! end
5014
5015 !! test
5016 Template-generated table cell attributes and cell content (3)
5017 !! wikitext
5018 {|
5019 |align=center {{table_cells}}
5020 |}
5021 !! html
5022 <table>
5023 <tr>
5024 <td align="center" style="color: red"> Foo </td>
5025 <td> Bar </td>
5026 <td> Baz
5027 </td></tr></table>
5028
5029 !! end
5030
5031 !! test
5032 Table with row followed by newlines and table heading
5033 !! wikitext
5034 {|
5035 |-
5036
5037 ! foo
5038 |}
5039 !! html
5040 <table>
5041
5042
5043 <tr>
5044 <th> foo
5045 </th></tr></table>
5046
5047 !! end
5048
5049 !! test
5050 Table with empty line following the start tag
5051 !! wikitext
5052 {|
5053
5054 |-
5055 | foo
5056 |}
5057 !! html
5058 <table>
5059
5060
5061 <tr>
5062 <td> foo
5063 </td></tr></table>
5064
5065 !! end
5066
5067 # FIXME: Preserve the attribute properly (with an empty string as value) in
5068 # the PHP parser. Parsoid implements the behavior below.
5069 !! test
5070 Table attributes with empty value
5071 !! wikitext
5072 {|
5073 | style=| hello
5074 |}
5075 !! html/parsoid
5076 <table>
5077 <tbody>
5078 <tr>
5079 <td style=""> hello
5080 </td></tr></tbody></table>
5081
5082 !! end
5083
5084 !! test
5085 Wikitext table with a lot of comments
5086 !! wikitext
5087 {|
5088 <!-- c0 -->
5089 | foo
5090 <!-- c1 -->
5091 |- <!-- c2 -->
5092 <!-- c3 -->
5093 |<!-- c4 -->
5094 <!-- c5 -->
5095 |}
5096 !! html
5097 <table>
5098 <tr>
5099 <td> foo
5100 </td></tr>
5101 <tr>
5102 <td>
5103 </td></tr></table>
5104
5105 !! end
5106
5107 !! test
5108 Wikitext table with double-line table cell
5109 !! wikitext
5110 {|
5111 |a
5112 b
5113 |}
5114 !! html
5115 <table>
5116 <tr>
5117 <td>a
5118 <p>b
5119 </p>
5120 </td></tr></table>
5121
5122 !! end
5123
5124 !! test
5125 Table cell with a single comment
5126 !! wikitext
5127 {|
5128 | <!-- c1 -->
5129 | a
5130 |}
5131 !! html
5132 <table>
5133 <tr>
5134 <td>
5135 </td>
5136 <td> a
5137 </td></tr></table>
5138
5139 !! end
5140
5141 # The expected HTML structure in this test is debatable. The PHP parser does
5142 # not parse this kind of table at all. The main focus for Parsoid is on
5143 # round-tripping, so this output is ok for now. TODO: revisit!
5144 !! test
5145 Wikitext table with html-syntax row
5146 !! wikitext
5147 {|
5148 |-
5149 <td>foo</td>
5150 |}
5151 !! html/parsoid
5152 <table>
5153 <tbody>
5154 <tr>
5155 <td>foo</td></tr></tbody></table>
5156 !! end
5157
5158 !! test
5159 Implicit <td> after a |-
5160 (PHP parser relies on Tidy to add the missing <td> tags)
5161 !! options
5162 parsoid=wt2html,wt2wt
5163 !! wikitext
5164 {|
5165 |-
5166 a
5167 |}
5168 !! html
5169 <table>
5170 <tr><td>a</td></tr>
5171 </table>
5172 !! end
5173
5174 !! test
5175 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5176 (PHP parser relies on Tidy to add the missing <td> tags)
5177 !! options
5178 parsoid=wt2html,wt2wt
5179 !! wikitext
5180 {|
5181 |-
5182 |
5183 a
5184 |-
5185 b
5186 |}
5187 !! html
5188 <table>
5189 <tbody>
5190 <tr><td><pre>a</pre></td></tr>
5191 <tr><td> b</td></tr>
5192 </tbody>
5193 </table>
5194 !! end
5195
5196 !! test
5197 Lists should be recognized in an implicit <td> context
5198 (PHP parser relies on Tidy to add the missing <td> tags)
5199 !! options
5200 parsoid=wt2html,wt2wt
5201 !! wikitext
5202 {|
5203 |-
5204 *a
5205 |}
5206 !! html
5207 <table>
5208 <tr>
5209 <td><ul>
5210 <li>a</li>
5211 </ul></td>
5212 </tr>
5213 </table>
5214 !! end
5215
5216 !! test
5217 Parsoid: Round-trip tables directly followed by content (bug 51219)
5218 !! options
5219 parsoid=wt2html,wt2wt
5220 !! wikitext
5221 {|
5222 |foo
5223 |} bar
5224
5225 {|
5226 |baz
5227 |}<b>quux</b>
5228 !! html
5229 <table><tbody>
5230 <tr>
5231 <td>foo</td></tr></tbody></table> bar
5232 <table>
5233 <tbody>
5234 <tr>
5235 <td>baz</td></tr></tbody></table><b>quux</b>
5236 !! end
5237
5238 !! test
5239 Parsoid: Default to a newline after tables in new content (bug 51219)
5240 !! options
5241 parsoid=html2wt
5242 !! wikitext
5243 {|
5244 |foo
5245 |}
5246 <nowiki> </nowiki>bar
5247 {|
5248 |baz
5249 |}
5250 '''quux'''
5251 !! html
5252 <table><tbody>
5253 <tr><td>foo</td></tr></tbody></table> bar
5254 <table><tbody>
5255 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5256 !! end
5257
5258 !! test
5259 Parsoid: newline inducing block nodes don't suppress <nowiki>
5260 !! options
5261 parsoid=html2wt
5262 !! wikitext
5263 <nowiki> </nowiki>a
5264
5265 = foo =
5266 !! html
5267 a<h1>foo</h1>
5268 !! end
5269
5270 !! test
5271 Parsoid: Row-syntax table headings followed by comment & table cells
5272 !! options
5273 parsoid=wt2html,wt2wt
5274 !! wikitext
5275 {|
5276 ! foo || bar
5277 <!-- foo --> || baz || quux
5278 |}
5279 !! html/parsoid
5280 <table>
5281 <tbody>
5282 <tr><th>foo </th><th>bar </th>
5283 <td>baz </td>
5284 <td>quux</td></tr></tbody></table>
5285 !! end
5286
5287
5288 !!test
5289 Parsoid: Recover better from broken table attributes
5290 !!options
5291 parsoid=wt2html
5292 !!wikitext
5293 {| class="foo
5294 | class="bar" |
5295 foo
5296 |}
5297 !!html/parsoid
5298 <table class="foo">
5299 <tr>
5300 <td class="bar">
5301 <p>foo</p></td></tr>
5302 </tbody></table>
5303 !!end
5304
5305 ###
5306 ### Internal links
5307 ###
5308 !! test
5309 Plain link, capitalized
5310 !! wikitext
5311 [[Main Page]]
5312 !! html
5313 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5314 </p>
5315 !! end
5316
5317 !! test
5318 Plain link, uncapitalized
5319 !! wikitext
5320 [[main Page]]
5321 !! html
5322 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5323 </p>
5324 !! end
5325
5326 !! test
5327 Piped link
5328 !! wikitext
5329 [[Main Page|The Main Page]]
5330 !! html
5331 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5332 </p>
5333 !! end
5334
5335 !! test
5336 Piped link with comment in link text
5337 !! wikitext
5338 [[Main Page|The Main<!--front--> Page]]
5339 !! html
5340 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5341 </p>
5342 !! end
5343
5344 !! test
5345 Piped link with multiple pipe characters in link text
5346 !! wikitext
5347 [[Main Page||The|Main|Page|]]
5348 !! html/php
5349 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5353 !! end
5354
5355 !! test
5356 Broken link
5357 !! wikitext
5358 [[Zigzagzogzagzig]]
5359 !! html
5360 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5361 </p>
5362 !! end
5363
5364 !! test
5365 Broken link with fragment
5366 !! wikitext
5367 [[Zigzagzogzagzig#zug]]
5368 !! html
5369 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5370 </p>
5371 !! end
5372
5373 !! test
5374 Special page link with fragment
5375 !! wikitext
5376 [[Special:Version#anchor]]
5377 !! html
5378 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5379 </p>
5380 !! end
5381
5382 !! test
5383 Nonexistent special page link with fragment
5384 !! wikitext
5385 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5386 !! html
5387 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5388 </p>
5389 !! end
5390
5391 !! test
5392 Link with prefix
5393 !! wikitext
5394 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5395 !! html
5396 <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>
5397 </p>
5398 !! end
5399
5400 !! test
5401 Link with suffix
5402 !! wikitext
5403 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5404 !! html
5405 <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>!!!
5406 </p>
5407 !! end
5408
5409 !! article
5410 prefixed article
5411 !! text
5412 Some text
5413 !! endarticle
5414
5415 !! test
5416 Bug 43661: Piped links with identical prefixes
5417 !! wikitext
5418 [[prefixed article|prefixed articles with spaces]]
5419
5420 [[prefixed article|prefixed articlesaoeu]]
5421
5422 [[Main Page|Main Page test]]
5423 !! html
5424 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5425 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5426 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5427 </p>
5428 !! end
5429
5430
5431 !! test
5432 Link with HTML entity in suffix / tail
5433 !! wikitext
5434 [[Main Page]]&quot;, [[Main Page]]&#97;
5435 !! html
5436 <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;
5437 </p>
5438 !! end
5439
5440 !! test
5441 Link with 3 brackets
5442 !! wikitext
5443 [[[Main Page]]]
5444 !! html
5445 <p>[[[Main Page]]]
5446 </p>
5447 !! end
5448
5449 !! test
5450 Link with 4 brackets
5451 !! wikitext
5452 [[[[Main Page]]]]
5453 !! html
5454 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5455 </p>
5456 !! end
5457
5458 !! test
5459 Piped link with 3 brackets
5460 !! wikitext
5461 [[[main page|the main page]]]
5462 !! html
5463 <p>[[[main page|the main page]]]
5464 </p>
5465 !! end
5466
5467 !! test
5468 Piped link with extlink-like text
5469 !! wikitext
5470 [[Main Page|[bar]]]
5471 [[Main Page|This is a [bar]]]
5472 !! html
5473 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5474 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5475 </p>
5476 !! end
5477
5478 !! test
5479 Link with multiple pipes
5480 !! wikitext
5481 [[Main Page|The|Main|Page]]
5482 !! html
5483 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5484 </p>
5485 !! end
5486
5487 !! test
5488 Link to namespaces
5489 !! wikitext
5490 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5491 !! html
5492 <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>
5493 </p>
5494 !! end
5495
5496 !! test
5497 Link with space in namespace
5498 !! wikitext
5499 [[User talk:Foo bar]]
5500 !! html
5501 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
5502 </p>
5503 !! end
5504
5505 !! article
5506 MemoryAlpha:AlphaTest
5507 !! text
5508 This is an article in the MemoryAlpha namespace
5509 (which shadows the memoryalpha interwiki link).
5510 !! endarticle
5511
5512 !! test
5513 Namespace takes precedence over interwiki link (bug 51680)
5514 !! wikitext
5515 [[MemoryAlpha:AlphaTest]]
5516 !! html
5517 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5518 </p>
5519 !! end
5520
5521 # The previous test doesn't work correctly in html2*, due to not recognizing the
5522 # link as an internal one. This one checks for the correct behavior.
5523 !! test
5524 Link to namespace preferred over interwiki with correct rel attribute
5525 !! options
5526 parsoid=html2wt,html2html
5527 !! wikitext
5528 [[MemoryAlpha:AlphaTest]]
5529 !! html
5530 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5531 </p>
5532 !! end
5533
5534 !! test
5535 Piped link to namespace
5536 !! wikitext
5537 [[Meta:Disclaimers|The disclaimers]]
5538 !! html
5539 <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>
5540 </p>
5541 !! end
5542
5543 !! test
5544 Link containing }
5545 !! wikitext
5546 [[Usually caused by a typo (oops}]]
5547 !! html
5548 <p>[[Usually caused by a typo (oops}]]
5549 </p>
5550 !! end
5551
5552 !! article
5553 7% Solution
5554 !! text
5555 Just a test of an article title containing a percent.
5556 !! endarticle
5557
5558 !! test
5559 Link containing % (not as a hex sequence)
5560 !! wikitext
5561 [[7% Solution]]
5562 !! html/php
5563 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5564 </p>
5565 !! html/parsoid
5566 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5567 !! end
5568
5569 # note that the parsoid HTML is identical to the previous test output,
5570 # so the previous test ensures that the html2wt mode will generate the
5571 # "not as a hex sequence" wikitext.
5572 !! test
5573 Link containing % as a single hex sequence interpreted to char
5574 !! options
5575 parsoid=wt2wt,wt2html,html2html
5576 !! wikitext
5577 [[7%25 Solution]]
5578 !! html/php
5579 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5580 </p>
5581 !! html/parsoid
5582 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5583 !!end
5584
5585 !! test
5586 Link containing % as a double hex sequence interpreted to hex sequence
5587 !! wikitext
5588 [[7%2525 Solution]]
5589 !! html
5590 <p>[[7%2525 Solution]]
5591 </p>
5592 !!end
5593
5594 # note that parsoid does not munge anchor text; all non-space
5595 # characters are valid in HTML5 anchors.
5596 !! test
5597 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5598 Example for such a section: == < ==
5599 !! wikitext
5600 [[%23%3c]][[%23%3e]]
5601 !! html/php
5602 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5603 </p>
5604 !! html/parsoid
5605 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5606 !! end
5607
5608 !! test
5609 Link containing "<#" and ">#" as a hex sequences
5610 !! wikitext
5611 [[%3c%23]][[%3e%23]]
5612 !! html
5613 <p>[[%3c%23]][[%3e%23]]
5614 </p>
5615 !! end
5616
5617 !! test
5618 Link containing an equals sign
5619 !! wikitext
5620 [[Special:BookSources/isbn=4-00-026157-6]]
5621 !! html/php
5622 <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>
5623 </p>
5624 !! html/parsoid
5625 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5626 !! end
5627
5628 !! article
5629 Foo~bar
5630 !! text
5631 Just a test of an article title containing a tilde.
5632 !! endarticle
5633
5634 # note that links containing signatures, like [[Foo~~~~]], are
5635 # massaged by the pre-save transform (PST) and so the tildes are never
5636 # seen by the parser.
5637 !! test
5638 Link containing a tilde
5639 !! wikitext
5640 [[Foo~bar]]
5641 !! html/php
5642 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5643 </p>
5644 !! html/parsoid
5645 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5646 !! end
5647
5648 !! test
5649 Link containing double-single-quotes '' (bug 4598)
5650 !! wikitext
5651 [[Lista d''e paise d''o munno]]
5652 !! html/php
5653 <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>
5654 </p>
5655 !! html/parsoid
5656 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5657 !! end
5658
5659 !! test
5660 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5661 !! wikitext
5662 Some [[Link|pretty ''italics'' and stuff]]!
5663 !! html/php
5664 <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>!
5665 </p>
5666 !! html/parsoid
5667 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5668 !! end
5669
5670 !! test
5671 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5672 !! wikitext
5673 ''Some [[Link|pretty ''italics'' and stuff]]!''
5674 !! html
5675 <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>
5676 </p>
5677 !! end
5678
5679 !! test
5680 Link with double quotes in title part (literal) and alternate part (interpreted)
5681 !! wikitext
5682 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5683
5684 [[''Pentecoste'']]
5685
5686 [[''Pentecoste''|Pentecoste]]
5687
5688 [[''Pentecoste''|''Pentecoste'']]
5689 !! html/php
5690 <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>
5691 </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>
5692 </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>
5693 </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>
5694 </p>
5695 !! html/parsoid
5696 <meta typeof="mw:Placeholder"/>
5697 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5698 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5699 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5700 !! end
5701
5702 !! test
5703 Broken image links with HTML captions (bug 39700)
5704 !! wikitext
5705 [[File:Nonexistent|<script></script>]]
5706 [[File:Nonexistent|100px|<script></script>]]
5707 [[File:Nonexistent|&lt;]]
5708 [[File:Nonexistent|a<i>b</i>c]]
5709 !! html
5710 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5711 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5712 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5713 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5714 </p>
5715 !! end
5716
5717 !! test
5718 Plain link to URL
5719 !! wikitext
5720 [[http://www.example.com]]
5721 !! html/php
5722 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5723 </p>
5724 !! html/parsoid
5725 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5726 !! end
5727
5728 !! test
5729 Plain link to URL with link text
5730 !! wikitext
5731 [[http://www.example.com Link text]]
5732 !! html
5733 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5734 </p>
5735 !! end
5736
5737 !! test
5738 Plain link to protocol-relative URL
5739 !! wikitext
5740 [[//www.example.com]]
5741 !! html/php
5742 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5743 </p>
5744 !! html/parsoid
5745 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5746 !! end
5747
5748 !! test
5749 Plain link to protocol-relative URL with link text
5750 !! wikitext
5751 [[//www.example.com Link text]]
5752 !! html
5753 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5754 </p>
5755 !! end
5756
5757 !! test
5758 Plain link to page with question mark in title
5759 !! wikitext
5760 [[A?b]]
5761
5762 [[A?b|Baz]]
5763 !! html
5764 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5765 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5766 </p>
5767 !! end
5768
5769
5770 # I'm fairly sure the expected result here is wrong.
5771 # We want these to be URL links, not pseudo-pages with URLs for titles....
5772 # However the current output is also pretty screwy.
5773 #
5774 # ----
5775 # I'm changing it to match the current output--it arguably makes more
5776 # sense in the light of the test above. Old expected result was:
5777 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5778 #</p>
5779 # But I think this test is bordering on "garbage in, garbage out" anyway.
5780 # -- wtm
5781 !! test
5782 Piped link to URL
5783 !! wikitext
5784 Piped link to URL: [[http://www.example.com|an example URL]]
5785 !! html/php
5786 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5787 </p>
5788 !! html/parsoid
5789 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5790 !! end
5791
5792 !! test
5793 BUG 2: [[page|http://url/]] should link to page, not http://url/
5794 !! wikitext
5795 [[Main Page|http://url/]]
5796 !! html/php
5797 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5798 </p>
5799 !! html/parsoid
5800 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5801 !! end
5802
5803 # Parsoid does not mark self-links, by design.
5804 !! test
5805 BUG 337: Escaped self-links should be bold
5806 !! options
5807 title=[[Bug462]]
5808 !! wikitext
5809 [[Bu&#103;462]] [[Bug462]]
5810 !! html/php
5811 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5812 </p>
5813 !! html/parsoid
5814 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
5815 !! end
5816
5817 !! test
5818 Self-link to section should not be bold
5819 !! options
5820 title=[[Main Page]]
5821 !! wikitext
5822 [[Main Page#section]]
5823 !! html
5824 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5825 </p>
5826 !! end
5827
5828 !! article
5829 00
5830 !! text
5831 This is 00.
5832 !! endarticle
5833
5834 !!test
5835 Self-link to numeric title
5836 !!options
5837 title=[[0]]
5838 !! wikitext
5839 [[0]]
5840 !! html
5841 <p><strong class="selflink">0</strong>
5842 </p>
5843 !!end
5844
5845 !!test
5846 Link to numeric-equivalent title
5847 !!options
5848 title=[[0]]
5849 !! wikitext
5850 [[00]]
5851 !! html
5852 <p><a href="/wiki/00" title="00">00</a>
5853 </p>
5854 !!end
5855
5856 !! test
5857 <nowiki> inside a link
5858 !! wikitext
5859 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5860 !! html
5861 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5862 </p>
5863 !! end
5864
5865 !! test
5866 Non-breaking spaces in title
5867 !! wikitext
5868 [[&nbsp; Main &nbsp; Page &nbsp;]]
5869 !! html
5870 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5871 </p>
5872 !!end
5873
5874 !! test
5875 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5876 !! options
5877 language=ca
5878 !! wikitext
5879 '''[[Main Page]]'''
5880 !! html
5881 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5882 </p>
5883 !! end
5884
5885 !! test
5886 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5887 !! options
5888 language=ca
5889 !! wikitext
5890 ''[[Main Page]]''
5891 !! html
5892 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5893 </p>
5894 !! end
5895
5896 !! test
5897 Internal link with en linktrail: no apostrophes (bug 27473)
5898 !! options
5899 language=en
5900 !! wikitext
5901 [[Something]]'nice
5902 !! html
5903 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5904 </p>
5905 !! end
5906
5907 !! test
5908 Internal link with ca linktrail with apostrophes (bug 27473)
5909 !! options
5910 language=ca
5911 !! wikitext
5912 [[Something]]'nice
5913 !! html
5914 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5915 </p>
5916 !! end
5917
5918 !! test
5919 Internal link with kaa linktrail with apostrophes (bug 27473)
5920 !! options
5921 language=kaa
5922 !! wikitext
5923 [[Something]]'nice
5924 !! html
5925 <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>
5926 </p>
5927 !! end
5928
5929 !! test
5930 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
5931 !! wikitext
5932 [[User:Foo/Test/63636:Bar|Test]]
5933 !! html/php
5934 <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>
5935 </p>
5936 !! html/parsoid
5937 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
5938 !! end
5939
5940 !! test
5941 1. Interaction of linktrail and template encapsulation
5942 !! options
5943 parsoid
5944 !! wikitext
5945 {{echo|[[Foo]]}}l
5946 !! html
5947 <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>
5948 !! end
5949
5950 !! test
5951 2. Interaction of linktrail and template encapsulation
5952 !! options
5953 parsoid
5954 !! wikitext
5955 {{echo|Some [[Fool]]}}s
5956 !! html
5957 <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>
5958 !! end
5959
5960 !! test
5961 3. Interaction of linktrail and template encapsulation
5962 !! options
5963 parsoid
5964 !! wikitext
5965 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5966 !! html
5967 <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>
5968 !! end
5969
5970 !! article
5971 Söfnuður
5972 !! text
5973 Test.
5974 !! endarticle
5975
5976 !! test
5977 Internal link with is link prefix
5978 !! options
5979 language=is
5980 !! wikitext
5981 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5982 !! html
5983 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5984 </p>
5985 !! end
5986
5987 !! article
5988 Mótmælendatrú
5989 !! text
5990 Test.
5991 !! endarticle
5992
5993 !! test
5994 Internal link with is link trail and link prefix
5995 !! options
5996 language=is
5997 !! wikitext
5998 [[mótmælendatrú|xxx]]ar
5999 [[mótmælendatrú]]ar
6000 mótmælenda[[söfnuður]]
6001 mótmælenda[[söfnuður|söfnuðir]]
6002 mótmælenda[[söfnuður|söfnuðir]]xxx
6003 !! html
6004 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6005 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6006 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6007 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6008 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6009 </p>
6010 !! end
6011
6012 !! test
6013 Parsoid link trail escaping
6014 !! options
6015 parsoid=html2wt,html2html
6016 !! wikitext
6017 [[apple]]<nowiki/>s
6018 !! html
6019 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6020 !! end
6021
6022 !! test
6023 Parsoid link prefix escaping
6024 !! options
6025 language=is
6026 parsoid=html2wt,html2html
6027 !! wikitext
6028 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6029 !! html
6030 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6031 !! end
6032
6033 !! test
6034 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6035 !! wikitext
6036 [[Foo| bar]]
6037
6038 [[Foo| ''bar'']]
6039
6040 [http://wp.org foo]
6041
6042 [http://wp.org ''foo'']
6043 !! html
6044 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6045 </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>
6046 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6047 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6048 </p>
6049 !! end
6050
6051 !! test
6052 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6053 !! options
6054 parsoid
6055 !! wikitext
6056 [[Foo|{{echo|a}} b {{echo|c}}]]
6057 !! html
6058 <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>
6059 !! end
6060
6061 ###
6062 ### Interwiki links (see maintenance/interwiki.sql)
6063 ###
6064
6065 !! test
6066 Inline interwiki link
6067 !! wikitext
6068 [[MeatBall:SoftSecurity]]
6069 !! html
6070 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6071 </p>
6072 !! end
6073
6074 !! test
6075 Inline interwiki link with empty title (bug 2372)
6076 !! wikitext
6077 [[MeatBall:]]
6078 !! html
6079 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6080 </p>
6081 !! end
6082
6083 !! test
6084 Interwiki link encoding conversion (bug 1636)
6085 !! wikitext
6086 *[[Wikipedia:ro:Olteni&#0355;a]]
6087 *[[Wikipedia:ro:Olteni&#355;a]]
6088 !! html
6089 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
6090 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
6091
6092 !! end
6093
6094 !! test
6095 Interwiki link with fragment (bug 2130)
6096 !! wikitext
6097 [[MeatBall:SoftSecurity#foo]]
6098 !! html
6099 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6100 </p>
6101 !! end
6102
6103 # Ideally the wikipedia: prefix here should be proto-relative too
6104 !! test
6105 Different interwiki prefixes mapping to the same URL
6106 !! wikitext
6107 [[:en:Foo]]
6108
6109 [[:en:Foo|Foo]]
6110
6111 [[wikipedia:Foo]]
6112
6113 [[:wikipedia:Foo|Foo]]
6114
6115 [[wikipedia:en:Foo]]
6116
6117 [[:wikipedia:en:Foo]]
6118 !! html/parsoid
6119 <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>
6120
6121 <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>
6122
6123 <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>
6124
6125 <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>
6126
6127 <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>
6128
6129 <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>
6130 !! end
6131
6132 !! test
6133 Interwiki links that cannot be represented in wiki syntax
6134 !! wikitext
6135 [[meatball:ok]]
6136 [[meatball:ok#foo|ok with fragment]]
6137 [[meatball:ok_as_well?|ok ending with ? mark]]
6138 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6139 [http://de.wikipedia.org/wiki/#foo is just fragment]
6140
6141 !! html/parsoid
6142 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6143 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6144 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6145 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6146 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6147 !! end
6148
6149 !! test
6150 Interwiki links: trail
6151 !! options
6152 parsoid
6153 !! wikitext
6154 [[wikipedia:Foo|Ba]]r
6155 !! html
6156 <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>
6157 !! end
6158
6159 ###
6160 ### Interlanguage links
6161 ### Language links (so that searching for '### language' matches..)
6162 ###
6163
6164 !! test
6165 Interlanguage link
6166 !! wikitext
6167 Blah blah blah
6168 [[zh:Chinese]]
6169 !! html
6170 <p>Blah blah blah
6171 </p>
6172 !! end
6173
6174 !! test
6175 Double interlanguage link
6176 !! wikitext
6177 Blah blah blah
6178 [[es:Spanish]]
6179 [[zh:Chinese]]
6180 !! html
6181 <p>Blah blah blah
6182 </p>
6183 !! end
6184
6185 !! test
6186 Interlanguage link, with prefix links
6187 !! options
6188 language=ln
6189 !! wikitext
6190 Blah blah blah
6191 [[zh:Chinese]]
6192 !! html
6193 <p>Blah blah blah
6194 </p>
6195 !! end
6196
6197 !! test
6198 Double interlanguage link, with prefix links (bug 8897)
6199 !! options
6200 language=ln
6201 !! wikitext
6202 Blah blah blah
6203 [[es:Spanish]]
6204 [[zh:Chinese]]
6205 !! html
6206 <p>Blah blah blah
6207 </p>
6208 !! end
6209
6210 !! test
6211 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6212 !! options
6213 language=ln
6214 !! wikitext
6215 [[WW&nbsp;II]]
6216 !! html
6217 <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>
6218 </p>
6219 !! end
6220
6221 !! test
6222 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6223 !! options
6224 parsoid=html2wt
6225 !! wikitext
6226 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6227
6228 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6229 !! html
6230 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6231 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6232 !! end
6233
6234 !! test
6235 Parsoid: handle constructor well
6236 !! options
6237 parsoid
6238 !! wikitext
6239 [[constructor]]
6240
6241 [[constructor:foo]]
6242 !! html
6243 <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>
6244
6245 <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>
6246 !! end
6247
6248 !! test
6249 Parsoid: recognize interlanguage links without a target page
6250 !! options
6251 parsoid
6252 !! wikitext
6253 [[ko:]]
6254 !! html
6255 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6256 !! end
6257
6258 !! test
6259 Parsoid: recognize interwiki links without a target page
6260 !! options
6261 parsoid
6262 !! wikitext
6263 [[:ko:]]
6264 !! html
6265 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6266 !! end
6267
6268 !! test
6269 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6270 !! options
6271 parsoid
6272 !! wikitext
6273 [[en:Foo]]
6274 !! html
6275 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6276 !! end
6277
6278 ###
6279 ### Redirects, Parsoid-only
6280 ###
6281 !! test
6282 1. Simple redirect to page
6283 !! options
6284 parsoid
6285 !! wikitext
6286 #REDIRECT [[Main Page]]
6287 !! html
6288 <link rel="mw:PageProp/redirect" href="./Main_Page">
6289 !! end
6290
6291 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6292 !! test
6293 2. Other redirect variants
6294 !! options
6295 parsoid=wt2html,wt2wt
6296 !! wikitext
6297 #REDIRECT [[Main_Page]]
6298 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6299 !! html
6300 <link rel="mw:PageProp/redirect" href="./Main_Page">
6301 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6302 !! end
6303
6304 !! test
6305 Empty redirect
6306 !! options
6307 parsoid=wt2html,wt2wt
6308 !! wikitext
6309 #REDIRECT [[]]
6310 !! html
6311 <ol>
6312 <li>REDIRECT [[]]</li></ol>
6313 !! end
6314
6315 !! test
6316 Optional colon in #REDIRECT
6317 !! options
6318 # the colon is archaic syntax. we support it for wt2html, but we
6319 # don't care that it roundtrips back to the modern syntax.
6320 parsoid=wt2html,html2html
6321 !! wikitext
6322 #REDIRECT:[[Main Page]]
6323 !! html
6324 <link rel="mw:PageProp/redirect" href="./Main_Page">
6325 !! end
6326
6327 !! test
6328 Whitespace in #REDIRECT with optional colon
6329 !! options
6330 # the colon and gratuitous whitespace is archaic syntax. we support
6331 # it for wt2html, but we don't care that it roundtrips back to the
6332 # modern syntax (without extra whitespace)
6333 parsoid=wt2html,html2html
6334 !! wikitext
6335
6336 #REDIRECT
6337 :
6338 [[Main Page]]
6339 !! html
6340 <link rel="mw:PageProp/redirect" href="./Main_Page">
6341 !! end
6342
6343 !! test
6344 Piped link in #REDIRECT
6345 !! options
6346 # content after piped link is ignored. we support this syntax,
6347 # but don't care that the piped link is lost when we roundtrip this.
6348 parsoid=wt2html
6349 !! wikitext
6350 #REDIRECT [[Main Page|bar]]
6351 !! html
6352 <link rel="mw:PageProp/redirect" href="./Main_Page">
6353 !! end
6354
6355 !! test
6356 Redirect to category
6357 !! options
6358 parsoid=wt2html
6359 !! wikitext
6360 #REDIRECT [[Category:Foo]]
6361 !! html
6362 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6363 !! end
6364
6365 !! test
6366 Redirect to category with URL encoding
6367 !! options
6368 parsoid=wt2html
6369 !! wikitext
6370 #REDIRECT [[Category%3AFoo]]
6371 !! html
6372 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6373 !! end
6374
6375 !! test
6376 Redirect to category page
6377 !! options
6378 parsoid=wt2html,html2html
6379 !! wikitext
6380 #REDIRECT [[:Category:Foo]]
6381 !! html
6382 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6383 !! end
6384
6385 !! test
6386 Redirect to image page (1)
6387 !! options
6388 parsoid
6389 !! wikitext
6390 #REDIRECT [[File:Wiki.png]]
6391 !! html
6392 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6393 !! end
6394
6395 !! test
6396 Redirect to image page (2)
6397 !! options
6398 parsoid
6399 !! wikitext
6400 #REDIRECT [[Image:Wiki.png]]
6401 !! html
6402 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6403 !! end
6404
6405 !! test
6406 Redirect to language
6407 !! options
6408 parsoid
6409 !! wikitext
6410 #REDIRECT [[en:File:Wiki.png]]
6411 !! html
6412 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6413 !! end
6414
6415 !! test
6416 Redirect to interwiki
6417 !! options
6418 parsoid
6419 !! wikitext
6420 #REDIRECT [[meatball:File:Wiki.png]]
6421 !! html
6422 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6423 !! end
6424
6425 !! test
6426 Non-English #REDIRECT
6427 !! options
6428 parsoid
6429 language=is
6430 !! wikitext
6431 #TILVÍSUN [[Main Page]]
6432 !! html
6433 <link rel="mw:PageProp/redirect" href="./Main_Page">
6434 !! end
6435
6436 !! test
6437 New redirect
6438 !! options
6439 parsoid=html2wt
6440 !! wikitext
6441 Foo
6442 #REDIRECT [[Foo]]
6443 !! html
6444 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6445 !! end
6446
6447 ##
6448 ## XHTML tidiness
6449 ###
6450
6451 !! test
6452 <br> to <br />
6453 !! wikitext
6454 1<br>2<br />3
6455 !! html
6456 <p>1<br />2<br />3
6457 </p>
6458 !! end
6459
6460 !! test
6461 Broken br tag sanitization
6462 !! wikitext
6463 </br>
6464 !! html/php
6465 <p>&lt;/br&gt;
6466 </p>
6467 !! end
6468
6469 # TODO: Fix html2html mode (bug 51055)!
6470 !! test
6471 Parsoid: Broken br tag recognition
6472 !! options
6473 parsoid=wt2html
6474 !! wikitext
6475 </br>
6476
6477 <br/ >
6478 !! html/parsoid
6479 <p><br></p>
6480 <p><br/></p>
6481 !! end
6482
6483 !! test
6484 Incorrecly removing closing slashes from correctly formed XHTML
6485 !! wikitext
6486 <br style="clear:both;" />
6487 !! html
6488 <p><br style="clear:both;" />
6489 </p>
6490 !! end
6491
6492 !! test
6493 Failing to transform badly formed HTML into correct XHTML
6494 !! wikitext
6495 <br style="clear: left;">
6496 <br style="clear: right;">
6497 <br style="clear: both;">
6498 !! html
6499 <p><br style="clear: left;" />
6500 <br style="clear: right;" />
6501 <br style="clear: both;" />
6502 </p>
6503 !!end
6504
6505 !! test
6506 Handling html with a div self-closing tag
6507 !! wikitext
6508 <div title />
6509 <div title/>
6510 <div title/ >
6511 <div title=bar />
6512 <div title=bar/>
6513 <div title=bar/ >
6514 !! html
6515 <p>&lt;div title /&gt;
6516 &lt;div title/&gt;
6517 </p>
6518 <div>
6519 <p>&lt;div title=bar /&gt;
6520 &lt;div title=bar/&gt;
6521 </p>
6522 <div title="bar/"></div>
6523 </div>
6524
6525 !! end
6526
6527 !! test
6528 Handling html with a br self-closing tag
6529 !! wikitext
6530 <br title />
6531 <br title/>
6532 <br title/ >
6533 <br title=bar />
6534 <br title=bar/>
6535 <br title=bar/ >
6536 !! html
6537 <p><br title="title" />
6538 <br title="title" />
6539 <br />
6540 <br title="bar" />
6541 <br title="bar" />
6542 <br title="bar/" />
6543 </p>
6544 !! end
6545
6546 !! test
6547 Horizontal ruler (should it add that extra space?)
6548 !! wikitext
6549 <hr>
6550 <hr >
6551 foo <hr
6552 > bar
6553 !! html
6554 <hr />
6555 <hr />
6556 foo <hr /> bar
6557
6558 !! end
6559
6560 !! test
6561 Horizontal ruler -- 4+ dashes render hr
6562 !! wikitext
6563 ----
6564 !! html
6565 <hr />
6566
6567 !! end
6568
6569 !! test
6570 Horizontal ruler -- eats additional dashes on the same line
6571 !! wikitext
6572 ---------
6573 !! html
6574 <hr />
6575
6576 !! end
6577
6578 !! test
6579 Horizontal ruler -- does not collapse dashes on consecutive lines
6580 !! wikitext
6581 ----
6582 ----
6583 !! html
6584 <hr />
6585 <hr />
6586
6587 !! end
6588
6589 !! test
6590 Horizontal ruler -- <4 dashes render as plain text
6591 !! wikitext
6592 ---
6593 !! html
6594 <p>---
6595 </p>
6596 !! end
6597
6598 !! test
6599 Horizontal ruler -- Supports content following dashes on same line
6600 !! wikitext
6601 ---- Foo
6602 !! html
6603 <hr /> Foo
6604
6605 !! end
6606
6607 ###
6608 ### Block-level elements
6609 ###
6610 !! test
6611 Common list
6612 !! wikitext
6613 *Common list
6614 * item 2
6615 *item 3
6616 !! html
6617 <ul><li>Common list</li>
6618 <li> item 2</li>
6619 <li>item 3</li></ul>
6620
6621 !! end
6622
6623 !! test
6624 Numbered list
6625 !! wikitext
6626 #Numbered list
6627 #item 2
6628 # item 3
6629 !! html
6630 <ol><li>Numbered list</li>
6631 <li>item 2</li>
6632 <li> item 3</li></ol>
6633
6634 !! end
6635
6636 !! test
6637 Mixed list
6638 !! wikitext
6639 *Mixed list
6640 *# with numbers
6641 ** and bullets
6642 *# and numbers
6643 *bullets again
6644 **bullet level 2
6645 ***bullet level 3
6646 ***#Number on level 4
6647 **bullet level 2
6648 **#Number on level 3
6649 **#Number on level 3
6650 *#number level 2
6651 *Level 1
6652 *** Level 3
6653 #** Level 3, but ordered
6654 !! html
6655 <ul><li>Mixed list
6656 <ol><li> with numbers</li></ol>
6657 <ul><li> and bullets</li></ul>
6658 <ol><li> and numbers</li></ol></li>
6659 <li>bullets again
6660 <ul><li>bullet level 2
6661 <ul><li>bullet level 3
6662 <ol><li>Number on level 4</li></ol></li></ul></li>
6663 <li>bullet level 2
6664 <ol><li>Number on level 3</li>
6665 <li>Number on level 3</li></ol></li></ul>
6666 <ol><li>number level 2</li></ol></li>
6667 <li>Level 1
6668 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6669 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6670
6671 !! end
6672
6673 !! test
6674 Nested lists 1
6675 !! wikitext
6676 *foo
6677 **bar
6678 !! html
6679 <ul><li>foo
6680 <ul><li>bar</li></ul></li></ul>
6681
6682 !! end
6683
6684 !! test
6685 Nested lists 2
6686 !! wikitext
6687 **foo
6688 *bar
6689 !! html
6690 <ul><li><ul><li>foo</li></ul></li>
6691 <li>bar</li></ul>
6692
6693 !! end
6694
6695 !! test
6696 Nested lists 3 (first element empty)
6697 !! wikitext
6698 *
6699 **bar
6700 !! html
6701 <ul><li>
6702 <ul><li>bar</li></ul></li></ul>
6703
6704 !! end
6705
6706 !! test
6707 Nested lists 4 (first element empty)
6708 !! wikitext
6709 **
6710 *bar
6711 !! html
6712 <ul><li><ul><li></li></ul></li>
6713 <li>bar</li></ul>
6714
6715 !! end
6716
6717 !! test
6718 Nested lists 5 (both elements empty)
6719 !! wikitext
6720 **
6721 *
6722 !! html
6723 <ul><li><ul><li></li></ul></li>
6724 <li></li></ul>
6725
6726 !! end
6727
6728 !! test
6729 Nested lists 6 (both elements empty)
6730 !! wikitext
6731 *
6732 **
6733 !! html
6734 <ul><li>
6735 <ul><li></li></ul></li></ul>
6736
6737 !! end
6738
6739 !! test
6740 Nested lists 7 (skip initial nesting levels)
6741 !! wikitext
6742 *** foo
6743 !! html
6744 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6745
6746 !! end
6747
6748 !! test
6749 Nested lists 8 (multiple nesting transitions)
6750 !! wikitext
6751 * foo
6752 *** bar
6753 ** baz
6754 * boo
6755 !! html
6756 <ul><li> foo
6757 <ul><li><ul><li> bar</li></ul></li>
6758 <li> baz</li></ul></li>
6759 <li> boo</li></ul>
6760
6761 !! end
6762
6763 !! test
6764 1. Lists with start-of-line-transparent tokens before bullets: Comments
6765 !! wikitext
6766 *foo
6767 *<!--cmt-->bar
6768 <!--cmt-->*baz
6769 !! html
6770 <ul><li>foo</li>
6771 <li>bar</li>
6772 <li>baz</li></ul>
6773
6774 !! end
6775
6776 !! test
6777 2. Lists with start-of-line-transparent tokens before bullets: Template close
6778 !! wikitext
6779 *foo {{echo|bar
6780 }}*baz
6781 !! html
6782 <ul><li>foo bar</li>
6783 <li>baz</li></ul>
6784
6785 !! end
6786
6787 !! test
6788 List items are not parsed correctly following a <pre> block (bug 785)
6789 !! wikitext
6790 * <pre>foo</pre>
6791 * <pre>bar</pre>
6792 * zar
6793 !! html
6794 <ul><li> <pre>foo</pre></li>
6795 <li> <pre>bar</pre></li>
6796 <li> zar</li></ul>
6797
6798 !! end
6799
6800 !! test
6801 List items from template
6802 !! wikitext
6803
6804 {{inner list}}
6805 * item 2
6806
6807 * item 0
6808 {{inner list}}
6809 * item 2
6810
6811 * item 0
6812 * notSOL{{inner list}}
6813 * item 2
6814 !! html
6815 <ul><li> item 1</li>
6816 <li> item 2</li></ul>
6817 <ul><li> item 0</li>
6818 <li> item 1</li>
6819 <li> item 2</li></ul>
6820 <ul><li> item 0</li>
6821 <li> notSOL</li>
6822 <li> item 1</li>
6823 <li> item 2</li></ul>
6824
6825 !! end
6826
6827 !! test
6828 List interrupted by empty line or heading
6829 !! wikitext
6830 * foo
6831
6832 ** bar
6833 == A heading ==
6834 * Another list item
6835 !! html
6836 <ul><li> foo</li></ul>
6837 <ul><li><ul><li> bar</li></ul></li></ul>
6838 <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>
6839 <ul><li> Another list item</li></ul>
6840
6841 !!end
6842
6843 !!test
6844 Multiple list tags generated by templates
6845 !! wikitext
6846 {{echo|<li>}}a
6847 {{echo|<li>}}b
6848 {{echo|<li>}}c
6849 !! html
6850 <li>a
6851 <li>b
6852 <li>c</li>
6853 </li>
6854 </li>
6855
6856 !!end
6857
6858 !!test
6859 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6860 !! wikitext
6861 *a
6862 <!--This line will NOT split the list-->
6863 *b
6864 <!--This line will NOT split the list either-->
6865 *c
6866 <!--foo--> <!----> <!--This line NOT split the list either-->
6867 *d
6868 !! html
6869 <ul><li>a</li>
6870 <li>b</li>
6871 <li>c</li>
6872 <li>d</li></ul>
6873
6874 !!end
6875
6876 !!test
6877 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6878 !! wikitext
6879 *a
6880 <!--This line will NOT split the list-->
6881 *b
6882 <!--This line will NOT split the list either-->
6883 *c
6884 <!--foo--> <!----> <!--This line NOT split the list
6885 either-->
6886 *d
6887 !! html
6888 <ul><li>a</li>
6889 <li>b</li>
6890 <li>c</li>
6891 <li>d</li></ul>
6892
6893 !!end
6894
6895 !!test
6896 Test the li-hack
6897 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6898 !!options
6899 parsoid=wt2html,wt2wt
6900 !! wikitext
6901 * foo
6902 * <li>li-hack
6903 * {{echo|<li>templated li-hack}}
6904 * <!--foo--> <li> unsupported li-hack with preceding comments
6905
6906 <ul>
6907 <li><li>not a li-hack
6908 </li>
6909 </ul>
6910 !! html
6911 <ul>
6912 <li> foo</li>
6913 <li>li-hack</li>
6914 <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>
6915 <li> <!--foo--> </li>
6916 <li> li-hack with preceding comments</li>
6917 </ul>
6918
6919 <ul>
6920 <li></li>
6921 <li>not a li-hack
6922 </li>
6923 </ul>
6924 !!end
6925
6926 !! test
6927 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6928 !! options
6929 parsoid
6930 !! wikitext
6931 # foo
6932 ## bar
6933 * foo
6934 ** bar
6935 : foo
6936 :: bar
6937 !! html
6938 <ol>
6939 <li> foo<ol>
6940 <li> bar</li>
6941 </ol></li>
6942 </ol><ul>
6943 <li> foo<ul>
6944 <li> bar</li>
6945 </ul></li>
6946 </ul><dl>
6947 <dd> foo<dl>
6948 <dd> bar</dd>
6949 </dl></dd>
6950 </dl>
6951 !! end
6952
6953 !! test
6954 Parsoid: Test of whitespace serialization with Templated bullets
6955 !! options
6956 parsoid
6957 !! wikitext
6958 * {{bullet}}
6959 !! html
6960 <ul>
6961 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6962 </ul>
6963 !! end
6964
6965 # ------------------------------------------------------------------------
6966 # The next set of tests are about Parsoid's ability to handle badly nested
6967 # tags (parse, minimize scope of fixup, and roundtrip back)
6968 # ------------------------------------------------------------------------
6969
6970 !! test
6971 Unbalanced closing block tags break a list
6972 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6973 !! wikitext
6974 <div>
6975 *a</div><div>
6976 *b</div>
6977 !! html/parsoid
6978 <div>
6979 <ul>
6980 <li>a
6981 </li>
6982 </ul></div><div>
6983 <ul>
6984 <li>b
6985 </li>
6986 </ul></div>
6987 !! end
6988
6989 !! test
6990 Unbalanced closing non-block tags don't break a list
6991 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6992 !! wikitext
6993 <span>
6994 *a</span><span>
6995 *b</span>
6996 !! html/parsoid
6997 <p><span></span>
6998 </p>
6999 <ul>
7000 <li>a<span></span>
7001 </li>
7002 <li>b
7003 </li>
7004 </ul>
7005 !! end
7006
7007 !! test
7008 Unclosed formatting tags that straddle lists are closed and reopened
7009 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7010 !! wikitext
7011 # <s> a
7012 # b </s>
7013 !! html/parsoid
7014 <ol>
7015 <li> <s> a </s>
7016 </li>
7017 <li> <s> b </s>
7018 </li>
7019 </ol>
7020 !! end
7021
7022 !!test
7023 List embedded in a non-block tag
7024 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7025 !! wikitext
7026 <small>
7027 * foo
7028 </small>
7029 !! html/parsoid
7030 <p><small></small></p>
7031 <small>
7032 <ul>
7033 <li> foo</li>
7034 </ul>
7035 </small>
7036 <p><small></small></p>
7037 !!end
7038
7039 !! test
7040 Table with missing opening <tr> tag
7041 !! options
7042 parsoid=wt2html,wt2wt
7043 !! wikitext
7044 <table>
7045 <td>foo</td>
7046 </tr>
7047 </table>
7048 !! html/parsoid
7049 <table>
7050 <tr>
7051 <td>foo</td>
7052 </tr>
7053 </table>
7054 !! end
7055
7056 ###
7057 ### Magic Words
7058 ###
7059
7060 # Note that the current date is hard-coded as
7061 # 1970-01-01T00:02:03Z (a Thursday)
7062 # when running parser tests. The timezone is also fixed to GMT, so
7063 # local date will be identical to current date.
7064
7065 !! test
7066 Magic Word: {{CURRENTDAY}}
7067 !! wikitext
7068 {{CURRENTDAY}}
7069 !! html
7070 <p>1
7071 </p>
7072 !! end
7073
7074 !! test
7075 Magic Word: {{CURRENTDAY2}}
7076 !! wikitext
7077 {{CURRENTDAY2}}
7078 !! html
7079 <p>01
7080 </p>
7081 !! end
7082
7083 !! test
7084 Magic Word: {{CURRENTDAYNAME}}
7085 !! wikitext
7086 {{CURRENTDAYNAME}}
7087 !! html
7088 <p>Thursday
7089 </p>
7090 !! end
7091
7092 !! test
7093 Magic Word: {{CURRENTDOW}}
7094 !! wikitext
7095 {{CURRENTDOW}}
7096 !! html
7097 <p>4
7098 </p>
7099 !! end
7100
7101 !! test
7102 Magic Word: {{CURRENTMONTH}}
7103 !! wikitext
7104 {{CURRENTMONTH}}
7105 !! html
7106 <p>01
7107 </p>
7108 !! end
7109
7110 !! test
7111 Magic Word: {{CURRENTMONTH1}}
7112 !! wikitext
7113 {{CURRENTMONTH1}}
7114 !! html
7115 <p>1
7116 </p>
7117 !! end
7118
7119 !! test
7120 Magic Word: {{CURRENTMONTHABBREV}}
7121 !! wikitext
7122 {{CURRENTMONTHABBREV}}
7123 !! html
7124 <p>Jan
7125 </p>
7126 !! end
7127
7128 !! test
7129 Magic Word: {{CURRENTMONTHNAME}}
7130 !! wikitext
7131 {{CURRENTMONTHNAME}}
7132 !! html
7133 <p>January
7134 </p>
7135 !! end
7136
7137 !! test
7138 Magic Word: {{CURRENTMONTHNAMEGEN}}
7139 !! wikitext
7140 {{CURRENTMONTHNAMEGEN}}
7141 !! html
7142 <p>January
7143 </p>
7144 !! end
7145
7146 !! test
7147 Magic Word: {{CURRENTTIME}}
7148 !! wikitext
7149 {{CURRENTTIME}}
7150 !! html
7151 <p>00:02
7152 </p>
7153 !! end
7154
7155 !! test
7156 Magic Word: {{CURRENTHOUR}}
7157 !! wikitext
7158 {{CURRENTHOUR}}
7159 !! html
7160 <p>00
7161 </p>
7162 !! end
7163
7164 !! test
7165 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7166 !! wikitext
7167 {{CURRENTWEEK}}
7168 !! html
7169 <p>1
7170 </p>
7171 !! end
7172
7173 !! test
7174 Magic Word: {{CURRENTYEAR}}
7175 !! wikitext
7176 {{CURRENTYEAR}}
7177 !! html
7178 <p>1970
7179 </p>
7180 !! end
7181
7182 !! test
7183 Magic Word: {{CURRENTTIMESTAMP}}
7184 !! wikitext
7185 {{CURRENTTIMESTAMP}}
7186 !! html
7187 <p>19700101000203
7188 </p>
7189 !! end
7190
7191 !! test
7192 Magic Words LOCAL (UTC)
7193 !! wikitext
7194 * {{LOCALMONTH}}
7195 * {{LOCALMONTH1}}
7196 * {{LOCALMONTHNAME}}
7197 * {{LOCALMONTHNAMEGEN}}
7198 * {{LOCALMONTHABBREV}}
7199 * {{LOCALDAY}}
7200 * {{LOCALDAY2}}
7201 * {{LOCALDAYNAME}}
7202 * {{LOCALYEAR}}
7203 * {{LOCALTIME}}
7204 * {{LOCALHOUR}}
7205 * {{LOCALWEEK}}
7206 * {{LOCALDOW}}
7207 * {{LOCALTIMESTAMP}}
7208 !! html
7209 <ul><li> 01</li>
7210 <li> 1</li>
7211 <li> January</li>
7212 <li> January</li>
7213 <li> Jan</li>
7214 <li> 1</li>
7215 <li> 01</li>
7216 <li> Thursday</li>
7217 <li> 1970</li>
7218 <li> 00:02</li>
7219 <li> 00</li>
7220 <li> 1</li>
7221 <li> 4</li>
7222 <li> 19700101000203</li></ul>
7223
7224 !! end
7225
7226 !! test
7227 Magic Word: {{FULLPAGENAME}}
7228 !! options
7229 title=[[User:Ævar Arnfjörð Bjarmason]]
7230 !! wikitext
7231 {{FULLPAGENAME}}
7232 !! html
7233 <p>User:Ævar Arnfjörð Bjarmason
7234 </p>
7235 !! end
7236
7237 !! test
7238 Magic Word: {{FULLPAGENAMEE}}
7239 !! options
7240 title=[[User:Ævar Arnfjörð Bjarmason]]
7241 !! wikitext
7242 {{FULLPAGENAMEE}}
7243 !! html
7244 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7245 </p>
7246 !! end
7247
7248 !! test
7249 Magic Word: {{TALKSPACE}}
7250 !! options
7251 title=[[User:Ævar Arnfjörð Bjarmason]]
7252 !! wikitext
7253 {{TALKSPACE}}
7254 !! html
7255 <p>User talk
7256 </p>
7257 !! end
7258
7259 !! test
7260 Magic Word: {{TALKSPACE}}, same namespace
7261 !! options
7262 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7263 !! wikitext
7264 {{TALKSPACE}}
7265 !! html
7266 <p>User talk
7267 </p>
7268 !! end
7269
7270 !! test
7271 Magic Word: {{TALKSPACE}}, main namespace
7272 !! options
7273 title=[[Parser Test]]
7274 !! wikitext
7275 {{TALKSPACE}}
7276 !! html
7277 <p>Talk
7278 </p>
7279 !! end
7280
7281 !! test
7282 Magic Word: {{TALKSPACEE}}
7283 !! options
7284 title=[[User:Ævar Arnfjörð Bjarmason]]
7285 !! wikitext
7286 {{TALKSPACEE}}
7287 !! html
7288 <p>User_talk
7289 </p>
7290 !! end
7291
7292 !! test
7293 Magic Word: {{SUBJECTSPACE}}
7294 !! options
7295 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7296 !! wikitext
7297 {{SUBJECTSPACE}}
7298 !! html
7299 <p>User
7300 </p>
7301 !! end
7302
7303 !! test
7304 Magic Word: {{SUBJECTSPACE}}, same namespace
7305 !! options
7306 title=[[User:Ævar Arnfjörð Bjarmason]]
7307 !! wikitext
7308 {{SUBJECTSPACE}}
7309 !! html
7310 <p>User
7311 </p>
7312 !! end
7313
7314 !! test
7315 Magic Word: {{SUBJECTSPACE}}, main namespace
7316 !! options
7317 title=[[Parser Test]]
7318 !! wikitext
7319 {{SUBJECTSPACE}}
7320 !! html
7321
7322 !! end
7323
7324 !! test
7325 Magic Word: {{SUBJECTSPACEE}}
7326 !! options
7327 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7328 !! wikitext
7329 {{SUBJECTSPACEE}}
7330 !! html
7331 <p>User
7332 </p>
7333 !! end
7334
7335 !! test
7336 Magic Word: {{NAMESPACE}}
7337 !! options
7338 title=[[User:Ævar Arnfjörð Bjarmason]]
7339 !! wikitext
7340 {{NAMESPACE}}
7341 !! html
7342 <p>User
7343 </p>
7344 !! end
7345
7346 !! test
7347 Magic Word: {{NAMESPACEE}}
7348 !! options
7349 title=[[User:Ævar Arnfjörð Bjarmason]]
7350 !! wikitext
7351 {{NAMESPACEE}}
7352 !! html
7353 <p>User
7354 </p>
7355 !! end
7356
7357 !! test
7358 Magic Word: {{NAMESPACENUMBER}}
7359 !! options
7360 title=[[User:Ævar Arnfjörð Bjarmason]]
7361 !! wikitext
7362 {{NAMESPACENUMBER}}
7363 !! html
7364 <p>2
7365 </p>
7366 !! end
7367
7368 !! test
7369 Magic Word: {{SUBPAGENAME}}
7370 !! options
7371 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7372 !! wikitext
7373 {{SUBPAGENAME}}
7374 !! html
7375 <p>sub ö
7376 </p>
7377 !! end
7378
7379 !! test
7380 Magic Word: {{SUBPAGENAMEE}}
7381 !! options
7382 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7383 !! wikitext
7384 {{SUBPAGENAMEE}}
7385 !! html
7386 <p>sub_%C3%B6
7387 </p>
7388 !! end
7389
7390 !! test
7391 Magic Word: {{ROOTPAGENAME}}
7392 !! options
7393 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7394 !! wikitext
7395 {{ROOTPAGENAME}}
7396 !! html
7397 <p>Ævar Arnfjörð Bjarmason
7398 </p>
7399 !! end
7400
7401 !! test
7402 Magic Word: {{ROOTPAGENAMEE}}
7403 !! options
7404 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7405 !! wikitext
7406 {{ROOTPAGENAMEE}}
7407 !! html
7408 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7409 </p>
7410 !! end
7411
7412 !! test
7413 Magic Word: {{BASEPAGENAME}}
7414 !! options
7415 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7416 !! wikitext
7417 {{BASEPAGENAME}}
7418 !! html
7419 <p>Ævar Arnfjörð Bjarmason
7420 </p>
7421 !! end
7422
7423 !! test
7424 Magic Word: {{BASEPAGENAMEE}}
7425 !! options
7426 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7427 !! wikitext
7428 {{BASEPAGENAMEE}}
7429 !! html
7430 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7431 </p>
7432 !! end
7433
7434 !! test
7435 Magic Word: {{TALKPAGENAME}}
7436 !! options
7437 title=[[User:Ævar Arnfjörð Bjarmason]]
7438 !! wikitext
7439 {{TALKPAGENAME}}
7440 !! html
7441 <p>User talk:Ævar Arnfjörð Bjarmason
7442 </p>
7443 !! end
7444
7445 !! test
7446 Magic Word: {{TALKPAGENAMEE}}
7447 !! options
7448 title=[[User:Ævar Arnfjörð Bjarmason]]
7449 !! wikitext
7450 {{TALKPAGENAMEE}}
7451 !! html
7452 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7453 </p>
7454 !! end
7455
7456 !! test
7457 Magic Word: {{SUBJECTPAGENAME}}
7458 !! options
7459 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7460 !! wikitext
7461 {{SUBJECTPAGENAME}}
7462 !! html
7463 <p>User:Ævar Arnfjörð Bjarmason
7464 </p>
7465 !! end
7466
7467 !! test
7468 Magic Word: {{SUBJECTPAGENAMEE}}
7469 !! options
7470 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7471 !! wikitext
7472 {{SUBJECTPAGENAMEE}}
7473 !! html
7474 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7475 </p>
7476 !! end
7477
7478 !! test
7479 Magic Word: {{NUMBEROFFILES}}
7480 !! wikitext
7481 {{NUMBEROFFILES}}
7482 !! html
7483 <p>5
7484 </p>
7485 !! end
7486
7487 !! test
7488 Magic Word: {{PAGENAME}}
7489 !! options
7490 title=[[User:Ævar Arnfjörð Bjarmason]]
7491 !! wikitext
7492 {{PAGENAME}}
7493 !! html
7494 <p>Ævar Arnfjörð Bjarmason
7495 </p>
7496 !! end
7497
7498 !! test
7499 Magic Word: {{PAGENAME}} with metacharacters
7500 !! options
7501 title=[['foo & bar = baz']]
7502 !! wikitext
7503 ''{{PAGENAME}}''
7504 !! html
7505 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7506 </p>
7507 !! end
7508
7509 !! test
7510 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7511 !! options
7512 title=[[*RFC 1234 http://example.com/]]
7513 !! wikitext
7514 {{PAGENAME}}
7515 !! html
7516 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7517 </p>
7518 !! end
7519
7520 !! test
7521 Magic Word: {{PAGENAMEE}}
7522 !! options
7523 title=[[User:Ævar Arnfjörð Bjarmason]]
7524 !! wikitext
7525 {{PAGENAMEE}}
7526 !! html
7527 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7528 </p>
7529 !! end
7530
7531 !! test
7532 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7533 !! options
7534 title=[[*RFC 1234 http://example.com/]]
7535 !! wikitext
7536 {{PAGENAMEE}}
7537 !! html
7538 <p>&#42;RFC_1234_http&#58;//example.com/
7539 </p>
7540 !! end
7541
7542 !! test
7543 Magic Word: {{REVISIONID}}
7544 !! wikitext
7545 {{REVISIONID}}
7546 !! html
7547 <p>1337
7548 </p>
7549 !! end
7550
7551 !! test
7552 Magic Word: {{SCRIPTPATH}}
7553 !! wikitext
7554 {{SCRIPTPATH}}
7555 !! html
7556 <p>/
7557 </p>
7558 !! end
7559
7560 !! test
7561 Magic Word: {{STYLEPATH}}
7562 !! wikitext
7563 {{STYLEPATH}}
7564 !! html
7565 <p>/skins
7566 </p>
7567 !! end
7568
7569 !! test
7570 Magic Word: {{SERVER}}
7571 !! wikitext
7572 {{SERVER}}
7573 !! html
7574 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7575 </p>
7576 !! end
7577
7578 !! test
7579 Magic Word: {{SERVERNAME}}
7580 !! wikitext
7581 {{SERVERNAME}}
7582 !! html
7583 <p>example.org
7584 </p>
7585 !! end
7586
7587 !! test
7588 Magic Word: {{SITENAME}}
7589 !! wikitext
7590 {{SITENAME}}
7591 !! html
7592 <p>MediaWiki
7593 </p>
7594 !! end
7595
7596 !! test
7597 Case-sensitive magic words, when cased differently, should just be template transclusions
7598 !! wikitext
7599 {{CurrentMonth}}
7600 {{currentday}}
7601 {{cURreNTweEK}}
7602 {{currentHour}}
7603 !! html
7604 <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>
7605 <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>
7606 <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>
7607 <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>
7608 </p>
7609 !! end
7610
7611 !! test
7612 Case-insensitive magic words should still work with weird casing.
7613 !! wikitext
7614 {{sErVeRNaMe}}
7615 {{LCFirst:AOEU}}
7616 {{ucFIRST:aoeu}}
7617 {{SERver}}
7618 !! html
7619 <p>example.org
7620 aOEU
7621 Aoeu
7622 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7623 </p>
7624 !! end
7625
7626 !! test
7627 Namespace 1 {{ns:1}}
7628 !! wikitext
7629 {{ns:1}}
7630 !! html
7631 <p>Talk
7632 </p>
7633 !! end
7634
7635 !! test
7636 Namespace 1 {{ns:01}}
7637 !! wikitext
7638 {{ns:01}}
7639 !! html
7640 <p>Talk
7641 </p>
7642 !! end
7643
7644 !! test
7645 Namespace 0 {{ns:0}} (bug 4783)
7646 !! wikitext
7647 {{ns:0}}
7648 !! html
7649
7650 !! end
7651
7652 !! test
7653 Namespace 0 {{ns:00}} (bug 4783)
7654 !! wikitext
7655 {{ns:00}}
7656 !! html
7657
7658 !! end
7659
7660 !! test
7661 Namespace -1 {{ns:-1}}
7662 !! wikitext
7663 {{ns:-1}}
7664 !! html
7665 <p>Special
7666 </p>
7667 !! end
7668
7669 !! test
7670 Namespace User {{ns:User}}
7671 !! wikitext
7672 {{ns:User}}
7673 !! html
7674 <p>User
7675 </p>
7676 !! end
7677
7678 !! test
7679 Namespace User talk {{ns:User_talk}}
7680 !! wikitext
7681 {{ns:User_talk}}
7682 !! html
7683 <p>User talk
7684 </p>
7685 !! end
7686
7687 !! test
7688 Namespace User talk {{ns:uSeR tAlK}}
7689 !! wikitext
7690 {{ns:uSeR tAlK}}
7691 !! html
7692 <p>User talk
7693 </p>
7694 !! end
7695
7696 !! test
7697 Namespace File {{ns:File}}
7698 !! wikitext
7699 {{ns:File}}
7700 !! html
7701 <p>File
7702 </p>
7703 !! end
7704
7705 !! test
7706 Namespace File {{ns:Image}}
7707 !! wikitext
7708 {{ns:Image}}
7709 !! html
7710 <p>File
7711 </p>
7712 !! end
7713
7714 !! test
7715 Namespace (lang=de) Benutzer {{ns:User}}
7716 !! options
7717 language=de
7718 !! wikitext
7719 {{ns:User}}
7720 !! html
7721 <p>Benutzer
7722 </p>
7723 !! end
7724
7725 !! test
7726 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7727 !! options
7728 language=de
7729 !! wikitext
7730 {{ns:3}}
7731 !! html
7732 <p>Benutzer Diskussion
7733 </p>
7734 !! end
7735
7736
7737 !! test
7738 Urlencode
7739 !! wikitext
7740 {{urlencode:hi world?!}}
7741 {{urlencode:hi world?!|WIKI}}
7742 {{urlencode:hi world?!|PATH}}
7743 {{urlencode:hi world?!|QUERY}}
7744 !! html
7745 <p>hi+world%3F%21
7746 hi_world%3F!
7747 hi%20world%3F%21
7748 hi+world%3F%21
7749 </p>
7750 !! end
7751
7752 !! test
7753 Magic Word: prioritize type info over data-parsoid
7754 !! options
7755 parsoid=html2wt
7756 !! wikitext
7757 __FORCETOC__
7758 !! html
7759 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7760 !! end
7761
7762 !! test
7763 Magic Word: serialize on separate line (parsoid)
7764 !! options
7765 parsoid=wt2wt,html2wt
7766 !! wikitext
7767 foo
7768 __NOTOC__
7769 bar
7770 !! html
7771 foo<meta property="mw:PageProp/notoc"/>bar
7772 !! end
7773
7774 !! test
7775 Magic Word: rt non-english wikis
7776 !! options
7777 parsoid=wt2wt
7778 language=de
7779 !! wikitext
7780 __NOEDITSECTION__
7781 !! html
7782 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7783 !! end
7784
7785 ###
7786 ### Magic links
7787 ###
7788 !! test
7789 Magic links: internal link to RFC (bug 479)
7790 !! wikitext
7791 [[RFC 123]]
7792 !! html
7793 <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>
7794 </p>
7795 !! end
7796
7797 !! test
7798 Magic links: RFC (bug 479)
7799 !! wikitext
7800 RFC 822
7801 !! html
7802 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Magic links: ISBN (bug 1937)
7808 !! wikitext
7809 ISBN 0-306-40615-2
7810 !! html
7811 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7812 </p>
7813 !! end
7814
7815 !! test
7816 Magic links: PMID incorrectly converts space to underscore
7817 !! wikitext
7818 PMID 1234
7819 !! html
7820 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7821 </p>
7822 !! end
7823
7824 ###
7825 ### Templates
7826 ####
7827
7828 !! test
7829 Nonexistent template
7830 !! wikitext
7831 {{thistemplatedoesnotexist}}
7832 !! html
7833 <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>
7834 </p>
7835 !! end
7836
7837 !! test
7838 Template with invalid target containing tags
7839 !! wikitext
7840 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7841 !! html
7842 <p>{{a<b>b</b>|foo|a=b|a = b}}
7843 </p>
7844 !! end
7845
7846 !! test
7847 Template with invalid target containing unclosed tag
7848 !! wikitext
7849 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7850 !! html
7851 <p>{{a<b>|foo|a=b|a = b}}</b>
7852 </p>
7853 !! end
7854
7855 !! test
7856 Template with invalid target containing wikilink
7857 !! wikitext
7858 {{[[Main Page]]}}
7859 !! html/php
7860 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7861 </p>
7862 !! html/parsoid
7863 <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>
7864 !! end
7865
7866 !! article
7867 Template:test
7868 !! text
7869 This is a test template
7870 !! endarticle
7871
7872 !! test
7873 Simple template
7874 !! wikitext
7875 {{test}}
7876 !! html
7877 <p>This is a test template
7878 </p>
7879 !! end
7880
7881 !! test
7882 Template with explicit namespace
7883 !! wikitext
7884 {{Template:test}}
7885 !! html
7886 <p>This is a test template
7887 </p>
7888 !! end
7889
7890
7891 !! article
7892 Template:paramtest
7893 !! text
7894 This is a test template with parameter {{{param}}}
7895 !! endarticle
7896
7897 !! test
7898 Template parameter
7899 !! wikitext
7900 {{paramtest|param=foo}}
7901 !! html
7902 <p>This is a test template with parameter foo
7903 </p>
7904 !! end
7905
7906 !! article
7907 Template:paramtestnum
7908 !! text
7909 [[{{{1}}}|{{{2}}}]]
7910 !! endarticle
7911
7912 !! test
7913 Template unnamed parameter
7914 !! wikitext
7915 {{paramtestnum|Main Page|the main page}}
7916 !! html
7917 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7918 </p>
7919 !! end
7920
7921 !! article
7922 Template:templatesimple
7923 !! text
7924 (test)
7925 !! endarticle
7926
7927 !! article
7928 Template:templateredirect
7929 !! text
7930 #redirect [[Template:templatesimple]]
7931 !! endarticle
7932
7933 !! article
7934 Template:templateasargtestnum
7935 !! text
7936 {{{{{1}}}}}
7937 !! endarticle
7938
7939 !! article
7940 Template:templateasargtest
7941 !! text
7942 {{template{{{templ}}}}}
7943 !! endarticle
7944
7945 !! article
7946 Template:templateasargtest2
7947 !! text
7948 {{{{{templ}}}}}
7949 !! endarticle
7950
7951 !! test
7952 Template with template name as unnamed argument
7953 !! wikitext
7954 {{templateasargtestnum|templatesimple}}
7955 !! html
7956 <p>(test)
7957 </p>
7958 !! end
7959
7960 !! test
7961 Template with template name as argument
7962 !! wikitext
7963 {{templateasargtest|templ=simple}}
7964 !! html
7965 <p>(test)
7966 </p>
7967 !! end
7968
7969 !! test
7970 Template with template name as argument (2)
7971 !! wikitext
7972 {{templateasargtest2|templ=templatesimple}}
7973 !! html
7974 <p>(test)
7975 </p>
7976 !! end
7977
7978 !! article
7979 Template:templateasargtestdefault
7980 !! text
7981 {{{{{templ|templatesimple}}}}}
7982 !! endarticle
7983
7984 !! article
7985 Template:templa
7986 !! text
7987 '''templ'''
7988 !! endarticle
7989
7990 !! test
7991 Template with default value
7992 !! wikitext
7993 {{templateasargtestdefault}}
7994 !! html
7995 <p>(test)
7996 </p>
7997 !! end
7998
7999 !! test
8000 Template with default value (value set)
8001 !! wikitext
8002 {{templateasargtestdefault|templ=templa}}
8003 !! html
8004 <p><b>templ</b>
8005 </p>
8006 !! end
8007
8008 !! test
8009 Template redirect
8010 !! wikitext
8011 {{templateredirect}}
8012 !! html
8013 <p>(test)
8014 </p>
8015 !! end
8016
8017 !! test
8018 Template with argument in separate line
8019 !! wikitext
8020 {{ templateasargtest |
8021 templ = simple }}
8022 !! html
8023 <p>(test)
8024 </p>
8025 !! end
8026
8027 !! test
8028 Template with complex template as argument
8029 !! wikitext
8030 {{paramtest|
8031 param ={{ templateasargtest |
8032 templ = simple }}}}
8033 !! html
8034 <p>This is a test template with parameter (test)
8035 </p>
8036 !! end
8037
8038 !! test
8039 Template with thumb image (with link in description)
8040 !! wikitext
8041 {{paramtest|
8042 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8043 !! html
8044 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>
8045
8046 !! end
8047
8048 !! article
8049 Template:complextemplate
8050 !! text
8051 {{{1}}} {{paramtest|
8052 param ={{{param}}}}}
8053 !! endarticle
8054
8055 !! test
8056 Template with complex arguments
8057 !! wikitext
8058 {{complextemplate|
8059 param ={{ templateasargtest |
8060 templ = simple }}|[[Template:complextemplate|link]]}}
8061 !! html
8062 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8063 </p>
8064 !! end
8065
8066 !! test
8067 BUG 553: link with two variables in a piped link
8068 !! wikitext
8069 {|
8070 |[[{{{1}}}|{{{2}}}]]
8071 |}
8072 !! html
8073 <table>
8074 <tr>
8075 <td>[[{{{1}}}|{{{2}}}]]
8076 </td></tr></table>
8077
8078 !! end
8079
8080 !! test
8081 Magic variable as template parameter
8082 !! wikitext
8083 {{paramtest|param={{SITENAME}}}}
8084 !! html
8085 <p>This is a test template with parameter MediaWiki
8086 </p>
8087 !! end
8088
8089 !! article
8090 Template:linktest
8091 !! text
8092 [[{{{param}}}|link]]
8093 !! endarticle
8094
8095 !! test
8096 Template parameter as link source
8097 !! wikitext
8098 {{linktest|param=Main Page}}
8099 !! html
8100 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8101 </p>
8102 !! end
8103
8104 !!test
8105 Template-generated attribute string (k='v')
8106 !! wikitext
8107 <span {{attr_str|id|v1}}>bar</span>
8108 !! html
8109 <p><span id="v1">bar</span>
8110 </p>
8111 !!end
8112
8113 !!article
8114 Template:paramtest2
8115 !! text
8116 including another template, {{paramtest|param={{{arg}}}}}
8117 !! endarticle
8118
8119 !! test
8120 Template passing argument to another template
8121 !! wikitext
8122 {{paramtest2|arg='hmm'}}
8123 !! html
8124 <p>including another template, This is a test template with parameter 'hmm'
8125 </p>
8126 !! end
8127
8128 !! article
8129 Template:Linktest2
8130 !! text
8131 Main Page
8132 !! endarticle
8133
8134 !! test
8135 Template as link source
8136 !! wikitext
8137 [[{{linktest2}}]]
8138
8139 [[{{linktest2}}|Main Page]]
8140
8141 [[{{linktest2}}]]Page
8142 !! html
8143 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8144 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8145 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8146 </p>
8147 !! end
8148
8149
8150 !! article
8151 Template:loop1
8152 !! text
8153 {{loop2}}
8154 !! endarticle
8155
8156 !! article
8157 Template:loop2
8158 !! text
8159 {{loop1}}
8160 !! endarticle
8161
8162 !! test
8163 Template infinite loop
8164 !! wikitext
8165 {{loop1}}
8166 !! html
8167 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8168 </p>
8169 !! end
8170
8171 !! test
8172 Template from main namespace
8173 !! wikitext
8174 {{:Main Page}}
8175 !! html
8176 <p>blah blah
8177 </p>
8178 !! end
8179
8180 !! article
8181 Template:table
8182 !! text
8183 {|
8184 | 1 || 2
8185 |-
8186 | 3 || 4
8187 |}
8188 !! endarticle
8189
8190 !! test
8191 BUG 529: Template with table, not included at beginning of line
8192 !! wikitext
8193 foo {{table}}
8194 !! html
8195 <p>foo
8196 </p>
8197 <table>
8198 <tr>
8199 <td> 1 </td>
8200 <td> 2
8201 </td></tr>
8202 <tr>
8203 <td> 3 </td>
8204 <td> 4
8205 </td></tr></table>
8206
8207 !! end
8208
8209 !! test
8210 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8211 !! wikitext
8212 foo
8213 {{table}}
8214 !! html
8215 <p>foo
8216 </p>
8217 <table>
8218 <tr>
8219 <td> 1 </td>
8220 <td> 2
8221 </td></tr>
8222 <tr>
8223 <td> 3 </td>
8224 <td> 4
8225 </td></tr></table>
8226
8227 !! end
8228
8229 !! test
8230 BUG 41: Template parameters shown as broken links
8231 !! wikitext
8232 {{{parameter}}}
8233 !! html
8234 <p>{{{parameter}}}
8235 </p>
8236 !! end
8237
8238 !! test
8239 Template with targets containing wikilinks
8240 !! wikitext
8241 {{[[foo]]}}
8242
8243 {{[[{{echo|foo}}]]}}
8244
8245 {{{{echo|[[foo}}]]}}
8246 !! html
8247 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8248 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8249 </p><p>{{[[foo}}]]
8250 </p>
8251 !! end
8252
8253 !! article
8254 Template:MSGNW test
8255 !! text
8256 ''None'' of '''this''' should be
8257 * interpreted
8258 but rather passed unmodified
8259 {{test}}
8260 !! endarticle
8261
8262 # hmm, fix this or just deprecate msgnw and document its behavior?
8263 !! test
8264 msgnw keyword
8265 !! options
8266 disabled
8267 !! wikitext
8268 {{msgnw:MSGNW test}}
8269 !! html
8270 <p>''None'' of '''this''' should be
8271 * interpreted
8272 but rather passed unmodified
8273 {{test}}
8274 </p>
8275 !! end
8276
8277 !! test
8278 int keyword
8279 !! wikitext
8280 {{int:youhavenewmessages|lots of money|not!}}
8281 !! html
8282 <p>You have lots of money (not!).
8283 </p>
8284 !! end
8285
8286 !! article
8287 Template:Includes
8288 !! text
8289 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8290 !! endarticle
8291
8292 !! test
8293 <includeonly> and <noinclude> being included
8294 !! wikitext
8295 {{Includes}}
8296 !! html
8297 <p>Foobar
8298 </p>
8299 !! end
8300
8301 !! article
8302 Template:Includes2
8303 !! text
8304 <onlyinclude>Foo</onlyinclude>bar
8305 !! endarticle
8306
8307 !! test
8308 <onlyinclude> being included
8309 !! wikitext
8310 {{Includes2}}
8311 !! html
8312 <p>Foo
8313 </p>
8314 !! end
8315
8316
8317 !! article
8318 Template:Includes3
8319 !! text
8320 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8321 !! endarticle
8322
8323 !! test
8324 <onlyinclude> and <includeonly> being included
8325 !! wikitext
8326 {{Includes3}}
8327 !! html
8328 <p>Foo
8329 </p>
8330 !! end
8331
8332 !! test
8333 <includeonly> and <noinclude> on a page
8334 !! wikitext
8335 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8336 !! html
8337 <p>Foozar
8338 </p>
8339 !! end
8340
8341 !! test
8342 Un-closed <noinclude>
8343 !! wikitext
8344 <noinclude>
8345 !! html
8346 !! end
8347
8348 !! test
8349 <onlyinclude> on a page
8350 !! wikitext
8351 <onlyinclude>Foo</onlyinclude>bar
8352 !! html
8353 <p>Foobar
8354 </p>
8355 !! end
8356
8357 !! test
8358 Un-closed <onlyinclude>
8359 !! wikitext
8360 <onlyinclude>
8361 !! html
8362 !! end
8363
8364 !!test
8365 Self-closed noinclude, includeonly, onlyinclude tags
8366 !! wikitext
8367 <noinclude />
8368 <includeonly />
8369 <onlyinclude />
8370 !! html
8371 <p><br />
8372 </p>
8373 !!end
8374
8375 !!test
8376 Unbalanced includeonly and noinclude tags
8377 !! wikitext
8378 {|
8379 |a</noinclude>
8380 |b</noinclude></noinclude>
8381 |c</noinclude></includeonly>
8382 |d</includeonly></includeonly>
8383 |}
8384 !! html
8385 <table>
8386 <tr>
8387 <td>a
8388 </td>
8389 <td>b
8390 </td>
8391 <td>c&lt;/includeonly&gt;
8392 </td>
8393 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8394 </td></tr></table>
8395
8396 !!end
8397
8398 !! article
8399 Template:Includeonly section
8400 !! text
8401 <includeonly>
8402 ==Includeonly section==
8403 </includeonly>
8404 ==Section T-1==
8405 !!endarticle
8406
8407 !! test
8408 Bug 6563: Edit link generation for section shown by <includeonly>
8409 !! wikitext
8410 {{includeonly section}}
8411 !! html
8412 <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>
8413 <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>
8414
8415 !! end
8416
8417 # Uses same input as the contents of [[Template:Includeonly section]]
8418 !! test
8419 Bug 6563: Section extraction for section shown by <includeonly>
8420 !! options
8421 section=T-2
8422 !! wikitext
8423 <includeonly>
8424 ==Includeonly section==
8425 </includeonly>
8426 ==Section T-2==
8427 !! html
8428 ==Section T-2==
8429 !! end
8430
8431 !! test
8432 Bug 6563: Edit link generation for section suppressed by <includeonly>
8433 !! wikitext
8434 <includeonly>
8435 ==Includeonly section==
8436 </includeonly>
8437 ==Section 1==
8438 !! html
8439 <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>
8440
8441 !! end
8442
8443 !! test
8444 Bug 6563: Section extraction for section suppressed by <includeonly>
8445 !! options
8446 section=1
8447 !! wikitext
8448 <includeonly>
8449 ==Includeonly section==
8450 </includeonly>
8451 ==Section 1==
8452 !! html
8453 ==Section 1==
8454 !! end
8455
8456 !! test
8457 Un-closed <includeonly>
8458 !! wikitext
8459 <includeonly>
8460 !! html
8461 !! end
8462
8463 # TODO: test with DOM fragment reuse!
8464 !! test
8465 Parsoid: DOM fragment reuse
8466 !! options
8467 parsoid=wt2wt,wt2html
8468 !! wikitext
8469 a{{echo|b<table></table>c}}d
8470
8471 a{{echo|b
8472 <table></table>
8473 c}}d
8474
8475 {{echo|a
8476
8477 <table></table>
8478
8479 b}}
8480 !! html
8481 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8482 <table></table>c"}},"i":0}}]}'>b</span>
8483 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8484
8485
8486 <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">
8487 </span>
8488 <table about="#mwt2"></table><span about="#mwt2">
8489 </span>
8490 <p about="#mwt2">cd</p>
8491
8492
8493 <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">
8494
8495 </span>
8496 <table about="#mwt3"></table><span about="#mwt3">
8497
8498 </span>
8499 <p about="#mwt3">b</p>
8500 !! end
8501
8502 !! test
8503 Parsoid: Merge double tds (bug 50603)
8504 !! options
8505 parsoid
8506 !! wikitext
8507 {|
8508 |{{echo|{{!}} foo}}
8509 |}
8510 !! html
8511 <table><tbody>
8512 <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>
8513 </tbody></table>
8514 !! end
8515
8516 !! test
8517 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8518 !! options
8519 parsoid
8520 !! wikitext
8521 {{echo|<div>}}
8522 {|
8523 |{{echo|{{!}} foo}}
8524 |}
8525 {{echo|</div>}}
8526 !! html
8527 <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}}]}'>
8528 <table><tbody>
8529 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8530 </tbody></table>
8531 </div>
8532 !! end
8533
8534 ###
8535 ### <includeonly> and <noinclude> in attributes
8536 ###
8537 !!test
8538 0. includeonly around the entire attribute
8539 !! wikitext
8540 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8541 !! html
8542 <p><span id="v2">bar</span>
8543 </p>
8544 !!end
8545
8546 !!test
8547 1. includeonly in html attr key
8548 !! wikitext
8549 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8550 !! html
8551 <p><span id="foo">bar</span>
8552 </p>
8553 !!end
8554
8555 !!test
8556 2. includeonly in html attr value
8557 !! wikitext
8558 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8559 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8560 !! html
8561 <p><span id="v1">bar</span>
8562 <span id="v1">bar</span>
8563 </p>
8564 !!end
8565
8566 !!test
8567 3. includeonly in part of an attr value
8568 !! wikitext
8569 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8570 !! html
8571 <p><span style="color:red;">bar</span>
8572 </p>
8573 !!end
8574
8575 !!test
8576 4. includeonly in table attributes
8577 !! wikitext
8578 {|
8579 |- <noinclude>
8580 |-
8581 |a
8582 </noinclude>
8583 |- <includeonly>
8584 |-
8585 |b
8586 </includeonly>
8587 |}
8588 !! html
8589 <table>
8590
8591
8592 <tr>
8593 <td>a
8594 </td></tr>
8595 </table>
8596
8597 !!end
8598
8599 ###
8600 ### Token Stream Patcher tests
8601 ###
8602 ### These tests won't always pass wt2wt and other modes because
8603 ### on serialization, the table will be output on a new line.
8604 ### For now, we are blacklisting them, and using this to test selser.
8605 ###
8606
8607 !!test
8608 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8609 !!options
8610 parsoid=wt2html,wt2wt
8611 !!wikitext
8612 {{echo|}}{| width = '100%'
8613 |foo
8614 |}
8615 !!html/parsoid
8616 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8617 <table width="100%">
8618 <tbody>
8619 <tr>
8620 <td>foo</td></tr></tbody></table>
8621 !!end
8622
8623 !!test
8624 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8625 !!options
8626 parsoid=wt2html,wt2wt
8627 !!wikitext
8628 <includeonly>a</includeonly>{| {{{b}}}
8629 |c
8630 |}
8631 !!html/parsoid
8632 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":"&lt;/includeonly>"}'/><span typeof="mw:Param" about="#mwt1" id="mwt1" data-mw="{}">{{{b}}}</span><table about="#mwt1">
8633 <tbody><tr><td>c</td></tr>
8634 </tbody></table>
8635 !!end
8636
8637 ###
8638 ### Testing parsing of templates where a template arg
8639 ### has the same name as the template itself.
8640 ###
8641
8642 !! article
8643 Template:quote
8644 !! text
8645 {{{quote|{{{1}}}}}}
8646 !! endarticle
8647
8648 !!test
8649 Templates: Template Name/Arg clash: 1. Use of positional param
8650 !! wikitext
8651 {{quote|foo}}
8652 !! html
8653 <p>foo
8654 </p>
8655 !!end
8656
8657 !!test
8658 Templates: Template Name/Arg clash: 2. Use of named param
8659 !! wikitext
8660 {{quote|quote=foo}}
8661 !! html
8662 <p>foo
8663 </p>
8664 !!end
8665
8666 !!test
8667 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8668 !! wikitext
8669 {{quote|quote}}
8670 !! html
8671 <p>quote
8672 </p>
8673 !!end
8674
8675 ###
8676 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8677 ###
8678
8679 !!test
8680 Templates: 1. Simple use
8681 !! wikitext
8682 {{echo|Foo}}
8683 !! html
8684 <p>Foo
8685 </p>
8686 !!end
8687
8688 !!test
8689 Templates: 2. Inside a block tag
8690 !! wikitext
8691 <div>{{echo|Foo}}</div>
8692 <blockquote>{{echo|Foo}}</blockquote>
8693 !! html
8694 <div>Foo</div>
8695 <blockquote>Foo</blockquote>
8696
8697 !!end
8698
8699 !!test
8700 Templates: P-wrapping: 1a. Templates on consecutive lines
8701 !! wikitext
8702 {{echo|Foo}}
8703 {{echo|bar}}
8704 !! html
8705 <p>Foo
8706 bar
8707 </p>
8708 !!end
8709
8710 !!test
8711 Templates: P-wrapping: 1b. Templates on consecutive lines
8712 !! wikitext
8713 Foo
8714
8715 {{echo|bar}}
8716 {{echo|baz}}
8717 !! html
8718 <p>Foo
8719 </p><p>bar
8720 baz
8721 </p>
8722 !!end
8723
8724 !!test
8725 Templates: P-wrapping: 1c. Templates on consecutive lines
8726 !! wikitext
8727 {{echo|Foo}}
8728 {{echo|bar}} <div>baz</div>
8729 !! html
8730 <p>Foo
8731 </p>
8732 bar <div>baz</div>
8733
8734 !!end
8735
8736 !!test
8737 Templates: P-wrapping: 1d. Template preceded by comment-only line
8738 !!options
8739 parsoid
8740 !! wikitext
8741 <!-- foo -->
8742 {{echo|Bar}}
8743 !! html
8744 <!-- foo -->
8745
8746 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8747 !!end
8748
8749 !!test
8750 Templates: Inline Text: 1. Multiple template uses
8751 !! wikitext
8752 {{echo|Foo}}bar{{echo|baz}}
8753 !! html
8754 <p>Foobarbaz
8755 </p>
8756 !!end
8757
8758 !!test
8759 Templates: Inline Text: 2. Back-to-back template uses
8760 !! wikitext
8761 {{echo|Foo}}{{echo|bar}}
8762 !! html
8763 <p>Foobar
8764 </p>
8765 !!end
8766
8767 !!test
8768 Templates: Block Tags: 1. Multiple template uses
8769 !! wikitext
8770 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8771 !! html
8772 <div>Foo</div><div>bar</div><div>baz</div>
8773
8774 !!end
8775
8776 !!test
8777 Templates: Block Tags: 2. Back-to-back template uses
8778 !! wikitext
8779 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8780 !! html
8781 <div>Foo</div><div>bar</div>
8782
8783 !!end
8784
8785 !!test
8786 Templates: Links: 1. Simple example
8787 !! wikitext
8788 {{echo|[[Foo|bar]]}}
8789 !! html
8790 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8791 </p>
8792 !!end
8793
8794 !!test
8795 Templates: Links: 2. Generation of link href
8796 !! wikitext
8797 [[{{echo|Foo}}|bar]]
8798 !! html
8799 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8800 </p>
8801 !!end
8802
8803 !!test
8804 Templates: Links: 3. Generation of part of a link href
8805 !! wikitext
8806 [[Fo{{echo|o}}|bar]]
8807
8808 [[Foo{{echo|bar}}]]
8809
8810 [[Foo{{echo|bar}}baz]]
8811
8812 [[Foo{{echo|bar}}|bar]]
8813
8814 [[:Foo{{echo|bar}}]]
8815
8816 [[:Foo{{echo|bar}}|bar]]
8817 !! html
8818 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8819 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8820 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8821 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8822 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8823 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8824 </p>
8825 !!end
8826
8827 !!test
8828 Templates: Links: 4. Multiple templates generating link href
8829 !! wikitext
8830 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8831 !! html
8832 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8833 </p>
8834 !!end
8835
8836 !!test
8837 Templates: Links: 5. Generation of link text
8838 !! wikitext
8839 [[Foo|{{echo|bar}}]]
8840 !! html
8841 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8842 </p>
8843 !!end
8844
8845 !!test
8846 Templates: Links: 5. Nested templates (only outermost template should be marked)
8847 !! wikitext
8848 {{echo|[[{{echo|Foo}}|bar]]}}
8849 !! html
8850 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8851 </p>
8852 !!end
8853
8854 !!test
8855 Templates: HTML Tag: 1. Generation of HTML attr. key
8856 !! wikitext
8857 <div {{echo|style}}="color:red;">foo</div>
8858 !! html
8859 <div style="color:red;">foo</div>
8860
8861 !!end
8862
8863 !!test
8864 Templates: HTML Tag: 2. Generation of HTML attr. value
8865 !! wikitext
8866 <div style={{echo|'color:red;'}}>foo</div>
8867 !! html
8868 <div style="color:red;">foo</div>
8869
8870 !!end
8871
8872 !!test
8873 Templates: HTML Tag: 3. Generation of HTML attr key and value
8874 !! wikitext
8875 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8876 !! html
8877 <div style="color:red;">foo</div>
8878
8879 !!end
8880
8881 !!test
8882 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8883 !! wikitext
8884 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8885 !! html
8886 <div title="This is a long title with just one piece templated">foo</div>
8887
8888 !!end
8889
8890 !!test
8891 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8892 !! wikitext
8893 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8894 !! html
8895 <div title="This is a long title with just one piece templated">foo</div>
8896
8897 !!end
8898
8899 !!test
8900 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8901 !! wikitext
8902 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8903 !! html
8904 <div title="This is a long title with just one piece templated">foo</div>
8905
8906 !!end
8907
8908 !!test
8909 Templates: HTML Tag: 7. Generation of partial attribute key string
8910 !! wikitext
8911 <div st{{echo|yle}}="color:red;">foo</div>
8912 !! html
8913 <div style="color:red;">foo</div>
8914
8915 !!end
8916
8917 !!test
8918 Templates: HTML Tables: 1. Generating start of a HTML table
8919 !! wikitext
8920 {{echo|<table><tr><td>foo</td>}}</tr></table>
8921 !! html
8922 <table><tr><td>foo</td></tr></table>
8923
8924 !!end
8925
8926 !!test
8927 Templates: HTML Tables: 2a. Generating middle of a HTML table
8928 !! wikitext
8929 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8930 !! html
8931 <table><tr><td>foo</td></tr></table>
8932
8933 !!end
8934
8935 !!test
8936 Templates: HTML Tables: 2b. Generating middle of a HTML table
8937 !! wikitext
8938 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8939 !! html
8940 <table><tr><td>foo</td></tr></table>
8941
8942 !!end
8943
8944 !!test
8945 Templates: HTML Tables: 3. Generating end of a HTML table
8946 !! wikitext
8947 <table><tr>{{echo|<td>foo</td></tr></table>}}
8948 !! html
8949 <table><tr><td>foo</td></tr></table>
8950
8951 !!end
8952
8953 !!test
8954 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8955 !! wikitext
8956 {{echo|<table>}}<tr><td>foo</td></tr></table>
8957 !! html
8958 <table><tr><td>foo</td></tr></table>
8959
8960 !!end
8961
8962 !!test
8963 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8964 !! wikitext
8965 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8966 !! html
8967 <table><tr><td>foo</td></tr></table>
8968
8969 !!end
8970
8971 !!test
8972 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8973 !! wikitext
8974 <table><tr>{{echo|<td>}}foo</td></tr></table>
8975 !! html
8976 <table><tr><td>foo</td></tr></table>
8977
8978 !!end
8979
8980 !!test
8981 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8982 !! wikitext
8983 <table><tr><td>foo{{echo|</td>}}</tr></table>
8984 !! html
8985 <table><tr><td>foo</td></tr></table>
8986
8987 !!end
8988
8989 !!test
8990 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8991 !! wikitext
8992 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8993 !! html
8994 <table><tr><td>foo</td></tr></table>
8995
8996 !!end
8997
8998 !!test
8999 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9000 !! wikitext
9001 <table><tr><td>foo</td></tr>{{echo|</table>}}
9002 !! html
9003 <table><tr><td>foo</td></tr></table>
9004
9005 !!end
9006
9007 !!test
9008 Templates: HTML Tables: 5. Proper fostering of categories from inside
9009 !!options
9010 parsoid=wt2html,wt2wt
9011 !! wikitext
9012 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9013 <!--Two categories (Bug 50330)-->
9014 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9015 !! html
9016 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9017 <!--Two categories (Bug 50330)-->
9018 <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>
9019 !!end
9020
9021 !!test
9022 Templates: Wiki Tables: 1a. Fostering of entire template content
9023 !! wikitext
9024 {|
9025 {{echo|a}}
9026 |}
9027 !! html
9028 <table>
9029 a
9030 <tr><td></td></tr></table>
9031
9032 !!end
9033
9034 !!test
9035 Templates: Wiki Tables: 1b. Fostering of entire template content
9036 !! wikitext
9037 {|
9038 {{echo|<div>}}
9039 foo
9040 {{echo|</div>}}
9041 |}
9042 !! html
9043 <table>
9044 <div>
9045 <p>foo
9046 </p>
9047 </div>
9048 <tr><td></td></tr></table>
9049
9050 !!end
9051
9052 !!test
9053 Templates: Wiki Tables: 2. Fostering of partial template content
9054 !! wikitext
9055 {|
9056 {{echo|a
9057 <div>b</div>}}
9058 |}
9059 !! html
9060 <table>
9061 a
9062 <div>b</div>
9063 <tr><td></td></tr></table>
9064
9065 !!end
9066
9067 !!test
9068 Templates: Wiki Tables: 3. td-content via multiple templates
9069 !! wikitext
9070 {|
9071 {{echo|{{pipe}}a}}{{echo|b}}
9072 |}
9073 !! html
9074 <table>
9075 <tr>
9076 <td>ab
9077 </td></tr></table>
9078
9079 !!end
9080
9081 !!test
9082 Templates: Wiki Tables: 4. Templated tags, no content
9083 !! wikitext
9084 {{tbl-start}}
9085 {{tbl-end}}
9086 !! html
9087 <table>
9088 <tr><td></td></tr></table>
9089
9090 !!end
9091
9092 !!test
9093 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9094 !! wikitext
9095 {{tbl-start}}
9096 |foo
9097 {{tbl-end}}
9098 !! html
9099 <table>
9100 <tr>
9101 <td>foo
9102 </td></tr></table>
9103
9104 !!end
9105
9106 !!test
9107 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9108 !! wikitext
9109 {{tbl-start}}
9110 {{!}}foo
9111 {{tbl-end}}
9112 !! html
9113 <table>
9114 <tr>
9115 <td>foo
9116 </td></tr></table>
9117
9118 !!end
9119
9120 !!test
9121 Templates: Lists: Multi-line list-items via templates
9122 !! wikitext
9123 *{{echo|a {{nonexistent|
9124 unused}}}}
9125 *{{echo|b {{nonexistent|
9126 unused}}}}
9127 !! html
9128 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
9129 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
9130
9131 !!end
9132
9133 !!test
9134 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9135 !! wikitext
9136 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9137 !! html
9138 <p><i>ab</i>c<i>d</i>e
9139 </p>
9140 !!end
9141
9142 !!test
9143 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9144 (PHP parser generates misnested html)
9145 !! wikitext
9146 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9147 !! html/parsoid
9148 <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>
9149 !!end
9150
9151 !!test
9152 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9153 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9154 !! options
9155 parsoid=wt2html,wt2wt
9156 !! wikitext
9157 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9158 !! html
9159 <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>
9160 <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>
9161 <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>
9162 !!end
9163
9164 !!test
9165 Templates: Ugly nesting: 4. Divs opened/closed across templates
9166 !! wikitext
9167 a<div>b{{echo|c</div>d}}e
9168 !! html
9169 a<div>bc</div>de
9170
9171 !!end
9172
9173 !!test
9174 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9175 (Parsoid-centric)
9176 !! options
9177 parsoid
9178 !! wikitext
9179 {|
9180 |{{echo|foo</table>}}
9181 |bar
9182 |}
9183 !! html
9184 <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|}"]}'>
9185
9186 <tbody>
9187 <tr>
9188 <td>foo</td></tr></tbody></table><span about="#mwt1">
9189 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9190 |}</span>
9191 !!end
9192
9193 !!test
9194 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9195 (Parsoid-centric)
9196 !! options
9197 parsoid
9198 !! wikitext
9199 <table>
9200 <tr>
9201 <td>
9202 <table>
9203 <tr>
9204 <td>1. {{echo|foo </table>}}</td>
9205 <td> bar </td>
9206 <td>2. {{echo|baz </table>}}</td>
9207 </tr>
9208 <tr>
9209 <td>abc</td>
9210 </tr>
9211 </table>
9212 </td>
9213 </tr>
9214 <tr>
9215 <td>xyz</td>
9216 </tr>
9217 </table>
9218 !! html
9219 <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>"]}'>
9220 <tbody><tr>
9221 <td>
9222 <table>
9223 <tbody><tr>
9224 <td>1. foo </td></tr></tbody></table></td>
9225 <td> bar </td>
9226 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9227 </span><span about="#mwt2">
9228 </span><span about="#mwt2">
9229 </span><span about="#mwt2">abc</span><span about="#mwt2">
9230 </span><span about="#mwt2">
9231 </span><span about="#mwt2">
9232 </span><span about="#mwt2">
9233 </span><span about="#mwt2">
9234 </span><span about="#mwt2">
9235 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9236 </span><span about="#mwt2">
9237 </span>
9238 !!end
9239
9240 !! test
9241 Templates: Ugly templates: 3. newline-only template parameter
9242 !! wikitext
9243 foo {{echo|
9244 }}
9245 !! html
9246 <p>foo
9247 </p>
9248 !! end
9249
9250 # This looks like a bug: a single newline triggers p/br for some reason.
9251 !! test
9252 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9253 !! wikitext
9254 {{echo|
9255 }}
9256 !! html
9257 <p><br />
9258 </p>
9259 !! end
9260
9261 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9262 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9263 !! test
9264 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9265 !! wikitext
9266 {{echo|<table>}}
9267 {{echo|<div>foo}}
9268 {{echo|</table>}}
9269 !! html/parsoid
9270 <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
9271 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9272 </table>
9273 !! end
9274
9275 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9276 # that are "identical" and generate nesting cycles in the algorithm
9277 !! test
9278 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9279 !! wikitext
9280 {{echo|<table><tr><td><table>}}
9281 {{echo|<div>}}
9282 {{echo|</div>}}
9283 !! html/parsoid
9284 <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"}'>
9285 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9286 </table></td></tr></tbody></table>
9287 !! end
9288
9289 !!test
9290 Parser Functions: 1. Simple example
9291 !! wikitext
9292 {{uc:foo}}
9293 !! html
9294 <p>FOO
9295 </p>
9296 !!end
9297
9298 !!test
9299 Parser Functions: 2. Nested use (only outermost should be marked up)
9300 !! wikitext
9301 {{uc:{{lc:FOO}}}}
9302 !! html
9303 <p>FOO
9304 </p>
9305 !!end
9306
9307 ###
9308 ### Pre-save transform tests
9309 ###
9310 !! test
9311 pre-save transform: subst:
9312 !! options
9313 PST
9314 !! wikitext
9315 {{subst:test}}
9316 !! html
9317 This is a test template
9318 !! end
9319
9320 !! test
9321 pre-save transform: normal template
9322 !! options
9323 PST
9324 !! wikitext
9325 {{test}}
9326 !! html
9327 {{test}}
9328 !! end
9329
9330 !! test
9331 pre-save transform: nonexistent template
9332 !! options
9333 PST
9334 !! wikitext
9335 {{thistemplatedoesnotexist}}
9336 !! html
9337 {{thistemplatedoesnotexist}}
9338 !! end
9339
9340
9341 !! test
9342 pre-save transform: subst magic variables
9343 !! options
9344 PST
9345 !! wikitext
9346 {{subst:SITENAME}}
9347 !! html
9348 MediaWiki
9349 !! end
9350
9351 # This is bug 89, which I fixed. -- wtm
9352 !! test
9353 pre-save transform: subst: templates with parameters
9354 !! options
9355 pst
9356 !! wikitext
9357 {{subst:paramtest|param="something else"}}
9358 !! html
9359 This is a test template with parameter "something else"
9360 !! end
9361
9362 !! article
9363 Template:nowikitest
9364 !! text
9365 <nowiki>'''not wiki'''</nowiki>
9366 !! endarticle
9367
9368 !! test
9369 pre-save transform: nowiki in subst (bug 1188)
9370 !! options
9371 pst
9372 !! wikitext
9373 {{subst:nowikitest}}
9374 !! html
9375 <nowiki>'''not wiki'''</nowiki>
9376 !! end
9377
9378
9379 !! article
9380 Template:commenttest
9381 !! text
9382 This template has <!-- a comment --> in it.
9383 !! endarticle
9384
9385 !! test
9386 pre-save transform: comment in subst (bug 1936)
9387 !! options
9388 pst
9389 !! wikitext
9390 {{subst:commenttest}}
9391 !! html
9392 This template has <!-- a comment --> in it.
9393 !! end
9394
9395 !! test
9396 pre-save transform: unclosed tag
9397 !! options
9398 pst noxml
9399 !! wikitext
9400 <nowiki>'''not wiki'''
9401 !! html
9402 <nowiki>'''not wiki'''
9403 !! end
9404
9405 !! test
9406 pre-save transform: mixed tag case
9407 !! options
9408 pst noxml
9409 !! wikitext
9410 <NOwiki>'''not wiki'''</noWIKI>
9411 !! html
9412 <NOwiki>'''not wiki'''</noWIKI>
9413 !! end
9414
9415 !! test
9416 pre-save transform: unclosed comment in <nowiki>
9417 !! options
9418 pst noxml
9419 !! wikitext
9420 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9421 !! html
9422 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9423 !!end
9424
9425 # Leading @ in this template definition works around a limitation
9426 # in parsoid's parserTests which otherwise strips the <span> from the
9427 # result (confusing it for a template wrapper)
9428 !! article
9429 Template:dangerous
9430 !!text
9431 @<span onmouseover="alert('crap')">Oh no</span>
9432 !!endarticle
9433
9434 !!test
9435 (confirming safety of fix for subst bug 1936)
9436 !! wikitext
9437 {{Template:dangerous}}
9438 !! html
9439 <p>@<span>Oh no</span>
9440 </p>
9441 !! end
9442
9443 !! test
9444 pre-save transform: comment containing gallery (bug 5024)
9445 !! options
9446 pst
9447 !! wikitext
9448 <!-- <gallery>data</gallery> -->
9449 !! html
9450 <!-- <gallery>data</gallery> -->
9451 !!end
9452
9453 !! test
9454 pre-save transform: comment containing extension
9455 !! options
9456 pst
9457 !! wikitext
9458 <!-- <tag>data</tag> -->
9459 !! html
9460 <!-- <tag>data</tag> -->
9461 !!end
9462
9463 !! test
9464 pre-save transform: comment containing nowiki
9465 !! options
9466 pst
9467 !! wikitext
9468 <!-- <nowiki>data</nowiki> -->
9469 !! html
9470 <!-- <nowiki>data</nowiki> -->
9471 !!end
9472
9473 !! test
9474 pre-save transform: <noinclude> in subst (bug 3298)
9475 !! options
9476 pst
9477 !! wikitext
9478 {{subst:Includes}}
9479 !! html
9480 Foobar
9481 !! end
9482
9483 !! test
9484 pre-save transform: <onlyinclude> in subst (bug 3298)
9485 !! options
9486 pst
9487 !! wikitext
9488 {{subst:Includes2}}
9489 !! html
9490 Foo
9491 !! end
9492
9493 !! article
9494 Template:SubstTest
9495 !!text
9496 {{<includeonly>subst:</includeonly>Includes}}
9497 !! endarticle
9498
9499 !! article
9500 Template:SafeSubstTest
9501 !! text
9502 {{<includeonly>safesubst:</includeonly>Includes}}
9503 !! endarticle
9504
9505 !! test
9506 bug 22297: safesubst: works during PST
9507 !! options
9508 pst
9509 !! wikitext
9510 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9511 !! html
9512 FoobarFoobar
9513 !! end
9514
9515 !! test
9516 bug 22297: safesubst: works during normal parse
9517 !! wikitext
9518 {{SafeSubstTest}}
9519 !! html
9520 <p>Foobar
9521 </p>
9522 !! end
9523
9524 !! test
9525 subst: does not work during normal parse
9526 !! wikitext
9527 {{SubstTest}}
9528 !! html
9529 <p>{{subst:Includes}}
9530 </p>
9531 !! end
9532
9533 !! test
9534 pre-save transform: context links ("pipe trick")
9535 !! options
9536 pst
9537 !! wikitext
9538 [[Article (context)|]]
9539 [[Bar:Article|]]
9540 [[:Bar:Article|]]
9541 [[Bar:Article (context)|]]
9542 [[:Bar:Article (context)|]]
9543 [[|Article]]
9544 [[|Article (context)]]
9545 [[Bar:X (Y) Z|]]
9546 [[:Bar:X (Y) Z|]]
9547 !! html
9548 [[Article (context)|Article]]
9549 [[Bar:Article|Article]]
9550 [[:Bar:Article|Article]]
9551 [[Bar:Article (context)|Article]]
9552 [[:Bar:Article (context)|Article]]
9553 [[Article]]
9554 [[Article (context)]]
9555 [[Bar:X (Y) Z|X (Y) Z]]
9556 [[:Bar:X (Y) Z|X (Y) Z]]
9557 !! end
9558
9559 !! test
9560 pre-save transform: context links ("pipe trick") with interwiki prefix
9561 !! options
9562 pst
9563 !! wikitext
9564 [[interwiki:Article|]]
9565 [[:interwiki:Article|]]
9566 [[interwiki:Bar:Article|]]
9567 [[:interwiki:Bar:Article|]]
9568 !! html
9569 [[interwiki:Article|Article]]
9570 [[:interwiki:Article|Article]]
9571 [[interwiki:Bar:Article|Bar:Article]]
9572 [[:interwiki:Bar:Article|Bar:Article]]
9573 !! end
9574
9575 !! test
9576 pre-save transform: context links ("pipe trick") with parens in title
9577 !! options
9578 pst title=[[Somearticle (context)]]
9579 !! wikitext
9580 [[|Article]]
9581 !! html
9582 [[Article (context)|Article]]
9583 !! end
9584
9585 !! test
9586 pre-save transform: context links ("pipe trick") with comma in title
9587 !! options
9588 pst title=[[Someplace, Somewhere]]
9589 !! wikitext
9590 [[|Otherplace]]
9591 [[Otherplace, Elsewhere|]]
9592 [[Otherplace, Elsewhere, Anywhere|]]
9593 !! html
9594 [[Otherplace, Somewhere|Otherplace]]
9595 [[Otherplace, Elsewhere|Otherplace]]
9596 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9597 !! end
9598
9599 !! test
9600 pre-save transform: context links ("pipe trick") with parens and comma
9601 !! options
9602 pst title=[[Someplace (IGNORED), Somewhere]]
9603 !! wikitext
9604 [[|Otherplace]]
9605 [[Otherplace (place), Elsewhere|]]
9606 !! html
9607 [[Otherplace, Somewhere|Otherplace]]
9608 [[Otherplace (place), Elsewhere|Otherplace]]
9609 !! end
9610
9611 !! test
9612 pre-save transform: context links ("pipe trick") with comma and parens
9613 !! options
9614 pst title=[[Who, me? (context)]]
9615 !! wikitext
9616 [[|Yes, you.]]
9617 [[Me, Myself, and I (1937 song)|]]
9618 !! html
9619 [[Yes, you. (context)|Yes, you.]]
9620 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9621 !! end
9622
9623 !! test
9624 pre-save transform: context links ("pipe trick") with namespace
9625 !! options
9626 pst title=[[Ns:Somearticle]]
9627 !! wikitext
9628 [[|Article]]
9629 !! html
9630 [[Ns:Article|Article]]
9631 !! end
9632
9633 !! test
9634 pre-save transform: context links ("pipe trick") with namespace and parens
9635 !! options
9636 pst title=[[Ns:Somearticle (context)]]
9637 !! wikitext
9638 [[|Article]]
9639 !! html
9640 [[Ns:Article (context)|Article]]
9641 !! end
9642
9643 !! test
9644 pre-save transform: context links ("pipe trick") with namespace and comma
9645 !! options
9646 pst title=[[Ns:Somearticle, Context, Whatever]]
9647 !! wikitext
9648 [[|Article]]
9649 !! html
9650 [[Ns:Article, Context, Whatever|Article]]
9651 !! end
9652
9653 !! test
9654 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9655 !! options
9656 pst title=[[Ns:Somearticle, Context (context)]]
9657 !! wikitext
9658 [[|Article]]
9659 !! html
9660 [[Ns:Article (context)|Article]]
9661 !! end
9662
9663 !! test
9664 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9665 !! options
9666 pst title=[[Ns:Somearticle (IGNORED), Context]]
9667 !! wikitext
9668 [[|Article]]
9669 !! html
9670 [[Ns:Article, Context|Article]]
9671 !! end
9672
9673 !! test
9674 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9675 !! options
9676 pst
9677 !! wikitext
9678 [[Article(context)|]]
9679 [[Bar:Article(context)|]]
9680 [[:Bar:Article(context)|]]
9681 [[|Article(context)]]
9682 [[Bar:X(Y)Z|]]
9683 [[:Bar:X(Y)Z|]]
9684 !! html
9685 [[Article(context)|Article]]
9686 [[Bar:Article(context)|Article]]
9687 [[:Bar:Article(context)|Article]]
9688 [[Article(context)]]
9689 [[Bar:X(Y)Z|X(Y)Z]]
9690 [[:Bar:X(Y)Z|X(Y)Z]]
9691 !! end
9692
9693 !! test
9694 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9695 !! options
9696 pst
9697 !! wikitext
9698 [[Article (context)|]]
9699 [[Bar:Article (context)|]]
9700 [[:Bar:Article (context)|]]
9701 [[|Article (context)]]
9702 [[Bar:X (Y) Z|]]
9703 [[:Bar:X (Y) Z|]]
9704 !! html
9705 [[Article (context)|Article]]
9706 [[Bar:Article (context)|Article]]
9707 [[:Bar:Article (context)|Article]]
9708 [[Article (context)]]
9709 [[Bar:X (Y) Z|X (Y) Z]]
9710 [[:Bar:X (Y) Z|X (Y) Z]]
9711 !! end
9712
9713 !! test
9714 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9715 !! options
9716 pst
9717 !! wikitext
9718 [[Article(context)|]]
9719 [[Bar:Article(context)|]]
9720 [[:Bar:Article(context)|]]
9721 [[|Article(context)]]
9722 [[Bar:X(Y)Z|]]
9723 [[:Bar:X(Y)Z|]]
9724 !! html
9725 [[Article(context)|Article]]
9726 [[Bar:Article(context)|Article]]
9727 [[:Bar:Article(context)|Article]]
9728 [[Article(context)]]
9729 [[Bar:X(Y)Z|X(Y)Z]]
9730 [[:Bar:X(Y)Z|X(Y)Z]]
9731 !! end
9732
9733 !! test
9734 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9735 !! options
9736 pst
9737 !! wikitext
9738 [[Article (context), context|]]
9739 [[Article (context),context|]]
9740 [[Bar:Article (context), context|]]
9741 [[Bar:Article (context),context|]]
9742 [[:Bar:Article (context), context|]]
9743 [[:Bar:Article (context),context|]]
9744 !! html
9745 [[Article (context), context|Article]]
9746 [[Article (context),context|Article]]
9747 [[Bar:Article (context), context|Article]]
9748 [[Bar:Article (context),context|Article]]
9749 [[:Bar:Article (context), context|Article]]
9750 [[:Bar:Article (context),context|Article]]
9751 !! end
9752
9753 !! test
9754 pre-save transform: trim trailing empty lines
9755 !! options
9756 pst
9757 !! wikitext
9758 Empty lines are trimmed
9759
9760
9761
9762
9763 !! html
9764 Empty lines are trimmed
9765 !! end
9766
9767 !! test
9768 pre-save transform: Signature expansion
9769 !! options
9770 pst
9771 !! wikitext
9772 * ~~~
9773 * <noinclude>~~~</noinclude>
9774 * <includeonly>~~~</includeonly>
9775 * <onlyinclude>~~~</onlyinclude>
9776 !! html
9777 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9778 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9779 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9780 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9781 !! end
9782
9783
9784 !! test
9785 pre-save transform: Signature expansion in nowiki tags (bug 93)
9786 !! options
9787 pst disabled
9788 !! wikitext
9789 Shall not expand:
9790
9791 <nowiki>~~~~</nowiki>
9792
9793 <includeonly><nowiki>~~~~</nowiki></includeonly>
9794
9795 <noinclude><nowiki>~~~~</nowiki></noinclude>
9796
9797 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9798
9799 {{subst:Foo}} shall be converted to FOO
9800
9801 As well as inside noinclude/onlyinclude
9802 <noinclude>{{subst:Foo}}</noinclude>
9803 <onlyinclude>{{subst:Foo}}</onlyinclude>
9804
9805 But not inside includeonly
9806 <includeonly>{{subst:Foo}}</includeonly>
9807 !! html
9808 Shall not expand:
9809
9810 <nowiki>~~~~</nowiki>
9811
9812 <includeonly><nowiki>~~~~</nowiki></includeonly>
9813
9814 <noinclude><nowiki>~~~~</nowiki></noinclude>
9815
9816 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9817
9818 FOO shall be converted to FOO
9819
9820 As well as inside noinclude/onlyinclude
9821 <noinclude>FOO</noinclude>
9822 <onlyinclude>FOO</onlyinclude>
9823
9824 But not inside includeonly
9825 <includeonly>{{subst:Foo}}</includeonly>
9826 !! end
9827
9828 !! test
9829 Parsoid: Recognize nowiki with trailing space in tags
9830 !! options
9831 parsoid=wt2html
9832 !! wikitext
9833 <nowiki ><div>[[foo]]</nowiki >
9834
9835 a<nowiki / >b
9836
9837 c<nowiki />d
9838
9839 e<nowiki/ >f
9840 !! html
9841 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9842 <p>ab</p>
9843 <p>cd</p>
9844 <p>ef</p>
9845 !! end
9846
9847 !! test
9848 Parsoid: Recognize nowiki with odd capitalization
9849 !! options
9850 parsoid=wt2html
9851 !! wikitext
9852 <noWikI ><div>[[foo]]</Nowiki >
9853 !! html
9854 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9855 !! end
9856
9857
9858 !! test
9859 Parsoid: Escape nowiki with trailing space in tags
9860 !! options
9861 parsoid=html2wt
9862 !! wikitext
9863 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9864
9865 a&lt;nowiki /&gt;b
9866
9867 c&lt;nowiki/ &gt;d
9868 !! html
9869 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9870 <p>a&lt;nowiki /&gt;b</p>
9871 <p>c&lt;nowiki/ &gt;d</p>
9872 !! end
9873
9874 !! test
9875 Parsoid: Escape weird noWikI capitalizations
9876 !! options
9877 parsoid=html2wt
9878 !! wikitext
9879 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9880 !! html
9881 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9882 !! end
9883
9884 ###
9885 ### Message transform tests
9886 ###
9887 !! test
9888 message transform: magic variables
9889 !! options
9890 msg
9891 !! wikitext
9892 {{SITENAME}}
9893 !! html
9894 MediaWiki
9895 !! end
9896
9897 !! test
9898 message transform: should not transform wiki markup
9899 !! options
9900 msg
9901 !! wikitext
9902 ''test''
9903 !! html
9904 ''test''
9905 !! end
9906
9907 !! test
9908 message transform: <noinclude> in transcluded template (bug 4926)
9909 !! options
9910 msg
9911 !! wikitext
9912 {{Includes}}
9913 !! html
9914 Foobar
9915 !! end
9916
9917 !! test
9918 message transform: <onlyinclude> in transcluded template (bug 4926)
9919 !! options
9920 msg
9921 !! wikitext
9922 {{Includes2}}
9923 !! html
9924 Foo
9925 !! end
9926
9927 !! test
9928 {{#special:}} page name, known
9929 !! options
9930 msg
9931 !! wikitext
9932 {{#special:Recentchanges}}
9933 !! html
9934 Special:RecentChanges
9935 !! end
9936
9937 !! test
9938 {{#special:}} page name with subpage, known
9939 !! options
9940 msg
9941 !! wikitext
9942 {{#special:Recentchanges/param}}
9943 !! html
9944 Special:RecentChanges/param
9945 !! end
9946
9947 !! test
9948 {{#special:}} page name, unknown
9949 !! options
9950 msg
9951 !! wikitext
9952 {{#special:foobar nonexistent}}
9953 !! html
9954 Special:Foobar nonexistent
9955 !! end
9956
9957 !! test
9958 {{#speciale:}} page name, known
9959 !! options
9960 msg
9961 !! wikitext
9962 {{#speciale:Recentchanges}}
9963 !! html
9964 Special:RecentChanges
9965 !! end
9966
9967 !! test
9968 {{#speciale:}} page name with subpage, known
9969 !! options
9970 msg
9971 !! wikitext
9972 {{#speciale:Recentchanges/param}}
9973 !! html
9974 Special:RecentChanges/param
9975 !! end
9976
9977 !! test
9978 {{#speciale:}} page name, unknown
9979 !! options
9980 msg
9981 !! wikitext
9982 {{#speciale:foobar nonexistent}}
9983 !! html
9984 Special:Foobar_nonexistent
9985 !! end
9986
9987 ###
9988 ### Images
9989 ###
9990 ### For Parsoid-specific tests, see
9991 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9992
9993 !! test
9994 Simple image
9995 !! options
9996 parsoid=wt2html,wt2wt,html2html
9997 !! wikitext
9998 [[Image:foobar.jpg]]
9999 !! html/php
10000 <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>
10001 </p>
10002 !! html/parsoid
10003 <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>
10004 </p>
10005 !! end
10006
10007 !! test
10008 Simple image (using File: namespace, now canonical)
10009 !! wikitext
10010 [[File:Foobar.jpg]]
10011 !! html/php
10012 <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>
10013 </p>
10014 !! html/parsoid
10015 <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>
10016 </p>
10017 !! end
10018
10019 !! test
10020 Right-aligned image
10021 !! wikitext
10022 [[File:Foobar.jpg|right]]
10023 !! html/php
10024 <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>
10025
10026 !! html/parsoid
10027 <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>
10028 !! end
10029
10030 !! test
10031 Image with caption
10032 !! wikitext
10033 [[File:Foobar.jpg|right|Caption text]]
10034 !! html/php
10035 <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>
10036
10037 !! html/parsoid
10038 <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>
10039 !! end
10040
10041 !! test
10042 Image with caption, bug 53312 #1
10043 !! wikitext
10044 [[File:Foobar.jpg|right|Caption page stuff]]
10045 !! html/php
10046 <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>
10047
10048 !! html/parsoid
10049 <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>
10050 !! end
10051
10052 !! test
10053 Image with caption, bug 53312 #2
10054 !! wikitext
10055 [[File:Foobar.jpg|right|Caption page=]]
10056 !! html/php
10057 <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>
10058
10059 !! html/parsoid
10060 <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>
10061 !! end
10062
10063 !! test
10064 Image with caption, bug 53312 #3
10065 !! wikitext
10066 [[File:Foobar.jpg|right|Caption page=stuff]]
10067 !! html/php
10068 <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>
10069
10070 !! html/parsoid
10071 <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>
10072 !! end
10073
10074 !! test
10075 Allow empty links in image captions (Bug 60753)
10076 !! options
10077 thumbsize=220
10078 !! wikitext
10079 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10080 [[]]
10081 [[Link2]]
10082 ]]
10083 !! html/php
10084 <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>
10085
10086 !! html/parsoid
10087 <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>
10088 [[]]
10089 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10090 </figcaption></figure>
10091 !! end
10092
10093 !! test
10094 Link with empty target
10095 !! wikitext
10096 [[]]
10097 !! html
10098 <p>[[]]
10099 </p>
10100 !! end
10101
10102 !! test
10103 Image with empty attribute
10104 !! options
10105 parsoid=wt2html,wt2wt,html2html
10106 !! wikitext
10107 [[File:Foobar.jpg|right||Caption text]]
10108 !! html/php
10109 <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>
10110
10111 !! html/parsoid
10112 <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>
10113 !! end
10114
10115 !! test
10116 1. Block image with individual attributes from templates
10117 !! wikitext
10118 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10119 !! html/php
10120 <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>
10121
10122 !! html/parsoid
10123 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10124 !! end
10125
10126 !! test
10127 2. Block Image with individual attributes from templates
10128 !! wikitext
10129 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10130 !! html/php
10131 <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>
10132
10133 !! html/parsoid
10134 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10135 !! end
10136
10137 !! test
10138 3. Inline image with individual attributes from templates
10139 !! wikitext
10140 [[File:Foobar.jpg|{{echo|50px}}]]
10141 !! html/php
10142 <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>
10143 </p>
10144 !! html/parsoid
10145 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10146 !! end
10147
10148 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10149 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10150 !! test
10151 Image with multiple attributes from the same template
10152 !! wikitext
10153 [[File:Foobar.jpg|{{image_attribs}}]]
10154 !! html/php
10155 <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>
10156
10157 !! html/parsoid
10158 <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>
10159 !! end
10160
10161 !! test
10162 Image with link tails
10163 !! options
10164 thumbsize=220
10165 !! wikitext
10166 123[[File:Foobar.jpg]]456
10167 123[[File:Foobar.jpg|right]]456
10168 123[[File:Foobar.jpg|thumb]]456
10169 !! html/php
10170 <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
10171 </p>
10172 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
10173 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
10174
10175 !! html/parsoid
10176 <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>
10177 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
10178 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
10179 !! end
10180
10181 !! test
10182 Image with multiple captions -- only last one is accepted
10183 !! wikitext
10184 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10185 !! html/php
10186 <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>
10187
10188 !! html/parsoid
10189 <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>
10190 !! end
10191
10192 !! test
10193 Image with multiple widths -- use last
10194 !! wikitext
10195 [[File:Foobar.jpg|200px|300px|caption]]
10196 !! html/php
10197 <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>
10198 </p>
10199 !! html/parsoid
10200 <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>
10201 !! end
10202
10203 !! test
10204 Image with multiple alignments -- use first (bug 48664)
10205 !! options
10206 thumbsize=220
10207 !! wikitext
10208 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10209
10210 [[File:Foobar.jpg|middle|text-top|caption]]
10211 !! html/php
10212 <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>
10213 <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>
10214 </p>
10215 !! html/parsoid
10216 <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>
10217 <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>
10218 !! end
10219
10220 !! test
10221 Image with width attribute at different positions
10222 !! wikitext
10223 [[File:Foobar.jpg|200px|right|Caption]]
10224 [[File:Foobar.jpg|right|200px|Caption]]
10225 [[File:Foobar.jpg|right|Caption|200px]]
10226 !! html/php
10227 <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>
10228 <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>
10229 <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>
10230
10231 !! html/parsoid
10232 <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>
10233 <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>
10234 <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>
10235 !! end
10236
10237 # a sad bit of backward-compatibility
10238 !! test
10239 Image with size specified with pxpx (bug 13500, 51628)
10240 !! options
10241 parsoid=wt2html,wt2wt,html2html
10242 !! wikitext
10243 [[File:Foobar.jpg|20pxpx]]
10244 [[File:Foobar.jpg|200x20pxpx]]
10245 !! html/php
10246 <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>
10247 <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>
10248 </p>
10249 !! html/parsoid
10250 <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>
10251 !! end
10252
10253 !! test
10254 Image with link parameter, wiki target
10255 !! wikitext
10256 [[File:Foobar.jpg|link=Main Page]]
10257 !! html/php
10258 <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>
10259 </p>
10260 !! html/parsoid
10261 <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>
10262 !! end
10263
10264 # parsoid bug 49293 (part 1)
10265 !! test
10266 Image with link parameter, URL target
10267 !! wikitext
10268 [[File:Foobar.jpg|link=http://example.com/]]
10269 !! html/php
10270 <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>
10271 </p>
10272 !! html/parsoid
10273 <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>
10274 !! end
10275
10276 # parsoid bug 49293 (part 2)
10277 !! test
10278 Image with link parameter, protocol-less URL target
10279 !! wikitext
10280 [[File:Foobar.jpg|link=//example.com/]]
10281 !! html/php
10282 <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>
10283 </p>
10284 !! html/parsoid
10285 <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>
10286 !! end
10287
10288 !! test
10289 Image with link parameter, wgExternalLinkTarget
10290 !! wikitext
10291 [[Image:foobar.jpg|link=http://example.com/]]
10292 !! config
10293 wgExternalLinkTarget='foobar'
10294 !! html
10295 <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>
10296 </p>
10297 !! end
10298
10299 !! test
10300 Image with link parameter, wgNoFollowLinks set to false
10301 !! wikitext
10302 [[Image:foobar.jpg|link=http://example.com/]]
10303 !! config
10304 wgNoFollowLinks=false
10305 !! html
10306 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10307 </p>
10308 !! end
10309
10310 !! test
10311 Image with link parameter, wgNoFollowDomainExceptions
10312 !! wikitext
10313 [[Image:foobar.jpg|link=http://example.com/]]
10314 !! config
10315 wgNoFollowDomainExceptions='example.com'
10316 !! html
10317 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10318 </p>
10319 !! end
10320
10321 !! test
10322 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10323 !! wikitext
10324 [[Image:foobar.jpg|link=http://example.com/|Title]]
10325 !! config
10326 wgExternalLinkTarget='foobar'
10327 !! html
10328 <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>
10329 </p>
10330 !! end
10331
10332 !! test
10333 Image with empty link parameter
10334 !! wikitext
10335 [[File:Foobar.jpg|link=]]
10336 !! html/php
10337 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10338 </p>
10339 !! html/parsoid
10340 <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>
10341 !! end
10342
10343 !! test
10344 Image with link parameter (wiki target) and unnamed parameter
10345 !! wikitext
10346 [[File:Foobar.jpg|link=Main_Page|Title]]
10347 !! html/php
10348 <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>
10349 </p>
10350 !! html/parsoid
10351 <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>
10352 !! end
10353
10354 !! test
10355 Image with link parameter (URL target) and unnamed parameter
10356 !! wikitext
10357 [[File:Foobar.jpg|link=http://example.com/|Title]]
10358 !! html/php
10359 <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>
10360 </p>
10361 !! html/parsoid
10362 <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>
10363 !! end
10364
10365 !! test
10366 Thumbnail image with link parameter
10367 !! options
10368 thumbsize=220
10369 parsoid=wt2html,wt2wt,html2html
10370 !! wikitext
10371 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10372 !! html/php
10373 <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>
10374
10375 !! html/parsoid
10376 <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>
10377 !! end
10378
10379 !! test
10380 Manually-specified thumbnail image
10381 !! options
10382 thumbsize=220
10383 !! wikitext
10384 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10385 !! html/php
10386 <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>
10387
10388 !! html/parsoid
10389 <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>
10390 !! end
10391
10392 !! test
10393 Manually-specified thumbnail image with explicit link to wiki page
10394 !! options
10395 thumbsize=220
10396 parsoid=wt2html,wt2wt,html2html
10397 !! wikitext
10398 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10399 !! html/php
10400 <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>
10401
10402 !! html/parsoid
10403 <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>
10404 !! end
10405
10406 !! test
10407 Manually-specified thumbnail image with explicit link to url
10408 !! options
10409 thumbsize=220
10410 parsoid=wt2html,wt2wt,html2html
10411 !! wikitext
10412 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10413 !! html/php
10414 <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>
10415
10416 !! html/parsoid
10417 <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>
10418 !! end
10419
10420 !! test
10421 Manually-specified thumbnail image with explicit no link
10422 !! options
10423 thumbsize=220
10424 parsoid=wt2html,wt2wt,html2html
10425 !! wikitext
10426 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10427 !! html/php
10428 <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>
10429
10430 !! html/parsoid
10431 <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>
10432 !! end
10433
10434 !! test
10435 Manually-specified thumbnail image with explicit link and alt text
10436 !! options
10437 thumbsize=220
10438 parsoid=wt2html,wt2wt,html2html
10439 !! wikitext
10440 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10441 !! html/php
10442 <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>
10443
10444 !! html/parsoid
10445 <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>
10446 !! end
10447
10448 !! test
10449 Image with frame and link
10450 !! options
10451 parsoid=wt2html,wt2wt,html2html
10452 !! wikitext
10453 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10454 !! html/php
10455 <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>
10456
10457 !! html/parsoid
10458 <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>
10459 !! end
10460
10461 !! test
10462 Image with frame and link and explicit alt
10463 !! options
10464 parsoid=wt2html,wt2wt,html2html
10465 !! wikitext
10466 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10467 !! html/php
10468 <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>
10469
10470 !! html/parsoid
10471 <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>
10472 !! end
10473
10474 !! test
10475 Image with wiki markup in implicit alt
10476 !! options
10477 parsoid=wt2html,wt2wt,html2html
10478 !! wikitext
10479 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10480
10481 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10482 !! html/php
10483 <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>
10484 </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>
10485 </p>
10486 !! html/parsoid
10487 <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>
10488 <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>
10489 !! end
10490
10491 ###################
10492 # Conflicting image format options.
10493 # First option specified should 'win'.
10494 # All three cases in each test should be identical.
10495
10496 !! test
10497 Image with 'frameless' first.
10498 !! options
10499 parsoid=wt2html,wt2wt,html2html
10500 !! wikitext
10501 [[File:Foobar.jpg|frameless|caption]]
10502
10503 [[File:Foobar.jpg|frameless|frame|caption]]
10504
10505 [[File:Foobar.jpg|frameless|thumb|caption]]
10506 !! html/php
10507 <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>
10508 </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>
10509 </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>
10510 </p>
10511 !! html/parsoid
10512 <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>
10513 <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>
10514 <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>
10515 !! end
10516
10517 !! test
10518 Image with 'frame' first.
10519 !! options
10520 parsoid=wt2html,wt2wt,html2html
10521 !! wikitext
10522 [[File:Foobar.jpg|frame|caption]]
10523 [[File:Foobar.jpg|frame|frameless|caption]]
10524 [[File:Foobar.jpg|frame|thumb|caption]]
10525 !! html/php
10526 <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>
10527 <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>
10528 <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>
10529
10530 !! html/parsoid
10531 <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>
10532 !! end
10533
10534 !! test
10535 Image with 'thumb' first.
10536 !! options
10537 parsoid=wt2html,wt2wt,html2html
10538 !! wikitext
10539 [[File:Foobar.jpg|thumb|caption]]
10540 [[File:Foobar.jpg|thumb|frameless|caption]]
10541 [[File:Foobar.jpg|thumb|frame|caption]]
10542 !! html/php
10543 <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>
10544 <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>
10545 <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>
10546
10547 !! html/parsoid
10548 <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>
10549 !! end
10550
10551 ###################
10552 # Image sizing.
10553 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10554 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10555 # Foobar has actual size of 1941x220
10556 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10557 # a scalable format.
10558 # 2. Framed images always ignore size options; always render at default size.
10559 # 3. "Unspecified format" and border are the only types which can be
10560 # enlarged.
10561
10562 !! test
10563 Image: "unspecified format" and border enlarge
10564 !! options
10565 parsoid=wt2html,wt2wt,html2html
10566 !! wikitext
10567 [[File:Foobar.jpg|2000px]]
10568
10569 [[File:Foobar.jpg|border|2000px]]
10570 !! html/php
10571 <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>
10572 </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>
10573 </p>
10574 !! html/parsoid
10575 <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>
10576 <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>
10577 !! end
10578
10579 !! test
10580 Image: "unspecified format" and border reduce
10581 !! options
10582 parsoid=wt2html,wt2wt,html2html
10583 !! wikitext
10584 [[File:Foobar.jpg|1000px]]
10585
10586 [[File:Foobar.jpg|border|1000px]]
10587 !! html/php
10588 <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>
10589 </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>
10590 </p>
10591 !! html/parsoid
10592 <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>
10593 <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>
10594 !! end
10595
10596 !! test
10597 Image: thumbs reduce
10598 !! options
10599 parsoid=wt2html,wt2wt,html2html
10600 !! wikitext
10601 [[File:Foobar.jpg|thumb|50px]]
10602 !! html/php
10603 <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>
10604
10605 !! html/parsoid
10606 <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>
10607 !! end
10608
10609 !! test
10610 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10611 !! options
10612 parsoid=wt2html,wt2wt,html2html
10613 !! wikitext
10614 [[File:Foobar.jpg|thumb|2000px]]
10615
10616 [[File:Foobar.svg|thumb|2000px]]
10617 !! html/php
10618 <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>
10619 <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>
10620
10621 !! html/parsoid
10622 <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>
10623 <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>
10624 !! end
10625
10626 !! test
10627 Image: frameless can reduce in size
10628 !! options
10629 parsoid=wt2html,wt2wt,html2html
10630 !! wikitext
10631 [[File:Foobar.jpg|frameless|50px]]
10632 !! html/php
10633 <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>
10634 </p>
10635 !! html/parsoid
10636 <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>
10637 !! end
10638
10639 !! test
10640 Image: bitmap frameless can't be enlarged past original size, but vector can
10641 !! options
10642 parsoid=wt2html,wt2wt,html2html
10643 !! wikitext
10644 [[File:Foobar.jpg|frameless|2000px]]
10645
10646 [[File:Foobar.svg|frameless|2000px]]
10647 !! html/php
10648 <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>
10649 </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>
10650 </p>
10651 !! html/parsoid
10652 <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>
10653 <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>
10654 !! end
10655
10656 !! test
10657 Image: framed images are always unscaled.
10658 !! options
10659 parsoid=wt2html,wt2wt,html2html
10660 !! wikitext
10661 [[File:Foobar.jpg|frame]]
10662
10663 [[File:Foobar.jpg|frame|50px]]
10664
10665 [[File:Foobar.jpg|frame|50x50px]]
10666
10667 [[File:Foobar.jpg|frame|2000px]]
10668 !! html/php
10669 <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>
10670 <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>
10671 <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>
10672 <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>
10673
10674 !! html/parsoid
10675 <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>
10676 !! end
10677
10678 ###################
10679
10680 !! test
10681 Link to image page- image page normally doesn't exists, hence edit link
10682 Add test with existing image page
10683 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10684 !! wikitext
10685 [[:Image:test]]
10686 !! html
10687 <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>
10688 </p>
10689 !! end
10690
10691 !! test
10692 bug 18784 Link to non-existent image page with caption should use caption as link text
10693 !! wikitext
10694 [[:Image:test|caption]]
10695 !! html
10696 <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>
10697 </p>
10698 !! end
10699
10700 !! test
10701 Frameless image caption with a free URL
10702 !! wikitext
10703 [[File:Foobar.jpg|http://example.com]]
10704 !! html/php
10705 <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>
10706 </p>
10707 !! html/parsoid
10708 <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>
10709 !! end
10710
10711 !! test
10712 Thumbnail image caption with a free URL
10713 !! options
10714 thumbsize=220
10715 !! wikitext
10716 [[File:Foobar.jpg|thumb|http://example.com]]
10717 !! html/php
10718 <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>
10719
10720 !! html/parsoid
10721 <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>
10722 !! end
10723
10724 !! test
10725 Thumbnail image caption with a free URL and explicit alt
10726 !! options
10727 thumbsize=220
10728 parsoid=wt2html,wt2wt,html2html
10729 !! wikitext
10730 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10731 !! html/php
10732 <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>
10733
10734 !! html/parsoid
10735 <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>
10736 !! end
10737
10738 !! test
10739 SVG thumbnails with no language set
10740 !! options
10741 !! wikitext
10742 [[File:Foobar.svg|thumb|caption]]
10743 !! html/php
10744 <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>
10745
10746 !! html/parsoid
10747 <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>
10748 !! end
10749
10750 !! test
10751 SVG thumbnails with language de
10752 !! options
10753 parsoid=wt2html,wt2wt,html2html
10754 !! wikitext
10755 [[File:Foobar.svg|thumb|caption|lang=de]]
10756 !! html/php
10757 <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>
10758
10759 !! html/parsoid
10760 <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>
10761 !! end
10762
10763 !! test
10764 SVG thumbnails with invalid language code
10765 !! options
10766 parsoid=wt2html,wt2wt,html2html
10767 !! wikitext
10768 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10769 !! html/php
10770 <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>
10771
10772 !! html/parsoid
10773 <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>
10774 !! end
10775
10776 !! test
10777 BUG 1887: A ISBN with a thumbnail
10778 !! wikitext
10779 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10780 !! html/php
10781 <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>
10782
10783 !! html/parsoid
10784 <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>
10785 !! end
10786
10787 !! test
10788 BUG 1887: A RFC with a thumbnail
10789 !! wikitext
10790 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10791 !! html/php
10792 <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>
10793
10794 !! html/parsoid
10795 <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>
10796 !! end
10797
10798 !! test
10799 BUG 1887: A mailto link with a thumbnail
10800 !! wikitext
10801 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10802 !! html/php
10803 <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>
10804
10805 !! html/parsoid
10806 <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>
10807 !! end
10808
10809 # Pending resolution to bug 368
10810 !! test
10811 BUG 648: Frameless image caption with a link
10812 !! wikitext
10813 [[File:Foobar.jpg|text with a [[link]] in it]]
10814 !! html/php
10815 <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>
10816 </p>
10817 !! html/parsoid
10818 <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>
10819 !! end
10820
10821 !! test
10822 BUG 648: Frameless image caption with a link (suffix)
10823 !! wikitext
10824 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10825 !! html/php
10826 <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>
10827 </p>
10828 !! html/parsoid
10829 <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>
10830 !! end
10831
10832 !! test
10833 BUG 648: Frameless image caption with an interwiki link
10834 !! wikitext
10835 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10836 !! html/php
10837 <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>
10838 </p>
10839 !! html/parsoid
10840 <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>
10841 !! end
10842
10843 !! test
10844 BUG 648: Frameless image caption with a piped interwiki link
10845 !! wikitext
10846 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10847 !! html/php
10848 <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>
10849 </p>
10850 !! html/parsoid
10851 <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>
10852 !! end
10853
10854 !! test
10855 Escape HTML special chars in image alt text
10856 !! wikitext
10857 [[File:Foobar.jpg|& < > "]]
10858 !! html/php
10859 <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>
10860 </p>
10861 !! html/parsoid
10862 <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>
10863 !! end
10864
10865 !! test
10866 BUG 499: Alt text should have &#1234;, not &amp;1234;
10867 !! wikitext
10868 [[File:Foobar.jpg|&#9792;]]
10869 !! html/php
10870 <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>
10871 </p>
10872 !! html/parsoid
10873 <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>
10874 !! end
10875
10876 !! test
10877 Broken image caption with link
10878 !! options
10879 parsoid=wt2html,wt2wt,html2html
10880 !! wikitext
10881 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10882 !! html/php
10883 <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.
10884 </p>
10885 !! html/parsoid
10886 <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>
10887 !! end
10888
10889 !! test
10890 Image caption containing another image
10891 !! wikitext
10892 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10893 !! html/php
10894 <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>
10895
10896 !! html/parsoid
10897 <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>
10898 !! end
10899
10900 !! test
10901 Image: caption containing a newline
10902 !! wikitext
10903 [[File:Foobar.jpg|This
10904 *is some text]]
10905 !! html/php
10906 <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>
10907 </p>
10908 !! html/parsoid
10909 <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>
10910 !!end
10911
10912 !!test
10913 Image: caption containing leading space
10914 (The leading space should not trigger nowiki escaping in wt2wt mode)
10915 !! wikitext
10916 [[File:Foobar.jpg|thumb| bar]]
10917 !! html/php
10918 <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>
10919
10920 !! html/parsoid
10921 <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>
10922 !!end
10923
10924 !! test
10925 Image: caption containing a table
10926 !! options
10927 parsoid=wt2html,wt2wt,html2html
10928 !! wikitext
10929 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10930 {|
10931 ! Foo !! Bar
10932 |-
10933 | Foo1 || Bar1
10934 |}
10935 and some more text.]]
10936 !! html/php
10937 <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>
10938
10939 !! html/parsoid
10940 <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
10941 <table>
10942 <tbody>
10943 <tr><th>Foo </th><th>Bar</th></tr>
10944 <tr>
10945 <td>Foo1 </td>
10946 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10947 !! end
10948
10949 !! test
10950 Bug 3090: External links other than http: in image captions
10951 !! wikitext
10952 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10953 !! html/php
10954 <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>
10955
10956 !! html/parsoid
10957 <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>
10958 !! end
10959
10960 !! test
10961 Custom class
10962 !! options
10963 parsoid=wt2html,wt2wt,html2html
10964 !! wikitext
10965 [[Image:foobar.jpg|a|class=b]]
10966 !! html/php
10967 <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>
10968 </p>
10969 !! html/parsoid
10970 <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>
10971 !! end
10972
10973 !! test
10974 Localized image handling (1).
10975 !! options
10976 parsoid=wt2html,wt2wt,html2html
10977 language=es
10978 !! wikitext
10979 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10980 !! html/php
10981 <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>
10982
10983 !! html/parsoid
10984 <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>
10985 !! end
10986
10987 !! test
10988 Localized image handling (2).
10989 !! options
10990 thumbsize=220
10991 parsoid=wt2html,wt2wt,html2html
10992 language=es
10993 !! wikitext
10994 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10995 !! html/php
10996 <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>
10997
10998 !! html/parsoid
10999 <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>
11000 !! end
11001
11002 !! test
11003 "border", "frameless" and "class" attributes on an image.
11004 !! options
11005 thumbsize=220
11006 parsoid=wt2html,wt2wt,html2html
11007 !! wikitext
11008 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11009 !! html/php
11010 <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>
11011 </p>
11012 !! html/parsoid
11013 <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>
11014 !! end
11015
11016 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11017 !! test
11018 Invalid image attributes (bug 62500)
11019 !! options
11020 thumbsize=220
11021 parsoid=wt2html,wt2wt,html2html
11022 !! wikitext
11023 [[File:Foobar.jpg|thumb|float|left|caption]]
11024
11025 [[File:Foobar.jpg|thumb|righ|caption]]
11026
11027 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11028 !! html/php
11029 <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>
11030 <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>
11031 <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>
11032
11033 !! html/parsoid
11034 <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>
11035 !! end
11036
11037 !! article
11038 File:Barfoo.jpg
11039 !! text
11040 #REDIRECT [[File:Barfoo.jpg]]
11041 !! endarticle
11042
11043 !! test
11044 Redirected image
11045 !! wikitext
11046 [[Image:Barfoo.jpg]]
11047 !! html
11048 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11049 </p>
11050 !! end
11051
11052 !! test
11053 Missing image with uploads disabled
11054 !! options
11055 wgEnableUploads=0
11056 !! wikitext
11057 [[Image:Foobaz.jpg]]
11058 !! html
11059 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11060 </p>
11061 !! end
11062
11063 # Parsoid-specific testing for images
11064 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11065 # Currently imperfect due to a flaw in the Parsoid testrunner
11066 # Work in progress
11067 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11068 # image tests.
11069
11070 !! test
11071 Parsoid-specific image handling - simple image with size and middle alignment
11072 !! wikitext
11073 [[File:Foobar.jpg|middle|50px]]
11074 !! html/parsoid
11075 <p><span class="mw-valign-middle" typeof="mw:Image">
11076 <a href="File:Foobar.jpg">
11077 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11078 </a>
11079 </span>
11080 </p>
11081 !! end
11082
11083 !! test
11084 Parsoid-specific image handling - simple image with size, middle alignment,
11085 non-standard namespace alias
11086 !! options
11087 parsoid=wt2wt,wt2html,html2html
11088 !! wikitext
11089 [[Image:Foobar.jpg|middle|50px]]
11090 !! html/parsoid
11091 <p><span class="mw-valign-middle" typeof="mw:Image">
11092 <a href="File:Foobar.jpg">
11093 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11094 </a>
11095 </span>
11096 </p>
11097 !! end
11098
11099 !! test
11100 Parsoid-specific image handling - simple image with size and middle alignment
11101 (existing content)
11102 !! wikitext
11103 [[File:Foobar.jpg|50px|middle]]
11104 !! html/parsoid
11105 <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>
11106 !! end
11107
11108 !! test
11109 Parsoid-specific image handling - simple image with size and middle alignment
11110 and non-standard namespace name
11111 !! options
11112 parsoid=wt2html,wt2wt,html2html
11113 !! wikitext
11114 [[Image:Foobar.jpg|50px|middle]]
11115 !! html/parsoid
11116 <p><span class="mw-valign-middle" typeof="mw:Image">
11117 <a href="File:Foobar.jpg">
11118 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11119 </a>
11120 </span>
11121 </p>
11122 !! end
11123
11124 !! test
11125 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11126 !! wikitext
11127 [[File:Foobar.jpg|500x10px|baseline|caption]]
11128 !! html/parsoid
11129 <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>
11130 !! end
11131
11132 !! test
11133 Parsoid-specific image handling - simple image with border and size spec
11134 !! wikitext
11135 [[File:Foobar.jpg|50px|border|caption]]
11136 !! html/parsoid
11137 <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>
11138 !! end
11139
11140 !! test
11141 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11142 !! wikitext
11143 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11144 !! html/parsoid
11145 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11146 <a href="File:Foobar.jpg">
11147 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11148 </a>
11149 <figcaption>caption content</figcaption>
11150 </figure>
11151 !! end
11152
11153 !! test
11154 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11155 (existing content)
11156 !! wikitext
11157 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11158 !! html/parsoid
11159 <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>
11160 !! end
11161
11162 !! test
11163 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11164 !! wikitext
11165 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11166 !! html/parsoid
11167 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11168 <a href="File:Foobar.jpg">
11169 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11170 </a>
11171 <figcaption>caption</figcaption>
11172 </figure>
11173 !! end
11174
11175 !! test
11176 Parsoid-specific image handling - thumbnail with specific size, halign,
11177 valign, and caption (existing content)
11178 !! wikitext
11179 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11180 !! html/parsoid
11181 <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>
11182 !! end
11183
11184 !! test
11185 Parsoid-specific image handling - framed image with specific size and caption
11186 (size is ignored)
11187 !! options
11188 parsoid=wt2html,wt2wt,html2html
11189 !! wikitext
11190 [[File:Foobar.jpg|frame|500x50px|caption]]
11191 !! html/parsoid
11192 <figure typeof="mw:Image/Frame">
11193 <a href="File:Foobar.jpg">
11194 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11195 </a>
11196 <figcaption>caption</figcaption>
11197 </figure>
11198 !! end
11199
11200 !! test
11201 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11202 (size is ignored)
11203 !! options
11204 parsoid=wt2html,wt2wt,html2html
11205 !! wikitext
11206 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11207 !! html/parsoid
11208 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11209 <a href="File:Foobar.jpg">
11210 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11211 </a>
11212 <figcaption>caption</figcaption>
11213 </figure>
11214 !! end
11215
11216 !! test
11217 Parsoid-specific image handling - frameless image with specific size, border, and caption
11218 !! wikitext
11219 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11220 !! html/parsoid
11221 <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>
11222 !! end
11223
11224 !! test
11225 Parsoid-specific image handling - simple image with a formatted caption
11226 !! wikitext
11227 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11228 !! html/parsoid
11229 <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>"}'>
11230 <a href="File:Foobar.jpg">
11231 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11232 </a></span></p>
11233 !! end
11234
11235 !! test
11236 Parsoid-specific image handling - caption with a template in it
11237 !! wikitext
11238 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11239 !! html/parsoid
11240 <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>
11241 !! end
11242
11243 !! test
11244 Parsoid-specific image handling - caption with unbalanced tags in it
11245 !! options
11246 parsoid=wt2html,wt2wt,html2html
11247 !! wikitext
11248 foo
11249 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11250 bar
11251 !! html/parsoid
11252 <p>foo</p>
11253 <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>
11254 <p>bar</p>
11255 !! end
11256
11257 !! test
11258 Parsoid-specific image handling - empty caption (1)
11259 !! options
11260 parsoid=wt2html,wt2wt
11261 !! wikitext
11262 [[File:Foobar.jpg|thumb|]]
11263 !! html/parsoid
11264 <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>
11265 !! end
11266
11267 # empty captions don't get serialized unless we're in the "round trip" case
11268 !! test
11269 Parsoid-specific image handling - empty caption (2)
11270 !! options
11271 parsoid=html2wt
11272 !! html/parsoid
11273 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11274 <a href="File:Foobar.jpg">
11275 <img resource="./File:Foobar.jpg"
11276 src="//example.com/images/3/3a/Foobar.jpg"
11277 height="25" width="220"/>
11278 </a>
11279 <figcaption></figcaption>
11280 </figure>
11281 !! wikitext
11282 [[File:Foobar.jpg|thumb]]
11283 !! end
11284
11285 !! test
11286 Parsoid-specific image handling - whitespace caption
11287 !! wikitext
11288 [[File:Foobar.jpg|thumb| ]]
11289 !! html/parsoid
11290 <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>
11291 !! end
11292
11293 !! test
11294 Parsoid-specific image handling - lang option
11295 !! wikitext
11296 foo
11297 [[File:Foobar.svg|lang=de|caption]]
11298 bar
11299 !! html/parsoid
11300 <p>foo
11301 <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>
11302 bar</p>
11303 !! end
11304
11305
11306 ###
11307 ### Subpages
11308 ###
11309 !! article
11310 Subpage test/subpage
11311 !! text
11312 foo
11313 !! endarticle
11314
11315 !! test
11316 Subpage link
11317 !! options
11318 subpage title=[[Subpage test]]
11319 !! wikitext
11320 [[/subpage]]
11321 !! html
11322 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11323 </p>
11324 !! end
11325
11326 !! test
11327 Subpage noslash link
11328 !! options
11329 subpage title=[[Subpage test]]
11330 !! wikitext
11331 [[/subpage/]]
11332 !! html
11333 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11334 </p>
11335 !! end
11336
11337 # TODO: make this PHP-parser compatible!
11338 !! test
11339 Relative subpage noslash link
11340 !! options
11341 parsoid=wt2wt,wt2html,html2html
11342 subpage title=[[Subpage test/1/2/3/4]]
11343 !! wikitext
11344 [[../../subpage/]]
11345
11346 [[../../subpage]]
11347 !! html
11348 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11349 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11350 !! end
11351
11352 !! test
11353 Parsoid: dot-slash prefixed wikilinks
11354 !! wikitext
11355 [[./foo]]
11356
11357 [[././bar]]
11358
11359 [[././baz/]]
11360 !! html/php
11361 <p>[[./foo]]
11362 </p><p>[[././bar]]
11363 </p><p>[[././baz/]]
11364 </p>
11365 !! html/parsoid
11366 <p>[[./foo]]
11367 </p><p>[[././bar]]
11368 </p><p>[[././baz/]]
11369 </p>
11370 !! end
11371
11372 !! test
11373 Render invalid page names as plain text (bug 51090)
11374 !! wikitext
11375 [[./../foo|bar]]
11376 [[foo�|bar]]
11377 [[foo/.|bar]]
11378 [[foo/..|bar]]
11379 [[foo~~~bar]]
11380 [[foo>bar]]
11381 [[foo[bar]]
11382 [[.]]
11383 [[..]]
11384 [[foo././bar]]
11385
11386 [[{{echo|./../foo}}|bar]]
11387 [[{{echo|foo/.}}|bar]]
11388 [[{{echo|foo/..}}|bar]]
11389 [[{{echo|foo~~~~bar}}]]
11390 [[{{echo|foo>bar}}]]
11391 [[{{echo|foo././bar}}]]
11392 [[{{echo|foo{bar}}]]
11393 [[{{echo|foo}bar}}]]
11394 [[{{echo|foo[bar}}]]
11395 [[{{echo|foo]bar}}]]
11396 [[{{echo|foo<bar}}]]
11397 !!html/php
11398 <p>[[./../foo|bar]]
11399 [[foo�|bar]]
11400 [[foo/.|bar]]
11401 [[foo/..|bar]]
11402 [[foo~~~bar]]
11403 [[foo&gt;bar]]
11404 [[foo[bar]]
11405 [[.]]
11406 [[..]]
11407 [[foo././bar]]
11408 </p><p>[[./../foo|bar]]
11409 [[foo/.|bar]]
11410 [[foo/..|bar]]
11411 [[foo~~~~bar]]
11412 [[foo&gt;bar]]
11413 [[foo././bar]]
11414 [[foo{bar]]
11415 [[foo}bar]]
11416 [[foo[bar]]
11417 [[foo]bar]]
11418 [[foo&lt;bar]]
11419 </p>
11420 !!html/parsoid
11421 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11422 <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>
11423 !!end
11424
11425 !! test
11426 Disabled subpages
11427 !! wikitext
11428 [[/subpage]]
11429 !! html
11430 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11431 </p>
11432 !! end
11433
11434 !! test
11435 BUG 561: {{/Subpage}}
11436 !! options
11437 subpage title=[[Page]]
11438 !! wikitext
11439 {{/Subpage}}
11440 !! html
11441 <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>
11442 </p>
11443 !! end
11444
11445 ###
11446 ### Categories
11447 ###
11448 !! article
11449 Category:MediaWiki User's Guide
11450 !! text
11451 blah
11452 !! endarticle
11453
11454 !! test
11455 Link to category
11456 !! wikitext
11457 [[:Category:MediaWiki User's Guide]]
11458 !! html
11459 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11460 </p>
11461 !! end
11462
11463 !! test
11464 Simple category
11465 !! options
11466 cat
11467 !! wikitext
11468 [[Category:MediaWiki User's Guide]]
11469 !! html
11470 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11471 !! end
11472
11473 !! test
11474 PAGESINCATEGORY invalid title fatal (r33546 fix)
11475 !! wikitext
11476 {{PAGESINCATEGORY:<bogus>}}
11477 !! html
11478 <p>0
11479 </p>
11480 !! end
11481
11482 !! test
11483 Category with different sort key
11484 !! options
11485 cat
11486 !! wikitext
11487 [[Category:MediaWiki User's Guide|Foo]]
11488 !! html
11489 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11490 !! end
11491
11492 !! test
11493 Category with identical sort key
11494 !! options
11495 cat
11496 !! wikitext
11497 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11498 !! html
11499 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11500 !! end
11501
11502 !! test
11503 Category with empty sort key
11504 !! options
11505 cat
11506 pst
11507 !! wikitext
11508 [[Category:MediaWiki User's Guide|]]
11509 !! html
11510 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11511 !! end
11512
11513 !! test
11514 Category with empty sort key and parentheses
11515 !! options
11516 cat
11517 pst
11518 !! wikitext
11519 [[Category:Foo (bar)|]]
11520 !! html
11521 [[Category:Foo (bar)|Foo]]
11522 !! end
11523
11524 !! test
11525 Category with link tail
11526 !! options
11527 cat
11528 pst
11529 !! wikitext
11530 123[[Category:Foo]]456
11531 !! html
11532 123[[Category:Foo]]456
11533 !! end
11534
11535 !! test
11536 Category with template
11537 !! options
11538 cat
11539 pst
11540 !! wikitext
11541 [[Category:{{echo|Foo}}]]
11542 !! html
11543 [[Category:{{echo|Foo}}]]
11544 !! end
11545
11546 !! test
11547 Category with template in sort key
11548 !! options
11549 cat
11550 pst
11551 !! wikitext
11552 [[Category:Foo|{{echo|Bar}}]]
11553 !! html
11554 [[Category:Foo|{{echo|Bar}}]]
11555 !! end
11556
11557 !! test
11558 Category with template in sort key and title
11559 !! options
11560 cat
11561 pst
11562 !! wikitext
11563 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11564 !! html
11565 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11566 !! end
11567
11568 !! test
11569 Category / paragraph interactions
11570 !! wikitext
11571 Foo [[Category:Baz]] Bar
11572
11573 Foo [[Category:Baz]]
11574 Bar
11575
11576 Foo
11577 [[Category:Baz]]
11578 Bar
11579
11580 Foo
11581 [[Category:Baz]] Bar
11582
11583 Foo
11584 [[Category:Baz]]
11585 [[Category:Baz]]
11586 [[Category:Baz]]
11587 Bar
11588
11589 [[Category:Baz]]
11590 [[Category:Baz]]
11591 [[Category:Baz]]
11592
11593 [[Category:Baz]]
11594 {{echo|[[Category:Baz]]}}
11595 [[Category:Baz]]
11596 !! html
11597 <p>Foo Bar
11598 </p><p>Foo
11599 Bar
11600 </p><p>Foo
11601 Bar
11602 </p><p>Foo Bar
11603 </p><p>Foo
11604 Bar
11605 </p>
11606 !! end
11607
11608 !! test
11609 Parsoid: Serialize link to category page with colon escape
11610 !! options
11611 parsoid
11612 !! wikitext
11613
11614 [[:Category:Foo]]
11615 [[:Category:Foo|Bar]]
11616 !! html
11617 <p>
11618 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11619 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11620 </p>
11621 !! end
11622
11623 !! test
11624 Parsoid: Link prefix/suffixes aren't applied to category links
11625 !! options
11626 parsoid=wt2html,wt2wt,html2html
11627 language=is
11628 !! wikitext
11629 x[[Category:Foo]]y
11630 !! html
11631 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11632 !! end
11633
11634 !! test
11635 Parsoid: Serialize link to file page with colon escape
11636 !! options
11637 parsoid
11638 !! wikitext
11639
11640 [[:File:Foo.png]]
11641 [[:File:Foo.png|Bar]]
11642 !! html
11643 <p>
11644 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11645 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11646 </p>
11647 !! end
11648
11649 !! test
11650 Parsoid: Serialize a genuine category link without colon escape
11651 !! options
11652 parsoid
11653 !! wikitext
11654 [[Category:Foo]]
11655 [[Category:Foo|Bar]]
11656 !! html
11657 <link rel="mw:PageProp/Category" href="Category:Foo">
11658 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11659 !! end
11660
11661 !! test
11662 Parsoid: Defaultsort
11663 !! options
11664 parsoid
11665 !! wikitext
11666 {{DEFAULTSORT:Foo}}
11667 !! html
11668 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11669 !! end
11670
11671 ###
11672 ### Inter-language links
11673 ###
11674 !! test
11675 Inter-language links
11676 !! options
11677 ill
11678 !! wikitext
11679 [[es:Alimento]]
11680 [[fr:Nourriture]]
11681 [[zh:&#39135;&#21697;]]
11682 !! html
11683 es:Alimento fr:Nourriture zh:食品
11684 !! end
11685
11686 !! test
11687 Duplicate interlanguage links (bug 24502)
11688 !! options
11689 ill
11690 !! wikitext
11691 [[es:1]]
11692 [[es:2]]
11693 [[fr:1]]
11694 [[fr:2]]
11695 !! html
11696 es:1 fr:1
11697 !! end
11698
11699 ###
11700 ### Sections
11701 ###
11702 !! test
11703 Basic section headings
11704 !! wikitext
11705 == Headline 1 ==
11706 Some text
11707
11708 ==Headline 2==
11709 More
11710 ===Smaller headline===
11711 Blah blah
11712 !! html
11713 <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>
11714 <p>Some text
11715 </p>
11716 <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>
11717 <p>More
11718 </p>
11719 <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>
11720 <p>Blah blah
11721 </p>
11722 !! end
11723
11724 !! test
11725 Section headings with TOC
11726 !! wikitext
11727 == Headline 1 ==
11728 === Subheadline 1 ===
11729 ===== Skipping a level =====
11730 ====== Skipping a level ======
11731
11732 == Headline 2 ==
11733 Some text
11734 ===Another headline===
11735 !! html
11736 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11737 <ul>
11738 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11739 <ul>
11740 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11741 <ul>
11742 <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>
11743 <ul>
11744 <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>
11745 </ul>
11746 </li>
11747 </ul>
11748 </li>
11749 </ul>
11750 </li>
11751 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11752 <ul>
11753 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11754 </ul>
11755 </li>
11756 </ul>
11757 </div>
11758
11759 <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>
11760 <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>
11761 <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>
11762 <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>
11763 <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>
11764 <p>Some text
11765 </p>
11766 <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>
11767
11768 !! end
11769
11770 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11771 !! test
11772 Handling of sections up to level 6 and beyond
11773 !! wikitext
11774 = Level 1 Heading=
11775 == Level 2 Heading==
11776 === Level 3 Heading===
11777 ==== Level 4 Heading====
11778 ===== Level 5 Heading=====
11779 ====== Level 6 Heading======
11780 ======= Level 7 Heading=======
11781 ======== Level 8 Heading========
11782 ========= Level 9 Heading=========
11783 ========== Level 10 Heading==========
11784 !! html
11785 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11786 <ul>
11787 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11788 <ul>
11789 <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>
11790 <ul>
11791 <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>
11792 <ul>
11793 <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>
11794 <ul>
11795 <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>
11796 <ul>
11797 <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>
11798 <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>
11799 <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>
11800 <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>
11801 <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>
11802 </ul>
11803 </li>
11804 </ul>
11805 </li>
11806 </ul>
11807 </li>
11808 </ul>
11809 </li>
11810 </ul>
11811 </li>
11812 </ul>
11813 </div>
11814
11815 <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>
11816 <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>
11817 <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>
11818 <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>
11819 <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>
11820 <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>
11821 <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>
11822 <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>
11823 <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>
11824 <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>
11825
11826 !! end
11827
11828 !! test
11829 TOC regression (bug 9764)
11830 !! wikitext
11831 == title 1 ==
11832 === title 1.1 ===
11833 ==== title 1.1.1 ====
11834 === title 1.2 ===
11835 == title 2 ==
11836 === title 2.1 ===
11837 !! html
11838 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11839 <ul>
11840 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11841 <ul>
11842 <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>
11843 <ul>
11844 <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>
11845 </ul>
11846 </li>
11847 <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>
11848 </ul>
11849 </li>
11850 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11851 <ul>
11852 <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>
11853 </ul>
11854 </li>
11855 </ul>
11856 </div>
11857
11858 <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>
11859 <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>
11860 <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>
11861 <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>
11862 <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>
11863 <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>
11864
11865 !! end
11866
11867 !! test
11868 TOC with wgMaxTocLevel=3 (bug 6204)
11869 !! options
11870 wgMaxTocLevel=3
11871 !! wikitext
11872 == title 1 ==
11873 === title 1.1 ===
11874 ==== title 1.1.1 ====
11875 === title 1.2 ===
11876 == title 2 ==
11877 === title 2.1 ===
11878 !! html
11879 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11880 <ul>
11881 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11882 <ul>
11883 <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>
11884 <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>
11885 </ul>
11886 </li>
11887 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11888 <ul>
11889 <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>
11890 </ul>
11891 </li>
11892 </ul>
11893 </div>
11894
11895 <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>
11896 <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>
11897 <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>
11898 <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>
11899 <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>
11900 <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>
11901
11902 !! end
11903
11904 !! test
11905 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11906 !! options
11907 wgMaxTocLevel=3
11908 !! wikitext
11909 ==Section 1==
11910 ===Section 1.1===
11911 ====Section 1.1.1====
11912 ====Section 1.1.1.1====
11913 ==Section 2==
11914 !! html
11915 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11916 <ul>
11917 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11918 <ul>
11919 <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>
11920 </ul>
11921 </li>
11922 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11923 </ul>
11924 </div>
11925
11926 <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>
11927 <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>
11928 <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>
11929 <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>
11930 <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>
11931
11932 !! end
11933
11934
11935 !! test
11936 Resolving duplicate section names
11937 !! wikitext
11938 == Foo bar ==
11939 == Foo bar ==
11940 !! html
11941 <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>
11942 <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>
11943
11944 !! end
11945
11946 !! test
11947 Resolving duplicate section names with differing case (bug 10721)
11948 !! wikitext
11949 == Foo bar ==
11950 == Foo Bar ==
11951 !! html
11952 <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>
11953 <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>
11954
11955 !! end
11956
11957 !! article
11958 Template:sections
11959 !! text
11960 ===Section 1===
11961 ==Section 2==
11962 !! endarticle
11963
11964 !! test
11965 Template with sections, __NOTOC__
11966 !! wikitext
11967 __NOTOC__
11968 ==Section 0==
11969 {{sections}}
11970 ==Section 4==
11971 !! html
11972 <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>
11973 <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>
11974 <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>
11975 <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>
11976
11977 !! end
11978
11979 !! test
11980 __NOEDITSECTION__ keyword
11981 !! wikitext
11982 __NOEDITSECTION__
11983 ==Section 1==
11984 ==Section 2==
11985 !! html
11986 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11987 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11988
11989 !! end
11990
11991 !! test
11992 Link inside a section heading
11993 !! wikitext
11994 ==Section with a [[Main Page|link]] in it==
11995 !! html
11996 <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>
11997
11998 !! end
11999
12000 !! test
12001 TOC regression (bug 12077)
12002 !! wikitext
12003 __TOC__
12004 == title 1 ==
12005 === title 1.1 ===
12006 == title 2 ==
12007 !! html
12008 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12009 <ul>
12010 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12011 <ul>
12012 <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>
12013 </ul>
12014 </li>
12015 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12016 </ul>
12017 </div>
12018
12019 <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>
12020 <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>
12021 <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>
12022
12023 !! end
12024
12025 !! test
12026 BUG 1219 URL next to image (good)
12027 !! wikitext
12028 http://example.com [[Image:foobar.jpg]]
12029 !! html
12030 <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>
12031 </p>
12032 !!end
12033
12034 !! test
12035 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12036 !! wikitext
12037 ===
12038 The line above must have a trailing space!
12039 === <!--
12040 --> <!-- -->
12041 But just in case it doesn't...
12042 !! html
12043 <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>
12044 <p>The line above must have a trailing space!
12045 </p>
12046 <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>
12047 <p>But just in case it doesn't...
12048 </p>
12049 !! end
12050
12051 !! test
12052 Header with special characters (bug 25462)
12053 !! wikitext
12054 The tooltips shall not show entities to the user (ie. be double escaped)
12055
12056 == text > text ==
12057 section 1
12058
12059 == text < text ==
12060 section 2
12061
12062 == text & text ==
12063 section 3
12064
12065 == text ' text ==
12066 section 4
12067
12068 == text " text ==
12069 section 5
12070 !! html
12071 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12072 </p>
12073 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12074 <ul>
12075 <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>
12076 <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>
12077 <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>
12078 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12079 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12080 </ul>
12081 </div>
12082
12083 <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>
12084 <p>section 1
12085 </p>
12086 <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>
12087 <p>section 2
12088 </p>
12089 <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>
12090 <p>section 3
12091 </p>
12092 <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>
12093 <p>section 4
12094 </p>
12095 <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>
12096 <p>section 5
12097 </p>
12098 !! end
12099
12100 !! test
12101 Headers with excess '=' characters
12102 (Are similar tests necessary beyond the 1st level?)
12103 !! wikitext
12104 =foo==
12105 ==foo=
12106 =''italic'' heading==
12107 ==''italic'' heading=
12108 !! html
12109 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12110 <ul>
12111 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12112 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12113 <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>
12114 <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>
12115 </ul>
12116 </div>
12117
12118 <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>
12119 <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>
12120 <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>
12121 <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>
12122
12123 !! end
12124
12125 !! test
12126 HTML headers vs TOC (bug 23393)
12127 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12128 !! wikitext
12129 <h1>Header 1</h1>
12130 == Header 1.1 ==
12131 == Header 1.2 ==
12132
12133 <h1>Header 2
12134 </h1>
12135 == Header 2.1 ==
12136 == Header 2.2 ==
12137 __NOEDITSECTION__
12138 !! html
12139 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12140 <ul>
12141 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12142 <ul>
12143 <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>
12144 <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>
12145 </ul>
12146 </li>
12147 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12148 <ul>
12149 <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>
12150 <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>
12151 </ul>
12152 </li>
12153 </ul>
12154 </div>
12155
12156 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12157 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12158 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12159 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12160 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12161 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12162
12163 !! end
12164
12165 !! test
12166 Single-line or multiline-comments can follow headings
12167 !! options
12168 parsoid=wt2html,wt2wt
12169 !! wikitext
12170 ==foo==<!---->
12171 ==bar==<!--c1-->
12172 ==baz==<!--
12173 c2
12174 c3-->
12175 !! html
12176 <h2><span class="mw-headline" id="foo">foo</span></h2>
12177 <h2><span class="mw-headline" id="bar">bar</span></h2>
12178 <h2><span class="mw-headline" id="baz">baz</span></h2>
12179
12180 !! end
12181
12182 !! test
12183 BUG 1219 URL next to image (broken)
12184 !! wikitext
12185 http://example.com[[Image:foobar.jpg]]
12186 !! html
12187 <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>
12188 </p>
12189 !!end
12190
12191 !! test
12192 Bug 1186 news: in the middle of text
12193 !! wikitext
12194 http://en.wikinews.org/wiki/Wikinews:Workplace
12195 !! html
12196 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12197 </p>
12198 !!end
12199
12200
12201 !! test
12202 Namespaced link must have a title
12203 !! wikitext
12204 [[Project:]]
12205 !! html
12206 <p>[[Project:]]
12207 </p>
12208 !!end
12209
12210 !! test
12211 Namespaced link must have a title (bad fragment version)
12212 !! wikitext
12213 [[Project:#fragment]]
12214 !! html
12215 <p>[[Project:#fragment]]
12216 </p>
12217 !!end
12218
12219
12220 ###
12221 ### HTML tags and HTML attributes
12222 ###
12223
12224 !! test
12225 div with no attributes
12226 !! wikitext
12227 <div>HTML rocks</div>
12228 !! html
12229 <div>HTML rocks</div>
12230
12231 !! end
12232
12233 !! test
12234 div with double-quoted attribute
12235 !! wikitext
12236 <div id="rock">HTML rocks</div>
12237 !! html
12238 <div id="rock">HTML rocks</div>
12239
12240 !! end
12241
12242 !! test
12243 div with single-quoted attribute
12244 !! wikitext
12245 <div id='rock'>HTML rocks</div>
12246 !! html
12247 <div id="rock">HTML rocks</div>
12248
12249 !! end
12250
12251 !! test
12252 div with unquoted attribute
12253 !! wikitext
12254 <div id=rock>HTML rocks</div>
12255 !! html
12256 <div id="rock">HTML rocks</div>
12257
12258 !! end
12259
12260 !! test
12261 div with illegal double attributes
12262 !! wikitext
12263 <div id="a" id="b">HTML rocks</div>
12264 !! html
12265 <div id="b">HTML rocks</div>
12266
12267 !!end
12268
12269 # FIXME: produce empty string instead of "class" in the PHP parser, following
12270 # the HTML5 spec.
12271 !! test
12272 div with empty attribute value, space before equals
12273 !! options
12274 parsoid
12275 !! wikitext
12276 <div class =>HTML rocks</div>
12277 !! html
12278 <div class="">HTML rocks</div>
12279
12280 !! end
12281
12282 # The PHP parser escapes the opening brace to &#123; for some reason, so
12283 # disabled this test for it.
12284 !! test
12285 div with braces in attribute value
12286 !! options
12287 parsoid
12288 !! wikitext
12289 <div title="{}">Foo</div>
12290 !! html
12291 <div title="{}">Foo</div>
12292 !! end
12293
12294 # This it very inconsistent in the PHP parser: it returns
12295 # class="class" if there is a space between the name and the equal sign (see
12296 # 'div with empty attribute value, space before equals'), but strips the
12297 # attribute completely if the space is missing. We hope that not much content
12298 # depends on this, so are implementing the behavior below in Parsoid for
12299 # consistencies' sake. Disabled for the PHP parser.
12300 # FIXME: fix this behavior in the PHP parser?
12301 !! test
12302 div with empty attribute value, no space before equals
12303 !! options
12304 parsoid
12305 !! wikitext
12306 <div class=>HTML rocks</div>
12307 !! html
12308 <div class="">HTML rocks</div>
12309
12310 !! end
12311
12312 !! test
12313 HTML multiple attributes correction
12314 !! wikitext
12315 <p class="error" class="awesome">Awesome!</p>
12316 !! html
12317 <p class="awesome">Awesome!</p>
12318
12319 !!end
12320
12321 !! test
12322 Table multiple attributes correction
12323 !! wikitext
12324 {|
12325 !+ class="error" class="awesome"| status
12326 |}
12327 !! html
12328 <table>
12329 <tr>
12330 <th class="awesome"> status
12331 </th></tr></table>
12332
12333 !!end
12334
12335 !! test
12336 DIV IN UPPERCASE
12337 !! wikitext
12338 <DIV ID="x">HTML ROCKS</DIV>
12339 !! html
12340 <div id="x">HTML ROCKS</div>
12341
12342 !!end
12343
12344 !! test
12345 Non-ASCII pseudo-tags are rendered as text
12346 !! wikitext
12347 <khyô>
12348 !! html
12349 <p>&lt;khyô&gt;
12350 </p>
12351 !! end
12352
12353 !! test
12354 Pseudo-tag with URL 'name' renders as url link
12355 !! wikitext
12356 <http://example.com/>
12357 !! html
12358 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12359 </p>
12360 !! end
12361
12362 !! test
12363 text with amp in the middle of nowhere
12364 !! wikitext
12365 Remember AT&T?
12366 !! html
12367 <p>Remember AT&amp;T?
12368 </p>
12369 !! end
12370
12371 !! test
12372 text with character entity: eacute
12373 !! wikitext
12374 I always thought &eacute; was a cute letter.
12375 !! html
12376 <p>I always thought &#233; was a cute letter.
12377 </p>
12378 !! end
12379
12380 !! test
12381 text with entity-escaped character entity-like string: eacute
12382 !! wikitext
12383 I always thought &amp;eacute; was a cute letter.
12384 !! html
12385 <p>I always thought &amp;eacute; was a cute letter.
12386 </p>
12387 !! end
12388
12389 !! test
12390 text with undefined character entity: xacute
12391 !! wikitext
12392 I always thought &xacute; was a cute letter.
12393 !! html
12394 <p>I always thought &amp;xacute; was a cute letter.
12395 </p>
12396 !! end
12397
12398 # TODO: generalize to PHP parser?
12399 !! test
12400 HTML5 tags
12401 !! options
12402 parsoid
12403 !! wikitext
12404 <data value="5">five</data>
12405 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12406 <mark>This highlighted text</mark>
12407 !! html
12408 <p><data value="5">five</data>
12409 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12410 <mark>This highlighted text</mark></p>
12411 !! end
12412
12413 !! test
12414 HTML tag with leading space is parsed as text
12415 !! wikitext
12416 < div>foo< /div>
12417 !! html
12418 <p>&lt; div&gt;foo&lt; /div&gt;
12419 </p>
12420 !! end
12421
12422 ###
12423 ### Nesting tests (see bug 41545, 50604, 51081)
12424 ###
12425
12426 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12427 # Note that html2wt is considerably more difficult if we use <b> in
12428 # the test case, instead of <big>
12429 !! test
12430 Ensure that HTML adoption agency algorithm is properly implemented.
12431 !! wikitext
12432 <big>X<big>Y</big>Z</big>
12433 !! html
12434 <p><big>X<big>Y</big>Z</big>
12435 </p>
12436 !! end
12437
12438 # This was bug 41545 in the PHP parser.
12439 !! test
12440 Nesting of <kbd>
12441 !! wikitext
12442 <kbd>X<kbd>Y</kbd>Z</kbd>
12443 !! html
12444 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12445 </p>
12446 !! end
12447
12448 # The following cases were bug 51081 in the PHP parser.
12449 # Note that there are some other nestable tags (b, i, etc) which are
12450 # not covered; see bug 51081 for discussion.
12451 !! test
12452 Nesting of <em>
12453 !! wikitext
12454 <em>X<em>Y</em>Z</em>
12455 !! html
12456 <p><em>X<em>Y</em>Z</em>
12457 </p>
12458 !! end
12459
12460 !! test
12461 Nesting of <strong>
12462 !! wikitext
12463 <strong>X<strong>Y</strong>Z</strong>
12464 !! html
12465 <p><strong>X<strong>Y</strong>Z</strong>
12466 </p>
12467 !! end
12468
12469 !! test
12470 Nesting of <q>
12471 !! wikitext
12472 <q>X<q>Y</q>Z</q>
12473 !! html
12474 <p><q>X<q>Y</q>Z</q>
12475 </p>
12476 !! end
12477
12478 !! test
12479 Nesting of <ruby>
12480 !! wikitext
12481 <ruby>X<ruby>Y</ruby>Z</ruby>
12482 !! html
12483 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12484 </p>
12485 !! end
12486
12487 !! test
12488 Nesting of <bdo>
12489 !! wikitext
12490 <bdo>X<bdo>Y</bdo>Z</bdo>
12491 !! html
12492 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12493 </p>
12494 !! end
12495
12496
12497 ###
12498 ### Media links
12499 ###
12500
12501 !! test
12502 Media link
12503 !! wikitext
12504 [[Media:Foobar.jpg]]
12505 !! html
12506 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12507 </p>
12508 !! end
12509
12510 !! test
12511 Media link with text
12512 !! wikitext
12513 [[Media:Foobar.jpg|A neat file to look at]]
12514 !! html
12515 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12516 </p>
12517 !! end
12518
12519 # FIXME: this is still bad HTML tag nesting
12520 !! test
12521 Media link with nasty text
12522 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12523 !! wikitext
12524 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12525 !! html
12526 <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>
12527
12528 !! end
12529
12530 !! test
12531 Media link to nonexistent file (bug 1702)
12532 !! wikitext
12533 [[Media:No such.jpg]]
12534 !! html
12535 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12536 </p>
12537 !! end
12538
12539 !! test
12540 Image link to nonexistent file (bug 1850 - good)
12541 !! wikitext
12542 [[Image:No such.jpg]]
12543 !! html
12544 <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>
12545 </p>
12546 !! end
12547
12548 !! test
12549 :Image link to nonexistent file (bug 1850 - bad)
12550 !! wikitext
12551 [[:Image:No such.jpg]]
12552 !! html
12553 <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>
12554 </p>
12555 !! end
12556
12557
12558
12559 !! test
12560 Character reference normalization in link text (bug 1938)
12561 !! wikitext
12562 [[Main Page|this&that]]
12563 !! html
12564 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12565 </p>
12566 !!end
12567
12568 !! article
12569 אַ
12570 !! text
12571 Test for unicode normalization
12572
12573 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12574 !! endarticle
12575
12576 !! test
12577 (bug 19451) Links should refer to the normalized form.
12578 !! wikitext
12579 [[&#xFB2E;]]
12580 [[&#x5d0;&#x5b7;]]
12581 [[&#x5d0;ַ]]
12582 [[א&#x5b7;]]
12583 [[אַ]]
12584 !! html
12585 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12586 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12587 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12588 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12589 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12590 </p>
12591 !! end
12592
12593 !! test
12594 Empty attribute crash test (bug 2067)
12595 !! wikitext
12596 <font color="">foo</font>
12597 !! html
12598 <p><font color="">foo</font>
12599 </p>
12600 !! end
12601
12602 !! test
12603 Empty attribute crash test single-quotes (bug 2067)
12604 !! wikitext
12605 <font color=''>foo</font>
12606 !! html
12607 <p><font color="">foo</font>
12608 </p>
12609 !! end
12610
12611 !! test
12612 Attribute test: equals, then nothing
12613 !! wikitext
12614 <font color=>foo</font>
12615 !! html
12616 <p><font>foo</font>
12617 </p>
12618 !! end
12619
12620 !! test
12621 Attribute test: unquoted value
12622 !! wikitext
12623 <font color=x>foo</font>
12624 !! html
12625 <p><font color="x">foo</font>
12626 </p>
12627 !! end
12628
12629 !! test
12630 Attribute test: unquoted but illegal value (hash)
12631 !! wikitext
12632 <font color=#x>foo</font>
12633 !! html
12634 <p><font color="#x">foo</font>
12635 </p>
12636 !! end
12637
12638 !! test
12639 Attribute test: no value
12640 !! wikitext
12641 <font color>foo</font>
12642 !! html
12643 <p><font color="color">foo</font>
12644 </p>
12645 !! end
12646
12647 !! test
12648 Bug 2095: link with three closing brackets
12649 !! wikitext
12650 [[Main Page]]]
12651 !! html/php
12652 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12653 </p>
12654 !! html/parsoid
12655 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12656 !! end
12657
12658 !! test
12659 Bug 2095: link with pipe and three closing brackets
12660 !! wikitext
12661 [[Main Page|link]]]
12662 !! html/php
12663 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12664 </p>
12665 !! html/parsoid
12666 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12667 !! end
12668
12669 !! test
12670 Bug 2095: link with pipe and three closing brackets, version 2
12671 !! wikitext
12672 [[Main Page|[http://example.com/]]]
12673 !! html/php
12674 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12675 </p>
12676 !! html/parsoid
12677 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12678 !! end
12679
12680
12681 ###
12682 ### Safety
12683 ###
12684
12685 !! article
12686 Template:Dangerous attribute
12687 !! text
12688 " onmouseover="alert(document.cookie)
12689 !! endarticle
12690
12691 !! article
12692 Template:Dangerous style attribute
12693 !! text
12694 border-size: expression(alert(document.cookie))
12695 !! endarticle
12696
12697 !! article
12698 Template:Div style
12699 !! text
12700 <div style="float: right; {{{1}}}">Magic div</div>
12701 !! endarticle
12702
12703 !! test
12704 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12705 !! wikitext
12706 <div title="{{test}}"></div>
12707 !! html
12708 <div title="This is a test template"></div>
12709
12710 !! end
12711
12712 !! test
12713 Bug 2304: HTML attribute safety (dangerous template; 2309)
12714 !! wikitext
12715 <div title="{{dangerous attribute}}"></div>
12716 !! html
12717 <div title=""></div>
12718
12719 !! end
12720
12721 !! test
12722 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12723 !! wikitext
12724 <div style="{{dangerous style attribute}}"></div>
12725 !! html
12726 <div style="/* insecure input */"></div>
12727
12728 !! end
12729
12730 !! test
12731 Bug 2304: HTML attribute safety (safe parameter; 2309)
12732 !! wikitext
12733 {{div style|width: 200px}}
12734 !! html
12735 <div style="float: right; width: 200px">Magic div</div>
12736
12737 !! end
12738
12739 !! test
12740 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12741 !! wikitext
12742 {{div style|width: expression(alert(document.cookie))}}
12743 !! html
12744 <div style="/* insecure input */">Magic div</div>
12745
12746 !! end
12747
12748 !! test
12749 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12750 !! wikitext
12751 {{div style|"><script>alert(document.cookie)</script>}}
12752 !! html
12753 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12754
12755 !! end
12756
12757 !! test
12758 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12759 !! wikitext
12760 {{div style|" ><script>alert(document.cookie)</script>}}
12761 !! html
12762 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12763
12764 !! end
12765
12766 !! test
12767 Bug 2304: HTML attribute safety (link)
12768 !! wikitext
12769 <div title="[[Main Page]]"></div>
12770 !! html
12771 <div title="&#91;&#91;Main Page]]"></div>
12772
12773 !! end
12774
12775 !! test
12776 Bug 2304: HTML attribute safety (italics)
12777 !! wikitext
12778 <div title="''foobar''"></div>
12779 !! html
12780 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12781
12782 !! end
12783
12784 !! test
12785 Bug 2304: HTML attribute safety (bold)
12786 !! wikitext
12787 <div title="'''foobar'''"></div>
12788 !! html
12789 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12790
12791 !! end
12792
12793
12794 !! test
12795 Bug 2304: HTML attribute safety (ISBN)
12796 !! wikitext
12797 <div title="ISBN 1234567890"></div>
12798 !! html
12799 <div title="&#73;SBN 1234567890"></div>
12800
12801 !! end
12802
12803 !! test
12804 Bug 2304: HTML attribute safety (RFC)
12805 !! wikitext
12806 <div title="RFC 1234"></div>
12807 !! html
12808 <div title="&#82;FC 1234"></div>
12809
12810 !! end
12811
12812 !! test
12813 Bug 2304: HTML attribute safety (PMID)
12814 !! wikitext
12815 <div title="PMID 1234567890"></div>
12816 !! html
12817 <div title="&#80;MID 1234567890"></div>
12818
12819 !! end
12820
12821 !! test
12822 Bug 2304: HTML attribute safety (web link)
12823 !! wikitext
12824 <div title="http://example.com/"></div>
12825 !! html
12826 <div title="http&#58;//example.com/"></div>
12827
12828 !! end
12829
12830 !! test
12831 Bug 2304: HTML attribute safety (named web link)
12832 !! wikitext
12833 <div title="[http://example.com/ link]"></div>
12834 !! html
12835 <div title="&#91;http&#58;//example.com/ link]"></div>
12836
12837 !! end
12838
12839 !! test
12840 Bug 3244: HTML attribute safety (extension; safe)
12841 !! wikitext
12842 <div style="<nowiki>background:blue</nowiki>"></div>
12843 !! html
12844 <div style="background:blue"></div>
12845
12846 !! end
12847
12848 !! test
12849 Bug 3244: HTML attribute safety (extension; unsafe)
12850 !! wikitext
12851 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12852 !! html
12853 <div style="/* insecure input */"></div>
12854
12855 !! end
12856
12857 # More MSIE fun discovered by Tom Gilder
12858
12859 !! test
12860 MSIE CSS safety test: spurious slash
12861 !! wikitext
12862 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12863 !! html
12864 <div style="/* insecure input */">evil</div>
12865
12866 !! end
12867
12868 !! test
12869 MSIE CSS safety test: hex code
12870 !! wikitext
12871 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12872 !! html
12873 <div style="/* insecure input */">evil</div>
12874
12875 !! end
12876
12877 !! test
12878 MSIE CSS safety test: comment in url
12879 !! wikitext
12880 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12881 !! html
12882 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12883
12884 !! end
12885
12886 !! test
12887 MSIE CSS safety test: comment in expression
12888 !! wikitext
12889 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12890 !! html
12891 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12892
12893 !! end
12894
12895 !! test
12896 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12897 !! wikitext
12898 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12899 !! html
12900 <p style="/* invalid control char */">A</p>
12901
12902 !! end
12903
12904 !! test
12905 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12906 !! wikitext
12907 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12908 <div style="top:EXPRESSION(alert())">B</div>
12909 !! html
12910 <p style="/* insecure input */">A</p>
12911 <div style="/* insecure input */">B</div>
12912
12913 !! end
12914
12915 !! test
12916 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12917 !! wikitext
12918 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12919 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12920 !! html
12921 <div style="/* insecure input */">A</div>
12922 <p style="/* insecure input */">B</p>
12923
12924 !! end
12925
12926 !! test
12927 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12928 !! wikitext
12929 <div style="background-image:url⁽javascript:alert())">A</div>
12930 <div style="background-image:url₍javascript:alert())">B</div>
12931 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12932 !! html
12933 <div style="/* insecure input */">A</div>
12934 <div style="/* insecure input */">B</div>
12935 <p style="/* insecure input */">C</p>
12936
12937 !! end
12938
12939 !! test
12940 Opera -o-link CSS
12941 !! wikitext
12942 <div
12943 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;"
12944 style="-o-link:attr(title);-o-link-source:current">X</div>
12945 !! html
12946 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12947
12948 !! end
12949
12950 !! test
12951 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12952 !! wikitext
12953 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12954 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12955 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12956 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12957 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12958 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12959 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12960 !! html
12961 <p style="/* insecure input */">A</p>
12962 <p style="/* insecure input */">B</p>
12963 <p style="/* insecure input */">C</p>
12964 <p style="/* insecure input */">D</p>
12965 <p style="/* insecure input */">E</p>
12966 <p style="/* insecure input */">F</p>
12967 <p style="/* insecure input */">G</p>
12968
12969 !! end
12970
12971 !! test
12972 Table attribute legitimate extension
12973 !! wikitext
12974 {|
12975 !+ style="<nowiki>color:blue</nowiki>"| status
12976 |}
12977 !! html
12978 <table>
12979 <tr>
12980 <th style="color:blue"> status
12981 </th></tr></table>
12982
12983 !!end
12984
12985 !! test
12986 Table attribute safety
12987 !! wikitext
12988 {|
12989 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12990 |}
12991 !! html
12992 <table>
12993 <tr>
12994 <th style="/* insecure input */"> status
12995 </th></tr></table>
12996
12997 !! end
12998
12999 !! test
13000 CSS line continuation 1
13001 !! wikitext
13002 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13003 !! html
13004 <div style="/* insecure input */"></div>
13005
13006 !! end
13007
13008 !! test
13009 CSS line continuation 2
13010 !! wikitext
13011 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13012 !! html
13013 <div style="/* insecure input */"></div>
13014
13015 !! end
13016
13017 !! article
13018 Template:Identity
13019 !! text
13020 {{{1}}}
13021 !! endarticle
13022
13023 !! test
13024 Expansion of multi-line templates in attribute values (bug 6255)
13025 !! wikitext
13026 <div style="background: {{identity|#00FF00}}">-</div>
13027 !! html
13028 <div style="background: #00FF00">-</div>
13029
13030 !! end
13031
13032
13033 !! test
13034 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13035 !! wikitext
13036 <div style="background:
13037 #00FF00">-</div>
13038 !! html
13039 <div style="background: #00FF00">-</div>
13040
13041 !! end
13042
13043 !! test
13044 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13045 !! wikitext
13046 <div style="background: &#10;#00FF00">-</div>
13047 !! html
13048 <div style="background: &#10;#00FF00">-</div>
13049
13050 !! end
13051
13052 ###
13053 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13054 ###
13055 !! test
13056 Parser hook: empty input
13057 !! wikitext
13058 <tag></tag>
13059 !! html
13060 <pre>
13061 ''
13062 array (
13063 )
13064 </pre>
13065
13066 !! end
13067
13068 !! test
13069 Parser hook: empty input using terminated empty elements
13070 !! wikitext
13071 <tag/>
13072 !! html
13073 <pre>
13074 NULL
13075 array (
13076 )
13077 </pre>
13078
13079 !! end
13080
13081 !! test
13082 Parser hook: empty input using terminated empty elements (space before)
13083 !! wikitext
13084 <tag />
13085 !! html
13086 <pre>
13087 NULL
13088 array (
13089 )
13090 </pre>
13091
13092 !! end
13093
13094 !! test
13095 Parser hook: basic input
13096 !! wikitext
13097 <tag>input</tag>
13098 !! html
13099 <pre>
13100 'input'
13101 array (
13102 )
13103 </pre>
13104
13105 !! end
13106
13107
13108 !! test
13109 Parser hook: case insensitive
13110 !! wikitext
13111 <TAG>input</TAG>
13112 !! html
13113 <pre>
13114 'input'
13115 array (
13116 )
13117 </pre>
13118
13119 !! end
13120
13121
13122 !! test
13123 Parser hook: case insensitive, redux
13124 !! wikitext
13125 <TaG>input</TAg>
13126 !! html
13127 <pre>
13128 'input'
13129 array (
13130 )
13131 </pre>
13132
13133 !! end
13134
13135 !! test
13136 Parser hook: nested tags
13137 !! options
13138 noxml
13139 !! wikitext
13140 <tag><tag></tag></tag>
13141 !! html
13142 <pre>
13143 '<tag>'
13144 array (
13145 )
13146 </pre>&lt;/tag&gt;
13147
13148 !! end
13149
13150 !! test
13151 Parser hook: basic arguments
13152 !! wikitext
13153 <tag width=200 height = "100" depth = '50' square></tag>
13154 !! html
13155 <pre>
13156 ''
13157 array (
13158 'width' => '200',
13159 'height' => '100',
13160 'depth' => '50',
13161 'square' => 'square',
13162 )
13163 </pre>
13164
13165 !! end
13166
13167 !! test
13168 Parser hook: argument containing a forward slash (bug 5344)
13169 !! wikitext
13170 <tag filename='/tmp/bla'></tag>
13171 !! html
13172 <pre>
13173 ''
13174 array (
13175 'filename' => '/tmp/bla',
13176 )
13177 </pre>
13178
13179 !! end
13180
13181 !! test
13182 Parser hook: empty input using terminated empty elements (bug 2374)
13183 !! wikitext
13184 <tag foo=bar/>text
13185 !! html
13186 <pre>
13187 NULL
13188 array (
13189 'foo' => 'bar',
13190 )
13191 </pre>text
13192
13193 !! end
13194
13195 # </tag> should be output literally since there is no matching tag that begins it
13196 !! test
13197 Parser hook: basic arguments using terminated empty elements (bug 2374)
13198 !! wikitext
13199 <tag width=200 height = "100" depth = '50' square/>
13200 other stuff
13201 </tag>
13202 !! html
13203 <pre>
13204 NULL
13205 array (
13206 'width' => '200',
13207 'height' => '100',
13208 'depth' => '50',
13209 'square' => 'square',
13210 )
13211 </pre>
13212 <p>other stuff
13213 &lt;/tag&gt;
13214 </p>
13215 !! end
13216
13217 ###
13218 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13219 ###
13220
13221 !! test
13222 Parser hook: static parser hook not inside a comment
13223 !! wikitext
13224 <statictag>hello, world</statictag>
13225 <statictag action=flush/>
13226 !! html
13227 <p>hello, world
13228 </p>
13229 !! end
13230
13231
13232 !! test
13233 Parser hook: static parser hook inside a comment
13234 !! wikitext
13235 <!-- <statictag>hello, world</statictag> -->
13236 <statictag action=flush/>
13237 !! html
13238 <p><br />
13239 </p>
13240 !! end
13241
13242 # Nested template calls; this case was broken by Parser.php rev 1.506,
13243 # since reverted.
13244
13245 !! article
13246 Template:One-parameter
13247 !! text
13248 (My parameter is: {{{1}}})
13249 !! endarticle
13250
13251 !! article
13252 Template:Map-one-parameter
13253 !! text
13254 {{{{{1}}}|{{{2}}}}}
13255 !! endarticle
13256
13257 !! test
13258 Nested template calls
13259 !! wikitext
13260 {{Map-one-parameter|One-parameter|param}}
13261 !! html
13262 <p>(My parameter is: param)
13263 </p>
13264 !! end
13265
13266
13267 ###
13268 ### Sanitizer
13269 ###
13270 !! test
13271 Sanitizer: Closing of open tags
13272 !! wikitext
13273 <s></s><table></table>
13274 !! html
13275 <s></s><table></table>
13276
13277 !! end
13278
13279 !! test
13280 Sanitizer: Closing of open but not closed tags
13281 !! wikitext
13282 <s>foo
13283 !! html
13284 <p><s>foo</s>
13285 </p>
13286 !! end
13287
13288 !! test
13289 Sanitizer: Closing of closed but not open tags
13290 !! wikitext
13291 </s>
13292 !! html
13293 <p>&lt;/s&gt;
13294 </p>
13295 !! end
13296
13297 !! test
13298 Sanitizer: Closing of closed but not open table tags
13299 !! wikitext
13300 Table not started</td></tr></table>
13301 !! html
13302 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13303 </p>
13304 !! end
13305
13306 !! test
13307 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13308 !! wikitext
13309 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13310 !! html
13311 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13312 </p>
13313 !! end
13314
13315 !! test
13316 Sanitizer: Validating the contents of the id attribute (bug 4515)
13317 !! options
13318 disabled
13319 !! wikitext
13320 <br id=9 />
13321 !! html
13322 Something, but definitely not <br id="9" />...
13323 !! end
13324
13325 !! test
13326 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13327 !! options
13328 disabled
13329 !! wikitext
13330 <br id="foo" /><br id="foo" />
13331 !! html
13332 Something need to be done. foo-2 ?
13333 !! end
13334
13335 !! test
13336 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13337 !! wikitext
13338 <div itemscope>
13339 <meta itemprop="hello" content="world">
13340 <meta http-equiv="refresh" content="5">
13341 <meta itemprop="hello" http-equiv="refresh" content="5">
13342 <link itemprop="hello" href="{{SERVER}}">
13343 <link rel="stylesheet" href="{{SERVER}}">
13344 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13345 </div>
13346 !! html
13347 <div itemscope="itemscope">
13348 <p> <meta itemprop="hello" content="world" />
13349 &lt;meta http-equiv="refresh" content="5"&gt;
13350 <meta itemprop="hello" content="5" />
13351 </p>
13352 <link itemprop="hello" href="http&#58;//example.org" />
13353 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13354 <link itemprop="hello" href="http&#58;//example.org" />
13355 </div>
13356
13357 !! end
13358
13359 !! test
13360 Language converter: output gets cut off unexpectedly (bug 5757)
13361 !! options
13362 language=zh
13363 !! wikitext
13364 this bit is safe: }-
13365
13366 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13367
13368 then we get cut off here: }-
13369
13370 all additional text is vanished
13371 !! html
13372 <p>this bit is safe: }-
13373 </p><p>but if we add a conversion instance: xxx
13374 </p><p>then we get cut off here: }-
13375 </p><p>all additional text is vanished
13376 </p>
13377 !! end
13378
13379 !! test
13380 Self closed html pairs (bug 5487)
13381 !! options
13382 !! wikitext
13383 <center><font id="bug" />Centered text</center>
13384 <div><font id="bug2" />In div text</div>
13385 !! html
13386 <center>&lt;font id="bug" /&gt;Centered text</center>
13387 <div>&lt;font id="bug2" /&gt;In div text</div>
13388
13389 !! end
13390
13391 #
13392 #
13393 #
13394
13395 !! test
13396 Punctuation: nbsp before exclamation
13397 !! wikitext
13398 C'est grave !
13399 !! html
13400 <p>C'est grave&#160;!
13401 </p>
13402 !! end
13403
13404 !! test
13405 Punctuation: CSS !important (bug 11874)
13406 !! wikitext
13407 <div style="width:50% !important">important</div>
13408 !! html
13409 <div style="width:50% !important">important</div>
13410
13411 !!end
13412
13413 !! test
13414 Punctuation: CSS ! important (bug 11874; with space after)
13415 !! wikitext
13416 <div style="width:50% ! important">important</div>
13417 !! html
13418 <div style="width:50% ! important">important</div>
13419
13420 !!end
13421
13422
13423 !! test
13424 HTML bullet list, closed tags (bug 5497)
13425 !! wikitext
13426 <ul>
13427 <li>One</li>
13428 <li>Two</li>
13429 </ul>
13430 !! html
13431 <ul>
13432 <li>One</li>
13433 <li>Two</li>
13434 </ul>
13435
13436 !! end
13437
13438 !! test
13439 HTML bullet list, unclosed tags (bug 5497)
13440 !! options
13441 disabled
13442 !! wikitext
13443 <ul>
13444 <li>One
13445 <li>Two
13446 </ul>
13447 !! html
13448 <ul>
13449 <li>One
13450 </li>
13451 <li>Two
13452 </li>
13453 </ul>
13454
13455 !! end
13456
13457 !! test
13458 HTML ordered list, closed tags (bug 5497)
13459 !! wikitext
13460 <ol>
13461 <li>One</li>
13462 <li>Two</li>
13463 </ol>
13464 !! html
13465 <ol>
13466 <li>One</li>
13467 <li>Two</li>
13468 </ol>
13469
13470 !! end
13471
13472 !! test
13473 HTML ordered list, unclosed tags (bug 5497)
13474 !! options
13475 disabled
13476 !! wikitext
13477 <ol>
13478 <li>One
13479 <li>Two
13480 </ol>
13481 !! html
13482 <ol>
13483 <li>One
13484 </li>
13485 <li>Two
13486 </li>
13487 </ol>
13488
13489 !! end
13490
13491 !! test
13492 HTML nested bullet list, closed tags (bug 5497)
13493 !! wikitext
13494 <ul>
13495 <li>One</li>
13496 <li>Two:
13497 <ul>
13498 <li>Sub-one</li>
13499 <li>Sub-two</li>
13500 </ul>
13501 </li>
13502 </ul>
13503 !! html
13504 <ul>
13505 <li>One</li>
13506 <li>Two:
13507 <ul>
13508 <li>Sub-one</li>
13509 <li>Sub-two</li>
13510 </ul>
13511 </li>
13512 </ul>
13513
13514 !! end
13515
13516 !! test
13517 HTML nested bullet list, open tags (bug 5497)
13518 !! options
13519 disabled
13520 !! wikitext
13521 <ul>
13522 <li>One
13523 <li>Two:
13524 <ul>
13525 <li>Sub-one
13526 <li>Sub-two
13527 </ul>
13528 </ul>
13529 !! html
13530 <ul>
13531 <li>One
13532 </li>
13533 <li>Two:
13534 <ul>
13535 <li>Sub-one
13536 </li>
13537 <li>Sub-two
13538 </li>
13539 </ul>
13540 </li>
13541 </ul>
13542
13543 !! end
13544
13545 !! test
13546 HTML nested ordered list, closed tags (bug 5497)
13547 !! wikitext
13548 <ol>
13549 <li>One</li>
13550 <li>Two:
13551 <ol>
13552 <li>Sub-one</li>
13553 <li>Sub-two</li>
13554 </ol>
13555 </li>
13556 </ol>
13557 !! html
13558 <ol>
13559 <li>One</li>
13560 <li>Two:
13561 <ol>
13562 <li>Sub-one</li>
13563 <li>Sub-two</li>
13564 </ol>
13565 </li>
13566 </ol>
13567
13568 !! end
13569
13570 !! test
13571 HTML nested ordered list, open tags (bug 5497)
13572 !! options
13573 disabled
13574 !! wikitext
13575 <ol>
13576 <li>One
13577 <li>Two:
13578 <ol>
13579 <li>Sub-one
13580 <li>Sub-two
13581 </ol>
13582 </ol>
13583 !! html
13584 <ol>
13585 <li>One
13586 </li>
13587 <li>Two:
13588 <ol>
13589 <li>Sub-one
13590 </li>
13591 <li>Sub-two
13592 </li>
13593 </ol>
13594 </li>
13595 </ol>
13596
13597 !! end
13598
13599 !! test
13600 HTML ordered list item with parameters oddity
13601 !! wikitext
13602 <ol><li id="fragment">One</li>
13603 </ol>
13604 !! html
13605 <ol><li id="fragment">One</li>
13606 </ol>
13607
13608 !! end
13609
13610 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13611 !!test
13612 bug 5918: autonumbering
13613 !! wikitext
13614 [http://first/] [http://second] [ftp://ftp]
13615
13616 ftp://inlineftp
13617
13618 [mailto:enclosed@mail.tld With target]
13619
13620 [mailto:enclosed@mail.tld]
13621
13622 mailto:inline@mail.tld
13623 !! html/php
13624 <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>
13625 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13626 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13627 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13628 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13629 </p>
13630 !! html/parsoid
13631 <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>
13632 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13633 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13634 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13635 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13636 !! end
13637
13638
13639 #
13640 # Security and HTML correctness
13641 # From Nick Jenkins' fuzz testing
13642 #
13643
13644 !! test
13645 Fuzz testing: Parser13
13646 !! wikitext
13647 {|
13648 | http://a|
13649 !! html
13650 <table>
13651 <tr>
13652 <td>
13653 </td>
13654 </tr>
13655 </table>
13656
13657 !! end
13658
13659 !! test
13660 Fuzz testing: Parser14
13661 !! wikitext
13662 == onmouseover= ==
13663 http://__TOC__
13664 !! html
13665 <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>
13666 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13667 <ul>
13668 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13669 </ul>
13670 </div>
13671
13672
13673 !! end
13674
13675 !! test
13676 Fuzz testing: Parser14-table
13677 !! wikitext
13678 ==a==
13679 {| STYLE=__TOC__
13680 !! html
13681 <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>
13682 <table style="&#95;_TOC&#95;_">
13683 <tr><td></td></tr>
13684 </table>
13685
13686 !! end
13687
13688 # Known to produce bogus xml (extra </td>)
13689 !! test
13690 Fuzz testing: Parser16
13691 !! options
13692 noxml
13693 !! wikitext
13694 {|
13695 !https://||||||
13696 !! html
13697 <table>
13698 <tr>
13699 <th>https://</th>
13700 <th></th>
13701 <th></th>
13702 <th>
13703 </td>
13704 </tr>
13705 </table>
13706
13707 !! end
13708
13709 !! test
13710 Fuzz testing: Parser21
13711 !! wikitext
13712 {|
13713 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13714 |
13715 !! html
13716 <table>
13717 <tr>
13718 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13719 </th>
13720 <td>
13721 </td>
13722 </tr>
13723 </table>
13724
13725 !! end
13726
13727 !! test
13728 Fuzz testing: Parser22
13729 !! wikitext
13730 http://===r:::https://b
13731
13732 {|
13733 !! html
13734 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13735 </p>
13736 <table>
13737 <tr><td></td></tr>
13738 </table>
13739
13740 !! end
13741
13742 # Known to produce bad XML for now
13743 !! test
13744 Fuzz testing: Parser24
13745 !! options
13746 noxml
13747 !! wikitext
13748 {|
13749 {{{|
13750 <u CLASS=
13751 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13752 <br style="onmouseover='alert(document.cookie);' " />
13753
13754 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13755 |
13756 !! html
13757 <table>
13758 {{{|
13759 <u class="&#124;">}}}} &gt;
13760 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13761
13762 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13763 <tr>
13764 <td></u>
13765 </td>
13766 </tr>
13767 </table>
13768
13769 !! end
13770
13771 # Note: the current result listed for this is not what the original one was,
13772 # but the original bug was JavaScript injection, which is fixed in any case.
13773 # It's not clear that the original result listed was any more correct than the
13774 # current one. Original result:
13775 # <p>{{{|
13776 # </p>
13777 # <li class="&#124;&#124;">
13778 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13779 !!test
13780 Fuzz testing: Parser25 (bug 6055)
13781 !! wikitext
13782 {{{
13783 |
13784 <LI CLASS=||
13785 >
13786 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13787 !! html
13788 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13789 </p>
13790 !! end
13791
13792 !!test
13793 Fuzz testing: URL adjacent extension (with space, clean)
13794 !! options
13795 !! wikitext
13796 http://example.com <nowiki>junk</nowiki>
13797 !! html
13798 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13799 </p>
13800 !!end
13801
13802 !!test
13803 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13804 !! options
13805 !! wikitext
13806 http://example.com<nowiki>junk</nowiki>
13807 !! html
13808 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13809 </p>
13810 !!end
13811
13812 !!test
13813 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13814 !! options
13815 !! wikitext
13816 http://example.com<pre>junk</pre>
13817 !! html
13818 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13819
13820 !!end
13821
13822 !!test
13823 Fuzz testing: image with bogus manual thumbnail
13824 !! wikitext
13825 [[Image:foobar.jpg|thumbnail= ]]
13826 !! html/php
13827 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13828
13829 !! html/parsoid
13830 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13831 !!end
13832
13833 !! test
13834 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13835 !! wikitext
13836 <pre dir="&#10;"></pre>
13837 !! html
13838 <pre dir="&#10;"></pre>
13839
13840 !! end
13841
13842 !! test
13843 Parsing optional HTML elements (Bug 6171)
13844 !! options
13845 !! wikitext
13846 <table>
13847 <tr>
13848 <td> Some tabular data</td>
13849 <td> More tabular data ...
13850 <td> And yet som tabular data</td>
13851 </tr>
13852 </table>
13853 !! html
13854 <table>
13855 <tr>
13856 <td> Some tabular data</td>
13857 <td> More tabular data ...
13858 </td><td> And yet som tabular data</td>
13859 </tr>
13860 </table>
13861
13862 !! end
13863
13864 !! test
13865 Correct handling of <td>, <tr> (Bug 6171)
13866 !! options
13867 !! wikitext
13868 <table>
13869 <tr>
13870 <td> Some tabular data</td>
13871 <td> More tabular data ...</td>
13872 <td> And yet som tabular data</td>
13873 </tr>
13874 </table>
13875 !! html
13876 <table>
13877 <tr>
13878 <td> Some tabular data</td>
13879 <td> More tabular data ...</td>
13880 <td> And yet som tabular data</td>
13881 </tr>
13882 </table>
13883
13884 !! end
13885
13886
13887 !! test
13888 Parsing crashing regression (fr:JavaScript)
13889 !! wikitext
13890 </body></x>
13891 !! html
13892 <p>&lt;/body&gt;&lt;/x&gt;
13893 </p>
13894 !! end
13895
13896 !! test
13897 Inline wiki vs wiki block nesting
13898 !! wikitext
13899 '''Bold paragraph
13900
13901 New wiki paragraph
13902 !! html
13903 <p><b>Bold paragraph</b>
13904 </p><p>New wiki paragraph
13905 </p>
13906 !! end
13907
13908 !! test
13909 Inline HTML vs wiki block nesting
13910 !! options
13911 disabled
13912 !! wikitext
13913 <b>Bold paragraph
13914
13915 New wiki paragraph
13916 !! html
13917 <p><b>Bold paragraph</b>
13918 </p><p>New wiki paragraph
13919 </p>
13920 !! end
13921
13922 # Original result was this:
13923 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13924 # </p>
13925 # While that might be marginally more intuitive, maybe, the six-apostrophe
13926 # construct is clearly pathological and the result stated here (which is what
13927 # the parser actually does) is about as reasonable as anything.
13928 !!test
13929 Mixing markup for italics and bold
13930 !! options
13931 !! wikitext
13932 '''bold''''''bold''bolditalics'''''
13933 !! html
13934 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13935 </p>
13936 !! end
13937
13938
13939 !! article
13940 Xyzzyx
13941 !! text
13942 Article for special page transclusion test
13943 !! endarticle
13944
13945 !! test
13946 Special page transclusion
13947 !! options
13948 !! wikitext
13949 {{Special:Prefixindex/Xyzzyx}}
13950 !! html
13951 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13952
13953 !! end
13954
13955 !! test
13956 Special page transclusion twice (bug 5021)
13957 !! options
13958 !! wikitext
13959 {{Special:Prefixindex/Xyzzyx}}
13960 {{Special:Prefixindex/Xyzzyx}}
13961 !! html
13962 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13963 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13964
13965 !! end
13966
13967 !! test
13968 Transclusion of default MediaWiki message
13969 !! wikitext
13970 {{MediaWiki:Mainpage}}
13971 !! html
13972 <p>Main Page
13973 </p>
13974 !! end
13975
13976 !! test
13977 Transclusion of nonexistent MediaWiki message
13978 !! wikitext
13979 {{MediaWiki:Mainpagexxx}}
13980 !! html
13981 <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>
13982 </p>
13983 !! end
13984
13985 !! test
13986 Transclusion of MediaWiki message with underscore
13987 !! wikitext
13988 {{MediaWiki:history_short}}
13989 !! html
13990 <p>History
13991 </p>
13992 !! end
13993
13994 !! test
13995 Transclusion of MediaWiki message with space
13996 !! wikitext
13997 {{MediaWiki:history short}}
13998 !! html
13999 <p>History
14000 </p>
14001 !! end
14002
14003 !! test
14004 Invalid header with following text
14005 !! wikitext
14006 = x = y
14007 !! html
14008 <p>= x = y
14009 </p>
14010 !! end
14011
14012
14013 !! test
14014 Section extraction test (section 0)
14015 !! options
14016 section=0
14017 !! wikitext
14018 start
14019 ==a==
14020 ===aa===
14021 ====aaa====
14022 ==b==
14023 ===ba===
14024 ===bb===
14025 ====bba====
14026 ===bc===
14027 ==c==
14028 ===ca===
14029 !! html
14030 start
14031 !! end
14032
14033 !! test
14034 Section extraction test (section 1)
14035 !! options
14036 section=1
14037 !! wikitext
14038 start
14039 ==a==
14040 ===aa===
14041 ====aaa====
14042 ==b==
14043 ===ba===
14044 ===bb===
14045 ====bba====
14046 ===bc===
14047 ==c==
14048 ===ca===
14049 !! html
14050 ==a==
14051 ===aa===
14052 ====aaa====
14053 !! end
14054
14055 !! test
14056 Section extraction test (section 2)
14057 !! options
14058 section=2
14059 !! wikitext
14060 start
14061 ==a==
14062 ===aa===
14063 ====aaa====
14064 ==b==
14065 ===ba===
14066 ===bb===
14067 ====bba====
14068 ===bc===
14069 ==c==
14070 ===ca===
14071 !! html
14072 ===aa===
14073 ====aaa====
14074 !! end
14075
14076 !! test
14077 Section extraction test (section 3)
14078 !! options
14079 section=3
14080 !! wikitext
14081 start
14082 ==a==
14083 ===aa===
14084 ====aaa====
14085 ==b==
14086 ===ba===
14087 ===bb===
14088 ====bba====
14089 ===bc===
14090 ==c==
14091 ===ca===
14092 !! html
14093 ====aaa====
14094 !! end
14095
14096 !! test
14097 Section extraction test (section 4)
14098 !! options
14099 section=4
14100 !! wikitext
14101 start
14102 ==a==
14103 ===aa===
14104 ====aaa====
14105 ==b==
14106 ===ba===
14107 ===bb===
14108 ====bba====
14109 ===bc===
14110 ==c==
14111 ===ca===
14112 !! html
14113 ==b==
14114 ===ba===
14115 ===bb===
14116 ====bba====
14117 ===bc===
14118 !! end
14119
14120 !! test
14121 Section extraction test (section 5)
14122 !! options
14123 section=5
14124 !! wikitext
14125 start
14126 ==a==
14127 ===aa===
14128 ====aaa====
14129 ==b==
14130 ===ba===
14131 ===bb===
14132 ====bba====
14133 ===bc===
14134 ==c==
14135 ===ca===
14136 !! html
14137 ===ba===
14138 !! end
14139
14140 !! test
14141 Section extraction test (section 6)
14142 !! options
14143 section=6
14144 !! wikitext
14145 start
14146 ==a==
14147 ===aa===
14148 ====aaa====
14149 ==b==
14150 ===ba===
14151 ===bb===
14152 ====bba====
14153 ===bc===
14154 ==c==
14155 ===ca===
14156 !! html
14157 ===bb===
14158 ====bba====
14159 !! end
14160
14161 !! test
14162 Section extraction test (section 7)
14163 !! options
14164 section=7
14165 !! wikitext
14166 start
14167 ==a==
14168 ===aa===
14169 ====aaa====
14170 ==b==
14171 ===ba===
14172 ===bb===
14173 ====bba====
14174 ===bc===
14175 ==c==
14176 ===ca===
14177 !! html
14178 ====bba====
14179 !! end
14180
14181 !! test
14182 Section extraction test (section 8)
14183 !! options
14184 section=8
14185 !! wikitext
14186 start
14187 ==a==
14188 ===aa===
14189 ====aaa====
14190 ==b==
14191 ===ba===
14192 ===bb===
14193 ====bba====
14194 ===bc===
14195 ==c==
14196 ===ca===
14197 !! html
14198 ===bc===
14199 !! end
14200
14201 !! test
14202 Section extraction test (section 9)
14203 !! options
14204 section=9
14205 !! wikitext
14206 start
14207 ==a==
14208 ===aa===
14209 ====aaa====
14210 ==b==
14211 ===ba===
14212 ===bb===
14213 ====bba====
14214 ===bc===
14215 ==c==
14216 ===ca===
14217 !! html
14218 ==c==
14219 ===ca===
14220 !! end
14221
14222 !! test
14223 Section extraction test (section 10)
14224 !! options
14225 section=10
14226 !! wikitext
14227 start
14228 ==a==
14229 ===aa===
14230 ====aaa====
14231 ==b==
14232 ===ba===
14233 ===bb===
14234 ====bba====
14235 ===bc===
14236 ==c==
14237 ===ca===
14238 !! html
14239 ===ca===
14240 !! end
14241
14242 !! test
14243 Section extraction test (nonexistent section 11)
14244 !! options
14245 section=11
14246 !! wikitext
14247 start
14248 ==a==
14249 ===aa===
14250 ====aaa====
14251 ==b==
14252 ===ba===
14253 ===bb===
14254 ====bba====
14255 ===bc===
14256 ==c==
14257 ===ca===
14258 !! html
14259 !! end
14260
14261 !! test
14262 Section extraction test with bogus heading (section 1)
14263 !! options
14264 section=1
14265 !! wikitext
14266 ==a==
14267 ==bogus== not a legal section
14268 ==b==
14269 !! html
14270 ==a==
14271 ==bogus== not a legal section
14272 !! end
14273
14274 !! test
14275 Section extraction test with bogus heading (section 2)
14276 !! options
14277 section=2
14278 !! wikitext
14279 ==a==
14280 ==bogus== not a legal section
14281 ==b==
14282 !! html
14283 ==b==
14284 !! end
14285
14286 !! test
14287 Section extraction test with comment after heading (section 1)
14288 !! options
14289 section=1
14290 !! wikitext
14291 ==a==
14292 ==b== <!-- -->
14293 ==c==
14294 !! html
14295 ==a==
14296 !! end
14297
14298 !! test
14299 Section extraction test with comment after heading (section 2)
14300 !! options
14301 section=2
14302 !! wikitext
14303 ==a==
14304 ==b== <!-- -->
14305 ==c==
14306 !! html
14307 ==b== <!-- -->
14308 !! end
14309
14310 !! test
14311 Section extraction test with bogus <nowiki> heading (section 1)
14312 !! options
14313 section=1
14314 !! wikitext
14315 ==a==
14316 ==bogus== <nowiki>not a legal section</nowiki>
14317 ==b==
14318 !! html
14319 ==a==
14320 ==bogus== <nowiki>not a legal section</nowiki>
14321 !! end
14322
14323 !! test
14324 Section extraction test with bogus <nowiki> heading (section 2)
14325 !! options
14326 section=2
14327 !! wikitext
14328 ==a==
14329 ==bogus== <nowiki>not a legal section</nowiki>
14330 ==b==
14331 !! html
14332 ==b==
14333 !! end
14334
14335
14336 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14337 # instead of respecting commented sections
14338 !! test
14339 Section extraction prefixed by comment (section 1)
14340 !! options
14341 section=1
14342 !! wikitext
14343 <!-- -->==sec1==
14344 ==sec2==
14345 !! html
14346 ==sec2==
14347 !!end
14348
14349 !! test
14350 Section extraction prefixed by comment (section 2)
14351 !! options
14352 section=2
14353 !! wikitext
14354 <!-- -->==sec1==
14355 ==sec2==
14356 !! html
14357
14358 !!end
14359
14360
14361 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14362 # instead of respecting HTML-style headings
14363 !! test
14364 Section extraction, mixed wiki and html (section 1)
14365 !! options
14366 section=1
14367 !! wikitext
14368 <h2>unmarked</h2>
14369 unmarked
14370 ==1==
14371 one
14372 ==2==
14373 two
14374 !! html
14375 ==1==
14376 one
14377 !! end
14378
14379 !! test
14380 Section extraction, mixed wiki and html (section 2)
14381 !! options
14382 section=2
14383 !! wikitext
14384 <h2>unmarked</h2>
14385 unmarked
14386 ==1==
14387 one
14388 ==2==
14389 two
14390 !! html
14391 ==2==
14392 two
14393 !! end
14394
14395
14396 # Formerly testing for bug 3342
14397 !! test
14398 Section extraction, heading surrounded by <noinclude>
14399 !! options
14400 section=1
14401 !! wikitext
14402 <noinclude>==unmarked==</noinclude>
14403 ==marked==
14404 !! html
14405 ==marked==
14406 !!end
14407
14408 # Test behavior of bug 19910
14409 !! test
14410 Sectiion with all-equals
14411 !! options
14412 section=2
14413 !! wikitext
14414 ===
14415 The line above must have a trailing space
14416 === <!--
14417 --> <!-- -->
14418 But just in case it doesn't...
14419 !! html
14420 === <!--
14421 --> <!-- -->
14422 But just in case it doesn't...
14423 !! end
14424
14425 !! test
14426 Section replacement test (section 0)
14427 !! options
14428 replace=0,"xxx"
14429 !! wikitext
14430 start
14431 ==a==
14432 ===aa===
14433 ====aaa====
14434 ==b==
14435 ===ba===
14436 ===bb===
14437 ====bba====
14438 ===bc===
14439 ==c==
14440 ===ca===
14441 !! html
14442 xxx
14443
14444 ==a==
14445 ===aa===
14446 ====aaa====
14447 ==b==
14448 ===ba===
14449 ===bb===
14450 ====bba====
14451 ===bc===
14452 ==c==
14453 ===ca===
14454 !! end
14455
14456 !! test
14457 Section replacement test (section 1)
14458 !! options
14459 replace=1,"xxx"
14460 !! wikitext
14461 start
14462 ==a==
14463 ===aa===
14464 ====aaa====
14465 ==b==
14466 ===ba===
14467 ===bb===
14468 ====bba====
14469 ===bc===
14470 ==c==
14471 ===ca===
14472 !! html
14473 start
14474 xxx
14475
14476 ==b==
14477 ===ba===
14478 ===bb===
14479 ====bba====
14480 ===bc===
14481 ==c==
14482 ===ca===
14483 !! end
14484
14485 !! test
14486 Section replacement test (section 2)
14487 !! options
14488 replace=2,"xxx"
14489 !! wikitext
14490 start
14491 ==a==
14492 ===aa===
14493 ====aaa====
14494 ==b==
14495 ===ba===
14496 ===bb===
14497 ====bba====
14498 ===bc===
14499 ==c==
14500 ===ca===
14501 !! html
14502 start
14503 ==a==
14504 xxx
14505
14506 ==b==
14507 ===ba===
14508 ===bb===
14509 ====bba====
14510 ===bc===
14511 ==c==
14512 ===ca===
14513 !! end
14514
14515 !! test
14516 Section replacement test (section 3)
14517 !! options
14518 replace=3,"xxx"
14519 !! wikitext
14520 start
14521 ==a==
14522 ===aa===
14523 ====aaa====
14524 ==b==
14525 ===ba===
14526 ===bb===
14527 ====bba====
14528 ===bc===
14529 ==c==
14530 ===ca===
14531 !! html
14532 start
14533 ==a==
14534 ===aa===
14535 xxx
14536
14537 ==b==
14538 ===ba===
14539 ===bb===
14540 ====bba====
14541 ===bc===
14542 ==c==
14543 ===ca===
14544 !! end
14545
14546 !! test
14547 Section replacement test (section 4)
14548 !! options
14549 replace=4,"xxx"
14550 !! wikitext
14551 start
14552 ==a==
14553 ===aa===
14554 ====aaa====
14555 ==b==
14556 ===ba===
14557 ===bb===
14558 ====bba====
14559 ===bc===
14560 ==c==
14561 ===ca===
14562 !! html
14563 start
14564 ==a==
14565 ===aa===
14566 ====aaa====
14567 xxx
14568
14569 ==c==
14570 ===ca===
14571 !! end
14572
14573 !! test
14574 Section replacement test (section 5)
14575 !! options
14576 replace=5,"xxx"
14577 !! wikitext
14578 start
14579 ==a==
14580 ===aa===
14581 ====aaa====
14582 ==b==
14583 ===ba===
14584 ===bb===
14585 ====bba====
14586 ===bc===
14587 ==c==
14588 ===ca===
14589 !! html
14590 start
14591 ==a==
14592 ===aa===
14593 ====aaa====
14594 ==b==
14595 xxx
14596
14597 ===bb===
14598 ====bba====
14599 ===bc===
14600 ==c==
14601 ===ca===
14602 !! end
14603
14604 !! test
14605 Section replacement test (section 6)
14606 !! options
14607 replace=6,"xxx"
14608 !! wikitext
14609 start
14610 ==a==
14611 ===aa===
14612 ====aaa====
14613 ==b==
14614 ===ba===
14615 ===bb===
14616 ====bba====
14617 ===bc===
14618 ==c==
14619 ===ca===
14620 !! html
14621 start
14622 ==a==
14623 ===aa===
14624 ====aaa====
14625 ==b==
14626 ===ba===
14627 xxx
14628
14629 ===bc===
14630 ==c==
14631 ===ca===
14632 !! end
14633
14634 !! test
14635 Section replacement test (section 7)
14636 !! options
14637 replace=7,"xxx"
14638 !! wikitext
14639 start
14640 ==a==
14641 ===aa===
14642 ====aaa====
14643 ==b==
14644 ===ba===
14645 ===bb===
14646 ====bba====
14647 ===bc===
14648 ==c==
14649 ===ca===
14650 !! html
14651 start
14652 ==a==
14653 ===aa===
14654 ====aaa====
14655 ==b==
14656 ===ba===
14657 ===bb===
14658 xxx
14659
14660 ===bc===
14661 ==c==
14662 ===ca===
14663 !! end
14664
14665 !! test
14666 Section replacement test (section 8)
14667 !! options
14668 replace=8,"xxx"
14669 !! wikitext
14670 start
14671 ==a==
14672 ===aa===
14673 ====aaa====
14674 ==b==
14675 ===ba===
14676 ===bb===
14677 ====bba====
14678 ===bc===
14679 ==c==
14680 ===ca===
14681 !! html
14682 start
14683 ==a==
14684 ===aa===
14685 ====aaa====
14686 ==b==
14687 ===ba===
14688 ===bb===
14689 ====bba====
14690 xxx
14691
14692 ==c==
14693 ===ca===
14694 !!end
14695
14696 !! test
14697 Section replacement test (section 9)
14698 !! options
14699 replace=9,"xxx"
14700 !! wikitext
14701 start
14702 ==a==
14703 ===aa===
14704 ====aaa====
14705 ==b==
14706 ===ba===
14707 ===bb===
14708 ====bba====
14709 ===bc===
14710 ==c==
14711 ===ca===
14712 !! html
14713 start
14714 ==a==
14715 ===aa===
14716 ====aaa====
14717 ==b==
14718 ===ba===
14719 ===bb===
14720 ====bba====
14721 ===bc===
14722 xxx
14723 !! end
14724
14725 !! test
14726 Section replacement test (section 10)
14727 !! options
14728 replace=10,"xxx"
14729 !! wikitext
14730 start
14731 ==a==
14732 ===aa===
14733 ====aaa====
14734 ==b==
14735 ===ba===
14736 ===bb===
14737 ====bba====
14738 ===bc===
14739 ==c==
14740 ===ca===
14741 !! html
14742 start
14743 ==a==
14744 ===aa===
14745 ====aaa====
14746 ==b==
14747 ===ba===
14748 ===bb===
14749 ====bba====
14750 ===bc===
14751 ==c==
14752 xxx
14753 !! end
14754
14755 !! test
14756 Section replacement test with initial whitespace (bug 13728)
14757 !! options
14758 replace=2,"xxx"
14759 !! wikitext
14760 Preformatted initial line
14761 ==a==
14762 ===a===
14763 !! html
14764 Preformatted initial line
14765 ==a==
14766 xxx
14767 !! end
14768
14769
14770 !! test
14771 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14772 !! options
14773 section=1
14774 !! wikitext
14775 ==a==
14776 a
14777 !! html
14778 ==a==
14779 a
14780 !! end
14781
14782 !! test
14783 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14784 !! options
14785 section=1
14786 !! wikitext
14787 ==a==
14788 a
14789 !! html
14790 ==a==
14791 a
14792 !! end
14793
14794
14795 !! test
14796 Section extraction, <pre> around bogus header (bug 10309)
14797 !! options
14798 noxml section=2
14799 !! wikitext
14800 == Section One ==
14801 <pre>
14802 =======
14803 </pre>
14804
14805 == Section Two ==
14806 stuff
14807 !! html
14808 == Section Two ==
14809 stuff
14810 !! end
14811
14812 !! test
14813 Section replacement, <pre> around bogus header (bug 10309)
14814 !! options
14815 noxml replace=2,"xxx"
14816 !! wikitext
14817 == Section One ==
14818 <pre>
14819 =======
14820 </pre>
14821
14822 == Section Two ==
14823 stuff
14824 !! html
14825 == Section One ==
14826 <pre>
14827 =======
14828 </pre>
14829
14830 xxx
14831 !! end
14832
14833
14834
14835 !! test
14836 Handling of &#x0A; in URLs
14837 !! wikitext
14838 ** irc://&#x0A;a
14839 !! html/php
14840 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14841
14842 !! html/parsoid
14843 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
14844 a">irc://
14845 a</a></li></ul></li></ul>
14846 !! end
14847
14848 !! test
14849 Handling of %0A in URLs
14850 !! wikitext
14851 ** irc://%0Aa
14852 !! html/php
14853 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14854
14855 !! html/parsoid
14856 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14857 !! end
14858
14859
14860 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14861 !! test
14862 5 quotes, code coverage +1 line
14863 !! options
14864 parsoid=wt2html
14865 !! wikitext
14866 '''''
14867 !! html/php
14868 !! html/parsoid
14869 <p><b><i></i></b></p>
14870 !! end
14871
14872 # same html as previous, but wikitext adjusted to match parsoid html2wt
14873 # note that wt2html and html2html will put the <i> before the <b>
14874 !! test
14875 5 quotes, code coverage +1 line w/ nowiki (1)
14876 !! options
14877 parsoid=wt2wt,html2wt
14878 !! wikitext
14879 '''''<nowiki/>'''''
14880 !! html/php
14881 <p><i></i>
14882 </p>
14883 !! html/parsoid
14884 <p><b><i></i></b></p>
14885 !! end
14886
14887 # same as previous, just swapping the <i> and <b>
14888 !! test
14889 5 quotes, code coverage +1 line w/ nowiki (2)
14890 !! wikitext
14891 '''''<nowiki/>'''''
14892 !! html/php
14893 <p><i></i>
14894 </p>
14895 !! html/parsoid
14896 <p><i><b></b></i></p>
14897 !! end
14898
14899 !! test
14900 Special:Search page linking.
14901 !! wikitext
14902 {{Special:search}}
14903 !! html
14904 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14905 </p>
14906 !! end
14907
14908 !! test
14909 Say the magic word
14910 !! options
14911 title=[[Parser test]]
14912 !! wikitext
14913 * {{PAGENAME}}
14914 * {{PAGENAMEE}}
14915 * {{FULLPAGENAME}}
14916 * {{FULLPAGENAMEE}}
14917 * {{BASEPAGENAME}}
14918 * {{BASEPAGENAMEE}}
14919 * {{SUBPAGENAME}}
14920 * {{SUBPAGENAMEE}}
14921 * {{ROOTPAGENAME}}
14922 * {{ROOTPAGENAMEE}}
14923 * {{TALKPAGENAME}}
14924 * {{TALKPAGENAMEE}}
14925 * {{SUBJECTPAGENAME}}
14926 * {{SUBJECTPAGENAMEE}}
14927 * {{NAMESPACEE}}
14928 * {{NAMESPACE}}
14929 * {{NAMESPACENUMBER}}
14930 * {{TALKSPACE}}
14931 * {{TALKSPACEE}}
14932 * {{SUBJECTSPACE}}
14933 * {{SUBJECTSPACEE}}
14934 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14935 !! html
14936 <ul><li> Parser test</li>
14937 <li> Parser_test</li>
14938 <li> Parser test</li>
14939 <li> Parser_test</li>
14940 <li> Parser test</li>
14941 <li> Parser_test</li>
14942 <li> Parser test</li>
14943 <li> Parser_test</li>
14944 <li> Parser test</li>
14945 <li> Parser_test</li>
14946 <li> Talk:Parser test</li>
14947 <li> Talk:Parser_test</li>
14948 <li> Parser test</li>
14949 <li> Parser_test</li>
14950 <li> </li>
14951 <li> </li>
14952 <li> 0</li>
14953 <li> Talk</li>
14954 <li> Talk</li>
14955 <li> </li>
14956 <li> </li>
14957 <li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
14958
14959 !! end
14960 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14961
14962 !! test
14963 Gallery
14964 !! wikitext
14965 <gallery>
14966 image1.png |
14967 image2.gif|||||
14968
14969 image3|
14970 image4 |300px| centre
14971 image5.svg| http://///////
14972 [[x|xx]]]]
14973 * image6
14974 </gallery>
14975 !! html
14976 <ul class="gallery mw-gallery-traditional">
14977 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14978 <div class="thumb" style="height: 150px;">Image1.png</div>
14979 <div class="gallerytext">
14980 </div>
14981 </div></li>
14982 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14983 <div class="thumb" style="height: 150px;">Image2.gif</div>
14984 <div class="gallerytext">
14985 <p>||||
14986 </p>
14987 </div>
14988 </div></li>
14989 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14990 <div class="thumb" style="height: 150px;">Image3</div>
14991 <div class="gallerytext">
14992 </div>
14993 </div></li>
14994 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14995 <div class="thumb" style="height: 150px;">Image4</div>
14996 <div class="gallerytext">
14997 <p>300px| centre
14998 </p>
14999 </div>
15000 </div></li>
15001 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15002 <div class="thumb" style="height: 150px;">Image5.svg</div>
15003 <div class="gallerytext">
15004 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15005 </p>
15006 </div>
15007 </div></li>
15008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15009 <div class="thumb" style="height: 150px;">* image6</div>
15010 <div class="gallerytext">
15011 </div>
15012 </div></li>
15013 </ul>
15014
15015 !! end
15016
15017 !! test
15018 Gallery (with options)
15019 !! wikitext
15020 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15021 File:Nonexistant.jpg|caption
15022 File:Nonexistant.jpg
15023 image:foobar.jpg|some '''caption''' [[Main Page]]
15024 image:foobar.jpg
15025 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15026 </gallery>
15027 !! html
15028 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15029 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15030 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15031 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15032 <div class="gallerytext">
15033 <p>caption
15034 </p>
15035 </div>
15036 </div></li>
15037 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15038 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15039 <div class="gallerytext">
15040 </div>
15041 </div></li>
15042 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15043 <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>
15044 <div class="gallerytext">
15045 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15046 </p>
15047 </div>
15048 </div></li>
15049 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15050 <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>
15051 <div class="gallerytext">
15052 </div>
15053 </div></li>
15054 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15055 <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>
15056 <div class="gallerytext">
15057 <p>Blabla|blabla.
15058 </p>
15059 </div>
15060 </div></li>
15061 </ul>
15062
15063 !! end
15064
15065 !! test
15066 Gallery with wikitext inside caption
15067 !! wikitext
15068 <gallery>
15069 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15070 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15071 </gallery>
15072 !! html
15073 <ul class="gallery mw-gallery-traditional">
15074 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15075 <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>
15076 <div class="gallerytext">
15077 <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>
15078 </p>
15079 </div>
15080 </div></li>
15081 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15082 <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>
15083 <div class="gallerytext">
15084 <p>This is a test template
15085 </p>
15086 </div>
15087 </div></li>
15088 </ul>
15089
15090 !! end
15091
15092 !! test
15093 gallery (with showfilename option)
15094 !! wikitext
15095 <gallery showfilename>
15096 File:Nonexistant.jpg|caption
15097 File:Nonexistant.jpg
15098 image:foobar.jpg|some '''caption''' [[Main Page]]
15099 File:Foobar.jpg
15100 </gallery>
15101 !! html
15102 <ul class="gallery mw-gallery-traditional">
15103 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15104 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15105 <div class="gallerytext">
15106 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15107 caption
15108 </p>
15109 </div>
15110 </div></li>
15111 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15112 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15113 <div class="gallerytext">
15114 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15115 </p>
15116 </div>
15117 </div></li>
15118 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15119 <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>
15120 <div class="gallerytext">
15121 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15122 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15123 </p>
15124 </div>
15125 </div></li>
15126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15127 <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>
15128 <div class="gallerytext">
15129 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15130 </p>
15131 </div>
15132 </div></li>
15133 </ul>
15134
15135 !! end
15136
15137 !! test
15138 Gallery (with namespace-less filenames)
15139 !! wikitext
15140 <gallery>
15141 File:Nonexistant.jpg
15142 Nonexistant.jpg
15143 image:foobar.jpg
15144 foobar.jpg
15145 </gallery>
15146 !! html
15147 <ul class="gallery mw-gallery-traditional">
15148 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15149 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15150 <div class="gallerytext">
15151 </div>
15152 </div></li>
15153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15154 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15155 <div class="gallerytext">
15156 </div>
15157 </div></li>
15158 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15159 <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>
15160 <div class="gallerytext">
15161 </div>
15162 </div></li>
15163 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15164 <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>
15165 <div class="gallerytext">
15166 </div>
15167 </div></li>
15168 </ul>
15169
15170 !! end
15171
15172 !! test
15173 HTML Hex character encoding (spells the word "JavaScript")
15174 !! options
15175 parsoid=wt2html,wt2wt,html2html
15176 !! wikitext
15177 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15178 !! html/php
15179 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15180 </p>
15181 !! html/parsoid
15182 <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>
15183 !! end
15184
15185 !! test
15186 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15187 !! wikitext
15188 &#xsee;&#XSEE;
15189 !! html/php
15190 <p>&amp;#xsee;&amp;#XSEE;
15191 </p>
15192 !! html/parsoid
15193 <p>&amp;#xsee;&amp;#XSEE;</p>
15194 !! end
15195
15196 !! test
15197 HTML Hex character encoding mixed case
15198 !! options
15199 parsoid=wt2html,wt2wt,html2html
15200 !! wikitext
15201 &#xEE;&#Xee;
15202 !! html/php
15203 <p>&#xee;&#xee;
15204 </p>
15205 !! html/parsoid
15206 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15207 !! end
15208
15209 !! test
15210 __FORCETOC__ override
15211 !! wikitext
15212 __NEWSECTIONLINK__
15213 __FORCETOC__
15214 !! html
15215 <p><br />
15216 </p>
15217 !! end
15218
15219 !! test
15220 ISBN code coverage
15221 !! wikitext
15222 ISBN 978-0-1234-56&#x20;789
15223 !! html
15224 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15225 </p>
15226 !! end
15227
15228 !! test
15229 ISBN followed by 5 spaces
15230 !! wikitext
15231 ISBN
15232 !! html
15233 <p>ISBN
15234 </p>
15235 !! end
15236
15237 !! test
15238 Double ISBN
15239 !! wikitext
15240 ISBN ISBN 1234567890
15241 !! html
15242 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15243 </p>
15244 !! end
15245
15246 !! test
15247 ISBN with an X
15248 !! wikitext
15249 ISBN 3-462-04561-X
15250 !! html
15251 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15252 </p>
15253 !! end
15254
15255 !! test
15256 ISBN with empty prefix (parsoid test)
15257 !! wikitext
15258 ISBN 1234567890
15259 !! html/parsoid
15260 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15261 !! end
15262
15263 !! test
15264 Bug 22905: <abbr> followed by ISBN followed by </a>
15265 !! wikitext
15266 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15267 !! html
15268 <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>
15269 </p>
15270 !! end
15271
15272 !! test
15273 Double RFC
15274 !! wikitext
15275 RFC RFC 1234
15276 !! html
15277 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15278 </p>
15279 !! end
15280
15281 !! test
15282 Double RFC with a wiki link
15283 !! wikitext
15284 RFC [[RFC 1234]]
15285 !! html
15286 <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>
15287 </p>
15288 !! end
15289
15290 !! test
15291 RFC code coverage
15292 !! wikitext
15293 RFC 983&#x20;987
15294 !! html
15295 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15296 </p>
15297 !! end
15298
15299 !! test
15300 Centre-aligned image
15301 !! wikitext
15302 [[Image:foobar.jpg|centre]]
15303 !! html
15304 <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>
15305
15306 !!end
15307
15308 !! test
15309 None-aligned image
15310 !! wikitext
15311 [[Image:foobar.jpg|none]]
15312 !! html
15313 <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>
15314
15315 !!end
15316
15317 !! test
15318 Width + Height sized image (using px) (height is ignored)
15319 !! wikitext
15320 [[Image:foobar.jpg|640x480px]]
15321 !! html
15322 <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>
15323 </p>
15324 !!end
15325
15326 !! test
15327 Width-sized image (using px, no following whitespace)
15328 !! wikitext
15329 [[Image:foobar.jpg|640px]]
15330 !! html
15331 <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>
15332 </p>
15333 !!end
15334
15335 !! test
15336 Width-sized image (using px, with following whitespace - test regression from r39467)
15337 !! wikitext
15338 [[Image:foobar.jpg|640px ]]
15339 !! html
15340 <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>
15341 </p>
15342 !!end
15343
15344 !! test
15345 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15346 !! wikitext
15347 [[Image:foobar.jpg| 640px]]
15348 !! html
15349 <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>
15350 </p>
15351 !!end
15352
15353 !! test
15354 Image with page parameter
15355 !! options
15356 djvu
15357 !! wikitext
15358 [[File:LoremIpsum.djvu|page=2]]
15359 !! html
15360 <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>
15361 </p>
15362 !! end
15363
15364 !! test
15365 Another italics / bold test
15366 !! wikitext
15367 ''' ''x'
15368 !! html
15369 <pre>'<i> </i>x'
15370 </pre>
15371 !!end
15372
15373 # Note the results may be incorrect, as parserTest output included this:
15374 # XML error: Mismatched tag at byte 6120:
15375 # ...<dd> </dt></dl> </dd...
15376 !! test
15377 dt/dd/dl test
15378 !! options
15379 disabled
15380 !! wikitext
15381 :;;;::
15382 !! html
15383 <dl>
15384 <dd><dl>
15385 <dt><dl>
15386 <dt><dl>
15387 <dt><dl>
15388 <dd><dl>
15389 <dd>
15390 </dd>
15391 </dl>
15392 </dd>
15393 </dl>
15394 </dt>
15395 </dl>
15396 </dt>
15397 </dl>
15398 </dt>
15399 </dl>
15400 </dd>
15401 </dl>
15402
15403 !!end
15404
15405
15406 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15407 !! test
15408 Images with the "|" character in the comment
15409 !! wikitext
15410 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15411 !! html/php
15412 <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>
15413
15414 !! html/parsoid
15415 <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>
15416 !! end
15417
15418 !! test
15419 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15420 !! wikitext
15421 <html><script>alert(1);</script></html>
15422 !! html
15423 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15424 </p>
15425 !! end
15426
15427 !! test
15428 HTML with raw HTML ($wgRawHtml==true)
15429 !! options
15430 wgRawHtml=1
15431 !! wikitext
15432 <html><script>alert(1);</script></html>
15433 !! html
15434 <p><script>alert(1);</script>
15435 </p>
15436 !! end
15437
15438 !! test
15439 Parents of subpages, one level up
15440 !! options
15441 subpage title=[[Subpage test/L1/L2/L3]]
15442 !! wikitext
15443 [[../|L2]]
15444 !! html
15445 <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>
15446 </p>
15447 !! end
15448
15449
15450 !! test
15451 Parents of subpages, one level up, not named
15452 !! options
15453 subpage title=[[Subpage test/L1/L2/L3]]
15454 !! wikitext
15455 [[../]]
15456 !! html
15457 <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>
15458 </p>
15459 !! end
15460
15461
15462
15463 !! test
15464 Parents of subpages, two levels up
15465 !! options
15466 subpage title=[[Subpage test/L1/L2/L3]]
15467 !! wikitext
15468 [[../../|L1]]2
15469
15470 [[../../|L1]]l
15471 !! html
15472 <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
15473 </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>
15474 </p>
15475 !! end
15476
15477 !! test
15478 Parents of subpages, two levels up, without trailing slash or name.
15479 !! options
15480 subpage title=[[Subpage test/L1/L2/L3]]
15481 !! wikitext
15482 [[../..]]
15483 !! html
15484 <p>[[../..]]
15485 </p>
15486 !! end
15487
15488 !! test
15489 Parents of subpages, two levels up, with lots of extra trailing slashes.
15490 !! options
15491 subpage title=[[Subpage test/L1/L2/L3]]
15492 !! wikitext
15493 [[../../////]]
15494 !! html
15495 <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>
15496 </p>
15497 !! end
15498
15499 !! article
15500 Subpage test/L1/L2/L3Sibling
15501 !! text
15502 Sibling article
15503 !! endarticle
15504
15505 !! test
15506 Transclusion of a sibling page (one level up)
15507 !! options
15508 subpage title=[[Subpage test/L1/L2/L3]]
15509 !! wikitext
15510 {{../L3Sibling}}
15511 !! html
15512 <p>Sibling article
15513 </p>
15514 !! end
15515
15516 !! test
15517 Transclusion of a child page
15518 !! options
15519 subpage title=[[Subpage test/L1/L2]]
15520 !! wikitext
15521 {{/L3Sibling}}
15522 !! html
15523 <p>Sibling article
15524 </p>
15525 !! end
15526
15527 !! test
15528 Non-transclusion because of too many up levels
15529 !! options
15530 subpage title=[[Subpage test/L1/L2/L3]]
15531 !! wikitext
15532 {{../../../../More than parent}}
15533 !! html
15534 <p>{{../../../../More than parent}}
15535 </p>
15536 !! end
15537
15538 !! test
15539 Definition list code coverage
15540 !! wikitext
15541 ; title : def
15542 ; title : def
15543 ;title: def
15544 !! html
15545 <dl><dt> title &#160;</dt>
15546 <dd> def</dd>
15547 <dt> title&#160;</dt>
15548 <dd> def</dd>
15549 <dt>title</dt>
15550 <dd> def</dd></dl>
15551
15552 !! end
15553
15554 !! test
15555 Don't fall for the self-closing div
15556 !! wikitext
15557 <div>hello world</div/>
15558 !! html
15559 <div>hello world</div>
15560
15561 !! end
15562
15563 !! test
15564 MSGNW magic word
15565 !! wikitext
15566 {{MSGNW:msg}}
15567 !! html
15568 <p>&#91;&#91;:Template:Msg&#93;&#93;
15569 </p>
15570 !! end
15571
15572 !! test
15573 RAW magic word
15574 !! wikitext
15575 {{RAW:QUERTY}}
15576 !! html
15577 <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>
15578 </p>
15579 !! end
15580
15581 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15582 !! test
15583 Always escape literal '>' in output, not just after '<'
15584 !! wikitext
15585 ><>
15586 !! html
15587 <p>&gt;&lt;&gt;
15588 </p>
15589 !! end
15590
15591 !! test
15592 Template caching
15593 !! wikitext
15594 {{Test}}
15595 {{Test}}
15596 !! html
15597 <p>This is a test template
15598 This is a test template
15599 </p>
15600 !! end
15601
15602
15603 !! article
15604 MediaWiki:Fake
15605 !! text
15606 ==header==
15607 !! endarticle
15608
15609 !! test
15610 Inclusion of !userCanEdit() content
15611 !! wikitext
15612 {{MediaWiki:Fake}}
15613 !! html
15614 <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>
15615
15616 !! end
15617
15618
15619 !! test
15620 Out-of-order TOC heading levels
15621 !! wikitext
15622 ==2==
15623 ======6======
15624 ===3===
15625 =1=
15626 =====5=====
15627 ==2==
15628 !! html
15629 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15630 <ul>
15631 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15632 <ul>
15633 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15634 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15635 </ul>
15636 </li>
15637 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15638 <ul>
15639 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15640 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15641 </ul>
15642 </li>
15643 </ul>
15644 </div>
15645
15646 <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>
15647 <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>
15648 <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>
15649 <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>
15650 <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>
15651 <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>
15652
15653 !! end
15654
15655
15656 !! test
15657 ISBN with a dummy number
15658 !! wikitext
15659 ISBN ---
15660 !! html
15661 <p>ISBN ---
15662 </p>
15663 !! end
15664
15665
15666 !! test
15667 ISBN with space-delimited number
15668 !! wikitext
15669 ISBN 92 9017 032 8
15670 !! html
15671 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15672 </p>
15673 !! end
15674
15675
15676 !! test
15677 ISBN with multiple spaces, no number
15678 !! wikitext
15679 ISBN foo
15680 !! html
15681 <p>ISBN foo
15682 </p>
15683 !! end
15684
15685
15686 !! test
15687 ISBN length
15688 !! wikitext
15689 ISBN 123456789
15690
15691 ISBN 1234567890
15692
15693 ISBN 12345678901
15694 !! html
15695 <p>ISBN 123456789
15696 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15697 </p><p>ISBN 12345678901
15698 </p>
15699 !! end
15700
15701
15702 !! test
15703 ISBN with trailing year (bug 8110)
15704 !! wikitext
15705 ISBN 1-234-56789-0 - 2006
15706
15707 ISBN 1 234 56789 0 - 2006
15708 !! html
15709 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15710 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15711 </p>
15712 !! end
15713
15714
15715 !! test
15716 anchorencode
15717 !! wikitext
15718 {{anchorencode:foo bar©#%n}}
15719 !! html
15720 <p>foo_bar.C2.A9.23.25n
15721 </p>
15722 !! end
15723
15724 !! test
15725 anchorencode trims spaces
15726 !! wikitext
15727 {{anchorencode: __pretty__please__}}
15728 !! html
15729 <p>pretty_please
15730 </p>
15731 !! end
15732
15733 !! test
15734 anchorencode deals with links
15735 !! wikitext
15736 {{anchorencode: [[hello|world]] [[hi]]}}
15737 !! html
15738 <p>world_hi
15739 </p>
15740 !! end
15741
15742 !! test
15743 anchorencode deals with templates
15744 !! wikitext
15745 {{anchorencode: {{Foo}} }}
15746 !! html
15747 <p>FOO
15748 </p>
15749 !! end
15750
15751 !! test
15752 anchorencode encodes like the TOC generator: (bug 18431)
15753 !! wikitext
15754 === _ +:.3A%3A&&amp;]] ===
15755 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15756 __NOEDITSECTION__
15757 !! html
15758 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15759 <p>.2B:.3A.253A.26.26.5D.5D
15760 </p>
15761 !! end
15762
15763 !! test
15764 Bug 6200: blockquotes and paragraph formatting
15765 !! wikitext
15766 <blockquote>
15767 foo
15768 </blockquote>
15769
15770 bar
15771
15772 baz
15773 !! html
15774 <blockquote>
15775 <p>foo
15776 </p>
15777 </blockquote>
15778 <p>bar
15779 </p>
15780 <pre>baz
15781 </pre>
15782 !! end
15783
15784 !! test
15785 Bug 8293: Use of center tag ruins paragraph formatting
15786 !! wikitext
15787 <center>
15788 foo
15789 </center>
15790
15791 bar
15792
15793 baz
15794 !! html
15795 <center>
15796 <p>foo
15797 </p>
15798 </center>
15799 <p>bar
15800 </p>
15801 <pre>baz
15802 </pre>
15803 !! end
15804
15805 !!test
15806 Parsing of overlapping (improperly nested) inline html tags
15807 !! wikitext
15808 <span><s>x</span></s>
15809 !! html/php
15810 <p><span><s>x&lt;/span&gt;</s></span>
15811 </p>
15812 !! html/parsoid
15813 <p><span><s>x</s></span>
15814 </p>
15815 !!end
15816
15817 ###
15818 ### Language variants related tests
15819 ###
15820 !! test
15821 Self-link in language variants
15822 !! options
15823 title=[[Dunav]] language=sr
15824 !! wikitext
15825 Both [[Dunav]] and [[Дунав]] are names for this river.
15826 !! html
15827 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15828 </p>
15829 !!end
15830
15831 !! article
15832 Дуна
15833 !! text
15834 content
15835 !! endarticle
15836
15837 !! test
15838 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15839 !! options
15840 title=[[Duna]] language=sr
15841 !! wikitext
15842 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15843 !! html
15844 <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.
15845 </p>
15846 !! end
15847
15848 !! test
15849 Link to a section of a variant of this title shouldn't be parsed as self-link
15850 !! options
15851 title=[[Duna]] language=sr
15852 !! wikitext
15853 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15854 !! html
15855 <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.
15856 </p>
15857 !! end
15858
15859 !! test
15860 Link to pages in language variants
15861 !! options
15862 language=sr
15863 !! wikitext
15864 Main Page can be written as [[Маин Паге]]
15865 !! html
15866 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15867 </p>
15868 !!end
15869
15870
15871 !! test
15872 Multiple links to pages in language variants
15873 !! options
15874 language=sr
15875 !! wikitext
15876 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15877 !! html
15878 <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>.
15879 </p>
15880 !!end
15881
15882
15883 !! test
15884 Simple template in language variants
15885 !! options
15886 language=sr
15887 !! wikitext
15888 {{тест}}
15889 !! html
15890 <p>This is a test template
15891 </p>
15892 !! end
15893
15894
15895 !! test
15896 Template with explicit namespace in language variants
15897 !! options
15898 language=sr
15899 !! wikitext
15900 {{Template:тест}}
15901 !! html
15902 <p>This is a test template
15903 </p>
15904 !! end
15905
15906
15907 !! test
15908 Basic test for template parameter in language variants
15909 !! options
15910 language=sr
15911 !! wikitext
15912 {{парамтест|param=foo}}
15913 !! html
15914 <p>This is a test template with parameter foo
15915 </p>
15916 !! end
15917
15918
15919 !! test
15920 Simple category in language variants
15921 !! options
15922 language=sr cat
15923 !! wikitext
15924 [[Category:МедиаWики Усер'с Гуиде]]
15925 !! html
15926 <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>
15927 !! end
15928
15929
15930 !! article
15931 Category:分类
15932 !! text
15933 blah
15934 !! endarticle
15935
15936 !! article
15937 Category:分類
15938 !! text
15939 blah
15940 !! endarticle
15941
15942 !! test
15943 Don't convert blue categorylinks to another variant (bug 33210)
15944 !! options
15945 language=zh cat
15946 !! wikitext
15947 [[A]][[Category:分类]]
15948 !! html
15949 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15950 !! end
15951
15952
15953 !! test
15954 Stripping -{}- tags (language variants)
15955 !! options
15956 language=sr
15957 !! wikitext
15958 Latin proverb: -{Ne nuntium necare}-
15959 !! html
15960 <p>Latin proverb: Ne nuntium necare
15961 </p>
15962 !! end
15963
15964
15965 !! test
15966 Prevent conversion with -{}- tags (language variants)
15967 !! options
15968 language=sr variant=sr-ec
15969 !! wikitext
15970 Latinski: -{Ne nuntium necare}-
15971 !! html
15972 <p>Латински: Ne nuntium necare
15973 </p>
15974 !! end
15975
15976
15977 !! test
15978 Prevent conversion of text with -{}- tags (language variants)
15979 !! options
15980 language=sr variant=sr-ec
15981 !! wikitext
15982 Latinski: -{Ne nuntium necare}-
15983 !! html
15984 <p>Латински: Ne nuntium necare
15985 </p>
15986 !! end
15987
15988
15989 !! test
15990 Prevent conversion of links with -{}- tags (language variants)
15991 !! options
15992 language=sr variant=sr-ec
15993 !! wikitext
15994 -{[[Main Page]]}-
15995 !! html
15996 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15997 </p>
15998 !! end
15999
16000
16001 !! test
16002 -{}- tags within headlines (within html for parserConvert())
16003 !! options
16004 language=sr variant=sr-ec
16005 !! wikitext
16006 == -{Naslov}- ==
16007 !! html
16008 <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>
16009
16010 !! end
16011
16012
16013 !! test
16014 Explicit definition of language variant alternatives
16015 !! options
16016 language=zh variant=zh-tw
16017 !! wikitext
16018 -{zh:China;zh-tw:Taiwan}-, not China
16019 !! html
16020 <p>Taiwan, not China
16021 </p>
16022 !! end
16023
16024
16025 !! test
16026 Conversion around HTML tags
16027 !! options
16028 language=sr variant=sr-ec
16029 !! wikitext
16030 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16031 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16032 !! html
16033 <p>
16034 <span title="ЛаCтин">ски</span>
16035 </p>
16036 !! end
16037
16038
16039 !! test
16040 Explicit session-wise language variant mapping (A flag and - flag)
16041 !! options
16042 language=zh variant=zh-tw
16043 !! wikitext
16044 Taiwan is not China.
16045 But -{A|zh:China;zh-tw:Taiwan}- is China,
16046 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16047 and -{China}- is China.
16048 !! html
16049 <p>Taiwan is not China.
16050 But Taiwan is Taiwan,
16051 (This should be stripped!)
16052 and China is China.
16053 </p>
16054 !! end
16055
16056 !! test
16057 Explicit session-wise language variant mapping (H flag for hide)
16058 !! options
16059 language=zh variant=zh-tw
16060 !! wikitext
16061 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16062 Taiwan is China.
16063 !! html
16064 <p>(This should be stripped!)
16065 Taiwan is Taiwan.
16066 </p>
16067 !! end
16068
16069 !! test
16070 Adding explicit conversion rule for title (T flag)
16071 !! options
16072 language=zh variant=zh-tw showtitle
16073 !! wikitext
16074 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16075 !! html
16076 Taiwan
16077 <p>Should be stripped!
16078 </p>
16079 !! end
16080
16081 !! test
16082 Testing that changing the language variant here in the tests actually works
16083 !! options
16084 language=zh variant=zh showtitle
16085 !! wikitext
16086 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16087 !! html
16088 China
16089 <p>Should be stripped!
16090 </p>
16091 !! end
16092
16093 !! test
16094 Recursive conversion of alt and title attrs shouldn't clear converter state
16095 !! options
16096 language=zh variant=zh-cn showtitle
16097 !! wikitext
16098 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16099 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16100 !! html
16101 China
16102 <p>
16103 Should be stripped<span title="Exclamation">!</span>
16104 </p>
16105 !! end
16106
16107 !! test
16108 Bug 24072: more test on conversion rule for title
16109 !! options
16110 language=zh variant=zh-tw showtitle
16111 !! wikitext
16112 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16113 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16114 !! html
16115 Taiwan
16116 <p>This should be stripped!
16117 This won't take interferes with the title rule.
16118 </p>
16119 !! end
16120
16121 !! test
16122 Partly disable title conversion if variant == main language code
16123 !! options
16124 language=zh variant=zh title=[[ZH]] showtitle
16125 !! wikitext
16126 -{T|zh-cn:CN;zh-tw:TW}-
16127 !! html
16128 ZH
16129 <p>
16130 </p>
16131 !! end
16132
16133 !! test
16134 Partly disable title conversion if variant == main language code, more
16135 !! options
16136 language=zh variant=zh title=[[ZH]] showtitle
16137 !! wikitext
16138 -{T|TW}-
16139 !! html
16140 ZH
16141 <p>
16142 </p>
16143 !! end
16144
16145 !! test
16146 Raw output of variant escape tags (R flag)
16147 !! options
16148 language=zh variant=zh-tw
16149 !! wikitext
16150 Raw: -{R|zh:China;zh-tw:Taiwan}-
16151 !! html
16152 <p>Raw: zh:China;zh-tw:Taiwan
16153 </p>
16154 !! end
16155
16156 !! test
16157 Nested using of manual convert syntax
16158 !! options
16159 language=zh variant=zh-hk
16160 !! wikitext
16161 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16162 !! html
16163 <p>Nested: Hello Hong Kong!
16164 </p>
16165 !! end
16166
16167 !! test
16168 Proper conversion of text in external links
16169 !! options
16170 language=sr variant=sr-ec
16171 !! wikitext
16172 http://www.google.com
16173 gopher://www.google.com
16174 [http://www.google.com http://www.google.com]
16175 [gopher://www.google.com gopher://www.google.com]
16176 [https://www.google.com irc://www.google.com]
16177 [ftp://www.google.com www.google.com/ftp://dir]
16178 [//www.google.com www.google.com]
16179 !! html
16180 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16181 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16182 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16183 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16184 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16185 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16186 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16187 </p>
16188 !! end
16189
16190 !! test
16191 Do not convert roman numbers to language variants
16192 !! options
16193 language=sr variant=sr-ec
16194 !! wikitext
16195 Fridrih IV je car.
16196 !! html
16197 <p>Фридрих IV је цар.
16198 </p>
16199 !! end
16200
16201 !! test
16202 Unclosed language converter markup "-{"
16203 !! options
16204 language=sr
16205 !! wikitext
16206 -{T|hello
16207 !! html
16208 <p>-{T|hello
16209 </p>
16210 !! end
16211
16212 !! test
16213 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16214 !! options
16215 language=sr
16216 !! wikitext
16217 -{R|=&gt;}-
16218 !! html
16219 <p>=&gt;
16220 </p>
16221 !!end
16222
16223 !! test
16224 Don't break link parsing if language converter markup is in the caption.
16225 !! options
16226 language=sr variant=sr-ec
16227 !! wikitext
16228 [[Main Page|-{R|main page}-]]
16229 !! html
16230 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16231 </p>
16232 !! end
16233
16234 # This test is currently broken in the PHP parser (bug 52661)
16235 !! test
16236 Don't break image parsing if language converter markup is in the caption.
16237 !! options
16238 language=sr
16239 disabled
16240 !! wikitext
16241 [[File:Foobar.jpg|-{R|caption}-]]
16242 !! html
16243 <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>
16244 </p>
16245 !! end
16246
16247 # This test is currently broken in the PHP parser (bug 52661)
16248 !! test
16249 Don't break list handling if language converter markup is in the item.
16250 !! options
16251 language=zh variant=zh-cn
16252 disabled
16253 !! wikitext
16254 ;-{zh-cn:AAA;zh-tw:BBB}-
16255 !! html
16256 <dl><dt>AAA
16257 </dt></dl>
16258
16259 !! end
16260
16261 # This test is currently broken in the PHP parser (bug 52661)
16262 !! test
16263 Don't break table handling if language converter markup is in the cell.
16264 !! options
16265 language=sr variant=sr-ec
16266 disabled
16267 !! wikitext
16268 {|
16269 |-
16270 | -{R|B}-
16271 |}
16272 !! html
16273 <table>
16274
16275 <tr>
16276 <td> B
16277 </td></tr></table>
16278
16279 !! end
16280
16281 !! test
16282 Bug 529: Uncovered bullet
16283 !! wikitext
16284 * Foo {{bullet}}
16285 !! html
16286 <ul><li> Foo </li>
16287 <li> Bar</li></ul>
16288
16289 !! end
16290
16291 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16292 # Templates in Wikipedia rely on this behavior, as tidy has always been
16293 # enabled there. These tests are normally run *without* tidy, so specify the
16294 # full output here.
16295 # To test realistic parsing behavior, apply a tidy-like transformation to both
16296 # the expected output and your parser's output.
16297 !! test
16298 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16299 !! wikitext
16300 ******* Foo {{bullet}}
16301 !! html
16302 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo </li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li>
16303 <li> Bar</li></ul>
16304
16305 !! end
16306
16307 !! test
16308 Bug 529: Uncovered table already at line-start
16309 !! wikitext
16310 x
16311
16312 {{table}}
16313 y
16314 !! html
16315 <p>x
16316 </p>
16317 <table>
16318 <tr>
16319 <td> 1 </td>
16320 <td> 2
16321 </td></tr>
16322 <tr>
16323 <td> 3 </td>
16324 <td> 4
16325 </td></tr></table>
16326 <p>y
16327 </p>
16328 !! end
16329
16330 !! test
16331 Bug 529: Uncovered bullet in parser function result
16332 !! wikitext
16333 * Foo {{lc:{{bullet}} }}
16334 !! html
16335 <ul><li> Foo </li>
16336 <li> bar</li></ul>
16337
16338 !! end
16339
16340 !! test
16341 Bug 5678: Double-parsed template argument
16342 !! wikitext
16343 {{lc:{{{1}}}|hello}}
16344 !! html
16345 <p>{{{1}}}
16346 </p>
16347 !! end
16348
16349 !! test
16350 Bug 5678: Double-parsed template invocation
16351 !! wikitext
16352 {{lc:{{paramtest {{!}} param = hello }} }}
16353 !! html
16354 <p>{{paramtest | param = hello }}
16355 </p>
16356 !! end
16357
16358 !! test
16359 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16360 !! options
16361 language=cs
16362 title=[[Main Page]]
16363 !! wikitext
16364 {{PRVNÍVELKÉ:ěščř}}
16365 {{prvnívelké:ěščř}}
16366 {{PRVNÍMALÉ:ěščř}}
16367 {{prvnímalé:ěščř}}
16368 {{MALÁ:ěščř}}
16369 {{malá:ěščř}}
16370 {{VELKÁ:ěščř}}
16371 {{velká:ěščř}}
16372 !! html
16373 <p>Ěščř
16374 Ěščř
16375 ěščř
16376 ěščř
16377 ěščř
16378 ěščř
16379 ĚŠČŘ
16380 ĚŠČŘ
16381 </p>
16382 !! end
16383
16384 !! test
16385 Morwen/13: Unclosed link followed by heading
16386 !! wikitext
16387 [[link
16388 ==heading==
16389 !! html
16390 <p>[[link
16391 </p>
16392 <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>
16393
16394 !! end
16395
16396 !! test
16397 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16398 !! wikitext
16399 {{foo|
16400 =heading=
16401 !! html
16402 <p>{{foo|
16403 </p>
16404 <h1><span class="mw-headline" id="heading">heading</span></h1>
16405
16406 !! end
16407
16408 !! test
16409 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16410 !! wikitext
16411 {{foo|
16412 ==heading==
16413 !! html
16414 <p>{{foo|
16415 </p>
16416 <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>
16417
16418 !! end
16419
16420 !! test
16421 Tildes in comments
16422 !! options
16423 pst
16424 !! wikitext
16425 <!-- ~~~~ -->
16426 !! html
16427 <!-- ~~~~ -->
16428 !! end
16429
16430 !! test
16431 Paragraphs inside divs (no extra line breaks)
16432 !! wikitext
16433 <div>Line one
16434
16435 Line two</div>
16436 !! html
16437 <div>Line one
16438 Line two</div>
16439
16440 !! end
16441
16442 !! test
16443 Paragraphs inside divs (extra line break on open)
16444 !! wikitext
16445 <div>
16446 Line one
16447
16448 Line two</div>
16449 !! html
16450 <div>
16451 <p>Line one
16452 </p>
16453 Line two</div>
16454
16455 !! end
16456
16457 !! test
16458 Paragraphs inside divs (extra line break on close)
16459 !! wikitext
16460 <div>Line one
16461
16462 Line two
16463 </div>
16464 !! html
16465 <div>Line one
16466 <p>Line two
16467 </p>
16468 </div>
16469
16470 !! end
16471
16472 !! test
16473 Paragraphs inside divs (extra line break on open and close)
16474 !! wikitext
16475 <div>
16476 Line one
16477
16478 Line two
16479 </div>
16480 !! html
16481 <div>
16482 <p>Line one
16483 </p><p>Line two
16484 </p>
16485 </div>
16486
16487 !! end
16488
16489 !! test
16490 Nesting tags, paragraphs on lines which begin with <div>
16491 !! options
16492 disabled
16493 !! wikitext
16494 <div></div><strong>A
16495 B</strong>
16496 !! html
16497 <div></div>
16498 <p><strong>A
16499 B</strong>
16500 </p>
16501 !! end
16502
16503 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16504 !! test
16505 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16506 !! wikitext
16507 <blockquote>Line one
16508
16509 Line two</blockquote>
16510 !! html
16511 <blockquote>Line one
16512 Line two</blockquote>
16513
16514 !! end
16515
16516 !! test
16517 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16518 !! wikitext
16519 <blockquote>
16520 Line one
16521
16522 Line two</blockquote>
16523 !! html
16524 <blockquote>
16525 <p>Line one
16526 </p>
16527 Line two</blockquote>
16528
16529 !! end
16530
16531 !! test
16532 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16533 !! wikitext
16534 <blockquote>Line one
16535
16536 Line two
16537 </blockquote>
16538 !! html
16539 <blockquote>Line one
16540 <p>Line two
16541 </p>
16542 </blockquote>
16543
16544 !! end
16545
16546 !! test
16547 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16548 !! wikitext
16549 <blockquote>
16550 Line one
16551
16552 Line two
16553 </blockquote>
16554 !! html
16555 <blockquote>
16556 <p>Line one
16557 </p><p>Line two
16558 </p>
16559 </blockquote>
16560
16561 !! end
16562
16563 !! test
16564 Paragraphs inside blockquotes/divs (no extra line breaks)
16565 !! wikitext
16566 <blockquote><div>Line one
16567
16568 Line two</div></blockquote>
16569 !! html
16570 <blockquote><div>Line one
16571 Line two</div></blockquote>
16572
16573 !! end
16574
16575 !! test
16576 Paragraphs inside blockquotes/divs (extra line break on open)
16577 !! wikitext
16578 <blockquote><div>
16579 Line one
16580
16581 Line two</div></blockquote>
16582 !! html
16583 <blockquote><div>
16584 <p>Line one
16585 </p>
16586 Line two</div></blockquote>
16587
16588 !! end
16589
16590 !! test
16591 Paragraphs inside blockquotes/divs (extra line break on close)
16592 !! wikitext
16593 <blockquote><div>Line one
16594
16595 Line two
16596 </div></blockquote>
16597 !! html
16598 <blockquote><div>Line one
16599 <p>Line two
16600 </p>
16601 </div></blockquote>
16602
16603 !! end
16604
16605 !! test
16606 Paragraphs inside blockquotes/divs (extra line break on open and close)
16607 !! wikitext
16608 <blockquote><div>
16609 Line one
16610
16611 Line two
16612 </div></blockquote>
16613 !! html
16614 <blockquote><div>
16615 <p>Line one
16616 </p><p>Line two
16617 </p>
16618 </div></blockquote>
16619
16620 !! end
16621
16622 !! test
16623 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16624 !! options
16625 wgLinkHolderBatchSize=0
16626 !! wikitext
16627 [[meatball:1]]
16628 [[meatball:2]]
16629 [[meatball:3]]
16630 !! html
16631 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16632 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16633 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16634 </p>
16635 !! end
16636
16637 !! test
16638 Free external link invading image caption
16639 !! wikitext
16640 [[Image:Foobar.jpg|thumb|http://x|hello]]
16641 !! html
16642 <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>
16643
16644 !! end
16645
16646 !! test
16647 Bug 15196: localised external link numbers
16648 !! options
16649 language=fa
16650 !! wikitext
16651 [http://en.wikipedia.org/]
16652 !! html/php
16653 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16654 </p>
16655 !! html/parsoid
16656 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16657 !! end
16658
16659 !! test
16660 Multibyte character in padleft
16661 !! wikitext
16662 {{padleft:-Hello|7|Æ}}
16663 !! html
16664 <p>Æ-Hello
16665 </p>
16666 !! end
16667
16668 !! test
16669 Multibyte character in padright
16670 !! wikitext
16671 {{padright:Hello-|7|Æ}}
16672 !! html
16673 <p>Hello-Æ
16674 </p>
16675 !! end
16676
16677 !!test
16678 formatdate parser function
16679 !! wikitext
16680 {{#formatdate:2009-03-24}}
16681 !! html
16682 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16683 </p>
16684 !! end
16685
16686 !!test
16687 formatdate parser function, with default format
16688 !! wikitext
16689 {{#formatdate:2009-03-24|mdy}}
16690 !! html
16691 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16692 </p>
16693 !! end
16694
16695 !! test
16696 Spacing of numbers in formatted dates
16697 !! wikitext
16698 {{#formatdate:January 15}}
16699 !! html
16700 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16701 </p>
16702 !! end
16703
16704 !! test
16705 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
16706 !! options
16707 language=nl title=[[MediaWiki:Common.css]]
16708 !! wikitext
16709 {{#formatdate:2009-03-24|dmy}}
16710 !! html
16711 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16712 </p>
16713 !! end
16714
16715 #
16716 #
16717 #
16718
16719 #
16720 # Edit comments
16721 #
16722
16723 !! test
16724 Edit comment with link
16725 !! options
16726 comment
16727 !! wikitext
16728 I like the [[Main Page]] a lot
16729 !! html
16730 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16731 !!end
16732
16733 !! test
16734 Edit comment with link and link text
16735 !! options
16736 comment
16737 !! wikitext
16738 I like the [[Main Page|best pages]] a lot
16739 !! html
16740 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16741 !!end
16742
16743 !! test
16744 Edit comment with link and link text with suffix
16745 !! options
16746 comment
16747 !! wikitext
16748 I like the [[Main Page|best page]]s a lot
16749 !! html
16750 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16751 !!end
16752
16753 !! test
16754 Edit comment with section link (non-local, eg in history list)
16755 !! options
16756 comment title=[[Main Page]]
16757 !! wikitext
16758 /* External links */ removed bogus entries
16759 !! html
16760 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16761 !!end
16762
16763 !! test
16764 Edit comment with section link and text before it (non-local, eg in history list)
16765 !! options
16766 comment title=[[Main Page]]
16767 !! wikitext
16768 pre-comment text /* External links */ removed bogus entries
16769 !! html
16770 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>
16771 !!end
16772
16773 !! test
16774 Edit comment with section link (local, eg in diff view)
16775 !! options
16776 comment local title=[[Main Page]]
16777 !! wikitext
16778 /* External links */ removed bogus entries
16779 !! html
16780 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16781 !!end
16782
16783 !! test
16784 Edit comment with subpage link (bug 14080)
16785 !! options
16786 comment
16787 subpage
16788 title=[[Subpage test]]
16789 !! wikitext
16790 Poked at a [[/subpage]] here...
16791 !! html
16792 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16793 !!end
16794
16795 !! test
16796 Edit comment with subpage link and link text (bug 14080)
16797 !! options
16798 comment
16799 subpage
16800 title=[[Subpage test]]
16801 !! wikitext
16802 Poked at a [[/subpage|neat little page]] here...
16803 !! html
16804 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16805 !!end
16806
16807 !! test
16808 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16809 !! options
16810 comment
16811 title=[[Subpage test]]
16812 !! wikitext
16813 Poked at a [[/subpage]] here...
16814 !! html
16815 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...
16816 !!end
16817
16818 !! test
16819 Edit comment with bare anchor link (local, as on diff)
16820 !! options
16821 comment
16822 local
16823 title=[[Main Page]]
16824 !! wikitext
16825 [[#section]]
16826 !! html
16827 <a href="#section">#section</a>
16828 !! end
16829
16830 !! test
16831 Edit comment with bare anchor link (non-local, as on history)
16832 !! options
16833 comment
16834 title=[[Main Page]]
16835 !! wikitext
16836 [[#section]]
16837 !! html
16838 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16839 !! end
16840
16841 !! test
16842 Anchor starting with underscore
16843 !! wikitext
16844 [[#_ref|One]]
16845 !! html
16846 <p><a href="#_ref">One</a>
16847 </p>
16848 !! end
16849
16850 !! test
16851 Id starting with underscore
16852 !! wikitext
16853 <div id="_ref"></div>
16854 !! html
16855 <div id="_ref"></div>
16856
16857 !! end
16858
16859 !! test
16860 Space normalisation on autocomment (bug 22784)
16861 !! options
16862 comment
16863 title=[[Main Page]]
16864 !! wikitext
16865 /* __hello__world__ */
16866 !! html
16867 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16868 !! end
16869
16870 !! test
16871 percent-encoding and + signs in comments (Bug 26410)
16872 !! options
16873 comment
16874 !! wikitext
16875 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16876 !! html
16877 <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>
16878 !! end
16879
16880 !! test
16881 Bad images - basic functionality
16882 !! options
16883 disabled
16884 !! wikitext
16885 [[File:Bad.jpg]]
16886 !! html
16887 !! end
16888
16889 !! test
16890 Bad images - bug 16039: text after bad image disappears
16891 !! options
16892 disabled
16893 !! wikitext
16894 Foo bar
16895 [[File:Bad.jpg]]
16896 Bar foo
16897 !! html
16898 <p>Foo bar
16899 </p><p>Bar foo
16900 </p>
16901 !! end
16902
16903 !! test
16904 Verify that displaytitle works (bug #22501) no displaytitle
16905 !! options
16906 showtitle
16907 !! config
16908 wgAllowDisplayTitle=true
16909 wgRestrictDisplayTitle=false
16910 !! wikitext
16911 this is not the the title
16912 !! html
16913 Parser test
16914 <p>this is not the the title
16915 </p>
16916 !! end
16917
16918 !! test
16919 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16920 !! options
16921 showtitle
16922 title=[[Screen]]
16923 !! config
16924 wgAllowDisplayTitle=true
16925 wgRestrictDisplayTitle=false
16926 !! wikitext
16927 this is not the the title
16928 {{DISPLAYTITLE:whatever}}
16929 !! html
16930 whatever
16931 <p>this is not the the title
16932 </p>
16933 !! end
16934
16935 !! test
16936 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16937 !! options
16938 showtitle
16939 title=[[Screen]]
16940 !! config
16941 wgAllowDisplayTitle=true
16942 wgRestrictDisplayTitle=true
16943 !! wikitext
16944 this is not the the title
16945 {{DISPLAYTITLE:whatever}}
16946 !! html
16947 Screen
16948 <p>this is not the the title
16949 </p>
16950 !! end
16951
16952 !! test
16953 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16954 !! options
16955 showtitle
16956 title=[[Screen]]
16957 !! config
16958 wgAllowDisplayTitle=true
16959 wgRestrictDisplayTitle=true
16960 !! wikitext
16961 this is not the the title
16962 {{DISPLAYTITLE:screen}}
16963 !! html
16964 screen
16965 <p>this is not the the title
16966 </p>
16967 !! end
16968
16969 !! test
16970 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16971 !! options
16972 showtitle
16973 title=[[Screen]]
16974 !! config
16975 wgAllowDisplayTitle=false
16976 !! wikitext
16977 this is not the the title
16978 {{DISPLAYTITLE:screen}}
16979 !! html
16980 Screen
16981 <p>this is not the the title
16982 <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>
16983 </p>
16984 !! end
16985
16986 !! test
16987 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16988 !! options
16989 showtitle
16990 title=[[Screen]]
16991 !! config
16992 wgAllowDisplayTitle=false
16993 !! wikitext
16994 this is not the the title
16995 !! html
16996 Screen
16997 <p>this is not the the title
16998 </p>
16999 !! end
17000
17001 !! test
17002 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17003 !! options
17004 showtitle
17005 title=[[Screen]]
17006 !! config
17007 wgAllowDisplayTitle=true
17008 wgRestrictDisplayTitle=true
17009 !! wikitext
17010 this is not the the title
17011 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17012 !! html
17013 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17014 <p>this is not the the title
17015 </p>
17016 !! end
17017
17018 !! test
17019 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17020 !! options
17021 showtitle
17022 title=[[Screen]]
17023 !! config
17024 wgAllowDisplayTitle=true
17025 wgRestrictDisplayTitle=true
17026 !! wikitext
17027 this is not the the title
17028 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17029 !! html
17030 <span style="color: red;">s</span>creen
17031 <p>this is not the the title
17032 </p>
17033 !! end
17034
17035 !! test
17036 preload: check <noinclude> and <includeonly>
17037 !! options
17038 preload
17039 !! wikitext
17040 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17041 !! html
17042 Hello kind world.
17043 !! end
17044
17045 !! test
17046 preload: check <onlyinclude>
17047 !! options
17048 preload
17049 !! wikitext
17050 Goodbye <onlyinclude>Hello world</onlyinclude>
17051 !! html
17052 Hello world
17053 !! end
17054
17055 !! test
17056 preload: can pass tags through if we want to
17057 !! options
17058 preload
17059 !! wikitext
17060 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17061 !! html
17062 <includeonly>Hello world</includeonly>
17063 !! end
17064
17065 !! test
17066 preload: check that it doesn't try to do tricks
17067 !! options
17068 preload
17069 !! wikitext
17070 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17071 !! html
17072 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17073 !! end
17074
17075 !! test
17076 Play a bit with r67090 and bug 3158
17077 !! options
17078 disabled
17079 !! wikitext
17080 <div style="width:50% !important">&nbsp;</div>
17081 <div style="width:50%&nbsp;!important">&nbsp;</div>
17082 <div style="width:50%&#160;!important">&nbsp;</div>
17083 <div style="border : solid;">&nbsp;</div>
17084 !! html
17085 <div style="width:50% !important">&nbsp;</div>
17086 <div style="width:50% !important">&nbsp;</div>
17087 <div style="width:50% !important">&nbsp;</div>
17088 <div style="border&#160;: solid;">&nbsp;</div>
17089
17090 !! end
17091
17092 !! test
17093 HTML5 data attributes
17094 !! wikitext
17095 <span data-foo="bar">Baz</span>
17096 <p data-abc-def_hij="">Quuz</p>
17097 !! html
17098 <p><span data-foo="bar">Baz</span>
17099 </p>
17100 <p data-abc-def_hij="">Quuz</p>
17101
17102 !! end
17103
17104 !! test
17105 percent-encoding and + signs in internal links (Bug 26410)
17106 !! wikitext
17107 [[User:+%]] [[Page+title%]]
17108 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17109 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17110 [[%33%45]] [[%33%45+]]
17111 !! html
17112 <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>
17113 <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>
17114 <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>
17115 <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>
17116 </p>
17117 !! end
17118
17119 !! test
17120 Special characters in embedded file links (bug 27679)
17121 !! wikitext
17122 [[File:Contains & ampersand.jpg]]
17123 [[File:Does not exist.jpg|Title with & ampersand]]
17124 !! html
17125 <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>
17126 <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>
17127 </p>
17128 !! end
17129
17130
17131 !! test
17132 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17133 !! wikitext
17134 Text&apos;s been normalized?
17135 !! html
17136 <p>Text&#39;s been normalized?
17137 </p>
17138 !! end
17139
17140 !! test
17141 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17142 !! wikitext
17143 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17144 !! html
17145 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17146 </p>
17147 !! end
17148
17149 !! test
17150 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17151 !! wikitext
17152 [http://www.example.org/ ideograms]
17153 !! html
17154 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17155 </p>
17156 !! end
17157
17158 !! test
17159 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17160 !! wikitext
17161 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17162 !! html
17163 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17164 </p>
17165 !! end
17166
17167 !! article
17168 Mediawiki:loop1
17169 !! text
17170 {{Identical|A}}
17171 !! endarticle
17172
17173 !! article
17174 Mediawiki:loop2
17175 !! text
17176 {{Identical|B}}
17177 !! endarticle
17178
17179 !! article
17180 Template:Identical
17181 !! text
17182 {{int:loop1}}
17183 {{int:loop2}}
17184 !! endarticle
17185
17186 !! test
17187 Bug 31098 Template which includes system messages which includes the template
17188 !! wikitext
17189 {{Identical}}
17190 !! html
17191 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17192 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17193 </p>
17194 !! end
17195
17196 !! test
17197 Bug31490 Turkish: ucfirst 'blah'
17198 !! options
17199 language=tr
17200 !! wikitext
17201 {{ucfirst:blah}}
17202 !! html
17203 <p>Blah
17204 </p>
17205 !! end
17206
17207 !! test
17208 Bug31490 Turkish: ucfirst 'ix'
17209 !! options
17210 language=tr
17211 !! wikitext
17212 {{ucfirst:ix}}
17213 !! html
17214 <p>İx
17215 </p>
17216 !! end
17217
17218 !! test
17219 Bug31490 Turkish: lcfirst 'BLAH'
17220 !! options
17221 language=tr
17222 !! wikitext
17223 {{lcfirst:BLAH}}
17224 !! html
17225 <p>bLAH
17226 </p>
17227 !! end
17228
17229 !! test
17230 Bug31490 Turkish: ucfırst (with a dotless i)
17231 !! options
17232 language=tr
17233 !! wikitext
17234 {{ucfırst:blah}}
17235 !! html
17236 <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>
17237 </p>
17238 !! end
17239
17240 !! test
17241 Bug31490 ucfırst (with a dotless i) with English language
17242 !! options
17243 language=en
17244 !! wikitext
17245 {{ucfırst:blah}}
17246 !! html
17247 <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>
17248 </p>
17249 !! end
17250
17251 !! test
17252 Bug 26375: TOC with italics
17253 !! options
17254 title=[[Main Page]]
17255 !! wikitext
17256 __TOC__
17257 == ''Lost'' episodes ==
17258 !! html
17259 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17260 <ul>
17261 <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>
17262 </ul>
17263 </div>
17264
17265 <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>
17266
17267 !! end
17268
17269 !! test
17270 Bug 26375: TOC with bold
17271 !! options
17272 title=[[Main Page]]
17273 !! wikitext
17274 __TOC__
17275 == '''should be bold''' then normal text ==
17276 !! html
17277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17278 <ul>
17279 <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>
17280 </ul>
17281 </div>
17282
17283 <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>
17284
17285 !! end
17286
17287 !! test
17288 Bug 33845: Headings become cursive in TOC when they contain an image
17289 !! options
17290 title=[[Main Page]]
17291 !! wikitext
17292 __TOC__
17293 == Image [[Image:foobar.jpg]] ==
17294 !! html
17295 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17296 <ul>
17297 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17298 </ul>
17299 </div>
17300
17301 <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>
17302
17303 !! end
17304
17305 !! test
17306 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17307 !! options
17308 title=[[Main Page]]
17309 !! wikitext
17310 __TOC__
17311 == <blockquote>Quote</blockquote> ==
17312 !! html
17313 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17314 <ul>
17315 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17316 </ul>
17317 </div>
17318
17319 <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>
17320
17321 !! end
17322
17323 !! test
17324 Unclosed tags in TOC
17325 !! options
17326 title=[[Main Page]]
17327 !! wikitext
17328 __TOC__
17329 == Proof: 2 < 3 ==
17330 <small>Hanc marginis exiguitas non caperet.</small>
17331 QED
17332 !! html
17333 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17334 <ul>
17335 <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>
17336 </ul>
17337 </div>
17338
17339 <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>
17340 <p><small>Hanc marginis exiguitas non caperet.</small>
17341 QED
17342 </p>
17343 !! end
17344
17345 !! test
17346 Multiple tags in TOC
17347 !! wikitext
17348 __TOC__
17349 == <i>Foo</i> <b>Bar</b> ==
17350
17351 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17352 !! html
17353 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17354 <ul>
17355 <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>
17356 <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>
17357 </ul>
17358 </div>
17359
17360 <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>
17361 <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>
17362
17363 !! end
17364
17365 !! test
17366 Tags with parameters in TOC
17367 !! wikitext
17368 __TOC__
17369 == <sup class="in-h2">Hello</sup> ==
17370
17371 == <sup class="a > b">Evilbye</sup> ==
17372 !! html
17373 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17374 <ul>
17375 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17376 <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>
17377 </ul>
17378 </div>
17379
17380 <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>
17381 <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>
17382
17383 !! end
17384
17385 !! test
17386 span tags with directionality in TOC
17387 !! wikitext
17388 __TOC__
17389 == <span dir="ltr">C++</span> ==
17390
17391 == <span dir="rtl">זבנג!</span> ==
17392
17393 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17394
17395 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17396
17397 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17398 !! html
17399 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17400 <ul>
17401 <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>
17402 <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>
17403 <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>
17404 <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>
17405 <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>
17406 </ul>
17407 </div>
17408
17409 <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>
17410 <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>
17411 <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>
17412 <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>
17413 <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>
17414
17415 !! end
17416
17417 !! article
17418 MediaWiki:Bug32057
17419 !! text
17420 == {{int:headline_sample}} ==
17421 !! endarticle
17422
17423 !! test
17424 Bug 32057: Title needed when expanding <h> nodes.
17425 !! options
17426 title=[[Main Page]]
17427 !! wikitext
17428 {{int:Bug32057}}
17429 !! html
17430 <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>
17431
17432 !! end
17433
17434 !! test
17435 Strip marker in urlencode
17436 !! wikitext
17437 {{urlencode:x<nowiki/>y}}
17438 {{urlencode:x<nowiki/>y|wiki}}
17439 {{urlencode:x<nowiki/>y|path}}
17440 !! html
17441 <p>xy
17442 xy
17443 xy
17444 </p>
17445 !! end
17446
17447 !! test
17448 Strip marker in lc
17449 !! wikitext
17450 {{lc:x<nowiki/>y}}
17451 !! html
17452 <p>xy
17453 </p>
17454 !! end
17455
17456 !! test
17457 Strip marker in uc
17458 !! wikitext
17459 {{uc:x<nowiki/>y}}
17460 !! html
17461 <p>XY
17462 </p>
17463 !! end
17464
17465 !! test
17466 Strip marker in formatNum
17467 !! wikitext
17468 {{formatnum:1<nowiki/>2}}
17469 {{formatnum:1<nowiki/>2|R}}
17470 !! html
17471 <p>12
17472 12
17473 </p>
17474 !! end
17475
17476 !! test
17477 Check noCommafy in formatNum
17478 !! options
17479 language=be-tarask
17480 !! wikitext
17481 {{formatnum:123456.78}}
17482 {{formatnum:123456.78|NOSEP}}
17483 !! html
17484 <p>123 456,78
17485 123456.78
17486 </p>
17487 !! end
17488
17489 !! test
17490 Wrong option for formatNum (bug 56199)
17491 !! wikitext
17492 {{formatnum:1,234.56|Random}}
17493 {{formatnum:1,234.56|EVERYTHING}}
17494 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17495 !! html
17496 <p>1,234.56
17497 1,234.56
17498 1,234.56
17499 </p>
17500 !! end
17501
17502 !! test
17503 Strip marker in grammar
17504 !! options
17505 language=fi
17506 !! wikitext
17507 {{grammar:elative|foo<nowiki/>bar}}
17508 !! html
17509 <p>foobarista
17510 </p>
17511 !! end
17512
17513 !! test
17514 Strip marker in padleft
17515 !! wikitext
17516 {{padleft:|2|x<nowiki/>y}}
17517 !! html
17518 <p>xy
17519 </p>
17520 !! end
17521
17522 !! test
17523 Strip marker in padright
17524 !! wikitext
17525 {{padright:|2|x<nowiki/>y}}
17526 !! html
17527 <p>xy
17528 </p>
17529 !! end
17530
17531 !! test
17532 Strip marker in anchorencode
17533 !! wikitext
17534 {{anchorencode:x<nowiki/>y}}
17535 !! html
17536 <p>xy
17537 </p>
17538 !! end
17539
17540 !! test
17541 nowiki inside link inside heading (bug 18295)
17542 !! wikitext
17543 ==[[foo|x<nowiki>y</nowiki>z]]==
17544 !! html
17545 <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>
17546
17547 !! end
17548
17549 !! test
17550 new support for bdi element (bug 31817)
17551 !! wikitext
17552 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17553 !! html
17554 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17555
17556 !!end
17557
17558 !! test
17559 Ignore pipe between table row attributes
17560 !! wikitext
17561 {|
17562 | quux
17563 |- id=foo | style='color: red'
17564 | bar
17565 |}
17566 !! html
17567 <table>
17568 <tr>
17569 <td> quux
17570 </td></tr>
17571 <tr id="foo" style="color: red">
17572 <td> bar
17573 </td></tr></table>
17574
17575 !! end
17576
17577 !!test
17578 Gallery override link with WikiLink (bug 34852)
17579 !! wikitext
17580 <gallery>
17581 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17582 </gallery>
17583 !! html
17584 <ul class="gallery mw-gallery-traditional">
17585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17586 <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>
17587 <div class="gallerytext">
17588 <p>caption
17589 </p>
17590 </div>
17591 </div></li>
17592 </ul>
17593
17594 !! end
17595
17596 !!test
17597 Gallery override link with absolute external link (bug 34852)
17598 !! wikitext
17599 <gallery>
17600 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17601 </gallery>
17602 !! html
17603 <ul class="gallery mw-gallery-traditional">
17604 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17605 <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>
17606 <div class="gallerytext">
17607 <p>caption
17608 </p>
17609 </div>
17610 </div></li>
17611 </ul>
17612
17613 !! end
17614
17615 !!test
17616 Gallery override link with malicious javascript (bug 34852)
17617 !! wikitext
17618 <gallery>
17619 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17620 </gallery>
17621 !! html
17622 <ul class="gallery mw-gallery-traditional">
17623 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17624 <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>
17625 <div class="gallerytext">
17626 <p>caption
17627 </p>
17628 </div>
17629 </div></li>
17630 </ul>
17631
17632 !! end
17633
17634 !!test
17635 Gallery with invalid title as link (bug 43964)
17636 !! wikitext
17637 <gallery>
17638 File:foobar.jpg|link=<
17639 </gallery>
17640 !! html
17641 <ul class="gallery mw-gallery-traditional">
17642 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17643 <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>
17644 <div class="gallerytext">
17645 </div>
17646 </div></li>
17647 </ul>
17648
17649 !! end
17650
17651 !!test
17652 Language parser function
17653 !! wikitext
17654 {{#language:ar}}
17655 !! html
17656 <p>العربية
17657 </p>
17658 !! end
17659
17660 !!test
17661 Padleft and padright as substr
17662 !! wikitext
17663 {{padleft:|3|abcde}}
17664 {{padright:|3|abcde}}
17665 !! html
17666 <p>abc
17667 abc
17668 </p>
17669 !! end
17670
17671 !!test
17672 Special parser function
17673 !! wikitext
17674 {{#special:RandomPage}}
17675 {{#special:BaDtItLe}}
17676 {{#special:Foobar}}
17677 !! html
17678 <p>Special:Random
17679 Special:Badtitle
17680 Special:Foobar
17681 </p>
17682 !! end
17683
17684 !!test
17685 Bug 34939 - Case insensitive link parsing ([HttP://])
17686 !! wikitext
17687 [HttP://MediaWiki.Org/]
17688 !! html/php
17689 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17690 </p>
17691 !! html/parsoid
17692 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17693 !! end
17694
17695 !!test
17696 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17697 !! wikitext
17698 [HttP://MediaWiki.Org/ MediaWiki]
17699 !! html
17700 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17701 </p>
17702 !! end
17703
17704 !!test
17705 Bug 34939 - Case insensitive link parsing (HttP://)
17706 !! wikitext
17707 HttP://MediaWiki.Org/
17708 !! html/php
17709 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17710 </p>
17711 !! html/parsoid
17712 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17713 !! end
17714
17715 !!test
17716 Disable TOC
17717 !! options
17718 notoc
17719 !! wikitext
17720 Lead
17721 == Section 1 ==
17722 == Section 2 ==
17723 == Section 3 ==
17724 == Section 4 ==
17725 == Section 5 ==
17726 !! html
17727 <p>Lead
17728 </p>
17729
17730 <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>
17731 <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>
17732 <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>
17733 <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>
17734 <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>
17735
17736 !! end
17737
17738
17739 ###
17740 ### Parsoid-specific tests
17741 ### Parsoid-PHP parser incompatibilities
17742 ###
17743 !!test
17744 1. SOL-sensitive wikitext tokens as template-args
17745 !!options
17746 parsoid=wt2html,wt2wt
17747 !! wikitext
17748 {{echo|*a}}
17749 {{echo|#a}}
17750 {{echo|:a}}
17751 !! html
17752 <span about="#mwt1" typeof="mw:Transclusion">
17753 </span><ul about="#mwt1"><li>a</li>
17754 </ul>
17755 <span about="#mwt2" typeof="mw:Transclusion">
17756 </span><ol about="#mwt2"><li>a</li>
17757 </ol>
17758 <span about="#mwt3" typeof="mw:Transclusion">
17759 </span><dl about="#mwt3"><dd>a</dd>
17760 </dl>
17761 !!end
17762
17763 #### -----------------------------------------------------------------
17764 #### Parsoid-specific functionality tests
17765 #### -----------------------------------------------------------------
17766
17767 # Bug 63642: Formatting elt fixup is cleaned up.
17768 # We know wt2wt will fail, but we expect selser to pass.
17769 # Due to the nature of our testing, wt2wt and selser tests will enter the
17770 # blacklist and we'll catch selser regressions based on changes to the
17771 # blacklist entries for selser tests.
17772 !! test
17773 Bad treebuilder fixup of formatting elt is cleaned up
17774 !! options
17775 parsoid=wt2html,wt2wt
17776 !! wikitext
17777 {|
17778 |
17779 <small>
17780 [[Image:Foobar.jpg|right|Test]]
17781 </small>
17782 |}
17783 !! html/parsoid
17784 <table>
17785 <tbody><tr><td>
17786 <p><small></small></p>
17787 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption><small>Test</small></figcaption></figure>
17788 <p></p></td></tr>
17789 </tbody></table>
17790 !! end
17791
17792 #### ----------------------------------------------------------------
17793 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17794 #### tags. Parsoid's output for these tags differs from that of the
17795 #### PHP parser.
17796 #### ----------------------------------------------------------------
17797
17798 !!test
17799 Ref: 1. ref-location should be replaced with an index span
17800 !!options
17801 parsoid
17802 !! wikitext
17803 A <ref>foo</ref>
17804 B <ref name="x">foo</ref>
17805 C <ref name="y" />
17806 !! html
17807 <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>
17808 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>
17809 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>
17810 !!end
17811
17812 !!test
17813 Ref: 2. ref-tags with identical names should all get the same index
17814 !!options
17815 parsoid
17816 !! wikitext
17817 A <ref name="x">foo</ref>
17818 B <ref name="x" />
17819 !! html
17820 <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>
17821 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>
17822 !!end
17823
17824 !!test
17825 Ref: 3. spaces in ref-names should be ignored
17826 !!options
17827 parsoid
17828 !! wikitext
17829 A <ref name="x">foo</ref>
17830 B <ref name=" x " />
17831 C <ref name= x />
17832 !! html
17833 <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>
17834 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>
17835 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>
17836 !!end
17837
17838 !!test
17839 Ref: 4. 'constructor' should be accepted as a valid ref-name
17840 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17841 !!options
17842 parsoid
17843 !! wikitext
17844 A <ref name="constructor">foo</ref>
17845 !! html
17846 <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>
17847 !!end
17848
17849 !!test
17850 Ref: 5. body should accept generic wikitext
17851 !!options
17852 parsoid
17853 !! wikitext
17854 A <ref>
17855 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17856 </ref>
17857
17858 <references />
17859 !! html
17860 <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;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17861
17862 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17863 <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>
17864 </li>
17865 </ol>
17866 !!end
17867
17868 !!test
17869 Ref: 6. indent-pres should not be output in ref-body
17870 !!options
17871 parsoid
17872 !! wikitext
17873 A <ref>
17874 foo
17875 bar
17876 baz
17877 </ref>
17878
17879 <references />
17880 !! html
17881 <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>
17882
17883 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17884 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17885 bar
17886 baz
17887 </li>
17888 </ol>
17889 !!end
17890
17891 !!test
17892 Ref: 7. No p-wrapping in ref-body
17893 !!options
17894 parsoid
17895 !! wikitext
17896 A <ref>
17897 foo
17898
17899 bar
17900
17901
17902 baz
17903
17904
17905
17906 booz
17907 </ref>
17908
17909 <references />
17910 !! html
17911 <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>
17912
17913 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17914 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17915
17916 bar
17917
17918
17919 baz
17920
17921
17922
17923 booz
17924 </li>
17925 </ol>
17926 !!end
17927
17928 !!test
17929 Ref: 8. transclusion wikitext has lower precedence
17930 !!options
17931 parsoid
17932 !! wikitext
17933 A <ref> foo {{echo|</ref> B C}}
17934
17935 <references />
17936 !! html
17937 <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>
17938 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17939 <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>
17940 </ol>
17941 !!end
17942
17943 !!test
17944 Ref: 9. unclosed comments should not leak out of ref-body
17945 !!options
17946 parsoid
17947 !! wikitext
17948 A <ref> foo <!--</ref> B C
17949 <references />
17950 !! html
17951 <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>
17952 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17953 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17954 </ol>
17955 !!end
17956
17957 !!test
17958 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17959 !!options
17960 parsoid
17961 !! wikitext
17962 A <ref> <b> foo </ref> B C
17963
17964 <references />
17965 !! html
17966 <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>
17967
17968
17969 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17970 <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>
17971 </ol>
17972 !!end
17973
17974 !!test
17975 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17976 !!options
17977 parsoid
17978 !! wikitext
17979 A <ref>foo</ref> B
17980 C <ref>bar</ref> D
17981 !! html
17982 <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
17983 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>
17984 !!end
17985
17986 !!test
17987 Ref: 12. ref-tags act as trailing newline migration barrier
17988 !!options
17989 parsoid
17990 !! wikitext
17991 <!--the newline at the end of this line moves out of the p-tag-->a
17992
17993 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17994 <ref />
17995
17996 c
17997 !! html
17998 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17999
18000
18001 <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>
18002 <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>
18003
18004
18005 <p>c</p>
18006 !!end
18007
18008 !!test
18009 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18010 !!options
18011 parsoid
18012 !! wikitext
18013 <ref>foo</ref> A
18014 <ref>bar
18015 </ref> B
18016 !! html
18017 <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
18018 <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>
18019 !!end
18020
18021 !!test
18022 Ref: 14. A nested ref-tag should be emitted as plain text
18023 !!options
18024 parsoid
18025 !! wikitext
18026 <ref>foo <ref>bar</ref> baz</ref>
18027
18028 <references />
18029 !! html
18030 <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>
18031
18032 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18033 <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>
18034 </ol>
18035 !!end
18036
18037 !!test
18038 Ref: 15. ref-tags with identical names should get identical indexes
18039 !!options
18040 parsoid
18041 !! wikitext
18042 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18043 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18044
18045 <references />
18046 !! html
18047 <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>
18048 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>
18049
18050 <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>
18051 </ol>
18052 !!end
18053
18054 ## We don't bother wt2wt-ing non-standard whitespace
18055 !!test
18056 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18057 !!options
18058 parsoid=wt2html
18059 !! wikitext
18060 A <ref >foo</ref >
18061
18062 <references />
18063 !! html
18064 <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>
18065
18066 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18067 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18068 !!end
18069
18070 !!test
18071 References: 1. references tag without any refs should be handled properly
18072 !!options
18073 parsoid
18074 !! wikitext
18075 <references />
18076 !! html
18077 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18078 !!end
18079
18080 !!test
18081 References: 2. references tag with group only outputs references from that group
18082 !!options
18083 parsoid
18084 !! wikitext
18085 A <ref group="a">foo</ref>
18086 B <ref group="b">bar</ref>
18087
18088 <references group="a" />
18089 !! html
18090 <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>
18091 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>
18092
18093 <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>
18094 </ol>
18095 !!end
18096
18097 !!test
18098 References: 3. ref list should be cleared after processing references
18099 !!options
18100 parsoid
18101 !! wikitext
18102 A <ref>foo</ref>
18103
18104 <references />
18105
18106 B <ref>bar</ref>
18107
18108 <references />
18109 !! html
18110 <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>
18111
18112 <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>
18113 </ol>
18114
18115 <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>
18116
18117 <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>
18118 </ol>
18119 !!end
18120
18121 !!test
18122 References: 4. only referenced group should be cleared after processing references
18123 !!options
18124 parsoid
18125 !! wikitext
18126 A <ref group="a">afoo</ref>
18127 B <ref>bfoo</ref>
18128
18129 <references group="a" />
18130
18131 C <ref>cfoo</ref>
18132
18133 <references />
18134 !! html
18135 <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>
18136 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>
18137
18138 <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>
18139 </ol>
18140
18141 <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>
18142
18143 <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>
18144 </ol>
18145 !!end
18146
18147 !!test
18148 References: 5. ref tags in references should be processed while ignoring all other content
18149 !!options
18150 parsoid
18151 !! wikitext
18152 A <ref name="a" />
18153 B <ref name="b">bar</ref>
18154
18155 <references>
18156 <ref name="a">foo</ref>
18157 This should just get lost.
18158 </references>
18159 !! html
18160 <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>
18161 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>
18162
18163
18164 <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":{}}'>
18165 <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>
18166 <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>
18167 </ol>
18168 !!end
18169
18170 !!test
18171 References: 6. <references /> from a transclusion
18172 !!options
18173 parsoid
18174 !! wikitext
18175 <ref>Foo</ref> {{echo|<references />}}
18176 !! html
18177 <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>
18178 !!end
18179
18180 !! test
18181 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18182 !! options
18183 parsoid
18184 !! wikitext
18185 A <ref>foo bar for a</ref>
18186 B <ref group="X" name="b" />
18187
18188 <references />
18189
18190 <references group="X">
18191 <ref name="b">foo</ref>
18192 </references>
18193 !! html
18194 <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>
18195 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>
18196
18197 <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>
18198
18199 <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>
18200 !! end
18201
18202 !! test
18203 Entities in ref name
18204 !! options
18205 parsoid
18206 !! wikitext
18207 <ref name="test &amp; me">hi</ref>
18208 !! html
18209 <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>
18210 !! end
18211
18212 # This test is wt2html only because we're permitting the serializer to produce
18213 # dirty diffs, normalizing the unclosed references to the self-closed version.
18214 !! test
18215 Generate references for unclosed references tag
18216 !! options
18217 parsoid=wt2html
18218 !! wikitext
18219 a<ref>foo</ref>
18220
18221 <references>
18222 !! html
18223 <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>
18224
18225
18226 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18227 <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>
18228 !! end
18229
18230 !! test
18231 New reference serializes on its own line
18232 !! options
18233 parsoid=wt2wt,html2wt
18234 !! wikitext
18235 foo
18236 <references />
18237 !! html
18238 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18239 !! end
18240
18241 #### ----------------------------------------------------------------
18242 #### The following section of tests are primarily to test
18243 #### wikitext escaping capabilities of Parsoid. Given that
18244 #### escaping can be done any number of ways, the wikitext (input)
18245 #### is always adjusted to reflect how Parsoid adds nowiki
18246 #### escape tags.
18247 ####
18248 #### We are marking several tests as parsoid-only since the
18249 #### HTML in the result section is different from what the
18250 #### PHP parser generates for it.
18251 #### ----------------------------------------------------------------
18252
18253
18254 #### --------------- Headings ---------------
18255 #### 0. Unnested
18256 #### 1. Nested inside html <h1>=foo=</h1>
18257 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18258 #### 3. Nested inside html with wikitext split by html tags
18259 #### 4. No escape needed
18260 #### 5. Empty headings <h1></h1>
18261 #### 6. Heading chars in SOL context
18262 #### ----------------------------------------
18263 !! test
18264 Headings: 0. Unnested
18265 !! options
18266 parsoid
18267 !! wikitext
18268 <nowiki>=foo=</nowiki>
18269
18270 <nowiki> =foo= </nowiki>
18271 <!--cmt-->
18272 <nowiki>=foo=</nowiki>
18273
18274 =foo''a''<nowiki>=</nowiki>
18275 !! html
18276 <p><span typeof="mw:Nowiki">=foo=</span></p>
18277
18278 <p><span typeof="mw:Nowiki"> =foo= </span>
18279 <!--cmt-->
18280 <span typeof="mw:Nowiki">=foo=</span></p>
18281
18282 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18283 !!end
18284
18285 !! test
18286 Headings: 1. Nested inside html
18287 (New headings and existing headings are handled differently)
18288 !! options
18289 parsoid=html2wt
18290 !! wikitext
18291 = =foo= =
18292
18293 == =foo= ==
18294
18295 === =foo= ===
18296
18297 =<nowiki>=foo=</nowiki>=
18298 ==<nowiki>=foo=</nowiki>==
18299 ===<nowiki>=foo=</nowiki>===
18300 ====<nowiki>=foo=</nowiki>====
18301 =====<nowiki>=foo=</nowiki>=====
18302 ======<nowiki>=foo=</nowiki>======
18303
18304 !! html
18305 <h1>=foo=</h1>
18306 <h2>=foo=</h2>
18307 <h3>=foo=</h3>
18308
18309 <h1 data-parsoid='{}'>=foo=</h1>
18310 <h2 data-parsoid='{}'>=foo=</h2>
18311 <h3 data-parsoid='{}'>=foo=</h3>
18312 <h4 data-parsoid='{}'>=foo=</h4>
18313 <h5 data-parsoid='{}'>=foo=</h5>
18314 <h6 data-parsoid='{}'>=foo=</h6>
18315 !!end
18316
18317 !! test
18318 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18319 !! options
18320 parsoid=html2wt
18321 !! wikitext
18322 = foo =
18323 <nowiki>*</nowiki>bar
18324
18325 = foo =
18326 =bar
18327
18328 = foo =
18329 <nowiki>=bar=</nowiki>
18330 !! html
18331 <h1>foo</h1>*bar
18332 <h1>foo</h1>=bar
18333 <h1>foo</h1>=bar=
18334 !!end
18335
18336 !! test
18337 Headings: 3. Nested inside html with wikitext split by html tags
18338 !! options
18339 parsoid=html2wt
18340 !! wikitext
18341 = ='''bold'''<nowiki>foo=</nowiki> =
18342 !! html
18343 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18344 !!end
18345
18346 !! test
18347 Headings: 4a. No escaping needed (testing just h1 and h2)
18348 !! options
18349 parsoid=html2wt
18350 !! wikitext
18351 = =foo =
18352
18353 = foo= =
18354
18355 = =foo= =
18356
18357 = =foo= bar =
18358
18359 == =foo ==
18360
18361 == foo= ==
18362
18363 = ''=''foo= =
18364
18365 = <nowiki>=</nowiki> =
18366 !! html
18367 <h1>=foo</h1>
18368 <h1>foo=</h1>
18369 <h1> =foo= </h1>
18370 <h1>=foo= bar</h1>
18371 <h2>=foo</h2>
18372 <h2>foo=</h2>
18373 <h1><i>=</i>foo=</h1>
18374 <h1><span typeof="mw:Nowiki">=</span></h1>
18375 !!end
18376
18377 !! test
18378 Headings: 4b. No escaping needed (inside p-tags)
18379 !! options
18380 parsoid=html2wt
18381 !! wikitext
18382 ===
18383 =foo= x
18384 =foo= <s></s>
18385 !! html
18386 <p>===
18387 =foo= x
18388 =foo= <s></s>
18389 </p>
18390 !!end
18391
18392 !! test
18393 Headings: 5. Empty headings
18394 !! options
18395 parsoid
18396 !! wikitext
18397 =<nowiki/>=
18398
18399 ==<nowiki/>==
18400
18401 ===<nowiki/>===
18402
18403 ====<nowiki/>====
18404
18405 =====<nowiki/>=====
18406
18407 ======<nowiki/>======
18408 !! html
18409 <h1></h1>
18410 <h2></h2>
18411 <h3></h3>
18412 <h4></h4>
18413 <h5></h5>
18414 <h6></h6>
18415 !!end
18416
18417 !! test
18418 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18419 !! options
18420 parsoid
18421 !! wikitext
18422 <nowiki>=a=</nowiki>
18423
18424 <nowiki>=a=</nowiki>
18425
18426 <nowiki>=a=</nowiki>
18427
18428 <nowiki>=a=</nowiki>
18429 !! html
18430 <p>=a=</p>
18431 <p>=a= </p>
18432 <p>=a= </p>
18433 <p>=a= </p>
18434 !!end
18435
18436 !! test
18437 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18438 !! options
18439 parsoid
18440 !! wikitext
18441 <nowiki>=a=
18442 b</nowiki>
18443
18444 <nowiki>=a=
18445 b</nowiki>
18446
18447 <nowiki>=a=
18448 b</nowiki>
18449
18450 <nowiki>=a=
18451 b</nowiki>
18452 !! html
18453 <p>=a=
18454 b</p>
18455 <p>=a=
18456 b</p>
18457 <p>=a=
18458 b</p>
18459 <p>=a=
18460 b</p>
18461 </p>
18462 !!end
18463
18464 !! test
18465 Headings: 6c. Heading chars in SOL context (leading newline break)
18466 !! options
18467 parsoid
18468 !! wikitext
18469 a
18470 <nowiki>=b=</nowiki>
18471 !! html
18472 <p>a
18473 =b=</p>
18474 !!end
18475
18476 !! test
18477 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18478 !! options
18479 parsoid
18480 !! wikitext
18481 <!--c0--><nowiki>=a=</nowiki>
18482
18483 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18484 !! html
18485 <p><!--c0-->=a=</p>
18486 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18487 !!end
18488
18489 !! test
18490 Headings: 6d. Heading chars in SOL context (No escaping needed)
18491 !! options
18492 parsoid=html2wt
18493 !! wikitext
18494 =a=<div>b</div>
18495 !! html
18496 =a=<div>b</div>
18497 !!end
18498
18499 #### --------------- Lists ---------------
18500 #### 0. Outside nests (*foo, etc.)
18501 #### 1. Nested inside html <ul><li>*foo</li></ul>
18502 #### 2. Inside definition lists
18503 #### 3. Only bullets at start should be escaped
18504 #### 4. No escapes needed
18505 #### 5. No unnecessary escapes
18506 #### 6. Escape bullets in SOL position
18507 #### 7. Escape bullets in a multi-line context
18508 #### ----------------------------------------
18509
18510 !! test
18511 Lists: 0. Outside nests
18512 !! wikitext
18513 <nowiki>*</nowiki>foo
18514
18515 <nowiki>#</nowiki>foo
18516
18517 <nowiki>;Foo:</nowiki>bar
18518 !! html
18519 <p>*foo
18520 </p><p>#foo
18521 </p><p>;Foo:bar
18522 </p>
18523 !!end
18524
18525 !! test
18526 Lists: 1. Nested inside html
18527 !! wikitext
18528 *<nowiki>*foo</nowiki>
18529
18530 *<nowiki>#foo</nowiki>
18531
18532 *<nowiki>:foo</nowiki>
18533
18534 *<nowiki>;foo</nowiki>
18535
18536 #<nowiki>*foo</nowiki>
18537
18538 #<nowiki>#foo</nowiki>
18539
18540 #<nowiki>:foo</nowiki>
18541
18542 #<nowiki>;foo</nowiki>
18543 !! html
18544 <ul><li>*foo</li></ul>
18545 <ul><li>#foo</li></ul>
18546 <ul><li>:foo</li></ul>
18547 <ul><li>;foo</li></ul>
18548 <ol><li>*foo</li></ol>
18549 <ol><li>#foo</li></ol>
18550 <ol><li>:foo</li></ol>
18551 <ol><li>;foo</li></ol>
18552
18553 !!end
18554
18555 !! test
18556 Lists: 2. Inside definition lists
18557 !! wikitext
18558 ;<nowiki>;foo</nowiki>
18559
18560 ;<nowiki>:foo</nowiki>
18561
18562 ;<nowiki>:foo</nowiki>
18563 :bar
18564
18565 :<nowiki>:foo</nowiki>
18566 !! html
18567 <dl><dt>;foo</dt></dl>
18568 <dl><dt>:foo</dt></dl>
18569 <dl><dt>:foo</dt>
18570 <dd>bar</dd></dl>
18571 <dl><dd>:foo</dd></dl>
18572
18573 !!end
18574
18575 !! test
18576 Lists: 3. Only bullets at start of text should be escaped
18577 !! wikitext
18578 *<nowiki>*foo*bar</nowiki>
18579
18580 *<nowiki>*foo</nowiki>''it''*bar
18581 !! html
18582 <ul><li>*foo*bar</li></ul>
18583 <ul><li>*foo<i>it</i>*bar</li></ul>
18584
18585 !!end
18586
18587 !! test
18588 Lists: 4. No escapes needed
18589 !! options
18590 parsoid
18591 !! wikitext
18592 *foo*bar
18593
18594 *''foo''*bar
18595
18596 *[[Foo]]: bar
18597
18598 *[[Foo]]*bar
18599 !! html
18600 <ul>
18601 <li>foo*bar
18602 </li>
18603 </ul>
18604 <ul>
18605 <li><i>foo</i>*bar
18606 </li>
18607 </ul>
18608 <ul>
18609 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18610 </li>
18611 </ul>
18612 <ul>
18613 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18614 </li>
18615 </ul>
18616 !!end
18617
18618 !! test
18619 Lists: 5. No unnecessary escapes
18620 !! wikitext
18621 * bar <span><nowiki>[[foo]]</nowiki></span>
18622
18623 *=bar <span><nowiki>[[foo]]</nowiki></span>
18624
18625 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18626
18627 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18628
18629 *=bar <span>foo]]</span>=
18630
18631 * <s></s>: a
18632 !! html
18633 <ul><li> bar <span>[[foo]]</span></li></ul>
18634 <ul><li>=bar <span>[[foo]]</span></li></ul>
18635 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18636 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18637 <ul><li>=bar <span>foo]]</span>=</li></ul>
18638 <ul><li> <s></s>: a</li></ul>
18639
18640 !!end
18641
18642 !! test
18643 Lists: 6. Escape bullets in SOL position
18644 !! options
18645 parsoid
18646 !! wikitext
18647 <!--cmt--><nowiki>*foo</nowiki>
18648 !! html
18649 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18650 !!end
18651
18652 !! test
18653 Lists: 7. Escape bullets in a multi-line context
18654 !! wikitext
18655 a
18656 <nowiki>*</nowiki>b
18657 !! html
18658 <p>a
18659 *b
18660 </p>
18661 !!end
18662
18663 #### --------------- HRs ---------------
18664 #### 1. Single line
18665 #### -----------------------------------
18666
18667 !! test
18668 HRs: 1. Single line
18669 !! options
18670 parsoid
18671 !! wikitext
18672 ----<nowiki>----</nowiki>
18673 ----=foo=
18674 ----*foo
18675 !! html
18676 <hr><span typeof="mw:Nowiki">----</span>
18677 <hr>=foo=
18678 <hr>*foo
18679 !! end
18680
18681 #### --------------- Tables ---------------
18682 #### 1a. Simple example
18683 #### 1b. No escaping needed (!foo)
18684 #### 1c. No escaping needed (|foo)
18685 #### 1d. No escaping needed (|}foo)
18686 ####
18687 #### 2a. Nested in td (<td>foo|bar</td>)
18688 #### 2b. Nested in td (<td>foo||bar</td>)
18689 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18690 ####
18691 #### 3a. Nested in th (<th>foo!bar</th>)
18692 #### 3b. Nested in th (<th>foo!!bar</th>)
18693 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18694 ####
18695 #### 4a. Escape -
18696 #### 4b. Escape +
18697 #### 4c. No escaping needed
18698 #### --------------------------------------
18699
18700 !! test
18701 Tables: 1a. Simple example
18702 !! wikitext
18703 <nowiki>{|
18704 |}</nowiki>
18705 !! html
18706 <p>{|
18707 |}
18708 </p>
18709 !! end
18710
18711 !! test
18712 Tables: 1b. No escaping needed
18713 !! wikitext
18714 !foo
18715 !! html
18716 <p>!foo
18717 </p>
18718 !! end
18719
18720 !! test
18721 Tables: 1c. No escaping needed
18722 !! wikitext
18723 |foo
18724 !! html
18725 <p>|foo
18726 </p>
18727 !! end
18728
18729 !! test
18730 Tables: 1d. No escaping needed
18731 !! wikitext
18732 |}foo
18733 !! html
18734 <p>|}foo
18735 </p>
18736 !! end
18737
18738 !! test
18739 Tables: 2a. Nested in td
18740 !! options
18741 parsoid=html2wt
18742 !! wikitext
18743 {|
18744 |<nowiki>foo|bar</nowiki>
18745 |-
18746 |x<div><nowiki>a|b</nowiki></div>
18747 |}
18748 !! html
18749 <table><tbody><tr>
18750 <td>foo|bar</td></tr>
18751 <tr><td>x<div>a|b</div></td>
18752 </tbody></table>
18753 !! end
18754
18755 !! test
18756 Tables: 2b. Nested in td
18757 !! options
18758 parsoid
18759 !! wikitext
18760 {|
18761 |<nowiki>foo||bar</nowiki>
18762 |''it''<nowiki>foo||bar</nowiki>
18763 |}
18764 !! html
18765 <table><tbody><tr>
18766 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18767 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18768 !! end
18769
18770 !! test
18771 Tables: 2c. Nested in td -- no escaping needed
18772 !! options
18773 parsoid
18774 !! wikitext
18775 {|
18776 |foo!!bar
18777 |}
18778 !! html
18779 <table><tbody><tr><td>foo!!bar
18780 </td></tr></tbody></table>
18781
18782 !! end
18783
18784 !! test
18785 Tables: 3a. Nested in th
18786 !! options
18787 parsoid
18788 !! wikitext
18789 {|
18790 !foo!bar
18791 |}
18792 !! html
18793 <table><tbody><tr><th>foo!bar
18794 </th></tr></tbody></table>
18795
18796 !! end
18797
18798 !! test
18799 Tables: 3b. Nested in th
18800 !! options
18801 parsoid
18802 !! wikitext
18803 {|
18804 !<nowiki>foo!!bar</nowiki>
18805 |}
18806 !! html
18807 <table>
18808 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18809 </tbody></table>
18810 !! end
18811
18812 !! test
18813 Tables: 3c. Nested in th -- no escaping needed
18814 !! options
18815 parsoid
18816 !! wikitext
18817 {|
18818 !<nowiki>foo||bar</nowiki>
18819 |}
18820 !! html
18821 <table><tbody><tr>
18822 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18823 !! end
18824
18825 !! test
18826 Tables: 4a. Escape -
18827 !! options
18828 parsoid
18829 !! wikitext
18830 {|
18831 !-bar
18832 |-
18833 |<nowiki>-bar</nowiki>
18834 |}
18835 !! html
18836 <table><tbody>
18837 <tr><th>-bar</th></tr>
18838 <tr>
18839 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18840 !! end
18841
18842 !! test
18843 Tables: 4b. Escape +
18844 !! options
18845 parsoid
18846 !! wikitext
18847 {|
18848 !+bar
18849 |-
18850 |<nowiki>+bar</nowiki>
18851 |}
18852 !! html
18853 <table><tbody>
18854 <tr><th>+bar</th></tr>
18855 <tr>
18856 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18857 !! end
18858
18859 !! test
18860 Tables: 4c. No escaping needed
18861 !! options
18862 parsoid
18863 !! wikitext
18864 {|
18865 |foo-bar
18866 |foo+bar
18867 |-
18868 |''foo''-bar
18869 |''foo''+bar
18870 |-
18871 |foo
18872 bar|baz
18873 +bar
18874 -bar
18875 |-
18876 |x
18877 <div>a|b</div>
18878 |}
18879 !! html
18880 <table><tbody>
18881 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18882 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18883 <tr><td>foo
18884 <p>bar|baz
18885 +bar
18886 -bar</p></td></tr>
18887 <tr><td>x
18888 <div>a|b</div></td>
18889 </tbody></table>
18890 !! end
18891
18892 !! test
18893 Tables: 4d. No escaping needed
18894 !! options
18895 parsoid
18896 !! wikitext
18897 {|
18898 |[[Foo]]-bar
18899 ||+1
18900 ||-2
18901 |}
18902 !! html
18903 <table>
18904 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18905 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18906 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18907 </tbody></table>
18908 !! end
18909
18910 !! test
18911 Tables: Digest broken attributes on table and tr tag
18912 !! options
18913 parsoid=wt2html
18914 !! wikitext
18915 {| || |} ++
18916 |- || || ++ --
18917 |- > [
18918 |}
18919 !! html
18920 <table>
18921 <tbody>
18922 <tr></tr>
18923 <tr></tr>
18924 </tbody></table>
18925 !! end
18926
18927 #### --------------- Links ----------------
18928 #### 1. Quote marks in link text
18929 #### 2. Wikilinks: Escapes needed
18930 #### 3. Wikilinks: No escapes needed
18931 #### 4. Extlinks: Escapes needed
18932 #### 5. Extlinks: No escapes needed
18933 #### --------------------------------------
18934 !! test
18935 Links 1. Quote marks in link text
18936 !! options
18937 parsoid
18938 !! wikitext
18939 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18940 !! html
18941 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18942 !! end
18943
18944 !! test
18945 Links 2. WikiLinks: Escapes needed
18946 !! options
18947 parsoid
18948 !! wikitext
18949 [[Foo|[Foobar]]]
18950 [[Foo|<nowiki>Foobar]</nowiki>]]
18951 [[Foo|x [Foobar] x]]
18952 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18953 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18954 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18955 [[Foo|<nowiki>|Bar</nowiki>]]
18956 [[Foo|<nowiki>]]bar</nowiki>]]
18957 [[Foo|<nowiki>[[bar</nowiki>]]
18958 [[Foo|<nowiki>x [[ y</nowiki>]]
18959 [[Foo|<nowiki>x ]] y</nowiki>]]
18960 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18961 !! html
18962 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18963 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18964 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18965 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18966 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18967 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18968 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18969 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18970 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18971 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18972 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18973 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18974 !! end
18975
18976 !! test
18977 Links 3. WikiLinks: No escapes needed
18978 !! options
18979 parsoid
18980 !! wikitext
18981 [[Foo|[Foobar]]
18982 [[Foo|foo|bar]]
18983 !! html
18984 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18985 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18986 !! end
18987
18988 !! test
18989 Links 4. ExtLinks: Escapes needed
18990 !! options
18991 parsoid
18992 !! wikitext
18993 [http://google.com <nowiki>[google]</nowiki>]
18994 [http://google.com <nowiki>google]</nowiki>]
18995
18996 <nowiki>[http://google.com]</nowiki>
18997
18998 <nowiki>[http://google.com google]</nowiki>
18999
19000 !! html
19001 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19002 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19003 <p>[http://google.com]</p>
19004 <p>[http://google.com google]</p>
19005 !! end
19006
19007 !! test
19008 Links 5. ExtLinks: No escapes needed
19009 !! options
19010 parsoid
19011 !! wikitext
19012 [http://google.com [google]
19013 !! html
19014 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19015 !! end
19016
19017 !! test
19018 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19019 !! html/parsoid
19020 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19021 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19022 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19023 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19024 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19025 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19026 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19027 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19028 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19029 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19030 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19031 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19032 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19033 </p>
19034 !! wikitext
19035 x<nowiki/>http://example.com<nowiki/>y
19036 http://example.com<nowiki/>?x
19037 http://example.com<nowiki/>&x
19038 http://example.com<nowiki/>'x
19039 http://example.com<nowiki/>,x
19040 http://example.com<nowiki/>.x
19041 http://example.com<nowiki/>;x
19042 http://example.com<nowiki/>:x
19043 http://example.com<nowiki/>;x
19044 http://example.com<nowiki/>!x
19045 http://example.com<nowiki/>=x
19046 http://example.com<nowiki/>(x)
19047 http://example.com(x<nowiki/>)
19048 !! end
19049
19050 !! test
19051 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19052 !! html/parsoid
19053 <p>x
19054 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19055 y
19056 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19057 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19058 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19059 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19060 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19061 </p>
19062 !! wikitext
19063 x
19064 http://example.com
19065 y
19066 "http://example.com"
19067 (http://example.com)
19068 (http://example.com) foo
19069 http://example.com,
19070 http://example.com, foo
19071 !! end
19072
19073 ## Parsoid currently fails wt2html on this one!
19074 !! test
19075 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19076 !! html/parsoid
19077 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19078 !! wikitext
19079 http://example.com.,;:!?
19080 !! end
19081
19082 !! test
19083 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19084 !! html/parsoid
19085 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19086 !! wikitext
19087 RFC 123<nowiki/>4
19088 !! end
19089
19090 !! test
19091 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19092 !! html/parsoid
19093 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19094 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19095 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19096 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19097 </p>
19098 !! wikitext
19099 xRFC 123y
19100 XRFC 123y
19101 RFC 123?foo
19102 RFC 123&foo
19103 !! end
19104
19105 !! test
19106 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19107 !! html/parsoid
19108 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19109 !! wikitext
19110 PMID 123<nowiki/>4
19111 !! end
19112
19113 !! test
19114 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19115 !! html/parsoid
19116 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19117 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19118 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19119 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19120 </p>
19121 !! wikitext
19122 xPMID 123y
19123 XPMID 123y
19124 PMID 123?foo
19125 PMID 123&foo
19126 !! end
19127
19128 !! test
19129 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19130 !! html/parsoid
19131 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19132 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19133 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19134 </p>
19135 !! wikitext
19136 ISBN 1234567890<nowiki/>1
19137 ISBN 1234567890<nowiki/>x
19138 ISBN 1234567890<nowiki/>b
19139 !! end
19140
19141 !! test
19142 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19143 !! html/parsoid
19144 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19145 !! wikitext
19146 ISBN 1234567890's
19147 !! end
19148
19149 #### --------------- Quotes ---------------
19150 #### 1. Quotes inside <b> and <i>
19151 #### 2. Link fragments separated by <i> and <b> tags
19152 #### 3. Link fragments inside <i> and <b>
19153 #### 4. No escaping needed
19154 #### --------------------------------------
19155 !! test
19156 1. Quotes inside <b> and <i>
19157 !! options
19158 parsoid=html2wt,wt2wt
19159 !! wikitext
19160 ''<nowiki>'foo'</nowiki>''
19161 ''<nowiki>''foo''</nowiki>''
19162 ''<nowiki>'''foo'''</nowiki>''
19163 ''foo''<nowiki/>'s
19164 '''<nowiki>'foo'</nowiki>'''
19165 '''<nowiki>''foo''</nowiki>'''
19166 '''<nowiki>'''foo'''</nowiki>'''
19167 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19168 '''foo'''<nowiki/>'s
19169 '''foo''
19170 ''foo''<nowiki/>'
19171 '<nowiki/>''foo''<nowiki/>'
19172 ''''foo'''
19173 '''foo'''<nowiki/>'
19174 '<nowiki/>'''foo'''<nowiki/>'
19175 ''fools'<span> errand</span>''
19176 ''<span>fool</span>'s errand''
19177 !! html
19178 <p><i>'foo'</i>
19179 <i>''foo''</i>
19180 <i>'''foo'''</i>
19181 <i>foo</i>'s
19182 <b>'foo'</b>
19183 <b>''foo''</b>
19184 <b>'''foo'''</b>
19185 <b>foo'<i>bar'</i>baz</b>
19186 <b>foo</b>'s
19187 '<i>foo</i>
19188 <i>foo</i>'
19189 '<i>foo</i>'
19190 '<b>foo</b>
19191 <b>foo</b>'
19192 '<b>foo</b>'</p>
19193 <i>fools'<span> errand</span></i>
19194 <i><span>fool</span>'s errand</i>
19195 !! end
19196
19197 !! test
19198 2. Link fragments separated by <i> and <b> tags
19199 !! wikitext
19200 [[''foo''<nowiki>hello]]</nowiki>
19201
19202 [['''foo'''<nowiki>hello]]</nowiki>
19203 !! html
19204 <p>[[<i>foo</i>hello]]
19205 </p><p>[[<b>foo</b>hello]]
19206 </p>
19207 !! end
19208
19209 !! test
19210 3. Link fragments inside <i> and <b>
19211 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19212 this is one of the shortcomings of this format)
19213 !! wikitext
19214 ''[[foo''<nowiki>]]</nowiki>
19215
19216 '''[[foo'''<nowiki>]]</nowiki>
19217 !! html
19218 <p><i>[[foo</i>]]
19219 </p><p><b>[[foo</b>]]
19220 </p>
19221 !! end
19222
19223 !! test
19224 4. No escaping needed
19225 !! wikitext
19226 '<span>''bar''</span>'
19227 '<span>'''bar'''</span>'
19228 !! html
19229 <p>'<span><i>bar</i></span>'
19230 '<span><b>bar</b></span>'
19231 </p>
19232 !! end
19233
19234 #### ----------- Paragraphs ---------------
19235 #### 1. No unnecessary escapes
19236 #### --------------------------------------
19237
19238 !! test
19239 1. No unnecessary escapes
19240 !! wikitext
19241 bar <span><nowiki>[[foo]]</nowiki></span>
19242
19243 =bar <span><nowiki>[[foo]]</nowiki></span>
19244
19245 [[bar <span><nowiki>[[foo]]</nowiki></span>
19246
19247 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19248
19249 =bar <span>foo]]</span><nowiki>=</nowiki>
19250 !! html
19251 <p>bar <span>[[foo]]</span>
19252 </p><p>=bar <span>[[foo]]</span>
19253 </p><p>[[bar <span>[[foo]]</span>
19254 </p><p>]]bar <span>[[foo]]</span>
19255 </p><p>=bar <span>foo]]</span>=
19256 </p>
19257 !!end
19258
19259 #### ----------------------- PRE --------------------------
19260 #### 1. Leading whitespace in SOL context should be escaped
19261 #### ------------------------------------------------------
19262 !! test
19263 1. Leading whitespace in SOL context should be escaped
19264 !! options
19265 parsoid
19266 !! wikitext
19267 <nowiki> </nowiki>a
19268
19269 <nowiki> </nowiki> a
19270
19271 <nowiki> </nowiki>a(tab)
19272
19273 <nowiki> </nowiki> a
19274 <!--cmt-->
19275 <nowiki> </nowiki> a
19276
19277 a
19278 <nowiki> </nowiki>b
19279
19280 a
19281 <nowiki> </nowiki>b
19282
19283 a
19284 <nowiki> </nowiki> b
19285 !! html
19286 <p> a</p>
19287 <p> a</p>
19288 <p> a(tab)</p>
19289 <p> a</p>
19290 <p><!--cmt--> a</p>
19291 <p>a
19292 b</p>
19293 <p>a
19294 b</p>
19295 <p>a
19296 b</p>
19297 !! end
19298
19299 #### --------------- Behavior Switches --------------------
19300 !! test
19301 1. Valid behavior switches should be escaped
19302 !! options
19303 parsoid=html2wt
19304 !! wikitext
19305 <nowiki>__TOC__</nowiki>
19306 !! html
19307 __TOC__
19308 !! end
19309
19310 !! test
19311 2. Invalid behavior switches should not be escaped
19312 !! options
19313 parsoid=html2wt
19314 !! wikitext
19315 __TOO__
19316 __|__
19317 !! html
19318 __TOO__
19319 __|__
19320 !! end
19321
19322 #### --------------- HTML tags ---------------
19323 #### 1. a tags
19324 #### 2. other tags
19325 #### 3. multi-line html tag
19326 #### 4. extension tags
19327 #### -----------------------------------------
19328 !! test
19329 1. a tags
19330 !! options
19331 parsoid
19332 !! wikitext
19333 <a href="http://google.com">google</a>
19334 !! html
19335 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19336 !! end
19337
19338 !! test
19339 2. other tags
19340 !! wikitext
19341 <nowiki><div>foo</div>
19342 <div style="color:red">foo</div></nowiki>
19343 !! html
19344 <p>&lt;div&gt;foo&lt;/div&gt;
19345 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19346 </p>
19347 !! end
19348
19349 !! test
19350 3. multi-line html tag
19351 !! wikitext
19352 <nowiki><div
19353 >foo</div
19354 ></nowiki>
19355 !! html
19356 <p>&lt;div
19357 &gt;foo&lt;/div
19358 &gt;
19359 </p>
19360 !! end
19361
19362 !! test
19363 4. extension tags
19364 !! wikitext
19365 <nowiki><ref>foo</ref></nowiki>
19366
19367 <nowiki><ref>bar</nowiki>
19368
19369 baz<nowiki></ref></nowiki>
19370 !! html
19371 <p>&lt;ref&gt;foo&lt;/ref&gt;
19372 </p><p>&lt;ref&gt;bar
19373 </p><p>baz&lt;/ref&gt;
19374 </p>
19375 !! end
19376
19377 #### --------------- Others ---------------
19378 !! test
19379 Escaping nowikis
19380 !! wikitext
19381 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19382 !! html
19383 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19384 </p>
19385 !! end
19386
19387 ## The quote-char in the input is necessary for triggering the bug
19388 !! test
19389 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19390 !! options
19391 parsoid=wt2wt,html2wt
19392 !! wikitext
19393 foo's bar :
19394 !! html
19395 <p>foo's bar :</p>
19396 !! end
19397
19398 !! test
19399
19400 Tag-like HTML structures are passed through as text
19401 !! wikitext
19402 <x y>
19403
19404 <x.y>
19405
19406 <x-y>
19407
19408 1>2
19409
19410 x<y
19411
19412 a>b
19413
19414 1<d e>f
19415 !! html
19416 <p>&lt;x y&gt;
19417 </p><p>&lt;x.y&gt;
19418 </p><p>&lt;x-y&gt;
19419 </p><p>1&gt;2
19420 </p><p>x&lt;y
19421 </p><p>a&gt;b
19422 </p><p>1&lt;d e&gt;f
19423 </p>
19424 !! end
19425
19426
19427 # This was a bug in the PHP parser (see bug 17663 and its dups,
19428 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19429 !! test
19430 Tag names followed by punctuation should not be recognized as tags
19431 !! wikitext
19432 <s.ome> text
19433 !! html
19434 <p>&lt;s.ome&gt; text
19435 </p>
19436 !! end
19437
19438 !! test
19439 HTML tag with necessary entities in attributes
19440 !! wikitext
19441 <span title="&amp;amp;">foo</span>
19442 !! html
19443 <p><span title="&amp;amp;">foo</span>
19444 </p>
19445 !! end
19446
19447 !! test
19448 HTML tag with 'unnecessary' entity encoding in attributes
19449 !! wikitext
19450 <span title="&amp;">foo</span>
19451 !! html
19452 <p><span title="&amp;">foo</span>
19453 </p>
19454 !! end
19455
19456 !! test
19457 HTML tag with broken attribute value quoting
19458 !! wikitext
19459 <span title="Hello world>Foo</span>
19460 !! html
19461 <p><span>Foo</span>
19462 </p>
19463 !! end
19464
19465 !! test
19466 Parsoid-only: HTML tag with broken attribute value quoting
19467 !! options
19468 parsoid
19469 !! wikitext
19470 <span title="Hello world>Foo</span>
19471 !! html
19472 <p><span title="Hello world">Foo</span>
19473 </p>
19474 !! end
19475
19476 !! test
19477 Table with broken attribute value quoting
19478 !! wikitext
19479 {|
19480 | title="Hello world|Foo
19481 |}
19482 !! html
19483 <table>
19484 <tr>
19485 <td>Foo
19486 </td></tr></table>
19487
19488 !! end
19489
19490 !! test
19491 Table with broken attribute value quoting on consecutive lines
19492 !! wikitext
19493 {|
19494 | title="Hello world|Foo
19495 | style="color:red|Bar
19496 |}
19497 !! html
19498 <table>
19499 <tr>
19500 <td>Foo
19501 </td>
19502 <td>Bar
19503 </td></tr></table>
19504
19505 !! end
19506
19507 !! test
19508 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19509 !! options
19510 parsoid
19511 !! wikitext
19512 {|
19513 | title="Hello world|Foo
19514 | style="color:red|Bar
19515 |}
19516 !! html
19517 <table><tbody>
19518 <tr>
19519 <td title="Hello world">Foo
19520 </td><td style="color: red">Bar
19521 </td></tr></tbody></table>
19522
19523 !! end
19524
19525 !! test
19526 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19527 !! options
19528 parsoid
19529 !! wikitext
19530 {{}}
19531 !! html
19532 {{}}
19533 !! end
19534
19535 !! test
19536 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19537 !! options
19538 parsoid
19539 !! wikitext
19540 }}{{
19541 !! html
19542 }}{{
19543 !! end
19544
19545 !!test
19546 Accept empty td cell attribute
19547 !! wikitext
19548 {|
19549 | align="center" | foo || |
19550 |}
19551 !! html
19552 <table>
19553 <tr>
19554 <td align="center"> foo </td>
19555 <td>
19556 </td></tr></table>
19557
19558 !!end
19559
19560 !!test
19561 Non-empty attributes in th-cells
19562 !! wikitext
19563 {|
19564 ! Foo !! style="color: red" | Bar
19565 |}
19566 !! html
19567 <table>
19568 <tr>
19569 <th> Foo </th>
19570 <th style="color: red"> Bar
19571 </th></tr></table>
19572
19573 !!end
19574
19575 !!test
19576 Accept empty attributes in th-cells
19577 !! wikitext
19578 {|
19579 !| foo !!| bar
19580 |}
19581 !! html
19582 <table>
19583 <tr>
19584 <th> foo </th>
19585 <th> bar
19586 </th></tr></table>
19587
19588 !!end
19589
19590 !!test
19591 Empty table rows go away
19592 !! wikitext
19593 {|
19594 | Hello
19595 | there
19596 |- class="foo"
19597 |-
19598 |}
19599 !! html
19600 <table>
19601 <tr>
19602 <td> Hello
19603 </td>
19604 <td> there
19605 </td></tr>
19606
19607 </table>
19608
19609 !! end
19610
19611 ###
19612 ### Parsoid-centric tests for testing RTing of inter-element separators
19613 ### Edge cases not tested by existing parser tests and specific to
19614 ### Parsoid-specific serialization strategies.
19615 ###
19616
19617 !!test
19618 RT-ed inter-element separators should be valid separators
19619 !! wikitext
19620 {|
19621 |- [[foo]]
19622 |}
19623 !! html
19624 <table>
19625
19626 </table>
19627
19628 !!end
19629
19630 !!test
19631 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19632 (Parsoid-only since PHP parser relies on Tidy for correct output)
19633 !!options
19634 parsoid
19635 !! wikitext
19636 {|
19637 |<small>foo
19638 bar
19639 |}
19640
19641 {|
19642 |<small>foo<small>
19643 |}
19644 !! html
19645 !!end
19646
19647 !!test
19648 Empty TD followed by TD with tpl-generated attribute
19649 !! wikitext
19650 {|
19651 |-
19652 |
19653 |{{echo|style='color:red'}}|foo
19654 |}
19655 !! html
19656 <table>
19657
19658 <tr>
19659 <td>
19660 </td>
19661 <td>foo
19662 </td></tr></table>
19663
19664 !!end
19665
19666 !!test
19667 Indented table with an empty td
19668 !! wikitext
19669 {|
19670 |-
19671 |
19672 |foo
19673 |}
19674 !! html
19675 <table>
19676
19677 <tr>
19678 <td>
19679 </td>
19680 <td>foo
19681 </td></tr></table>
19682
19683 !!end
19684
19685 !!test
19686 Empty TR followed by a template-generated TR
19687 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19688 !!options
19689 parsoid
19690 !! wikitext
19691 {|
19692 |-
19693 {{echo|<tr><td>foo</td></tr>}}
19694 |}
19695 !! html
19696 <table>
19697 <tbody>
19698 <tr></tr>
19699 <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}}]}'>
19700 <td>foo</td></tr>
19701 </tbody></table>
19702 !!end
19703
19704 ## PHP and parsoid output differ for this, and since this is primarily
19705 ## for testing Parsoid's serializer, marking this Parsoid only
19706 !!test
19707 Empty TR followed by mixed-ws-comment line should RT correctly
19708 !!options
19709 parsoid
19710 !! wikitext
19711 {|
19712 |-
19713 <!--c-->
19714 |-
19715 <!--c--> <!--d-->
19716 |}
19717 !! html
19718 <table>
19719 <tbody>
19720 <tr></tr>
19721 <!--c-->
19722 <tr>
19723 <!--c--> </tr><!--d-->
19724 </tbody></table>
19725
19726 !!end
19727
19728 !!test
19729 Multi-line image caption generated by templates with/without trailing newlines
19730 !!options
19731 parsoid
19732 !! wikitext
19733 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19734 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19735 !! html
19736 <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>
19737 <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>
19738
19739 !!end
19740
19741 !! test
19742 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19743 !! options
19744 parsoid=html2wt
19745 !! wikitext
19746 <includeonly>foo</includeonly>
19747 new para
19748
19749 [[./Category:Foo]]
19750
19751 = new heading =
19752 !! html
19753 <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>
19754
19755 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19756 !! end
19757
19758 ## PHP emits broken html for this, and since this is primarily
19759 ## a Parsoid serializer test, marking this Parsoid only
19760 !!test
19761 Improperly nested inline or quotes tags with whitespace in between
19762 !!options
19763 parsoid
19764 !! wikitext
19765 <span> <s>x</span> </s>
19766 ''' ''x''' ''
19767 !! html
19768 <p><span> <s>x</s></span><s> </s>
19769 <b> <i>x</i></b><i> </i>
19770 </p>
19771 !!end
19772
19773 !!test
19774 Encapsulate protected attributes from wt
19775 !!options
19776 parsoid
19777 !! wikitext
19778 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19779 !! html
19780 <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>
19781 </body>
19782 !!end
19783
19784 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19785 ## Having nested or stray pre tags results in the attempt to add duplicates,
19786 ## causing an assertion fail. This test tries to prevent that situation.
19787 !!test
19788 Ensure ParagraphWrapper can deal with stray closing pre tags
19789 !!options
19790 parsoid=wt2html
19791 !! wikitext
19792 plain text</pre>
19793 !! html
19794 plain text
19795 !!end
19796
19797 !!test
19798 1. Ensure fostered text content is wrapped in spans
19799 !!options
19800 parsoid=wt2html
19801 !! wikitext
19802 <table>hi</table><table>ho</table>
19803 !! html
19804 <span>hi</span>
19805 <table></table>
19806 <span>ho</span>
19807 <table></table>
19808 !!end
19809
19810 !!test
19811 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19812 !!options
19813 parsoid=wt2html,wt2wt
19814 !! wikitext
19815 <table>
19816 <tr> || ||
19817 <td> a
19818 </table>
19819 !! html
19820 <span> || ||</span>
19821 <table>
19822 <tbody>
19823 <tr>
19824 <td> a</td></tr>
19825 </tbody></table>
19826 !!end
19827
19828 !!test
19829 Encapsulation properly handles null DSR information from foster box
19830 !!options
19831 parsoid=wt2html,wt2wt
19832 !! wikitext
19833 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19834 !! html
19835 <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;
19836 <table>foo
19837 <tr>
19838 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19839 <table>
19840 <tbody>
19841 <tr>
19842 <td>bar</td></tr></tbody></table>
19843 !!end
19844
19845 !!test
19846 1. Encapsulate foster-parented transclusion content
19847 !!options
19848 parsoid=wt2wt,wt2html
19849 !! wikitext
19850 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19851 !! html
19852 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19853 <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
19854 <tr>
19855 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19856 <table>
19857 <tbody>
19858 <tr>
19859 <td>bar</td></tr></tbody></table>
19860 !!end
19861
19862 !!test
19863 2. Encapsulate foster-parented transclusion content
19864 !!options
19865 parsoid=wt2wt,wt2html
19866 !! wikitext
19867 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19868 !! html
19869 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19870 <table>
19871 <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>
19872 <tr>
19873 <td>bar</td></tr></table>&quot;]}">foo</div>
19874 <table>
19875 <tbody>
19876 <tr>
19877 <td>bar</td></tr></tbody></table>
19878 !!end
19879
19880 !!test
19881 3. Encapsulate foster-parented transclusion content
19882 !!options
19883 parsoid=wt2wt,wt2html
19884 !! wikitext
19885 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19886 !! html
19887 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19888 <table>
19889 <div>
19890 <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>
19891 <tr>
19892 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19893 <p>foo</p></div>
19894 <table>
19895 <tbody>
19896 <tr>
19897 <td>bar</td></tr></tbody></table>
19898 !!end
19899
19900 !!test
19901 4. Encapsulate foster-parented transclusion content
19902 !!options
19903 parsoid=wt2wt,wt2html
19904 !! wikitext
19905 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19906 !! html
19907 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19908 <table>
19909 <div>
19910 <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>
19911 <tr>
19912 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19913 <p>foo</p></div>
19914 <table>
19915 <tbody>
19916 <tr>
19917 <td>bar</td></tr></tbody></table>
19918 !!end
19919
19920 !!test
19921 5. Encapsulate foster-parented transclusion content
19922 !!options
19923 parsoid=wt2wt,wt2html
19924 !! wikitext
19925 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19926 !! html
19927 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19928 <table>
19929 <tr>
19930 <td>
19931 <div>
19932 <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>
19933 <table>
19934 <tbody>
19935 <tr>
19936 <td>
19937 <div>
19938 <p>foo</p></div></td></tr></tbody></table>
19939 !!end
19940
19941 !!test
19942 6. Encapsulate foster-parented transclusion content
19943 !!options
19944 parsoid=wt2wt,wt2html
19945 !! wikitext
19946 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19947 !! html
19948 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19949 <table>
19950 <tr>
19951 <td>
19952 <div>
19953 <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>
19954 <table>
19955 <tbody>
19956 <tr>
19957 <td>
19958 <div>
19959 <p>foo</p></div></td></tr></tbody></table>
19960 <p>ok</p>
19961 !!end
19962
19963 !!test
19964 7. Encapsulate foster-parented transclusion content
19965 !!options
19966 parsoid=wt2wt,wt2html
19967 !! wikitext
19968 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19969 !! html
19970 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19971 <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;
19972 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19973 <td>bar</td></table>&quot;]}">foo</p>
19974 <table>
19975 <tbody>
19976 <tr>
19977 <td>bar</td></tr></tbody></table>
19978 !!end
19979
19980 !!test
19981 8. Encapsulate foster-parented transclusion content
19982 !!options
19983 parsoid=wt2wt,wt2html
19984 !! wikitext
19985 {{echo|a
19986 }}{|{{echo|style='color:red'}}
19987 |-
19988 |b
19989 |}
19990 !! html
19991 <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>
19992 <table>
19993 <tbody>
19994 <tr>
19995 <td>b</td></tr></tbody></table>
19996 !!end
19997
19998 !!test
19999 9. Encapsulate foster-parented transclusion content
20000 !!options
20001 parsoid=wt2wt,wt2html
20002 !! wikitext
20003 <table>{{echo|hi</table>hello}}
20004 !! html
20005 <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>
20006 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20007 !!end
20008
20009 !!test
20010 Table in fosterable position
20011 !!options
20012 parsoid=wt2html,wt2wt
20013 !! wikitext
20014 {{OpenTable}}
20015 <div>
20016 {|
20017 |}
20018 </div>
20019 |}
20020 !! html
20021 <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="{}">
20022 </span>
20023 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20024
20025 <table>
20026 </table>
20027 !!end
20028
20029 # Parsoid only for bug 64747
20030 !! test
20031 Properly encapsulate empty-content transclusions in fosterable positions
20032 !! wikitext
20033 <table>
20034 {{#if:|
20035 <td>foo</td>
20036 }}
20037 </table>
20038 !! html/parsoid
20039 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
20040
20041 </table>
20042 !! end
20043
20044 !!test
20045 Support <object> element with .data attribute
20046 !!options
20047 parsoid=html2wt
20048 !! wikitext
20049 <object data="test.swf"></object>
20050 !! html
20051 <object data="test.swf"></object>
20052 !!end
20053
20054 # -----------------------------------------------------------------
20055 # The following section of tests are primarily to spec requirements
20056 # around serialization of new/edited content.
20057 #
20058 # All these tests are marked Parsoid html2wt and html2html only
20059 # ----------------------------------------------------------------
20060
20061 !! test
20062 Image: Modifying size of an image (1)
20063 !! options
20064 parsoid={
20065 "modes": ["wt2wt"],
20066 "changes": [
20067 ["img[height]", "attr", "height", "22"],
20068 ["img[width]", "attr", "width", "200"]
20069 ]
20070 }
20071 !! wikitext
20072 [[Image:Foobar.jpg|230x230px]]
20073 !! wikitext/edited
20074 [[Image:Foobar.jpg|200x200px]]
20075 !!end
20076
20077 !! test
20078 Image: Modifying size of an image (2)
20079 !! options
20080 parsoid={
20081 "modes": ["wt2wt"],
20082 "changes": [
20083 ["img[height]", "attr", "height", "100"],
20084 ["img[width]", "attr", "width", "500"]
20085 ]
20086 }
20087 !! wikitext
20088 [[Image:Foobar.jpg|230x230px]]
20089 !! wikitext/edited
20090 [[Image:Foobar.jpg|500x500px]]
20091 !!end
20092
20093 # Change in size is ignored so long as class='mw-default-size'
20094 !! test
20095 Image: Modifying size of an image (3)
20096 !! options
20097 parsoid={
20098 "modes": ["wt2wt"],
20099 "changes": [
20100 ["figure[class]", "removeClass", "mw-default-size"],
20101 ["figure img", "attr", "height", "19"],
20102 ["figure img", "attr", "width", "170"]
20103 ]
20104 }
20105 !! wikitext
20106 [[Image:Foobar.jpg|thumb]]
20107 !! wikitext/edited
20108 [[Image:Foobar.jpg|thumb|170x170px]]
20109 !!end
20110
20111 !! test
20112 Image: Modifying alignment of an image (bug 48665)
20113 !! options
20114 parsoid={
20115 "modes": ["wt2wt"],
20116 "changes": [
20117 ["figure[class]", "removeClass", "mw-halign-right"],
20118 ["figure[class]", "addClass", "mw-halign-left"]
20119 ]
20120 }
20121 !! wikitext
20122 [[Image:Foobar.jpg|thumb|caption|right]]
20123 !! wikitext/edited
20124 [[Image:Foobar.jpg|thumb|caption|left]]
20125 !! end
20126
20127 !! test
20128 Image: Modifying mw-default-size of an frameless image (bug 62805)
20129 !! options
20130 parsoid={
20131 "modes": ["wt2wt"],
20132 "changes": [
20133 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20134 ]
20135 }
20136 !! wikitext
20137 [[Image:Foobar.jpg|frameless|right]]
20138 !! wikitext/edited
20139 [[Image:Foobar.jpg|frameless|right|220x220px]]
20140 !! end
20141
20142 !! test
20143 Image: Modifying valign of an image (bug 49221)
20144 !! options
20145 parsoid={
20146 "modes": ["wt2wt"],
20147 "changes": [
20148 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20149 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20150 ]
20151 }
20152 !! wikitext
20153 [[File:Foobar.jpg|20px|middle]]
20154 !! wikitext/edited
20155 [[File:Foobar.jpg|20px|text-top]]
20156 !! end
20157
20158 !! test
20159 Image: Modifying alt attribute of an image (bug 56400)
20160 !! options
20161 parsoid={
20162 "modes": ["wt2wt"],
20163 "changes": [
20164 ["img[alt]", "attr", "alt", "some alternate edited text"]
20165 ]
20166 }
20167 !! wikitext
20168 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20169 !! wikitext/edited
20170 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20171 !!end
20172
20173 !! test
20174 Image: Modifying caption of an image
20175 !! options
20176 parsoid={
20177 "modes": ["wt2wt"],
20178 "changes": [
20179 ["figcaption", "text", "new caption"]
20180 ]
20181 }
20182 !! wikitext
20183 [[Image:Foobar.jpg|thumb|original caption]]
20184 !! wikitext/edited
20185 [[Image:Foobar.jpg|thumb|new caption]]
20186 !!end
20187
20188 !! test
20189 Image: empty alt attribute (bug 48924)
20190 !! options
20191 parsoid
20192 !! wikitext
20193 [[File:Foobar.jpg|thumb|alt=|bar]]
20194 !! html
20195 <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>
20196 !! end
20197
20198 #!! test
20199 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20200 #!! options
20201 #parsoid=html2wt
20202 #language=ar
20203 #!! input
20204 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20205 #!! result
20206 #<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>
20207 #!! end
20208
20209 !! test
20210 Image: Block level image should have \n before and after
20211 !! options
20212 parsoid
20213 !! wikitext
20214 123
20215 [[File:Foobar.jpg|right|thumb|150x150px]]
20216 456
20217 !! html
20218 <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>
20219 !!end
20220
20221 !! test
20222 Image: New block level image should have \n before and after (existing
20223 content)
20224 !! options
20225 parsoid
20226 !! wikitext
20227 123
20228 [[File:Foobar.jpg|right|thumb|150x150px]]
20229 456
20230 !! html
20231 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20232 <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>
20233 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20234 !!end
20235
20236 !! test
20237 Image: upright option (parsoid)
20238 !! options
20239 parsoid
20240 !! wikitext
20241 [[File:Foobar.jpg|thumb|upright|caption]]
20242 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20243 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20244 !! html
20245 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure><figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
20246 !!end
20247
20248 !! test
20249 Image: upright option is ignored on inline and frame images (parsoid)
20250 !! options
20251 parsoid
20252 !! wikitext
20253 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20254 !! html
20255 <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>
20256 !!end
20257
20258 !! test
20259 Image: from basic HTML (1)
20260 !! options
20261 parsoid=html2wt
20262 !! html/parsoid
20263 <span typeof="mw:Image">
20264 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20265 </span>
20266 !! wikitext
20267 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20268 !! end
20269
20270 !! test
20271 Image: from basic HTML (2)
20272 !! options
20273 parsoid=html2wt
20274 !! html/parsoid
20275 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20276 !! wikitext
20277 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20278 !! end
20279
20280 !! test
20281 Image: from basic HTML (3)
20282 !! options
20283 parsoid=html2wt
20284 !! html/parsoid
20285 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20286 !! wikitext
20287 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20288 !! end
20289
20290 !! test
20291 Image: from basic HTML (4)
20292 !! options
20293 parsoid=html2wt
20294 !! html/parsoid
20295 <img src="File:Foobar.jpg">
20296 !! wikitext
20297 [[File:Foobar.jpg|link=]]
20298 !! end
20299
20300 !! test
20301 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20302 !! options
20303 parsoid=html2wt
20304 !! wikitext
20305 * foo
20306 !! html
20307 <ul>
20308 <li><p>foo</p></li>
20309 </ul>
20310 !! end
20311
20312 !! test
20313 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20314 !! options
20315 parsoid=html2wt
20316 !! wikitext
20317 * foo
20318 !! html
20319 <ul> <li>foo</li></ul>
20320 !! end
20321
20322 !! test
20323 Don't strip leading whitespace when handling indent-pre suppressing tags
20324 !! options
20325 parsoid=html2wt
20326 !! wikitext
20327 {|
20328 | indented row
20329 |}
20330 <blockquote>
20331 '''This is very bold of you!'''
20332
20333 {|
20334 |
20335 indented cell (no pre-wrapping!)
20336 |}
20337 </blockquote>
20338 foo
20339 <div>bar</div>
20340 !! html
20341 <table>
20342 <tr><td> indented row</td></tr>
20343 </table>
20344 <blockquote><p>
20345 <b>This is very bold of you!</b>
20346 </p>
20347 <table><tr><td>
20348 indented cell (no pre-wrapping!)
20349 </td></tr></table>
20350 </blockquote>
20351 <p>foo</p>
20352 <div>bar</div>
20353 !! end
20354
20355 !! test
20356 Strip leading whitespace when handling indent-pre inducing tags
20357 !! options
20358 parsoid=html2wt
20359 !! wikitext
20360 foo
20361 <span>bar</span>
20362
20363 <span>foo2
20364 </span>bar2
20365
20366 <div>foo</div>
20367 <span>bar</span>
20368
20369 <div>
20370 <span>foo</span>
20371 </div>
20372 !! html
20373 <p>foo</p>
20374 <span>bar</span>
20375
20376 <span>foo2
20377 </span>bar2
20378
20379 <div>foo</div>
20380 <span>bar</span>
20381
20382 <div>
20383 <span>foo</span>
20384 </div>
20385 !! end
20386
20387 !! test
20388 Lists: Add space after bullets
20389 !! options
20390 parsoid=html2wt
20391 !! wikitext
20392 * foo
20393 * bar
20394 * <span> baz</span>
20395 !! html
20396 <ul>
20397 <li>foo</li>
20398 <li> bar</li>
20399 <li><span> baz</span></li>
20400 </ul>
20401 !! end
20402
20403 !! test
20404 Lists: Dont insert newlines in a serialized list item.
20405 !! options
20406 parsoid=html2wt
20407 !! wikitext
20408 * a<br>b
20409 * c
20410 !! html
20411 <ul><li>a<br>b</li><li>c</li></ul>
20412 !! end
20413
20414 !! test
20415 Headings: Add space before/after == (Bug 51744)
20416 !! options
20417 parsoid=html2wt
20418 !! wikitext
20419 == foo ==
20420
20421 == bar ==
20422
20423 == baz ==
20424
20425 == <span> baz</span> ==
20426 !! html
20427 <h2>foo</h2>
20428 <h2> bar</h2>
20429 <h2>baz </h2>
20430 <h2><span> baz</span></h2>
20431 !! end
20432
20433 !! test
20434 Parsoid: Serialize positional parameters with = in them as named parameter
20435 !! options
20436 parsoid=html2wt
20437 !! wikitext
20438 {{echo|1 = f=oo}}
20439
20440 {{echo|1 = f=oo|2 = bar}}
20441
20442 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20443 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20444 {{echo|<nowiki>f=oo</nowiki>|bar}}
20445 !! html
20446 <p about="#mwt1" typeof="mw:Transclusion"
20447 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20448
20449 <p about="#mwt1" typeof="mw:Transclusion"
20450 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20451
20452 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20453 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20454 <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>
20455 !! end
20456
20457 !! test
20458 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20459 !! options
20460 parsoid=html2wt
20461 !! wikitext
20462 <div>a
20463 b
20464 </div>
20465 <div>a
20466 b
20467 </div>
20468 <div>
20469 a
20470
20471 b
20472 </div>
20473 !! html
20474 <div>a<p>b</p></div>
20475 <div>a
20476 <p>b</p></div>
20477 <div>
20478 a
20479 <p>b</p></div>
20480 !! end
20481
20482 !! test
20483 Substrings resembling wikitext in hrefs should not get nowiki escapes
20484 !! options
20485 parsoid=html2wt
20486 !! wikitext
20487 [[Foo''bar''baz]]
20488 !! html
20489 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20490 !! end
20491
20492 #-----------------------------
20493 # I/B quote minimization tests
20494 #-----------------------------
20495
20496 !! test
20497 1. I/B quote minimization: wikitext-only tags should be combined
20498 !! options
20499 parsoid=html2wt
20500 !! wikitext
20501 ''AB''
20502
20503 '''AB'''
20504
20505 ''A'''B'''''
20506
20507 '''A''B'''''
20508
20509 '''A''BC''D'''
20510
20511 '''''AB'''''
20512
20513 '''''AB'''''
20514
20515 '''''AB'''''
20516 !! html
20517 <p><i>A</i><i>B</i></p>
20518 <p><b>A</b><b>B</b></p>
20519 <p><i>A</i><b><i>B</i></b></p>
20520 <p><b>A</b><i><b>B</b></i></p>
20521 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20522 <p><i><b>A</b></i><i><b>B</b></i></p>
20523 <p><i><b>A</b></i><b><i>B</i></b></p>
20524 <p><b><i>A</i></b><i><b>B</b></i></p>
20525 !! end
20526
20527 !! test
20528 2. I/B quote minimization: wikitext and html tags should not be combined
20529 !! options
20530 parsoid=html2wt
20531 !! wikitext
20532 ''A''<i>B</i>
20533
20534 ''A'''''<i>B</i>'''
20535 !! html
20536 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20537 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20538 !! end
20539
20540 !! test
20541 3. I/B quote minimization: templated content stops minimization
20542 !! options
20543 parsoid=html2wt
20544 !! wikitext
20545 ''A''{{echo|''B''}}
20546
20547 ''A''{{echo|'''''B'''''}}
20548 !! html
20549 <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>
20550 <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>
20551 !! end
20552
20553 !! test
20554 4. I/B quote minimization: new content should be mimimized with adjacent old content
20555 !! options
20556 parsoid=html2wt
20557 !! wikitext
20558 ''AB''
20559
20560 '''AB'''
20561
20562 ''A'''B'''''
20563 !! html
20564 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20565 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20566 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20567 !! end
20568
20569 #------------------------------------
20570 # End of I/B quote minimization tests
20571 #------------------------------------
20572
20573 !!test
20574 Bug 54262: New entities
20575 !! options
20576 parsoid=html2wt
20577 !! wikitext
20578 &nbsp;
20579 !! html
20580 <span typeof="mw:Entity">&nbsp;</span>
20581 !! end
20582
20583 ## Note that there is no wikitext output for 'unknownproperty' ##
20584 ## Unknown magic words are silently dropped ##
20585
20586 !! test
20587 Magic words
20588 !! options
20589 parsoid=html2wt
20590 !! wikitext
20591 __TOC__
20592 __NOTOC__
20593 __FORCETOC__
20594 __INDEX__
20595 __NOINDEX__
20596 __NOGALLERY__
20597 __NOEDITSECTION__
20598 __NOTITLECONVERT__
20599 __NOCONTENTCONVERT__
20600 !! html
20601 <meta property='mw:PageProp/toc' />
20602 <meta property='mw:PageProp/notoc' />
20603 <meta property='mw:PageProp/forcetoc' />
20604 <meta property='mw:PageProp/index' />
20605 <meta property='mw:PageProp/noindex' />
20606 <meta property='mw:PageProp/nogallery' />
20607 <meta property='mw:PageProp/noeditsection' />
20608 <meta property='mw:PageProp/notitleconvert' />
20609 <meta property='mw:PageProp/nocontentconvert' />
20610 <meta property='mw:PageProp/unknownproperty' />
20611 !! end
20612
20613 !! test
20614 Consecutive <pre>s should not get merged
20615 !! options
20616 parsoid=html2wt,html2html
20617 !! wikitext
20618 a
20619
20620 b
20621
20622 c
20623
20624 d
20625
20626 e
20627
20628
20629
20630 f
20631 !! html
20632 <pre>a</pre><pre>b</pre>
20633
20634 <pre>c
20635 </pre><pre>
20636 d</pre>
20637
20638 <pre>e
20639
20640 </pre><pre>
20641
20642 f</pre>
20643 !! end
20644
20645 !! test
20646 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20647 !! options
20648 parsoid=html2wt
20649 !! wikitext
20650 [[Special:BookSources/1234567890|ISBN 1234567895]]
20651 !! html
20652 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20653 !! end
20654
20655 !! test
20656 Edited RFC links not serializable as RFC links should serialize as extlinks
20657 !! options
20658 parsoid=html2wt
20659 !! wikitext
20660 [//tools.ietf.org/html/rfc123 New RFC]
20661 !! html
20662 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20663 !! end
20664
20665 !! test
20666 Edited PMID links not serializable as PMID links should serialize as extlinks
20667 !! options
20668 parsoid=html2wt
20669 !! wikitext
20670 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20671 !! html
20672 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20673 !! end
20674
20675 !! test
20676 Edited Redirect link should emit a non-piped wikitext link
20677 !! options
20678 parsoid=html2wt
20679 !! wikitext
20680 #REDIRECT [[Bar]]
20681 !! html
20682 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20683 !! end
20684
20685 # -----------------------------------------------------------------
20686 # End of section for Parsoid-only html2wt tests for serialization
20687 # of new content
20688 # -----------------------------------------------------------------
20689
20690 TODO:
20691 more images
20692 more tables
20693 character entities
20694 and much more
20695 Try for 100% code coverage