b3e9c511fd830f9e31bae79a73dd33782061f96b
[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 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2213 !! options
2214 parsoid
2215 !! wikitext
2216 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2217 !! html
2218 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2219 !! end
2220
2221 !! test
2222 Templates: Don't escape already nowiki-escaped text in template parameters
2223 !! options
2224 parsoid=html2wt,wt2wt
2225 !! wikitext
2226 {{echo|foo<nowiki>|</nowiki>bar}}
2227 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2228 {{echo|<nowiki></nowiki>}}
2229 !! html
2230 <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>
2231 <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>
2232 <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>
2233 </p>
2234 !! end
2235
2236 ## Bug 52824
2237 !! test
2238 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2239 !! options
2240 parsoid=html2wt,wt2wt
2241 !! wikitext
2242 {{echo|{{echo|1=bar}}}}
2243 !! html
2244 <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>
2245 !! end
2246
2247 ## Bug 56733
2248 !! test
2249 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2250 !! options
2251 parsoid
2252 !! wikitext
2253 {{echo|a : b}}
2254 !! html
2255 <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>
2256 !! end
2257
2258 ###
2259 ### Parsoid-centric tests for testing RT edge cases for pre
2260 ###
2261
2262 !!test
2263 1a. Indent-Pre and Comments
2264 !! wikitext
2265 a
2266 <!--a-->
2267 c
2268 !! html
2269 <pre>a
2270 </pre>
2271 <p>c
2272 </p>
2273 !!end
2274
2275 !!test
2276 1b. Indent-Pre and Comments
2277 !! wikitext
2278 a
2279 <!--a-->
2280 c
2281 !! html
2282 <pre>a
2283 </pre>
2284 <p>c
2285 </p>
2286 !!end
2287
2288 !!test
2289 1c. Indent-Pre and Comments
2290 !! wikitext
2291 <!--a--> a
2292
2293 <!--a--> a
2294 !! html
2295 <pre> a
2296 </pre>
2297 <pre> a
2298 </pre>
2299 !!end
2300
2301 !!test
2302 1d. Indent-Pre and Comments
2303 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2304 !! wikitext
2305 <!--a--> a
2306
2307 <!--b-->b
2308 !! html
2309 <pre>a
2310 </pre>
2311 <pre>b
2312 </pre>
2313 !!end
2314
2315 !!test
2316 2a. Indent-Pre and tables
2317 !! wikitext
2318 {|
2319 |-
2320 !h1!!h2
2321 |foo||bar
2322 |}
2323 !! html
2324 <table>
2325
2326 <tr>
2327 <th>h1</th>
2328 <th>h2
2329 </th>
2330 <td>foo</td>
2331 <td>bar
2332 </td></tr></table>
2333
2334 !!end
2335
2336 !!test
2337 2b. Indent-Pre and tables
2338 !! wikitext
2339 {|
2340 |-
2341 |foo
2342 |}
2343 !! html
2344 <table>
2345
2346 <tr>
2347 <td>foo
2348 </td></tr></table>
2349
2350 !!end
2351
2352 !!test
2353 2c. Indent-Pre and tables (bug 42252)
2354 !! wikitext
2355 {|
2356 |+ foo
2357 ! | bar
2358 |}
2359 !! html
2360 <table>
2361 <caption> foo
2362 </caption>
2363 <tr>
2364 <th> bar
2365 </th></tr></table>
2366
2367 !!end
2368
2369 !!test
2370 2d. Indent-Pre and tables
2371 !! wikitext
2372 a
2373 {|
2374 | b
2375 |}
2376 !! html/php
2377 <pre>a
2378 </pre>
2379 <table>
2380 <tr>
2381 <td> b
2382 </td></tr></table>
2383
2384 !! html/parsoid
2385 <pre>a</pre>
2386
2387 <table>
2388
2389 <tbody>
2390 <tr>
2391 <td> b</td></tr>
2392 </tbody></table>
2393 !!end
2394
2395 !!test
2396 2e. Indent-Pre and table-line syntax
2397 !! wikitext
2398 a
2399 | b
2400 | c
2401 !! html/parsoid
2402 <pre>a
2403 | b
2404 | c</pre>
2405 !!end
2406
2407 !!test
2408 2f. Indent-pre started by table-line syntax
2409 !! wikitext
2410 a
2411 | b
2412 | c
2413 !! html/parsoid
2414 <p>a</p>
2415 <pre>
2416 | b
2417 | c</pre>
2418 !!end
2419
2420 !!test
2421 3a. Indent-Pre and block tags (single-line html)
2422 !! wikitext
2423 a <p> foo </p>
2424 b <div> foo </div>
2425 c <blockquote> foo </blockquote>
2426 <span> foo </span>
2427 !! html
2428 a <p> foo </p>
2429 b <div> foo </div>
2430 c <blockquote> foo </blockquote>
2431 <pre><span> foo </span>
2432 </pre>
2433 !!end
2434
2435 !!test
2436 3b. Indent-Pre and block tags (multi-line html)
2437 !! wikitext
2438 a <span>foo</span>
2439 b <div> foo </div>
2440 !! html
2441 <pre>a <span>foo</span>
2442 </pre>
2443 b <div> foo </div>
2444
2445 !!end
2446
2447 !!test
2448 3c. Indent-Pre and block tags (pre-content on separate line)
2449 !! wikitext
2450 <p>
2451 foo
2452 </p>
2453
2454 <div>
2455 foo
2456 </div>
2457
2458 <center>
2459 foo
2460 </center>
2461
2462 <blockquote>
2463 foo
2464 </blockquote>
2465
2466 <blockquote>
2467 <pre>
2468 foo
2469 </pre>
2470 </blockquote>
2471
2472 <table><tr><td>
2473 foo
2474 </td></tr></table>
2475
2476 <ul><li>
2477 foo
2478 </li></ul>
2479
2480 !! html
2481 <p>
2482 foo
2483 </p>
2484 <div>
2485 <pre>foo
2486 </pre>
2487 </div>
2488 <center>
2489 <pre>foo
2490 </pre>
2491 </center>
2492 <blockquote>
2493 <p> foo
2494 </p>
2495 </blockquote>
2496 <blockquote>
2497 <pre>
2498 foo
2499 </pre>
2500 </blockquote>
2501 <table><tr><td>
2502 <pre>foo
2503 </pre>
2504 </td></tr></table>
2505 <ul><li>
2506 foo
2507 </li></ul>
2508
2509 !!end
2510
2511 !!test
2512 4. Indent-Pre and extension tags
2513 !! wikitext
2514 a <gallery>
2515 File:foobar.jpg
2516 </gallery>
2517 !! html
2518 a <ul class="gallery mw-gallery-traditional">
2519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2520 <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>
2521 <div class="gallerytext">
2522 </div>
2523 </div></li>
2524 </ul>
2525
2526 !!end
2527
2528 !! test
2529 Leading pipes outside of tables
2530 !! options
2531 parsoid
2532 !! wikitext
2533 | foo
2534 !! html
2535 <p>| foo</p>
2536 !! end
2537
2538 !! test
2539 Leading pipes outside of tables 2
2540 !! options
2541 parsoid
2542 !! wikitext
2543 a
2544 | foo
2545 b
2546 !! html
2547 <p>a
2548 | foo
2549 b</p>
2550 !! end
2551
2552 !! test
2553 Leading pipes outside of tables 3
2554 !! options
2555 parsoid
2556 !! wikitext
2557 a
2558 | class="foo bar" | baz
2559 b
2560 !! html
2561 <p>a
2562 | class="foo bar" | baz
2563 b</p>
2564 !! end
2565
2566 !!test
2567 Render paragraphs when indent-pre is suppressed in blocklevels
2568 !! wikitext
2569 <blockquote>
2570 foo
2571
2572 bar
2573 </blockquote>
2574 !! html
2575 <blockquote>
2576 <p> foo
2577 </p><p> bar
2578 </p>
2579 </blockquote>
2580
2581 !!end
2582
2583 !!test
2584 4. Multiple spaces at start-of-line
2585 !! wikitext
2586 <p> foo </p>
2587 foo
2588 {|
2589 |foo
2590 |}
2591 !! html
2592 <p> foo </p>
2593 <pre> foo
2594 </pre>
2595 <table>
2596 <tr>
2597 <td>foo
2598 </td></tr></table>
2599
2600 !!end
2601
2602 ## NOTE: the leading white-space chars on empty line are significant
2603 !! test
2604 5a. White-space in indent-pre
2605 !! wikitext
2606 a<br />
2607
2608 b
2609 !! html
2610 <pre>a<br />
2611
2612 b
2613 </pre>
2614 !! end
2615
2616 ## NOTE: the leading white-space chars on empty line are significant
2617 !! test
2618 5b. White-space in indent-pre
2619 !! wikitext
2620 a
2621
2622 b
2623
2624
2625 c
2626 !! html
2627 <pre>a
2628
2629 b
2630
2631
2632 c
2633 </pre>
2634 !! end
2635
2636 !! test
2637 5c. White-space in indent-pre
2638 !! wikitext
2639 ''a''
2640 ''b''
2641 ''c''
2642 !! html
2643 <pre><i>a</i>
2644 <i>b</i>
2645 <i>c</i>
2646 </pre>
2647 !! end
2648
2649 !! test
2650 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2651 !! wikitext
2652 a
2653
2654 <!-- continue -->
2655 b
2656
2657 c
2658
2659 d
2660 !! html
2661 <pre>a
2662
2663 b
2664 </pre>
2665 <pre>c
2666
2667 </pre>
2668 <p>d
2669 </p>
2670 !! end
2671
2672 !! test
2673 7a. Indent-pre and category links
2674 !! options
2675 parsoid=wt2html,wt2wt
2676 !! wikitext
2677 [[Category:foo]] <!-- No pre-wrapping -->
2678 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2679 !! html
2680 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2681 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2682 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2683 !! end
2684
2685 !! test
2686 7b. Indent-pre and category links
2687 !! options
2688 parsoid=wt2html,wt2wt
2689 !! wikitext
2690 [[Category:foo]] a
2691 [[Category:foo]] {{echo|b}}
2692 !! html
2693 <pre>
2694 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2695
2696 <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>
2697 !! end
2698
2699 ###
2700 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2701 ###
2702
2703 !!test
2704 HTML-pre: 1. embedded newlines
2705 !! wikitext
2706 <pre>foo</pre>
2707
2708 <pre>
2709 foo
2710 </pre>
2711
2712 <pre>
2713
2714 foo
2715 </pre>
2716
2717 <pre>
2718
2719
2720 foo
2721 </pre>
2722 !! html
2723 <pre>foo</pre>
2724 <pre>
2725 foo
2726 </pre>
2727 <pre>
2728
2729 foo
2730 </pre>
2731 <pre>
2732
2733
2734 foo
2735 </pre>
2736
2737 !! html/parsoid
2738 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2739
2740 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2741 foo
2742 </pre>
2743
2744 <pre data-parsoid='{"stx":"html"}'>
2745
2746 foo
2747 </pre>
2748
2749 <pre data-parsoid='{"stx":"html"}'>
2750
2751
2752 foo
2753 </pre>
2754 !!end
2755
2756 !! test
2757 HTML-pre: big spaces
2758 !! wikitext
2759 <pre>
2760
2761
2762
2763
2764 haha
2765
2766
2767
2768
2769 haha
2770
2771
2772
2773
2774 </pre>
2775 !! html
2776 <pre>
2777
2778
2779
2780
2781 haha
2782
2783
2784
2785
2786 haha
2787
2788
2789
2790
2791 </pre>
2792
2793 !! html/parsoid
2794 <pre data-parsoid='{"stx":"html"}'>
2795
2796
2797
2798
2799 haha
2800
2801
2802
2803
2804 haha
2805
2806
2807
2808
2809 </pre>
2810 !! end
2811
2812 !!test
2813 HTML-pre: 2: indented text
2814 !! wikitext
2815 <pre>
2816 foo
2817 </pre>
2818 !! html
2819 <pre>
2820 foo
2821 </pre>
2822
2823 !!end
2824
2825 !!test
2826 HTML-pre: 3: other wikitext
2827 !! wikitext
2828 <pre>
2829 * foo
2830 # bar
2831 = no-h =
2832 '' no-italic ''
2833 [[ NoLink ]]
2834 </pre>
2835 !! html
2836 <pre>
2837 * foo
2838 # bar
2839 = no-h =
2840 '' no-italic ''
2841 [[ NoLink ]]
2842 </pre>
2843
2844 !!end
2845
2846 ###
2847 ### Definition lists
2848 ###
2849 !! test
2850 Simple definition
2851 !! wikitext
2852 ; name : Definition
2853 !! html
2854 <dl><dt> name&#160;</dt>
2855 <dd> Definition</dd></dl>
2856
2857 !! end
2858
2859 !! test
2860 Definition list for indentation only
2861 !! wikitext
2862 : Indented text
2863 !! html
2864 <dl><dd> Indented text</dd></dl>
2865
2866 !! end
2867
2868 !! test
2869 Definition list with no space
2870 !! wikitext
2871 ;name:Definition
2872 !! html
2873 <dl><dt>name</dt>
2874 <dd>Definition</dd></dl>
2875
2876 !!end
2877
2878 !! test
2879 Definition list with URL link
2880 !! wikitext
2881 ; http://example.com/ : definition
2882 !! html
2883 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2884 <dd> definition</dd></dl>
2885
2886 !! end
2887
2888 !! test
2889 Definition list with bracketed URL link
2890 !! wikitext
2891 ;[http://www.example.com/ Example]:Something about it
2892 !! html
2893 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2894 <dd>Something about it</dd></dl>
2895
2896 !! end
2897
2898 !! test
2899 Definition list with wikilink containing colon
2900 !! wikitext
2901 ; [[Help:FAQ]]: The least-read page on Wikipedia
2902 !! html
2903 <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>
2904 <dd> The least-read page on Wikipedia</dd></dl>
2905
2906 !! end
2907
2908 # At Brion's and JeLuF's insistence... :)
2909 !! test
2910 Definition list with news link containing colon
2911 !! wikitext
2912 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2913 !! html
2914 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2915 <dd> This isn't even a real newsgroup!</dd></dl>
2916
2917 !! end
2918
2919 !! test
2920 Malformed definition list with colon
2921 !! wikitext
2922 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2923 !! html
2924 <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>
2925
2926 !! end
2927
2928 !! test
2929 Definition lists: colon in external link text
2930 !! wikitext
2931 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2932 !! html
2933 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2934 <dd> OK, I made that up</dd></dl>
2935
2936 !! end
2937
2938 !! test
2939 Definition lists: colon in HTML attribute
2940 !! wikitext
2941 ;<b style="display: inline">bold</b>
2942 !! html
2943 <dl><dt><b style="display: inline">bold</b></dt></dl>
2944
2945 !! end
2946
2947 !! test
2948 Definition lists: self-closed tag
2949 !! wikitext
2950 ;one<br/>two : two-line fun
2951 !! html
2952 <dl><dt>one<br />two&#160;</dt>
2953 <dd> two-line fun</dd></dl>
2954
2955 !! end
2956
2957 !! test
2958 Bug 11748: Literal closing tags
2959 !! wikitext
2960 <dl>
2961 <dt>test 1</dt>
2962 <dd>test test test test test</dd>
2963 <dt>test 2</dt>
2964 <dd>test test test test test</dd>
2965 </dl>
2966 !! html
2967 <dl>
2968 <dt>test 1</dt>
2969 <dd>test test test test test</dd>
2970 <dt>test 2</dt>
2971 <dd>test test test test test</dd>
2972 </dl>
2973
2974 !! end
2975
2976 !! test
2977 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2978 !! wikitext
2979 <ul><li>
2980 ; term : description
2981 * unordered
2982 </li></ul>
2983 !! html
2984 <ul><li>
2985 <dl><dt> term&#160;</dt>
2986 <dd> description</dd></dl>
2987 <ul><li> unordered</li></ul>
2988 </li></ul>
2989
2990 !! end
2991
2992 !! test
2993
2994 Definition list with empty definition and following paragraph
2995 !! wikitext
2996 ; term:
2997 Paragraph text
2998 !! html
2999 <dl><dt> term</dt>
3000 <dd></dd></dl>
3001 <p>Paragraph text
3002 </p>
3003 !! end
3004
3005 !! test
3006 Nested definition lists using html syntax
3007 !! wikitext
3008 <dl><dt>x</dt>
3009 <dd>a</dd>
3010 <dd>b</dd></dl>
3011
3012 !! end
3013
3014 !! test
3015 Definition Lists: No nesting: Multiple dd's
3016 !! wikitext
3017 ;x
3018 :a
3019 :b
3020 !! html
3021 <dl><dt>x</dt>
3022 <dd>a</dd>
3023 <dd>b</dd></dl>
3024
3025 !! end
3026
3027 !! test
3028 Definition Lists: Indentation: Regular
3029 !! wikitext
3030 :i1
3031 ::i2
3032 :::i3
3033 !! html
3034 <dl><dd>i1
3035 <dl><dd>i2
3036 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3037
3038 !! end
3039
3040 !! test
3041 Definition Lists: Indentation: Missing 1st level
3042 !! wikitext
3043 ::i2
3044 :::i3
3045 !! html
3046 <dl><dd><dl><dd>i2
3047 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3048
3049 !! end
3050
3051 !! test
3052 Definition Lists: Indentation: Multi-level indent
3053 !! wikitext
3054 :::i3
3055 !! html
3056 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3057
3058 !! end
3059
3060 !! test
3061 Definition Lists: Hacky use to indent tables
3062 !! wikitext
3063 ::{|
3064 |foo
3065 |bar
3066 |}
3067 this text
3068 should be left alone
3069 !! html
3070 <dl><dd><dl><dd><table>
3071 <tr>
3072 <td>foo
3073 </td>
3074 <td>bar
3075 </td></tr></table></dd></dl></dd></dl>
3076 <p>this text
3077 should be left alone
3078 </p>
3079 !! end
3080
3081 !! test
3082 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3083 !! wikitext
3084 <!-- foo -->
3085 ::{|
3086 |foo
3087 |bar
3088 |}<!-- bar -->
3089 this text
3090 should be left alone
3091 !! html/parsoid
3092 <!-- foo -->
3093 <dl><dd><dl><dd><table><tr>
3094 <td>foo</td>
3095 <td>bar</td>
3096 </tr></table><!-- bar --></dd></dl></dd></dl>
3097 <p>this text
3098 should be left alone</p>
3099 !! end
3100
3101 !! test
3102 Definition Lists: Hacky use to indent tables, with comment before table
3103 !! wikitext
3104 ::<!-- foo -->{|
3105 |foo
3106 |}
3107 !! html/parsoid
3108 <dl><dd><dl><dd><!-- foo --><table><tr>
3109 <td>foo</td>
3110 </tr></table></dd></dl></dd></dl>
3111 !! end
3112
3113 # Bug 52473
3114 !! test
3115 Definition Lists: Hacky use to indent tables (WS-insensitive)
3116 !! options
3117 parsoid
3118 !! wikitext
3119 : {|
3120 |a
3121 |}
3122 !! html
3123 <dl>
3124 <dd> <table><tr><td>a</td></tr></table> </dd>
3125 </dl>
3126 !! end
3127 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3128 ## as an empty dt item. It also ignores all but the last ";" when followed
3129 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3130 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3131 ## ";"s.
3132 ##
3133 ## Ex: ";;t2 ::d2" is transformed into:
3134 ##
3135 ## <dl>
3136 ## <dt>t2 </dt>
3137 ## <dd>
3138 ## <dl>
3139 ## <dt></dt>
3140 ## <dd>d2</dd>
3141 ## </dl>
3142 ## </dd>
3143 ## </dl>
3144 ##
3145 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3146 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3147 ##
3148 ## <dl>
3149 ## <dt>
3150 ## <dl>
3151 ## <dt>t2 </dt>
3152 ## <dd>:d2</dd>
3153 ## </dl>
3154 ## </dt>
3155 ## </dl>
3156 ##
3157 ## All Parsoid only definition list tests have this difference.
3158 ##
3159 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3160 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3161
3162 !! test
3163 Table / list interaction: indented table with lists in table contents
3164 !! wikitext
3165 :{|
3166 |-
3167 | a
3168 * b
3169 |-
3170 | c
3171 * d
3172 |}
3173 !! html
3174 <dl><dd><table>
3175
3176 <tr>
3177 <td> a
3178 <ul><li> b</li></ul>
3179 </td></tr>
3180 <tr>
3181 <td> c
3182 <ul><li> d</li></ul>
3183 </td></tr></table></dd></dl>
3184
3185 !! end
3186
3187 !!test
3188 Table / list interaction: lists nested in tables nested in indented lists
3189 !! wikitext
3190 :{|
3191 |
3192 :a
3193 :b
3194 |
3195 *c
3196 *d
3197 |}
3198
3199 *e
3200 *f
3201 !! html
3202 <dl><dd><table>
3203 <tr>
3204 <td>
3205 <dl><dd>a</dd>
3206 <dd>b</dd></dl>
3207 </td>
3208 <td>
3209 <ul><li>c</li>
3210 <li>d</li></ul>
3211 </td></tr></table></dd></dl>
3212 <ul><li>e</li>
3213 <li>f</li></ul>
3214
3215 !!end
3216
3217 !! test
3218 Definition Lists: Nesting: Multi-level (Parsoid only)
3219 !! options
3220 parsoid
3221 !! wikitext
3222 ;t1 :d1
3223 ;;t2 ::d2
3224 ;;;t3 :::d3
3225 !! html
3226 <dl>
3227 <dt>t1 </dt>
3228 <dd>d1</dd>
3229 <dt>
3230 <dl>
3231 <dt>t2 </dt>
3232 <dd>:d2</dd>
3233 <dt>
3234 <dl>
3235 <dt>t3 </dt>
3236 <dd>::d3</dd>
3237 </dl>
3238 </dt>
3239 </dl>
3240 </dt>
3241 </dl>
3242
3243
3244 !! end
3245
3246
3247 !! test
3248 Definition Lists: Nesting: Test 2 (Parsoid only)
3249 !! options
3250 parsoid
3251 !! wikitext
3252 ;t1
3253 ::d2
3254 !! html
3255 <dl>
3256 <dt>t1</dt>
3257 <dd>
3258 <dl>
3259 <dd>d2</dd>
3260 </dl>
3261 </dd>
3262 </dl>
3263
3264 !! end
3265
3266
3267 !! test
3268 Definition Lists: Nesting: Test 3 (Parsoid only)
3269 !! options
3270 parsoid
3271 !! wikitext
3272 :;t1
3273 ::::d2
3274 !! html
3275 <dl>
3276 <dd>
3277 <dl>
3278 <dt>t1</dt>
3279 <dd>
3280 <dl>
3281 <dd>
3282 <dl>
3283 <dd>d2</dd>
3284 </dl>
3285 </dd>
3286 </dl>
3287 </dd>
3288 </dl>
3289 </dd>
3290 </dl>
3291
3292 !! end
3293
3294
3295 !! test
3296 Definition Lists: Nesting: Test 4
3297 !! wikitext
3298 ::;t3
3299 :::d3
3300 !! html
3301 <dl><dd><dl><dd><dl><dt>t3</dt>
3302 <dd>d3</dd></dl></dd></dl></dd></dl>
3303
3304 !! end
3305
3306
3307 ## The Parsoid team believes the following three test exposes a
3308 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3309 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3310 !! test
3311 Definition Lists: Mixed Lists: Test 1
3312 !! wikitext
3313 :;* foo
3314 ::* bar
3315 :; baz
3316 !! html/php
3317 <dl><dd><dl><dt><ul><li> foo</li>
3318 <li> bar</li></ul></dt></dl>
3319 <dl><dt> baz</dt></dl></dd></dl>
3320
3321 !! html/parsoid
3322 <dl>
3323 <dd><dl>
3324 <dt><ul>
3325 <li> foo
3326 </li>
3327 </ul></dt>
3328 <dd><ul>
3329 <li> bar
3330 </li>
3331 </ul></dd>
3332 <dt> baz</dt>
3333 </dl></dd>
3334 </dl>
3335 !! end
3336
3337 !! test
3338 Definition Lists: Mixed Lists: Test 2
3339 !! wikitext
3340 *: d1
3341 *: d2
3342 !! html
3343 <ul><li><dl><dd> d1</dd>
3344 <dd> d2</dd></dl></li></ul>
3345
3346 !! end
3347
3348
3349 !! test
3350 Definition Lists: Mixed Lists: Test 3
3351 !! wikitext
3352 *::: d1
3353 *::: d2
3354 !! html
3355 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3356 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3357
3358 !! end
3359
3360
3361 !! test
3362 Definition Lists: Mixed Lists: Test 4
3363 !! wikitext
3364 *;d1 :d2
3365 *;d3 :d4
3366 !! html
3367 <ul><li><dl><dt>d1&#160;</dt>
3368 <dd>d2</dd>
3369 <dt>d3&#160;</dt>
3370 <dd>d4</dd></dl></li></ul>
3371
3372 !! end
3373
3374
3375 !! test
3376 Definition Lists: Mixed Lists: Test 5
3377 !! wikitext
3378 *:d1
3379 *:: d2
3380 !! html
3381 <ul><li><dl><dd>d1
3382 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3383
3384 !! end
3385
3386
3387 !! test
3388 Definition Lists: Mixed Lists: Test 6
3389 !! wikitext
3390 #*:d1
3391 #*::: d3
3392 !! html
3393 <ol><li><ul><li><dl><dd>d1
3394 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3395
3396 !! end
3397
3398
3399 !! test
3400 Definition Lists: Mixed Lists: Test 7
3401 !! wikitext
3402 :* d1
3403 :* d2
3404 !! html
3405 <dl><dd><ul><li> d1</li>
3406 <li> d2</li></ul></dd></dl>
3407
3408 !! end
3409
3410
3411 !! test
3412 Definition Lists: Mixed Lists: Test 8
3413 !! wikitext
3414 :* d1
3415 ::* d2
3416 !! html
3417 <dl><dd><ul><li> d1</li></ul>
3418 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3419
3420 !! end
3421
3422
3423 !! test
3424 Definition Lists: Mixed Lists: Test 9
3425 !! wikitext
3426 *;foo :bar
3427 !! html
3428 <ul><li><dl><dt>foo&#160;</dt>
3429 <dd>bar</dd></dl></li></ul>
3430
3431 !! end
3432
3433
3434 !! test
3435 Definition Lists: Mixed Lists: Test 10
3436 !! wikitext
3437 *#;foo :bar
3438 !! html
3439 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3440 <dd>bar</dd></dl></li></ol></li></ul>
3441
3442 !! end
3443
3444 # The Parsoid team disagrees with the PHP parser's seemingly-random
3445 # rules regarding dd/dt on the next two tests. Parsoid is more
3446 # consistent, and recognizes the shared nesting and keeps the
3447 # still-open tags around until the nesting is complete.
3448
3449 !! test
3450 Definition Lists: Mixed Lists: Test 11
3451 !! wikitext
3452 *#*#;*;;foo :bar
3453 *#*#;boo :baz
3454 !! html/php
3455 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3456 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3457 <dl><dt>boo&#160;</dt>
3458 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3459
3460 !! html/parsoid
3461 <ul>
3462 <li>
3463 <ol>
3464 <li>
3465 <ul>
3466 <li>
3467 <ol>
3468 <li>
3469 <dl>
3470 <dt>
3471 <ul>
3472 <li>
3473 <dl>
3474 <dt>
3475 <dl>
3476 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3477 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3478 </dl></dt>
3479 </dl></li>
3480 </ul></dt>
3481 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3482 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3483 </dl></li>
3484 </ol></li>
3485 </ul></li>
3486 </ol></li>
3487 </ul>
3488 !! end
3489
3490
3491 !! test
3492 Definition Lists: Weird Ones: Test 1
3493 !! wikitext
3494 *#;*::;; foo : bar (who uses this?)
3495 !! html/php
3496 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3497 <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>
3498
3499 !! html/parsoid
3500 <ul>
3501 <li>
3502 <ol>
3503 <li>
3504 <dl>
3505 <dt>
3506 <ul>
3507 <li>
3508 <dl>
3509 <dd>
3510 <dl>
3511 <dd>
3512 <dl>
3513 <dt>
3514 <dl>
3515 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3516 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3517 </dl></dt>
3518 </dl></dd>
3519 </dl></dd>
3520 </dl></li>
3521 </ul></dt>
3522 </dl></li>
3523 </ol></li>
3524 </ul>
3525 !! end
3526
3527 ###
3528 ### External links
3529 ###
3530 !! test
3531 External links: non-bracketed
3532 !! wikitext
3533 Non-bracketed: http://example.com
3534 !! html
3535 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3536 </p>
3537 !! end
3538
3539 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3540 !! test
3541 External links: numbered
3542 !! wikitext
3543 Numbered: [http://example.com]
3544 Numbered: [http://example.net]
3545 Numbered: [http://example.com]
3546 !! html/php
3547 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3548 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3549 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3550 </p>
3551 !! html/parsoid
3552 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3553 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3554 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3555 !!end
3556
3557 !! test
3558 External links: specified text
3559 !! wikitext
3560 Specified text: [http://example.com link]
3561 !! html
3562 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3563 </p>
3564 !!end
3565
3566 !! test
3567 External links: trail
3568 !! wikitext
3569 Linktrails should not work for external links: [http://example.com link]s
3570 !! html
3571 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3572 </p>
3573 !! end
3574
3575 !! test
3576 External links: dollar sign in URL
3577 !! wikitext
3578 http://example.com/1$2345
3579 !! html
3580 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3581 </p>
3582 !! end
3583
3584 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3585 !! test
3586 External links: dollar sign in URL (autonumber)
3587 !! wikitext
3588 [http://example.com/1$2345]
3589 !! html/php
3590 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3591 </p>
3592 !! html/parsoid
3593 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3594 !!end
3595
3596 !! test
3597 External links: open square bracket forbidden in URL (bug 4377)
3598 !! options
3599 parsoid=wt2html,wt2wt,html2html
3600 !! wikitext
3601 http://example.com/1[2345
3602 !! html/php
3603 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3604 </p>
3605 !! html/parsoid
3606 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3607 !! end
3608
3609 !! test
3610 External links: open square bracket forbidden in URL (named) (bug 4377)
3611 !! options
3612 parsoid=wt2html,html2html
3613 !! wikitext
3614 [http://example.com/1[2345]
3615 !! html/php
3616 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3617 </p>
3618 !! html/parsoid
3619 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3620 !!end
3621
3622 # parsoid adds a space before the link name
3623 !! test
3624 External links: open square bracket forbidden in URL (named) (bug 4377)
3625 Parsoid variant.
3626 !! wikitext
3627 [http://example.com/1 [2345]
3628 !! html
3629 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3630 </p>
3631 !!end
3632
3633 !! test
3634 External links: nowiki in URL link text (bug 6230)
3635 !! wikitext
3636 [http://example.com/ <nowiki>''example site''</nowiki>]
3637 !! html
3638 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3639 </p>
3640 !! end
3641
3642 !! test
3643 External links: newline forbidden in text (bug 6230 regression check)
3644 !! wikitext
3645 [http://example.com/ first
3646 second]
3647 !! html
3648 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3649 second]
3650 </p>
3651 !!end
3652
3653 !! test
3654 External links: Pipe char between url and text
3655 !! wikitext
3656 [http://example.com | link]
3657 !! html
3658 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3659 </p>
3660 !!end
3661
3662 !! test
3663 External links: protocol-relative URL in brackets
3664 !! wikitext
3665 [//example.com/ Test]
3666 !! html
3667 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3668 </p>
3669 !! end
3670
3671 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3672 !! test
3673 External links: protocol-relative URL in brackets without text
3674 !! wikitext
3675 [//example.com]
3676 !! html/php
3677 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3678 </p>
3679 !! html/parsoid
3680 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3681 !! end
3682
3683 !! test
3684 External links: protocol-relative URL in free text is left alone
3685 !! wikitext
3686 //example.com/Foo
3687 !! html
3688 <p>//example.com/Foo
3689 </p>
3690 !!end
3691
3692 !! test
3693 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3694 !! wikitext
3695 foo//example.com/Foo
3696 !! html
3697 <p>foo//example.com/Foo
3698 </p>
3699 !! end
3700
3701 !! test
3702 External links: with no contents
3703 !! wikitext
3704 [http://en.wikipedia.org/wiki/Foo]
3705
3706 [[wikipedia:Foo|Bar]]
3707
3708 [[wikipedia:Foo|<span>Bar</span>]]
3709 !! html/parsoid
3710 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3711 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3712 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3713 !! end
3714
3715 !! test
3716 External image
3717 !! wikitext
3718 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3719 !! html
3720 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3721 </p>
3722 !! end
3723
3724 !! test
3725 External image from https
3726 !! wikitext
3727 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3728 !! html
3729 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3730 </p>
3731 !! end
3732
3733 !! test
3734 External image (when not allowed)
3735 !! options
3736 wgAllowExternalImages=0
3737 !! wikitext
3738 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3739 !! html
3740 <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>
3741 </p>
3742 !! end
3743
3744 !! test
3745 Link to non-http image, no img tag
3746 !! wikitext
3747 Link to non-http image, no img tag: ftp://example.com/test.jpg
3748 !! html
3749 <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>
3750 </p>
3751 !! end
3752
3753 !! test
3754 External links: terminating separator
3755 !! wikitext
3756 Terminating separator: http://example.com/thing,
3757 !! html
3758 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3759 </p>
3760 !! end
3761
3762 !! test
3763 External links: intervening separator
3764 !! wikitext
3765 Intervening separator: http://example.com/1,2,3
3766 !! html
3767 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3768 </p>
3769 !! end
3770
3771 !! test
3772 External links: old bug with URL in query
3773 !! wikitext
3774 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3775 !! html
3776 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3777 </p>
3778 !! end
3779
3780 !! test
3781 External links: old URL-in-URL bug, mixed protocols
3782 !! wikitext
3783 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3784 !! html
3785 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3786 </p>
3787 !!end
3788
3789 !! test
3790 External links: URL in text
3791 !! wikitext
3792 URL in text: [http://example.com http://example.com]
3793 !! html
3794 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3795 </p>
3796 !! end
3797
3798 !! test
3799 External links: Clickable images
3800 !! wikitext
3801 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3802 !! html
3803 <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>
3804 </p>
3805 !!end
3806
3807 !! test
3808 External links: raw ampersand
3809 !! wikitext
3810 Old &amp; use: http://x&y
3811 !! html
3812 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3813 </p>
3814 !! end
3815
3816 !! test
3817 External links: encoded ampersand
3818 !! wikitext
3819 Old &amp; use: http://x&amp;y
3820 !! html/php
3821 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3822 </p>
3823 !! html/parsoid
3824 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3825 !! end
3826
3827 !! test
3828 External links: encoded equals (bug 6102)
3829 !! wikitext
3830 http://example.com/?foo&#61;bar
3831 !! html/php
3832 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3833 </p>
3834 !! html/parsoid
3835 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3836 !! end
3837
3838 ##
3839 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3840 ## does it number them. As discussed in bug 53505, we can identify
3841 ## autonumbered links via CSS.
3842 ##
3843
3844 !! test
3845 External links: [raw ampersand]
3846 !! wikitext
3847 Old &amp; use: [http://x&y]
3848 !! html/php
3849 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3850 </p>
3851 !! html/parsoid
3852 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3853 !! end
3854
3855 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3856 # mode will return the [raw ampersand] wikitext
3857 !! test
3858 External links: [encoded ampersand]
3859 !! options
3860 parsoid=wt2html,wt2wt,html2html
3861 !! wikitext
3862 Old &amp; use: [http://x&amp;y]
3863 !! html/php
3864 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3865 </p>
3866 !! html/parsoid
3867 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3868 !! end
3869
3870 !! test
3871 External links: [raw equals]
3872 !! wikitext
3873 [http://example.com/?foo=bar]
3874 !! html/php
3875 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3876 </p>
3877 !! html/parsoid
3878 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3879 !! end
3880
3881 # note that parsoid html is identical to [raw equals] case; so html2wt
3882 # mode will return the [raw equals] wikitext
3883 !! test
3884 External links: [encoded equals] (bug 6102)
3885 !! options
3886 parsoid=wt2html,wt2wt,html2html
3887 !! wikitext
3888 [http://example.com/?foo&#61;bar]
3889 !! html/php
3890 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3891 </p>
3892 !! html/parsoid
3893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3894 !! end
3895
3896 # xxx parsoid strips the IDN character, so the round-trip tests will
3897 # obviously fail and are disabled. --cscott
3898 !! test
3899 External links: [IDN ignored character reference in hostname; strip it right off]
3900 !! options
3901 parsoid=wt2html,wt2wt,html2html
3902 !! wikitext
3903 [http://e&zwnj;xample.com/]
3904 !! html/php
3905 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3906 </p>
3907 !! html/parsoid
3908 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3909 !! end
3910
3911 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3912 # Where an external link could easily circumvent the sanitization of the text of
3913 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3914 # test demands a higher standard. That's a bit strange.
3915 #
3916 # Example:
3917 #
3918 # http://e‌xample.com -> [http://example.com|http://example.com]
3919 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3920 #
3921 # The first example is sanitized, but the second is not. Any security benefits
3922 # from this production are trivial to circumvent. Either remove this test and
3923 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3924 # the test accordingly.
3925 #
3926 # All our love,
3927 # The Parsoid team.
3928 # xxx parsoid strips the IDN character, so the round-trip tests will
3929 # obviously fail and are disabled. --cscott
3930 !! test
3931 External links: IDN ignored character reference in hostname; strip it right off
3932 !! options
3933 parsoid=wt2html,html2html
3934 !! wikitext
3935 http://e&zwnj;xample.com/
3936 !! html/php
3937 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3938 </p>
3939 !! html/parsoid
3940 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
3941 !! end
3942
3943 !! test
3944 External links: www.jpeg.org (bug 554)
3945 !! wikitext
3946 http://www.jpeg.org
3947 !! html
3948 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3949 </p>
3950 !! end
3951
3952 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3953 !! test
3954 External links: URL within URL (original bug 2)
3955 !! wikitext
3956 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3957 !! html/php
3958 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3959 </p>
3960 !! html/parsoid
3961 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
3962 !! end
3963
3964 !! test
3965 BUG 361: URL inside bracketed URL
3966 !! wikitext
3967 [http://www.example.com/foo http://www.example.com/bar]
3968 !! html
3969 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3970 </p>
3971 !! end
3972
3973 !! test
3974 BUG 361: URL within URL, not bracketed
3975 !! wikitext
3976 http://www.example.com/foo?=http://www.example.com/bar
3977 !! html
3978 <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>
3979 </p>
3980 !! end
3981
3982 !! test
3983 BUG 289: ">"-token in URL-tail
3984 !! wikitext
3985 http://www.example.com/<hello>
3986 !! html
3987 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3988 </p>
3989 !!end
3990
3991 !! test
3992 BUG 289: literal ">"-token in URL-tail
3993 !! wikitext
3994 http://www.example.com/<b>html</b>
3995 !! html
3996 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3997 </p>
3998 !!end
3999
4000 !! test
4001 BUG 289: ">"-token in bracketed URL
4002 !! wikitext
4003 [http://www.example.com/<hello> stuff]
4004 !! html
4005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4006 </p>
4007 !!end
4008
4009 !! test
4010 BUG 289: literal ">"-token in bracketed URL
4011 !! wikitext
4012 [http://www.example.com/<b>html</b> stuff]
4013 !! html
4014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4015 </p>
4016 !!end
4017
4018 !! test
4019 BUG 289: literal double quote at end of URL
4020 !! wikitext
4021 http://www.example.com/"hello"
4022 !! html
4023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4024 </p>
4025 !!end
4026
4027 !! test
4028 BUG 289: literal double quote in bracketed URL
4029 !! wikitext
4030 [http://www.example.com/"hello" stuff]
4031 !! html
4032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4033 </p>
4034 !!end
4035
4036 !! test
4037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4038 !! wikitext
4039 [http://www.example.com test]
4040 !! html
4041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4042 </p>
4043 !! end
4044
4045 !! test
4046 External links: link text with spaces
4047 !! wikitext
4048 [http://www.example.com a b c]
4049 [http://www.example.com ''a'' ''b'']
4050 !! html
4051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4053 </p>
4054 !! end
4055
4056 !! test
4057 External links: wiki links within external link (Bug 3695)
4058 !! wikitext
4059 [http://example.com [[wikilink]] embedded in ext link]
4060 !! html/php
4061 <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>
4062 </p>
4063 !! html/parsoid
4064 <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>
4065 !! end
4066
4067 !! test
4068 BUG 787: Links with one slash after the url protocol are invalid
4069 !! wikitext
4070 http:/example.com
4071
4072 [http:/example.com title]
4073 !! html
4074 <p>http:/example.com
4075 </p><p>[http:/example.com title]
4076 </p>
4077 !! end
4078
4079 !! test
4080 Bracketed external links with template-generated invalid target
4081 !! wikitext
4082 [{{echo|http:/example.com}} title]
4083 !! html
4084 <p>[http:/example.com title]
4085 </p>
4086 !! end
4087
4088 !! test
4089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4090 !! wikitext
4091 ''[http://example.com text'']
4092 [http://example.com '''text]'''
4093 ''Something [http://example.com in italic'']
4094 ''Something [http://example.com mixed''''', even bold]'''
4095 '''''Now [http://example.com both''''']
4096 !! html
4097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4102 </p>
4103 !! end
4104
4105
4106 !! test
4107 Bug 4781: %26 in URL
4108 !! wikitext
4109 http://www.example.com/?title=AT%26T
4110 !! html/php
4111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4112 </p>
4113 !! html/parsoid
4114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4115 !! end
4116
4117 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4118 # % is actually legal in HTML5. Any change in output would need testing though.
4119 !! test
4120 Bug 4781, 5267: %25 in URL
4121 !! wikitext
4122 http://www.example.com/?title=100%25_Bran
4123 !! html/php
4124 <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>
4125 </p>
4126 !! html/parsoid
4127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4128 !! end
4129
4130 !! test
4131 Bug 4781, 5267: %28, %29 in URL
4132 !! wikitext
4133 http://www.example.com/?title=Ben-Hur_%281959_film%29
4134 !! html/php
4135 <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>
4136 </p>
4137 !! html/parsoid
4138 <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>
4139 !! end
4140
4141
4142 !! test
4143 Bug 4781: %26 in autonumber URL
4144 !! wikitext
4145 [http://www.example.com/?title=AT%26T]
4146 !! html/php
4147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4148 </p>
4149 !! html/parsoid
4150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4151 !! end
4152
4153 !! test
4154 Bug 4781, 5267: %26 in autonumber URL
4155 !! wikitext
4156 [http://www.example.com/?title=100%25_Bran]
4157 !! html/php
4158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4159 </p>
4160 !! html/parsoid
4161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4162 !! end
4163
4164 !! test
4165 Bug 4781, 5267: %28, %29 in autonumber URL
4166 !! wikitext
4167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4168 !! html/php
4169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4170 </p>
4171 !! html/parsoid
4172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4173 !! end
4174
4175
4176 !! test
4177 Bug 4781: %26 in bracketed URL
4178 !! wikitext
4179 [http://www.example.com/?title=AT%26T link]
4180 !! html/php
4181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4182 </p>
4183 !! html/parsoid
4184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4185 !! end
4186
4187 !! test
4188 Bug 4781, 5267: %25 in bracketed URL
4189 !! wikitext
4190 [http://www.example.com/?title=100%25_Bran link]
4191 !! html
4192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4193 </p>
4194 !! end
4195
4196 !! test
4197 Bug 4781, 5267: %28, %29 in bracketed URL
4198 !! wikitext
4199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4200 !! html/php
4201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4205 !! end
4206
4207 !! test
4208 External link containing a period in the anchor. (bug 63947)
4209 !! wikitext
4210 [//foo.org/bar#baz. bang]
4211
4212 [//foo.org/bar. bang]
4213 !! html/php
4214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4216 </p>
4217 !! html/parsoid
4218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4220 !! end
4221
4222 !! test
4223 External link containing a single quote. (bug 63947)
4224 !! wikitext
4225 [//foo.org/bar'baz]
4226
4227 [//foo.org/bar'baz bang]
4228 !! html/php
4229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4231 </p>
4232 !! html/parsoid
4233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4235 !! end
4236
4237
4238 !! test
4239 External link containing a period in the anchor. (bug 63947)
4240 !! wikitext
4241 [//foo.org/bar#baz. bang]
4242
4243 [//foo.org/bar. bang]
4244 !! html/php
4245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4247 </p>
4248 !! html/parsoid
4249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4251 !! end
4252
4253 !! test
4254 External link containing a single quote. (bug 63947)
4255 !! wikitext
4256 [//foo.org/bar'baz]
4257
4258 [//foo.org/bar'baz bang]
4259 !! html/php
4260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4262 </p>
4263 !! html/parsoid
4264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4266 !! end
4267
4268
4269 !! test
4270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4271 !! wikitext
4272 Some [http://example.com/ pretty ''italics'' and stuff]!
4273 !! html
4274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4275 </p>
4276 !! end
4277
4278 !! test
4279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4280 !! wikitext
4281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4282 !! html
4283 <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>
4284 </p>
4285 !! end
4286
4287 !! test
4288 External link containing double-single-quotes with no space separating the url from text in italics
4289 !! wikitext
4290 [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]].]
4291 !! html/php
4292 <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>
4293 </p>
4294 !! html/parsoid
4295 <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>
4296 !! end
4297
4298 !! test
4299 External link with comments in link text
4300 !! wikitext
4301 [http://www.google.com Google <!-- comment -->]
4302 !! html
4303 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4304 </p>
4305 !! end
4306
4307 !! test
4308 URL-encoding in URL functions (single parameter)
4309 !! wikitext
4310 {{localurl:Some page|amp=&}}
4311 !! html
4312 <p>/index.php?title=Some_page&amp;amp=&amp;
4313 </p>
4314 !! end
4315
4316 !! test
4317 URL-encoding in URL functions (multiple parameters)
4318 !! wikitext
4319 {{localurl:Some page|q=?&amp=&}}
4320 !! html
4321 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4322 </p>
4323 !! end
4324
4325 !! test
4326 Brackets in urls
4327 !! wikitext
4328 http://example.com/index.php?foozoid%5B%5D=bar
4329
4330 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4331 !! html/php
4332 <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>
4333 </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>
4334 </p>
4335 !! html/parsoid
4336 <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>
4337
4338 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4339 !! end
4340
4341 !! test
4342 IPv6 urls (bug 21261)
4343 !! options
4344 disabled
4345 !! wikitext
4346 http://[2404:130:0:1000::187:2]/index.php
4347 !! html
4348 <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>
4349 </p>
4350 !! end
4351
4352 !! test
4353 Non-extlinks in brackets
4354 !! wikitext
4355 [foo]
4356 [foo bar]
4357 [foo ''bar'']
4358 [fool's] errand
4359 [fool's errand]
4360 [{{echo|foo}}]
4361 [{{echo|foo}} bar]
4362 [{{echo|foo}} ''bar'']
4363 [{{echo|foo}}l's] errand
4364 [{{echo|foo}}l's errand]
4365 [url={{echo|foo}}]
4366 [url=http://example.com]
4367 !! html
4368 <p>[foo]
4369 [foo bar]
4370 [foo <i>bar</i>]
4371 [fool's] errand
4372 [fool's errand]
4373 [foo]
4374 [foo bar]
4375 [foo <i>bar</i>]
4376 [fool's] errand
4377 [fool's errand]
4378 [url=foo]
4379 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4380 </p>
4381 !! end
4382
4383 !! test
4384 Percent encoding in external links
4385 !! wikitext
4386 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4387 !! html/php
4388 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4389 </p>
4390 !! html/parsoid
4391 <p><a rel="mw:ExtLink"
4392 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4393 !! end
4394
4395 !! test
4396 Use url link syntax for links where the content is equal the link target
4397 !! wikitext
4398 http://example.com
4399 !! html/php
4400 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4401 </p>
4402 !! html/parsoid
4403 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4404 !! end
4405
4406 !! test
4407 Parenthesis in external links, especially URL links
4408 !! wikitext
4409 http://example.com)
4410
4411 http://example.com/test)
4412
4413 http://example.com/(test)
4414
4415 http://example.com/((test)
4416
4417 (http://example.com/(test))
4418
4419 (http://example.com/(test)))))
4420
4421 http://example.com/a)b
4422
4423 [http://example.com) foo]
4424 !! html/php
4425 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4426 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4427 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4428 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4429 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4430 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4431 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4432 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4433 </p>
4434 !! html/parsoid
4435 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4436 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4437 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4438 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4439 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4440 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4441 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4442 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4443 !! end
4444
4445 !! test
4446 Parenthesis in external links, w/ transclusion or comment
4447 !! wikitext
4448 (http://example.com/{{echo|hi}})
4449
4450 (http://example.com<!-- hi -->)
4451 !! html/php
4452 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4453 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4454 </p>
4455 !! html/parsoid
4456 <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>
4457
4458 <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>
4459 !! end
4460
4461 ###
4462 ### Quotes
4463 ###
4464
4465 !! test
4466 Quotes
4467 !! wikitext
4468 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4469
4470 Normal text. '''''Bold italic text.''''' Normal text.
4471 !! html
4472 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4473 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4474 </p>
4475 !! end
4476
4477
4478 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4479 # parser strips. The wikitext contains just the first half of the bold
4480 # quote pair.
4481 !! test
4482 Unclosed and unmatched quotes
4483 !! wikitext
4484 '''''Bold italic text '''with bold deactivated''' in between.'''''
4485
4486 '''''Bold italic text ''with italic deactivated'' in between.'''''
4487
4488 '''Bold text..
4489
4490 ..spanning two paragraphs (should not work).'''
4491
4492 '''Bold tag left open
4493
4494 ''Italic tag left open
4495
4496 Normal text.
4497
4498 <!-- Unmatching number of opening, closing tags: -->
4499 '''This year''''s election ''should'' beat '''last year''''s.
4500
4501 ''Tom'''s car is bigger than ''Susan'''s.
4502
4503 Plain ''italic'''s plain
4504 !! html/php
4505 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4506 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4507 </p><p><b>Bold text..</b>
4508 </p><p>..spanning two paragraphs (should not work).
4509 </p><p><b>Bold tag left open</b>
4510 </p><p><i>Italic tag left open</i>
4511 </p><p>Normal text.
4512 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4513 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4514 </p><p>Plain <i>italic'</i>s plain
4515 </p>
4516 !! html/parsoid
4517 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4518 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4519 </p><p><b>Bold text..</b>
4520 </p><p>..spanning two paragraphs (should not work).<b></b>
4521 </p><p><b>Bold tag left open</b>
4522 </p><p><i>Italic tag left open</i>
4523 </p><p>Normal text.
4524 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4525 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4526 </p><p>Plain <i>italic'</i>s plain
4527 </p>
4528 !! end
4529
4530 ###
4531 ### Tables
4532 ###
4533 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4534 ###
4535
4536 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4537 # is the bare minimum required by the spec, see:
4538 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4539 # Parsoid team replies: empty table tags are legal in HTML5
4540 !! test
4541 A table with no data.
4542 !! options
4543 parsoid=wt2html
4544 !! wikitext
4545 {||}
4546 !! html/php
4547
4548 !! html/parsoid
4549 <table></table>
4550
4551 !! end
4552
4553 !! test
4554 A table with stray table end tags on start tag line (wt2html)
4555 !! options
4556 parsoid=wt2html
4557 !! wikitext
4558 {|style="color: red;"|}
4559
4560 {|style="color: red;" |}
4561 |foo
4562 |}
4563
4564 {|style="color: red;"|} id="foo"
4565 |foo
4566 |}
4567
4568 {|style="color: red;" |} id="foo"
4569 |foo
4570 |}
4571 !! html
4572 <table style="color: red;"></table>
4573
4574 <table style="color: red;">
4575 <tbody><tr>
4576 <td>foo</td>
4577 </tr></tbody>
4578 </table>
4579
4580 <table style="color: red;" id="foo">
4581 <tbody><tr>
4582 <td>foo</td>
4583 </tr></tbody>
4584 </table>
4585
4586 <table style="color: red;" id="foo">
4587 <tbody><tr>
4588 <td>foo</td>
4589 </tr></tbody>
4590 </table>
4591
4592 !! end
4593
4594 !! test
4595 A table with no data (take 2)
4596 !! wikitext
4597 {|
4598 |}
4599 !! html/parsoid
4600 <table></table>
4601 !! end
4602
4603 # A table with nothing but a caption is invalid XHTML, we might want to render
4604 # this as <p>caption</p>
4605 # Parsoid team replies: table with only a caption is legal in HTML5
4606 !! test
4607 A table with nothing but a caption
4608 !! wikitext
4609 {|
4610 |+ caption
4611 |}
4612 !! html/php
4613 <table>
4614 <caption> caption
4615 </caption><tr><td></td></tr></table>
4616
4617 !! html/parsoid
4618 <table><caption> caption</caption></table>
4619 !! end
4620
4621 !! test
4622 A table with caption with default-spaced attributes and a table row
4623 !! wikitext
4624 {|
4625 |+ style="color: red;" | caption1
4626 |-
4627 | foo
4628 |}
4629 !! html
4630 <table>
4631 <caption style="color: red;"> caption1
4632 </caption>
4633 <tr>
4634 <td> foo
4635 </td></tr></table>
4636
4637 !! end
4638
4639 !! test
4640 A table with captions with non-default spaced attributes and a table row
4641 !! wikitext
4642 {|
4643 |+style="color: red;"|caption2
4644 |+ style="color: red;"| caption3
4645 |-
4646 | foo
4647 |}
4648 !! html
4649 <table>
4650 <caption style="color: red;">caption2
4651 </caption>
4652 <caption style="color: red;"> caption3
4653 </caption>
4654 <tr>
4655 <td> foo
4656 </td></tr></table>
4657
4658 !! end
4659
4660 !! test
4661 Table td-cell syntax variations
4662 !! wikitext
4663 {|
4664 | foo bar foo | baz
4665 | foo bar foo || baz
4666 | style='color:red;' | baz
4667 | style='color:red;' || baz
4668 |}
4669 !! html
4670 <table>
4671 <tr>
4672 <td> baz
4673 </td>
4674 <td> foo bar foo </td>
4675 <td> baz
4676 </td>
4677 <td style="color:red;"> baz
4678 </td>
4679 <td> style='color:red;' </td>
4680 <td> baz
4681 </td></tr></table>
4682
4683 !! end
4684
4685 !! test
4686 Simple table
4687 !! wikitext
4688 {|
4689 | 1 || 2
4690 |-
4691 | 3 || 4
4692 |}
4693 !! html
4694 <table>
4695 <tr>
4696 <td> 1 </td>
4697 <td> 2
4698 </td></tr>
4699 <tr>
4700 <td> 3 </td>
4701 <td> 4
4702 </td></tr></table>
4703
4704 !! end
4705
4706 !! test
4707 Simple table but with multiple dashes for row wikitext
4708 !! wikitext
4709 {|
4710 | foo
4711 |-----
4712 | bar
4713 |}
4714 !! html
4715 <table>
4716 <tr>
4717 <td> foo
4718 </td></tr>
4719 <tr>
4720 <td> bar
4721 </td></tr></table>
4722
4723 !! end
4724 !! test
4725 Multiplication table
4726 !! wikitext
4727 {| border="1" cellpadding="2"
4728 |+Multiplication table
4729 |-
4730 ! &times; !! 1 !! 2 !! 3
4731 |-
4732 ! 1
4733 | 1 || 2 || 3
4734 |-
4735 ! 2
4736 | 2 || 4 || 6
4737 |-
4738 ! 3
4739 | 3 || 6 || 9
4740 |-
4741 ! 4
4742 | 4 || 8 || 12
4743 |-
4744 ! 5
4745 | 5 || 10 || 15
4746 |}
4747 !! html
4748 <table border="1" cellpadding="2">
4749 <caption>Multiplication table
4750 </caption>
4751 <tr>
4752 <th> &#215; </th>
4753 <th> 1 </th>
4754 <th> 2 </th>
4755 <th> 3
4756 </th></tr>
4757 <tr>
4758 <th> 1
4759 </th>
4760 <td> 1 </td>
4761 <td> 2 </td>
4762 <td> 3
4763 </td></tr>
4764 <tr>
4765 <th> 2
4766 </th>
4767 <td> 2 </td>
4768 <td> 4 </td>
4769 <td> 6
4770 </td></tr>
4771 <tr>
4772 <th> 3
4773 </th>
4774 <td> 3 </td>
4775 <td> 6 </td>
4776 <td> 9
4777 </td></tr>
4778 <tr>
4779 <th> 4
4780 </th>
4781 <td> 4 </td>
4782 <td> 8 </td>
4783 <td> 12
4784 </td></tr>
4785 <tr>
4786 <th> 5
4787 </th>
4788 <td> 5 </td>
4789 <td> 10 </td>
4790 <td> 15
4791 </td></tr></table>
4792
4793 !! end
4794
4795 !! test
4796 Accept "||" in table headings
4797 !! wikitext
4798 {|
4799 !h1 || h2
4800 |}
4801 !! html
4802 <table>
4803 <tr>
4804 <th>h1 </th>
4805 <th> h2
4806 </th></tr></table>
4807
4808 !! end
4809
4810 !! test
4811 Accept "!!" in table data
4812 !! wikitext
4813 {|
4814 | Foo!! ||
4815 |}
4816 !! html/parsoid
4817 <table data-parsoid='{}'>
4818 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
4819 </tbody></table>
4820 !! end
4821
4822 !! test
4823 Accept "||" in indented table headings
4824 !! wikitext
4825 :{|
4826 !h1 || h2
4827 |}
4828 !! html
4829 <dl><dd><table>
4830 <tr>
4831 <th>h1 </th>
4832 <th> h2
4833 </th></tr></table></dd></dl>
4834
4835 !! end
4836
4837 !! test
4838 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4839 !! wikitext
4840 {|
4841 !| h1
4842 || a
4843 |}
4844 !! html
4845 <table>
4846 <tr>
4847 <th> h1
4848 </th>
4849 <td> a
4850 </td></tr></table>
4851
4852 !! end
4853
4854 !!test
4855 Accept "| !" at start of line in tables (ignore !-attribute)
4856 !! wikitext
4857 {|
4858 |-
4859 | !style="color:red" | bar
4860 |}
4861 !! html
4862 <table>
4863
4864 <tr>
4865 <td> bar
4866 </td></tr></table>
4867
4868 !!end
4869
4870 !!test
4871 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 +/-
4872 !! wikitext
4873 {|
4874 |-
4875 |style='color:red;'|+1
4876 |style='color:blue;'|-1
4877 |-
4878 | 1 || 2 || 3
4879 | 1 ||+2 ||-3
4880 |-
4881 | +1
4882 | -1
4883 |}
4884 !! html
4885 <table>
4886
4887 <tr>
4888 <td style="color:red;">+1
4889 </td>
4890 <td style="color:blue;">-1
4891 </td></tr>
4892 <tr>
4893 <td> 1 </td>
4894 <td> 2 </td>
4895 <td> 3
4896 </td>
4897 <td> 1 </td>
4898 <td>+2 </td>
4899 <td>-3
4900 </td></tr>
4901 <tr>
4902 <td> +1
4903 </td>
4904 <td> -1
4905 </td></tr></table>
4906
4907 !!end
4908
4909 !! test
4910 Table rowspan
4911 !! wikitext
4912 {| border=1
4913 | Cell 1, row 1
4914 |rowspan=2| Cell 2, row 1 (and 2)
4915 | Cell 3, row 1
4916 |-
4917 | Cell 1, row 2
4918 | Cell 3, row 2
4919 |}
4920 !! html
4921 <table border="1">
4922 <tr>
4923 <td> Cell 1, row 1
4924 </td>
4925 <td rowspan="2"> Cell 2, row 1 (and 2)
4926 </td>
4927 <td> Cell 3, row 1
4928 </td></tr>
4929 <tr>
4930 <td> Cell 1, row 2
4931 </td>
4932 <td> Cell 3, row 2
4933 </td></tr></table>
4934
4935 !! end
4936
4937 !! test
4938 Nested table
4939 !! wikitext
4940 {| border=1
4941 | &alpha;
4942 |
4943 {| bgcolor=#ABCDEF border=2
4944 |nested
4945 |-
4946 |table
4947 |}
4948 |the original table again
4949 |}
4950 !! html
4951 <table border="1">
4952 <tr>
4953 <td> &#945;
4954 </td>
4955 <td>
4956 <table bgcolor="#ABCDEF" border="2">
4957 <tr>
4958 <td>nested
4959 </td></tr>
4960 <tr>
4961 <td>table
4962 </td></tr></table>
4963 </td>
4964 <td>the original table again
4965 </td></tr></table>
4966
4967 !! end
4968
4969 !! test
4970 Invalid attributes in table cell (bug 1830)
4971 !! wikitext
4972 {|
4973 |Cell:|broken
4974 |}
4975 !! html
4976 <table>
4977 <tr>
4978 <td>broken
4979 </td></tr></table>
4980
4981 !! end
4982
4983
4984 # The "|}" to close the table is missing from the input, so parsoid's
4985 # *2wt modes will fail.
4986 !! test
4987 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4988 !! options
4989 parsoid=wt2html,html2html
4990 !! wikitext
4991 {|
4992 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4993 !! html/php
4994 <table>
4995 <tr>
4996 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4997 <td>]" onmouseover="alert(document.cookie)"&gt;test
4998 </td>
4999 </tr>
5000 </table>
5001
5002 !! html/parsoid
5003 <table><tbody>
5004 <tr>
5005 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5006 !! end
5007
5008
5009 !! test
5010 Indented table markup mixed with indented pre content (proposed in bug 6200)
5011 !! wikitext
5012 <table>
5013 <tr>
5014 <td>
5015 Text that should be rendered preformatted
5016 </td>
5017 </tr>
5018 </table>
5019 !! html
5020 <table>
5021 <tr>
5022 <td>
5023 <pre>Text that should be rendered preformatted
5024 </pre>
5025 </td>
5026 </tr>
5027 </table>
5028
5029 !! end
5030
5031 !! test
5032 Template-generated table cell attributes and cell content
5033 !! wikitext
5034 {|
5035 |{{table_attribs}}
5036 | {{table_attribs}}
5037 |}
5038 !! html
5039 <table>
5040 <tr>
5041 <td style="color: red"> Foo
5042 </td>
5043 <td style="color: red"> Foo
5044 </td></tr></table>
5045
5046 !! end
5047
5048 !! test
5049 Template-generated table cell attributes and cell content (2)
5050 !! wikitext
5051 {|
5052 |align=center {{table_attribs}}
5053 |}
5054 !! html
5055 <table>
5056 <tr>
5057 <td align="center" style="color: red"> Foo
5058 </td></tr></table>
5059
5060 !! end
5061
5062 !! test
5063 Template-generated table cell attributes and cell content (3)
5064 !! wikitext
5065 {|
5066 |align=center {{table_cells}}
5067 |}
5068 !! html
5069 <table>
5070 <tr>
5071 <td align="center" style="color: red"> Foo </td>
5072 <td> Bar </td>
5073 <td> Baz
5074 </td></tr></table>
5075
5076 !! end
5077
5078 !! test
5079 Table with row followed by newlines and table heading
5080 !! wikitext
5081 {|
5082 |-
5083
5084 ! foo
5085 |}
5086 !! html
5087 <table>
5088
5089
5090 <tr>
5091 <th> foo
5092 </th></tr></table>
5093
5094 !! end
5095
5096 !! test
5097 Table with empty line following the start tag
5098 !! wikitext
5099 {|
5100
5101 |-
5102 | foo
5103 |}
5104 !! html
5105 <table>
5106
5107
5108 <tr>
5109 <td> foo
5110 </td></tr></table>
5111
5112 !! end
5113
5114 # FIXME: Preserve the attribute properly (with an empty string as value) in
5115 # the PHP parser. Parsoid implements the behavior below.
5116 !! test
5117 Table attributes with empty value
5118 !! wikitext
5119 {|
5120 | style=| hello
5121 |}
5122 !! html/parsoid
5123 <table>
5124 <tbody>
5125 <tr>
5126 <td style=""> hello
5127 </td></tr></tbody></table>
5128
5129 !! end
5130
5131 !! test
5132 Wikitext table with a lot of comments
5133 !! wikitext
5134 {|
5135 <!-- c0 -->
5136 | foo
5137 <!-- c1 -->
5138 |- <!-- c2 -->
5139 <!-- c3 -->
5140 |<!-- c4 -->
5141 <!-- c5 -->
5142 |}
5143 !! html
5144 <table>
5145 <tr>
5146 <td> foo
5147 </td></tr>
5148 <tr>
5149 <td>
5150 </td></tr></table>
5151
5152 !! end
5153
5154 !! test
5155 Wikitext table with double-line table cell
5156 !! wikitext
5157 {|
5158 |a
5159 b
5160 |}
5161 !! html
5162 <table>
5163 <tr>
5164 <td>a
5165 <p>b
5166 </p>
5167 </td></tr></table>
5168
5169 !! end
5170
5171 !! test
5172 Table cell with a single comment
5173 !! wikitext
5174 {|
5175 | <!-- c1 -->
5176 | a
5177 |}
5178 !! html
5179 <table>
5180 <tr>
5181 <td>
5182 </td>
5183 <td> a
5184 </td></tr></table>
5185
5186 !! end
5187
5188 # The expected HTML structure in this test is debatable. The PHP parser does
5189 # not parse this kind of table at all. The main focus for Parsoid is on
5190 # round-tripping, so this output is ok for now. TODO: revisit!
5191 !! test
5192 Wikitext table with html-syntax row
5193 !! wikitext
5194 {|
5195 |-
5196 <td>foo</td>
5197 |}
5198 !! html/parsoid
5199 <table>
5200 <tbody>
5201 <tr>
5202 <td>foo</td></tr></tbody></table>
5203 !! end
5204
5205 !! test
5206 Implicit <td> after a |-
5207 (PHP parser relies on Tidy to add the missing <td> tags)
5208 !! options
5209 parsoid=wt2html,wt2wt
5210 !! wikitext
5211 {|
5212 |-
5213 a
5214 |}
5215 !! html
5216 <table>
5217 <tr><td>a</td></tr>
5218 </table>
5219 !! end
5220
5221 !! test
5222 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5223 (PHP parser relies on Tidy to add the missing <td> tags)
5224 !! options
5225 parsoid=wt2html,wt2wt
5226 !! wikitext
5227 {|
5228 |-
5229 |
5230 a
5231 |-
5232 b
5233 |}
5234 !! html
5235 <table>
5236 <tbody>
5237 <tr><td><pre>a</pre></td></tr>
5238 <tr><td> b</td></tr>
5239 </tbody>
5240 </table>
5241 !! end
5242
5243 !! test
5244 Lists should be recognized in an implicit <td> context
5245 (PHP parser relies on Tidy to add the missing <td> tags)
5246 !! options
5247 parsoid=wt2html,wt2wt
5248 !! wikitext
5249 {|
5250 |-
5251 *a
5252 |}
5253 !! html
5254 <table>
5255 <tr>
5256 <td><ul>
5257 <li>a</li>
5258 </ul></td>
5259 </tr>
5260 </table>
5261 !! end
5262
5263 !! test
5264 Parsoid: Round-trip tables directly followed by content (bug 51219)
5265 !! options
5266 parsoid=wt2html,wt2wt
5267 !! wikitext
5268 {|
5269 |foo
5270 |} bar
5271
5272 {|
5273 |baz
5274 |}<b>quux</b>
5275 !! html
5276 <table><tbody>
5277 <tr>
5278 <td>foo</td></tr></tbody></table> bar
5279 <table>
5280 <tbody>
5281 <tr>
5282 <td>baz</td></tr></tbody></table><b>quux</b>
5283 !! end
5284
5285 !! test
5286 Parsoid: Default to a newline after tables in new content (bug 51219)
5287 !! options
5288 parsoid=html2wt
5289 !! wikitext
5290 {|
5291 |foo
5292 |}
5293 <nowiki> </nowiki>bar
5294 {|
5295 |baz
5296 |}
5297 '''quux'''
5298 !! html
5299 <table><tbody>
5300 <tr><td>foo</td></tr></tbody></table> bar
5301 <table><tbody>
5302 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5303 !! end
5304
5305 !! test
5306 Parsoid: newline inducing block nodes don't suppress <nowiki>
5307 !! options
5308 parsoid=html2wt
5309 !! wikitext
5310 <nowiki> </nowiki>a
5311
5312 = foo =
5313 !! html
5314 a<h1>foo</h1>
5315 !! end
5316
5317 !! test
5318 Parsoid: Row-syntax table headings followed by comment & table cells
5319 !! options
5320 parsoid=wt2html,wt2wt
5321 !! wikitext
5322 {|
5323 ! foo || bar
5324 <!-- foo --> || baz || quux
5325 |}
5326 !! html/parsoid
5327 <table>
5328 <tbody>
5329 <tr><th>foo </th><th>bar </th>
5330 <td>baz </td>
5331 <td>quux</td></tr></tbody></table>
5332 !! end
5333
5334
5335 !!test
5336 Parsoid: Recover better from broken table attributes
5337 !!options
5338 parsoid=wt2html
5339 !!wikitext
5340 {| class="foo
5341 | class="bar" |
5342 foo
5343 |}
5344 !!html/parsoid
5345 <table class="foo">
5346 <tr>
5347 <td class="bar">
5348 <p>foo</p></td></tr>
5349 </tbody></table>
5350 !!end
5351
5352 ###
5353 ### Internal links
5354 ###
5355 !! test
5356 Plain link, capitalized
5357 !! wikitext
5358 [[Main Page]]
5359 !! html
5360 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5361 </p>
5362 !! end
5363
5364 !! test
5365 Plain link, uncapitalized
5366 !! wikitext
5367 [[main Page]]
5368 !! html
5369 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5370 </p>
5371 !! end
5372
5373 !! test
5374 Piped link
5375 !! wikitext
5376 [[Main Page|The Main Page]]
5377 !! html
5378 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5379 </p>
5380 !! end
5381
5382 !! test
5383 Piped link with comment in link text
5384 !! wikitext
5385 [[Main Page|The Main<!--front--> Page]]
5386 !! html
5387 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5388 </p>
5389 !! end
5390
5391 !! test
5392 Piped link with multiple pipe characters in link text
5393 !! wikitext
5394 [[Main Page||The|Main|Page|]]
5395 !! html/php
5396 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5397 </p>
5398 !! html/parsoid
5399 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5400 !! end
5401
5402 !! test
5403 Broken link
5404 !! wikitext
5405 [[Zigzagzogzagzig]]
5406 !! html
5407 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5408 </p>
5409 !! end
5410
5411 !! test
5412 Broken link with fragment
5413 !! wikitext
5414 [[Zigzagzogzagzig#zug]]
5415 !! html
5416 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5417 </p>
5418 !! end
5419
5420 !! test
5421 Special page link with fragment
5422 !! wikitext
5423 [[Special:Version#anchor]]
5424 !! html
5425 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5426 </p>
5427 !! end
5428
5429 !! test
5430 Nonexistent special page link with fragment
5431 !! wikitext
5432 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5433 !! html
5434 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5435 </p>
5436 !! end
5437
5438 !! test
5439 Link with prefix
5440 !! wikitext
5441 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5442 !! html
5443 <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>
5444 </p>
5445 !! end
5446
5447 !! test
5448 Link with suffix
5449 !! wikitext
5450 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5451 !! html
5452 <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>!!!
5453 </p>
5454 !! end
5455
5456 !! article
5457 prefixed article
5458 !! text
5459 Some text
5460 !! endarticle
5461
5462 !! test
5463 Bug 43661: Piped links with identical prefixes
5464 !! wikitext
5465 [[prefixed article|prefixed articles with spaces]]
5466
5467 [[prefixed article|prefixed articlesaoeu]]
5468
5469 [[Main Page|Main Page test]]
5470 !! html
5471 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5472 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5473 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5474 </p>
5475 !! end
5476
5477
5478 !! test
5479 Link with HTML entity in suffix / tail
5480 !! wikitext
5481 [[Main Page]]&quot;, [[Main Page]]&#97;
5482 !! html
5483 <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;
5484 </p>
5485 !! end
5486
5487 !! test
5488 Link with 3 brackets
5489 !! wikitext
5490 [[[Main Page]]]
5491 !! html
5492 <p>[[[Main Page]]]
5493 </p>
5494 !! end
5495
5496 !! test
5497 Link with 4 brackets
5498 !! wikitext
5499 [[[[Main Page]]]]
5500 !! html
5501 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5502 </p>
5503 !! end
5504
5505 !! test
5506 Piped link with 3 brackets
5507 !! wikitext
5508 [[[main page|the main page]]]
5509 !! html
5510 <p>[[[main page|the main page]]]
5511 </p>
5512 !! end
5513
5514 !! test
5515 Piped link with extlink-like text
5516 !! wikitext
5517 [[Main Page|[bar]]]
5518 [[Main Page|This is a [bar]]]
5519 !! html
5520 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5521 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5522 </p>
5523 !! end
5524
5525 !! test
5526 Link with multiple pipes
5527 !! wikitext
5528 [[Main Page|The|Main|Page]]
5529 !! html
5530 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5531 </p>
5532 !! end
5533
5534 # Note that parsoid does not munge anchor text; all non-space
5535 # characters are valid in HTML5 ids.
5536 !! test
5537 Anchor containing a #. (bug 63430)
5538 !! wikitext
5539 [[Main Page#And#Link]]
5540 !! html/php
5541 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5542 </p>
5543 !! html/parsoid
5544 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5545 !! end
5546
5547 !! test
5548 Link to namespaces
5549 !! wikitext
5550 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5551 !! html
5552 <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>
5553 </p>
5554 !! end
5555
5556 !! test
5557 Link with space in namespace
5558 !! wikitext
5559 [[User talk:Foo bar]]
5560 !! html
5561 <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>
5562 </p>
5563 !! end
5564
5565 !! article
5566 MemoryAlpha:AlphaTest
5567 !! text
5568 This is an article in the MemoryAlpha namespace
5569 (which shadows the memoryalpha interwiki link).
5570 !! endarticle
5571
5572 !! test
5573 Namespace takes precedence over interwiki link (bug 51680)
5574 !! wikitext
5575 [[MemoryAlpha:AlphaTest]]
5576 !! html
5577 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5578 </p>
5579 !! end
5580
5581 # The previous test doesn't work correctly in html2*, due to not recognizing the
5582 # link as an internal one. This one checks for the correct behavior.
5583 !! test
5584 Link to namespace preferred over interwiki with correct rel attribute
5585 !! options
5586 parsoid=html2wt,html2html
5587 !! wikitext
5588 [[MemoryAlpha:AlphaTest]]
5589 !! html
5590 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5591 </p>
5592 !! end
5593
5594 !! test
5595 Piped link to namespace
5596 !! wikitext
5597 [[Meta:Disclaimers|The disclaimers]]
5598 !! html
5599 <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>
5600 </p>
5601 !! end
5602
5603 !! test
5604 Link containing }
5605 !! wikitext
5606 [[Usually caused by a typo (oops}]]
5607 !! html
5608 <p>[[Usually caused by a typo (oops}]]
5609 </p>
5610 !! end
5611
5612 !! article
5613 7% Solution
5614 !! text
5615 Just a test of an article title containing a percent.
5616 !! endarticle
5617
5618 !! test
5619 Link containing % (not as a hex sequence)
5620 !! wikitext
5621 [[7% Solution]]
5622 !! html/php
5623 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5624 </p>
5625 !! html/parsoid
5626 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5627 !! end
5628
5629 # note that the parsoid HTML is identical to the previous test output,
5630 # so the previous test ensures that the html2wt mode will generate the
5631 # "not as a hex sequence" wikitext.
5632 !! test
5633 Link containing % as a single hex sequence interpreted to char
5634 !! options
5635 parsoid=wt2wt,wt2html,html2html
5636 !! wikitext
5637 [[7%25 Solution]]
5638 !! html/php
5639 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5640 </p>
5641 !! html/parsoid
5642 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5643 !!end
5644
5645 !! test
5646 Link containing % as a double hex sequence interpreted to hex sequence
5647 !! wikitext
5648 [[7%2525 Solution]]
5649 !! html
5650 <p>[[7%2525 Solution]]
5651 </p>
5652 !!end
5653
5654 # note that parsoid does not munge anchor text; all non-space
5655 # characters are valid in HTML5 anchors.
5656 !! test
5657 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5658 Example for such a section: == < ==
5659 !! wikitext
5660 [[%23%3c]][[%23%3e]]
5661 !! html/php
5662 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5663 </p>
5664 !! html/parsoid
5665 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5666 !! end
5667
5668 !! test
5669 Link containing "<#" and ">#" as a hex sequences
5670 !! wikitext
5671 [[%3c%23]][[%3e%23]]
5672 !! html
5673 <p>[[%3c%23]][[%3e%23]]
5674 </p>
5675 !! end
5676
5677 !! test
5678 Link containing an equals sign
5679 !! wikitext
5680 [[Special:BookSources/isbn=4-00-026157-6]]
5681 !! html/php
5682 <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>
5683 </p>
5684 !! html/parsoid
5685 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5686 !! end
5687
5688 !! article
5689 Foo~bar
5690 !! text
5691 Just a test of an article title containing a tilde.
5692 !! endarticle
5693
5694 # note that links containing signatures, like [[Foo~~~~]], are
5695 # massaged by the pre-save transform (PST) and so the tildes are never
5696 # seen by the parser.
5697 !! test
5698 Link containing a tilde
5699 !! wikitext
5700 [[Foo~bar]]
5701 !! html/php
5702 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5703 </p>
5704 !! html/parsoid
5705 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5706 !! end
5707
5708 !! test
5709 Link containing double-single-quotes '' (bug 4598)
5710 !! wikitext
5711 [[Lista d''e paise d''o munno]]
5712 !! html/php
5713 <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>
5714 </p>
5715 !! html/parsoid
5716 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5717 !! end
5718
5719 !! test
5720 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5721 !! wikitext
5722 Some [[Link|pretty ''italics'' and stuff]]!
5723 !! html/php
5724 <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>!
5725 </p>
5726 !! html/parsoid
5727 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5728 !! end
5729
5730 !! test
5731 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5732 !! wikitext
5733 ''Some [[Link|pretty ''italics'' and stuff]]!''
5734 !! html
5735 <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>
5736 </p>
5737 !! end
5738
5739 !! test
5740 Link with double quotes in title part (literal) and alternate part (interpreted)
5741 !! wikitext
5742 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5743
5744 [[''Pentecoste'']]
5745
5746 [[''Pentecoste''|Pentecoste]]
5747
5748 [[''Pentecoste''|''Pentecoste'']]
5749 !! html/php
5750 <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>
5751 </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>
5752 </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>
5753 </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>
5754 </p>
5755 !! html/parsoid
5756 <meta typeof="mw:Placeholder"/>
5757 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5758 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5759 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5760 !! end
5761
5762 !! test
5763 Broken image links with HTML captions (bug 39700)
5764 !! wikitext
5765 [[File:Nonexistent|<script></script>]]
5766 [[File:Nonexistent|100px|<script></script>]]
5767 [[File:Nonexistent|&lt;]]
5768 [[File:Nonexistent|a<i>b</i>c]]
5769 !! html
5770 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5771 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5772 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5773 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5774 </p>
5775 !! end
5776
5777 !! test
5778 Plain link to URL
5779 !! wikitext
5780 [[http://www.example.com]]
5781 !! html/php
5782 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5783 </p>
5784 !! html/parsoid
5785 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5786 !! end
5787
5788 !! test
5789 Plain link to URL with link text
5790 !! wikitext
5791 [[http://www.example.com Link text]]
5792 !! html
5793 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5794 </p>
5795 !! end
5796
5797 !! test
5798 Plain link to protocol-relative URL
5799 !! wikitext
5800 [[//www.example.com]]
5801 !! html/php
5802 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5803 </p>
5804 !! html/parsoid
5805 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5806 !! end
5807
5808 !! test
5809 Plain link to protocol-relative URL with link text
5810 !! wikitext
5811 [[//www.example.com Link text]]
5812 !! html
5813 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5814 </p>
5815 !! end
5816
5817 !! test
5818 Plain link to page with question mark in title
5819 !! wikitext
5820 [[A?b]]
5821
5822 [[A?b|Baz]]
5823 !! html
5824 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5825 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5826 </p>
5827 !! end
5828
5829
5830 # I'm fairly sure the expected result here is wrong.
5831 # We want these to be URL links, not pseudo-pages with URLs for titles....
5832 # However the current output is also pretty screwy.
5833 #
5834 # ----
5835 # I'm changing it to match the current output--it arguably makes more
5836 # sense in the light of the test above. Old expected result was:
5837 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5838 #</p>
5839 # But I think this test is bordering on "garbage in, garbage out" anyway.
5840 # -- wtm
5841 !! test
5842 Piped link to URL
5843 !! wikitext
5844 Piped link to URL: [[http://www.example.com|an example URL]]
5845 !! html/php
5846 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5847 </p>
5848 !! html/parsoid
5849 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5850 !! end
5851
5852 !! test
5853 BUG 2: [[page|http://url/]] should link to page, not http://url/
5854 !! wikitext
5855 [[Main Page|http://url/]]
5856 !! html/php
5857 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5858 </p>
5859 !! html/parsoid
5860 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5861 !! end
5862
5863 # Parsoid does not mark self-links, by design.
5864 !! test
5865 BUG 337: Escaped self-links should be bold
5866 !! options
5867 title=[[Bug462]]
5868 !! wikitext
5869 [[Bu&#103;462]] [[Bug462]]
5870 !! html/php
5871 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5872 </p>
5873 !! html/parsoid
5874 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
5875 !! end
5876
5877 !! test
5878 Self-link to section should not be bold
5879 !! options
5880 title=[[Main Page]]
5881 !! wikitext
5882 [[Main Page#section]]
5883 !! html
5884 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5885 </p>
5886 !! end
5887
5888 !! article
5889 00
5890 !! text
5891 This is 00.
5892 !! endarticle
5893
5894 !!test
5895 Self-link to numeric title
5896 !!options
5897 title=[[0]]
5898 !! wikitext
5899 [[0]]
5900 !! html
5901 <p><strong class="selflink">0</strong>
5902 </p>
5903 !!end
5904
5905 !!test
5906 Link to numeric-equivalent title
5907 !!options
5908 title=[[0]]
5909 !! wikitext
5910 [[00]]
5911 !! html
5912 <p><a href="/wiki/00" title="00">00</a>
5913 </p>
5914 !!end
5915
5916 !! test
5917 <nowiki> inside a link
5918 !! wikitext
5919 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5920 !! html
5921 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5922 </p>
5923 !! end
5924
5925 !! test
5926 Non-breaking spaces in title
5927 !! wikitext
5928 [[&nbsp; Main &nbsp; Page &nbsp;]]
5929 !! html
5930 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5931 </p>
5932 !!end
5933
5934 !! test
5935 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5936 !! options
5937 language=ca
5938 !! wikitext
5939 '''[[Main Page]]'''
5940 !! html
5941 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5942 </p>
5943 !! end
5944
5945 !! test
5946 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5947 !! options
5948 language=ca
5949 !! wikitext
5950 ''[[Main Page]]''
5951 !! html
5952 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5953 </p>
5954 !! end
5955
5956 !! test
5957 Internal link with en linktrail: no apostrophes (bug 27473)
5958 !! options
5959 language=en
5960 !! wikitext
5961 [[Something]]'nice
5962 !! html
5963 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5964 </p>
5965 !! end
5966
5967 !! test
5968 Internal link with ca linktrail with apostrophes (bug 27473)
5969 !! options
5970 language=ca
5971 !! wikitext
5972 [[Something]]'nice
5973 !! html
5974 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5975 </p>
5976 !! end
5977
5978 !! test
5979 Internal link with kaa linktrail with apostrophes (bug 27473)
5980 !! options
5981 language=kaa
5982 !! wikitext
5983 [[Something]]'nice
5984 !! html
5985 <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>
5986 </p>
5987 !! end
5988
5989 !! test
5990 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
5991 !! wikitext
5992 [[User:Foo/Test/63636:Bar|Test]]
5993 !! html/php
5994 <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>
5995 </p>
5996 !! html/parsoid
5997 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
5998 !! end
5999
6000 !! test
6001 1. Interaction of linktrail and template encapsulation
6002 !! options
6003 parsoid
6004 !! wikitext
6005 {{echo|[[Foo]]}}l
6006 !! html
6007 <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>
6008 !! end
6009
6010 !! test
6011 2. Interaction of linktrail and template encapsulation
6012 !! options
6013 parsoid
6014 !! wikitext
6015 {{echo|Some [[Fool]]}}s
6016 !! html
6017 <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>
6018 !! end
6019
6020 !! test
6021 3. Interaction of linktrail and template encapsulation
6022 !! options
6023 parsoid
6024 !! wikitext
6025 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6026 !! html
6027 <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>
6028 !! end
6029
6030 !! article
6031 Söfnuður
6032 !! text
6033 Test.
6034 !! endarticle
6035
6036 !! test
6037 Internal link with is link prefix
6038 !! options
6039 language=is
6040 !! wikitext
6041 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6042 !! html
6043 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6044 </p>
6045 !! end
6046
6047 !! article
6048 Mótmælendatrú
6049 !! text
6050 Test.
6051 !! endarticle
6052
6053 !! test
6054 Internal link with is link trail and link prefix
6055 !! options
6056 language=is
6057 !! wikitext
6058 [[mótmælendatrú|xxx]]ar
6059 [[mótmælendatrú]]ar
6060 mótmælenda[[söfnuður]]
6061 mótmælenda[[söfnuður|söfnuðir]]
6062 mótmælenda[[söfnuður|söfnuðir]]xxx
6063 !! html
6064 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6065 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6066 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6067 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6068 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6069 </p>
6070 !! end
6071
6072 !! test
6073 Parsoid link trail escaping
6074 !! options
6075 parsoid=html2wt,html2html
6076 !! wikitext
6077 [[apple]]<nowiki/>s
6078 !! html
6079 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6080 !! end
6081
6082 !! test
6083 Parsoid link prefix escaping
6084 !! options
6085 language=is
6086 parsoid=html2wt,html2html
6087 !! wikitext
6088 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6089 !! html
6090 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6091 !! end
6092
6093 !! test
6094 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6095 !! wikitext
6096 [[Foo| bar]]
6097
6098 [[Foo| ''bar'']]
6099
6100 [http://wp.org foo]
6101
6102 [http://wp.org ''foo'']
6103 !! html
6104 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6105 </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>
6106 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6107 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6108 </p>
6109 !! end
6110
6111 !! test
6112 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6113 !! options
6114 parsoid
6115 !! wikitext
6116 [[Foo|{{echo|a}} b {{echo|c}}]]
6117 !! html
6118 <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>
6119 !! end
6120
6121 !! test
6122 Link with angle bracket after anchor
6123 !! wikitext
6124 [[Foo#<bar>]]
6125 !! html/parsoid
6126 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6127 !! end
6128
6129 ###
6130 ### Interwiki links (see maintenance/interwiki.sql)
6131 ###
6132
6133 !! test
6134 Inline interwiki link
6135 !! wikitext
6136 [[MeatBall:SoftSecurity]]
6137 !! html
6138 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6139 </p>
6140 !! end
6141
6142 !! test
6143 Inline interwiki link with empty title (bug 2372)
6144 !! wikitext
6145 [[MeatBall:]]
6146 !! html
6147 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6148 </p>
6149 !! end
6150
6151 !! test
6152 Interwiki link encoding conversion (bug 1636)
6153 !! wikitext
6154 *[[Wikipedia:ro:Olteni&#0355;a]]
6155 *[[Wikipedia:ro:Olteni&#355;a]]
6156 !! html
6157 <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>
6158 <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>
6159
6160 !! end
6161
6162 !! test
6163 Interwiki link with fragment (bug 2130)
6164 !! wikitext
6165 [[MeatBall:SoftSecurity#foo]]
6166 !! html
6167 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6168 </p>
6169 !! end
6170
6171 # Ideally the wikipedia: prefix here should be proto-relative too
6172 !! test
6173 Different interwiki prefixes mapping to the same URL
6174 !! wikitext
6175 [[:en:Foo]]
6176
6177 [[:en:Foo|Foo]]
6178
6179 [[wikipedia:Foo]]
6180
6181 [[:wikipedia:Foo|Foo]]
6182
6183 [[wikipedia:en:Foo]]
6184
6185 [[:wikipedia:en:Foo]]
6186 !! html/parsoid
6187 <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>
6188
6189 <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>
6190
6191 <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>
6192
6193 <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>
6194
6195 <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>
6196
6197 <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>
6198 !! end
6199
6200 !! test
6201 Interwiki links that cannot be represented in wiki syntax
6202 !! wikitext
6203 [[meatball:ok]]
6204 [[meatball:ok#foo|ok with fragment]]
6205 [[meatball:ok_as_well?|ok ending with ? mark]]
6206 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6207 [http://de.wikipedia.org/wiki/#foo is just fragment]
6208
6209 !! html/parsoid
6210 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6211 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6212 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6213 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6214 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6215 !! end
6216
6217 !! test
6218 Interwiki links: trail
6219 !! options
6220 parsoid
6221 !! wikitext
6222 [[wikipedia:Foo|Ba]]r
6223 !! html
6224 <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>
6225 !! end
6226
6227 ###
6228 ### Interlanguage links
6229 ### Language links (so that searching for '### language' matches..)
6230 ###
6231
6232 !! test
6233 Interlanguage link
6234 !! wikitext
6235 Blah blah blah
6236 [[zh:Chinese]]
6237 !! html
6238 <p>Blah blah blah
6239 </p>
6240 !! end
6241
6242 !! test
6243 Double interlanguage link
6244 !! wikitext
6245 Blah blah blah
6246 [[es:Spanish]]
6247 [[zh:Chinese]]
6248 !! html
6249 <p>Blah blah blah
6250 </p>
6251 !! end
6252
6253 !! test
6254 Interlanguage link, with prefix links
6255 !! options
6256 language=ln
6257 !! wikitext
6258 Blah blah blah
6259 [[zh:Chinese]]
6260 !! html
6261 <p>Blah blah blah
6262 </p>
6263 !! end
6264
6265 !! test
6266 Double interlanguage link, with prefix links (bug 8897)
6267 !! options
6268 language=ln
6269 !! wikitext
6270 Blah blah blah
6271 [[es:Spanish]]
6272 [[zh:Chinese]]
6273 !! html
6274 <p>Blah blah blah
6275 </p>
6276 !! end
6277
6278 !! test
6279 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6280 !! options
6281 language=ln
6282 !! wikitext
6283 [[WW&nbsp;II]]
6284 !! html
6285 <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>
6286 </p>
6287 !! end
6288
6289 !! test
6290 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6291 !! options
6292 parsoid=html2wt
6293 !! wikitext
6294 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6295
6296 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6297 !! html
6298 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6299 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6300 !! end
6301
6302 !! test
6303 Parsoid: handle constructor well
6304 !! options
6305 parsoid
6306 !! wikitext
6307 [[constructor]]
6308
6309 [[constructor:foo]]
6310 !! html
6311 <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>
6312
6313 <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>
6314 !! end
6315
6316 !! test
6317 Parsoid: recognize interlanguage links without a target page
6318 !! options
6319 parsoid
6320 !! wikitext
6321 [[ko:]]
6322 !! html
6323 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6324 !! end
6325
6326 !! test
6327 Parsoid: recognize interwiki links without a target page
6328 !! options
6329 parsoid
6330 !! wikitext
6331 [[:ko:]]
6332 !! html
6333 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6334 !! end
6335
6336 !! test
6337 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6338 !! options
6339 parsoid
6340 !! wikitext
6341 [[en:Foo]]
6342 !! html
6343 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6344 !! end
6345
6346 ###
6347 ### Redirects, Parsoid-only
6348 ###
6349 !! test
6350 1. Simple redirect to page
6351 !! options
6352 parsoid
6353 !! wikitext
6354 #REDIRECT [[Main Page]]
6355 !! html
6356 <link rel="mw:PageProp/redirect" href="./Main_Page">
6357 !! end
6358
6359 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6360 !! test
6361 2. Other redirect variants
6362 !! options
6363 parsoid=wt2html,wt2wt
6364 !! wikitext
6365 #REDIRECT [[Main_Page]]
6366 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6367 !! html
6368 <link rel="mw:PageProp/redirect" href="./Main_Page">
6369 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6370 !! end
6371
6372 !! test
6373 Empty redirect
6374 !! options
6375 parsoid=wt2html,wt2wt
6376 !! wikitext
6377 #REDIRECT [[]]
6378 !! html
6379 <ol>
6380 <li>REDIRECT [[]]</li></ol>
6381 !! end
6382
6383 !! test
6384 Optional colon in #REDIRECT
6385 !! options
6386 # the colon is archaic syntax. we support it for wt2html, but we
6387 # don't care that it roundtrips back to the modern syntax.
6388 parsoid=wt2html,html2html
6389 !! wikitext
6390 #REDIRECT:[[Main Page]]
6391 !! html
6392 <link rel="mw:PageProp/redirect" href="./Main_Page">
6393 !! end
6394
6395 !! test
6396 Whitespace in #REDIRECT with optional colon
6397 !! options
6398 # the colon and gratuitous whitespace is archaic syntax. we support
6399 # it for wt2html, but we don't care that it roundtrips back to the
6400 # modern syntax (without extra whitespace)
6401 parsoid=wt2html,html2html
6402 !! wikitext
6403
6404 #REDIRECT
6405 :
6406 [[Main Page]]
6407 !! html
6408 <link rel="mw:PageProp/redirect" href="./Main_Page">
6409 !! end
6410
6411 !! test
6412 Piped link in #REDIRECT
6413 !! options
6414 # content after piped link is ignored. we support this syntax,
6415 # but don't care that the piped link is lost when we roundtrip this.
6416 parsoid=wt2html
6417 !! wikitext
6418 #REDIRECT [[Main Page|bar]]
6419 !! html
6420 <link rel="mw:PageProp/redirect" href="./Main_Page">
6421 !! end
6422
6423 !! test
6424 Redirect to category
6425 !! options
6426 parsoid=wt2html
6427 !! wikitext
6428 #REDIRECT [[Category:Foo]]
6429 !! html
6430 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6431 !! end
6432
6433 !! test
6434 Redirect to category with URL encoding
6435 !! options
6436 parsoid=wt2html
6437 !! wikitext
6438 #REDIRECT [[Category%3AFoo]]
6439 !! html
6440 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6441 !! end
6442
6443 !! test
6444 Redirect to category page
6445 !! options
6446 parsoid=wt2html,html2html
6447 !! wikitext
6448 #REDIRECT [[:Category:Foo]]
6449 !! html
6450 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6451 !! end
6452
6453 !! test
6454 Redirect to image page (1)
6455 !! options
6456 parsoid
6457 !! wikitext
6458 #REDIRECT [[File:Wiki.png]]
6459 !! html
6460 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6461 !! end
6462
6463 !! test
6464 Redirect to image page (2)
6465 !! options
6466 parsoid
6467 !! wikitext
6468 #REDIRECT [[Image:Wiki.png]]
6469 !! html
6470 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6471 !! end
6472
6473 !! test
6474 Redirect to language
6475 !! options
6476 parsoid
6477 !! wikitext
6478 #REDIRECT [[en:File:Wiki.png]]
6479 !! html
6480 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6481 !! end
6482
6483 !! test
6484 Redirect to interwiki
6485 !! options
6486 parsoid
6487 !! wikitext
6488 #REDIRECT [[meatball:File:Wiki.png]]
6489 !! html
6490 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6491 !! end
6492
6493 !! test
6494 Non-English #REDIRECT
6495 !! options
6496 parsoid
6497 language=is
6498 !! wikitext
6499 #TILVÍSUN [[Main Page]]
6500 !! html
6501 <link rel="mw:PageProp/redirect" href="./Main_Page">
6502 !! end
6503
6504 !! test
6505 New redirect
6506 !! options
6507 parsoid=html2wt
6508 !! wikitext
6509 Foo
6510 #REDIRECT [[Foo]]
6511 !! html
6512 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6513 !! end
6514
6515 ##
6516 ## XHTML tidiness
6517 ###
6518
6519 !! test
6520 <br> to <br />
6521 !! wikitext
6522 1<br>2<br />3
6523 !! html
6524 <p>1<br />2<br />3
6525 </p>
6526 !! end
6527
6528 !! test
6529 Broken br tag sanitization
6530 !! wikitext
6531 </br>
6532 !! html/php
6533 <p>&lt;/br&gt;
6534 </p>
6535 !! end
6536
6537 # TODO: Fix html2html mode (bug 51055)!
6538 !! test
6539 Parsoid: Broken br tag recognition
6540 !! options
6541 parsoid=wt2html
6542 !! wikitext
6543 </br>
6544
6545 <br/ >
6546 !! html/parsoid
6547 <p><br></p>
6548 <p><br/></p>
6549 !! end
6550
6551 !! test
6552 Incorrecly removing closing slashes from correctly formed XHTML
6553 !! wikitext
6554 <br style="clear:both;" />
6555 !! html
6556 <p><br style="clear:both;" />
6557 </p>
6558 !! end
6559
6560 !! test
6561 Failing to transform badly formed HTML into correct XHTML
6562 !! wikitext
6563 <br style="clear: left;">
6564 <br style="clear: right;">
6565 <br style="clear: both;">
6566 !! html
6567 <p><br style="clear: left;" />
6568 <br style="clear: right;" />
6569 <br style="clear: both;" />
6570 </p>
6571 !!end
6572
6573 !! test
6574 Handling html with a div self-closing tag
6575 !! wikitext
6576 <div title />
6577 <div title/>
6578 <div title/ >
6579 <div title=bar />
6580 <div title=bar/>
6581 <div title=bar/ >
6582 !! html
6583 <p>&lt;div title /&gt;
6584 &lt;div title/&gt;
6585 </p>
6586 <div>
6587 <p>&lt;div title=bar /&gt;
6588 &lt;div title=bar/&gt;
6589 </p>
6590 <div title="bar/"></div>
6591 </div>
6592
6593 !! end
6594
6595 !! test
6596 Handling html with a br self-closing tag
6597 !! wikitext
6598 <br title />
6599 <br title/>
6600 <br title/ >
6601 <br title=bar />
6602 <br title=bar/>
6603 <br title=bar/ >
6604 !! html
6605 <p><br title="title" />
6606 <br title="title" />
6607 <br />
6608 <br title="bar" />
6609 <br title="bar" />
6610 <br title="bar/" />
6611 </p>
6612 !! end
6613
6614 !! test
6615 Horizontal ruler (should it add that extra space?)
6616 !! wikitext
6617 <hr>
6618 <hr >
6619 foo <hr
6620 > bar
6621 !! html
6622 <hr />
6623 <hr />
6624 foo <hr /> bar
6625
6626 !! end
6627
6628 !! test
6629 Horizontal ruler -- 4+ dashes render hr
6630 !! wikitext
6631 ----
6632 !! html
6633 <hr />
6634
6635 !! end
6636
6637 !! test
6638 Horizontal ruler -- eats additional dashes on the same line
6639 !! wikitext
6640 ---------
6641 !! html
6642 <hr />
6643
6644 !! end
6645
6646 !! test
6647 Horizontal ruler -- does not collapse dashes on consecutive lines
6648 !! wikitext
6649 ----
6650 ----
6651 !! html
6652 <hr />
6653 <hr />
6654
6655 !! end
6656
6657 !! test
6658 Horizontal ruler -- <4 dashes render as plain text
6659 !! wikitext
6660 ---
6661 !! html
6662 <p>---
6663 </p>
6664 !! end
6665
6666 !! test
6667 Horizontal ruler -- Supports content following dashes on same line
6668 !! wikitext
6669 ---- Foo
6670 !! html
6671 <hr /> Foo
6672
6673 !! end
6674
6675 ###
6676 ### Block-level elements
6677 ###
6678 !! test
6679 Common list
6680 !! wikitext
6681 *Common list
6682 * item 2
6683 *item 3
6684 !! html
6685 <ul><li>Common list</li>
6686 <li> item 2</li>
6687 <li>item 3</li></ul>
6688
6689 !! end
6690
6691 !! test
6692 Numbered list
6693 !! wikitext
6694 #Numbered list
6695 #item 2
6696 # item 3
6697 !! html
6698 <ol><li>Numbered list</li>
6699 <li>item 2</li>
6700 <li> item 3</li></ol>
6701
6702 !! end
6703
6704 !! test
6705 Mixed list
6706 !! wikitext
6707 *Mixed list
6708 *# with numbers
6709 ** and bullets
6710 *# and numbers
6711 *bullets again
6712 **bullet level 2
6713 ***bullet level 3
6714 ***#Number on level 4
6715 **bullet level 2
6716 **#Number on level 3
6717 **#Number on level 3
6718 *#number level 2
6719 *Level 1
6720 *** Level 3
6721 #** Level 3, but ordered
6722 !! html
6723 <ul><li>Mixed list
6724 <ol><li> with numbers</li></ol>
6725 <ul><li> and bullets</li></ul>
6726 <ol><li> and numbers</li></ol></li>
6727 <li>bullets again
6728 <ul><li>bullet level 2
6729 <ul><li>bullet level 3
6730 <ol><li>Number on level 4</li></ol></li></ul></li>
6731 <li>bullet level 2
6732 <ol><li>Number on level 3</li>
6733 <li>Number on level 3</li></ol></li></ul>
6734 <ol><li>number level 2</li></ol></li>
6735 <li>Level 1
6736 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6737 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6738
6739 !! end
6740
6741 !! test
6742 Nested lists 1
6743 !! wikitext
6744 *foo
6745 **bar
6746 !! html
6747 <ul><li>foo
6748 <ul><li>bar</li></ul></li></ul>
6749
6750 !! end
6751
6752 !! test
6753 Nested lists 2
6754 !! wikitext
6755 **foo
6756 *bar
6757 !! html
6758 <ul><li><ul><li>foo</li></ul></li>
6759 <li>bar</li></ul>
6760
6761 !! end
6762
6763 !! test
6764 Nested lists 3 (first element empty)
6765 !! wikitext
6766 *
6767 **bar
6768 !! html
6769 <ul><li>
6770 <ul><li>bar</li></ul></li></ul>
6771
6772 !! end
6773
6774 !! test
6775 Nested lists 4 (first element empty)
6776 !! wikitext
6777 **
6778 *bar
6779 !! html
6780 <ul><li><ul><li></li></ul></li>
6781 <li>bar</li></ul>
6782
6783 !! end
6784
6785 !! test
6786 Nested lists 5 (both elements empty)
6787 !! wikitext
6788 **
6789 *
6790 !! html
6791 <ul><li><ul><li></li></ul></li>
6792 <li></li></ul>
6793
6794 !! end
6795
6796 !! test
6797 Nested lists 6 (both elements empty)
6798 !! wikitext
6799 *
6800 **
6801 !! html
6802 <ul><li>
6803 <ul><li></li></ul></li></ul>
6804
6805 !! end
6806
6807 !! test
6808 Nested lists 7 (skip initial nesting levels)
6809 !! wikitext
6810 *** foo
6811 !! html
6812 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6813
6814 !! end
6815
6816 !! test
6817 Nested lists 8 (multiple nesting transitions)
6818 !! wikitext
6819 * foo
6820 *** bar
6821 ** baz
6822 * boo
6823 !! html
6824 <ul><li> foo
6825 <ul><li><ul><li> bar</li></ul></li>
6826 <li> baz</li></ul></li>
6827 <li> boo</li></ul>
6828
6829 !! end
6830
6831 !! test
6832 1. Lists with start-of-line-transparent tokens before bullets: Comments
6833 !! wikitext
6834 *foo
6835 *<!--cmt-->bar
6836 <!--cmt-->*baz
6837 !! html
6838 <ul><li>foo</li>
6839 <li>bar</li>
6840 <li>baz</li></ul>
6841
6842 !! end
6843
6844 !! test
6845 2. Lists with start-of-line-transparent tokens before bullets: Template close
6846 !! wikitext
6847 *foo {{echo|bar
6848 }}*baz
6849 !! html
6850 <ul><li>foo bar</li>
6851 <li>baz</li></ul>
6852
6853 !! end
6854
6855 !! test
6856 List items are not parsed correctly following a <pre> block (bug 785)
6857 !! wikitext
6858 * <pre>foo</pre>
6859 * <pre>bar</pre>
6860 * zar
6861 !! html
6862 <ul><li> <pre>foo</pre></li>
6863 <li> <pre>bar</pre></li>
6864 <li> zar</li></ul>
6865
6866 !! end
6867
6868 !! test
6869 List items from template
6870 !! wikitext
6871
6872 {{inner list}}
6873 * item 2
6874
6875 * item 0
6876 {{inner list}}
6877 * item 2
6878
6879 * item 0
6880 * notSOL{{inner list}}
6881 * item 2
6882 !! html
6883 <ul><li> item 1</li>
6884 <li> item 2</li></ul>
6885 <ul><li> item 0</li>
6886 <li> item 1</li>
6887 <li> item 2</li></ul>
6888 <ul><li> item 0</li>
6889 <li> notSOL</li>
6890 <li> item 1</li>
6891 <li> item 2</li></ul>
6892
6893 !! end
6894
6895 !! test
6896 List interrupted by empty line or heading
6897 !! wikitext
6898 * foo
6899
6900 ** bar
6901 == A heading ==
6902 * Another list item
6903 !! html
6904 <ul><li> foo</li></ul>
6905 <ul><li><ul><li> bar</li></ul></li></ul>
6906 <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>
6907 <ul><li> Another list item</li></ul>
6908
6909 !!end
6910
6911 !!test
6912 Multiple list tags generated by templates
6913 !! wikitext
6914 {{echo|<li>}}a
6915 {{echo|<li>}}b
6916 {{echo|<li>}}c
6917 !! html
6918 <li>a
6919 <li>b
6920 <li>c</li>
6921 </li>
6922 </li>
6923
6924 !!end
6925
6926 !!test
6927 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6928 !! wikitext
6929 *a
6930 <!--This line will NOT split the list-->
6931 *b
6932 <!--This line will NOT split the list either-->
6933 *c
6934 <!--foo--> <!----> <!--This line NOT split the list either-->
6935 *d
6936 !! html
6937 <ul><li>a</li>
6938 <li>b</li>
6939 <li>c</li>
6940 <li>d</li></ul>
6941
6942 !!end
6943
6944 !!test
6945 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6946 !! wikitext
6947 *a
6948 <!--This line will NOT split the list-->
6949 *b
6950 <!--This line will NOT split the list either-->
6951 *c
6952 <!--foo--> <!----> <!--This line NOT split the list
6953 either-->
6954 *d
6955 !! html
6956 <ul><li>a</li>
6957 <li>b</li>
6958 <li>c</li>
6959 <li>d</li></ul>
6960
6961 !!end
6962
6963 !!test
6964 Test the li-hack
6965 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6966 !!options
6967 parsoid=wt2html,wt2wt
6968 !! wikitext
6969 * foo
6970 * <li>li-hack
6971 * {{echo|<li>templated li-hack}}
6972 * <!--foo--> <li> unsupported li-hack with preceding comments
6973
6974 <ul>
6975 <li><li>not a li-hack
6976 </li>
6977 </ul>
6978 !! html
6979 <ul>
6980 <li> foo</li>
6981 <li>li-hack</li>
6982 <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>
6983 <li> <!--foo--> </li>
6984 <li> li-hack with preceding comments</li>
6985 </ul>
6986
6987 <ul>
6988 <li></li>
6989 <li>not a li-hack
6990 </li>
6991 </ul>
6992 !!end
6993
6994 !! test
6995 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6996 !! options
6997 parsoid
6998 !! wikitext
6999 # foo
7000 ## bar
7001 * foo
7002 ** bar
7003 : foo
7004 :: bar
7005 !! html
7006 <ol>
7007 <li> foo<ol>
7008 <li> bar</li>
7009 </ol></li>
7010 </ol><ul>
7011 <li> foo<ul>
7012 <li> bar</li>
7013 </ul></li>
7014 </ul><dl>
7015 <dd> foo<dl>
7016 <dd> bar</dd>
7017 </dl></dd>
7018 </dl>
7019 !! end
7020
7021 !! test
7022 Parsoid: Test of whitespace serialization with Templated bullets
7023 !! options
7024 parsoid
7025 !! wikitext
7026 * {{bullet}}
7027 !! html
7028 <ul>
7029 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7030 </ul>
7031 !! end
7032
7033 # ------------------------------------------------------------------------
7034 # The next set of tests are about Parsoid's ability to handle badly nested
7035 # tags (parse, minimize scope of fixup, and roundtrip back)
7036 # ------------------------------------------------------------------------
7037
7038 !! test
7039 Unbalanced closing block tags break a list
7040 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7041 !! wikitext
7042 <div>
7043 *a</div><div>
7044 *b</div>
7045 !! html/parsoid
7046 <div>
7047 <ul>
7048 <li>a
7049 </li>
7050 </ul></div><div>
7051 <ul>
7052 <li>b
7053 </li>
7054 </ul></div>
7055 !! end
7056
7057 !! test
7058 Unbalanced closing non-block tags don't break a list
7059 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7060 !! wikitext
7061 <span>
7062 *a</span><span>
7063 *b</span>
7064 !! html/parsoid
7065 <p><span></span>
7066 </p>
7067 <ul>
7068 <li>a<span></span>
7069 </li>
7070 <li>b
7071 </li>
7072 </ul>
7073 !! end
7074
7075 !! test
7076 Unclosed formatting tags that straddle lists are closed and reopened
7077 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7078 !! wikitext
7079 # <s> a
7080 # b </s>
7081 !! html/parsoid
7082 <ol>
7083 <li> <s> a </s>
7084 </li>
7085 <li> <s> b </s>
7086 </li>
7087 </ol>
7088 !! end
7089
7090 !!test
7091 List embedded in a non-block tag
7092 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7093 !! wikitext
7094 <small>
7095 * foo
7096 </small>
7097 !! html/parsoid
7098 <p><small></small></p>
7099 <small>
7100 <ul>
7101 <li> foo</li>
7102 </ul>
7103 </small>
7104 <p><small></small></p>
7105 !!end
7106
7107 !! test
7108 Table with missing opening <tr> tag
7109 !! options
7110 parsoid=wt2html,wt2wt
7111 !! wikitext
7112 <table>
7113 <td>foo</td>
7114 </tr>
7115 </table>
7116 !! html/parsoid
7117 <table>
7118 <tr>
7119 <td>foo</td>
7120 </tr>
7121 </table>
7122 !! end
7123
7124 ###
7125 ### Magic Words
7126 ###
7127
7128 # Note that the current date is hard-coded as
7129 # 1970-01-01T00:02:03Z (a Thursday)
7130 # when running parser tests. The timezone is also fixed to GMT, so
7131 # local date will be identical to current date.
7132
7133 !! test
7134 Magic Word: {{CURRENTDAY}}
7135 !! wikitext
7136 {{CURRENTDAY}}
7137 !! html
7138 <p>1
7139 </p>
7140 !! end
7141
7142 !! test
7143 Magic Word: {{CURRENTDAY2}}
7144 !! wikitext
7145 {{CURRENTDAY2}}
7146 !! html
7147 <p>01
7148 </p>
7149 !! end
7150
7151 !! test
7152 Magic Word: {{CURRENTDAYNAME}}
7153 !! wikitext
7154 {{CURRENTDAYNAME}}
7155 !! html
7156 <p>Thursday
7157 </p>
7158 !! end
7159
7160 !! test
7161 Magic Word: {{CURRENTDOW}}
7162 !! wikitext
7163 {{CURRENTDOW}}
7164 !! html
7165 <p>4
7166 </p>
7167 !! end
7168
7169 !! test
7170 Magic Word: {{CURRENTMONTH}}
7171 !! wikitext
7172 {{CURRENTMONTH}}
7173 !! html
7174 <p>01
7175 </p>
7176 !! end
7177
7178 !! test
7179 Magic Word: {{CURRENTMONTH1}}
7180 !! wikitext
7181 {{CURRENTMONTH1}}
7182 !! html
7183 <p>1
7184 </p>
7185 !! end
7186
7187 !! test
7188 Magic Word: {{CURRENTMONTHABBREV}}
7189 !! wikitext
7190 {{CURRENTMONTHABBREV}}
7191 !! html
7192 <p>Jan
7193 </p>
7194 !! end
7195
7196 !! test
7197 Magic Word: {{CURRENTMONTHNAME}}
7198 !! wikitext
7199 {{CURRENTMONTHNAME}}
7200 !! html
7201 <p>January
7202 </p>
7203 !! end
7204
7205 !! test
7206 Magic Word: {{CURRENTMONTHNAMEGEN}}
7207 !! wikitext
7208 {{CURRENTMONTHNAMEGEN}}
7209 !! html
7210 <p>January
7211 </p>
7212 !! end
7213
7214 !! test
7215 Magic Word: {{CURRENTTIME}}
7216 !! wikitext
7217 {{CURRENTTIME}}
7218 !! html
7219 <p>00:02
7220 </p>
7221 !! end
7222
7223 !! test
7224 Magic Word: {{CURRENTHOUR}}
7225 !! wikitext
7226 {{CURRENTHOUR}}
7227 !! html
7228 <p>00
7229 </p>
7230 !! end
7231
7232 !! test
7233 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7234 !! wikitext
7235 {{CURRENTWEEK}}
7236 !! html
7237 <p>1
7238 </p>
7239 !! end
7240
7241 !! test
7242 Magic Word: {{CURRENTYEAR}}
7243 !! wikitext
7244 {{CURRENTYEAR}}
7245 !! html
7246 <p>1970
7247 </p>
7248 !! end
7249
7250 !! test
7251 Magic Word: {{CURRENTTIMESTAMP}}
7252 !! wikitext
7253 {{CURRENTTIMESTAMP}}
7254 !! html
7255 <p>19700101000203
7256 </p>
7257 !! end
7258
7259 !! test
7260 Magic Words LOCAL (UTC)
7261 !! wikitext
7262 * {{LOCALMONTH}}
7263 * {{LOCALMONTH1}}
7264 * {{LOCALMONTHNAME}}
7265 * {{LOCALMONTHNAMEGEN}}
7266 * {{LOCALMONTHABBREV}}
7267 * {{LOCALDAY}}
7268 * {{LOCALDAY2}}
7269 * {{LOCALDAYNAME}}
7270 * {{LOCALYEAR}}
7271 * {{LOCALTIME}}
7272 * {{LOCALHOUR}}
7273 * {{LOCALWEEK}}
7274 * {{LOCALDOW}}
7275 * {{LOCALTIMESTAMP}}
7276 !! html
7277 <ul><li> 01</li>
7278 <li> 1</li>
7279 <li> January</li>
7280 <li> January</li>
7281 <li> Jan</li>
7282 <li> 1</li>
7283 <li> 01</li>
7284 <li> Thursday</li>
7285 <li> 1970</li>
7286 <li> 00:02</li>
7287 <li> 00</li>
7288 <li> 1</li>
7289 <li> 4</li>
7290 <li> 19700101000203</li></ul>
7291
7292 !! end
7293
7294 !! test
7295 Magic Word: {{FULLPAGENAME}}
7296 !! options
7297 title=[[User:Ævar Arnfjörð Bjarmason]]
7298 !! wikitext
7299 {{FULLPAGENAME}}
7300 !! html
7301 <p>User:Ævar Arnfjörð Bjarmason
7302 </p>
7303 !! end
7304
7305 !! test
7306 Magic Word: {{FULLPAGENAMEE}}
7307 !! options
7308 title=[[User:Ævar Arnfjörð Bjarmason]]
7309 !! wikitext
7310 {{FULLPAGENAMEE}}
7311 !! html
7312 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7313 </p>
7314 !! end
7315
7316 !! test
7317 Magic Word: {{TALKSPACE}}
7318 !! options
7319 title=[[User:Ævar Arnfjörð Bjarmason]]
7320 !! wikitext
7321 {{TALKSPACE}}
7322 !! html
7323 <p>User talk
7324 </p>
7325 !! end
7326
7327 !! test
7328 Magic Word: {{TALKSPACE}}, same namespace
7329 !! options
7330 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7331 !! wikitext
7332 {{TALKSPACE}}
7333 !! html
7334 <p>User talk
7335 </p>
7336 !! end
7337
7338 !! test
7339 Magic Word: {{TALKSPACE}}, main namespace
7340 !! options
7341 title=[[Parser Test]]
7342 !! wikitext
7343 {{TALKSPACE}}
7344 !! html
7345 <p>Talk
7346 </p>
7347 !! end
7348
7349 !! test
7350 Magic Word: {{TALKSPACEE}}
7351 !! options
7352 title=[[User:Ævar Arnfjörð Bjarmason]]
7353 !! wikitext
7354 {{TALKSPACEE}}
7355 !! html
7356 <p>User_talk
7357 </p>
7358 !! end
7359
7360 !! test
7361 Magic Word: {{SUBJECTSPACE}}
7362 !! options
7363 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7364 !! wikitext
7365 {{SUBJECTSPACE}}
7366 !! html
7367 <p>User
7368 </p>
7369 !! end
7370
7371 !! test
7372 Magic Word: {{SUBJECTSPACE}}, same namespace
7373 !! options
7374 title=[[User:Ævar Arnfjörð Bjarmason]]
7375 !! wikitext
7376 {{SUBJECTSPACE}}
7377 !! html
7378 <p>User
7379 </p>
7380 !! end
7381
7382 !! test
7383 Magic Word: {{SUBJECTSPACE}}, main namespace
7384 !! options
7385 title=[[Parser Test]]
7386 !! wikitext
7387 {{SUBJECTSPACE}}
7388 !! html
7389
7390 !! end
7391
7392 !! test
7393 Magic Word: {{SUBJECTSPACEE}}
7394 !! options
7395 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7396 !! wikitext
7397 {{SUBJECTSPACEE}}
7398 !! html
7399 <p>User
7400 </p>
7401 !! end
7402
7403 !! test
7404 Magic Word: {{NAMESPACE}}
7405 !! options
7406 title=[[User:Ævar Arnfjörð Bjarmason]]
7407 !! wikitext
7408 {{NAMESPACE}}
7409 !! html
7410 <p>User
7411 </p>
7412 !! end
7413
7414 !! test
7415 Magic Word: {{NAMESPACEE}}
7416 !! options
7417 title=[[User:Ævar Arnfjörð Bjarmason]]
7418 !! wikitext
7419 {{NAMESPACEE}}
7420 !! html
7421 <p>User
7422 </p>
7423 !! end
7424
7425 !! test
7426 Magic Word: {{NAMESPACENUMBER}}
7427 !! options
7428 title=[[User:Ævar Arnfjörð Bjarmason]]
7429 !! wikitext
7430 {{NAMESPACENUMBER}}
7431 !! html
7432 <p>2
7433 </p>
7434 !! end
7435
7436 !! test
7437 Magic Word: {{SUBPAGENAME}}
7438 !! options
7439 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7440 !! wikitext
7441 {{SUBPAGENAME}}
7442 !! html
7443 <p>sub ö
7444 </p>
7445 !! end
7446
7447 !! test
7448 Magic Word: {{SUBPAGENAMEE}}
7449 !! options
7450 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7451 !! wikitext
7452 {{SUBPAGENAMEE}}
7453 !! html
7454 <p>sub_%C3%B6
7455 </p>
7456 !! end
7457
7458 !! test
7459 Magic Word: {{ROOTPAGENAME}}
7460 !! options
7461 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7462 !! wikitext
7463 {{ROOTPAGENAME}}
7464 !! html
7465 <p>Ævar Arnfjörð Bjarmason
7466 </p>
7467 !! end
7468
7469 !! test
7470 Magic Word: {{ROOTPAGENAMEE}}
7471 !! options
7472 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7473 !! wikitext
7474 {{ROOTPAGENAMEE}}
7475 !! html
7476 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7477 </p>
7478 !! end
7479
7480 !! test
7481 Magic Word: {{BASEPAGENAME}}
7482 !! options
7483 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7484 !! wikitext
7485 {{BASEPAGENAME}}
7486 !! html
7487 <p>Ævar Arnfjörð Bjarmason
7488 </p>
7489 !! end
7490
7491 !! test
7492 Magic Word: {{BASEPAGENAMEE}}
7493 !! options
7494 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7495 !! wikitext
7496 {{BASEPAGENAMEE}}
7497 !! html
7498 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7499 </p>
7500 !! end
7501
7502 !! test
7503 Magic Word: {{TALKPAGENAME}}
7504 !! options
7505 title=[[User:Ævar Arnfjörð Bjarmason]]
7506 !! wikitext
7507 {{TALKPAGENAME}}
7508 !! html
7509 <p>User talk:Ævar Arnfjörð Bjarmason
7510 </p>
7511 !! end
7512
7513 !! test
7514 Magic Word: {{TALKPAGENAMEE}}
7515 !! options
7516 title=[[User:Ævar Arnfjörð Bjarmason]]
7517 !! wikitext
7518 {{TALKPAGENAMEE}}
7519 !! html
7520 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7521 </p>
7522 !! end
7523
7524 !! test
7525 Magic Word: {{SUBJECTPAGENAME}}
7526 !! options
7527 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7528 !! wikitext
7529 {{SUBJECTPAGENAME}}
7530 !! html
7531 <p>User:Ævar Arnfjörð Bjarmason
7532 </p>
7533 !! end
7534
7535 !! test
7536 Magic Word: {{SUBJECTPAGENAMEE}}
7537 !! options
7538 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7539 !! wikitext
7540 {{SUBJECTPAGENAMEE}}
7541 !! html
7542 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7543 </p>
7544 !! end
7545
7546 !! test
7547 Magic Word: {{NUMBEROFFILES}}
7548 !! wikitext
7549 {{NUMBEROFFILES}}
7550 !! html
7551 <p>5
7552 </p>
7553 !! end
7554
7555 !! test
7556 Magic Word: {{PAGENAME}}
7557 !! options
7558 title=[[User:Ævar Arnfjörð Bjarmason]]
7559 !! wikitext
7560 {{PAGENAME}}
7561 !! html
7562 <p>Ævar Arnfjörð Bjarmason
7563 </p>
7564 !! end
7565
7566 !! test
7567 Magic Word: {{PAGENAME}} with metacharacters
7568 !! options
7569 title=[['foo & bar = baz']]
7570 !! wikitext
7571 ''{{PAGENAME}}''
7572 !! html
7573 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7574 </p>
7575 !! end
7576
7577 !! test
7578 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7579 !! options
7580 title=[[*RFC 1234 http://example.com/]]
7581 !! wikitext
7582 {{PAGENAME}}
7583 !! html
7584 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7585 </p>
7586 !! end
7587
7588 !! test
7589 Magic Word: {{PAGENAMEE}}
7590 !! options
7591 title=[[User:Ævar Arnfjörð Bjarmason]]
7592 !! wikitext
7593 {{PAGENAMEE}}
7594 !! html
7595 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7596 </p>
7597 !! end
7598
7599 !! test
7600 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7601 !! options
7602 title=[[*RFC 1234 http://example.com/]]
7603 !! wikitext
7604 {{PAGENAMEE}}
7605 !! html
7606 <p>&#42;RFC_1234_http&#58;//example.com/
7607 </p>
7608 !! end
7609
7610 !! test
7611 Magic Word: {{REVISIONID}}
7612 !! wikitext
7613 {{REVISIONID}}
7614 !! html
7615 <p>1337
7616 </p>
7617 !! end
7618
7619 !! test
7620 Magic Word: {{SCRIPTPATH}}
7621 !! wikitext
7622 {{SCRIPTPATH}}
7623 !! html
7624 <p>/
7625 </p>
7626 !! end
7627
7628 !! test
7629 Magic Word: {{STYLEPATH}}
7630 !! wikitext
7631 {{STYLEPATH}}
7632 !! html
7633 <p>/skins
7634 </p>
7635 !! end
7636
7637 !! test
7638 Magic Word: {{SERVER}}
7639 !! wikitext
7640 {{SERVER}}
7641 !! html
7642 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7643 </p>
7644 !! end
7645
7646 !! test
7647 Magic Word: {{SERVERNAME}}
7648 !! wikitext
7649 {{SERVERNAME}}
7650 !! html
7651 <p>example.org
7652 </p>
7653 !! end
7654
7655 !! test
7656 Magic Word: {{SITENAME}}
7657 !! wikitext
7658 {{SITENAME}}
7659 !! html
7660 <p>MediaWiki
7661 </p>
7662 !! end
7663
7664 !! test
7665 Case-sensitive magic words, when cased differently, should just be template transclusions
7666 !! wikitext
7667 {{CurrentMonth}}
7668 {{currentday}}
7669 {{cURreNTweEK}}
7670 {{currentHour}}
7671 !! html
7672 <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>
7673 <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>
7674 <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>
7675 <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>
7676 </p>
7677 !! end
7678
7679 !! test
7680 Case-insensitive magic words should still work with weird casing.
7681 !! wikitext
7682 {{sErVeRNaMe}}
7683 {{LCFirst:AOEU}}
7684 {{ucFIRST:aoeu}}
7685 {{SERver}}
7686 !! html
7687 <p>example.org
7688 aOEU
7689 Aoeu
7690 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7691 </p>
7692 !! end
7693
7694 !! test
7695 Namespace 1 {{ns:1}}
7696 !! wikitext
7697 {{ns:1}}
7698 !! html
7699 <p>Talk
7700 </p>
7701 !! end
7702
7703 !! test
7704 Namespace 1 {{ns:01}}
7705 !! wikitext
7706 {{ns:01}}
7707 !! html
7708 <p>Talk
7709 </p>
7710 !! end
7711
7712 !! test
7713 Namespace 0 {{ns:0}} (bug 4783)
7714 !! wikitext
7715 {{ns:0}}
7716 !! html
7717
7718 !! end
7719
7720 !! test
7721 Namespace 0 {{ns:00}} (bug 4783)
7722 !! wikitext
7723 {{ns:00}}
7724 !! html
7725
7726 !! end
7727
7728 !! test
7729 Namespace -1 {{ns:-1}}
7730 !! wikitext
7731 {{ns:-1}}
7732 !! html
7733 <p>Special
7734 </p>
7735 !! end
7736
7737 !! test
7738 Namespace User {{ns:User}}
7739 !! wikitext
7740 {{ns:User}}
7741 !! html
7742 <p>User
7743 </p>
7744 !! end
7745
7746 !! test
7747 Namespace User talk {{ns:User_talk}}
7748 !! wikitext
7749 {{ns:User_talk}}
7750 !! html
7751 <p>User talk
7752 </p>
7753 !! end
7754
7755 !! test
7756 Namespace User talk {{ns:uSeR tAlK}}
7757 !! wikitext
7758 {{ns:uSeR tAlK}}
7759 !! html
7760 <p>User talk
7761 </p>
7762 !! end
7763
7764 !! test
7765 Namespace File {{ns:File}}
7766 !! wikitext
7767 {{ns:File}}
7768 !! html
7769 <p>File
7770 </p>
7771 !! end
7772
7773 !! test
7774 Namespace File {{ns:Image}}
7775 !! wikitext
7776 {{ns:Image}}
7777 !! html
7778 <p>File
7779 </p>
7780 !! end
7781
7782 !! test
7783 Namespace (lang=de) Benutzer {{ns:User}}
7784 !! options
7785 language=de
7786 !! wikitext
7787 {{ns:User}}
7788 !! html
7789 <p>Benutzer
7790 </p>
7791 !! end
7792
7793 !! test
7794 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7795 !! options
7796 language=de
7797 !! wikitext
7798 {{ns:3}}
7799 !! html
7800 <p>Benutzer Diskussion
7801 </p>
7802 !! end
7803
7804
7805 !! test
7806 Urlencode
7807 !! wikitext
7808 {{urlencode:hi world?!}}
7809 {{urlencode:hi world?!|WIKI}}
7810 {{urlencode:hi world?!|PATH}}
7811 {{urlencode:hi world?!|QUERY}}
7812 !! html
7813 <p>hi+world%3F%21
7814 hi_world%3F!
7815 hi%20world%3F%21
7816 hi+world%3F%21
7817 </p>
7818 !! end
7819
7820 !! test
7821 Magic Word: prioritize type info over data-parsoid
7822 !! options
7823 parsoid=html2wt
7824 !! wikitext
7825 __FORCETOC__
7826 !! html
7827 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7828 !! end
7829
7830 !! test
7831 Magic Word: serialize on separate line (parsoid)
7832 !! options
7833 parsoid=wt2wt,html2wt
7834 !! wikitext
7835 foo
7836 __NOTOC__
7837 bar
7838 !! html
7839 foo<meta property="mw:PageProp/notoc"/>bar
7840 !! end
7841
7842 !! test
7843 Magic Word: rt non-english wikis
7844 !! options
7845 parsoid=wt2wt
7846 language=de
7847 !! wikitext
7848 __NOEDITSECTION__
7849 !! html
7850 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7851 !! end
7852
7853 ###
7854 ### Magic links
7855 ###
7856 !! test
7857 Magic links: internal link to RFC (bug 479)
7858 !! wikitext
7859 [[RFC 123]]
7860 !! html
7861 <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>
7862 </p>
7863 !! end
7864
7865 !! test
7866 Magic links: RFC (bug 479)
7867 !! wikitext
7868 RFC 822
7869 !! html
7870 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7871 </p>
7872 !! end
7873
7874 !! test
7875 Magic links: ISBN (bug 1937)
7876 !! wikitext
7877 ISBN 0-306-40615-2
7878 !! html
7879 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7880 </p>
7881 !! end
7882
7883 !! test
7884 Magic links: PMID incorrectly converts space to underscore
7885 !! wikitext
7886 PMID 1234
7887 !! html
7888 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7889 </p>
7890 !! end
7891
7892 ###
7893 ### Templates
7894 ####
7895
7896 !! test
7897 Nonexistent template
7898 !! wikitext
7899 {{thistemplatedoesnotexist}}
7900 !! html
7901 <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>
7902 </p>
7903 !! end
7904
7905 !! test
7906 Template with invalid target containing tags
7907 !! wikitext
7908 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7909 !! html
7910 <p>{{a<b>b</b>|foo|a=b|a = b}}
7911 </p>
7912 !! end
7913
7914 !! test
7915 Template with invalid target containing unclosed tag
7916 !! wikitext
7917 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7918 !! html
7919 <p>{{a<b>|foo|a=b|a = b}}</b>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Template with invalid target containing wikilink
7925 !! wikitext
7926 {{[[Main Page]]}}
7927 !! html/php
7928 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7929 </p>
7930 !! html/parsoid
7931 <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>
7932 !! end
7933
7934 !! article
7935 Template:test
7936 !! text
7937 This is a test template
7938 !! endarticle
7939
7940 !! test
7941 Simple template
7942 !! wikitext
7943 {{test}}
7944 !! html
7945 <p>This is a test template
7946 </p>
7947 !! end
7948
7949 !! test
7950 Template with explicit namespace
7951 !! wikitext
7952 {{Template:test}}
7953 !! html
7954 <p>This is a test template
7955 </p>
7956 !! end
7957
7958
7959 !! article
7960 Template:paramtest
7961 !! text
7962 This is a test template with parameter {{{param}}}
7963 !! endarticle
7964
7965 !! test
7966 Template parameter
7967 !! wikitext
7968 {{paramtest|param=foo}}
7969 !! html
7970 <p>This is a test template with parameter foo
7971 </p>
7972 !! end
7973
7974 !! article
7975 Template:paramtestnum
7976 !! text
7977 [[{{{1}}}|{{{2}}}]]
7978 !! endarticle
7979
7980 !! test
7981 Template unnamed parameter
7982 !! wikitext
7983 {{paramtestnum|Main Page|the main page}}
7984 !! html
7985 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7986 </p>
7987 !! end
7988
7989 !! article
7990 Template:templatesimple
7991 !! text
7992 (test)
7993 !! endarticle
7994
7995 !! article
7996 Template:templateredirect
7997 !! text
7998 #redirect [[Template:templatesimple]]
7999 !! endarticle
8000
8001 !! article
8002 Template:templateasargtestnum
8003 !! text
8004 {{{{{1}}}}}
8005 !! endarticle
8006
8007 !! article
8008 Template:templateasargtest
8009 !! text
8010 {{template{{{templ}}}}}
8011 !! endarticle
8012
8013 !! article
8014 Template:templateasargtest2
8015 !! text
8016 {{{{{templ}}}}}
8017 !! endarticle
8018
8019 !! test
8020 Template with template name as unnamed argument
8021 !! wikitext
8022 {{templateasargtestnum|templatesimple}}
8023 !! html
8024 <p>(test)
8025 </p>
8026 !! end
8027
8028 !! test
8029 Template with template name as argument
8030 !! wikitext
8031 {{templateasargtest|templ=simple}}
8032 !! html
8033 <p>(test)
8034 </p>
8035 !! end
8036
8037 !! test
8038 Template with template name as argument (2)
8039 !! wikitext
8040 {{templateasargtest2|templ=templatesimple}}
8041 !! html
8042 <p>(test)
8043 </p>
8044 !! end
8045
8046 !! article
8047 Template:templateasargtestdefault
8048 !! text
8049 {{{{{templ|templatesimple}}}}}
8050 !! endarticle
8051
8052 !! article
8053 Template:templa
8054 !! text
8055 '''templ'''
8056 !! endarticle
8057
8058 !! test
8059 Template with default value
8060 !! wikitext
8061 {{templateasargtestdefault}}
8062 !! html
8063 <p>(test)
8064 </p>
8065 !! end
8066
8067 !! test
8068 Template with default value (value set)
8069 !! wikitext
8070 {{templateasargtestdefault|templ=templa}}
8071 !! html
8072 <p><b>templ</b>
8073 </p>
8074 !! end
8075
8076 !! test
8077 Template redirect
8078 !! wikitext
8079 {{templateredirect}}
8080 !! html
8081 <p>(test)
8082 </p>
8083 !! end
8084
8085 !! test
8086 Template with argument in separate line
8087 !! wikitext
8088 {{ templateasargtest |
8089 templ = simple }}
8090 !! html
8091 <p>(test)
8092 </p>
8093 !! end
8094
8095 !! test
8096 Template with complex template as argument
8097 !! wikitext
8098 {{paramtest|
8099 param ={{ templateasargtest |
8100 templ = simple }}}}
8101 !! html
8102 <p>This is a test template with parameter (test)
8103 </p>
8104 !! end
8105
8106 !! test
8107 Template with thumb image (with link in description)
8108 !! wikitext
8109 {{paramtest|
8110 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8111 !! html
8112 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>
8113
8114 !! end
8115
8116 !! article
8117 Template:complextemplate
8118 !! text
8119 {{{1}}} {{paramtest|
8120 param ={{{param}}}}}
8121 !! endarticle
8122
8123 !! test
8124 Template with complex arguments
8125 !! wikitext
8126 {{complextemplate|
8127 param ={{ templateasargtest |
8128 templ = simple }}|[[Template:complextemplate|link]]}}
8129 !! html
8130 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8131 </p>
8132 !! end
8133
8134 !! test
8135 BUG 553: link with two variables in a piped link
8136 !! wikitext
8137 {|
8138 |[[{{{1}}}|{{{2}}}]]
8139 |}
8140 !! html
8141 <table>
8142 <tr>
8143 <td>[[{{{1}}}|{{{2}}}]]
8144 </td></tr></table>
8145
8146 !! end
8147
8148 !! test
8149 Magic variable as template parameter
8150 !! wikitext
8151 {{paramtest|param={{SITENAME}}}}
8152 !! html
8153 <p>This is a test template with parameter MediaWiki
8154 </p>
8155 !! end
8156
8157 !! article
8158 Template:linktest
8159 !! text
8160 [[{{{param}}}|link]]
8161 !! endarticle
8162
8163 !! test
8164 Template parameter as link source
8165 !! wikitext
8166 {{linktest|param=Main Page}}
8167 !! html
8168 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8169 </p>
8170 !! end
8171
8172 !!test
8173 Template-generated attribute string (k='v')
8174 !! wikitext
8175 <span {{attr_str|id|v1}}>bar</span>
8176 !! html
8177 <p><span id="v1">bar</span>
8178 </p>
8179 !!end
8180
8181 !!article
8182 Template:paramtest2
8183 !! text
8184 including another template, {{paramtest|param={{{arg}}}}}
8185 !! endarticle
8186
8187 !! test
8188 Template passing argument to another template
8189 !! wikitext
8190 {{paramtest2|arg='hmm'}}
8191 !! html
8192 <p>including another template, This is a test template with parameter 'hmm'
8193 </p>
8194 !! end
8195
8196 !! article
8197 Template:Linktest2
8198 !! text
8199 Main Page
8200 !! endarticle
8201
8202 !! test
8203 Template as link source
8204 !! wikitext
8205 [[{{linktest2}}]]
8206
8207 [[{{linktest2}}|Main Page]]
8208
8209 [[{{linktest2}}]]Page
8210 !! html
8211 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8212 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8213 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8214 </p>
8215 !! end
8216
8217
8218 !! article
8219 Template:loop1
8220 !! text
8221 {{loop2}}
8222 !! endarticle
8223
8224 !! article
8225 Template:loop2
8226 !! text
8227 {{loop1}}
8228 !! endarticle
8229
8230 !! test
8231 Template infinite loop
8232 !! wikitext
8233 {{loop1}}
8234 !! html
8235 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8236 </p>
8237 !! end
8238
8239 !! test
8240 Template from main namespace
8241 !! wikitext
8242 {{:Main Page}}
8243 !! html
8244 <p>blah blah
8245 </p>
8246 !! end
8247
8248 !! article
8249 Template:table
8250 !! text
8251 {|
8252 | 1 || 2
8253 |-
8254 | 3 || 4
8255 |}
8256 !! endarticle
8257
8258 !! test
8259 BUG 529: Template with table, not included at beginning of line
8260 !! wikitext
8261 foo {{table}}
8262 !! html
8263 <p>foo
8264 </p>
8265 <table>
8266 <tr>
8267 <td> 1 </td>
8268 <td> 2
8269 </td></tr>
8270 <tr>
8271 <td> 3 </td>
8272 <td> 4
8273 </td></tr></table>
8274
8275 !! end
8276
8277 !! test
8278 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8279 !! wikitext
8280 foo
8281 {{table}}
8282 !! html
8283 <p>foo
8284 </p>
8285 <table>
8286 <tr>
8287 <td> 1 </td>
8288 <td> 2
8289 </td></tr>
8290 <tr>
8291 <td> 3 </td>
8292 <td> 4
8293 </td></tr></table>
8294
8295 !! end
8296
8297 !! test
8298 BUG 41: Template parameters shown as broken links
8299 !! wikitext
8300 {{{parameter}}}
8301 !! html
8302 <p>{{{parameter}}}
8303 </p>
8304 !! end
8305
8306 !! test
8307 Template with targets containing wikilinks
8308 !! wikitext
8309 {{[[foo]]}}
8310
8311 {{[[{{echo|foo}}]]}}
8312
8313 {{{{echo|[[foo}}]]}}
8314 !! html
8315 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8316 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8317 </p><p>{{[[foo}}]]
8318 </p>
8319 !! end
8320
8321 !! article
8322 Template:MSGNW test
8323 !! text
8324 ''None'' of '''this''' should be
8325 * interpreted
8326 but rather passed unmodified
8327 {{test}}
8328 <gallery>
8329 File:Foobar.jpg
8330 </gallery>
8331 !! endarticle
8332
8333 # hmm, fix this or just deprecate msgnw and document its behavior?
8334 !! test
8335 msgnw keyword
8336 !! wikitext
8337 {{msgnw:MSGNW test}}
8338 !! html
8339 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8340 &#42; interpreted
8341 &#32;but rather passed unmodified
8342 &#123;&#123;test&#125;&#125;
8343 &#60;gallery&#62;
8344 File:Foobar.jpg
8345 &#60;/gallery&#62;
8346 </p>
8347 !! end
8348
8349 !! test
8350 int keyword
8351 !! wikitext
8352 {{int:youhavenewmessages|lots of money|not!}}
8353 !! html
8354 <p>You have lots of money (not!).
8355 </p>
8356 !! end
8357
8358 !! article
8359 Template:Includes
8360 !! text
8361 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8362 !! endarticle
8363
8364 !! test
8365 <includeonly> and <noinclude> being included
8366 !! wikitext
8367 {{Includes}}
8368 !! html
8369 <p>Foobar
8370 </p>
8371 !! end
8372
8373 !! article
8374 Template:Includes2
8375 !! text
8376 <onlyinclude>Foo</onlyinclude>bar
8377 !! endarticle
8378
8379 !! test
8380 <onlyinclude> being included
8381 !! wikitext
8382 {{Includes2}}
8383 !! html
8384 <p>Foo
8385 </p>
8386 !! end
8387
8388
8389 !! article
8390 Template:Includes3
8391 !! text
8392 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8393 !! endarticle
8394
8395 !! test
8396 <onlyinclude> and <includeonly> being included
8397 !! wikitext
8398 {{Includes3}}
8399 !! html
8400 <p>Foo
8401 </p>
8402 !! end
8403
8404 !! test
8405 <includeonly> and <noinclude> on a page
8406 !! wikitext
8407 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8408 !! html
8409 <p>Foozar
8410 </p>
8411 !! end
8412
8413 !! test
8414 Un-closed <noinclude>
8415 !! wikitext
8416 <noinclude>
8417 !! html
8418 !! end
8419
8420 !! test
8421 <onlyinclude> on a page
8422 !! wikitext
8423 <onlyinclude>Foo</onlyinclude>bar
8424 !! html
8425 <p>Foobar
8426 </p>
8427 !! end
8428
8429 !! test
8430 Un-closed <onlyinclude>
8431 !! wikitext
8432 <onlyinclude>
8433 !! html
8434 !! end
8435
8436 !!test
8437 Self-closed noinclude, includeonly, onlyinclude tags
8438 !! wikitext
8439 <noinclude />
8440 <includeonly />
8441 <onlyinclude />
8442 !! html
8443 <p><br />
8444 </p>
8445 !!end
8446
8447 !!test
8448 Unbalanced includeonly and noinclude tags
8449 !! wikitext
8450 {|
8451 |a</noinclude>
8452 |b</noinclude></noinclude>
8453 |c</noinclude></includeonly>
8454 |d</includeonly></includeonly>
8455 |}
8456 !! html
8457 <table>
8458 <tr>
8459 <td>a
8460 </td>
8461 <td>b
8462 </td>
8463 <td>c&lt;/includeonly&gt;
8464 </td>
8465 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8466 </td></tr></table>
8467
8468 !!end
8469
8470 !! article
8471 Template:Includeonly section
8472 !! text
8473 <includeonly>
8474 ==Includeonly section==
8475 </includeonly>
8476 ==Section T-1==
8477 !!endarticle
8478
8479 !! test
8480 Bug 6563: Edit link generation for section shown by <includeonly>
8481 !! wikitext
8482 {{includeonly section}}
8483 !! html
8484 <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>
8485 <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>
8486
8487 !! end
8488
8489 # Uses same input as the contents of [[Template:Includeonly section]]
8490 !! test
8491 Bug 6563: Section extraction for section shown by <includeonly>
8492 !! options
8493 section=T-2
8494 !! wikitext
8495 <includeonly>
8496 ==Includeonly section==
8497 </includeonly>
8498 ==Section T-2==
8499 !! html
8500 ==Section T-2==
8501 !! end
8502
8503 !! test
8504 Bug 6563: Edit link generation for section suppressed by <includeonly>
8505 !! wikitext
8506 <includeonly>
8507 ==Includeonly section==
8508 </includeonly>
8509 ==Section 1==
8510 !! html
8511 <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>
8512
8513 !! end
8514
8515 !! test
8516 Bug 6563: Section extraction for section suppressed by <includeonly>
8517 !! options
8518 section=1
8519 !! wikitext
8520 <includeonly>
8521 ==Includeonly section==
8522 </includeonly>
8523 ==Section 1==
8524 !! html
8525 ==Section 1==
8526 !! end
8527
8528 !! test
8529 Un-closed <includeonly>
8530 !! wikitext
8531 <includeonly>
8532 !! html
8533 !! end
8534
8535 # TODO: test with DOM fragment reuse!
8536 !! test
8537 Parsoid: DOM fragment reuse
8538 !! options
8539 parsoid=wt2wt,wt2html
8540 !! wikitext
8541 a{{echo|b<table></table>c}}d
8542
8543 a{{echo|b
8544 <table></table>
8545 c}}d
8546
8547 {{echo|a
8548
8549 <table></table>
8550
8551 b}}
8552 !! html
8553 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8554 <table></table>c"}},"i":0}}]}'>b</span>
8555 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8556
8557
8558 <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">
8559 </span>
8560 <table about="#mwt2"></table><span about="#mwt2">
8561 </span>
8562 <p about="#mwt2">cd</p>
8563
8564
8565 <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">
8566
8567 </span>
8568 <table about="#mwt3"></table><span about="#mwt3">
8569
8570 </span>
8571 <p about="#mwt3">b</p>
8572 !! end
8573
8574 !! test
8575 Parsoid: Merge double tds (bug 50603)
8576 !! options
8577 parsoid
8578 !! wikitext
8579 {|
8580 |{{echo|{{!}} foo}}
8581 |}
8582 !! html
8583 <table><tbody>
8584 <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>
8585 </tbody></table>
8586 !! end
8587
8588 !! test
8589 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8590 !! options
8591 parsoid
8592 !! wikitext
8593 {{echo|<div>}}
8594 {|
8595 |{{echo|{{!}} foo}}
8596 |}
8597 {{echo|</div>}}
8598 !! html
8599 <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}}]}'>
8600 <table><tbody>
8601 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8602 </tbody></table>
8603 </div>
8604 !! end
8605
8606 ###
8607 ### <includeonly> and <noinclude> in attributes
8608 ###
8609 !!test
8610 0. includeonly around the entire attribute
8611 !! wikitext
8612 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8613 !! html
8614 <p><span id="v2">bar</span>
8615 </p>
8616 !!end
8617
8618 !!test
8619 1. includeonly in html attr key
8620 !! wikitext
8621 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8622 !! html
8623 <p><span id="foo">bar</span>
8624 </p>
8625 !!end
8626
8627 !!test
8628 2. includeonly in html attr value
8629 !! wikitext
8630 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8631 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8632 !! html
8633 <p><span id="v1">bar</span>
8634 <span id="v1">bar</span>
8635 </p>
8636 !!end
8637
8638 !!test
8639 3. includeonly in part of an attr value
8640 !! wikitext
8641 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8642 !! html
8643 <p><span style="color:red;">bar</span>
8644 </p>
8645 !!end
8646
8647 !!test
8648 4. includeonly in table attributes
8649 !! wikitext
8650 {|
8651 |- <noinclude>
8652 |-
8653 |a
8654 </noinclude>
8655 |- <includeonly>
8656 |-
8657 |b
8658 </includeonly>
8659 |}
8660 !! html
8661 <table>
8662
8663
8664 <tr>
8665 <td>a
8666 </td></tr>
8667 </table>
8668
8669 !!end
8670
8671 ###
8672 ### Token Stream Patcher tests
8673 ###
8674 ### These tests won't always pass wt2wt and other modes because
8675 ### on serialization, the table will be output on a new line.
8676 ### For now, we are blacklisting them, and using this to test selser.
8677 ###
8678
8679 !!test
8680 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8681 !!options
8682 parsoid=wt2html,wt2wt
8683 !!wikitext
8684 {{echo|}}{| width = '100%'
8685 |foo
8686 |}
8687 !!html/parsoid
8688 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8689 <table width="100%">
8690 <tbody>
8691 <tr>
8692 <td>foo</td></tr></tbody></table>
8693 !!end
8694
8695 !!test
8696 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8697 !!options
8698 parsoid=wt2html,wt2wt
8699 !!wikitext
8700 <includeonly>a</includeonly>{| {{{b}}}
8701 |c
8702 |}
8703 !!html/parsoid
8704 <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 data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>{{{b}}}</span><table about="#mwt1" typeof="mw:Param" data-parsoid='{"a":{" ":null},"sa":{" ":""},"src":"{| {{{b}}}\n|c\n|}"}'>
8705 <tbody><tr><td>c</td></tr>
8706 </tbody></table>
8707 !!end
8708
8709 ###
8710 ### Testing parsing of templates where a template arg
8711 ### has the same name as the template itself.
8712 ###
8713
8714 !! article
8715 Template:quote
8716 !! text
8717 {{{quote|{{{1}}}}}}
8718 !! endarticle
8719
8720 !!test
8721 Templates: Template Name/Arg clash: 1. Use of positional param
8722 !! wikitext
8723 {{quote|foo}}
8724 !! html
8725 <p>foo
8726 </p>
8727 !!end
8728
8729 !!test
8730 Templates: Template Name/Arg clash: 2. Use of named param
8731 !! wikitext
8732 {{quote|quote=foo}}
8733 !! html
8734 <p>foo
8735 </p>
8736 !!end
8737
8738 !!test
8739 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8740 !! wikitext
8741 {{quote|quote}}
8742 !! html
8743 <p>quote
8744 </p>
8745 !!end
8746
8747 ###
8748 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8749 ###
8750
8751 !!test
8752 Templates: 1. Simple use
8753 !! wikitext
8754 {{echo|Foo}}
8755 !! html
8756 <p>Foo
8757 </p>
8758 !!end
8759
8760 !!test
8761 Templates: 2. Inside a block tag
8762 !! wikitext
8763 <div>{{echo|Foo}}</div>
8764 <blockquote>{{echo|Foo}}</blockquote>
8765 !! html
8766 <div>Foo</div>
8767 <blockquote>Foo</blockquote>
8768
8769 !!end
8770
8771 !!test
8772 Templates: P-wrapping: 1a. Templates on consecutive lines
8773 !! wikitext
8774 {{echo|Foo}}
8775 {{echo|bar}}
8776 !! html
8777 <p>Foo
8778 bar
8779 </p>
8780 !!end
8781
8782 !!test
8783 Templates: P-wrapping: 1b. Templates on consecutive lines
8784 !! wikitext
8785 Foo
8786
8787 {{echo|bar}}
8788 {{echo|baz}}
8789 !! html
8790 <p>Foo
8791 </p><p>bar
8792 baz
8793 </p>
8794 !!end
8795
8796 !!test
8797 Templates: P-wrapping: 1c. Templates on consecutive lines
8798 !! wikitext
8799 {{echo|Foo}}
8800 {{echo|bar}} <div>baz</div>
8801 !! html
8802 <p>Foo
8803 </p>
8804 bar <div>baz</div>
8805
8806 !!end
8807
8808 !!test
8809 Templates: P-wrapping: 1d. Template preceded by comment-only line
8810 !!options
8811 parsoid
8812 !! wikitext
8813 <!-- foo -->
8814 {{echo|Bar}}
8815 !! html
8816 <!-- foo -->
8817
8818 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8819 !!end
8820
8821 !!test
8822 Templates: Inline Text: 1. Multiple template uses
8823 !! wikitext
8824 {{echo|Foo}}bar{{echo|baz}}
8825 !! html
8826 <p>Foobarbaz
8827 </p>
8828 !!end
8829
8830 !!test
8831 Templates: Inline Text: 2. Back-to-back template uses
8832 !! wikitext
8833 {{echo|Foo}}{{echo|bar}}
8834 !! html
8835 <p>Foobar
8836 </p>
8837 !!end
8838
8839 !!test
8840 Templates: Block Tags: 1. Multiple template uses
8841 !! wikitext
8842 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8843 !! html
8844 <div>Foo</div><div>bar</div><div>baz</div>
8845
8846 !!end
8847
8848 !!test
8849 Templates: Block Tags: 2. Back-to-back template uses
8850 !! wikitext
8851 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8852 !! html
8853 <div>Foo</div><div>bar</div>
8854
8855 !!end
8856
8857 !!test
8858 Templates: Links: 1. Simple example
8859 !! wikitext
8860 {{echo|[[Foo|bar]]}}
8861 !! html
8862 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8863 </p>
8864 !!end
8865
8866 !!test
8867 Templates: Links: 2. Generation of link href
8868 !! wikitext
8869 [[{{echo|Foo}}|bar]]
8870 !! html
8871 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8872 </p>
8873 !!end
8874
8875 !!test
8876 Templates: Links: 3. Generation of part of a link href
8877 !! wikitext
8878 [[Fo{{echo|o}}|bar]]
8879
8880 [[Foo{{echo|bar}}]]
8881
8882 [[Foo{{echo|bar}}baz]]
8883
8884 [[Foo{{echo|bar}}|bar]]
8885
8886 [[:Foo{{echo|bar}}]]
8887
8888 [[:Foo{{echo|bar}}|bar]]
8889 !! html
8890 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8891 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8892 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8893 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8894 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8895 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8896 </p>
8897 !!end
8898
8899 !!test
8900 Templates: Links: 4. Multiple templates generating link href
8901 !! wikitext
8902 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8903 !! html
8904 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8905 </p>
8906 !!end
8907
8908 !!test
8909 Templates: Links: 5. Generation of link text
8910 !! wikitext
8911 [[Foo|{{echo|bar}}]]
8912 !! html
8913 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8914 </p>
8915 !!end
8916
8917 !!test
8918 Templates: Links: 5. Nested templates (only outermost template should be marked)
8919 !! wikitext
8920 {{echo|[[{{echo|Foo}}|bar]]}}
8921 !! html
8922 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8923 </p>
8924 !!end
8925
8926 !!test
8927 Templates: HTML Tag: 1. Generation of HTML attr. key
8928 !! wikitext
8929 <div {{echo|style}}="color:red;">foo</div>
8930 !! html
8931 <div style="color:red;">foo</div>
8932
8933 !!end
8934
8935 !!test
8936 Templates: HTML Tag: 2. Generation of HTML attr. value
8937 !! wikitext
8938 <div style={{echo|'color:red;'}}>foo</div>
8939 !! html
8940 <div style="color:red;">foo</div>
8941
8942 !!end
8943
8944 !!test
8945 Templates: HTML Tag: 3. Generation of HTML attr key and value
8946 !! wikitext
8947 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8948 !! html
8949 <div style="color:red;">foo</div>
8950
8951 !!end
8952
8953 !!test
8954 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8955 !! wikitext
8956 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8957 !! html
8958 <div title="This is a long title with just one piece templated">foo</div>
8959
8960 !!end
8961
8962 !!test
8963 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8964 !! wikitext
8965 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8966 !! html
8967 <div title="This is a long title with just one piece templated">foo</div>
8968
8969 !!end
8970
8971 !!test
8972 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8973 !! wikitext
8974 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8975 !! html
8976 <div title="This is a long title with just one piece templated">foo</div>
8977
8978 !!end
8979
8980 !!test
8981 Templates: HTML Tag: 7. Generation of partial attribute key string
8982 !! wikitext
8983 <div st{{echo|yle}}="color:red;">foo</div>
8984 !! html
8985 <div style="color:red;">foo</div>
8986
8987 !!end
8988
8989 !!test
8990 Templates: HTML Tables: 1. Generating start of a HTML table
8991 !! wikitext
8992 {{echo|<table><tr><td>foo</td>}}</tr></table>
8993 !! html
8994 <table><tr><td>foo</td></tr></table>
8995
8996 !!end
8997
8998 !!test
8999 Templates: HTML Tables: 2a. Generating middle of a HTML table
9000 !! wikitext
9001 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9002 !! html
9003 <table><tr><td>foo</td></tr></table>
9004
9005 !!end
9006
9007 !!test
9008 Templates: HTML Tables: 2b. Generating middle of a HTML table
9009 !! wikitext
9010 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9011 !! html
9012 <table><tr><td>foo</td></tr></table>
9013
9014 !!end
9015
9016 !!test
9017 Templates: HTML Tables: 3. Generating end of a HTML table
9018 !! wikitext
9019 <table><tr>{{echo|<td>foo</td></tr></table>}}
9020 !! html
9021 <table><tr><td>foo</td></tr></table>
9022
9023 !!end
9024
9025 !!test
9026 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9027 !! wikitext
9028 {{echo|<table>}}<tr><td>foo</td></tr></table>
9029 !! html
9030 <table><tr><td>foo</td></tr></table>
9031
9032 !!end
9033
9034 !!test
9035 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9036 !! wikitext
9037 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9038 !! html
9039 <table><tr><td>foo</td></tr></table>
9040
9041 !!end
9042
9043 !!test
9044 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9045 !! wikitext
9046 <table><tr>{{echo|<td>}}foo</td></tr></table>
9047 !! html
9048 <table><tr><td>foo</td></tr></table>
9049
9050 !!end
9051
9052 !!test
9053 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9054 !! wikitext
9055 <table><tr><td>foo{{echo|</td>}}</tr></table>
9056 !! html
9057 <table><tr><td>foo</td></tr></table>
9058
9059 !!end
9060
9061 !!test
9062 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9063 !! wikitext
9064 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9065 !! html
9066 <table><tr><td>foo</td></tr></table>
9067
9068 !!end
9069
9070 !!test
9071 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9072 !! wikitext
9073 <table><tr><td>foo</td></tr>{{echo|</table>}}
9074 !! html
9075 <table><tr><td>foo</td></tr></table>
9076
9077 !!end
9078
9079 !!test
9080 Templates: HTML Tables: 5. Proper fostering of categories from inside
9081 !!options
9082 parsoid=wt2html,wt2wt
9083 !! wikitext
9084 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9085 <!--Two categories (Bug 50330)-->
9086 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9087 !! html
9088 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9089 <!--Two categories (Bug 50330)-->
9090 <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>
9091 !!end
9092
9093 !!test
9094 Templates: Wiki Tables: 1a. Fostering of entire template content
9095 !! wikitext
9096 {|
9097 {{echo|a}}
9098 |}
9099 !! html
9100 <table>
9101 a
9102 <tr><td></td></tr></table>
9103
9104 !!end
9105
9106 !!test
9107 Templates: Wiki Tables: 1b. Fostering of entire template content
9108 !! wikitext
9109 {|
9110 {{echo|<div>}}
9111 foo
9112 {{echo|</div>}}
9113 |}
9114 !! html
9115 <table>
9116 <div>
9117 <p>foo
9118 </p>
9119 </div>
9120 <tr><td></td></tr></table>
9121
9122 !!end
9123
9124 !!test
9125 Templates: Wiki Tables: 2. Fostering of partial template content
9126 !! wikitext
9127 {|
9128 {{echo|a
9129 <div>b</div>}}
9130 |}
9131 !! html
9132 <table>
9133 a
9134 <div>b</div>
9135 <tr><td></td></tr></table>
9136
9137 !!end
9138
9139 !!test
9140 Templates: Wiki Tables: 3. td-content via multiple templates
9141 !! wikitext
9142 {|
9143 {{echo|{{pipe}}a}}{{echo|b}}
9144 |}
9145 !! html
9146 <table>
9147 <tr>
9148 <td>ab
9149 </td></tr></table>
9150
9151 !!end
9152
9153 !!test
9154 Templates: Wiki Tables: 4. Templated tags, no content
9155 !! wikitext
9156 {{tbl-start}}
9157 {{tbl-end}}
9158 !! html
9159 <table>
9160 <tr><td></td></tr></table>
9161
9162 !!end
9163
9164 !!test
9165 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9166 !! wikitext
9167 {{tbl-start}}
9168 |foo
9169 {{tbl-end}}
9170 !! html
9171 <table>
9172 <tr>
9173 <td>foo
9174 </td></tr></table>
9175
9176 !!end
9177
9178 !!test
9179 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9180 !! wikitext
9181 {{tbl-start}}
9182 {{!}}foo
9183 {{tbl-end}}
9184 !! html
9185 <table>
9186 <tr>
9187 <td>foo
9188 </td></tr></table>
9189
9190 !!end
9191
9192 !!test
9193 Templates: Lists: Multi-line list-items via templates
9194 !! wikitext
9195 *{{echo|a {{nonexistent|
9196 unused}}}}
9197 *{{echo|b {{nonexistent|
9198 unused}}}}
9199 !! html
9200 <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>
9201 <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>
9202
9203 !!end
9204
9205 !!test
9206 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9207 !! wikitext
9208 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9209 !! html
9210 <p><i>ab</i>c<i>d</i>e
9211 </p>
9212 !!end
9213
9214 !!test
9215 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9216 (PHP parser generates misnested html)
9217 !! wikitext
9218 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9219 !! html/parsoid
9220 <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>
9221 !!end
9222
9223 !!test
9224 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9225 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9226 !! options
9227 parsoid=wt2html,wt2wt
9228 !! wikitext
9229 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9230 !! html
9231 <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>
9232 <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>
9233 <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>
9234 !!end
9235
9236 !!test
9237 Templates: Ugly nesting: 4. Divs opened/closed across templates
9238 !! wikitext
9239 a<div>b{{echo|c</div>d}}e
9240 !! html
9241 a<div>bc</div>de
9242
9243 !!end
9244
9245 !!test
9246 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9247 (Parsoid-centric)
9248 !! options
9249 parsoid
9250 !! wikitext
9251 {|
9252 |{{echo|foo</table>}}
9253 |bar
9254 |}
9255 !! html
9256 <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|}"]}'>
9257
9258 <tbody>
9259 <tr>
9260 <td>foo</td></tr></tbody></table><span about="#mwt1">
9261 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9262 |}</span>
9263 !!end
9264
9265 !!test
9266 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9267 (Parsoid-centric)
9268 !! options
9269 parsoid
9270 !! wikitext
9271 <table>
9272 <tr>
9273 <td>
9274 <table>
9275 <tr>
9276 <td>1. {{echo|foo </table>}}</td>
9277 <td> bar </td>
9278 <td>2. {{echo|baz </table>}}</td>
9279 </tr>
9280 <tr>
9281 <td>abc</td>
9282 </tr>
9283 </table>
9284 </td>
9285 </tr>
9286 <tr>
9287 <td>xyz</td>
9288 </tr>
9289 </table>
9290 !! html
9291 <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>"]}'>
9292 <tbody><tr>
9293 <td>
9294 <table>
9295 <tbody><tr>
9296 <td>1. foo </td></tr></tbody></table></td>
9297 <td> bar </td>
9298 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9299 </span><span about="#mwt2">
9300 </span><span about="#mwt2">
9301 </span><span about="#mwt2">abc</span><span about="#mwt2">
9302 </span><span about="#mwt2">
9303 </span><span about="#mwt2">
9304 </span><span about="#mwt2">
9305 </span><span about="#mwt2">
9306 </span><span about="#mwt2">
9307 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9308 </span><span about="#mwt2">
9309 </span>
9310 !!end
9311
9312 !! test
9313 Templates: Ugly templates: 3. newline-only template parameter
9314 !! wikitext
9315 foo {{echo|
9316 }}
9317 !! html
9318 <p>foo
9319 </p>
9320 !! end
9321
9322 # This looks like a bug: a single newline triggers p/br for some reason.
9323 !! test
9324 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9325 !! wikitext
9326 {{echo|
9327 }}
9328 !! html
9329 <p><br />
9330 </p>
9331 !! end
9332
9333 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9334 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9335 !! test
9336 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9337 !! wikitext
9338 {{echo|<table>}}
9339 {{echo|<div>foo}}
9340 {{echo|</table>}}
9341 !! html/parsoid
9342 <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
9343 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9344 </table>
9345 !! end
9346
9347 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9348 # that are "identical" and generate nesting cycles in the algorithm
9349 !! test
9350 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9351 !! wikitext
9352 {{echo|<table><tr><td><table>}}
9353 {{echo|<div>}}
9354 {{echo|</div>}}
9355 !! html/parsoid
9356 <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"}'>
9357 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9358 </table></td></tr></tbody></table>
9359 !! end
9360
9361 !!test
9362 Parser Functions: 1. Simple example
9363 !! wikitext
9364 {{uc:foo}}
9365 !! html
9366 <p>FOO
9367 </p>
9368 !!end
9369
9370 !!test
9371 Parser Functions: 2. Nested use (only outermost should be marked up)
9372 !! wikitext
9373 {{uc:{{lc:FOO}}}}
9374 !! html
9375 <p>FOO
9376 </p>
9377 !!end
9378
9379 ###
9380 ### Pre-save transform tests
9381 ###
9382 !! test
9383 pre-save transform: subst:
9384 !! options
9385 PST
9386 !! wikitext
9387 {{subst:test}}
9388 !! html
9389 This is a test template
9390 !! end
9391
9392 !! test
9393 pre-save transform: normal template
9394 !! options
9395 PST
9396 !! wikitext
9397 {{test}}
9398 !! html
9399 {{test}}
9400 !! end
9401
9402 !! test
9403 pre-save transform: nonexistent template
9404 !! options
9405 PST
9406 !! wikitext
9407 {{thistemplatedoesnotexist}}
9408 !! html
9409 {{thistemplatedoesnotexist}}
9410 !! end
9411
9412
9413 !! test
9414 pre-save transform: subst magic variables
9415 !! options
9416 PST
9417 !! wikitext
9418 {{subst:SITENAME}}
9419 !! html
9420 MediaWiki
9421 !! end
9422
9423 # This is bug 89, which I fixed. -- wtm
9424 !! test
9425 pre-save transform: subst: templates with parameters
9426 !! options
9427 pst
9428 !! wikitext
9429 {{subst:paramtest|param="something else"}}
9430 !! html
9431 This is a test template with parameter "something else"
9432 !! end
9433
9434 !! article
9435 Template:nowikitest
9436 !! text
9437 <nowiki>'''not wiki'''</nowiki>
9438 !! endarticle
9439
9440 !! test
9441 pre-save transform: nowiki in subst (bug 1188)
9442 !! options
9443 pst
9444 !! wikitext
9445 {{subst:nowikitest}}
9446 !! html
9447 <nowiki>'''not wiki'''</nowiki>
9448 !! end
9449
9450
9451 !! article
9452 Template:commenttest
9453 !! text
9454 This template has <!-- a comment --> in it.
9455 !! endarticle
9456
9457 !! test
9458 pre-save transform: comment in subst (bug 1936)
9459 !! options
9460 pst
9461 !! wikitext
9462 {{subst:commenttest}}
9463 !! html
9464 This template has <!-- a comment --> in it.
9465 !! end
9466
9467 !! test
9468 pre-save transform: unclosed tag
9469 !! options
9470 pst noxml
9471 !! wikitext
9472 <nowiki>'''not wiki'''
9473 !! html
9474 <nowiki>'''not wiki'''
9475 !! end
9476
9477 !! test
9478 pre-save transform: mixed tag case
9479 !! options
9480 pst noxml
9481 !! wikitext
9482 <NOwiki>'''not wiki'''</noWIKI>
9483 !! html
9484 <NOwiki>'''not wiki'''</noWIKI>
9485 !! end
9486
9487 !! test
9488 pre-save transform: unclosed comment in <nowiki>
9489 !! options
9490 pst noxml
9491 !! wikitext
9492 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9493 !! html
9494 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9495 !!end
9496
9497 # Leading @ in this template definition works around a limitation
9498 # in parsoid's parserTests which otherwise strips the <span> from the
9499 # result (confusing it for a template wrapper)
9500 !! article
9501 Template:dangerous
9502 !!text
9503 @<span onmouseover="alert('crap')">Oh no</span>
9504 !!endarticle
9505
9506 !!test
9507 (confirming safety of fix for subst bug 1936)
9508 !! wikitext
9509 {{Template:dangerous}}
9510 !! html
9511 <p>@<span>Oh no</span>
9512 </p>
9513 !! end
9514
9515 !! test
9516 pre-save transform: comment containing gallery (bug 5024)
9517 !! options
9518 pst
9519 !! wikitext
9520 <!-- <gallery>data</gallery> -->
9521 !! html
9522 <!-- <gallery>data</gallery> -->
9523 !!end
9524
9525 !! test
9526 pre-save transform: comment containing extension
9527 !! options
9528 pst
9529 !! wikitext
9530 <!-- <tag>data</tag> -->
9531 !! html
9532 <!-- <tag>data</tag> -->
9533 !!end
9534
9535 !! test
9536 pre-save transform: comment containing nowiki
9537 !! options
9538 pst
9539 !! wikitext
9540 <!-- <nowiki>data</nowiki> -->
9541 !! html
9542 <!-- <nowiki>data</nowiki> -->
9543 !!end
9544
9545 !! test
9546 pre-save transform: <noinclude> in subst (bug 3298)
9547 !! options
9548 pst
9549 !! wikitext
9550 {{subst:Includes}}
9551 !! html
9552 Foobar
9553 !! end
9554
9555 !! test
9556 pre-save transform: <onlyinclude> in subst (bug 3298)
9557 !! options
9558 pst
9559 !! wikitext
9560 {{subst:Includes2}}
9561 !! html
9562 Foo
9563 !! end
9564
9565 !! article
9566 Template:SubstTest
9567 !!text
9568 {{<includeonly>subst:</includeonly>Includes}}
9569 !! endarticle
9570
9571 !! article
9572 Template:SafeSubstTest
9573 !! text
9574 {{<includeonly>safesubst:</includeonly>Includes}}
9575 !! endarticle
9576
9577 !! test
9578 bug 22297: safesubst: works during PST
9579 !! options
9580 pst
9581 !! wikitext
9582 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9583 !! html
9584 FoobarFoobar
9585 !! end
9586
9587 !! test
9588 bug 22297: safesubst: works during normal parse
9589 !! wikitext
9590 {{SafeSubstTest}}
9591 !! html
9592 <p>Foobar
9593 </p>
9594 !! end
9595
9596 !! test
9597 subst: does not work during normal parse
9598 !! wikitext
9599 {{SubstTest}}
9600 !! html
9601 <p>{{subst:Includes}}
9602 </p>
9603 !! end
9604
9605 !! test
9606 pre-save transform: context links ("pipe trick")
9607 !! options
9608 pst
9609 !! wikitext
9610 [[Article (context)|]]
9611 [[Bar:Article|]]
9612 [[:Bar:Article|]]
9613 [[Bar:Article (context)|]]
9614 [[:Bar:Article (context)|]]
9615 [[|Article]]
9616 [[|Article (context)]]
9617 [[Bar:X (Y) Z|]]
9618 [[:Bar:X (Y) Z|]]
9619 !! html
9620 [[Article (context)|Article]]
9621 [[Bar:Article|Article]]
9622 [[:Bar:Article|Article]]
9623 [[Bar:Article (context)|Article]]
9624 [[:Bar:Article (context)|Article]]
9625 [[Article]]
9626 [[Article (context)]]
9627 [[Bar:X (Y) Z|X (Y) Z]]
9628 [[:Bar:X (Y) Z|X (Y) Z]]
9629 !! end
9630
9631 !! test
9632 pre-save transform: context links ("pipe trick") with interwiki prefix
9633 !! options
9634 pst
9635 !! wikitext
9636 [[interwiki:Article|]]
9637 [[:interwiki:Article|]]
9638 [[interwiki:Bar:Article|]]
9639 [[:interwiki:Bar:Article|]]
9640 !! html
9641 [[interwiki:Article|Article]]
9642 [[:interwiki:Article|Article]]
9643 [[interwiki:Bar:Article|Bar:Article]]
9644 [[:interwiki:Bar:Article|Bar:Article]]
9645 !! end
9646
9647 !! test
9648 pre-save transform: context links ("pipe trick") with parens in title
9649 !! options
9650 pst title=[[Somearticle (context)]]
9651 !! wikitext
9652 [[|Article]]
9653 !! html
9654 [[Article (context)|Article]]
9655 !! end
9656
9657 !! test
9658 pre-save transform: context links ("pipe trick") with comma in title
9659 !! options
9660 pst title=[[Someplace, Somewhere]]
9661 !! wikitext
9662 [[|Otherplace]]
9663 [[Otherplace, Elsewhere|]]
9664 [[Otherplace, Elsewhere, Anywhere|]]
9665 !! html
9666 [[Otherplace, Somewhere|Otherplace]]
9667 [[Otherplace, Elsewhere|Otherplace]]
9668 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9669 !! end
9670
9671 !! test
9672 pre-save transform: context links ("pipe trick") with parens and comma
9673 !! options
9674 pst title=[[Someplace (IGNORED), Somewhere]]
9675 !! wikitext
9676 [[|Otherplace]]
9677 [[Otherplace (place), Elsewhere|]]
9678 !! html
9679 [[Otherplace, Somewhere|Otherplace]]
9680 [[Otherplace (place), Elsewhere|Otherplace]]
9681 !! end
9682
9683 !! test
9684 pre-save transform: context links ("pipe trick") with comma and parens
9685 !! options
9686 pst title=[[Who, me? (context)]]
9687 !! wikitext
9688 [[|Yes, you.]]
9689 [[Me, Myself, and I (1937 song)|]]
9690 !! html
9691 [[Yes, you. (context)|Yes, you.]]
9692 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9693 !! end
9694
9695 !! test
9696 pre-save transform: context links ("pipe trick") with namespace
9697 !! options
9698 pst title=[[Ns:Somearticle]]
9699 !! wikitext
9700 [[|Article]]
9701 !! html
9702 [[Ns:Article|Article]]
9703 !! end
9704
9705 !! test
9706 pre-save transform: context links ("pipe trick") with namespace and parens
9707 !! options
9708 pst title=[[Ns:Somearticle (context)]]
9709 !! wikitext
9710 [[|Article]]
9711 !! html
9712 [[Ns:Article (context)|Article]]
9713 !! end
9714
9715 !! test
9716 pre-save transform: context links ("pipe trick") with namespace and comma
9717 !! options
9718 pst title=[[Ns:Somearticle, Context, Whatever]]
9719 !! wikitext
9720 [[|Article]]
9721 !! html
9722 [[Ns:Article, Context, Whatever|Article]]
9723 !! end
9724
9725 !! test
9726 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9727 !! options
9728 pst title=[[Ns:Somearticle, Context (context)]]
9729 !! wikitext
9730 [[|Article]]
9731 !! html
9732 [[Ns:Article (context)|Article]]
9733 !! end
9734
9735 !! test
9736 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9737 !! options
9738 pst title=[[Ns:Somearticle (IGNORED), Context]]
9739 !! wikitext
9740 [[|Article]]
9741 !! html
9742 [[Ns:Article, Context|Article]]
9743 !! end
9744
9745 !! test
9746 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9747 !! options
9748 pst
9749 !! wikitext
9750 [[Article(context)|]]
9751 [[Bar:Article(context)|]]
9752 [[:Bar:Article(context)|]]
9753 [[|Article(context)]]
9754 [[Bar:X(Y)Z|]]
9755 [[:Bar:X(Y)Z|]]
9756 !! html
9757 [[Article(context)|Article]]
9758 [[Bar:Article(context)|Article]]
9759 [[:Bar:Article(context)|Article]]
9760 [[Article(context)]]
9761 [[Bar:X(Y)Z|X(Y)Z]]
9762 [[:Bar:X(Y)Z|X(Y)Z]]
9763 !! end
9764
9765 !! test
9766 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9767 !! options
9768 pst
9769 !! wikitext
9770 [[Article (context)|]]
9771 [[Bar:Article (context)|]]
9772 [[:Bar:Article (context)|]]
9773 [[|Article (context)]]
9774 [[Bar:X (Y) Z|]]
9775 [[:Bar:X (Y) Z|]]
9776 !! html
9777 [[Article (context)|Article]]
9778 [[Bar:Article (context)|Article]]
9779 [[:Bar:Article (context)|Article]]
9780 [[Article (context)]]
9781 [[Bar:X (Y) Z|X (Y) Z]]
9782 [[:Bar:X (Y) Z|X (Y) Z]]
9783 !! end
9784
9785 !! test
9786 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9787 !! options
9788 pst
9789 !! wikitext
9790 [[Article(context)|]]
9791 [[Bar:Article(context)|]]
9792 [[:Bar:Article(context)|]]
9793 [[|Article(context)]]
9794 [[Bar:X(Y)Z|]]
9795 [[:Bar:X(Y)Z|]]
9796 !! html
9797 [[Article(context)|Article]]
9798 [[Bar:Article(context)|Article]]
9799 [[:Bar:Article(context)|Article]]
9800 [[Article(context)]]
9801 [[Bar:X(Y)Z|X(Y)Z]]
9802 [[:Bar:X(Y)Z|X(Y)Z]]
9803 !! end
9804
9805 !! test
9806 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9807 !! options
9808 pst
9809 !! wikitext
9810 [[Article (context), context|]]
9811 [[Article (context),context|]]
9812 [[Bar:Article (context), context|]]
9813 [[Bar:Article (context),context|]]
9814 [[:Bar:Article (context), context|]]
9815 [[:Bar:Article (context),context|]]
9816 !! html
9817 [[Article (context), context|Article]]
9818 [[Article (context),context|Article]]
9819 [[Bar:Article (context), context|Article]]
9820 [[Bar:Article (context),context|Article]]
9821 [[:Bar:Article (context), context|Article]]
9822 [[:Bar:Article (context),context|Article]]
9823 !! end
9824
9825 !! test
9826 pre-save transform: trim trailing empty lines
9827 !! options
9828 pst
9829 !! wikitext
9830 Empty lines are trimmed
9831
9832
9833
9834
9835 !! html
9836 Empty lines are trimmed
9837 !! end
9838
9839 !! test
9840 pre-save transform: Signature expansion
9841 !! options
9842 pst
9843 !! wikitext
9844 * ~~~
9845 * <noinclude>~~~</noinclude>
9846 * <includeonly>~~~</includeonly>
9847 * <onlyinclude>~~~</onlyinclude>
9848 !! html
9849 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9850 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9851 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9852 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9853 !! end
9854
9855
9856 !! test
9857 pre-save transform: Signature expansion in nowiki tags (bug 93)
9858 !! options
9859 pst disabled
9860 !! wikitext
9861 Shall not expand:
9862
9863 <nowiki>~~~~</nowiki>
9864
9865 <includeonly><nowiki>~~~~</nowiki></includeonly>
9866
9867 <noinclude><nowiki>~~~~</nowiki></noinclude>
9868
9869 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9870
9871 {{subst:Foo}} shall be converted to FOO
9872
9873 As well as inside noinclude/onlyinclude
9874 <noinclude>{{subst:Foo}}</noinclude>
9875 <onlyinclude>{{subst:Foo}}</onlyinclude>
9876
9877 But not inside includeonly
9878 <includeonly>{{subst:Foo}}</includeonly>
9879 !! html
9880 Shall not expand:
9881
9882 <nowiki>~~~~</nowiki>
9883
9884 <includeonly><nowiki>~~~~</nowiki></includeonly>
9885
9886 <noinclude><nowiki>~~~~</nowiki></noinclude>
9887
9888 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9889
9890 FOO shall be converted to FOO
9891
9892 As well as inside noinclude/onlyinclude
9893 <noinclude>FOO</noinclude>
9894 <onlyinclude>FOO</onlyinclude>
9895
9896 But not inside includeonly
9897 <includeonly>{{subst:Foo}}</includeonly>
9898 !! end
9899
9900 !! test
9901 Parsoid: Recognize nowiki with trailing space in tags
9902 !! options
9903 parsoid=wt2html
9904 !! wikitext
9905 <nowiki ><div>[[foo]]</nowiki >
9906
9907 a<nowiki / >b
9908
9909 c<nowiki />d
9910
9911 e<nowiki/ >f
9912 !! html
9913 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9914 <p>ab</p>
9915 <p>cd</p>
9916 <p>ef</p>
9917 !! end
9918
9919 !! test
9920 Parsoid: Recognize nowiki with odd capitalization
9921 !! options
9922 parsoid=wt2html
9923 !! wikitext
9924 <noWikI ><div>[[foo]]</Nowiki >
9925 !! html
9926 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9927 !! end
9928
9929
9930 !! test
9931 Parsoid: Escape nowiki with trailing space in tags
9932 !! options
9933 parsoid=html2wt
9934 !! wikitext
9935 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9936
9937 a&lt;nowiki /&gt;b
9938
9939 c&lt;nowiki/ &gt;d
9940 !! html
9941 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9942 <p>a&lt;nowiki /&gt;b</p>
9943 <p>c&lt;nowiki/ &gt;d</p>
9944 !! end
9945
9946 !! test
9947 Parsoid: Escape weird noWikI capitalizations
9948 !! options
9949 parsoid=html2wt
9950 !! wikitext
9951 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9952 !! html
9953 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9954 !! end
9955
9956 ###
9957 ### Message transform tests
9958 ###
9959 !! test
9960 message transform: magic variables
9961 !! options
9962 msg
9963 !! wikitext
9964 {{SITENAME}}
9965 !! html
9966 MediaWiki
9967 !! end
9968
9969 !! test
9970 message transform: should not transform wiki markup
9971 !! options
9972 msg
9973 !! wikitext
9974 ''test''
9975 !! html
9976 ''test''
9977 !! end
9978
9979 !! test
9980 message transform: <noinclude> in transcluded template (bug 4926)
9981 !! options
9982 msg
9983 !! wikitext
9984 {{Includes}}
9985 !! html
9986 Foobar
9987 !! end
9988
9989 !! test
9990 message transform: <onlyinclude> in transcluded template (bug 4926)
9991 !! options
9992 msg
9993 !! wikitext
9994 {{Includes2}}
9995 !! html
9996 Foo
9997 !! end
9998
9999 !! test
10000 {{#special:}} page name, known
10001 !! options
10002 msg
10003 !! wikitext
10004 {{#special:Recentchanges}}
10005 !! html
10006 Special:RecentChanges
10007 !! end
10008
10009 !! test
10010 {{#special:}} page name with subpage, known
10011 !! options
10012 msg
10013 !! wikitext
10014 {{#special:Recentchanges/param}}
10015 !! html
10016 Special:RecentChanges/param
10017 !! end
10018
10019 !! test
10020 {{#special:}} page name, unknown
10021 !! options
10022 msg
10023 !! wikitext
10024 {{#special:foobar nonexistent}}
10025 !! html
10026 Special:Foobar nonexistent
10027 !! end
10028
10029 !! test
10030 {{#speciale:}} page name, known
10031 !! options
10032 msg
10033 !! wikitext
10034 {{#speciale:Recentchanges}}
10035 !! html
10036 Special:RecentChanges
10037 !! end
10038
10039 !! test
10040 {{#speciale:}} page name with subpage, known
10041 !! options
10042 msg
10043 !! wikitext
10044 {{#speciale:Recentchanges/param}}
10045 !! html
10046 Special:RecentChanges/param
10047 !! end
10048
10049 !! test
10050 {{#speciale:}} page name, unknown
10051 !! options
10052 msg
10053 !! wikitext
10054 {{#speciale:foobar nonexistent}}
10055 !! html
10056 Special:Foobar_nonexistent
10057 !! end
10058
10059 ###
10060 ### Images
10061 ###
10062 ### For Parsoid-specific tests, see
10063 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10064
10065 !! test
10066 Simple image
10067 !! options
10068 parsoid=wt2html,wt2wt,html2html
10069 !! wikitext
10070 [[Image:foobar.jpg]]
10071 !! html/php
10072 <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>
10073 </p>
10074 !! html/parsoid
10075 <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>
10076 </p>
10077 !! end
10078
10079 !! test
10080 Simple image (using File: namespace, now canonical)
10081 !! wikitext
10082 [[File:Foobar.jpg]]
10083 !! html/php
10084 <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>
10085 </p>
10086 !! html/parsoid
10087 <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>
10088 </p>
10089 !! end
10090
10091 !! test
10092 Right-aligned image
10093 !! wikitext
10094 [[File:Foobar.jpg|right]]
10095 !! html/php
10096 <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>
10097
10098 !! html/parsoid
10099 <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>
10100 !! end
10101
10102 !! test
10103 Image with caption
10104 !! wikitext
10105 [[File:Foobar.jpg|right|Caption text]]
10106 !! html/php
10107 <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>
10108
10109 !! html/parsoid
10110 <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>
10111 !! end
10112
10113 !! test
10114 Image with caption, bug 53312 #1
10115 !! wikitext
10116 [[File:Foobar.jpg|right|Caption page stuff]]
10117 !! html/php
10118 <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>
10119
10120 !! html/parsoid
10121 <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>
10122 !! end
10123
10124 !! test
10125 Image with caption, bug 53312 #2
10126 !! wikitext
10127 [[File:Foobar.jpg|right|Caption page=]]
10128 !! html/php
10129 <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>
10130
10131 !! html/parsoid
10132 <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>
10133 !! end
10134
10135 !! test
10136 Image with caption, bug 53312 #3
10137 !! wikitext
10138 [[File:Foobar.jpg|right|Caption page=stuff]]
10139 !! html/php
10140 <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>
10141
10142 !! html/parsoid
10143 <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>
10144 !! end
10145
10146 !! test
10147 Allow empty links in image captions (Bug 60753)
10148 !! options
10149 thumbsize=220
10150 !! wikitext
10151 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10152 [[]]
10153 [[Link2]]
10154 ]]
10155 !! html/php
10156 <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>
10157
10158 !! html/parsoid
10159 <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>
10160 [[]]
10161 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10162 </figcaption></figure>
10163 !! end
10164
10165 !! test
10166 Link with empty target
10167 !! wikitext
10168 [[]]
10169 !! html
10170 <p>[[]]
10171 </p>
10172 !! end
10173
10174 !! test
10175 Image with empty attribute
10176 !! options
10177 parsoid=wt2html,wt2wt,html2html
10178 !! wikitext
10179 [[File:Foobar.jpg|right||Caption text]]
10180 !! html/php
10181 <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>
10182
10183 !! html/parsoid
10184 <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>
10185 !! end
10186
10187 !! test
10188 1. Block image with individual attributes from templates
10189 !! wikitext
10190 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10191 !! html/php
10192 <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>
10193
10194 !! html/parsoid
10195 <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>
10196 !! end
10197
10198 !! test
10199 2. Block Image with individual attributes from templates
10200 !! wikitext
10201 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10202 !! html/php
10203 <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>
10204
10205 !! html/parsoid
10206 <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>
10207 !! end
10208
10209 !! test
10210 3. Inline image with individual attributes from templates
10211 !! wikitext
10212 [[File:Foobar.jpg|{{echo|50px}}]]
10213 !! html/php
10214 <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>
10215 </p>
10216 !! html/parsoid
10217 <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>
10218 !! end
10219
10220 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10221 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10222 !! test
10223 Image with multiple attributes from the same template
10224 !! wikitext
10225 [[File:Foobar.jpg|{{image_attribs}}]]
10226 !! html/php
10227 <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>
10228
10229 !! html/parsoid
10230 <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>
10231 !! end
10232
10233 !! test
10234 Image with link tails
10235 !! options
10236 thumbsize=220
10237 !! wikitext
10238 123[[File:Foobar.jpg]]456
10239 123[[File:Foobar.jpg|right]]456
10240 123[[File:Foobar.jpg|thumb]]456
10241 !! html/php
10242 <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
10243 </p>
10244 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
10245 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
10246
10247 !! html/parsoid
10248 <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>
10249 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
10250 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
10251 !! end
10252
10253 !! test
10254 Image with multiple captions -- only last one is accepted
10255 !! wikitext
10256 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10257 !! html/php
10258 <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>
10259
10260 !! html/parsoid
10261 <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>
10262 !! end
10263
10264 !! test
10265 Image with multiple widths -- use last
10266 !! wikitext
10267 [[File:Foobar.jpg|200px|300px|caption]]
10268 !! html/php
10269 <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>
10270 </p>
10271 !! html/parsoid
10272 <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>
10273 !! end
10274
10275 !! test
10276 Image with multiple alignments -- use first (bug 48664)
10277 !! options
10278 thumbsize=220
10279 !! wikitext
10280 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10281
10282 [[File:Foobar.jpg|middle|text-top|caption]]
10283 !! html/php
10284 <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>
10285 <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>
10286 </p>
10287 !! html/parsoid
10288 <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>
10289 <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>
10290 !! end
10291
10292 !! test
10293 Image with width attribute at different positions
10294 !! wikitext
10295 [[File:Foobar.jpg|200px|right|Caption]]
10296 [[File:Foobar.jpg|right|200px|Caption]]
10297 [[File:Foobar.jpg|right|Caption|200px]]
10298 !! html/php
10299 <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>
10300 <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>
10301 <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>
10302
10303 !! html/parsoid
10304 <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>
10305 <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>
10306 <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>
10307 !! end
10308
10309 # a sad bit of backward-compatibility
10310 !! test
10311 Image with size specified with pxpx (bug 13500, 51628)
10312 !! options
10313 parsoid=wt2html,wt2wt,html2html
10314 !! wikitext
10315 [[File:Foobar.jpg|20pxpx]]
10316 [[File:Foobar.jpg|200x20pxpx]]
10317 !! html/php
10318 <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>
10319 <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>
10320 </p>
10321 !! html/parsoid
10322 <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>
10323 !! end
10324
10325 !! test
10326 Image with link parameter, wiki target
10327 !! wikitext
10328 [[File:Foobar.jpg|link=Main Page]]
10329 !! html/php
10330 <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>
10331 </p>
10332 !! html/parsoid
10333 <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>
10334 !! end
10335
10336 # parsoid bug 49293 (part 1)
10337 !! test
10338 Image with link parameter, URL target
10339 !! wikitext
10340 [[File:Foobar.jpg|link=http://example.com/]]
10341 !! html/php
10342 <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>
10343 </p>
10344 !! html/parsoid
10345 <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>
10346 !! end
10347
10348 # parsoid bug 49293 (part 2)
10349 !! test
10350 Image with link parameter, protocol-less URL target
10351 !! wikitext
10352 [[File:Foobar.jpg|link=//example.com/]]
10353 !! html/php
10354 <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>
10355 </p>
10356 !! html/parsoid
10357 <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>
10358 !! end
10359
10360 !! test
10361 Image with link parameter, wgExternalLinkTarget
10362 !! wikitext
10363 [[Image:foobar.jpg|link=http://example.com/]]
10364 !! config
10365 wgExternalLinkTarget='foobar'
10366 !! html
10367 <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>
10368 </p>
10369 !! end
10370
10371 !! test
10372 Image with link parameter, wgNoFollowLinks set to false
10373 !! wikitext
10374 [[Image:foobar.jpg|link=http://example.com/]]
10375 !! config
10376 wgNoFollowLinks=false
10377 !! html
10378 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10379 </p>
10380 !! end
10381
10382 !! test
10383 Image with link parameter, wgNoFollowDomainExceptions
10384 !! wikitext
10385 [[Image:foobar.jpg|link=http://example.com/]]
10386 !! config
10387 wgNoFollowDomainExceptions='example.com'
10388 !! html
10389 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10390 </p>
10391 !! end
10392
10393 !! test
10394 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10395 !! wikitext
10396 [[Image:foobar.jpg|link=http://example.com/|Title]]
10397 !! config
10398 wgExternalLinkTarget='foobar'
10399 !! html
10400 <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>
10401 </p>
10402 !! end
10403
10404 !! test
10405 Image with empty link parameter
10406 !! wikitext
10407 [[File:Foobar.jpg|link=]]
10408 !! html/php
10409 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10410 </p>
10411 !! html/parsoid
10412 <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>
10413 !! end
10414
10415 !! test
10416 Image with link parameter (wiki target) and unnamed parameter
10417 !! wikitext
10418 [[File:Foobar.jpg|link=Main_Page|Title]]
10419 !! html/php
10420 <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>
10421 </p>
10422 !! html/parsoid
10423 <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>
10424 !! end
10425
10426 !! test
10427 Image with link parameter (URL target) and unnamed parameter
10428 !! wikitext
10429 [[File:Foobar.jpg|link=http://example.com/|Title]]
10430 !! html/php
10431 <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>
10432 </p>
10433 !! html/parsoid
10434 <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>
10435 !! end
10436
10437 !! test
10438 Thumbnail image with link parameter
10439 !! options
10440 thumbsize=220
10441 parsoid=wt2html,wt2wt,html2html
10442 !! wikitext
10443 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10444 !! html/php
10445 <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>
10446
10447 !! html/parsoid
10448 <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>
10449 !! end
10450
10451 !! test
10452 Manually-specified thumbnail image
10453 !! options
10454 thumbsize=220
10455 !! wikitext
10456 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10457 !! html/php
10458 <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>
10459
10460 !! html/parsoid
10461 <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>
10462 !! end
10463
10464 !! test
10465 Manually-specified thumbnail image with explicit link to wiki page
10466 !! options
10467 thumbsize=220
10468 parsoid=wt2html,wt2wt,html2html
10469 !! wikitext
10470 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10471 !! html/php
10472 <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>
10473
10474 !! html/parsoid
10475 <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>
10476 !! end
10477
10478 !! test
10479 Manually-specified thumbnail image with explicit link to url
10480 !! options
10481 thumbsize=220
10482 parsoid=wt2html,wt2wt,html2html
10483 !! wikitext
10484 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10485 !! html/php
10486 <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>
10487
10488 !! html/parsoid
10489 <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>
10490 !! end
10491
10492 !! test
10493 Manually-specified thumbnail image with explicit no link
10494 !! options
10495 thumbsize=220
10496 parsoid=wt2html,wt2wt,html2html
10497 !! wikitext
10498 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10499 !! html/php
10500 <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>
10501
10502 !! html/parsoid
10503 <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>
10504 !! end
10505
10506 !! test
10507 Manually-specified thumbnail image with explicit link and alt text
10508 !! options
10509 thumbsize=220
10510 parsoid=wt2html,wt2wt,html2html
10511 !! wikitext
10512 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10513 !! html/php
10514 <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>
10515
10516 !! html/parsoid
10517 <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>
10518 !! end
10519
10520 !! test
10521 Image with frame and link
10522 !! options
10523 parsoid=wt2html,wt2wt,html2html
10524 !! wikitext
10525 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10526 !! html/php
10527 <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>
10528
10529 !! html/parsoid
10530 <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>
10531 !! end
10532
10533 !! test
10534 Image with frame and link and explicit alt
10535 !! options
10536 parsoid=wt2html,wt2wt,html2html
10537 !! wikitext
10538 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10539 !! html/php
10540 <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>
10541
10542 !! html/parsoid
10543 <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>
10544 !! end
10545
10546 !! test
10547 Image with wiki markup in implicit alt
10548 !! options
10549 parsoid=wt2html,wt2wt,html2html
10550 !! wikitext
10551 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10552
10553 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10554 !! html/php
10555 <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>
10556 </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>
10557 </p>
10558 !! html/parsoid
10559 <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>
10560 <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>
10561 !! end
10562
10563 ###################
10564 # Conflicting image format options.
10565 # First option specified should 'win'.
10566 # All three cases in each test should be identical.
10567
10568 !! test
10569 Image with 'frameless' first.
10570 !! options
10571 parsoid=wt2html,wt2wt,html2html
10572 !! wikitext
10573 [[File:Foobar.jpg|frameless|caption]]
10574
10575 [[File:Foobar.jpg|frameless|frame|caption]]
10576
10577 [[File:Foobar.jpg|frameless|thumb|caption]]
10578 !! html/php
10579 <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>
10580 </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>
10581 </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>
10582 </p>
10583 !! html/parsoid
10584 <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>
10585 <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>
10586 <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>
10587 !! end
10588
10589 !! test
10590 Image with 'frame' first.
10591 !! options
10592 parsoid=wt2html,wt2wt,html2html
10593 !! wikitext
10594 [[File:Foobar.jpg|frame|caption]]
10595 [[File:Foobar.jpg|frame|frameless|caption]]
10596 [[File:Foobar.jpg|frame|thumb|caption]]
10597 !! html/php
10598 <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>
10599 <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>
10600 <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>
10601
10602 !! html/parsoid
10603 <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>
10604 !! end
10605
10606 !! test
10607 Image with 'thumb' first.
10608 !! options
10609 parsoid=wt2html,wt2wt,html2html
10610 !! wikitext
10611 [[File:Foobar.jpg|thumb|caption]]
10612 [[File:Foobar.jpg|thumb|frameless|caption]]
10613 [[File:Foobar.jpg|thumb|frame|caption]]
10614 !! html/php
10615 <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>
10616 <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>
10617 <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>
10618
10619 !! html/parsoid
10620 <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>
10621 !! end
10622
10623 ###################
10624 # Image sizing.
10625 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10626 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10627 # Foobar has actual size of 1941x220
10628 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10629 # a scalable format.
10630 # 2. Framed images always ignore size options; always render at default size.
10631 # 3. "Unspecified format" and border are the only types which can be
10632 # enlarged.
10633
10634 !! test
10635 Image: "unspecified format" and border enlarge
10636 !! options
10637 parsoid=wt2html,wt2wt,html2html
10638 !! wikitext
10639 [[File:Foobar.jpg|2000px]]
10640
10641 [[File:Foobar.jpg|border|2000px]]
10642 !! html/php
10643 <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>
10644 </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>
10645 </p>
10646 !! html/parsoid
10647 <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>
10648 <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>
10649 !! end
10650
10651 !! test
10652 Image: "unspecified format" and border reduce
10653 !! options
10654 parsoid=wt2html,wt2wt,html2html
10655 !! wikitext
10656 [[File:Foobar.jpg|1000px]]
10657
10658 [[File:Foobar.jpg|border|1000px]]
10659 !! html/php
10660 <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>
10661 </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>
10662 </p>
10663 !! html/parsoid
10664 <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>
10665 <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>
10666 !! end
10667
10668 !! test
10669 Image: thumbs reduce
10670 !! options
10671 parsoid=wt2html,wt2wt,html2html
10672 !! wikitext
10673 [[File:Foobar.jpg|thumb|50px]]
10674 !! html/php
10675 <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>
10676
10677 !! html/parsoid
10678 <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>
10679 !! end
10680
10681 !! test
10682 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10683 !! options
10684 parsoid=wt2html,wt2wt,html2html
10685 !! wikitext
10686 [[File:Foobar.jpg|thumb|2000px]]
10687
10688 [[File:Foobar.svg|thumb|2000px]]
10689 !! html/php
10690 <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>
10691 <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>
10692
10693 !! html/parsoid
10694 <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>
10695 <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>
10696 !! end
10697
10698 !! test
10699 Image: frameless can reduce in size
10700 !! options
10701 parsoid=wt2html,wt2wt,html2html
10702 !! wikitext
10703 [[File:Foobar.jpg|frameless|50px]]
10704 !! html/php
10705 <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>
10706 </p>
10707 !! html/parsoid
10708 <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>
10709 !! end
10710
10711 !! test
10712 Image: bitmap frameless can't be enlarged past original size, but vector can
10713 !! options
10714 parsoid=wt2html,wt2wt,html2html
10715 !! wikitext
10716 [[File:Foobar.jpg|frameless|2000px]]
10717
10718 [[File:Foobar.svg|frameless|2000px]]
10719 !! html/php
10720 <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>
10721 </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>
10722 </p>
10723 !! html/parsoid
10724 <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>
10725 <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>
10726 !! end
10727
10728 !! test
10729 Image: framed images are always unscaled.
10730 !! options
10731 parsoid=wt2html,wt2wt,html2html
10732 !! wikitext
10733 [[File:Foobar.jpg|frame]]
10734
10735 [[File:Foobar.jpg|frame|50px]]
10736
10737 [[File:Foobar.jpg|frame|50x50px]]
10738
10739 [[File:Foobar.jpg|frame|2000px]]
10740 !! html/php
10741 <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>
10742 <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>
10743 <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>
10744 <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>
10745
10746 !! html/parsoid
10747 <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>
10748 !! end
10749
10750 ###################
10751
10752 !! test
10753 Link to image page- image page normally doesn't exists, hence edit link
10754 Add test with existing image page
10755 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10756 !! wikitext
10757 [[:Image:test]]
10758 !! html
10759 <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>
10760 </p>
10761 !! end
10762
10763 !! test
10764 bug 18784 Link to non-existent image page with caption should use caption as link text
10765 !! wikitext
10766 [[:Image:test|caption]]
10767 !! html
10768 <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>
10769 </p>
10770 !! end
10771
10772 !! test
10773 Frameless image caption with a free URL
10774 !! wikitext
10775 [[File:Foobar.jpg|http://example.com]]
10776 !! html/php
10777 <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>
10778 </p>
10779 !! html/parsoid
10780 <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>
10781 !! end
10782
10783 !! test
10784 Thumbnail image caption with a free URL
10785 !! options
10786 thumbsize=220
10787 !! wikitext
10788 [[File:Foobar.jpg|thumb|http://example.com]]
10789 !! html/php
10790 <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>
10791
10792 !! html/parsoid
10793 <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>
10794 !! end
10795
10796 !! test
10797 Thumbnail image caption with a free URL and explicit alt
10798 !! options
10799 thumbsize=220
10800 parsoid=wt2html,wt2wt,html2html
10801 !! wikitext
10802 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10803 !! html/php
10804 <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>
10805
10806 !! html/parsoid
10807 <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>
10808 !! end
10809
10810 !! test
10811 SVG thumbnails with no language set
10812 !! options
10813 !! wikitext
10814 [[File:Foobar.svg|thumb|caption]]
10815 !! html/php
10816 <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>
10817
10818 !! html/parsoid
10819 <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>
10820 !! end
10821
10822 !! test
10823 SVG thumbnails with language de
10824 !! options
10825 parsoid=wt2html,wt2wt,html2html
10826 !! wikitext
10827 [[File:Foobar.svg|thumb|caption|lang=de]]
10828 !! html/php
10829 <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>
10830
10831 !! html/parsoid
10832 <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>
10833 !! end
10834
10835 !! test
10836 SVG thumbnails with invalid language code
10837 !! options
10838 parsoid=wt2html,wt2wt,html2html
10839 !! wikitext
10840 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10841 !! html/php
10842 <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>
10843
10844 !! html/parsoid
10845 <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>
10846 !! end
10847
10848 !! test
10849 BUG 1887: A ISBN with a thumbnail
10850 !! wikitext
10851 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10852 !! html/php
10853 <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>
10854
10855 !! html/parsoid
10856 <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>
10857 !! end
10858
10859 !! test
10860 BUG 1887: A RFC with a thumbnail
10861 !! wikitext
10862 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10863 !! html/php
10864 <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>
10865
10866 !! html/parsoid
10867 <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>
10868 !! end
10869
10870 !! test
10871 BUG 1887: A mailto link with a thumbnail
10872 !! wikitext
10873 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10874 !! html/php
10875 <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>
10876
10877 !! html/parsoid
10878 <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>
10879 !! end
10880
10881 # Pending resolution to bug 368
10882 !! test
10883 BUG 648: Frameless image caption with a link
10884 !! wikitext
10885 [[File:Foobar.jpg|text with a [[link]] in it]]
10886 !! html/php
10887 <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>
10888 </p>
10889 !! html/parsoid
10890 <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>
10891 !! end
10892
10893 !! test
10894 BUG 648: Frameless image caption with a link (suffix)
10895 !! wikitext
10896 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10897 !! html/php
10898 <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>
10899 </p>
10900 !! html/parsoid
10901 <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>
10902 !! end
10903
10904 !! test
10905 BUG 648: Frameless image caption with an interwiki link
10906 !! wikitext
10907 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10908 !! html/php
10909 <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>
10910 </p>
10911 !! html/parsoid
10912 <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>
10913 !! end
10914
10915 !! test
10916 BUG 648: Frameless image caption with a piped interwiki link
10917 !! wikitext
10918 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10919 !! html/php
10920 <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>
10921 </p>
10922 !! html/parsoid
10923 <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>
10924 !! end
10925
10926 !! test
10927 Escape HTML special chars in image alt text
10928 !! wikitext
10929 [[File:Foobar.jpg|& < > "]]
10930 !! html/php
10931 <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>
10932 </p>
10933 !! html/parsoid
10934 <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>
10935 !! end
10936
10937 !! test
10938 BUG 499: Alt text should have &#1234;, not &amp;1234;
10939 !! wikitext
10940 [[File:Foobar.jpg|&#9792;]]
10941 !! html/php
10942 <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>
10943 </p>
10944 !! html/parsoid
10945 <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>
10946 !! end
10947
10948 !! test
10949 Broken image caption with link
10950 !! options
10951 parsoid=wt2html,wt2wt,html2html
10952 !! wikitext
10953 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10954 !! html/php
10955 <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.
10956 </p>
10957 !! html/parsoid
10958 <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>
10959 !! end
10960
10961 !! test
10962 Image caption containing another image
10963 !! wikitext
10964 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10965 !! html/php
10966 <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>
10967
10968 !! html/parsoid
10969 <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>
10970 !! end
10971
10972 !! test
10973 Image: caption containing a newline
10974 !! wikitext
10975 [[File:Foobar.jpg|This
10976 *is some text]]
10977 !! html/php
10978 <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>
10979 </p>
10980 !! html/parsoid
10981 <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>
10982 !!end
10983
10984 !!test
10985 Image: caption containing leading space
10986 (The leading space should not trigger nowiki escaping in wt2wt mode)
10987 !! wikitext
10988 [[File:Foobar.jpg|thumb| bar]]
10989 !! html/php
10990 <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>
10991
10992 !! html/parsoid
10993 <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>
10994 !!end
10995
10996 !! test
10997 Image: caption containing a table
10998 !! options
10999 parsoid=wt2html,wt2wt,html2html
11000 !! wikitext
11001 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11002 {|
11003 ! Foo !! Bar
11004 |-
11005 | Foo1 || Bar1
11006 |}
11007 and some more text.]]
11008 !! html/php
11009 <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>
11010
11011 !! html/parsoid
11012 <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
11013 <table>
11014 <tbody>
11015 <tr><th>Foo </th><th>Bar</th></tr>
11016 <tr>
11017 <td>Foo1 </td>
11018 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11019 !! end
11020
11021 !! test
11022 Bug 3090: External links other than http: in image captions
11023 !! wikitext
11024 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11025 !! html/php
11026 <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>
11027
11028 !! html/parsoid
11029 <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>
11030 !! end
11031
11032 !! test
11033 Custom class
11034 !! options
11035 parsoid=wt2html,wt2wt,html2html
11036 !! wikitext
11037 [[Image:foobar.jpg|a|class=b]]
11038 !! html/php
11039 <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>
11040 </p>
11041 !! html/parsoid
11042 <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>
11043 !! end
11044
11045 !! test
11046 Localized image handling (1).
11047 !! options
11048 parsoid=wt2html,wt2wt,html2html
11049 language=es
11050 !! wikitext
11051 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11052 !! html/php
11053 <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>
11054
11055 !! html/parsoid
11056 <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>
11057 !! end
11058
11059 !! test
11060 Localized image handling (2).
11061 !! options
11062 thumbsize=220
11063 parsoid=wt2html,wt2wt,html2html
11064 language=es
11065 !! wikitext
11066 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11067 !! html/php
11068 <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>
11069
11070 !! html/parsoid
11071 <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>
11072 !! end
11073
11074 !! test
11075 "border", "frameless" and "class" attributes on an image.
11076 !! options
11077 thumbsize=220
11078 parsoid=wt2html,wt2wt,html2html
11079 !! wikitext
11080 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11081 !! html/php
11082 <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>
11083 </p>
11084 !! html/parsoid
11085 <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>
11086 !! end
11087
11088 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11089 !! test
11090 Invalid image attributes (bug 62500)
11091 !! options
11092 thumbsize=220
11093 parsoid=wt2html,wt2wt,html2html
11094 !! wikitext
11095 [[File:Foobar.jpg|thumb|float|left|caption]]
11096
11097 [[File:Foobar.jpg|thumb|righ|caption]]
11098
11099 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11100 !! html/php
11101 <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>
11102 <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>
11103 <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>
11104
11105 !! html/parsoid
11106 <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>
11107 !! end
11108
11109 !! article
11110 File:Barfoo.jpg
11111 !! text
11112 #REDIRECT [[File:Barfoo.jpg]]
11113 !! endarticle
11114
11115 !! test
11116 Redirected image
11117 !! wikitext
11118 [[Image:Barfoo.jpg]]
11119 !! html
11120 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11121 </p>
11122 !! end
11123
11124 !! test
11125 Missing image with uploads disabled
11126 !! options
11127 wgEnableUploads=0
11128 !! wikitext
11129 [[Image:Foobaz.jpg]]
11130 !! html
11131 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11132 </p>
11133 !! end
11134
11135 # Parsoid-specific testing for images
11136 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11137 # Currently imperfect due to a flaw in the Parsoid testrunner
11138 # Work in progress
11139 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11140 # image tests.
11141
11142 !! test
11143 Parsoid-specific image handling - simple image with size and middle alignment
11144 !! wikitext
11145 [[File:Foobar.jpg|middle|50px]]
11146 !! html/parsoid
11147 <p><span class="mw-valign-middle" typeof="mw:Image">
11148 <a href="File:Foobar.jpg">
11149 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11150 </a>
11151 </span>
11152 </p>
11153 !! end
11154
11155 !! test
11156 Parsoid-specific image handling - simple image with size, middle alignment,
11157 non-standard namespace alias
11158 !! options
11159 parsoid=wt2wt,wt2html,html2html
11160 !! wikitext
11161 [[Image:Foobar.jpg|middle|50px]]
11162 !! html/parsoid
11163 <p><span class="mw-valign-middle" typeof="mw:Image">
11164 <a href="File:Foobar.jpg">
11165 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11166 </a>
11167 </span>
11168 </p>
11169 !! end
11170
11171 !! test
11172 Parsoid-specific image handling - simple image with size and middle alignment
11173 (existing content)
11174 !! wikitext
11175 [[File:Foobar.jpg|50px|middle]]
11176 !! html/parsoid
11177 <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>
11178 !! end
11179
11180 !! test
11181 Parsoid-specific image handling - simple image with size and middle alignment
11182 and non-standard namespace name
11183 !! options
11184 parsoid=wt2html,wt2wt,html2html
11185 !! wikitext
11186 [[Image:Foobar.jpg|50px|middle]]
11187 !! html/parsoid
11188 <p><span class="mw-valign-middle" typeof="mw:Image">
11189 <a href="File:Foobar.jpg">
11190 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11191 </a>
11192 </span>
11193 </p>
11194 !! end
11195
11196 !! test
11197 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11198 !! wikitext
11199 [[File:Foobar.jpg|500x10px|baseline|caption]]
11200 !! html/parsoid
11201 <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>
11202 !! end
11203
11204 !! test
11205 Parsoid-specific image handling - simple image with border and size spec
11206 !! wikitext
11207 [[File:Foobar.jpg|50px|border|caption]]
11208 !! html/parsoid
11209 <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>
11210 !! end
11211
11212 !! test
11213 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11214 !! wikitext
11215 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11216 !! html/parsoid
11217 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11218 <a href="File:Foobar.jpg">
11219 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11220 </a>
11221 <figcaption>caption content</figcaption>
11222 </figure>
11223 !! end
11224
11225 !! test
11226 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11227 (existing content)
11228 !! wikitext
11229 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11230 !! html/parsoid
11231 <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>
11232 !! end
11233
11234 !! test
11235 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11236 !! wikitext
11237 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11238 !! html/parsoid
11239 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11240 <a href="File:Foobar.jpg">
11241 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11242 </a>
11243 <figcaption>caption</figcaption>
11244 </figure>
11245 !! end
11246
11247 !! test
11248 Parsoid-specific image handling - thumbnail with specific size, halign,
11249 valign, and caption (existing content)
11250 !! wikitext
11251 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11252 !! html/parsoid
11253 <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>
11254 !! end
11255
11256 !! test
11257 Parsoid-specific image handling - framed image with specific size and caption
11258 (size is ignored)
11259 !! options
11260 parsoid=wt2html,wt2wt,html2html
11261 !! wikitext
11262 [[File:Foobar.jpg|frame|500x50px|caption]]
11263 !! html/parsoid
11264 <figure typeof="mw:Image/Frame">
11265 <a href="File:Foobar.jpg">
11266 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11267 </a>
11268 <figcaption>caption</figcaption>
11269 </figure>
11270 !! end
11271
11272 !! test
11273 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11274 (size is ignored)
11275 !! options
11276 parsoid=wt2html,wt2wt,html2html
11277 !! wikitext
11278 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11279 !! html/parsoid
11280 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11281 <a href="File:Foobar.jpg">
11282 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11283 </a>
11284 <figcaption>caption</figcaption>
11285 </figure>
11286 !! end
11287
11288 !! test
11289 Parsoid-specific image handling - frameless image with specific size, border, and caption
11290 !! wikitext
11291 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11292 !! html/parsoid
11293 <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>
11294 !! end
11295
11296 !! test
11297 Parsoid-specific image handling - simple image with a formatted caption
11298 !! wikitext
11299 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11300 !! html/parsoid
11301 <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>"}'>
11302 <a href="File:Foobar.jpg">
11303 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11304 </a></span></p>
11305 !! end
11306
11307 !! test
11308 Parsoid-specific image handling - caption with a template in it
11309 !! wikitext
11310 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11311 !! html/parsoid
11312 <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>
11313 !! end
11314
11315 !! test
11316 Parsoid-specific image handling - caption with unbalanced tags in it
11317 !! options
11318 parsoid=wt2html,wt2wt,html2html
11319 !! wikitext
11320 foo
11321 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11322 bar
11323 !! html/parsoid
11324 <p>foo</p>
11325 <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>
11326 <p>bar</p>
11327 !! end
11328
11329 !! test
11330 Parsoid-specific image handling - empty caption (1)
11331 !! options
11332 parsoid=wt2html,wt2wt
11333 !! wikitext
11334 [[File:Foobar.jpg|thumb|]]
11335 !! html/parsoid
11336 <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>
11337 !! end
11338
11339 # empty captions don't get serialized unless we're in the "round trip" case
11340 !! test
11341 Parsoid-specific image handling - empty caption (2)
11342 !! options
11343 parsoid=html2wt
11344 !! html/parsoid
11345 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11346 <a href="File:Foobar.jpg">
11347 <img resource="./File:Foobar.jpg"
11348 src="//example.com/images/3/3a/Foobar.jpg"
11349 height="25" width="220"/>
11350 </a>
11351 <figcaption></figcaption>
11352 </figure>
11353 !! wikitext
11354 [[File:Foobar.jpg|thumb]]
11355 !! end
11356
11357 !! test
11358 Parsoid-specific image handling - whitespace caption
11359 !! wikitext
11360 [[File:Foobar.jpg|thumb| ]]
11361 !! html/parsoid
11362 <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>
11363 !! end
11364
11365 !! test
11366 Parsoid-specific image handling - lang option
11367 !! wikitext
11368 foo
11369 [[File:Foobar.svg|lang=de|caption]]
11370 bar
11371 !! html/parsoid
11372 <p>foo
11373 <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>
11374 bar</p>
11375 !! end
11376
11377
11378 ###
11379 ### Subpages
11380 ###
11381 !! article
11382 Subpage test/subpage
11383 !! text
11384 foo
11385 !! endarticle
11386
11387 !! test
11388 Subpage link
11389 !! options
11390 subpage title=[[Subpage test]]
11391 !! wikitext
11392 [[/subpage]]
11393 !! html
11394 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11395 </p>
11396 !! end
11397
11398 !! test
11399 Subpage noslash link
11400 !! options
11401 subpage title=[[Subpage test]]
11402 !! wikitext
11403 [[/subpage/]]
11404 !! html
11405 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11406 </p>
11407 !! end
11408
11409 # TODO: make this PHP-parser compatible!
11410 !! test
11411 Relative subpage noslash link
11412 !! options
11413 parsoid=wt2wt,wt2html,html2html
11414 subpage title=[[Subpage test/1/2/3/4]]
11415 !! wikitext
11416 [[../../subpage/]]
11417
11418 [[../../subpage]]
11419 !! html
11420 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11421 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11422 !! end
11423
11424 !! test
11425 Parsoid: dot-slash prefixed wikilinks
11426 !! wikitext
11427 [[./foo]]
11428
11429 [[././bar]]
11430
11431 [[././baz/]]
11432 !! html/php
11433 <p>[[./foo]]
11434 </p><p>[[././bar]]
11435 </p><p>[[././baz/]]
11436 </p>
11437 !! html/parsoid
11438 <p>[[./foo]]
11439 </p><p>[[././bar]]
11440 </p><p>[[././baz/]]
11441 </p>
11442 !! end
11443
11444 !! test
11445 Render invalid page names as plain text (bug 51090)
11446 !! wikitext
11447 [[./../foo|bar]]
11448 [[foo�|bar]]
11449 [[foo/.|bar]]
11450 [[foo/..|bar]]
11451 [[foo~~~bar]]
11452 [[foo>bar]]
11453 [[foo[bar]]
11454 [[.]]
11455 [[..]]
11456 [[foo././bar]]
11457
11458 [[{{echo|./../foo}}|bar]]
11459 [[{{echo|foo/.}}|bar]]
11460 [[{{echo|foo/..}}|bar]]
11461 [[{{echo|foo~~~~bar}}]]
11462 [[{{echo|foo>bar}}]]
11463 [[{{echo|foo././bar}}]]
11464 [[{{echo|foo{bar}}]]
11465 [[{{echo|foo}bar}}]]
11466 [[{{echo|foo[bar}}]]
11467 [[{{echo|foo]bar}}]]
11468 [[{{echo|foo<bar}}]]
11469 !!html/php
11470 <p>[[./../foo|bar]]
11471 [[foo�|bar]]
11472 [[foo/.|bar]]
11473 [[foo/..|bar]]
11474 [[foo~~~bar]]
11475 [[foo&gt;bar]]
11476 [[foo[bar]]
11477 [[.]]
11478 [[..]]
11479 [[foo././bar]]
11480 </p><p>[[./../foo|bar]]
11481 [[foo/.|bar]]
11482 [[foo/..|bar]]
11483 [[foo~~~~bar]]
11484 [[foo&gt;bar]]
11485 [[foo././bar]]
11486 [[foo{bar]]
11487 [[foo}bar]]
11488 [[foo[bar]]
11489 [[foo]bar]]
11490 [[foo&lt;bar]]
11491 </p>
11492 !!html/parsoid
11493 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11494 <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>
11495 !!end
11496
11497 !! test
11498 Disabled subpages
11499 !! wikitext
11500 [[/subpage]]
11501 !! html
11502 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11503 </p>
11504 !! end
11505
11506 !! test
11507 BUG 561: {{/Subpage}}
11508 !! options
11509 subpage title=[[Page]]
11510 !! wikitext
11511 {{/Subpage}}
11512 !! html
11513 <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>
11514 </p>
11515 !! end
11516
11517 ###
11518 ### Categories
11519 ###
11520 !! article
11521 Category:MediaWiki User's Guide
11522 !! text
11523 blah
11524 !! endarticle
11525
11526 !! test
11527 Link to category
11528 !! wikitext
11529 [[:Category:MediaWiki User's Guide]]
11530 !! html
11531 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11532 </p>
11533 !! end
11534
11535 !! test
11536 Simple category
11537 !! options
11538 cat
11539 !! wikitext
11540 [[Category:MediaWiki User's Guide]]
11541 !! html
11542 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11543 !! end
11544
11545 !! test
11546 PAGESINCATEGORY invalid title fatal (r33546 fix)
11547 !! wikitext
11548 {{PAGESINCATEGORY:<bogus>}}
11549 !! html
11550 <p>0
11551 </p>
11552 !! end
11553
11554 !! test
11555 Category with different sort key
11556 !! options
11557 cat
11558 !! wikitext
11559 [[Category:MediaWiki User's Guide|Foo]]
11560 !! html
11561 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11562 !! end
11563
11564 !! test
11565 Category with identical sort key
11566 !! options
11567 cat
11568 !! wikitext
11569 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11570 !! html
11571 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11572 !! end
11573
11574 !! test
11575 Category with empty sort key
11576 !! options
11577 cat
11578 pst
11579 !! wikitext
11580 [[Category:MediaWiki User's Guide|]]
11581 !! html
11582 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11583 !! end
11584
11585 !! test
11586 Category with empty sort key and parentheses
11587 !! options
11588 cat
11589 pst
11590 !! wikitext
11591 [[Category:Foo (bar)|]]
11592 !! html
11593 [[Category:Foo (bar)|Foo]]
11594 !! end
11595
11596 !! test
11597 Category with link tail
11598 !! options
11599 cat
11600 pst
11601 !! wikitext
11602 123[[Category:Foo]]456
11603 !! html
11604 123[[Category:Foo]]456
11605 !! end
11606
11607 !! test
11608 Category with template
11609 !! options
11610 cat
11611 pst
11612 !! wikitext
11613 [[Category:{{echo|Foo}}]]
11614 !! html
11615 [[Category:{{echo|Foo}}]]
11616 !! end
11617
11618 !! test
11619 Category with template in sort key
11620 !! options
11621 cat
11622 pst
11623 !! wikitext
11624 [[Category:Foo|{{echo|Bar}}]]
11625 !! html
11626 [[Category:Foo|{{echo|Bar}}]]
11627 !! end
11628
11629 !! test
11630 Category with template in sort key and title
11631 !! options
11632 cat
11633 pst
11634 !! wikitext
11635 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11636 !! html
11637 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11638 !! end
11639
11640 !! test
11641 Category / paragraph interactions
11642 !! wikitext
11643 Foo [[Category:Baz]] Bar
11644
11645 Foo [[Category:Baz]]
11646 Bar
11647
11648 Foo
11649 [[Category:Baz]]
11650 Bar
11651
11652 Foo
11653 [[Category:Baz]] Bar
11654
11655 Foo
11656 [[Category:Baz]]
11657 [[Category:Baz]]
11658 [[Category:Baz]]
11659 Bar
11660
11661 [[Category:Baz]]
11662 [[Category:Baz]]
11663 [[Category:Baz]]
11664
11665 [[Category:Baz]]
11666 {{echo|[[Category:Baz]]}}
11667 [[Category:Baz]]
11668 !! html
11669 <p>Foo Bar
11670 </p><p>Foo
11671 Bar
11672 </p><p>Foo
11673 Bar
11674 </p><p>Foo Bar
11675 </p><p>Foo
11676 Bar
11677 </p>
11678 !! end
11679
11680 !! test
11681 Parsoid: Serialize link to category page with colon escape
11682 !! options
11683 parsoid
11684 !! wikitext
11685
11686 [[:Category:Foo]]
11687 [[:Category:Foo|Bar]]
11688 !! html
11689 <p>
11690 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11691 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11692 </p>
11693 !! end
11694
11695 !! test
11696 Parsoid: Link prefix/suffixes aren't applied to category links
11697 !! options
11698 parsoid=wt2html,wt2wt,html2html
11699 language=is
11700 !! wikitext
11701 x[[Category:Foo]]y
11702 !! html
11703 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11704 !! end
11705
11706 !! test
11707 Parsoid: Serialize link to file page with colon escape
11708 !! options
11709 parsoid
11710 !! wikitext
11711
11712 [[:File:Foo.png]]
11713 [[:File:Foo.png|Bar]]
11714 !! html
11715 <p>
11716 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11717 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11718 </p>
11719 !! end
11720
11721 !! test
11722 Parsoid: Serialize a genuine category link without colon escape
11723 !! options
11724 parsoid
11725 !! wikitext
11726 [[Category:Foo]]
11727 [[Category:Foo|Bar]]
11728 !! html
11729 <link rel="mw:PageProp/Category" href="Category:Foo">
11730 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11731 !! end
11732
11733 !! test
11734 Parsoid: Defaultsort
11735 !! options
11736 parsoid
11737 !! wikitext
11738 {{DEFAULTSORT:Foo}}
11739 !! html
11740 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11741 !! end
11742
11743 ###
11744 ### Inter-language links
11745 ###
11746 !! test
11747 Inter-language links
11748 !! options
11749 ill
11750 !! wikitext
11751 [[es:Alimento]]
11752 [[fr:Nourriture]]
11753 [[zh:&#39135;&#21697;]]
11754 !! html
11755 es:Alimento fr:Nourriture zh:食品
11756 !! end
11757
11758 !! test
11759 Duplicate interlanguage links (bug 24502)
11760 !! options
11761 ill
11762 !! wikitext
11763 [[es:1]]
11764 [[es:2]]
11765 [[fr:1]]
11766 [[fr:2]]
11767 !! html
11768 es:1 fr:1
11769 !! end
11770
11771 ###
11772 ### Sections
11773 ###
11774 !! test
11775 Basic section headings
11776 !! wikitext
11777 == Headline 1 ==
11778 Some text
11779
11780 ==Headline 2==
11781 More
11782 ===Smaller headline===
11783 Blah blah
11784 !! html
11785 <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>
11786 <p>Some text
11787 </p>
11788 <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>
11789 <p>More
11790 </p>
11791 <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>
11792 <p>Blah blah
11793 </p>
11794 !! end
11795
11796 !! test
11797 Section headings with TOC
11798 !! wikitext
11799 == Headline 1 ==
11800 === Subheadline 1 ===
11801 ===== Skipping a level =====
11802 ====== Skipping a level ======
11803
11804 == Headline 2 ==
11805 Some text
11806 ===Another headline===
11807 !! html
11808 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11809 <ul>
11810 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11811 <ul>
11812 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11813 <ul>
11814 <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>
11815 <ul>
11816 <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>
11817 </ul>
11818 </li>
11819 </ul>
11820 </li>
11821 </ul>
11822 </li>
11823 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11824 <ul>
11825 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11826 </ul>
11827 </li>
11828 </ul>
11829 </div>
11830
11831 <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>
11832 <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>
11833 <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>
11834 <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>
11835 <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>
11836 <p>Some text
11837 </p>
11838 <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>
11839
11840 !! end
11841
11842 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11843 !! test
11844 Handling of sections up to level 6 and beyond
11845 !! wikitext
11846 = Level 1 Heading=
11847 == Level 2 Heading==
11848 === Level 3 Heading===
11849 ==== Level 4 Heading====
11850 ===== Level 5 Heading=====
11851 ====== Level 6 Heading======
11852 ======= Level 7 Heading=======
11853 ======== Level 8 Heading========
11854 ========= Level 9 Heading=========
11855 ========== Level 10 Heading==========
11856 !! html
11857 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11858 <ul>
11859 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11860 <ul>
11861 <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>
11862 <ul>
11863 <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>
11864 <ul>
11865 <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>
11866 <ul>
11867 <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>
11868 <ul>
11869 <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>
11870 <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>
11871 <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>
11872 <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>
11873 <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>
11874 </ul>
11875 </li>
11876 </ul>
11877 </li>
11878 </ul>
11879 </li>
11880 </ul>
11881 </li>
11882 </ul>
11883 </li>
11884 </ul>
11885 </div>
11886
11887 <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>
11888 <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>
11889 <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>
11890 <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>
11891 <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>
11892 <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>
11893 <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>
11894 <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>
11895 <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>
11896 <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>
11897
11898 !! end
11899
11900 !! test
11901 TOC regression (bug 9764)
11902 !! wikitext
11903 == title 1 ==
11904 === title 1.1 ===
11905 ==== title 1.1.1 ====
11906 === title 1.2 ===
11907 == title 2 ==
11908 === title 2.1 ===
11909 !! html
11910 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11911 <ul>
11912 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11913 <ul>
11914 <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>
11915 <ul>
11916 <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>
11917 </ul>
11918 </li>
11919 <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>
11920 </ul>
11921 </li>
11922 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11923 <ul>
11924 <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>
11925 </ul>
11926 </li>
11927 </ul>
11928 </div>
11929
11930 <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>
11931 <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>
11932 <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>
11933 <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>
11934 <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>
11935 <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>
11936
11937 !! end
11938
11939 !! test
11940 TOC with wgMaxTocLevel=3 (bug 6204)
11941 !! options
11942 wgMaxTocLevel=3
11943 !! wikitext
11944 == title 1 ==
11945 === title 1.1 ===
11946 ==== title 1.1.1 ====
11947 === title 1.2 ===
11948 == title 2 ==
11949 === title 2.1 ===
11950 !! html
11951 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11952 <ul>
11953 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11954 <ul>
11955 <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>
11956 <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>
11957 </ul>
11958 </li>
11959 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11960 <ul>
11961 <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>
11962 </ul>
11963 </li>
11964 </ul>
11965 </div>
11966
11967 <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>
11968 <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>
11969 <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>
11970 <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>
11971 <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>
11972 <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>
11973
11974 !! end
11975
11976 !! test
11977 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11978 !! options
11979 wgMaxTocLevel=3
11980 !! wikitext
11981 ==Section 1==
11982 ===Section 1.1===
11983 ====Section 1.1.1====
11984 ====Section 1.1.1.1====
11985 ==Section 2==
11986 !! html
11987 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11988 <ul>
11989 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11990 <ul>
11991 <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>
11992 </ul>
11993 </li>
11994 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11995 </ul>
11996 </div>
11997
11998 <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>
11999 <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>
12000 <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>
12001 <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>
12002 <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>
12003
12004 !! end
12005
12006
12007 !! test
12008 Resolving duplicate section names
12009 !! wikitext
12010 == Foo bar ==
12011 == Foo bar ==
12012 !! html
12013 <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>
12014 <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>
12015
12016 !! end
12017
12018 !! test
12019 Resolving duplicate section names with differing case (bug 10721)
12020 !! wikitext
12021 == Foo bar ==
12022 == Foo Bar ==
12023 !! html
12024 <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>
12025 <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>
12026
12027 !! end
12028
12029 !! article
12030 Template:sections
12031 !! text
12032 ===Section 1===
12033 ==Section 2==
12034 !! endarticle
12035
12036 !! test
12037 Template with sections, __NOTOC__
12038 !! wikitext
12039 __NOTOC__
12040 ==Section 0==
12041 {{sections}}
12042 ==Section 4==
12043 !! html
12044 <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>
12045 <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>
12046 <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>
12047 <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>
12048
12049 !! end
12050
12051 !! test
12052 __NOEDITSECTION__ keyword
12053 !! wikitext
12054 __NOEDITSECTION__
12055 ==Section 1==
12056 ==Section 2==
12057 !! html
12058 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12059 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12060
12061 !! end
12062
12063 !! test
12064 Link inside a section heading
12065 !! wikitext
12066 ==Section with a [[Main Page|link]] in it==
12067 !! html
12068 <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>
12069
12070 !! end
12071
12072 !! test
12073 TOC regression (bug 12077)
12074 !! wikitext
12075 __TOC__
12076 == title 1 ==
12077 === title 1.1 ===
12078 == title 2 ==
12079 !! html
12080 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12081 <ul>
12082 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12083 <ul>
12084 <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>
12085 </ul>
12086 </li>
12087 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12088 </ul>
12089 </div>
12090
12091 <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>
12092 <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>
12093 <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>
12094
12095 !! end
12096
12097 !! test
12098 BUG 1219 URL next to image (good)
12099 !! wikitext
12100 http://example.com [[Image:foobar.jpg]]
12101 !! html
12102 <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>
12103 </p>
12104 !!end
12105
12106 !! test
12107 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12108 !! wikitext
12109 ===
12110 The line above must have a trailing space!
12111 === <!--
12112 --> <!-- -->
12113 But just in case it doesn't...
12114 !! html
12115 <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>
12116 <p>The line above must have a trailing space!
12117 </p>
12118 <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>
12119 <p>But just in case it doesn't...
12120 </p>
12121 !! end
12122
12123 !! test
12124 Header with special characters (bug 25462)
12125 !! wikitext
12126 The tooltips shall not show entities to the user (ie. be double escaped)
12127
12128 == text > text ==
12129 section 1
12130
12131 == text < text ==
12132 section 2
12133
12134 == text & text ==
12135 section 3
12136
12137 == text ' text ==
12138 section 4
12139
12140 == text " text ==
12141 section 5
12142 !! html
12143 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12144 </p>
12145 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12146 <ul>
12147 <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>
12148 <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>
12149 <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>
12150 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12151 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12152 </ul>
12153 </div>
12154
12155 <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>
12156 <p>section 1
12157 </p>
12158 <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>
12159 <p>section 2
12160 </p>
12161 <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>
12162 <p>section 3
12163 </p>
12164 <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>
12165 <p>section 4
12166 </p>
12167 <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>
12168 <p>section 5
12169 </p>
12170 !! end
12171
12172 !! test
12173 Headers with excess '=' characters
12174 (Are similar tests necessary beyond the 1st level?)
12175 !! wikitext
12176 =foo==
12177 ==foo=
12178 =''italic'' heading==
12179 ==''italic'' heading=
12180 !! html
12181 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12182 <ul>
12183 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12184 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12185 <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>
12186 <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>
12187 </ul>
12188 </div>
12189
12190 <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>
12191 <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>
12192 <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>
12193 <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>
12194
12195 !! end
12196
12197 !! test
12198 HTML headers vs TOC (bug 23393)
12199 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12200 !! wikitext
12201 <h1>Header 1</h1>
12202 == Header 1.1 ==
12203 == Header 1.2 ==
12204
12205 <h1>Header 2
12206 </h1>
12207 == Header 2.1 ==
12208 == Header 2.2 ==
12209 __NOEDITSECTION__
12210 !! html
12211 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12212 <ul>
12213 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12214 <ul>
12215 <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>
12216 <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>
12217 </ul>
12218 </li>
12219 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12220 <ul>
12221 <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>
12222 <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>
12223 </ul>
12224 </li>
12225 </ul>
12226 </div>
12227
12228 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12229 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12230 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12231 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12232 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12233 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12234
12235 !! end
12236
12237 !! test
12238 Single-line or multiline-comments can follow headings
12239 !! options
12240 parsoid=wt2html,wt2wt
12241 !! wikitext
12242 ==foo==<!---->
12243 ==bar==<!--c1-->
12244 ==baz==<!--
12245 c2
12246 c3-->
12247 !! html
12248 <h2><span class="mw-headline" id="foo">foo</span></h2>
12249 <h2><span class="mw-headline" id="bar">bar</span></h2>
12250 <h2><span class="mw-headline" id="baz">baz</span></h2>
12251
12252 !! end
12253
12254 !! test
12255 BUG 1219 URL next to image (broken)
12256 !! wikitext
12257 http://example.com[[Image:foobar.jpg]]
12258 !! html
12259 <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>
12260 </p>
12261 !!end
12262
12263 !! test
12264 Bug 1186 news: in the middle of text
12265 !! wikitext
12266 http://en.wikinews.org/wiki/Wikinews:Workplace
12267 !! html
12268 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12269 </p>
12270 !!end
12271
12272
12273 !! test
12274 Namespaced link must have a title
12275 !! wikitext
12276 [[Project:]]
12277 !! html
12278 <p>[[Project:]]
12279 </p>
12280 !!end
12281
12282 !! test
12283 Namespaced link must have a title (bad fragment version)
12284 !! wikitext
12285 [[Project:#fragment]]
12286 !! html
12287 <p>[[Project:#fragment]]
12288 </p>
12289 !!end
12290
12291
12292 ###
12293 ### HTML tags and HTML attributes
12294 ###
12295
12296 !! test
12297 div with no attributes
12298 !! wikitext
12299 <div>HTML rocks</div>
12300 !! html
12301 <div>HTML rocks</div>
12302
12303 !! end
12304
12305 !! test
12306 div with double-quoted attribute
12307 !! wikitext
12308 <div id="rock">HTML rocks</div>
12309 !! html
12310 <div id="rock">HTML rocks</div>
12311
12312 !! end
12313
12314 !! test
12315 div with single-quoted attribute
12316 !! wikitext
12317 <div id='rock'>HTML rocks</div>
12318 !! html
12319 <div id="rock">HTML rocks</div>
12320
12321 !! end
12322
12323 !! test
12324 div with unquoted attribute
12325 !! wikitext
12326 <div id=rock>HTML rocks</div>
12327 !! html
12328 <div id="rock">HTML rocks</div>
12329
12330 !! end
12331
12332 !! test
12333 div with illegal double attributes
12334 !! wikitext
12335 <div id="a" id="b">HTML rocks</div>
12336 !! html
12337 <div id="b">HTML rocks</div>
12338
12339 !!end
12340
12341 # FIXME: produce empty string instead of "class" in the PHP parser, following
12342 # the HTML5 spec.
12343 !! test
12344 div with empty attribute value, space before equals
12345 !! options
12346 parsoid
12347 !! wikitext
12348 <div class =>HTML rocks</div>
12349 !! html
12350 <div class="">HTML rocks</div>
12351
12352 !! end
12353
12354 # The PHP parser escapes the opening brace to &#123; for some reason, so
12355 # disabled this test for it.
12356 !! test
12357 div with braces in attribute value
12358 !! options
12359 parsoid
12360 !! wikitext
12361 <div title="{}">Foo</div>
12362 !! html
12363 <div title="{}">Foo</div>
12364 !! end
12365
12366 # This it very inconsistent in the PHP parser: it returns
12367 # class="class" if there is a space between the name and the equal sign (see
12368 # 'div with empty attribute value, space before equals'), but strips the
12369 # attribute completely if the space is missing. We hope that not much content
12370 # depends on this, so are implementing the behavior below in Parsoid for
12371 # consistencies' sake. Disabled for the PHP parser.
12372 # FIXME: fix this behavior in the PHP parser?
12373 !! test
12374 div with empty attribute value, no space before equals
12375 !! options
12376 parsoid
12377 !! wikitext
12378 <div class=>HTML rocks</div>
12379 !! html
12380 <div class="">HTML rocks</div>
12381
12382 !! end
12383
12384 !! test
12385 HTML multiple attributes correction
12386 !! wikitext
12387 <p class="error" class="awesome">Awesome!</p>
12388 !! html
12389 <p class="awesome">Awesome!</p>
12390
12391 !!end
12392
12393 !! test
12394 Table multiple attributes correction
12395 !! wikitext
12396 {|
12397 !+ class="error" class="awesome"| status
12398 |}
12399 !! html
12400 <table>
12401 <tr>
12402 <th class="awesome"> status
12403 </th></tr></table>
12404
12405 !!end
12406
12407 !! test
12408 DIV IN UPPERCASE
12409 !! wikitext
12410 <DIV ID="x">HTML ROCKS</DIV>
12411 !! html
12412 <div id="x">HTML ROCKS</div>
12413
12414 !!end
12415
12416 !! test
12417 Non-ASCII pseudo-tags are rendered as text
12418 !! wikitext
12419 <khyô>
12420 !! html
12421 <p>&lt;khyô&gt;
12422 </p>
12423 !! end
12424
12425 !! test
12426 Pseudo-tag with URL 'name' renders as url link
12427 !! wikitext
12428 <http://example.com/>
12429 !! html
12430 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12431 </p>
12432 !! end
12433
12434 !! test
12435 text with amp in the middle of nowhere
12436 !! wikitext
12437 Remember AT&T?
12438 !! html
12439 <p>Remember AT&amp;T?
12440 </p>
12441 !! end
12442
12443 !! test
12444 text with character entity: eacute
12445 !! wikitext
12446 I always thought &eacute; was a cute letter.
12447 !! html
12448 <p>I always thought &#233; was a cute letter.
12449 </p>
12450 !! end
12451
12452 !! test
12453 text with entity-escaped character entity-like string: eacute
12454 !! wikitext
12455 I always thought &amp;eacute; was a cute letter.
12456 !! html
12457 <p>I always thought &amp;eacute; was a cute letter.
12458 </p>
12459 !! end
12460
12461 !! test
12462 text with undefined character entity: xacute
12463 !! wikitext
12464 I always thought &xacute; was a cute letter.
12465 !! html
12466 <p>I always thought &amp;xacute; was a cute letter.
12467 </p>
12468 !! end
12469
12470 # TODO: generalize to PHP parser?
12471 !! test
12472 HTML5 tags
12473 !! options
12474 parsoid
12475 !! wikitext
12476 <data value="5">five</data>
12477 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12478 <mark>This highlighted text</mark>
12479 !! html
12480 <p><data value="5">five</data>
12481 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12482 <mark>This highlighted text</mark></p>
12483 !! end
12484
12485 !! test
12486 HTML tag with leading space is parsed as text
12487 !! wikitext
12488 < div>foo< /div>
12489 !! html
12490 <p>&lt; div&gt;foo&lt; /div&gt;
12491 </p>
12492 !! end
12493
12494 ###
12495 ### Nesting tests (see bug 41545, 50604, 51081)
12496 ###
12497
12498 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12499 # Note that html2wt is considerably more difficult if we use <b> in
12500 # the test case, instead of <big>
12501 !! test
12502 Ensure that HTML adoption agency algorithm is properly implemented.
12503 !! wikitext
12504 <big>X<big>Y</big>Z</big>
12505 !! html
12506 <p><big>X<big>Y</big>Z</big>
12507 </p>
12508 !! end
12509
12510 # This was bug 41545 in the PHP parser.
12511 !! test
12512 Nesting of <kbd>
12513 !! wikitext
12514 <kbd>X<kbd>Y</kbd>Z</kbd>
12515 !! html
12516 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12517 </p>
12518 !! end
12519
12520 # The following cases were bug 51081 in the PHP parser.
12521 # Note that there are some other nestable tags (b, i, etc) which are
12522 # not covered; see bug 51081 for discussion.
12523 !! test
12524 Nesting of <em>
12525 !! wikitext
12526 <em>X<em>Y</em>Z</em>
12527 !! html
12528 <p><em>X<em>Y</em>Z</em>
12529 </p>
12530 !! end
12531
12532 !! test
12533 Nesting of <strong>
12534 !! wikitext
12535 <strong>X<strong>Y</strong>Z</strong>
12536 !! html
12537 <p><strong>X<strong>Y</strong>Z</strong>
12538 </p>
12539 !! end
12540
12541 !! test
12542 Nesting of <q>
12543 !! wikitext
12544 <q>X<q>Y</q>Z</q>
12545 !! html
12546 <p><q>X<q>Y</q>Z</q>
12547 </p>
12548 !! end
12549
12550 !! test
12551 Nesting of <ruby>
12552 !! wikitext
12553 <ruby>X<ruby>Y</ruby>Z</ruby>
12554 !! html
12555 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12556 </p>
12557 !! end
12558
12559 !! test
12560 Nesting of <bdo>
12561 !! wikitext
12562 <bdo>X<bdo>Y</bdo>Z</bdo>
12563 !! html
12564 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12565 </p>
12566 !! end
12567
12568
12569 ###
12570 ### Media links
12571 ###
12572
12573 !! test
12574 Media link
12575 !! wikitext
12576 [[Media:Foobar.jpg]]
12577 !! html
12578 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12579 </p>
12580 !! end
12581
12582 !! test
12583 Media link with text
12584 !! wikitext
12585 [[Media:Foobar.jpg|A neat file to look at]]
12586 !! html
12587 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12588 </p>
12589 !! end
12590
12591 # FIXME: this is still bad HTML tag nesting
12592 !! test
12593 Media link with nasty text
12594 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12595 !! wikitext
12596 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12597 !! html
12598 <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>
12599
12600 !! end
12601
12602 !! test
12603 Media link to nonexistent file (bug 1702)
12604 !! wikitext
12605 [[Media:No such.jpg]]
12606 !! html
12607 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12608 </p>
12609 !! end
12610
12611 !! test
12612 Image link to nonexistent file (bug 1850 - good)
12613 !! wikitext
12614 [[Image:No such.jpg]]
12615 !! html
12616 <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>
12617 </p>
12618 !! end
12619
12620 !! test
12621 :Image link to nonexistent file (bug 1850 - bad)
12622 !! wikitext
12623 [[:Image:No such.jpg]]
12624 !! html
12625 <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>
12626 </p>
12627 !! end
12628
12629
12630
12631 !! test
12632 Character reference normalization in link text (bug 1938)
12633 !! wikitext
12634 [[Main Page|this&that]]
12635 !! html
12636 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12637 </p>
12638 !!end
12639
12640 !! article
12641 אַ
12642 !! text
12643 Test for unicode normalization
12644
12645 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12646 !! endarticle
12647
12648 !! test
12649 (bug 19451) Links should refer to the normalized form.
12650 !! wikitext
12651 [[&#xFB2E;]]
12652 [[&#x5d0;&#x5b7;]]
12653 [[&#x5d0;ַ]]
12654 [[א&#x5b7;]]
12655 [[אַ]]
12656 !! html
12657 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12658 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12659 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12660 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12661 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12662 </p>
12663 !! end
12664
12665 !! test
12666 Empty attribute crash test (bug 2067)
12667 !! wikitext
12668 <font color="">foo</font>
12669 !! html
12670 <p><font color="">foo</font>
12671 </p>
12672 !! end
12673
12674 !! test
12675 Empty attribute crash test single-quotes (bug 2067)
12676 !! wikitext
12677 <font color=''>foo</font>
12678 !! html
12679 <p><font color="">foo</font>
12680 </p>
12681 !! end
12682
12683 !! test
12684 Attribute test: equals, then nothing
12685 !! wikitext
12686 <font color=>foo</font>
12687 !! html
12688 <p><font>foo</font>
12689 </p>
12690 !! end
12691
12692 !! test
12693 Attribute test: unquoted value
12694 !! wikitext
12695 <font color=x>foo</font>
12696 !! html
12697 <p><font color="x">foo</font>
12698 </p>
12699 !! end
12700
12701 !! test
12702 Attribute test: unquoted but illegal value (hash)
12703 !! wikitext
12704 <font color=#x>foo</font>
12705 !! html
12706 <p><font color="#x">foo</font>
12707 </p>
12708 !! end
12709
12710 !! test
12711 Attribute test: no value
12712 !! wikitext
12713 <font color>foo</font>
12714 !! html
12715 <p><font color="color">foo</font>
12716 </p>
12717 !! end
12718
12719 !! test
12720 Bug 2095: link with three closing brackets
12721 !! wikitext
12722 [[Main Page]]]
12723 !! html/php
12724 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12725 </p>
12726 !! html/parsoid
12727 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12728 !! end
12729
12730 !! test
12731 Bug 2095: link with pipe and three closing brackets
12732 !! wikitext
12733 [[Main Page|link]]]
12734 !! html/php
12735 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12736 </p>
12737 !! html/parsoid
12738 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12739 !! end
12740
12741 !! test
12742 Bug 2095: link with pipe and three closing brackets, version 2
12743 !! wikitext
12744 [[Main Page|[http://example.com/]]]
12745 !! html/php
12746 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12747 </p>
12748 !! html/parsoid
12749 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12750 !! end
12751
12752
12753 ###
12754 ### Safety
12755 ###
12756
12757 !! article
12758 Template:Dangerous attribute
12759 !! text
12760 " onmouseover="alert(document.cookie)
12761 !! endarticle
12762
12763 !! article
12764 Template:Dangerous style attribute
12765 !! text
12766 border-size: expression(alert(document.cookie))
12767 !! endarticle
12768
12769 !! article
12770 Template:Div style
12771 !! text
12772 <div style="float: right; {{{1}}}">Magic div</div>
12773 !! endarticle
12774
12775 !! test
12776 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12777 !! wikitext
12778 <div title="{{test}}"></div>
12779 !! html
12780 <div title="This is a test template"></div>
12781
12782 !! end
12783
12784 !! test
12785 Bug 2304: HTML attribute safety (dangerous template; 2309)
12786 !! wikitext
12787 <div title="{{dangerous attribute}}"></div>
12788 !! html
12789 <div title=""></div>
12790
12791 !! end
12792
12793 !! test
12794 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12795 !! wikitext
12796 <div style="{{dangerous style attribute}}"></div>
12797 !! html
12798 <div style="/* insecure input */"></div>
12799
12800 !! end
12801
12802 !! test
12803 Bug 2304: HTML attribute safety (safe parameter; 2309)
12804 !! wikitext
12805 {{div style|width: 200px}}
12806 !! html
12807 <div style="float: right; width: 200px">Magic div</div>
12808
12809 !! end
12810
12811 !! test
12812 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12813 !! wikitext
12814 {{div style|width: expression(alert(document.cookie))}}
12815 !! html
12816 <div style="/* insecure input */">Magic div</div>
12817
12818 !! end
12819
12820 !! test
12821 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12822 !! wikitext
12823 {{div style|"><script>alert(document.cookie)</script>}}
12824 !! html
12825 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12826
12827 !! end
12828
12829 !! test
12830 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12831 !! wikitext
12832 {{div style|" ><script>alert(document.cookie)</script>}}
12833 !! html
12834 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12835
12836 !! end
12837
12838 !! test
12839 Bug 2304: HTML attribute safety (link)
12840 !! wikitext
12841 <div title="[[Main Page]]"></div>
12842 !! html
12843 <div title="&#91;&#91;Main Page]]"></div>
12844
12845 !! end
12846
12847 !! test
12848 Bug 2304: HTML attribute safety (italics)
12849 !! wikitext
12850 <div title="''foobar''"></div>
12851 !! html
12852 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12853
12854 !! end
12855
12856 !! test
12857 Bug 2304: HTML attribute safety (bold)
12858 !! wikitext
12859 <div title="'''foobar'''"></div>
12860 !! html
12861 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12862
12863 !! end
12864
12865
12866 !! test
12867 Bug 2304: HTML attribute safety (ISBN)
12868 !! wikitext
12869 <div title="ISBN 1234567890"></div>
12870 !! html
12871 <div title="&#73;SBN 1234567890"></div>
12872
12873 !! end
12874
12875 !! test
12876 Bug 2304: HTML attribute safety (RFC)
12877 !! wikitext
12878 <div title="RFC 1234"></div>
12879 !! html
12880 <div title="&#82;FC 1234"></div>
12881
12882 !! end
12883
12884 !! test
12885 Bug 2304: HTML attribute safety (PMID)
12886 !! wikitext
12887 <div title="PMID 1234567890"></div>
12888 !! html
12889 <div title="&#80;MID 1234567890"></div>
12890
12891 !! end
12892
12893 !! test
12894 Bug 2304: HTML attribute safety (web link)
12895 !! wikitext
12896 <div title="http://example.com/"></div>
12897 !! html
12898 <div title="http&#58;//example.com/"></div>
12899
12900 !! end
12901
12902 !! test
12903 Bug 2304: HTML attribute safety (named web link)
12904 !! wikitext
12905 <div title="[http://example.com/ link]"></div>
12906 !! html
12907 <div title="&#91;http&#58;//example.com/ link]"></div>
12908
12909 !! end
12910
12911 !! test
12912 Bug 3244: HTML attribute safety (extension; safe)
12913 !! wikitext
12914 <div style="<nowiki>background:blue</nowiki>"></div>
12915 !! html
12916 <div style="background:blue"></div>
12917
12918 !! end
12919
12920 !! test
12921 Bug 3244: HTML attribute safety (extension; unsafe)
12922 !! wikitext
12923 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12924 !! html
12925 <div style="/* insecure input */"></div>
12926
12927 !! end
12928
12929 # More MSIE fun discovered by Tom Gilder
12930
12931 !! test
12932 MSIE CSS safety test: spurious slash
12933 !! wikitext
12934 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12935 !! html
12936 <div style="/* insecure input */">evil</div>
12937
12938 !! end
12939
12940 !! test
12941 MSIE CSS safety test: hex code
12942 !! wikitext
12943 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12944 !! html
12945 <div style="/* insecure input */">evil</div>
12946
12947 !! end
12948
12949 !! test
12950 MSIE CSS safety test: comment in url
12951 !! wikitext
12952 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12953 !! html
12954 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12955
12956 !! end
12957
12958 !! test
12959 MSIE CSS safety test: comment in expression
12960 !! wikitext
12961 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12962 !! html
12963 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12964
12965 !! end
12966
12967 !! test
12968 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12969 !! wikitext
12970 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12971 !! html
12972 <p style="/* invalid control char */">A</p>
12973
12974 !! end
12975
12976 !! test
12977 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12978 !! wikitext
12979 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12980 <div style="top:EXPRESSION(alert())">B</div>
12981 !! html
12982 <p style="/* insecure input */">A</p>
12983 <div style="/* insecure input */">B</div>
12984
12985 !! end
12986
12987 !! test
12988 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12989 !! wikitext
12990 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12991 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12992 !! html
12993 <div style="/* insecure input */">A</div>
12994 <p style="/* insecure input */">B</p>
12995
12996 !! end
12997
12998 !! test
12999 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13000 !! wikitext
13001 <div style="background-image:url⁽javascript:alert())">A</div>
13002 <div style="background-image:url₍javascript:alert())">B</div>
13003 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13004 !! html
13005 <div style="/* insecure input */">A</div>
13006 <div style="/* insecure input */">B</div>
13007 <p style="/* insecure input */">C</p>
13008
13009 !! end
13010
13011 !! test
13012 Opera -o-link CSS
13013 !! wikitext
13014 <div
13015 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;"
13016 style="-o-link:attr(title);-o-link-source:current">X</div>
13017 !! html
13018 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13019
13020 !! end
13021
13022 !! test
13023 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13024 !! wikitext
13025 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13026 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13027 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13028 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13029 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13030 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13031 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13032 !! html
13033 <p style="/* insecure input */">A</p>
13034 <p style="/* insecure input */">B</p>
13035 <p style="/* insecure input */">C</p>
13036 <p style="/* insecure input */">D</p>
13037 <p style="/* insecure input */">E</p>
13038 <p style="/* insecure input */">F</p>
13039 <p style="/* insecure input */">G</p>
13040
13041 !! end
13042
13043 !! test
13044 Table attribute legitimate extension
13045 !! wikitext
13046 {|
13047 !+ style="<nowiki>color:blue</nowiki>"| status
13048 |}
13049 !! html
13050 <table>
13051 <tr>
13052 <th style="color:blue"> status
13053 </th></tr></table>
13054
13055 !!end
13056
13057 !! test
13058 Table attribute safety
13059 !! wikitext
13060 {|
13061 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13062 |}
13063 !! html
13064 <table>
13065 <tr>
13066 <th style="/* insecure input */"> status
13067 </th></tr></table>
13068
13069 !! end
13070
13071 !! test
13072 CSS line continuation 1
13073 !! wikitext
13074 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13075 !! html
13076 <div style="/* insecure input */"></div>
13077
13078 !! end
13079
13080 !! test
13081 CSS line continuation 2
13082 !! wikitext
13083 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13084 !! html
13085 <div style="/* insecure input */"></div>
13086
13087 !! end
13088
13089 !! article
13090 Template:Identity
13091 !! text
13092 {{{1}}}
13093 !! endarticle
13094
13095 !! test
13096 Expansion of multi-line templates in attribute values (bug 6255)
13097 !! wikitext
13098 <div style="background: {{identity|#00FF00}}">-</div>
13099 !! html
13100 <div style="background: #00FF00">-</div>
13101
13102 !! end
13103
13104
13105 !! test
13106 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13107 !! wikitext
13108 <div style="background:
13109 #00FF00">-</div>
13110 !! html
13111 <div style="background: #00FF00">-</div>
13112
13113 !! end
13114
13115 !! test
13116 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13117 !! wikitext
13118 <div style="background: &#10;#00FF00">-</div>
13119 !! html
13120 <div style="background: &#10;#00FF00">-</div>
13121
13122 !! end
13123
13124 ###
13125 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13126 ###
13127 !! test
13128 Parser hook: empty input
13129 !! wikitext
13130 <tag></tag>
13131 !! html
13132 <pre>
13133 ''
13134 array (
13135 )
13136 </pre>
13137
13138 !! end
13139
13140 !! test
13141 Parser hook: empty input using terminated empty elements
13142 !! wikitext
13143 <tag/>
13144 !! html
13145 <pre>
13146 NULL
13147 array (
13148 )
13149 </pre>
13150
13151 !! end
13152
13153 !! test
13154 Parser hook: empty input using terminated empty elements (space before)
13155 !! wikitext
13156 <tag />
13157 !! html
13158 <pre>
13159 NULL
13160 array (
13161 )
13162 </pre>
13163
13164 !! end
13165
13166 !! test
13167 Parser hook: basic input
13168 !! wikitext
13169 <tag>input</tag>
13170 !! html
13171 <pre>
13172 'input'
13173 array (
13174 )
13175 </pre>
13176
13177 !! end
13178
13179
13180 !! test
13181 Parser hook: case insensitive
13182 !! wikitext
13183 <TAG>input</TAG>
13184 !! html
13185 <pre>
13186 'input'
13187 array (
13188 )
13189 </pre>
13190
13191 !! end
13192
13193
13194 !! test
13195 Parser hook: case insensitive, redux
13196 !! wikitext
13197 <TaG>input</TAg>
13198 !! html
13199 <pre>
13200 'input'
13201 array (
13202 )
13203 </pre>
13204
13205 !! end
13206
13207 !! test
13208 Parser hook: nested tags
13209 !! options
13210 noxml
13211 !! wikitext
13212 <tag><tag></tag></tag>
13213 !! html
13214 <pre>
13215 '<tag>'
13216 array (
13217 )
13218 </pre>&lt;/tag&gt;
13219
13220 !! end
13221
13222 !! test
13223 Parser hook: basic arguments
13224 !! wikitext
13225 <tag width=200 height = "100" depth = '50' square></tag>
13226 !! html
13227 <pre>
13228 ''
13229 array (
13230 'width' => '200',
13231 'height' => '100',
13232 'depth' => '50',
13233 'square' => 'square',
13234 )
13235 </pre>
13236
13237 !! end
13238
13239 !! test
13240 Parser hook: argument containing a forward slash (bug 5344)
13241 !! wikitext
13242 <tag filename='/tmp/bla'></tag>
13243 !! html
13244 <pre>
13245 ''
13246 array (
13247 'filename' => '/tmp/bla',
13248 )
13249 </pre>
13250
13251 !! end
13252
13253 !! test
13254 Parser hook: empty input using terminated empty elements (bug 2374)
13255 !! wikitext
13256 <tag foo=bar/>text
13257 !! html
13258 <pre>
13259 NULL
13260 array (
13261 'foo' => 'bar',
13262 )
13263 </pre>text
13264
13265 !! end
13266
13267 # </tag> should be output literally since there is no matching tag that begins it
13268 !! test
13269 Parser hook: basic arguments using terminated empty elements (bug 2374)
13270 !! wikitext
13271 <tag width=200 height = "100" depth = '50' square/>
13272 other stuff
13273 </tag>
13274 !! html
13275 <pre>
13276 NULL
13277 array (
13278 'width' => '200',
13279 'height' => '100',
13280 'depth' => '50',
13281 'square' => 'square',
13282 )
13283 </pre>
13284 <p>other stuff
13285 &lt;/tag&gt;
13286 </p>
13287 !! end
13288
13289 ###
13290 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13291 ###
13292
13293 !! test
13294 Parser hook: static parser hook not inside a comment
13295 !! wikitext
13296 <statictag>hello, world</statictag>
13297 <statictag action=flush/>
13298 !! html
13299 <p>hello, world
13300 </p>
13301 !! end
13302
13303
13304 !! test
13305 Parser hook: static parser hook inside a comment
13306 !! wikitext
13307 <!-- <statictag>hello, world</statictag> -->
13308 <statictag action=flush/>
13309 !! html
13310 <p><br />
13311 </p>
13312 !! end
13313
13314 # Nested template calls; this case was broken by Parser.php rev 1.506,
13315 # since reverted.
13316
13317 !! article
13318 Template:One-parameter
13319 !! text
13320 (My parameter is: {{{1}}})
13321 !! endarticle
13322
13323 !! article
13324 Template:Map-one-parameter
13325 !! text
13326 {{{{{1}}}|{{{2}}}}}
13327 !! endarticle
13328
13329 !! test
13330 Nested template calls
13331 !! wikitext
13332 {{Map-one-parameter|One-parameter|param}}
13333 !! html
13334 <p>(My parameter is: param)
13335 </p>
13336 !! end
13337
13338
13339 ###
13340 ### Sanitizer
13341 ###
13342 !! test
13343 Sanitizer: Closing of open tags
13344 !! wikitext
13345 <s></s><table></table>
13346 !! html
13347 <s></s><table></table>
13348
13349 !! end
13350
13351 !! test
13352 Sanitizer: Closing of open but not closed tags
13353 !! wikitext
13354 <s>foo
13355 !! html
13356 <p><s>foo</s>
13357 </p>
13358 !! end
13359
13360 !! test
13361 Sanitizer: Closing of closed but not open tags
13362 !! wikitext
13363 </s>
13364 !! html
13365 <p>&lt;/s&gt;
13366 </p>
13367 !! end
13368
13369 !! test
13370 Sanitizer: Closing of closed but not open table tags
13371 !! wikitext
13372 Table not started</td></tr></table>
13373 !! html
13374 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13375 </p>
13376 !! end
13377
13378 !! test
13379 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13380 !! wikitext
13381 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13382 !! html
13383 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13384 </p>
13385 !! end
13386
13387 !! test
13388 Sanitizer: Validating the contents of the id attribute (bug 4515)
13389 !! options
13390 disabled
13391 !! wikitext
13392 <br id=9 />
13393 !! html
13394 Something, but definitely not <br id="9" />...
13395 !! end
13396
13397 !! test
13398 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13399 !! options
13400 disabled
13401 !! wikitext
13402 <br id="foo" /><br id="foo" />
13403 !! html
13404 Something need to be done. foo-2 ?
13405 !! end
13406
13407 !! test
13408 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13409 !! wikitext
13410 <div itemscope>
13411 <meta itemprop="hello" content="world">
13412 <meta http-equiv="refresh" content="5">
13413 <meta itemprop="hello" http-equiv="refresh" content="5">
13414 <link itemprop="hello" href="{{SERVER}}">
13415 <link rel="stylesheet" href="{{SERVER}}">
13416 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13417 </div>
13418 !! html
13419 <div itemscope="itemscope">
13420 <p> <meta itemprop="hello" content="world" />
13421 &lt;meta http-equiv="refresh" content="5"&gt;
13422 <meta itemprop="hello" content="5" />
13423 </p>
13424 <link itemprop="hello" href="http&#58;//example.org" />
13425 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13426 <link itemprop="hello" href="http&#58;//example.org" />
13427 </div>
13428
13429 !! end
13430
13431 !! test
13432 Language converter: output gets cut off unexpectedly (bug 5757)
13433 !! options
13434 language=zh
13435 !! wikitext
13436 this bit is safe: }-
13437
13438 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13439
13440 then we get cut off here: }-
13441
13442 all additional text is vanished
13443 !! html
13444 <p>this bit is safe: }-
13445 </p><p>but if we add a conversion instance: xxx
13446 </p><p>then we get cut off here: }-
13447 </p><p>all additional text is vanished
13448 </p>
13449 !! end
13450
13451 !! test
13452 Self closed html pairs (bug 5487)
13453 !! options
13454 !! wikitext
13455 <center><font id="bug" />Centered text</center>
13456 <div><font id="bug2" />In div text</div>
13457 !! html
13458 <center>&lt;font id="bug" /&gt;Centered text</center>
13459 <div>&lt;font id="bug2" /&gt;In div text</div>
13460
13461 !! end
13462
13463 #
13464 #
13465 #
13466
13467 !! test
13468 Punctuation: nbsp before exclamation
13469 !! wikitext
13470 C'est grave !
13471 !! html
13472 <p>C'est grave&#160;!
13473 </p>
13474 !! end
13475
13476 !! test
13477 Punctuation: CSS !important (bug 11874)
13478 !! wikitext
13479 <div style="width:50% !important">important</div>
13480 !! html
13481 <div style="width:50% !important">important</div>
13482
13483 !!end
13484
13485 !! test
13486 Punctuation: CSS ! important (bug 11874; with space after)
13487 !! wikitext
13488 <div style="width:50% ! important">important</div>
13489 !! html
13490 <div style="width:50% ! important">important</div>
13491
13492 !!end
13493
13494
13495 !! test
13496 HTML bullet list, closed tags (bug 5497)
13497 !! wikitext
13498 <ul>
13499 <li>One</li>
13500 <li>Two</li>
13501 </ul>
13502 !! html
13503 <ul>
13504 <li>One</li>
13505 <li>Two</li>
13506 </ul>
13507
13508 !! end
13509
13510 !! test
13511 HTML bullet list, unclosed tags (bug 5497)
13512 !! options
13513 disabled
13514 !! wikitext
13515 <ul>
13516 <li>One
13517 <li>Two
13518 </ul>
13519 !! html
13520 <ul>
13521 <li>One
13522 </li>
13523 <li>Two
13524 </li>
13525 </ul>
13526
13527 !! end
13528
13529 !! test
13530 HTML ordered list, closed tags (bug 5497)
13531 !! wikitext
13532 <ol>
13533 <li>One</li>
13534 <li>Two</li>
13535 </ol>
13536 !! html
13537 <ol>
13538 <li>One</li>
13539 <li>Two</li>
13540 </ol>
13541
13542 !! end
13543
13544 !! test
13545 HTML ordered list, unclosed tags (bug 5497)
13546 !! options
13547 disabled
13548 !! wikitext
13549 <ol>
13550 <li>One
13551 <li>Two
13552 </ol>
13553 !! html
13554 <ol>
13555 <li>One
13556 </li>
13557 <li>Two
13558 </li>
13559 </ol>
13560
13561 !! end
13562
13563 !! test
13564 HTML nested bullet list, closed tags (bug 5497)
13565 !! wikitext
13566 <ul>
13567 <li>One</li>
13568 <li>Two:
13569 <ul>
13570 <li>Sub-one</li>
13571 <li>Sub-two</li>
13572 </ul>
13573 </li>
13574 </ul>
13575 !! html
13576 <ul>
13577 <li>One</li>
13578 <li>Two:
13579 <ul>
13580 <li>Sub-one</li>
13581 <li>Sub-two</li>
13582 </ul>
13583 </li>
13584 </ul>
13585
13586 !! end
13587
13588 !! test
13589 HTML nested bullet list, open tags (bug 5497)
13590 !! options
13591 disabled
13592 !! wikitext
13593 <ul>
13594 <li>One
13595 <li>Two:
13596 <ul>
13597 <li>Sub-one
13598 <li>Sub-two
13599 </ul>
13600 </ul>
13601 !! html
13602 <ul>
13603 <li>One
13604 </li>
13605 <li>Two:
13606 <ul>
13607 <li>Sub-one
13608 </li>
13609 <li>Sub-two
13610 </li>
13611 </ul>
13612 </li>
13613 </ul>
13614
13615 !! end
13616
13617 !! test
13618 HTML nested ordered list, closed tags (bug 5497)
13619 !! wikitext
13620 <ol>
13621 <li>One</li>
13622 <li>Two:
13623 <ol>
13624 <li>Sub-one</li>
13625 <li>Sub-two</li>
13626 </ol>
13627 </li>
13628 </ol>
13629 !! html
13630 <ol>
13631 <li>One</li>
13632 <li>Two:
13633 <ol>
13634 <li>Sub-one</li>
13635 <li>Sub-two</li>
13636 </ol>
13637 </li>
13638 </ol>
13639
13640 !! end
13641
13642 !! test
13643 HTML nested ordered list, open tags (bug 5497)
13644 !! options
13645 disabled
13646 !! wikitext
13647 <ol>
13648 <li>One
13649 <li>Two:
13650 <ol>
13651 <li>Sub-one
13652 <li>Sub-two
13653 </ol>
13654 </ol>
13655 !! html
13656 <ol>
13657 <li>One
13658 </li>
13659 <li>Two:
13660 <ol>
13661 <li>Sub-one
13662 </li>
13663 <li>Sub-two
13664 </li>
13665 </ol>
13666 </li>
13667 </ol>
13668
13669 !! end
13670
13671 !! test
13672 HTML ordered list item with parameters oddity
13673 !! wikitext
13674 <ol><li id="fragment">One</li>
13675 </ol>
13676 !! html
13677 <ol><li id="fragment">One</li>
13678 </ol>
13679
13680 !! end
13681
13682 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13683 !!test
13684 bug 5918: autonumbering
13685 !! wikitext
13686 [http://first/] [http://second] [ftp://ftp]
13687
13688 ftp://inlineftp
13689
13690 [mailto:enclosed@mail.tld With target]
13691
13692 [mailto:enclosed@mail.tld]
13693
13694 mailto:inline@mail.tld
13695 !! html/php
13696 <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>
13697 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13698 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13699 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13700 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13701 </p>
13702 !! html/parsoid
13703 <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>
13704 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13705 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13706 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13707 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13708 !! end
13709
13710
13711 #
13712 # Security and HTML correctness
13713 # From Nick Jenkins' fuzz testing
13714 #
13715
13716 !! test
13717 Fuzz testing: Parser13
13718 !! wikitext
13719 {|
13720 | http://a|
13721 !! html
13722 <table>
13723 <tr>
13724 <td>
13725 </td>
13726 </tr>
13727 </table>
13728
13729 !! end
13730
13731 !! test
13732 Fuzz testing: Parser14
13733 !! wikitext
13734 == onmouseover= ==
13735 http://__TOC__
13736 !! html
13737 <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>
13738 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13739 <ul>
13740 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13741 </ul>
13742 </div>
13743
13744
13745 !! end
13746
13747 !! test
13748 Fuzz testing: Parser14-table
13749 !! wikitext
13750 ==a==
13751 {| STYLE=__TOC__
13752 !! html
13753 <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>
13754 <table style="&#95;_TOC&#95;_">
13755 <tr><td></td></tr>
13756 </table>
13757
13758 !! end
13759
13760 # Known to produce bogus xml (extra </td>)
13761 !! test
13762 Fuzz testing: Parser16
13763 !! options
13764 noxml
13765 !! wikitext
13766 {|
13767 !https://||||||
13768 !! html
13769 <table>
13770 <tr>
13771 <th>https://</th>
13772 <th></th>
13773 <th></th>
13774 <th>
13775 </td>
13776 </tr>
13777 </table>
13778
13779 !! end
13780
13781 !! test
13782 Fuzz testing: Parser21
13783 !! wikitext
13784 {|
13785 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13786 |
13787 !! html
13788 <table>
13789 <tr>
13790 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13791 </th>
13792 <td>
13793 </td>
13794 </tr>
13795 </table>
13796
13797 !! end
13798
13799 !! test
13800 Fuzz testing: Parser22
13801 !! wikitext
13802 http://===r:::https://b
13803
13804 {|
13805 !! html
13806 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13807 </p>
13808 <table>
13809 <tr><td></td></tr>
13810 </table>
13811
13812 !! end
13813
13814 # Known to produce bad XML for now
13815 !! test
13816 Fuzz testing: Parser24
13817 !! options
13818 noxml
13819 !! wikitext
13820 {|
13821 {{{|
13822 <u CLASS=
13823 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13824 <br style="onmouseover='alert(document.cookie);' " />
13825
13826 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13827 |
13828 !! html
13829 <table>
13830 {{{|
13831 <u class="&#124;">}}}} &gt;
13832 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13833
13834 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13835 <tr>
13836 <td></u>
13837 </td>
13838 </tr>
13839 </table>
13840
13841 !! end
13842
13843 # Note: the current result listed for this is not what the original one was,
13844 # but the original bug was JavaScript injection, which is fixed in any case.
13845 # It's not clear that the original result listed was any more correct than the
13846 # current one. Original result:
13847 # <p>{{{|
13848 # </p>
13849 # <li class="&#124;&#124;">
13850 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13851 !!test
13852 Fuzz testing: Parser25 (bug 6055)
13853 !! wikitext
13854 {{{
13855 |
13856 <LI CLASS=||
13857 >
13858 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13859 !! html
13860 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13861 </p>
13862 !! end
13863
13864 !!test
13865 Fuzz testing: URL adjacent extension (with space, clean)
13866 !! options
13867 !! wikitext
13868 http://example.com <nowiki>junk</nowiki>
13869 !! html
13870 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13871 </p>
13872 !!end
13873
13874 !!test
13875 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13876 !! options
13877 !! wikitext
13878 http://example.com<nowiki>junk</nowiki>
13879 !! html
13880 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13881 </p>
13882 !!end
13883
13884 !!test
13885 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13886 !! options
13887 !! wikitext
13888 http://example.com<pre>junk</pre>
13889 !! html
13890 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13891
13892 !!end
13893
13894 !!test
13895 Fuzz testing: image with bogus manual thumbnail
13896 !! wikitext
13897 [[Image:foobar.jpg|thumbnail= ]]
13898 !! html/php
13899 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13900
13901 !! html/parsoid
13902 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13903 !!end
13904
13905 !! test
13906 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13907 !! wikitext
13908 <pre dir="&#10;"></pre>
13909 !! html
13910 <pre dir="&#10;"></pre>
13911
13912 !! end
13913
13914 !! test
13915 Parsing optional HTML elements (Bug 6171)
13916 !! options
13917 !! wikitext
13918 <table>
13919 <tr>
13920 <td> Some tabular data</td>
13921 <td> More tabular data ...
13922 <td> And yet som tabular data</td>
13923 </tr>
13924 </table>
13925 !! html
13926 <table>
13927 <tr>
13928 <td> Some tabular data</td>
13929 <td> More tabular data ...
13930 </td><td> And yet som tabular data</td>
13931 </tr>
13932 </table>
13933
13934 !! end
13935
13936 !! test
13937 Correct handling of <td>, <tr> (Bug 6171)
13938 !! options
13939 !! wikitext
13940 <table>
13941 <tr>
13942 <td> Some tabular data</td>
13943 <td> More tabular data ...</td>
13944 <td> And yet som tabular data</td>
13945 </tr>
13946 </table>
13947 !! html
13948 <table>
13949 <tr>
13950 <td> Some tabular data</td>
13951 <td> More tabular data ...</td>
13952 <td> And yet som tabular data</td>
13953 </tr>
13954 </table>
13955
13956 !! end
13957
13958
13959 !! test
13960 Parsing crashing regression (fr:JavaScript)
13961 !! wikitext
13962 </body></x>
13963 !! html
13964 <p>&lt;/body&gt;&lt;/x&gt;
13965 </p>
13966 !! end
13967
13968 !! test
13969 Inline wiki vs wiki block nesting
13970 !! wikitext
13971 '''Bold paragraph
13972
13973 New wiki paragraph
13974 !! html
13975 <p><b>Bold paragraph</b>
13976 </p><p>New wiki paragraph
13977 </p>
13978 !! end
13979
13980 !! test
13981 Inline HTML vs wiki block nesting
13982 !! options
13983 disabled
13984 !! wikitext
13985 <b>Bold paragraph
13986
13987 New wiki paragraph
13988 !! html
13989 <p><b>Bold paragraph</b>
13990 </p><p>New wiki paragraph
13991 </p>
13992 !! end
13993
13994 # Original result was this:
13995 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13996 # </p>
13997 # While that might be marginally more intuitive, maybe, the six-apostrophe
13998 # construct is clearly pathological and the result stated here (which is what
13999 # the parser actually does) is about as reasonable as anything.
14000 !!test
14001 Mixing markup for italics and bold
14002 !! options
14003 !! wikitext
14004 '''bold''''''bold''bolditalics'''''
14005 !! html
14006 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14007 </p>
14008 !! end
14009
14010
14011 !! article
14012 Xyzzyx
14013 !! text
14014 Article for special page transclusion test
14015 !! endarticle
14016
14017 !! test
14018 Special page transclusion
14019 !! options
14020 !! wikitext
14021 {{Special:Prefixindex/Xyzzyx}}
14022 !! html
14023 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14024
14025 !! end
14026
14027 !! test
14028 Special page transclusion twice (bug 5021)
14029 !! options
14030 !! wikitext
14031 {{Special:Prefixindex/Xyzzyx}}
14032 {{Special:Prefixindex/Xyzzyx}}
14033 !! html
14034 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14035 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14036
14037 !! end
14038
14039 !! test
14040 Transclusion of default MediaWiki message
14041 !! wikitext
14042 {{MediaWiki:Mainpage}}
14043 !! html
14044 <p>Main Page
14045 </p>
14046 !! end
14047
14048 !! test
14049 Transclusion of nonexistent MediaWiki message
14050 !! wikitext
14051 {{MediaWiki:Mainpagexxx}}
14052 !! html
14053 <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>
14054 </p>
14055 !! end
14056
14057 !! test
14058 Transclusion of MediaWiki message with underscore
14059 !! wikitext
14060 {{MediaWiki:history_short}}
14061 !! html
14062 <p>History
14063 </p>
14064 !! end
14065
14066 !! test
14067 Transclusion of MediaWiki message with space
14068 !! wikitext
14069 {{MediaWiki:history short}}
14070 !! html
14071 <p>History
14072 </p>
14073 !! end
14074
14075 !! test
14076 Invalid header with following text
14077 !! wikitext
14078 = x = y
14079 !! html
14080 <p>= x = y
14081 </p>
14082 !! end
14083
14084
14085 !! test
14086 Section extraction test (section 0)
14087 !! options
14088 section=0
14089 !! wikitext
14090 start
14091 ==a==
14092 ===aa===
14093 ====aaa====
14094 ==b==
14095 ===ba===
14096 ===bb===
14097 ====bba====
14098 ===bc===
14099 ==c==
14100 ===ca===
14101 !! html
14102 start
14103 !! end
14104
14105 !! test
14106 Section extraction test (section 1)
14107 !! options
14108 section=1
14109 !! wikitext
14110 start
14111 ==a==
14112 ===aa===
14113 ====aaa====
14114 ==b==
14115 ===ba===
14116 ===bb===
14117 ====bba====
14118 ===bc===
14119 ==c==
14120 ===ca===
14121 !! html
14122 ==a==
14123 ===aa===
14124 ====aaa====
14125 !! end
14126
14127 !! test
14128 Section extraction test (section 2)
14129 !! options
14130 section=2
14131 !! wikitext
14132 start
14133 ==a==
14134 ===aa===
14135 ====aaa====
14136 ==b==
14137 ===ba===
14138 ===bb===
14139 ====bba====
14140 ===bc===
14141 ==c==
14142 ===ca===
14143 !! html
14144 ===aa===
14145 ====aaa====
14146 !! end
14147
14148 !! test
14149 Section extraction test (section 3)
14150 !! options
14151 section=3
14152 !! wikitext
14153 start
14154 ==a==
14155 ===aa===
14156 ====aaa====
14157 ==b==
14158 ===ba===
14159 ===bb===
14160 ====bba====
14161 ===bc===
14162 ==c==
14163 ===ca===
14164 !! html
14165 ====aaa====
14166 !! end
14167
14168 !! test
14169 Section extraction test (section 4)
14170 !! options
14171 section=4
14172 !! wikitext
14173 start
14174 ==a==
14175 ===aa===
14176 ====aaa====
14177 ==b==
14178 ===ba===
14179 ===bb===
14180 ====bba====
14181 ===bc===
14182 ==c==
14183 ===ca===
14184 !! html
14185 ==b==
14186 ===ba===
14187 ===bb===
14188 ====bba====
14189 ===bc===
14190 !! end
14191
14192 !! test
14193 Section extraction test (section 5)
14194 !! options
14195 section=5
14196 !! wikitext
14197 start
14198 ==a==
14199 ===aa===
14200 ====aaa====
14201 ==b==
14202 ===ba===
14203 ===bb===
14204 ====bba====
14205 ===bc===
14206 ==c==
14207 ===ca===
14208 !! html
14209 ===ba===
14210 !! end
14211
14212 !! test
14213 Section extraction test (section 6)
14214 !! options
14215 section=6
14216 !! wikitext
14217 start
14218 ==a==
14219 ===aa===
14220 ====aaa====
14221 ==b==
14222 ===ba===
14223 ===bb===
14224 ====bba====
14225 ===bc===
14226 ==c==
14227 ===ca===
14228 !! html
14229 ===bb===
14230 ====bba====
14231 !! end
14232
14233 !! test
14234 Section extraction test (section 7)
14235 !! options
14236 section=7
14237 !! wikitext
14238 start
14239 ==a==
14240 ===aa===
14241 ====aaa====
14242 ==b==
14243 ===ba===
14244 ===bb===
14245 ====bba====
14246 ===bc===
14247 ==c==
14248 ===ca===
14249 !! html
14250 ====bba====
14251 !! end
14252
14253 !! test
14254 Section extraction test (section 8)
14255 !! options
14256 section=8
14257 !! wikitext
14258 start
14259 ==a==
14260 ===aa===
14261 ====aaa====
14262 ==b==
14263 ===ba===
14264 ===bb===
14265 ====bba====
14266 ===bc===
14267 ==c==
14268 ===ca===
14269 !! html
14270 ===bc===
14271 !! end
14272
14273 !! test
14274 Section extraction test (section 9)
14275 !! options
14276 section=9
14277 !! wikitext
14278 start
14279 ==a==
14280 ===aa===
14281 ====aaa====
14282 ==b==
14283 ===ba===
14284 ===bb===
14285 ====bba====
14286 ===bc===
14287 ==c==
14288 ===ca===
14289 !! html
14290 ==c==
14291 ===ca===
14292 !! end
14293
14294 !! test
14295 Section extraction test (section 10)
14296 !! options
14297 section=10
14298 !! wikitext
14299 start
14300 ==a==
14301 ===aa===
14302 ====aaa====
14303 ==b==
14304 ===ba===
14305 ===bb===
14306 ====bba====
14307 ===bc===
14308 ==c==
14309 ===ca===
14310 !! html
14311 ===ca===
14312 !! end
14313
14314 !! test
14315 Section extraction test (nonexistent section 11)
14316 !! options
14317 section=11
14318 !! wikitext
14319 start
14320 ==a==
14321 ===aa===
14322 ====aaa====
14323 ==b==
14324 ===ba===
14325 ===bb===
14326 ====bba====
14327 ===bc===
14328 ==c==
14329 ===ca===
14330 !! html
14331 !! end
14332
14333 !! test
14334 Section extraction test with bogus heading (section 1)
14335 !! options
14336 section=1
14337 !! wikitext
14338 ==a==
14339 ==bogus== not a legal section
14340 ==b==
14341 !! html
14342 ==a==
14343 ==bogus== not a legal section
14344 !! end
14345
14346 !! test
14347 Section extraction test with bogus heading (section 2)
14348 !! options
14349 section=2
14350 !! wikitext
14351 ==a==
14352 ==bogus== not a legal section
14353 ==b==
14354 !! html
14355 ==b==
14356 !! end
14357
14358 !! test
14359 Section extraction test with comment after heading (section 1)
14360 !! options
14361 section=1
14362 !! wikitext
14363 ==a==
14364 ==b== <!-- -->
14365 ==c==
14366 !! html
14367 ==a==
14368 !! end
14369
14370 !! test
14371 Section extraction test with comment after heading (section 2)
14372 !! options
14373 section=2
14374 !! wikitext
14375 ==a==
14376 ==b== <!-- -->
14377 ==c==
14378 !! html
14379 ==b== <!-- -->
14380 !! end
14381
14382 !! test
14383 Section extraction test with bogus <nowiki> heading (section 1)
14384 !! options
14385 section=1
14386 !! wikitext
14387 ==a==
14388 ==bogus== <nowiki>not a legal section</nowiki>
14389 ==b==
14390 !! html
14391 ==a==
14392 ==bogus== <nowiki>not a legal section</nowiki>
14393 !! end
14394
14395 !! test
14396 Section extraction test with bogus <nowiki> heading (section 2)
14397 !! options
14398 section=2
14399 !! wikitext
14400 ==a==
14401 ==bogus== <nowiki>not a legal section</nowiki>
14402 ==b==
14403 !! html
14404 ==b==
14405 !! end
14406
14407
14408 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14409 # instead of respecting commented sections
14410 !! test
14411 Section extraction prefixed by comment (section 1)
14412 !! options
14413 section=1
14414 !! wikitext
14415 <!-- -->==sec1==
14416 ==sec2==
14417 !! html
14418 ==sec2==
14419 !!end
14420
14421 !! test
14422 Section extraction prefixed by comment (section 2)
14423 !! options
14424 section=2
14425 !! wikitext
14426 <!-- -->==sec1==
14427 ==sec2==
14428 !! html
14429
14430 !!end
14431
14432
14433 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14434 # instead of respecting HTML-style headings
14435 !! test
14436 Section extraction, mixed wiki and html (section 1)
14437 !! options
14438 section=1
14439 !! wikitext
14440 <h2>unmarked</h2>
14441 unmarked
14442 ==1==
14443 one
14444 ==2==
14445 two
14446 !! html
14447 ==1==
14448 one
14449 !! end
14450
14451 !! test
14452 Section extraction, mixed wiki and html (section 2)
14453 !! options
14454 section=2
14455 !! wikitext
14456 <h2>unmarked</h2>
14457 unmarked
14458 ==1==
14459 one
14460 ==2==
14461 two
14462 !! html
14463 ==2==
14464 two
14465 !! end
14466
14467
14468 # Formerly testing for bug 3342
14469 !! test
14470 Section extraction, heading surrounded by <noinclude>
14471 !! options
14472 section=1
14473 !! wikitext
14474 <noinclude>==unmarked==</noinclude>
14475 ==marked==
14476 !! html
14477 ==marked==
14478 !!end
14479
14480 # Test behavior of bug 19910
14481 !! test
14482 Sectiion with all-equals
14483 !! options
14484 section=2
14485 !! wikitext
14486 ===
14487 The line above must have a trailing space
14488 === <!--
14489 --> <!-- -->
14490 But just in case it doesn't...
14491 !! html
14492 === <!--
14493 --> <!-- -->
14494 But just in case it doesn't...
14495 !! end
14496
14497 !! test
14498 Section replacement test (section 0)
14499 !! options
14500 replace=0,"xxx"
14501 !! wikitext
14502 start
14503 ==a==
14504 ===aa===
14505 ====aaa====
14506 ==b==
14507 ===ba===
14508 ===bb===
14509 ====bba====
14510 ===bc===
14511 ==c==
14512 ===ca===
14513 !! html
14514 xxx
14515
14516 ==a==
14517 ===aa===
14518 ====aaa====
14519 ==b==
14520 ===ba===
14521 ===bb===
14522 ====bba====
14523 ===bc===
14524 ==c==
14525 ===ca===
14526 !! end
14527
14528 !! test
14529 Section replacement test (section 1)
14530 !! options
14531 replace=1,"xxx"
14532 !! wikitext
14533 start
14534 ==a==
14535 ===aa===
14536 ====aaa====
14537 ==b==
14538 ===ba===
14539 ===bb===
14540 ====bba====
14541 ===bc===
14542 ==c==
14543 ===ca===
14544 !! html
14545 start
14546 xxx
14547
14548 ==b==
14549 ===ba===
14550 ===bb===
14551 ====bba====
14552 ===bc===
14553 ==c==
14554 ===ca===
14555 !! end
14556
14557 !! test
14558 Section replacement test (section 2)
14559 !! options
14560 replace=2,"xxx"
14561 !! wikitext
14562 start
14563 ==a==
14564 ===aa===
14565 ====aaa====
14566 ==b==
14567 ===ba===
14568 ===bb===
14569 ====bba====
14570 ===bc===
14571 ==c==
14572 ===ca===
14573 !! html
14574 start
14575 ==a==
14576 xxx
14577
14578 ==b==
14579 ===ba===
14580 ===bb===
14581 ====bba====
14582 ===bc===
14583 ==c==
14584 ===ca===
14585 !! end
14586
14587 !! test
14588 Section replacement test (section 3)
14589 !! options
14590 replace=3,"xxx"
14591 !! wikitext
14592 start
14593 ==a==
14594 ===aa===
14595 ====aaa====
14596 ==b==
14597 ===ba===
14598 ===bb===
14599 ====bba====
14600 ===bc===
14601 ==c==
14602 ===ca===
14603 !! html
14604 start
14605 ==a==
14606 ===aa===
14607 xxx
14608
14609 ==b==
14610 ===ba===
14611 ===bb===
14612 ====bba====
14613 ===bc===
14614 ==c==
14615 ===ca===
14616 !! end
14617
14618 !! test
14619 Section replacement test (section 4)
14620 !! options
14621 replace=4,"xxx"
14622 !! wikitext
14623 start
14624 ==a==
14625 ===aa===
14626 ====aaa====
14627 ==b==
14628 ===ba===
14629 ===bb===
14630 ====bba====
14631 ===bc===
14632 ==c==
14633 ===ca===
14634 !! html
14635 start
14636 ==a==
14637 ===aa===
14638 ====aaa====
14639 xxx
14640
14641 ==c==
14642 ===ca===
14643 !! end
14644
14645 !! test
14646 Section replacement test (section 5)
14647 !! options
14648 replace=5,"xxx"
14649 !! wikitext
14650 start
14651 ==a==
14652 ===aa===
14653 ====aaa====
14654 ==b==
14655 ===ba===
14656 ===bb===
14657 ====bba====
14658 ===bc===
14659 ==c==
14660 ===ca===
14661 !! html
14662 start
14663 ==a==
14664 ===aa===
14665 ====aaa====
14666 ==b==
14667 xxx
14668
14669 ===bb===
14670 ====bba====
14671 ===bc===
14672 ==c==
14673 ===ca===
14674 !! end
14675
14676 !! test
14677 Section replacement test (section 6)
14678 !! options
14679 replace=6,"xxx"
14680 !! wikitext
14681 start
14682 ==a==
14683 ===aa===
14684 ====aaa====
14685 ==b==
14686 ===ba===
14687 ===bb===
14688 ====bba====
14689 ===bc===
14690 ==c==
14691 ===ca===
14692 !! html
14693 start
14694 ==a==
14695 ===aa===
14696 ====aaa====
14697 ==b==
14698 ===ba===
14699 xxx
14700
14701 ===bc===
14702 ==c==
14703 ===ca===
14704 !! end
14705
14706 !! test
14707 Section replacement test (section 7)
14708 !! options
14709 replace=7,"xxx"
14710 !! wikitext
14711 start
14712 ==a==
14713 ===aa===
14714 ====aaa====
14715 ==b==
14716 ===ba===
14717 ===bb===
14718 ====bba====
14719 ===bc===
14720 ==c==
14721 ===ca===
14722 !! html
14723 start
14724 ==a==
14725 ===aa===
14726 ====aaa====
14727 ==b==
14728 ===ba===
14729 ===bb===
14730 xxx
14731
14732 ===bc===
14733 ==c==
14734 ===ca===
14735 !! end
14736
14737 !! test
14738 Section replacement test (section 8)
14739 !! options
14740 replace=8,"xxx"
14741 !! wikitext
14742 start
14743 ==a==
14744 ===aa===
14745 ====aaa====
14746 ==b==
14747 ===ba===
14748 ===bb===
14749 ====bba====
14750 ===bc===
14751 ==c==
14752 ===ca===
14753 !! html
14754 start
14755 ==a==
14756 ===aa===
14757 ====aaa====
14758 ==b==
14759 ===ba===
14760 ===bb===
14761 ====bba====
14762 xxx
14763
14764 ==c==
14765 ===ca===
14766 !!end
14767
14768 !! test
14769 Section replacement test (section 9)
14770 !! options
14771 replace=9,"xxx"
14772 !! wikitext
14773 start
14774 ==a==
14775 ===aa===
14776 ====aaa====
14777 ==b==
14778 ===ba===
14779 ===bb===
14780 ====bba====
14781 ===bc===
14782 ==c==
14783 ===ca===
14784 !! html
14785 start
14786 ==a==
14787 ===aa===
14788 ====aaa====
14789 ==b==
14790 ===ba===
14791 ===bb===
14792 ====bba====
14793 ===bc===
14794 xxx
14795 !! end
14796
14797 !! test
14798 Section replacement test (section 10)
14799 !! options
14800 replace=10,"xxx"
14801 !! wikitext
14802 start
14803 ==a==
14804 ===aa===
14805 ====aaa====
14806 ==b==
14807 ===ba===
14808 ===bb===
14809 ====bba====
14810 ===bc===
14811 ==c==
14812 ===ca===
14813 !! html
14814 start
14815 ==a==
14816 ===aa===
14817 ====aaa====
14818 ==b==
14819 ===ba===
14820 ===bb===
14821 ====bba====
14822 ===bc===
14823 ==c==
14824 xxx
14825 !! end
14826
14827 !! test
14828 Section replacement test with initial whitespace (bug 13728)
14829 !! options
14830 replace=2,"xxx"
14831 !! wikitext
14832 Preformatted initial line
14833 ==a==
14834 ===a===
14835 !! html
14836 Preformatted initial line
14837 ==a==
14838 xxx
14839 !! end
14840
14841
14842 !! test
14843 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14844 !! options
14845 section=1
14846 !! wikitext
14847 ==a==
14848 a
14849 !! html
14850 ==a==
14851 a
14852 !! end
14853
14854 !! test
14855 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14856 !! options
14857 section=1
14858 !! wikitext
14859 ==a==
14860 a
14861 !! html
14862 ==a==
14863 a
14864 !! end
14865
14866
14867 !! test
14868 Section extraction, <pre> around bogus header (bug 10309)
14869 !! options
14870 noxml section=2
14871 !! wikitext
14872 == Section One ==
14873 <pre>
14874 =======
14875 </pre>
14876
14877 == Section Two ==
14878 stuff
14879 !! html
14880 == Section Two ==
14881 stuff
14882 !! end
14883
14884 !! test
14885 Section replacement, <pre> around bogus header (bug 10309)
14886 !! options
14887 noxml replace=2,"xxx"
14888 !! wikitext
14889 == Section One ==
14890 <pre>
14891 =======
14892 </pre>
14893
14894 == Section Two ==
14895 stuff
14896 !! html
14897 == Section One ==
14898 <pre>
14899 =======
14900 </pre>
14901
14902 xxx
14903 !! end
14904
14905
14906
14907 !! test
14908 Handling of &#x0A; in URLs
14909 !! wikitext
14910 ** irc://&#x0A;a
14911 !! html/php
14912 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14913
14914 !! html/parsoid
14915 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
14916 a">irc://
14917 a</a></li></ul></li></ul>
14918 !! end
14919
14920 !! test
14921 Handling of %0A in URLs
14922 !! wikitext
14923 ** irc://%0Aa
14924 !! html/php
14925 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14926
14927 !! html/parsoid
14928 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14929 !! end
14930
14931
14932 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14933 !! test
14934 5 quotes, code coverage +1 line
14935 !! options
14936 parsoid=wt2html
14937 !! wikitext
14938 '''''
14939 !! html/php
14940 !! html/parsoid
14941 <p><b><i></i></b></p>
14942 !! end
14943
14944 # same html as previous, but wikitext adjusted to match parsoid html2wt
14945 # note that wt2html and html2html will put the <i> before the <b>
14946 !! test
14947 5 quotes, code coverage +1 line w/ nowiki (1)
14948 !! options
14949 parsoid=wt2wt,html2wt
14950 !! wikitext
14951 '''''<nowiki/>'''''
14952 !! html/php
14953 <p><i></i>
14954 </p>
14955 !! html/parsoid
14956 <p><b><i></i></b></p>
14957 !! end
14958
14959 # same as previous, just swapping the <i> and <b>
14960 !! test
14961 5 quotes, code coverage +1 line w/ nowiki (2)
14962 !! wikitext
14963 '''''<nowiki/>'''''
14964 !! html/php
14965 <p><i></i>
14966 </p>
14967 !! html/parsoid
14968 <p><i><b></b></i></p>
14969 !! end
14970
14971 !! test
14972 Special:Search page linking.
14973 !! wikitext
14974 {{Special:search}}
14975 !! html
14976 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14977 </p>
14978 !! end
14979
14980 !! test
14981 Say the magic word
14982 !! options
14983 title=[[Parser test]]
14984 !! wikitext
14985 * {{PAGENAME}}
14986 * {{PAGENAMEE}}
14987 * {{FULLPAGENAME}}
14988 * {{FULLPAGENAMEE}}
14989 * {{BASEPAGENAME}}
14990 * {{BASEPAGENAMEE}}
14991 * {{SUBPAGENAME}}
14992 * {{SUBPAGENAMEE}}
14993 * {{ROOTPAGENAME}}
14994 * {{ROOTPAGENAMEE}}
14995 * {{TALKPAGENAME}}
14996 * {{TALKPAGENAMEE}}
14997 * {{SUBJECTPAGENAME}}
14998 * {{SUBJECTPAGENAMEE}}
14999 * {{NAMESPACEE}}
15000 * {{NAMESPACE}}
15001 * {{NAMESPACENUMBER}}
15002 * {{TALKSPACE}}
15003 * {{TALKSPACEE}}
15004 * {{SUBJECTSPACE}}
15005 * {{SUBJECTSPACEE}}
15006 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15007 !! html
15008 <ul><li> Parser test</li>
15009 <li> Parser_test</li>
15010 <li> Parser test</li>
15011 <li> Parser_test</li>
15012 <li> Parser test</li>
15013 <li> Parser_test</li>
15014 <li> Parser test</li>
15015 <li> Parser_test</li>
15016 <li> Parser test</li>
15017 <li> Parser_test</li>
15018 <li> Talk:Parser test</li>
15019 <li> Talk:Parser_test</li>
15020 <li> Parser test</li>
15021 <li> Parser_test</li>
15022 <li> </li>
15023 <li> </li>
15024 <li> 0</li>
15025 <li> Talk</li>
15026 <li> Talk</li>
15027 <li> </li>
15028 <li> </li>
15029 <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>
15030
15031 !! end
15032 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15033
15034 !! test
15035 Gallery
15036 !! wikitext
15037 <gallery>
15038 image1.png |
15039 image2.gif|||||
15040
15041 image3|
15042 image4 |300px| centre
15043 image5.svg| http://///////
15044 [[x|xx]]]]
15045 * image6
15046 </gallery>
15047 !! html
15048 <ul class="gallery mw-gallery-traditional">
15049 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15050 <div class="thumb" style="height: 150px;">Image1.png</div>
15051 <div class="gallerytext">
15052 </div>
15053 </div></li>
15054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15055 <div class="thumb" style="height: 150px;">Image2.gif</div>
15056 <div class="gallerytext">
15057 <p>||||
15058 </p>
15059 </div>
15060 </div></li>
15061 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15062 <div class="thumb" style="height: 150px;">Image3</div>
15063 <div class="gallerytext">
15064 </div>
15065 </div></li>
15066 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15067 <div class="thumb" style="height: 150px;">Image4</div>
15068 <div class="gallerytext">
15069 <p>300px| centre
15070 </p>
15071 </div>
15072 </div></li>
15073 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15074 <div class="thumb" style="height: 150px;">Image5.svg</div>
15075 <div class="gallerytext">
15076 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15077 </p>
15078 </div>
15079 </div></li>
15080 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15081 <div class="thumb" style="height: 150px;">* image6</div>
15082 <div class="gallerytext">
15083 </div>
15084 </div></li>
15085 </ul>
15086
15087 !! end
15088
15089 !! test
15090 Gallery (with options)
15091 !! wikitext
15092 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15093 File:Nonexistant.jpg|caption
15094 File:Nonexistant.jpg
15095 image:foobar.jpg|some '''caption''' [[Main Page]]
15096 image:foobar.jpg
15097 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15098 </gallery>
15099 !! html
15100 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15101 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15102 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15103 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15104 <div class="gallerytext">
15105 <p>caption
15106 </p>
15107 </div>
15108 </div></li>
15109 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15110 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15111 <div class="gallerytext">
15112 </div>
15113 </div></li>
15114 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15115 <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>
15116 <div class="gallerytext">
15117 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15118 </p>
15119 </div>
15120 </div></li>
15121 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15122 <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>
15123 <div class="gallerytext">
15124 </div>
15125 </div></li>
15126 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15127 <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>
15128 <div class="gallerytext">
15129 <p>Blabla|blabla.
15130 </p>
15131 </div>
15132 </div></li>
15133 </ul>
15134
15135 !! end
15136
15137 !! test
15138 Gallery with link that has fragment
15139 !! wikitext
15140 <gallery>
15141 image:foobar.jpg|link=Main_Page
15142 image:foobar.jpg|link=Main_Page#section
15143 image:foobar.jpg|link=Main Page#section|caption
15144 </gallery>
15145 !! html
15146 <ul class="gallery mw-gallery-traditional">
15147 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15148 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15149 <div class="gallerytext">
15150 </div>
15151 </div></li>
15152 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15153 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15154 <div class="gallerytext">
15155 </div>
15156 </div></li>
15157 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15158 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15159 <div class="gallerytext">
15160 <p>caption
15161 </p>
15162 </div>
15163 </div></li>
15164 </ul>
15165
15166 !! end
15167
15168 !! test
15169 Gallery with wikitext inside caption
15170 !! wikitext
15171 <gallery>
15172 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15173 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15174 </gallery>
15175 !! html
15176 <ul class="gallery mw-gallery-traditional">
15177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15178 <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>
15179 <div class="gallerytext">
15180 <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>
15181 </p>
15182 </div>
15183 </div></li>
15184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15185 <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>
15186 <div class="gallerytext">
15187 <p>This is a test template
15188 </p>
15189 </div>
15190 </div></li>
15191 </ul>
15192
15193 !! end
15194
15195 !! test
15196 gallery (with showfilename option)
15197 !! wikitext
15198 <gallery showfilename>
15199 File:Nonexistant.jpg|caption
15200 File:Nonexistant.jpg
15201 image:foobar.jpg|some '''caption''' [[Main Page]]
15202 File:Foobar.jpg
15203 </gallery>
15204 !! html
15205 <ul class="gallery mw-gallery-traditional">
15206 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15207 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15208 <div class="gallerytext">
15209 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15210 caption
15211 </p>
15212 </div>
15213 </div></li>
15214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15215 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15216 <div class="gallerytext">
15217 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15218 </p>
15219 </div>
15220 </div></li>
15221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15222 <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>
15223 <div class="gallerytext">
15224 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15225 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15226 </p>
15227 </div>
15228 </div></li>
15229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15230 <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>
15231 <div class="gallerytext">
15232 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15233 </p>
15234 </div>
15235 </div></li>
15236 </ul>
15237
15238 !! end
15239
15240 !! test
15241 Gallery (with namespace-less filenames)
15242 !! wikitext
15243 <gallery>
15244 File:Nonexistant.jpg
15245 Nonexistant.jpg
15246 image:foobar.jpg
15247 foobar.jpg
15248 </gallery>
15249 !! html
15250 <ul class="gallery mw-gallery-traditional">
15251 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15252 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15253 <div class="gallerytext">
15254 </div>
15255 </div></li>
15256 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15257 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15258 <div class="gallerytext">
15259 </div>
15260 </div></li>
15261 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15262 <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>
15263 <div class="gallerytext">
15264 </div>
15265 </div></li>
15266 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15267 <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>
15268 <div class="gallerytext">
15269 </div>
15270 </div></li>
15271 </ul>
15272
15273 !! end
15274
15275 !! test
15276 HTML Hex character encoding (spells the word "JavaScript")
15277 !! options
15278 parsoid=wt2html,wt2wt,html2html
15279 !! wikitext
15280 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15281 !! html/php
15282 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15283 </p>
15284 !! html/parsoid
15285 <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>
15286 !! end
15287
15288 !! test
15289 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15290 !! wikitext
15291 &#xsee;&#XSEE;
15292 !! html/php
15293 <p>&amp;#xsee;&amp;#XSEE;
15294 </p>
15295 !! html/parsoid
15296 <p>&amp;#xsee;&amp;#XSEE;</p>
15297 !! end
15298
15299 !! test
15300 HTML Hex character encoding mixed case
15301 !! options
15302 parsoid=wt2html,wt2wt,html2html
15303 !! wikitext
15304 &#xEE;&#Xee;
15305 !! html/php
15306 <p>&#xee;&#xee;
15307 </p>
15308 !! html/parsoid
15309 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15310 !! end
15311
15312 !! test
15313 __FORCETOC__ override
15314 !! wikitext
15315 __NEWSECTIONLINK__
15316 __FORCETOC__
15317 !! html
15318 <p><br />
15319 </p>
15320 !! end
15321
15322 !! test
15323 ISBN code coverage
15324 !! wikitext
15325 ISBN 978-0-1234-56&#x20;789
15326 !! html
15327 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15328 </p>
15329 !! end
15330
15331 !! test
15332 ISBN followed by 5 spaces
15333 !! wikitext
15334 ISBN
15335 !! html
15336 <p>ISBN
15337 </p>
15338 !! end
15339
15340 !! test
15341 Double ISBN
15342 !! wikitext
15343 ISBN ISBN 1234567890
15344 !! html
15345 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15346 </p>
15347 !! end
15348
15349 !! test
15350 ISBN with an X
15351 !! wikitext
15352 ISBN 3-462-04561-X
15353 !! html
15354 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15355 </p>
15356 !! end
15357
15358 !! test
15359 ISBN with empty prefix (parsoid test)
15360 !! wikitext
15361 ISBN 1234567890
15362 !! html/parsoid
15363 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15364 !! end
15365
15366 !! test
15367 Bug 22905: <abbr> followed by ISBN followed by </a>
15368 !! wikitext
15369 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15370 !! html
15371 <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>
15372 </p>
15373 !! end
15374
15375 !! test
15376 Double RFC
15377 !! wikitext
15378 RFC RFC 1234
15379 !! html
15380 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15381 </p>
15382 !! end
15383
15384 !! test
15385 Double RFC with a wiki link
15386 !! wikitext
15387 RFC [[RFC 1234]]
15388 !! html
15389 <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>
15390 </p>
15391 !! end
15392
15393 !! test
15394 RFC code coverage
15395 !! wikitext
15396 RFC 983&#x20;987
15397 !! html
15398 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15399 </p>
15400 !! end
15401
15402 !! test
15403 Centre-aligned image
15404 !! wikitext
15405 [[Image:foobar.jpg|centre]]
15406 !! html
15407 <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>
15408
15409 !!end
15410
15411 !! test
15412 None-aligned image
15413 !! wikitext
15414 [[Image:foobar.jpg|none]]
15415 !! html
15416 <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>
15417
15418 !!end
15419
15420 !! test
15421 Width + Height sized image (using px) (height is ignored)
15422 !! wikitext
15423 [[Image:foobar.jpg|640x480px]]
15424 !! html
15425 <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>
15426 </p>
15427 !!end
15428
15429 !! test
15430 Width-sized image (using px, no following whitespace)
15431 !! wikitext
15432 [[Image:foobar.jpg|640px]]
15433 !! html
15434 <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>
15435 </p>
15436 !!end
15437
15438 !! test
15439 Width-sized image (using px, with following whitespace - test regression from r39467)
15440 !! wikitext
15441 [[Image:foobar.jpg|640px ]]
15442 !! html
15443 <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>
15444 </p>
15445 !!end
15446
15447 !! test
15448 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15449 !! wikitext
15450 [[Image:foobar.jpg| 640px]]
15451 !! html
15452 <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>
15453 </p>
15454 !!end
15455
15456 !! test
15457 Image with page parameter
15458 !! options
15459 djvu
15460 !! wikitext
15461 [[File:LoremIpsum.djvu|page=2]]
15462 !! html
15463 <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>
15464 </p>
15465 !! end
15466
15467 !! test
15468 Another italics / bold test
15469 !! wikitext
15470 ''' ''x'
15471 !! html
15472 <pre>'<i> </i>x'
15473 </pre>
15474 !!end
15475
15476 # Note the results may be incorrect, as parserTest output included this:
15477 # XML error: Mismatched tag at byte 6120:
15478 # ...<dd> </dt></dl> </dd...
15479 !! test
15480 dt/dd/dl test
15481 !! options
15482 disabled
15483 !! wikitext
15484 :;;;::
15485 !! html
15486 <dl>
15487 <dd><dl>
15488 <dt><dl>
15489 <dt><dl>
15490 <dt><dl>
15491 <dd><dl>
15492 <dd>
15493 </dd>
15494 </dl>
15495 </dd>
15496 </dl>
15497 </dt>
15498 </dl>
15499 </dt>
15500 </dl>
15501 </dt>
15502 </dl>
15503 </dd>
15504 </dl>
15505
15506 !!end
15507
15508
15509 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15510 !! test
15511 Images with the "|" character in the comment
15512 !! wikitext
15513 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15514 !! html/php
15515 <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>
15516
15517 !! html/parsoid
15518 <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>
15519 !! end
15520
15521 !! test
15522 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15523 !! wikitext
15524 <html><script>alert(1);</script></html>
15525 !! html
15526 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15527 </p>
15528 !! end
15529
15530 !! test
15531 HTML with raw HTML ($wgRawHtml==true)
15532 !! options
15533 wgRawHtml=1
15534 !! wikitext
15535 <html><script>alert(1);</script></html>
15536 !! html
15537 <p><script>alert(1);</script>
15538 </p>
15539 !! end
15540
15541 !! test
15542 Parents of subpages, one level up
15543 !! options
15544 subpage title=[[Subpage test/L1/L2/L3]]
15545 !! wikitext
15546 [[../|L2]]
15547 !! html
15548 <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>
15549 </p>
15550 !! end
15551
15552
15553 !! test
15554 Parents of subpages, one level up, not named
15555 !! options
15556 subpage title=[[Subpage test/L1/L2/L3]]
15557 !! wikitext
15558 [[../]]
15559 !! html
15560 <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>
15561 </p>
15562 !! end
15563
15564
15565
15566 !! test
15567 Parents of subpages, two levels up
15568 !! options
15569 subpage title=[[Subpage test/L1/L2/L3]]
15570 !! wikitext
15571 [[../../|L1]]2
15572
15573 [[../../|L1]]l
15574 !! html
15575 <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
15576 </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>
15577 </p>
15578 !! end
15579
15580 !! test
15581 Parents of subpages, two levels up, without trailing slash or name.
15582 !! options
15583 subpage title=[[Subpage test/L1/L2/L3]]
15584 !! wikitext
15585 [[../..]]
15586 !! html
15587 <p>[[../..]]
15588 </p>
15589 !! end
15590
15591 !! test
15592 Parents of subpages, two levels up, with lots of extra trailing slashes.
15593 !! options
15594 subpage title=[[Subpage test/L1/L2/L3]]
15595 !! wikitext
15596 [[../../////]]
15597 !! html
15598 <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>
15599 </p>
15600 !! end
15601
15602 !! article
15603 Subpage test/L1/L2/L3Sibling
15604 !! text
15605 Sibling article
15606 !! endarticle
15607
15608 !! test
15609 Transclusion of a sibling page (one level up)
15610 !! options
15611 subpage title=[[Subpage test/L1/L2/L3]]
15612 !! wikitext
15613 {{../L3Sibling}}
15614 !! html
15615 <p>Sibling article
15616 </p>
15617 !! end
15618
15619 !! test
15620 Transclusion of a child page
15621 !! options
15622 subpage title=[[Subpage test/L1/L2]]
15623 !! wikitext
15624 {{/L3Sibling}}
15625 !! html
15626 <p>Sibling article
15627 </p>
15628 !! end
15629
15630 !! test
15631 Non-transclusion because of too many up levels
15632 !! options
15633 subpage title=[[Subpage test/L1/L2/L3]]
15634 !! wikitext
15635 {{../../../../More than parent}}
15636 !! html
15637 <p>{{../../../../More than parent}}
15638 </p>
15639 !! end
15640
15641 !! test
15642 Definition list code coverage
15643 !! wikitext
15644 ; title : def
15645 ; title : def
15646 ;title: def
15647 !! html
15648 <dl><dt> title &#160;</dt>
15649 <dd> def</dd>
15650 <dt> title&#160;</dt>
15651 <dd> def</dd>
15652 <dt>title</dt>
15653 <dd> def</dd></dl>
15654
15655 !! end
15656
15657 !! test
15658 Don't fall for the self-closing div
15659 !! wikitext
15660 <div>hello world</div/>
15661 !! html
15662 <div>hello world</div>
15663
15664 !! end
15665
15666 !! test
15667 MSGNW magic word
15668 !! wikitext
15669 {{MSGNW:msg}}
15670 !! html
15671 <p>&#91;&#91;:Template:Msg&#93;&#93;
15672 </p>
15673 !! end
15674
15675 !! test
15676 RAW magic word
15677 !! wikitext
15678 {{RAW:QUERTY}}
15679 !! html
15680 <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>
15681 </p>
15682 !! end
15683
15684 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15685 !! test
15686 Always escape literal '>' in output, not just after '<'
15687 !! wikitext
15688 ><>
15689 !! html
15690 <p>&gt;&lt;&gt;
15691 </p>
15692 !! end
15693
15694 !! test
15695 Template caching
15696 !! wikitext
15697 {{Test}}
15698 {{Test}}
15699 !! html
15700 <p>This is a test template
15701 This is a test template
15702 </p>
15703 !! end
15704
15705
15706 !! article
15707 MediaWiki:Fake
15708 !! text
15709 ==header==
15710 !! endarticle
15711
15712 !! test
15713 Inclusion of !userCanEdit() content
15714 !! wikitext
15715 {{MediaWiki:Fake}}
15716 !! html
15717 <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>
15718
15719 !! end
15720
15721
15722 !! test
15723 Out-of-order TOC heading levels
15724 !! wikitext
15725 ==2==
15726 ======6======
15727 ===3===
15728 =1=
15729 =====5=====
15730 ==2==
15731 !! html
15732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15733 <ul>
15734 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15735 <ul>
15736 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15737 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15738 </ul>
15739 </li>
15740 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15741 <ul>
15742 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15743 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15744 </ul>
15745 </li>
15746 </ul>
15747 </div>
15748
15749 <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>
15750 <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>
15751 <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>
15752 <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>
15753 <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>
15754 <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>
15755
15756 !! end
15757
15758
15759 !! test
15760 ISBN with a dummy number
15761 !! wikitext
15762 ISBN ---
15763 !! html
15764 <p>ISBN ---
15765 </p>
15766 !! end
15767
15768
15769 !! test
15770 ISBN with space-delimited number
15771 !! wikitext
15772 ISBN 92 9017 032 8
15773 !! html
15774 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15775 </p>
15776 !! end
15777
15778
15779 !! test
15780 ISBN with multiple spaces, no number
15781 !! wikitext
15782 ISBN foo
15783 !! html
15784 <p>ISBN foo
15785 </p>
15786 !! end
15787
15788
15789 !! test
15790 ISBN length
15791 !! wikitext
15792 ISBN 123456789
15793
15794 ISBN 1234567890
15795
15796 ISBN 12345678901
15797 !! html
15798 <p>ISBN 123456789
15799 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15800 </p><p>ISBN 12345678901
15801 </p>
15802 !! end
15803
15804
15805 !! test
15806 ISBN with trailing year (bug 8110)
15807 !! wikitext
15808 ISBN 1-234-56789-0 - 2006
15809
15810 ISBN 1 234 56789 0 - 2006
15811 !! html
15812 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15813 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15814 </p>
15815 !! end
15816
15817
15818 !! test
15819 anchorencode
15820 !! wikitext
15821 {{anchorencode:foo bar©#%n}}
15822 !! html
15823 <p>foo_bar.C2.A9.23.25n
15824 </p>
15825 !! end
15826
15827 !! test
15828 anchorencode trims spaces
15829 !! wikitext
15830 {{anchorencode: __pretty__please__}}
15831 !! html
15832 <p>pretty_please
15833 </p>
15834 !! end
15835
15836 !! test
15837 anchorencode deals with links
15838 !! wikitext
15839 {{anchorencode: [[hello|world]] [[hi]]}}
15840 !! html
15841 <p>world_hi
15842 </p>
15843 !! end
15844
15845 !! test
15846 anchorencode deals with templates
15847 !! wikitext
15848 {{anchorencode: {{Foo}} }}
15849 !! html
15850 <p>FOO
15851 </p>
15852 !! end
15853
15854 !! test
15855 anchorencode encodes like the TOC generator: (bug 18431)
15856 !! wikitext
15857 === _ +:.3A%3A&&amp;]] ===
15858 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15859 __NOEDITSECTION__
15860 !! html
15861 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15862 <p>.2B:.3A.253A.26.26.5D.5D
15863 </p>
15864 !! end
15865
15866 !! test
15867 Bug 6200: blockquotes and paragraph formatting
15868 !! wikitext
15869 <blockquote>
15870 foo
15871 </blockquote>
15872
15873 bar
15874
15875 baz
15876 !! html
15877 <blockquote>
15878 <p>foo
15879 </p>
15880 </blockquote>
15881 <p>bar
15882 </p>
15883 <pre>baz
15884 </pre>
15885 !! end
15886
15887 !! test
15888 Bug 8293: Use of center tag ruins paragraph formatting
15889 !! wikitext
15890 <center>
15891 foo
15892 </center>
15893
15894 bar
15895
15896 baz
15897 !! html
15898 <center>
15899 <p>foo
15900 </p>
15901 </center>
15902 <p>bar
15903 </p>
15904 <pre>baz
15905 </pre>
15906 !! end
15907
15908 !!test
15909 Parsing of overlapping (improperly nested) inline html tags
15910 !! wikitext
15911 <span><s>x</span></s>
15912 !! html/php
15913 <p><span><s>x&lt;/span&gt;</s></span>
15914 </p>
15915 !! html/parsoid
15916 <p><span><s>x</s></span>
15917 </p>
15918 !!end
15919
15920 ###
15921 ### Language variants related tests
15922 ###
15923 !! test
15924 Self-link in language variants
15925 !! options
15926 title=[[Dunav]] language=sr
15927 !! wikitext
15928 Both [[Dunav]] and [[Дунав]] are names for this river.
15929 !! html
15930 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15931 </p>
15932 !!end
15933
15934 !! article
15935 Дуна
15936 !! text
15937 content
15938 !! endarticle
15939
15940 !! test
15941 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15942 !! options
15943 title=[[Duna]] language=sr
15944 !! wikitext
15945 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15946 !! html
15947 <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.
15948 </p>
15949 !! end
15950
15951 !! test
15952 Link to a section of a variant of this title shouldn't be parsed as self-link
15953 !! options
15954 title=[[Duna]] language=sr
15955 !! wikitext
15956 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15957 !! html
15958 <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.
15959 </p>
15960 !! end
15961
15962 !! test
15963 Link to pages in language variants
15964 !! options
15965 language=sr
15966 !! wikitext
15967 Main Page can be written as [[Маин Паге]]
15968 !! html
15969 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15970 </p>
15971 !!end
15972
15973
15974 !! test
15975 Multiple links to pages in language variants
15976 !! options
15977 language=sr
15978 !! wikitext
15979 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15980 !! html
15981 <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>.
15982 </p>
15983 !!end
15984
15985
15986 !! test
15987 Simple template in language variants
15988 !! options
15989 language=sr
15990 !! wikitext
15991 {{тест}}
15992 !! html
15993 <p>This is a test template
15994 </p>
15995 !! end
15996
15997
15998 !! test
15999 Template with explicit namespace in language variants
16000 !! options
16001 language=sr
16002 !! wikitext
16003 {{Template:тест}}
16004 !! html
16005 <p>This is a test template
16006 </p>
16007 !! end
16008
16009
16010 !! test
16011 Basic test for template parameter in language variants
16012 !! options
16013 language=sr
16014 !! wikitext
16015 {{парамтест|param=foo}}
16016 !! html
16017 <p>This is a test template with parameter foo
16018 </p>
16019 !! end
16020
16021
16022 !! test
16023 Simple category in language variants
16024 !! options
16025 language=sr cat
16026 !! wikitext
16027 [[Category:МедиаWики Усер'с Гуиде]]
16028 !! html
16029 <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>
16030 !! end
16031
16032
16033 !! article
16034 Category:分类
16035 !! text
16036 blah
16037 !! endarticle
16038
16039 !! article
16040 Category:分類
16041 !! text
16042 blah
16043 !! endarticle
16044
16045 !! test
16046 Don't convert blue categorylinks to another variant (bug 33210)
16047 !! options
16048 language=zh cat
16049 !! wikitext
16050 [[A]][[Category:分类]]
16051 !! html
16052 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16053 !! end
16054
16055
16056 !! test
16057 Stripping -{}- tags (language variants)
16058 !! options
16059 language=sr
16060 !! wikitext
16061 Latin proverb: -{Ne nuntium necare}-
16062 !! html
16063 <p>Latin proverb: Ne nuntium necare
16064 </p>
16065 !! end
16066
16067
16068 !! test
16069 Prevent conversion with -{}- tags (language variants)
16070 !! options
16071 language=sr variant=sr-ec
16072 !! wikitext
16073 Latinski: -{Ne nuntium necare}-
16074 !! html
16075 <p>Латински: Ne nuntium necare
16076 </p>
16077 !! end
16078
16079
16080 !! test
16081 Prevent conversion of text with -{}- tags (language variants)
16082 !! options
16083 language=sr variant=sr-ec
16084 !! wikitext
16085 Latinski: -{Ne nuntium necare}-
16086 !! html
16087 <p>Латински: Ne nuntium necare
16088 </p>
16089 !! end
16090
16091
16092 !! test
16093 Prevent conversion of links with -{}- tags (language variants)
16094 !! options
16095 language=sr variant=sr-ec
16096 !! wikitext
16097 -{[[Main Page]]}-
16098 !! html
16099 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16100 </p>
16101 !! end
16102
16103
16104 !! test
16105 -{}- tags within headlines (within html for parserConvert())
16106 !! options
16107 language=sr variant=sr-ec
16108 !! wikitext
16109 == -{Naslov}- ==
16110 !! html
16111 <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>
16112
16113 !! end
16114
16115
16116 !! test
16117 Explicit definition of language variant alternatives
16118 !! options
16119 language=zh variant=zh-tw
16120 !! wikitext
16121 -{zh:China;zh-tw:Taiwan}-, not China
16122 !! html
16123 <p>Taiwan, not China
16124 </p>
16125 !! end
16126
16127
16128 !! test
16129 Conversion around HTML tags
16130 !! options
16131 language=sr variant=sr-ec
16132 !! wikitext
16133 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16134 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16135 !! html
16136 <p>
16137 <span title="ЛаCтин">ски</span>
16138 </p>
16139 !! end
16140
16141
16142 !! test
16143 Explicit session-wise language variant mapping (A flag and - flag)
16144 !! options
16145 language=zh variant=zh-tw
16146 !! wikitext
16147 Taiwan is not China.
16148 But -{A|zh:China;zh-tw:Taiwan}- is China,
16149 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16150 and -{China}- is China.
16151 !! html
16152 <p>Taiwan is not China.
16153 But Taiwan is Taiwan,
16154 (This should be stripped!)
16155 and China is China.
16156 </p>
16157 !! end
16158
16159 !! test
16160 Explicit session-wise language variant mapping (H flag for hide)
16161 !! options
16162 language=zh variant=zh-tw
16163 !! wikitext
16164 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16165 Taiwan is China.
16166 !! html
16167 <p>(This should be stripped!)
16168 Taiwan is Taiwan.
16169 </p>
16170 !! end
16171
16172 !! test
16173 Adding explicit conversion rule for title (T flag)
16174 !! options
16175 language=zh variant=zh-tw showtitle
16176 !! wikitext
16177 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16178 !! html
16179 Taiwan
16180 <p>Should be stripped!
16181 </p>
16182 !! end
16183
16184 !! test
16185 Testing that changing the language variant here in the tests actually works
16186 !! options
16187 language=zh variant=zh showtitle
16188 !! wikitext
16189 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16190 !! html
16191 China
16192 <p>Should be stripped!
16193 </p>
16194 !! end
16195
16196 !! test
16197 Recursive conversion of alt and title attrs shouldn't clear converter state
16198 !! options
16199 language=zh variant=zh-cn showtitle
16200 !! wikitext
16201 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16202 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16203 !! html
16204 China
16205 <p>
16206 Should be stripped<span title="Exclamation">!</span>
16207 </p>
16208 !! end
16209
16210 !! test
16211 Bug 24072: more test on conversion rule for title
16212 !! options
16213 language=zh variant=zh-tw showtitle
16214 !! wikitext
16215 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16216 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16217 !! html
16218 Taiwan
16219 <p>This should be stripped!
16220 This won't take interferes with the title rule.
16221 </p>
16222 !! end
16223
16224 !! test
16225 Partly disable title conversion if variant == main language code
16226 !! options
16227 language=zh variant=zh title=[[ZH]] showtitle
16228 !! wikitext
16229 -{T|zh-cn:CN;zh-tw:TW}-
16230 !! html
16231 ZH
16232 <p>
16233 </p>
16234 !! end
16235
16236 !! test
16237 Partly disable title conversion if variant == main language code, more
16238 !! options
16239 language=zh variant=zh title=[[ZH]] showtitle
16240 !! wikitext
16241 -{T|TW}-
16242 !! html
16243 ZH
16244 <p>
16245 </p>
16246 !! end
16247
16248 !! test
16249 Raw output of variant escape tags (R flag)
16250 !! options
16251 language=zh variant=zh-tw
16252 !! wikitext
16253 Raw: -{R|zh:China;zh-tw:Taiwan}-
16254 !! html
16255 <p>Raw: zh:China;zh-tw:Taiwan
16256 </p>
16257 !! end
16258
16259 !! test
16260 Nested using of manual convert syntax
16261 !! options
16262 language=zh variant=zh-hk
16263 !! wikitext
16264 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16265 !! html
16266 <p>Nested: Hello Hong Kong!
16267 </p>
16268 !! end
16269
16270 !! test
16271 Proper conversion of text in external links
16272 !! options
16273 language=sr variant=sr-ec
16274 !! wikitext
16275 http://www.google.com
16276 gopher://www.google.com
16277 [http://www.google.com http://www.google.com]
16278 [gopher://www.google.com gopher://www.google.com]
16279 [https://www.google.com irc://www.google.com]
16280 [ftp://www.google.com www.google.com/ftp://dir]
16281 [//www.google.com www.google.com]
16282 !! html
16283 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16284 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16285 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16286 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16287 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16288 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16289 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16290 </p>
16291 !! end
16292
16293 !! test
16294 Do not convert roman numbers to language variants
16295 !! options
16296 language=sr variant=sr-ec
16297 !! wikitext
16298 Fridrih IV je car.
16299 !! html
16300 <p>Фридрих IV је цар.
16301 </p>
16302 !! end
16303
16304 !! test
16305 Unclosed language converter markup "-{"
16306 !! options
16307 language=sr
16308 !! wikitext
16309 -{T|hello
16310 !! html
16311 <p>-{T|hello
16312 </p>
16313 !! end
16314
16315 !! test
16316 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16317 !! options
16318 language=sr
16319 !! wikitext
16320 -{R|=&gt;}-
16321 !! html
16322 <p>=&gt;
16323 </p>
16324 !!end
16325
16326 !! test
16327 Don't break link parsing if language converter markup is in the caption.
16328 !! options
16329 language=sr variant=sr-ec
16330 !! wikitext
16331 [[Main Page|-{R|main page}-]]
16332 !! html
16333 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16334 </p>
16335 !! end
16336
16337 # This test is currently broken in the PHP parser (bug 52661)
16338 !! test
16339 Don't break image parsing if language converter markup is in the caption.
16340 !! options
16341 language=sr
16342 disabled
16343 !! wikitext
16344 [[File:Foobar.jpg|-{R|caption}-]]
16345 !! html
16346 <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>
16347 </p>
16348 !! end
16349
16350 # This test is currently broken in the PHP parser (bug 52661)
16351 !! test
16352 Don't break list handling if language converter markup is in the item.
16353 !! options
16354 language=zh variant=zh-cn
16355 disabled
16356 !! wikitext
16357 ;-{zh-cn:AAA;zh-tw:BBB}-
16358 !! html
16359 <dl><dt>AAA
16360 </dt></dl>
16361
16362 !! end
16363
16364 # This test is currently broken in the PHP parser (bug 52661)
16365 !! test
16366 Don't break table handling if language converter markup is in the cell.
16367 !! options
16368 language=sr variant=sr-ec
16369 disabled
16370 !! wikitext
16371 {|
16372 |-
16373 | -{R|B}-
16374 |}
16375 !! html
16376 <table>
16377
16378 <tr>
16379 <td> B
16380 </td></tr></table>
16381
16382 !! end
16383
16384 !! test
16385 Bug 529: Uncovered bullet
16386 !! wikitext
16387 * Foo {{bullet}}
16388 !! html
16389 <ul><li> Foo </li>
16390 <li> Bar</li></ul>
16391
16392 !! end
16393
16394 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16395 # Templates in Wikipedia rely on this behavior, as tidy has always been
16396 # enabled there. These tests are normally run *without* tidy, so specify the
16397 # full output here.
16398 # To test realistic parsing behavior, apply a tidy-like transformation to both
16399 # the expected output and your parser's output.
16400 !! test
16401 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16402 !! wikitext
16403 ******* Foo {{bullet}}
16404 !! html
16405 <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>
16406 <li> Bar</li></ul>
16407
16408 !! end
16409
16410 !! test
16411 Bug 529: Uncovered table already at line-start
16412 !! wikitext
16413 x
16414
16415 {{table}}
16416 y
16417 !! html
16418 <p>x
16419 </p>
16420 <table>
16421 <tr>
16422 <td> 1 </td>
16423 <td> 2
16424 </td></tr>
16425 <tr>
16426 <td> 3 </td>
16427 <td> 4
16428 </td></tr></table>
16429 <p>y
16430 </p>
16431 !! end
16432
16433 !! test
16434 Bug 529: Uncovered bullet in parser function result
16435 !! wikitext
16436 * Foo {{lc:{{bullet}} }}
16437 !! html
16438 <ul><li> Foo </li>
16439 <li> bar</li></ul>
16440
16441 !! end
16442
16443 !! test
16444 Bug 5678: Double-parsed template argument
16445 !! wikitext
16446 {{lc:{{{1}}}|hello}}
16447 !! html
16448 <p>{{{1}}}
16449 </p>
16450 !! end
16451
16452 !! test
16453 Bug 5678: Double-parsed template invocation
16454 !! wikitext
16455 {{lc:{{paramtest {{!}} param = hello }} }}
16456 !! html
16457 <p>{{paramtest | param = hello }}
16458 </p>
16459 !! end
16460
16461 !! test
16462 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16463 !! options
16464 language=cs
16465 title=[[Main Page]]
16466 !! wikitext
16467 {{PRVNÍVELKÉ:ěščř}}
16468 {{prvnívelké:ěščř}}
16469 {{PRVNÍMALÉ:ěščř}}
16470 {{prvnímalé:ěščř}}
16471 {{MALÁ:ěščř}}
16472 {{malá:ěščř}}
16473 {{VELKÁ:ěščř}}
16474 {{velká:ěščř}}
16475 !! html
16476 <p>Ěščř
16477 Ěščř
16478 ěščř
16479 ěščř
16480 ěščř
16481 ěščř
16482 ĚŠČŘ
16483 ĚŠČŘ
16484 </p>
16485 !! end
16486
16487 !! test
16488 Morwen/13: Unclosed link followed by heading
16489 !! wikitext
16490 [[link
16491 ==heading==
16492 !! html
16493 <p>[[link
16494 </p>
16495 <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>
16496
16497 !! end
16498
16499 !! test
16500 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16501 !! wikitext
16502 {{foo|
16503 =heading=
16504 !! html
16505 <p>{{foo|
16506 </p>
16507 <h1><span class="mw-headline" id="heading">heading</span></h1>
16508
16509 !! end
16510
16511 !! test
16512 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16513 !! wikitext
16514 {{foo|
16515 ==heading==
16516 !! html
16517 <p>{{foo|
16518 </p>
16519 <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>
16520
16521 !! end
16522
16523 !! test
16524 Tildes in comments
16525 !! options
16526 pst
16527 !! wikitext
16528 <!-- ~~~~ -->
16529 !! html
16530 <!-- ~~~~ -->
16531 !! end
16532
16533 !! test
16534 Paragraphs inside divs (no extra line breaks)
16535 !! wikitext
16536 <div>Line one
16537
16538 Line two</div>
16539 !! html
16540 <div>Line one
16541 Line two</div>
16542
16543 !! end
16544
16545 !! test
16546 Paragraphs inside divs (extra line break on open)
16547 !! wikitext
16548 <div>
16549 Line one
16550
16551 Line two</div>
16552 !! html
16553 <div>
16554 <p>Line one
16555 </p>
16556 Line two</div>
16557
16558 !! end
16559
16560 !! test
16561 Paragraphs inside divs (extra line break on close)
16562 !! wikitext
16563 <div>Line one
16564
16565 Line two
16566 </div>
16567 !! html
16568 <div>Line one
16569 <p>Line two
16570 </p>
16571 </div>
16572
16573 !! end
16574
16575 !! test
16576 Paragraphs inside divs (extra line break on open and close)
16577 !! wikitext
16578 <div>
16579 Line one
16580
16581 Line two
16582 </div>
16583 !! html
16584 <div>
16585 <p>Line one
16586 </p><p>Line two
16587 </p>
16588 </div>
16589
16590 !! end
16591
16592 !! test
16593 Nesting tags, paragraphs on lines which begin with <div>
16594 !! options
16595 disabled
16596 !! wikitext
16597 <div></div><strong>A
16598 B</strong>
16599 !! html
16600 <div></div>
16601 <p><strong>A
16602 B</strong>
16603 </p>
16604 !! end
16605
16606 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16607 !! test
16608 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16609 !! wikitext
16610 <blockquote>Line one
16611
16612 Line two</blockquote>
16613 !! html
16614 <blockquote>Line one
16615 Line two</blockquote>
16616
16617 !! end
16618
16619 !! test
16620 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16621 !! wikitext
16622 <blockquote>
16623 Line one
16624
16625 Line two</blockquote>
16626 !! html
16627 <blockquote>
16628 <p>Line one
16629 </p>
16630 Line two</blockquote>
16631
16632 !! end
16633
16634 !! test
16635 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16636 !! wikitext
16637 <blockquote>Line one
16638
16639 Line two
16640 </blockquote>
16641 !! html
16642 <blockquote>Line one
16643 <p>Line two
16644 </p>
16645 </blockquote>
16646
16647 !! end
16648
16649 !! test
16650 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16651 !! wikitext
16652 <blockquote>
16653 Line one
16654
16655 Line two
16656 </blockquote>
16657 !! html
16658 <blockquote>
16659 <p>Line one
16660 </p><p>Line two
16661 </p>
16662 </blockquote>
16663
16664 !! end
16665
16666 !! test
16667 Paragraphs inside blockquotes/divs (no extra line breaks)
16668 !! wikitext
16669 <blockquote><div>Line one
16670
16671 Line two</div></blockquote>
16672 !! html
16673 <blockquote><div>Line one
16674 Line two</div></blockquote>
16675
16676 !! end
16677
16678 !! test
16679 Paragraphs inside blockquotes/divs (extra line break on open)
16680 !! wikitext
16681 <blockquote><div>
16682 Line one
16683
16684 Line two</div></blockquote>
16685 !! html
16686 <blockquote><div>
16687 <p>Line one
16688 </p>
16689 Line two</div></blockquote>
16690
16691 !! end
16692
16693 !! test
16694 Paragraphs inside blockquotes/divs (extra line break on close)
16695 !! wikitext
16696 <blockquote><div>Line one
16697
16698 Line two
16699 </div></blockquote>
16700 !! html
16701 <blockquote><div>Line one
16702 <p>Line two
16703 </p>
16704 </div></blockquote>
16705
16706 !! end
16707
16708 !! test
16709 Paragraphs inside blockquotes/divs (extra line break on open and close)
16710 !! wikitext
16711 <blockquote><div>
16712 Line one
16713
16714 Line two
16715 </div></blockquote>
16716 !! html
16717 <blockquote><div>
16718 <p>Line one
16719 </p><p>Line two
16720 </p>
16721 </div></blockquote>
16722
16723 !! end
16724
16725 !! test
16726 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16727 !! options
16728 wgLinkHolderBatchSize=0
16729 !! wikitext
16730 [[meatball:1]]
16731 [[meatball:2]]
16732 [[meatball:3]]
16733 !! html
16734 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16735 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16736 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16737 </p>
16738 !! end
16739
16740 !! test
16741 Free external link invading image caption
16742 !! wikitext
16743 [[Image:Foobar.jpg|thumb|http://x|hello]]
16744 !! html
16745 <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>
16746
16747 !! end
16748
16749 !! test
16750 Bug 15196: localised external link numbers
16751 !! options
16752 language=fa
16753 !! wikitext
16754 [http://en.wikipedia.org/]
16755 !! html/php
16756 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16757 </p>
16758 !! html/parsoid
16759 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16760 !! end
16761
16762 !! test
16763 Multibyte character in padleft
16764 !! wikitext
16765 {{padleft:-Hello|7|Æ}}
16766 !! html
16767 <p>Æ-Hello
16768 </p>
16769 !! end
16770
16771 !! test
16772 Multibyte character in padright
16773 !! wikitext
16774 {{padright:Hello-|7|Æ}}
16775 !! html
16776 <p>Hello-Æ
16777 </p>
16778 !! end
16779
16780 !!test
16781 formatdate parser function
16782 !! wikitext
16783 {{#formatdate:2009-03-24}}
16784 !! html
16785 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16786 </p>
16787 !! end
16788
16789 !!test
16790 formatdate parser function, with default format
16791 !! wikitext
16792 {{#formatdate:2009-03-24|mdy}}
16793 !! html
16794 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16795 </p>
16796 !! end
16797
16798 !! test
16799 Spacing of numbers in formatted dates
16800 !! wikitext
16801 {{#formatdate:January 15}}
16802 !! html
16803 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16804 </p>
16805 !! end
16806
16807 !! test
16808 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
16809 !! options
16810 language=nl title=[[MediaWiki:Common.css]]
16811 !! wikitext
16812 {{#formatdate:2009-03-24|dmy}}
16813 !! html
16814 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16815 </p>
16816 !! end
16817
16818 #
16819 #
16820 #
16821
16822 #
16823 # Edit comments
16824 #
16825
16826 !! test
16827 Edit comment with link
16828 !! options
16829 comment
16830 !! wikitext
16831 I like the [[Main Page]] a lot
16832 !! html
16833 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16834 !!end
16835
16836 !! test
16837 Edit comment with link and link text
16838 !! options
16839 comment
16840 !! wikitext
16841 I like the [[Main Page|best pages]] a lot
16842 !! html
16843 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16844 !!end
16845
16846 !! test
16847 Edit comment with link and link text with suffix
16848 !! options
16849 comment
16850 !! wikitext
16851 I like the [[Main Page|best page]]s a lot
16852 !! html
16853 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16854 !!end
16855
16856 !! test
16857 Edit comment with section link (non-local, eg in history list)
16858 !! options
16859 comment title=[[Main Page]]
16860 !! wikitext
16861 /* External links */ removed bogus entries
16862 !! html
16863 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16864 !!end
16865
16866 !! test
16867 Edit comment with section link and text before it (non-local, eg in history list)
16868 !! options
16869 comment title=[[Main Page]]
16870 !! wikitext
16871 pre-comment text /* External links */ removed bogus entries
16872 !! html
16873 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>
16874 !!end
16875
16876 !! test
16877 Edit comment with section link (local, eg in diff view)
16878 !! options
16879 comment local title=[[Main Page]]
16880 !! wikitext
16881 /* External links */ removed bogus entries
16882 !! html
16883 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16884 !!end
16885
16886 !! test
16887 Edit comment with subpage link (bug 14080)
16888 !! options
16889 comment
16890 subpage
16891 title=[[Subpage test]]
16892 !! wikitext
16893 Poked at a [[/subpage]] here...
16894 !! html
16895 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16896 !!end
16897
16898 !! test
16899 Edit comment with subpage link and link text (bug 14080)
16900 !! options
16901 comment
16902 subpage
16903 title=[[Subpage test]]
16904 !! wikitext
16905 Poked at a [[/subpage|neat little page]] here...
16906 !! html
16907 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16908 !!end
16909
16910 !! test
16911 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16912 !! options
16913 comment
16914 title=[[Subpage test]]
16915 !! wikitext
16916 Poked at a [[/subpage]] here...
16917 !! html
16918 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...
16919 !!end
16920
16921 !! test
16922 Edit comment with bare anchor link (local, as on diff)
16923 !! options
16924 comment
16925 local
16926 title=[[Main Page]]
16927 !! wikitext
16928 [[#section]]
16929 !! html
16930 <a href="#section">#section</a>
16931 !! end
16932
16933 !! test
16934 Edit comment with bare anchor link (non-local, as on history)
16935 !! options
16936 comment
16937 title=[[Main Page]]
16938 !! wikitext
16939 [[#section]]
16940 !! html
16941 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16942 !! end
16943
16944 !! test
16945 Anchor starting with underscore
16946 !! wikitext
16947 [[#_ref|One]]
16948 !! html
16949 <p><a href="#_ref">One</a>
16950 </p>
16951 !! end
16952
16953 !! test
16954 Id starting with underscore
16955 !! wikitext
16956 <div id="_ref"></div>
16957 !! html
16958 <div id="_ref"></div>
16959
16960 !! end
16961
16962 !! test
16963 Space normalisation on autocomment (bug 22784)
16964 !! options
16965 comment
16966 title=[[Main Page]]
16967 !! wikitext
16968 /* __hello__world__ */
16969 !! html
16970 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16971 !! end
16972
16973 !! test
16974 percent-encoding and + signs in comments (Bug 26410)
16975 !! options
16976 comment
16977 !! wikitext
16978 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16979 !! html
16980 <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>
16981 !! end
16982
16983 !! test
16984 Bad images - basic functionality
16985 !! options
16986 disabled
16987 !! wikitext
16988 [[File:Bad.jpg]]
16989 !! html
16990 !! end
16991
16992 !! test
16993 Bad images - bug 16039: text after bad image disappears
16994 !! options
16995 disabled
16996 !! wikitext
16997 Foo bar
16998 [[File:Bad.jpg]]
16999 Bar foo
17000 !! html
17001 <p>Foo bar
17002 </p><p>Bar foo
17003 </p>
17004 !! end
17005
17006 !! test
17007 Verify that displaytitle works (bug #22501) no displaytitle
17008 !! options
17009 showtitle
17010 !! config
17011 wgAllowDisplayTitle=true
17012 wgRestrictDisplayTitle=false
17013 !! wikitext
17014 this is not the the title
17015 !! html
17016 Parser test
17017 <p>this is not the the title
17018 </p>
17019 !! end
17020
17021 !! test
17022 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17023 !! options
17024 showtitle
17025 title=[[Screen]]
17026 !! config
17027 wgAllowDisplayTitle=true
17028 wgRestrictDisplayTitle=false
17029 !! wikitext
17030 this is not the the title
17031 {{DISPLAYTITLE:whatever}}
17032 !! html
17033 whatever
17034 <p>this is not the the title
17035 </p>
17036 !! end
17037
17038 !! test
17039 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17040 !! options
17041 showtitle
17042 title=[[Screen]]
17043 !! config
17044 wgAllowDisplayTitle=true
17045 wgRestrictDisplayTitle=true
17046 !! wikitext
17047 this is not the the title
17048 {{DISPLAYTITLE:whatever}}
17049 !! html
17050 Screen
17051 <p>this is not the the title
17052 </p>
17053 !! end
17054
17055 !! test
17056 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17057 !! options
17058 showtitle
17059 title=[[Screen]]
17060 !! config
17061 wgAllowDisplayTitle=true
17062 wgRestrictDisplayTitle=true
17063 !! wikitext
17064 this is not the the title
17065 {{DISPLAYTITLE:screen}}
17066 !! html
17067 screen
17068 <p>this is not the the title
17069 </p>
17070 !! end
17071
17072 !! test
17073 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17074 !! options
17075 showtitle
17076 title=[[Screen]]
17077 !! config
17078 wgAllowDisplayTitle=false
17079 !! wikitext
17080 this is not the the title
17081 {{DISPLAYTITLE:screen}}
17082 !! html
17083 Screen
17084 <p>this is not the the title
17085 <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>
17086 </p>
17087 !! end
17088
17089 !! test
17090 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17091 !! options
17092 showtitle
17093 title=[[Screen]]
17094 !! config
17095 wgAllowDisplayTitle=false
17096 !! wikitext
17097 this is not the the title
17098 !! html
17099 Screen
17100 <p>this is not the the title
17101 </p>
17102 !! end
17103
17104 !! test
17105 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17106 !! options
17107 showtitle
17108 title=[[Screen]]
17109 !! config
17110 wgAllowDisplayTitle=true
17111 wgRestrictDisplayTitle=true
17112 !! wikitext
17113 this is not the the title
17114 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17115 !! html
17116 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17117 <p>this is not the the title
17118 </p>
17119 !! end
17120
17121 !! test
17122 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17123 !! options
17124 showtitle
17125 title=[[Screen]]
17126 !! config
17127 wgAllowDisplayTitle=true
17128 wgRestrictDisplayTitle=true
17129 !! wikitext
17130 this is not the the title
17131 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17132 !! html
17133 <span style="color: red;">s</span>creen
17134 <p>this is not the the title
17135 </p>
17136 !! end
17137
17138 !! test
17139 preload: check <noinclude> and <includeonly>
17140 !! options
17141 preload
17142 !! wikitext
17143 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17144 !! html
17145 Hello kind world.
17146 !! end
17147
17148 !! test
17149 preload: check <onlyinclude>
17150 !! options
17151 preload
17152 !! wikitext
17153 Goodbye <onlyinclude>Hello world</onlyinclude>
17154 !! html
17155 Hello world
17156 !! end
17157
17158 !! test
17159 preload: can pass tags through if we want to
17160 !! options
17161 preload
17162 !! wikitext
17163 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17164 !! html
17165 <includeonly>Hello world</includeonly>
17166 !! end
17167
17168 !! test
17169 preload: check that it doesn't try to do tricks
17170 !! options
17171 preload
17172 !! wikitext
17173 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17174 !! html
17175 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17176 !! end
17177
17178 !! test
17179 Play a bit with r67090 and bug 3158
17180 !! options
17181 disabled
17182 !! wikitext
17183 <div style="width:50% !important">&nbsp;</div>
17184 <div style="width:50%&nbsp;!important">&nbsp;</div>
17185 <div style="width:50%&#160;!important">&nbsp;</div>
17186 <div style="border : solid;">&nbsp;</div>
17187 !! html
17188 <div style="width:50% !important">&nbsp;</div>
17189 <div style="width:50% !important">&nbsp;</div>
17190 <div style="width:50% !important">&nbsp;</div>
17191 <div style="border&#160;: solid;">&nbsp;</div>
17192
17193 !! end
17194
17195 !! test
17196 HTML5 data attributes
17197 !! wikitext
17198 <span data-foo="bar">Baz</span>
17199 <p data-abc-def_hij="">Quuz</p>
17200 !! html
17201 <p><span data-foo="bar">Baz</span>
17202 </p>
17203 <p data-abc-def_hij="">Quuz</p>
17204
17205 !! end
17206
17207 !! test
17208 percent-encoding and + signs in internal links (Bug 26410)
17209 !! wikitext
17210 [[User:+%]] [[Page+title%]]
17211 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17212 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17213 [[%33%45]] [[%33%45+]]
17214 !! html
17215 <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>
17216 <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>
17217 <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>
17218 <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>
17219 </p>
17220 !! end
17221
17222 !! test
17223 Special characters in embedded file links (bug 27679)
17224 !! wikitext
17225 [[File:Contains & ampersand.jpg]]
17226 [[File:Does not exist.jpg|Title with & ampersand]]
17227 !! html
17228 <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>
17229 <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>
17230 </p>
17231 !! end
17232
17233
17234 !! test
17235 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17236 !! wikitext
17237 Text&apos;s been normalized?
17238 !! html
17239 <p>Text&#39;s been normalized?
17240 </p>
17241 !! end
17242
17243 !! test
17244 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17245 !! wikitext
17246 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17247 !! html
17248 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17249 </p>
17250 !! end
17251
17252 !! test
17253 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17254 !! wikitext
17255 [http://www.example.org/ ideograms]
17256 !! html
17257 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17258 </p>
17259 !! end
17260
17261 !! test
17262 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17263 !! wikitext
17264 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17265 !! html
17266 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17267 </p>
17268 !! end
17269
17270 !! article
17271 Mediawiki:loop1
17272 !! text
17273 {{Identical|A}}
17274 !! endarticle
17275
17276 !! article
17277 Mediawiki:loop2
17278 !! text
17279 {{Identical|B}}
17280 !! endarticle
17281
17282 !! article
17283 Template:Identical
17284 !! text
17285 {{int:loop1}}
17286 {{int:loop2}}
17287 !! endarticle
17288
17289 !! test
17290 Bug 31098 Template which includes system messages which includes the template
17291 !! wikitext
17292 {{Identical}}
17293 !! html
17294 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17295 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17296 </p>
17297 !! end
17298
17299 !! test
17300 Bug31490 Turkish: ucfirst 'blah'
17301 !! options
17302 language=tr
17303 !! wikitext
17304 {{ucfirst:blah}}
17305 !! html
17306 <p>Blah
17307 </p>
17308 !! end
17309
17310 !! test
17311 Bug31490 Turkish: ucfirst 'ix'
17312 !! options
17313 language=tr
17314 !! wikitext
17315 {{ucfirst:ix}}
17316 !! html
17317 <p>İx
17318 </p>
17319 !! end
17320
17321 !! test
17322 Bug31490 Turkish: lcfirst 'BLAH'
17323 !! options
17324 language=tr
17325 !! wikitext
17326 {{lcfirst:BLAH}}
17327 !! html
17328 <p>bLAH
17329 </p>
17330 !! end
17331
17332 !! test
17333 Bug31490 Turkish: ucfırst (with a dotless i)
17334 !! options
17335 language=tr
17336 !! wikitext
17337 {{ucfırst:blah}}
17338 !! html
17339 <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>
17340 </p>
17341 !! end
17342
17343 !! test
17344 Bug31490 ucfırst (with a dotless i) with English language
17345 !! options
17346 language=en
17347 !! wikitext
17348 {{ucfırst:blah}}
17349 !! html
17350 <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>
17351 </p>
17352 !! end
17353
17354 !! test
17355 Bug 26375: TOC with italics
17356 !! options
17357 title=[[Main Page]]
17358 !! wikitext
17359 __TOC__
17360 == ''Lost'' episodes ==
17361 !! html
17362 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17363 <ul>
17364 <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>
17365 </ul>
17366 </div>
17367
17368 <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>
17369
17370 !! end
17371
17372 !! test
17373 Bug 26375: TOC with bold
17374 !! options
17375 title=[[Main Page]]
17376 !! wikitext
17377 __TOC__
17378 == '''should be bold''' then normal text ==
17379 !! html
17380 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17381 <ul>
17382 <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>
17383 </ul>
17384 </div>
17385
17386 <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>
17387
17388 !! end
17389
17390 !! test
17391 Bug 33845: Headings become cursive in TOC when they contain an image
17392 !! options
17393 title=[[Main Page]]
17394 !! wikitext
17395 __TOC__
17396 == Image [[Image:foobar.jpg]] ==
17397 !! html
17398 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17399 <ul>
17400 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17401 </ul>
17402 </div>
17403
17404 <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>
17405
17406 !! end
17407
17408 !! test
17409 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17410 !! options
17411 title=[[Main Page]]
17412 !! wikitext
17413 __TOC__
17414 == <blockquote>Quote</blockquote> ==
17415 !! html
17416 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17417 <ul>
17418 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17419 </ul>
17420 </div>
17421
17422 <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>
17423
17424 !! end
17425
17426 !! test
17427 Unclosed tags in TOC
17428 !! options
17429 title=[[Main Page]]
17430 !! wikitext
17431 __TOC__
17432 == Proof: 2 < 3 ==
17433 <small>Hanc marginis exiguitas non caperet.</small>
17434 QED
17435 !! html
17436 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17437 <ul>
17438 <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>
17439 </ul>
17440 </div>
17441
17442 <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>
17443 <p><small>Hanc marginis exiguitas non caperet.</small>
17444 QED
17445 </p>
17446 !! end
17447
17448 !! test
17449 Multiple tags in TOC
17450 !! wikitext
17451 __TOC__
17452 == <i>Foo</i> <b>Bar</b> ==
17453
17454 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17455 !! html
17456 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17457 <ul>
17458 <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>
17459 <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>
17460 </ul>
17461 </div>
17462
17463 <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>
17464 <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>
17465
17466 !! end
17467
17468 !! test
17469 Tags with parameters in TOC
17470 !! wikitext
17471 __TOC__
17472 == <sup class="in-h2">Hello</sup> ==
17473
17474 == <sup class="a > b">Evilbye</sup> ==
17475 !! html
17476 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17477 <ul>
17478 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17479 <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>
17480 </ul>
17481 </div>
17482
17483 <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>
17484 <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>
17485
17486 !! end
17487
17488 !! test
17489 span tags with directionality in TOC
17490 !! wikitext
17491 __TOC__
17492 == <span dir="ltr">C++</span> ==
17493
17494 == <span dir="rtl">זבנג!</span> ==
17495
17496 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17497
17498 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17499
17500 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17501 !! html
17502 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17503 <ul>
17504 <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>
17505 <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>
17506 <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>
17507 <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>
17508 <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>
17509 </ul>
17510 </div>
17511
17512 <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>
17513 <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>
17514 <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>
17515 <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>
17516 <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>
17517
17518 !! end
17519
17520 !! article
17521 MediaWiki:Bug32057
17522 !! text
17523 == {{int:headline_sample}} ==
17524 !! endarticle
17525
17526 !! test
17527 Bug 32057: Title needed when expanding <h> nodes.
17528 !! options
17529 title=[[Main Page]]
17530 !! wikitext
17531 {{int:Bug32057}}
17532 !! html
17533 <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>
17534
17535 !! end
17536
17537 !! test
17538 Strip marker in urlencode
17539 !! wikitext
17540 {{urlencode:x<nowiki/>y}}
17541 {{urlencode:x<nowiki/>y|wiki}}
17542 {{urlencode:x<nowiki/>y|path}}
17543 !! html
17544 <p>xy
17545 xy
17546 xy
17547 </p>
17548 !! end
17549
17550 !! test
17551 Strip marker in lc
17552 !! wikitext
17553 {{lc:x<nowiki/>y}}
17554 !! html
17555 <p>xy
17556 </p>
17557 !! end
17558
17559 !! test
17560 Strip marker in uc
17561 !! wikitext
17562 {{uc:x<nowiki/>y}}
17563 !! html
17564 <p>XY
17565 </p>
17566 !! end
17567
17568 !! test
17569 Strip marker in formatNum
17570 !! wikitext
17571 {{formatnum:1<nowiki/>2}}
17572 {{formatnum:1<nowiki/>2|R}}
17573 !! html
17574 <p>12
17575 12
17576 </p>
17577 !! end
17578
17579 !! test
17580 Check noCommafy in formatNum
17581 !! options
17582 language=be-tarask
17583 !! wikitext
17584 {{formatnum:123456.78}}
17585 {{formatnum:123456.78|NOSEP}}
17586 !! html
17587 <p>123 456,78
17588 123456.78
17589 </p>
17590 !! end
17591
17592 !! test
17593 Wrong option for formatNum (bug 56199)
17594 !! wikitext
17595 {{formatnum:1,234.56|Random}}
17596 {{formatnum:1,234.56|EVERYTHING}}
17597 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17598 !! html
17599 <p>1,234.56
17600 1,234.56
17601 1,234.56
17602 </p>
17603 !! end
17604
17605 !! test
17606 Strip marker in grammar
17607 !! options
17608 language=fi
17609 !! wikitext
17610 {{grammar:elative|foo<nowiki/>bar}}
17611 !! html
17612 <p>foobarista
17613 </p>
17614 !! end
17615
17616 !! test
17617 Strip marker in padleft
17618 !! wikitext
17619 {{padleft:|2|x<nowiki/>y}}
17620 !! html
17621 <p>xy
17622 </p>
17623 !! end
17624
17625 !! test
17626 Strip marker in padright
17627 !! wikitext
17628 {{padright:|2|x<nowiki/>y}}
17629 !! html
17630 <p>xy
17631 </p>
17632 !! end
17633
17634 !! test
17635 Strip marker in anchorencode
17636 !! wikitext
17637 {{anchorencode:x<nowiki/>y}}
17638 !! html
17639 <p>xy
17640 </p>
17641 !! end
17642
17643 !! test
17644 nowiki inside link inside heading (bug 18295)
17645 !! wikitext
17646 ==[[foo|x<nowiki>y</nowiki>z]]==
17647 !! html
17648 <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>
17649
17650 !! end
17651
17652 !! test
17653 new support for bdi element (bug 31817)
17654 !! wikitext
17655 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17656 !! html
17657 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17658
17659 !!end
17660
17661 !! test
17662 Ignore pipe between table row attributes
17663 !! wikitext
17664 {|
17665 | quux
17666 |- id=foo | style='color: red'
17667 | bar
17668 |}
17669 !! html
17670 <table>
17671 <tr>
17672 <td> quux
17673 </td></tr>
17674 <tr id="foo" style="color: red">
17675 <td> bar
17676 </td></tr></table>
17677
17678 !! end
17679
17680 !!test
17681 Gallery override link with WikiLink (bug 34852)
17682 !! wikitext
17683 <gallery>
17684 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17685 </gallery>
17686 !! html
17687 <ul class="gallery mw-gallery-traditional">
17688 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17689 <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>
17690 <div class="gallerytext">
17691 <p>caption
17692 </p>
17693 </div>
17694 </div></li>
17695 </ul>
17696
17697 !! end
17698
17699 !!test
17700 Gallery override link with absolute external link (bug 34852)
17701 !! wikitext
17702 <gallery>
17703 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17704 </gallery>
17705 !! html
17706 <ul class="gallery mw-gallery-traditional">
17707 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17708 <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>
17709 <div class="gallerytext">
17710 <p>caption
17711 </p>
17712 </div>
17713 </div></li>
17714 </ul>
17715
17716 !! end
17717
17718 !!test
17719 Gallery override link with malicious javascript (bug 34852)
17720 !! wikitext
17721 <gallery>
17722 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17723 </gallery>
17724 !! html
17725 <ul class="gallery mw-gallery-traditional">
17726 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17727 <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>
17728 <div class="gallerytext">
17729 <p>caption
17730 </p>
17731 </div>
17732 </div></li>
17733 </ul>
17734
17735 !! end
17736
17737 !!test
17738 Gallery with invalid title as link (bug 43964)
17739 !! wikitext
17740 <gallery>
17741 File:foobar.jpg|link=<
17742 </gallery>
17743 !! html
17744 <ul class="gallery mw-gallery-traditional">
17745 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17746 <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>
17747 <div class="gallerytext">
17748 </div>
17749 </div></li>
17750 </ul>
17751
17752 !! end
17753
17754 !!test
17755 Language parser function
17756 !! wikitext
17757 {{#language:ar}}
17758 !! html
17759 <p>العربية
17760 </p>
17761 !! end
17762
17763 !!test
17764 Padleft and padright as substr
17765 !! wikitext
17766 {{padleft:|3|abcde}}
17767 {{padright:|3|abcde}}
17768 !! html
17769 <p>abc
17770 abc
17771 </p>
17772 !! end
17773
17774 !!test
17775 Special parser function
17776 !! wikitext
17777 {{#special:RandomPage}}
17778 {{#special:BaDtItLe}}
17779 {{#special:Foobar}}
17780 !! html
17781 <p>Special:Random
17782 Special:Badtitle
17783 Special:Foobar
17784 </p>
17785 !! end
17786
17787 !!test
17788 Bug 34939 - Case insensitive link parsing ([HttP://])
17789 !! wikitext
17790 [HttP://MediaWiki.Org/]
17791 !! html/php
17792 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17793 </p>
17794 !! html/parsoid
17795 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17796 !! end
17797
17798 !!test
17799 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17800 !! wikitext
17801 [HttP://MediaWiki.Org/ MediaWiki]
17802 !! html
17803 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17804 </p>
17805 !! end
17806
17807 !!test
17808 Bug 34939 - Case insensitive link parsing (HttP://)
17809 !! wikitext
17810 HttP://MediaWiki.Org/
17811 !! html/php
17812 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17813 </p>
17814 !! html/parsoid
17815 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17816 !! end
17817
17818 !!test
17819 Disable TOC
17820 !! options
17821 notoc
17822 !! wikitext
17823 Lead
17824 == Section 1 ==
17825 == Section 2 ==
17826 == Section 3 ==
17827 == Section 4 ==
17828 == Section 5 ==
17829 !! html
17830 <p>Lead
17831 </p>
17832
17833 <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>
17834 <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>
17835 <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>
17836 <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>
17837 <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>
17838
17839 !! end
17840
17841
17842 ###
17843 ### Parsoid-specific tests
17844 ### Parsoid-PHP parser incompatibilities
17845 ###
17846 !!test
17847 1. SOL-sensitive wikitext tokens as template-args
17848 !!options
17849 parsoid=wt2html,wt2wt
17850 !! wikitext
17851 {{echo|*a}}
17852 {{echo|#a}}
17853 {{echo|:a}}
17854 !! html
17855 <span about="#mwt1" typeof="mw:Transclusion">
17856 </span><ul about="#mwt1"><li>a</li>
17857 </ul>
17858 <span about="#mwt2" typeof="mw:Transclusion">
17859 </span><ol about="#mwt2"><li>a</li>
17860 </ol>
17861 <span about="#mwt3" typeof="mw:Transclusion">
17862 </span><dl about="#mwt3"><dd>a</dd>
17863 </dl>
17864 !!end
17865
17866 #### -----------------------------------------------------------------
17867 #### Parsoid-specific functionality tests
17868 #### -----------------------------------------------------------------
17869
17870 # Bug 63642: Formatting elt fixup is cleaned up.
17871 # We know wt2wt will fail, but we expect selser to pass.
17872 # Due to the nature of our testing, wt2wt and selser tests will enter the
17873 # blacklist and we'll catch selser regressions based on changes to the
17874 # blacklist entries for selser tests.
17875 !! test
17876 Bad treebuilder fixup of formatting elt is cleaned up
17877 !! options
17878 parsoid=wt2html,wt2wt
17879 !! wikitext
17880 {|
17881 |
17882 <small>
17883 [[Image:Foobar.jpg|right|Test]]
17884 </small>
17885 |}
17886 !! html/parsoid
17887 <table>
17888 <tbody><tr><td>
17889 <p><small></small></p>
17890 <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>
17891 <p></p></td></tr>
17892 </tbody></table>
17893 !! end
17894
17895 #### ----------------------------------------------------------------
17896 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17897 #### tags. Parsoid's output for these tags differs from that of the
17898 #### PHP parser.
17899 #### ----------------------------------------------------------------
17900
17901 !!test
17902 Ref: 1. ref-location should be replaced with an index span
17903 !!options
17904 parsoid
17905 !! wikitext
17906 A <ref>foo</ref>
17907 B <ref name="x">foo</ref>
17908 C <ref name="y" />
17909 !! html
17910 <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>
17911 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>
17912 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>
17913 !!end
17914
17915 !!test
17916 Ref: 2. ref-tags with identical names should all get the same index
17917 !!options
17918 parsoid
17919 !! wikitext
17920 A <ref name="x">foo</ref>
17921 B <ref name="x" />
17922 !! html
17923 <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>
17924 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>
17925 !!end
17926
17927 !!test
17928 Ref: 3. spaces in ref-names should be ignored
17929 !!options
17930 parsoid
17931 !! wikitext
17932 A <ref name="x">foo</ref>
17933 B <ref name=" x " />
17934 C <ref name= x />
17935 !! html
17936 <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>
17937 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>
17938 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>
17939 !!end
17940
17941 !!test
17942 Ref: 4. 'constructor' should be accepted as a valid ref-name
17943 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17944 !!options
17945 parsoid
17946 !! wikitext
17947 A <ref name="constructor">foo</ref>
17948 !! html
17949 <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>
17950 !!end
17951
17952 !!test
17953 Ref: 5. body should accept generic wikitext
17954 !!options
17955 parsoid
17956 !! wikitext
17957 A <ref>
17958 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17959 </ref>
17960
17961 <references />
17962 !! html
17963 <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>
17964
17965 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17966 <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>
17967 </li>
17968 </ol>
17969 !!end
17970
17971 !!test
17972 Ref: 6. indent-pres should not be output in ref-body
17973 !!options
17974 parsoid
17975 !! wikitext
17976 A <ref>
17977 foo
17978 bar
17979 baz
17980 </ref>
17981
17982 <references />
17983 !! html
17984 <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>
17985
17986 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17987 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17988 bar
17989 baz
17990 </li>
17991 </ol>
17992 !!end
17993
17994 !!test
17995 Ref: 7. No p-wrapping in ref-body
17996 !!options
17997 parsoid
17998 !! wikitext
17999 A <ref>
18000 foo
18001
18002 bar
18003
18004
18005 baz
18006
18007
18008
18009 booz
18010 </ref>
18011
18012 <references />
18013 !! html
18014 <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>
18015
18016 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18017 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18018
18019 bar
18020
18021
18022 baz
18023
18024
18025
18026 booz
18027 </li>
18028 </ol>
18029 !!end
18030
18031 !!test
18032 Ref: 8. transclusion wikitext has lower precedence
18033 !!options
18034 parsoid
18035 !! wikitext
18036 A <ref> foo {{echo|</ref> B C}}
18037
18038 <references />
18039 !! html
18040 <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>
18041 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18042 <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>
18043 </ol>
18044 !!end
18045
18046 !!test
18047 Ref: 9. unclosed comments should not leak out of ref-body
18048 !!options
18049 parsoid
18050 !! wikitext
18051 A <ref> foo <!--</ref> B C
18052 <references />
18053 !! html
18054 <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>
18055 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18056 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18057 </ol>
18058 !!end
18059
18060 !!test
18061 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18062 !!options
18063 parsoid
18064 !! wikitext
18065 A <ref> <b> foo </ref> B C
18066
18067 <references />
18068 !! html
18069 <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>
18070
18071
18072 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18073 <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>
18074 </ol>
18075 !!end
18076
18077 !!test
18078 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18079 !!options
18080 parsoid
18081 !! wikitext
18082 A <ref>foo</ref> B
18083 C <ref>bar</ref> D
18084 !! html
18085 <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
18086 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>
18087 !!end
18088
18089 !!test
18090 Ref: 12. ref-tags act as trailing newline migration barrier
18091 !!options
18092 parsoid
18093 !! wikitext
18094 <!--the newline at the end of this line moves out of the p-tag-->a
18095
18096 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18097 <ref />
18098
18099 c
18100 !! html
18101 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18102
18103
18104 <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>
18105 <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>
18106
18107
18108 <p>c</p>
18109 !!end
18110
18111 !!test
18112 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18113 !!options
18114 parsoid
18115 !! wikitext
18116 <ref>foo</ref> A
18117 <ref>bar
18118 </ref> B
18119 !! html
18120 <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
18121 <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>
18122 !!end
18123
18124 !!test
18125 Ref: 14. A nested ref-tag should be emitted as plain text
18126 !!options
18127 parsoid
18128 !! wikitext
18129 <ref>foo <ref>bar</ref> baz</ref>
18130
18131 <references />
18132 !! html
18133 <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>
18134
18135 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18136 <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>
18137 </ol>
18138 !!end
18139
18140 !!test
18141 Ref: 15. ref-tags with identical names should get identical indexes
18142 !!options
18143 parsoid
18144 !! wikitext
18145 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18146 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18147
18148 <references />
18149 !! html
18150 <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>
18151 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>
18152
18153 <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>
18154 </ol>
18155 !!end
18156
18157 ## We don't bother wt2wt-ing non-standard whitespace
18158 !!test
18159 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18160 !!options
18161 parsoid=wt2html
18162 !! wikitext
18163 A <ref >foo</ref >
18164
18165 <references />
18166 !! html
18167 <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>
18168
18169 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18170 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18171 !!end
18172
18173 !!test
18174 References: 1. references tag without any refs should be handled properly
18175 !!options
18176 parsoid
18177 !! wikitext
18178 <references />
18179 !! html
18180 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18181 !!end
18182
18183 !!test
18184 References: 2. references tag with group only outputs references from that group
18185 !!options
18186 parsoid
18187 !! wikitext
18188 A <ref group="a">foo</ref>
18189 B <ref group="b">bar</ref>
18190
18191 <references group="a" />
18192 !! html
18193 <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>
18194 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>
18195
18196 <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>
18197 </ol>
18198 !!end
18199
18200 !!test
18201 References: 3. ref list should be cleared after processing references
18202 !!options
18203 parsoid
18204 !! wikitext
18205 A <ref>foo</ref>
18206
18207 <references />
18208
18209 B <ref>bar</ref>
18210
18211 <references />
18212 !! html
18213 <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>
18214
18215 <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>
18216 </ol>
18217
18218 <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>
18219
18220 <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>
18221 </ol>
18222 !!end
18223
18224 !!test
18225 References: 4. only referenced group should be cleared after processing references
18226 !!options
18227 parsoid
18228 !! wikitext
18229 A <ref group="a">afoo</ref>
18230 B <ref>bfoo</ref>
18231
18232 <references group="a" />
18233
18234 C <ref>cfoo</ref>
18235
18236 <references />
18237 !! html
18238 <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>
18239 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>
18240
18241 <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>
18242 </ol>
18243
18244 <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>
18245
18246 <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>
18247 </ol>
18248 !!end
18249
18250 !!test
18251 References: 5. ref tags in references should be processed while ignoring all other content
18252 !!options
18253 parsoid
18254 !! wikitext
18255 A <ref name="a" />
18256 B <ref name="b">bar</ref>
18257
18258 <references>
18259 <ref name="a">foo</ref>
18260 This should just get lost.
18261 </references>
18262 !! html
18263 <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>
18264 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>
18265
18266
18267 <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":{}}'>
18268 <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>
18269 <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>
18270 </ol>
18271 !!end
18272
18273 !!test
18274 References: 6. <references /> from a transclusion
18275 !!options
18276 parsoid
18277 !! wikitext
18278 <ref>Foo</ref> {{echo|<references />}}
18279 !! html
18280 <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>
18281 !!end
18282
18283 !! test
18284 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18285 !! options
18286 parsoid
18287 !! wikitext
18288 A <ref>foo bar for a</ref>
18289 B <ref group="X" name="b" />
18290
18291 <references />
18292
18293 <references group="X">
18294 <ref name="b">foo</ref>
18295 </references>
18296 !! html
18297 <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>
18298 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>
18299
18300 <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>
18301
18302 <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>
18303 !! end
18304
18305 !! test
18306 Entities in ref name
18307 !! options
18308 parsoid
18309 !! wikitext
18310 <ref name="test &amp; me">hi</ref>
18311 !! html
18312 <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>
18313 !! end
18314
18315 # This test is wt2html only because we're permitting the serializer to produce
18316 # dirty diffs, normalizing the unclosed references to the self-closed version.
18317 !! test
18318 Generate references for unclosed references tag
18319 !! options
18320 parsoid=wt2html
18321 !! wikitext
18322 a<ref>foo</ref>
18323
18324 <references>
18325 !! html
18326 <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>
18327
18328
18329 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18330 <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>
18331 !! end
18332
18333 !! test
18334 New reference serializes on its own line
18335 !! options
18336 parsoid=wt2wt,html2wt
18337 !! wikitext
18338 foo
18339 <references />
18340 !! html
18341 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18342 !! end
18343
18344 #### ----------------------------------------------------------------
18345 #### The following section of tests are primarily to test
18346 #### wikitext escaping capabilities of Parsoid. Given that
18347 #### escaping can be done any number of ways, the wikitext (input)
18348 #### is always adjusted to reflect how Parsoid adds nowiki
18349 #### escape tags.
18350 ####
18351 #### We are marking several tests as parsoid-only since the
18352 #### HTML in the result section is different from what the
18353 #### PHP parser generates for it.
18354 #### ----------------------------------------------------------------
18355
18356
18357 #### --------------- Headings ---------------
18358 #### 0. Unnested
18359 #### 1. Nested inside html <h1>=foo=</h1>
18360 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18361 #### 3. Nested inside html with wikitext split by html tags
18362 #### 4. No escape needed
18363 #### 5. Empty headings <h1></h1>
18364 #### 6. Heading chars in SOL context
18365 #### ----------------------------------------
18366 !! test
18367 Headings: 0. Unnested
18368 !! options
18369 parsoid
18370 !! wikitext
18371 <nowiki>=foo=</nowiki>
18372
18373 <nowiki> =foo= </nowiki>
18374 <!--cmt-->
18375 <nowiki>=foo=</nowiki>
18376
18377 =foo''a''<nowiki>=</nowiki>
18378 !! html
18379 <p><span typeof="mw:Nowiki">=foo=</span></p>
18380
18381 <p><span typeof="mw:Nowiki"> =foo= </span>
18382 <!--cmt-->
18383 <span typeof="mw:Nowiki">=foo=</span></p>
18384
18385 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18386 !!end
18387
18388 !! test
18389 Headings: 1. Nested inside html
18390 (New headings and existing headings are handled differently)
18391 !! options
18392 parsoid=html2wt
18393 !! wikitext
18394 = =foo= =
18395
18396 == =foo= ==
18397
18398 === =foo= ===
18399
18400 =<nowiki>=foo=</nowiki>=
18401 ==<nowiki>=foo=</nowiki>==
18402 ===<nowiki>=foo=</nowiki>===
18403 ====<nowiki>=foo=</nowiki>====
18404 =====<nowiki>=foo=</nowiki>=====
18405 ======<nowiki>=foo=</nowiki>======
18406
18407 !! html
18408 <h1>=foo=</h1>
18409 <h2>=foo=</h2>
18410 <h3>=foo=</h3>
18411
18412 <h1 data-parsoid='{}'>=foo=</h1>
18413 <h2 data-parsoid='{}'>=foo=</h2>
18414 <h3 data-parsoid='{}'>=foo=</h3>
18415 <h4 data-parsoid='{}'>=foo=</h4>
18416 <h5 data-parsoid='{}'>=foo=</h5>
18417 <h6 data-parsoid='{}'>=foo=</h6>
18418 !!end
18419
18420 !! test
18421 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18422 !! options
18423 parsoid=html2wt
18424 !! wikitext
18425 = foo =
18426 <nowiki>*</nowiki>bar
18427
18428 = foo =
18429 =bar
18430
18431 = foo =
18432 <nowiki>=bar=</nowiki>
18433 !! html
18434 <h1>foo</h1>*bar
18435 <h1>foo</h1>=bar
18436 <h1>foo</h1>=bar=
18437 !!end
18438
18439 !! test
18440 Headings: 3. Nested inside html with wikitext split by html tags
18441 !! options
18442 parsoid=html2wt
18443 !! wikitext
18444 = ='''bold'''<nowiki>foo=</nowiki> =
18445 !! html
18446 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18447 !!end
18448
18449 !! test
18450 Headings: 4a. No escaping needed (testing just h1 and h2)
18451 !! options
18452 parsoid=html2wt
18453 !! wikitext
18454 = =foo =
18455
18456 = foo= =
18457
18458 = =foo= =
18459
18460 = =foo= bar =
18461
18462 == =foo ==
18463
18464 == foo= ==
18465
18466 = ''=''foo= =
18467
18468 = <nowiki>=</nowiki> =
18469 !! html
18470 <h1>=foo</h1>
18471 <h1>foo=</h1>
18472 <h1> =foo= </h1>
18473 <h1>=foo= bar</h1>
18474 <h2>=foo</h2>
18475 <h2>foo=</h2>
18476 <h1><i>=</i>foo=</h1>
18477 <h1><span typeof="mw:Nowiki">=</span></h1>
18478 !!end
18479
18480 !! test
18481 Headings: 4b. No escaping needed (inside p-tags)
18482 !! options
18483 parsoid=html2wt
18484 !! wikitext
18485 ===
18486 =foo= x
18487 =foo= <s></s>
18488 !! html
18489 <p>===
18490 =foo= x
18491 =foo= <s></s>
18492 </p>
18493 !!end
18494
18495 !! test
18496 Headings: 5. Empty headings
18497 !! options
18498 parsoid
18499 !! wikitext
18500 =<nowiki/>=
18501
18502 ==<nowiki/>==
18503
18504 ===<nowiki/>===
18505
18506 ====<nowiki/>====
18507
18508 =====<nowiki/>=====
18509
18510 ======<nowiki/>======
18511 !! html
18512 <h1></h1>
18513 <h2></h2>
18514 <h3></h3>
18515 <h4></h4>
18516 <h5></h5>
18517 <h6></h6>
18518 !!end
18519
18520 !! test
18521 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18522 !! options
18523 parsoid
18524 !! wikitext
18525 <nowiki>=a=</nowiki>
18526
18527 <nowiki>=a=</nowiki>
18528
18529 <nowiki>=a=</nowiki>
18530
18531 <nowiki>=a=</nowiki>
18532 !! html
18533 <p>=a=</p>
18534 <p>=a= </p>
18535 <p>=a= </p>
18536 <p>=a= </p>
18537 !!end
18538
18539 !! test
18540 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18541 !! options
18542 parsoid
18543 !! wikitext
18544 <nowiki>=a=
18545 b</nowiki>
18546
18547 <nowiki>=a=
18548 b</nowiki>
18549
18550 <nowiki>=a=
18551 b</nowiki>
18552
18553 <nowiki>=a=
18554 b</nowiki>
18555 !! html
18556 <p>=a=
18557 b</p>
18558 <p>=a=
18559 b</p>
18560 <p>=a=
18561 b</p>
18562 <p>=a=
18563 b</p>
18564 </p>
18565 !!end
18566
18567 !! test
18568 Headings: 6c. Heading chars in SOL context (leading newline break)
18569 !! options
18570 parsoid
18571 !! wikitext
18572 a
18573 <nowiki>=b=</nowiki>
18574 !! html
18575 <p>a
18576 =b=</p>
18577 !!end
18578
18579 !! test
18580 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18581 !! options
18582 parsoid
18583 !! wikitext
18584 <!--c0--><nowiki>=a=</nowiki>
18585
18586 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18587 !! html
18588 <p><!--c0-->=a=</p>
18589 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18590 !!end
18591
18592 !! test
18593 Headings: 6d. Heading chars in SOL context (No escaping needed)
18594 !! options
18595 parsoid=html2wt
18596 !! wikitext
18597 =a=<div>b</div>
18598 !! html
18599 =a=<div>b</div>
18600 !!end
18601
18602 #### --------------- Lists ---------------
18603 #### 0. Outside nests (*foo, etc.)
18604 #### 1. Nested inside html <ul><li>*foo</li></ul>
18605 #### 2. Inside definition lists
18606 #### 3. Only bullets at start should be escaped
18607 #### 4. No escapes needed
18608 #### 5. No unnecessary escapes
18609 #### 6. Escape bullets in SOL position
18610 #### 7. Escape bullets in a multi-line context
18611 #### ----------------------------------------
18612
18613 !! test
18614 Lists: 0. Outside nests
18615 !! wikitext
18616 <nowiki>*</nowiki>foo
18617
18618 <nowiki>#</nowiki>foo
18619
18620 <nowiki>;Foo:</nowiki>bar
18621 !! html
18622 <p>*foo
18623 </p><p>#foo
18624 </p><p>;Foo:bar
18625 </p>
18626 !!end
18627
18628 !! test
18629 Lists: 1. Nested inside html
18630 !! wikitext
18631 *<nowiki>*foo</nowiki>
18632
18633 *<nowiki>#foo</nowiki>
18634
18635 *<nowiki>:foo</nowiki>
18636
18637 *<nowiki>;foo</nowiki>
18638
18639 #<nowiki>*foo</nowiki>
18640
18641 #<nowiki>#foo</nowiki>
18642
18643 #<nowiki>:foo</nowiki>
18644
18645 #<nowiki>;foo</nowiki>
18646 !! html
18647 <ul><li>*foo</li></ul>
18648 <ul><li>#foo</li></ul>
18649 <ul><li>:foo</li></ul>
18650 <ul><li>;foo</li></ul>
18651 <ol><li>*foo</li></ol>
18652 <ol><li>#foo</li></ol>
18653 <ol><li>:foo</li></ol>
18654 <ol><li>;foo</li></ol>
18655
18656 !!end
18657
18658 !! test
18659 Lists: 2. Inside definition lists
18660 !! wikitext
18661 ;<nowiki>;foo</nowiki>
18662
18663 ;<nowiki>:foo</nowiki>
18664
18665 ;<nowiki>:foo</nowiki>
18666 :bar
18667
18668 :<nowiki>:foo</nowiki>
18669 !! html
18670 <dl><dt>;foo</dt></dl>
18671 <dl><dt>:foo</dt></dl>
18672 <dl><dt>:foo</dt>
18673 <dd>bar</dd></dl>
18674 <dl><dd>:foo</dd></dl>
18675
18676 !!end
18677
18678 !! test
18679 Lists: 3. Only bullets at start of text should be escaped
18680 !! wikitext
18681 *<nowiki>*foo*bar</nowiki>
18682
18683 *<nowiki>*foo</nowiki>''it''*bar
18684 !! html
18685 <ul><li>*foo*bar</li></ul>
18686 <ul><li>*foo<i>it</i>*bar</li></ul>
18687
18688 !!end
18689
18690 !! test
18691 Lists: 4. No escapes needed
18692 !! options
18693 parsoid
18694 !! wikitext
18695 *foo*bar
18696
18697 *''foo''*bar
18698
18699 *[[Foo]]: bar
18700
18701 *[[Foo]]*bar
18702 !! html
18703 <ul>
18704 <li>foo*bar
18705 </li>
18706 </ul>
18707 <ul>
18708 <li><i>foo</i>*bar
18709 </li>
18710 </ul>
18711 <ul>
18712 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18713 </li>
18714 </ul>
18715 <ul>
18716 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18717 </li>
18718 </ul>
18719 !!end
18720
18721 !! test
18722 Lists: 5. No unnecessary escapes
18723 !! wikitext
18724 * bar <span><nowiki>[[foo]]</nowiki></span>
18725
18726 *=bar <span><nowiki>[[foo]]</nowiki></span>
18727
18728 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18729
18730 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18731
18732 *=bar <span>foo]]</span>=
18733
18734 * <s></s>: a
18735 !! html
18736 <ul><li> bar <span>[[foo]]</span></li></ul>
18737 <ul><li>=bar <span>[[foo]]</span></li></ul>
18738 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18739 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18740 <ul><li>=bar <span>foo]]</span>=</li></ul>
18741 <ul><li> <s></s>: a</li></ul>
18742
18743 !!end
18744
18745 !! test
18746 Lists: 6. Escape bullets in SOL position
18747 !! options
18748 parsoid
18749 !! wikitext
18750 <!--cmt--><nowiki>*foo</nowiki>
18751 !! html
18752 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18753 !!end
18754
18755 !! test
18756 Lists: 7. Escape bullets in a multi-line context
18757 !! wikitext
18758 a
18759 <nowiki>*</nowiki>b
18760 !! html
18761 <p>a
18762 *b
18763 </p>
18764 !!end
18765
18766 #### --------------- HRs ---------------
18767 #### 1. Single line
18768 #### -----------------------------------
18769
18770 !! test
18771 HRs: 1. Single line
18772 !! options
18773 parsoid
18774 !! wikitext
18775 ----<nowiki>----</nowiki>
18776 ----=foo=
18777 ----*foo
18778 !! html
18779 <hr><span typeof="mw:Nowiki">----</span>
18780 <hr>=foo=
18781 <hr>*foo
18782 !! end
18783
18784 #### --------------- Tables ---------------
18785 #### 1a. Simple example
18786 #### 1b. No escaping needed (!foo)
18787 #### 1c. No escaping needed (|foo)
18788 #### 1d. No escaping needed (|}foo)
18789 ####
18790 #### 2a. Nested in td (<td>foo|bar</td>)
18791 #### 2b. Nested in td (<td>foo||bar</td>)
18792 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18793 ####
18794 #### 3a. Nested in th (<th>foo!bar</th>)
18795 #### 3b. Nested in th (<th>foo!!bar</th>)
18796 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18797 ####
18798 #### 4a. Escape -
18799 #### 4b. Escape +
18800 #### 4c. No escaping needed
18801 #### --------------------------------------
18802
18803 !! test
18804 Tables: 1a. Simple example
18805 !! wikitext
18806 <nowiki>{|
18807 |}</nowiki>
18808 !! html
18809 <p>{|
18810 |}
18811 </p>
18812 !! end
18813
18814 !! test
18815 Tables: 1b. No escaping needed
18816 !! wikitext
18817 !foo
18818 !! html
18819 <p>!foo
18820 </p>
18821 !! end
18822
18823 !! test
18824 Tables: 1c. No escaping needed
18825 !! wikitext
18826 |foo
18827 !! html
18828 <p>|foo
18829 </p>
18830 !! end
18831
18832 !! test
18833 Tables: 1d. No escaping needed
18834 !! wikitext
18835 |}foo
18836 !! html
18837 <p>|}foo
18838 </p>
18839 !! end
18840
18841 !! test
18842 Tables: 2a. Nested in td
18843 !! options
18844 parsoid=html2wt
18845 !! wikitext
18846 {|
18847 |<nowiki>foo|bar</nowiki>
18848 |-
18849 |x<div><nowiki>a|b</nowiki></div>
18850 |}
18851 !! html
18852 <table><tbody><tr>
18853 <td>foo|bar</td></tr>
18854 <tr><td>x<div>a|b</div></td>
18855 </tbody></table>
18856 !! end
18857
18858 !! test
18859 Tables: 2b. Nested in td
18860 !! options
18861 parsoid
18862 !! wikitext
18863 {|
18864 |<nowiki>foo||bar</nowiki>
18865 |''it''<nowiki>foo||bar</nowiki>
18866 |}
18867 !! html
18868 <table><tbody><tr>
18869 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18870 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18871 !! end
18872
18873 !! test
18874 Tables: 2c. Nested in td -- no escaping needed
18875 !! options
18876 parsoid
18877 !! wikitext
18878 {|
18879 |foo!!bar
18880 |}
18881 !! html
18882 <table><tbody><tr><td>foo!!bar
18883 </td></tr></tbody></table>
18884
18885 !! end
18886
18887 !! test
18888 Tables: 3a. Nested in th
18889 !! options
18890 parsoid
18891 !! wikitext
18892 {|
18893 !foo!bar
18894 |}
18895 !! html
18896 <table><tbody><tr><th>foo!bar
18897 </th></tr></tbody></table>
18898
18899 !! end
18900
18901 !! test
18902 Tables: 3b. Nested in th
18903 !! options
18904 parsoid
18905 !! wikitext
18906 {|
18907 !<nowiki>foo!!bar</nowiki>
18908 |}
18909 !! html
18910 <table>
18911 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18912 </tbody></table>
18913 !! end
18914
18915 !! test
18916 Tables: 3c. Nested in th -- no escaping needed
18917 !! options
18918 parsoid
18919 !! wikitext
18920 {|
18921 !<nowiki>foo||bar</nowiki>
18922 |}
18923 !! html
18924 <table><tbody><tr>
18925 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18926 !! end
18927
18928 !! test
18929 Tables: 4a. Escape -
18930 !! options
18931 parsoid
18932 !! wikitext
18933 {|
18934 !-bar
18935 |-
18936 |<nowiki>-bar</nowiki>
18937 |}
18938 !! html
18939 <table><tbody>
18940 <tr><th>-bar</th></tr>
18941 <tr>
18942 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18943 !! end
18944
18945 !! test
18946 Tables: 4b. Escape +
18947 !! options
18948 parsoid
18949 !! wikitext
18950 {|
18951 !+bar
18952 |-
18953 |<nowiki>+bar</nowiki>
18954 |}
18955 !! html
18956 <table><tbody>
18957 <tr><th>+bar</th></tr>
18958 <tr>
18959 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18960 !! end
18961
18962 !! test
18963 Tables: 4c. No escaping needed
18964 !! options
18965 parsoid
18966 !! wikitext
18967 {|
18968 |foo-bar
18969 |foo+bar
18970 |-
18971 |''foo''-bar
18972 |''foo''+bar
18973 |-
18974 |foo
18975 bar|baz
18976 +bar
18977 -bar
18978 |-
18979 |x
18980 <div>a|b</div>
18981 |}
18982 !! html
18983 <table><tbody>
18984 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18985 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18986 <tr><td>foo
18987 <p>bar|baz
18988 +bar
18989 -bar</p></td></tr>
18990 <tr><td>x
18991 <div>a|b</div></td>
18992 </tbody></table>
18993 !! end
18994
18995 !! test
18996 Tables: 4d. No escaping needed
18997 !! options
18998 parsoid
18999 !! wikitext
19000 {|
19001 |[[Foo]]-bar
19002 ||+1
19003 ||-2
19004 |}
19005 !! html
19006 <table>
19007 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19008 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19009 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19010 </tbody></table>
19011 !! end
19012
19013 !! test
19014 Tables: Digest broken attributes on table and tr tag
19015 !! options
19016 parsoid=wt2html
19017 !! wikitext
19018 {| || |} ++
19019 |- || || ++ --
19020 |- > [
19021 |}
19022 !! html
19023 <table>
19024 <tbody>
19025 <tr></tr>
19026 <tr></tr>
19027 </tbody></table>
19028 !! end
19029
19030 #### --------------- Links ----------------
19031 #### 1. Quote marks in link text
19032 #### 2. Wikilinks: Escapes needed
19033 #### 3. Wikilinks: No escapes needed
19034 #### 4. Extlinks: Escapes needed
19035 #### 5. Extlinks: No escapes needed
19036 #### --------------------------------------
19037 !! test
19038 Links 1. Quote marks in link text
19039 !! options
19040 parsoid
19041 !! wikitext
19042 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19043 !! html
19044 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19045 !! end
19046
19047 !! test
19048 Links 2. WikiLinks: Escapes needed
19049 !! options
19050 parsoid
19051 !! wikitext
19052 [[Foo|[Foobar]]]
19053 [[Foo|<nowiki>Foobar]</nowiki>]]
19054 [[Foo|x [Foobar] x]]
19055 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19056 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19057 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19058 [[Foo|<nowiki>|Bar</nowiki>]]
19059 [[Foo|<nowiki>]]bar</nowiki>]]
19060 [[Foo|<nowiki>[[bar</nowiki>]]
19061 [[Foo|<nowiki>x [[ y</nowiki>]]
19062 [[Foo|<nowiki>x ]] y</nowiki>]]
19063 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19064 !! html
19065 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19066 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19067 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19068 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19069 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19070 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19071 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19072 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19073 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19074 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19075 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19076 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19077 !! end
19078
19079 !! test
19080 Links 3. WikiLinks: No escapes needed
19081 !! options
19082 parsoid
19083 !! wikitext
19084 [[Foo|[Foobar]]
19085 [[Foo|foo|bar]]
19086 !! html
19087 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19088 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19089 !! end
19090
19091 !! test
19092 Links 4. ExtLinks: Escapes needed
19093 !! options
19094 parsoid
19095 !! wikitext
19096 [http://google.com <nowiki>[google]</nowiki>]
19097 [http://google.com <nowiki>google]</nowiki>]
19098
19099 <nowiki>[http://google.com]</nowiki>
19100
19101 <nowiki>[http://google.com google]</nowiki>
19102
19103 !! html
19104 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19105 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19106 <p>[http://google.com]</p>
19107 <p>[http://google.com google]</p>
19108 !! end
19109
19110 !! test
19111 Links 5. ExtLinks: No escapes needed
19112 !! options
19113 parsoid
19114 !! wikitext
19115 [http://google.com [google]
19116 !! html
19117 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19118 !! end
19119
19120 !! test
19121 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19122 !! html/parsoid
19123 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19124 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19125 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19126 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19127 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19128 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19129 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19130 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19131 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19132 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19133 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19134 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19135 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19136 </p>
19137 !! wikitext
19138 x<nowiki/>http://example.com<nowiki/>y
19139 http://example.com<nowiki/>?x
19140 http://example.com<nowiki/>&x
19141 http://example.com<nowiki/>'x
19142 http://example.com<nowiki/>,x
19143 http://example.com<nowiki/>.x
19144 http://example.com<nowiki/>;x
19145 http://example.com<nowiki/>:x
19146 http://example.com<nowiki/>;x
19147 http://example.com<nowiki/>!x
19148 http://example.com<nowiki/>=x
19149 http://example.com<nowiki/>(x)
19150 http://example.com(x<nowiki/>)
19151 !! end
19152
19153 !! test
19154 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19155 !! html/parsoid
19156 <p>x
19157 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19158 y
19159 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19160 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19161 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19162 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19163 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19164 </p>
19165 !! wikitext
19166 x
19167 http://example.com
19168 y
19169 "http://example.com"
19170 (http://example.com)
19171 (http://example.com) foo
19172 http://example.com,
19173 http://example.com, foo
19174 !! end
19175
19176 ## Parsoid currently fails wt2html on this one!
19177 !! test
19178 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19179 !! html/parsoid
19180 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19181 !! wikitext
19182 http://example.com.,;:!?
19183 !! end
19184
19185 !! test
19186 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19187 !! html/parsoid
19188 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19189 !! wikitext
19190 RFC 123<nowiki/>4
19191 !! end
19192
19193 !! test
19194 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19195 !! html/parsoid
19196 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19197 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19198 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19199 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19200 </p>
19201 !! wikitext
19202 xRFC 123y
19203 XRFC 123y
19204 RFC 123?foo
19205 RFC 123&foo
19206 !! end
19207
19208 !! test
19209 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19210 !! html/parsoid
19211 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19212 !! wikitext
19213 PMID 123<nowiki/>4
19214 !! end
19215
19216 !! test
19217 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19218 !! html/parsoid
19219 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19220 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19221 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19222 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19223 </p>
19224 !! wikitext
19225 xPMID 123y
19226 XPMID 123y
19227 PMID 123?foo
19228 PMID 123&foo
19229 !! end
19230
19231 !! test
19232 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19233 !! html/parsoid
19234 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19235 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19236 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19237 </p>
19238 !! wikitext
19239 ISBN 1234567890<nowiki/>1
19240 ISBN 1234567890<nowiki/>x
19241 ISBN 1234567890<nowiki/>b
19242 !! end
19243
19244 !! test
19245 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19246 !! html/parsoid
19247 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19248 !! wikitext
19249 ISBN 1234567890's
19250 !! end
19251
19252 #### --------------- Quotes ---------------
19253 #### 1. Quotes inside <b> and <i>
19254 #### 2. Link fragments separated by <i> and <b> tags
19255 #### 3. Link fragments inside <i> and <b>
19256 #### 4. No escaping needed
19257 #### --------------------------------------
19258 !! test
19259 1. Quotes inside <b> and <i>
19260 !! options
19261 parsoid=html2wt,wt2wt
19262 !! wikitext
19263 ''<nowiki>'foo'</nowiki>''
19264 ''<nowiki>''foo''</nowiki>''
19265 ''<nowiki>'''foo'''</nowiki>''
19266 ''foo''<nowiki/>'s
19267 '''<nowiki>'foo'</nowiki>'''
19268 '''<nowiki>''foo''</nowiki>'''
19269 '''<nowiki>'''foo'''</nowiki>'''
19270 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19271 '''foo'''<nowiki/>'s
19272 '''foo''
19273 ''foo''<nowiki/>'
19274 '<nowiki/>''foo''<nowiki/>'
19275 ''''foo'''
19276 '''foo'''<nowiki/>'
19277 '<nowiki/>'''foo'''<nowiki/>'
19278 ''fools'<span> errand</span>''
19279 ''<span>fool</span>'s errand''
19280 !! html
19281 <p><i>'foo'</i>
19282 <i>''foo''</i>
19283 <i>'''foo'''</i>
19284 <i>foo</i>'s
19285 <b>'foo'</b>
19286 <b>''foo''</b>
19287 <b>'''foo'''</b>
19288 <b>foo'<i>bar'</i>baz</b>
19289 <b>foo</b>'s
19290 '<i>foo</i>
19291 <i>foo</i>'
19292 '<i>foo</i>'
19293 '<b>foo</b>
19294 <b>foo</b>'
19295 '<b>foo</b>'</p>
19296 <i>fools'<span> errand</span></i>
19297 <i><span>fool</span>'s errand</i>
19298 !! end
19299
19300 !! test
19301 2. Link fragments separated by <i> and <b> tags
19302 !! wikitext
19303 [[''foo''<nowiki>hello]]</nowiki>
19304
19305 [['''foo'''<nowiki>hello]]</nowiki>
19306 !! html
19307 <p>[[<i>foo</i>hello]]
19308 </p><p>[[<b>foo</b>hello]]
19309 </p>
19310 !! end
19311
19312 !! test
19313 3. Link fragments inside <i> and <b>
19314 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19315 this is one of the shortcomings of this format)
19316 !! wikitext
19317 ''[[foo''<nowiki>]]</nowiki>
19318
19319 '''[[foo'''<nowiki>]]</nowiki>
19320 !! html
19321 <p><i>[[foo</i>]]
19322 </p><p><b>[[foo</b>]]
19323 </p>
19324 !! end
19325
19326 !! test
19327 4. No escaping needed
19328 !! wikitext
19329 '<span>''bar''</span>'
19330 '<span>'''bar'''</span>'
19331 !! html
19332 <p>'<span><i>bar</i></span>'
19333 '<span><b>bar</b></span>'
19334 </p>
19335 !! end
19336
19337 #### ----------- Paragraphs ---------------
19338 #### 1. No unnecessary escapes
19339 #### --------------------------------------
19340
19341 !! test
19342 1. No unnecessary escapes
19343 !! wikitext
19344 bar <span><nowiki>[[foo]]</nowiki></span>
19345
19346 =bar <span><nowiki>[[foo]]</nowiki></span>
19347
19348 [[bar <span><nowiki>[[foo]]</nowiki></span>
19349
19350 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19351
19352 =bar <span>foo]]</span><nowiki>=</nowiki>
19353 !! html
19354 <p>bar <span>[[foo]]</span>
19355 </p><p>=bar <span>[[foo]]</span>
19356 </p><p>[[bar <span>[[foo]]</span>
19357 </p><p>]]bar <span>[[foo]]</span>
19358 </p><p>=bar <span>foo]]</span>=
19359 </p>
19360 !!end
19361
19362 #### ----------------------- PRE --------------------------
19363 #### 1. Leading whitespace in SOL context should be escaped
19364 #### ------------------------------------------------------
19365 !! test
19366 1. Leading whitespace in SOL context should be escaped
19367 !! options
19368 parsoid
19369 !! wikitext
19370 <nowiki> </nowiki>a
19371
19372 <nowiki> </nowiki> a
19373
19374 <nowiki> </nowiki>a(tab)
19375
19376 <nowiki> </nowiki> a
19377 <!--cmt-->
19378 <nowiki> </nowiki> a
19379
19380 a
19381 <nowiki> </nowiki>b
19382
19383 a
19384 <nowiki> </nowiki>b
19385
19386 a
19387 <nowiki> </nowiki> b
19388 !! html
19389 <p> a</p>
19390 <p> a</p>
19391 <p> a(tab)</p>
19392 <p> a</p>
19393 <p><!--cmt--> a</p>
19394 <p>a
19395 b</p>
19396 <p>a
19397 b</p>
19398 <p>a
19399 b</p>
19400 !! end
19401
19402 #### --------------- Behavior Switches --------------------
19403 !! test
19404 1. Valid behavior switches should be escaped
19405 !! options
19406 parsoid=html2wt
19407 !! wikitext
19408 <nowiki>__TOC__</nowiki>
19409 !! html
19410 __TOC__
19411 !! end
19412
19413 !! test
19414 2. Invalid behavior switches should not be escaped
19415 !! options
19416 parsoid=html2wt
19417 !! wikitext
19418 __TOO__
19419 __|__
19420 !! html
19421 __TOO__
19422 __|__
19423 !! end
19424
19425 #### --------------- HTML tags ---------------
19426 #### 1. a tags
19427 #### 2. other tags
19428 #### 3. multi-line html tag
19429 #### 4. extension tags
19430 #### -----------------------------------------
19431 !! test
19432 1. a tags
19433 !! options
19434 parsoid
19435 !! wikitext
19436 <a href="http://google.com">google</a>
19437 !! html
19438 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19439 !! end
19440
19441 !! test
19442 2. other tags
19443 !! wikitext
19444 <nowiki><div>foo</div>
19445 <div style="color:red">foo</div></nowiki>
19446 !! html
19447 <p>&lt;div&gt;foo&lt;/div&gt;
19448 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19449 </p>
19450 !! end
19451
19452 !! test
19453 3. multi-line html tag
19454 !! wikitext
19455 <nowiki><div
19456 >foo</div
19457 ></nowiki>
19458 !! html
19459 <p>&lt;div
19460 &gt;foo&lt;/div
19461 &gt;
19462 </p>
19463 !! end
19464
19465 !! test
19466 4. extension tags
19467 !! wikitext
19468 <nowiki><ref>foo</ref></nowiki>
19469
19470 <nowiki><ref>bar</nowiki>
19471
19472 baz<nowiki></ref></nowiki>
19473 !! html
19474 <p>&lt;ref&gt;foo&lt;/ref&gt;
19475 </p><p>&lt;ref&gt;bar
19476 </p><p>baz&lt;/ref&gt;
19477 </p>
19478 !! end
19479
19480 #### --------------- Others ---------------
19481 !! test
19482 Escaping nowikis
19483 !! wikitext
19484 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19485 !! html
19486 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19487 </p>
19488 !! end
19489
19490 ## The quote-char in the input is necessary for triggering the bug
19491 !! test
19492 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19493 !! options
19494 parsoid=wt2wt,html2wt
19495 !! wikitext
19496 foo's bar :
19497 !! html
19498 <p>foo's bar :</p>
19499 !! end
19500
19501 !! test
19502
19503 Tag-like HTML structures are passed through as text
19504 !! wikitext
19505 <x y>
19506
19507 <x.y>
19508
19509 <x-y>
19510
19511 1>2
19512
19513 x<y
19514
19515 a>b
19516
19517 1<d e>f
19518 !! html
19519 <p>&lt;x y&gt;
19520 </p><p>&lt;x.y&gt;
19521 </p><p>&lt;x-y&gt;
19522 </p><p>1&gt;2
19523 </p><p>x&lt;y
19524 </p><p>a&gt;b
19525 </p><p>1&lt;d e&gt;f
19526 </p>
19527 !! end
19528
19529
19530 # This was a bug in the PHP parser (see bug 17663 and its dups,
19531 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19532 !! test
19533 Tag names followed by punctuation should not be recognized as tags
19534 !! wikitext
19535 <s.ome> text
19536 !! html
19537 <p>&lt;s.ome&gt; text
19538 </p>
19539 !! end
19540
19541 !! test
19542 HTML tag with necessary entities in attributes
19543 !! wikitext
19544 <span title="&amp;amp;">foo</span>
19545 !! html
19546 <p><span title="&amp;amp;">foo</span>
19547 </p>
19548 !! end
19549
19550 !! test
19551 HTML tag with 'unnecessary' entity encoding in attributes
19552 !! wikitext
19553 <span title="&amp;">foo</span>
19554 !! html
19555 <p><span title="&amp;">foo</span>
19556 </p>
19557 !! end
19558
19559 !! test
19560 HTML tag with broken attribute value quoting
19561 !! wikitext
19562 <span title="Hello world>Foo</span>
19563 !! html
19564 <p><span>Foo</span>
19565 </p>
19566 !! end
19567
19568 !! test
19569 Parsoid-only: HTML tag with broken attribute value quoting
19570 !! options
19571 parsoid
19572 !! wikitext
19573 <span title="Hello world>Foo</span>
19574 !! html
19575 <p><span title="Hello world">Foo</span>
19576 </p>
19577 !! end
19578
19579 !! test
19580 Table with broken attribute value quoting
19581 !! wikitext
19582 {|
19583 | title="Hello world|Foo
19584 |}
19585 !! html
19586 <table>
19587 <tr>
19588 <td>Foo
19589 </td></tr></table>
19590
19591 !! end
19592
19593 !! test
19594 Table with broken attribute value quoting on consecutive lines
19595 !! wikitext
19596 {|
19597 | title="Hello world|Foo
19598 | style="color:red|Bar
19599 |}
19600 !! html
19601 <table>
19602 <tr>
19603 <td>Foo
19604 </td>
19605 <td>Bar
19606 </td></tr></table>
19607
19608 !! end
19609
19610 !! test
19611 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19612 !! options
19613 parsoid
19614 !! wikitext
19615 {|
19616 | title="Hello world|Foo
19617 | style="color:red|Bar
19618 |}
19619 !! html
19620 <table><tbody>
19621 <tr>
19622 <td title="Hello world">Foo
19623 </td><td style="color: red">Bar
19624 </td></tr></tbody></table>
19625
19626 !! end
19627
19628 !! test
19629 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19630 !! options
19631 parsoid
19632 !! wikitext
19633 {{}}
19634 !! html
19635 {{}}
19636 !! end
19637
19638 !! test
19639 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19640 !! options
19641 parsoid
19642 !! wikitext
19643 }}{{
19644 !! html
19645 }}{{
19646 !! end
19647
19648 !!test
19649 Accept empty td cell attribute
19650 !! wikitext
19651 {|
19652 | align="center" | foo || |
19653 |}
19654 !! html
19655 <table>
19656 <tr>
19657 <td align="center"> foo </td>
19658 <td>
19659 </td></tr></table>
19660
19661 !!end
19662
19663 !!test
19664 Non-empty attributes in th-cells
19665 !! wikitext
19666 {|
19667 ! Foo !! style="color: red" | Bar
19668 |}
19669 !! html
19670 <table>
19671 <tr>
19672 <th> Foo </th>
19673 <th style="color: red"> Bar
19674 </th></tr></table>
19675
19676 !!end
19677
19678 !!test
19679 Accept empty attributes in th-cells
19680 !! wikitext
19681 {|
19682 !| foo !!| bar
19683 |}
19684 !! html
19685 <table>
19686 <tr>
19687 <th> foo </th>
19688 <th> bar
19689 </th></tr></table>
19690
19691 !!end
19692
19693 !!test
19694 Empty table rows go away
19695 !! wikitext
19696 {|
19697 | Hello
19698 | there
19699 |- class="foo"
19700 |-
19701 |}
19702 !! html
19703 <table>
19704 <tr>
19705 <td> Hello
19706 </td>
19707 <td> there
19708 </td></tr>
19709
19710 </table>
19711
19712 !! end
19713
19714 ###
19715 ### Parsoid-centric tests for testing RTing of inter-element separators
19716 ### Edge cases not tested by existing parser tests and specific to
19717 ### Parsoid-specific serialization strategies.
19718 ###
19719
19720 !!test
19721 RT-ed inter-element separators should be valid separators
19722 !! wikitext
19723 {|
19724 |- [[foo]]
19725 |}
19726 !! html
19727 <table>
19728
19729 </table>
19730
19731 !!end
19732
19733 !!test
19734 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19735 (Parsoid-only since PHP parser relies on Tidy for correct output)
19736 !!options
19737 parsoid
19738 !! wikitext
19739 {|
19740 |<small>foo
19741 bar
19742 |}
19743
19744 {|
19745 |<small>foo<small>
19746 |}
19747 !! html
19748 !!end
19749
19750 !!test
19751 Empty TD followed by TD with tpl-generated attribute
19752 !! wikitext
19753 {|
19754 |-
19755 |
19756 |{{echo|style='color:red'}}|foo
19757 |}
19758 !! html
19759 <table>
19760
19761 <tr>
19762 <td>
19763 </td>
19764 <td>foo
19765 </td></tr></table>
19766
19767 !!end
19768
19769 !!test
19770 Indented table with an empty td
19771 !! wikitext
19772 {|
19773 |-
19774 |
19775 |foo
19776 |}
19777 !! html
19778 <table>
19779
19780 <tr>
19781 <td>
19782 </td>
19783 <td>foo
19784 </td></tr></table>
19785
19786 !!end
19787
19788 !!test
19789 Indented block & table
19790 !! wikitext
19791 <div>foo</div>
19792 {|
19793 |foo
19794 |}
19795 !! html/parsoid
19796 <div data-parsoid='{"stx":"html"}'>foo</div>
19797 <table><tbody>
19798 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19799 </tbody></table>
19800 !!end
19801
19802 !!test
19803 Empty TR followed by a template-generated TR
19804 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19805 !!options
19806 parsoid
19807 !! wikitext
19808 {|
19809 |-
19810 {{echo|<tr><td>foo</td></tr>}}
19811 |}
19812 !! html
19813 <table>
19814 <tbody>
19815 <tr></tr>
19816 <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}}]}'>
19817 <td>foo</td></tr>
19818 </tbody></table>
19819 !!end
19820
19821 ## PHP and parsoid output differ for this, and since this is primarily
19822 ## for testing Parsoid's serializer, marking this Parsoid only
19823 !!test
19824 Empty TR followed by mixed-ws-comment line should RT correctly
19825 !!options
19826 parsoid
19827 !! wikitext
19828 {|
19829 |-
19830 <!--c-->
19831 |-
19832 <!--c--> <!--d-->
19833 |}
19834 !! html
19835 <table>
19836 <tbody>
19837 <tr></tr>
19838 <!--c-->
19839 <tr>
19840 <!--c--> </tr><!--d-->
19841 </tbody></table>
19842
19843 !!end
19844
19845 !!test
19846 Multi-line image caption generated by templates with/without trailing newlines
19847 !!options
19848 parsoid
19849 !! wikitext
19850 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19851 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19852 !! html
19853 <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>
19854 <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>
19855
19856 !!end
19857
19858 !! test
19859 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19860 !! options
19861 parsoid=html2wt
19862 !! wikitext
19863 <includeonly>foo</includeonly>
19864 new para
19865
19866 [[./Category:Foo]]
19867
19868 = new heading =
19869 !! html
19870 <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>
19871
19872 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19873 !! end
19874
19875 ## PHP emits broken html for this, and since this is primarily
19876 ## a Parsoid serializer test, marking this Parsoid only
19877 !!test
19878 Improperly nested inline or quotes tags with whitespace in between
19879 !!options
19880 parsoid
19881 !! wikitext
19882 <span> <s>x</span> </s>
19883 ''' ''x''' ''
19884 !! html
19885 <p><span> <s>x</s></span><s> </s>
19886 <b> <i>x</i></b><i> </i>
19887 </p>
19888 !!end
19889
19890 !!test
19891 Encapsulate protected attributes from wt
19892 !!options
19893 parsoid
19894 !! wikitext
19895 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19896 !! html
19897 <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>
19898 </body>
19899 !!end
19900
19901 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19902 ## Having nested or stray pre tags results in the attempt to add duplicates,
19903 ## causing an assertion fail. This test tries to prevent that situation.
19904 !!test
19905 Ensure ParagraphWrapper can deal with stray closing pre tags
19906 !!options
19907 parsoid=wt2html
19908 !! wikitext
19909 plain text</pre>
19910 !! html
19911 plain text
19912 !!end
19913
19914 !!test
19915 1. Ensure fostered text content is wrapped in spans
19916 !!options
19917 parsoid=wt2html
19918 !! wikitext
19919 <table>hi</table><table>ho</table>
19920 !! html
19921 <span>hi</span>
19922 <table></table>
19923 <span>ho</span>
19924 <table></table>
19925 !!end
19926
19927 !!test
19928 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19929 !!options
19930 parsoid=wt2html,wt2wt
19931 !! wikitext
19932 <table>
19933 <tr> || ||
19934 <td> a
19935 </table>
19936 !! html
19937 <span> || ||</span>
19938 <table>
19939 <tbody>
19940 <tr>
19941 <td> a</td></tr>
19942 </tbody></table>
19943 !!end
19944
19945 !!test
19946 Encapsulation properly handles null DSR information from foster box
19947 !!options
19948 parsoid=wt2html,wt2wt
19949 !! wikitext
19950 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19951 !! html
19952 <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;
19953 <table>foo
19954 <tr>
19955 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19956 <table>
19957 <tbody>
19958 <tr>
19959 <td>bar</td></tr></tbody></table>
19960 !!end
19961
19962 !!test
19963 1. Encapsulate foster-parented transclusion content
19964 !!options
19965 parsoid=wt2wt,wt2html
19966 !! wikitext
19967 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19968 !! html
19969 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19970 <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
19971 <tr>
19972 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19973 <table>
19974 <tbody>
19975 <tr>
19976 <td>bar</td></tr></tbody></table>
19977 !!end
19978
19979 !!test
19980 2. Encapsulate foster-parented transclusion content
19981 !!options
19982 parsoid=wt2wt,wt2html
19983 !! wikitext
19984 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19985 !! html
19986 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19987 <table>
19988 <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>
19989 <tr>
19990 <td>bar</td></tr></table>&quot;]}">foo</div>
19991 <table>
19992 <tbody>
19993 <tr>
19994 <td>bar</td></tr></tbody></table>
19995 !!end
19996
19997 !!test
19998 3. Encapsulate foster-parented transclusion content
19999 !!options
20000 parsoid=wt2wt,wt2html
20001 !! wikitext
20002 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20003 !! html
20004 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20005 <table>
20006 <div>
20007 <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>
20008 <tr>
20009 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20010 <p>foo</p></div>
20011 <table>
20012 <tbody>
20013 <tr>
20014 <td>bar</td></tr></tbody></table>
20015 !!end
20016
20017 !!test
20018 4. Encapsulate foster-parented transclusion content
20019 !!options
20020 parsoid=wt2wt,wt2html
20021 !! wikitext
20022 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20023 !! html
20024 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20025 <table>
20026 <div>
20027 <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>
20028 <tr>
20029 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20030 <p>foo</p></div>
20031 <table>
20032 <tbody>
20033 <tr>
20034 <td>bar</td></tr></tbody></table>
20035 !!end
20036
20037 !!test
20038 5. Encapsulate foster-parented transclusion content
20039 !!options
20040 parsoid=wt2wt,wt2html
20041 !! wikitext
20042 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20043 !! html
20044 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20045 <table>
20046 <tr>
20047 <td>
20048 <div>
20049 <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>
20050 <table>
20051 <tbody>
20052 <tr>
20053 <td>
20054 <div>
20055 <p>foo</p></div></td></tr></tbody></table>
20056 !!end
20057
20058 !!test
20059 6. Encapsulate foster-parented transclusion content
20060 !!options
20061 parsoid=wt2wt,wt2html
20062 !! wikitext
20063 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20064 !! html
20065 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20066 <table>
20067 <tr>
20068 <td>
20069 <div>
20070 <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>
20071 <table>
20072 <tbody>
20073 <tr>
20074 <td>
20075 <div>
20076 <p>foo</p></div></td></tr></tbody></table>
20077 <p>ok</p>
20078 !!end
20079
20080 !!test
20081 7. Encapsulate foster-parented transclusion content
20082 !!options
20083 parsoid=wt2wt,wt2html
20084 !! wikitext
20085 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20086 !! html
20087 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20088 <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;
20089 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20090 <td>bar</td></table>&quot;]}">foo</p>
20091 <table>
20092 <tbody>
20093 <tr>
20094 <td>bar</td></tr></tbody></table>
20095 !!end
20096
20097 !!test
20098 8. Encapsulate foster-parented transclusion content
20099 !!options
20100 parsoid=wt2wt,wt2html
20101 !! wikitext
20102 {{echo|a
20103 }}{|{{echo|style='color:red'}}
20104 |-
20105 |b
20106 |}
20107 !! html
20108 <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>
20109 <table>
20110 <tbody>
20111 <tr>
20112 <td>b</td></tr></tbody></table>
20113 !!end
20114
20115 !!test
20116 9. Encapsulate foster-parented transclusion content
20117 !!options
20118 parsoid=wt2wt,wt2html
20119 !! wikitext
20120 <table>{{echo|hi</table>hello}}
20121 !! html
20122 <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>
20123 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20124 !!end
20125
20126 !!test
20127 Table in fosterable position
20128 !!options
20129 parsoid=wt2html,wt2wt
20130 !! wikitext
20131 {{OpenTable}}
20132 <div>
20133 {|
20134 |}
20135 </div>
20136 |}
20137 !! html
20138 <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="{}">
20139 </span>
20140 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20141
20142 <table>
20143 </table>
20144 !!end
20145
20146 # Parsoid only for bug 64747
20147 !! test
20148 Properly encapsulate empty-content transclusions in fosterable positions
20149 !! wikitext
20150 <table>
20151 {{#if:|
20152 <td>foo</td>
20153 }}
20154 </table>
20155 !! html/parsoid
20156 <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>"}'>
20157
20158 </table>
20159 !! end
20160
20161 !!test
20162 Support <object> element with .data attribute
20163 !!options
20164 parsoid=html2wt
20165 !! wikitext
20166 <object data="test.swf"></object>
20167 !! html
20168 <object data="test.swf"></object>
20169 !!end
20170
20171 # -----------------------------------------------------------------
20172 # The following section of tests are primarily to spec requirements
20173 # around serialization of new/edited content.
20174 #
20175 # All these tests are marked Parsoid html2wt and html2html only
20176 # ----------------------------------------------------------------
20177
20178 !! test
20179 Image: Modifying size of an image (1)
20180 !! options
20181 parsoid={
20182 "modes": ["wt2wt"],
20183 "changes": [
20184 ["img[height]", "attr", "height", "22"],
20185 ["img[width]", "attr", "width", "200"]
20186 ]
20187 }
20188 !! wikitext
20189 [[Image:Foobar.jpg|230x230px]]
20190 !! wikitext/edited
20191 [[Image:Foobar.jpg|200x200px]]
20192 !!end
20193
20194 !! test
20195 Image: Modifying size of an image (2)
20196 !! options
20197 parsoid={
20198 "modes": ["wt2wt"],
20199 "changes": [
20200 ["img[height]", "attr", "height", "100"],
20201 ["img[width]", "attr", "width", "500"]
20202 ]
20203 }
20204 !! wikitext
20205 [[Image:Foobar.jpg|230x230px]]
20206 !! wikitext/edited
20207 [[Image:Foobar.jpg|500x500px]]
20208 !!end
20209
20210 # Change in size is ignored so long as class='mw-default-size'
20211 !! test
20212 Image: Modifying size of an image (3)
20213 !! options
20214 parsoid={
20215 "modes": ["wt2wt"],
20216 "changes": [
20217 ["figure[class]", "removeClass", "mw-default-size"],
20218 ["figure img", "attr", "height", "19"],
20219 ["figure img", "attr", "width", "170"]
20220 ]
20221 }
20222 !! wikitext
20223 [[Image:Foobar.jpg|thumb]]
20224 !! wikitext/edited
20225 [[Image:Foobar.jpg|thumb|170x170px]]
20226 !!end
20227
20228 !! test
20229 Image: Modifying alignment of an image (bug 48665)
20230 !! options
20231 parsoid={
20232 "modes": ["wt2wt"],
20233 "changes": [
20234 ["figure[class]", "removeClass", "mw-halign-right"],
20235 ["figure[class]", "addClass", "mw-halign-left"]
20236 ]
20237 }
20238 !! wikitext
20239 [[Image:Foobar.jpg|thumb|caption|right]]
20240 !! wikitext/edited
20241 [[Image:Foobar.jpg|thumb|caption|left]]
20242 !! end
20243
20244 !! test
20245 Image: Modifying mw-default-size of an frameless image (bug 62805)
20246 !! options
20247 parsoid={
20248 "modes": ["wt2wt"],
20249 "changes": [
20250 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20251 ]
20252 }
20253 !! wikitext
20254 [[Image:Foobar.jpg|frameless|right]]
20255 !! wikitext/edited
20256 [[Image:Foobar.jpg|frameless|right|220x220px]]
20257 !! end
20258
20259 !! test
20260 Image: Modifying valign of an image (bug 49221)
20261 !! options
20262 parsoid={
20263 "modes": ["wt2wt"],
20264 "changes": [
20265 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20266 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20267 ]
20268 }
20269 !! wikitext
20270 [[File:Foobar.jpg|20px|middle]]
20271 !! wikitext/edited
20272 [[File:Foobar.jpg|20px|text-top]]
20273 !! end
20274
20275 !! test
20276 Image: Modifying alt attribute of an image (bug 56400)
20277 !! options
20278 parsoid={
20279 "modes": ["wt2wt"],
20280 "changes": [
20281 ["img[alt]", "attr", "alt", "some alternate edited text"]
20282 ]
20283 }
20284 !! wikitext
20285 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20286 !! wikitext/edited
20287 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20288 !!end
20289
20290 !! test
20291 Image: Modifying caption of an image
20292 !! options
20293 parsoid={
20294 "modes": ["wt2wt"],
20295 "changes": [
20296 ["figcaption", "text", "new caption"]
20297 ]
20298 }
20299 !! wikitext
20300 [[Image:Foobar.jpg|thumb|original caption]]
20301 !! wikitext/edited
20302 [[Image:Foobar.jpg|thumb|new caption]]
20303 !!end
20304
20305 !! test
20306 Image: empty alt attribute (bug 48924)
20307 !! options
20308 parsoid
20309 !! wikitext
20310 [[File:Foobar.jpg|thumb|alt=|bar]]
20311 !! html
20312 <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>
20313 !! end
20314
20315 #!! test
20316 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20317 #!! options
20318 #parsoid=html2wt
20319 #language=ar
20320 #!! input
20321 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20322 #!! result
20323 #<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>
20324 #!! end
20325
20326 !! test
20327 Image: Block level image should have \n before and after
20328 !! options
20329 parsoid
20330 !! wikitext
20331 123
20332 [[File:Foobar.jpg|right|thumb|150x150px]]
20333 456
20334 !! html
20335 <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>
20336 !!end
20337
20338 !! test
20339 Image: New block level image should have \n before and after (existing
20340 content)
20341 !! options
20342 parsoid
20343 !! wikitext
20344 123
20345 [[File:Foobar.jpg|right|thumb|150x150px]]
20346 456
20347 !! html
20348 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20349 <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>
20350 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20351 !!end
20352
20353 !! test
20354 Image: upright option (parsoid)
20355 !! options
20356 parsoid
20357 !! wikitext
20358 [[File:Foobar.jpg|thumb|upright|caption]]
20359 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20360 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20361 !! html
20362 <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>
20363 !!end
20364
20365 !! test
20366 Image: upright option is ignored on inline and frame images (parsoid)
20367 !! options
20368 parsoid
20369 !! wikitext
20370 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20371 !! html
20372 <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>
20373 !!end
20374
20375 !! test
20376 Image: from basic HTML (1)
20377 !! options
20378 parsoid=html2wt
20379 !! html/parsoid
20380 <span typeof="mw:Image">
20381 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20382 </span>
20383 !! wikitext
20384 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20385 !! end
20386
20387 !! test
20388 Image: from basic HTML (2)
20389 !! options
20390 parsoid=html2wt
20391 !! html/parsoid
20392 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20393 !! wikitext
20394 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20395 !! end
20396
20397 !! test
20398 Image: from basic HTML (3)
20399 !! options
20400 parsoid=html2wt
20401 !! html/parsoid
20402 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20403 !! wikitext
20404 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20405 !! end
20406
20407 !! test
20408 Image: from basic HTML (4)
20409 !! options
20410 parsoid=html2wt
20411 !! html/parsoid
20412 <img src="File:Foobar.jpg">
20413 !! wikitext
20414 [[File:Foobar.jpg|link=]]
20415 !! end
20416
20417 !! test
20418 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20419 !! options
20420 parsoid=html2wt
20421 !! wikitext
20422 * foo
20423 !! html
20424 <ul>
20425 <li><p>foo</p></li>
20426 </ul>
20427 !! end
20428
20429 !! test
20430 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20431 !! options
20432 parsoid=html2wt
20433 !! wikitext
20434 * foo
20435 !! html
20436 <ul> <li>foo</li></ul>
20437 !! end
20438
20439 !! test
20440 Don't strip leading whitespace when handling indent-pre suppressing tags
20441 !! options
20442 parsoid=html2wt
20443 !! wikitext
20444 {|
20445 | indented row
20446 |}
20447 <blockquote>
20448 '''This is very bold of you!'''
20449
20450 {|
20451 |
20452 indented cell (no pre-wrapping!)
20453 |}
20454 </blockquote>
20455 foo
20456 <div>bar</div>
20457 !! html
20458 <table>
20459 <tr><td> indented row</td></tr>
20460 </table>
20461 <blockquote><p>
20462 <b>This is very bold of you!</b>
20463 </p>
20464 <table><tr><td>
20465 indented cell (no pre-wrapping!)
20466 </td></tr></table>
20467 </blockquote>
20468 <p>foo</p>
20469 <div>bar</div>
20470 !! end
20471
20472 !! test
20473 Strip leading whitespace when handling indent-pre inducing tags
20474 !! options
20475 parsoid=html2wt
20476 !! wikitext
20477 foo
20478 <span>bar</span>
20479
20480 <span>foo2
20481 </span>bar2
20482
20483 <div>foo</div>
20484 <span>bar</span>
20485
20486 <div>
20487 <span>foo</span>
20488 </div>
20489 !! html
20490 <p>foo</p>
20491 <span>bar</span>
20492
20493 <span>foo2
20494 </span>bar2
20495
20496 <div>foo</div>
20497 <span>bar</span>
20498
20499 <div>
20500 <span>foo</span>
20501 </div>
20502 !! end
20503
20504 !! test
20505 Lists: Add space after bullets
20506 !! options
20507 parsoid=html2wt
20508 !! wikitext
20509 * foo
20510 * bar
20511 * <span> baz</span>
20512 !! html
20513 <ul>
20514 <li>foo</li>
20515 <li> bar</li>
20516 <li><span> baz</span></li>
20517 </ul>
20518 !! end
20519
20520 !! test
20521 Lists: Dont insert newlines in a serialized list item.
20522 !! options
20523 parsoid=html2wt
20524 !! wikitext
20525 * a<br>b
20526 * c
20527 !! html
20528 <ul><li>a<br>b</li><li>c</li></ul>
20529 !! end
20530
20531 !! test
20532 Headings: Add space before/after == (Bug 51744)
20533 !! options
20534 parsoid=html2wt
20535 !! wikitext
20536 == foo ==
20537
20538 == bar ==
20539
20540 == baz ==
20541
20542 == <span> baz</span> ==
20543 !! html
20544 <h2>foo</h2>
20545 <h2> bar</h2>
20546 <h2>baz </h2>
20547 <h2><span> baz</span></h2>
20548 !! end
20549
20550 !! test
20551 Parsoid: Serialize positional parameters with = in them as named parameter
20552 !! options
20553 parsoid=html2wt
20554 !! wikitext
20555 {{echo|1 = f=oo}}
20556
20557 {{echo|1 = f=oo|2 = bar}}
20558
20559 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20560 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20561 {{echo|<nowiki>f=oo</nowiki>|bar}}
20562 !! html
20563 <p about="#mwt1" typeof="mw:Transclusion"
20564 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20565
20566 <p about="#mwt1" typeof="mw:Transclusion"
20567 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20568
20569 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20570 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20571 <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>
20572 !! end
20573
20574 !! test
20575 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20576 !! options
20577 parsoid=html2wt
20578 !! wikitext
20579 <div>a
20580 b
20581 </div>
20582 <div>a
20583 b
20584 </div>
20585 <div>
20586 a
20587
20588 b
20589 </div>
20590 !! html
20591 <div>a<p>b</p></div>
20592 <div>a
20593 <p>b</p></div>
20594 <div>
20595 a
20596 <p>b</p></div>
20597 !! end
20598
20599 !! test
20600 Substrings resembling wikitext in hrefs should not get nowiki escapes
20601 !! options
20602 parsoid=html2wt
20603 !! wikitext
20604 [[Foo''bar''baz]]
20605 !! html
20606 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20607 !! end
20608
20609 #-----------------------------
20610 # I/B quote minimization tests
20611 #-----------------------------
20612
20613 !! test
20614 1. I/B quote minimization: wikitext-only tags should be combined
20615 !! options
20616 parsoid=html2wt
20617 !! wikitext
20618 ''AB''
20619
20620 '''AB'''
20621
20622 ''A'''B'''''
20623
20624 '''A''B'''''
20625
20626 '''A''BC''D'''
20627
20628 '''''AB'''''
20629
20630 '''''AB'''''
20631
20632 '''''AB'''''
20633 !! html
20634 <p><i>A</i><i>B</i></p>
20635 <p><b>A</b><b>B</b></p>
20636 <p><i>A</i><b><i>B</i></b></p>
20637 <p><b>A</b><i><b>B</b></i></p>
20638 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20639 <p><i><b>A</b></i><i><b>B</b></i></p>
20640 <p><i><b>A</b></i><b><i>B</i></b></p>
20641 <p><b><i>A</i></b><i><b>B</b></i></p>
20642 !! end
20643
20644 !! test
20645 2. I/B quote minimization: wikitext and html tags should not be combined
20646 !! options
20647 parsoid=html2wt
20648 !! wikitext
20649 ''A''<i>B</i>
20650
20651 ''A'''''<i>B</i>'''
20652 !! html
20653 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20654 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20655 !! end
20656
20657 !! test
20658 3. I/B quote minimization: templated content stops minimization
20659 !! options
20660 parsoid=html2wt
20661 !! wikitext
20662 ''A''{{echo|''B''}}
20663
20664 ''A''{{echo|'''''B'''''}}
20665 !! html
20666 <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>
20667 <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>
20668 !! end
20669
20670 !! test
20671 4. I/B quote minimization: new content should be mimimized with adjacent old content
20672 !! options
20673 parsoid=html2wt
20674 !! wikitext
20675 ''AB''
20676
20677 '''AB'''
20678
20679 ''A'''B'''''
20680 !! html
20681 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20682 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20683 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20684 !! end
20685
20686 #------------------------------------
20687 # End of I/B quote minimization tests
20688 #------------------------------------
20689
20690 !!test
20691 Bug 54262: New entities
20692 !! options
20693 parsoid=html2wt
20694 !! wikitext
20695 &nbsp;
20696 !! html
20697 <span typeof="mw:Entity">&nbsp;</span>
20698 !! end
20699
20700 ## Note that there is no wikitext output for 'unknownproperty' ##
20701 ## Unknown magic words are silently dropped ##
20702
20703 !! test
20704 Magic words
20705 !! options
20706 parsoid=html2wt
20707 !! wikitext
20708 __TOC__
20709 __NOTOC__
20710 __FORCETOC__
20711 __INDEX__
20712 __NOINDEX__
20713 __NOGALLERY__
20714 __NOEDITSECTION__
20715 __NOTITLECONVERT__
20716 __NOCONTENTCONVERT__
20717 !! html
20718 <meta property='mw:PageProp/toc' />
20719 <meta property='mw:PageProp/notoc' />
20720 <meta property='mw:PageProp/forcetoc' />
20721 <meta property='mw:PageProp/index' />
20722 <meta property='mw:PageProp/noindex' />
20723 <meta property='mw:PageProp/nogallery' />
20724 <meta property='mw:PageProp/noeditsection' />
20725 <meta property='mw:PageProp/notitleconvert' />
20726 <meta property='mw:PageProp/nocontentconvert' />
20727 <meta property='mw:PageProp/unknownproperty' />
20728 !! end
20729
20730 !! test
20731 Consecutive <pre>s should not get merged
20732 !! options
20733 parsoid=html2wt,html2html
20734 !! wikitext
20735 a
20736
20737 b
20738
20739 c
20740
20741 d
20742
20743 e
20744
20745
20746
20747 f
20748 !! html
20749 <pre>a</pre><pre>b</pre>
20750
20751 <pre>c
20752 </pre><pre>
20753 d</pre>
20754
20755 <pre>e
20756
20757 </pre><pre>
20758
20759 f</pre>
20760 !! end
20761
20762 !! test
20763 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20764 !! options
20765 parsoid=html2wt
20766 !! wikitext
20767 [[Special:BookSources/1234567890|ISBN 1234567895]]
20768 !! html
20769 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20770 !! end
20771
20772 !! test
20773 Edited RFC links not serializable as RFC links should serialize as extlinks
20774 !! options
20775 parsoid=html2wt
20776 !! wikitext
20777 [//tools.ietf.org/html/rfc123 New RFC]
20778 !! html
20779 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20780 !! end
20781
20782 !! test
20783 Edited PMID links not serializable as PMID links should serialize as extlinks
20784 !! options
20785 parsoid=html2wt
20786 !! wikitext
20787 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20788 !! html
20789 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20790 !! end
20791
20792 !! test
20793 Edited Redirect link should emit a non-piped wikitext link
20794 !! options
20795 parsoid=html2wt
20796 !! wikitext
20797 #REDIRECT [[Bar]]
20798 !! html
20799 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20800 !! end
20801
20802 # -----------------------------------------------------------------
20803 # End of section for Parsoid-only html2wt tests for serialization
20804 # of new content
20805 # -----------------------------------------------------------------
20806
20807 TODO:
20808 more images
20809 more tables
20810 character entities
20811 and much more
20812 Try for 100% code coverage