Add parser test for "extra interlanguage links".
[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 ## a,rtc not permitted
1097 ## i,b,br omitted
1098 !! test
1099 Text-level semantic html elements in wikitext
1100 !! wikitext
1101 <em>text</em>
1102 <strong>text</strong>
1103 <small>text</small>
1104 <s>text</s>
1105 <cite>text</cite>
1106 <q>text</q>
1107 <dfn>text</dfn>
1108 <abbr>text</abbr>
1109 <data>text</data>
1110 <time>text</time>
1111 <code>text</code>
1112 <var>text</var>
1113 <samp>text</samp>
1114 <kbd>text</kbd>
1115 <sub>text</sub>
1116 <u>text</u>
1117 <mark>text</mark>
1118 <ruby><rb>明日<rp>(</rp><rt>Ashita</rt><rp>)</rp></rb></ruby>
1119 <bdi>text</bdi>
1120 <bdo>text</bdo>
1121 <span>text</span>
1122 <wbr />
1123 !! html
1124 <p><em>text</em>
1125 <strong>text</strong>
1126 <small>text</small>
1127 <s>text</s>
1128 <cite>text</cite>
1129 <q>text</q>
1130 <dfn>text</dfn>
1131 <abbr>text</abbr>
1132 <data>text</data>
1133 <time>text</time>
1134 <code>text</code>
1135 <var>text</var>
1136 <samp>text</samp>
1137 <kbd>text</kbd>
1138 <sub>text</sub>
1139 <u>text</u>
1140 <mark>text</mark>
1141 <ruby><rb>明日<rp>(</rp><rt>Ashita</rt><rp>)</rp></rb></ruby>
1142 <bdi>text</bdi>
1143 <bdo>text</bdo>
1144 <span>text</span>
1145 <wbr />
1146 </p>
1147 !! end
1148
1149 !! test
1150 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1151 !! wikitext
1152 <b→> doesn't work! </b→>
1153
1154 <bä> doesn't work! </bä>
1155
1156 <boo> works fine </boo>
1157
1158 <s.foo>s.foo</s.foo>
1159
1160 <sub-ID#1>
1161 !! html
1162 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1163 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1164 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1165 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1166 </p><p>&lt;sub-ID#1&gt;
1167 </p>
1168 !! end
1169
1170 !! test
1171 Isolated close tags should be treated as literal text (bug 52760)
1172 !! wikitext
1173 </b>
1174
1175 <s.foo>s</s>
1176 !! html
1177 <p>&lt;/b&gt;
1178 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1179 </p>
1180 !! end
1181
1182 ###
1183 ### Special characters
1184 ###
1185
1186 !! test
1187 Bare pipe character (bug 52363)
1188 !! wikitext
1189 |
1190 !! html
1191 <p>|
1192 </p>
1193 !! end
1194
1195 !! test
1196 Bare pipe character from a template (bug 52363)
1197 !! wikitext
1198 {{pipe}}
1199 !! html
1200 <p>|
1201 </p>
1202 !! end
1203
1204 ###
1205 ### <nowiki> test cases
1206 ###
1207
1208 !! test
1209 <nowiki> unordered list
1210 !! wikitext
1211 <nowiki>* This is not an unordered list item.</nowiki>
1212 !! html
1213 <p>* This is not an unordered list item.
1214 </p>
1215 !! end
1216
1217 !! test
1218 <nowiki> spacing
1219 !! wikitext
1220 <nowiki>Lorem ipsum dolor
1221
1222 sed abit.
1223 sed nullum.
1224
1225 :and a colon
1226 </nowiki>
1227 !! html
1228 <p>Lorem ipsum dolor
1229
1230 sed abit.
1231 sed nullum.
1232
1233 :and a colon
1234
1235 </p>
1236 !! end
1237
1238 !! test
1239 nowiki 3
1240 !! wikitext
1241 :There is not nowiki.
1242 :There is <nowiki>nowiki</nowiki>.
1243
1244 #There is not nowiki.
1245 #There is <nowiki>nowiki</nowiki>.
1246
1247 *There is not nowiki.
1248 *There is <nowiki>nowiki</nowiki>.
1249 !! html
1250 <dl><dd>There is not nowiki.</dd>
1251 <dd>There is nowiki.</dd></dl>
1252 <ol><li>There is not nowiki.</li>
1253 <li>There is nowiki.</li></ol>
1254 <ul><li>There is not nowiki.</li>
1255 <li>There is nowiki.</li></ul>
1256
1257 !! end
1258
1259 !! test
1260 Entities inside <nowiki>
1261 !! wikitext
1262 <nowiki>&lt;</nowiki>
1263 !! html
1264 <p>&lt;
1265 </p>
1266 !! end
1267
1268 !! test
1269 Entities inside template parameters
1270 !! options
1271 parsoid
1272 !! wikitext
1273 {{echo|&ndash;}}
1274 !! html
1275 <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>
1276 </p>
1277 !! end
1278
1279 !! test
1280 Properly escape nowiki when combined with other wiki markup
1281 !! options
1282 parsoid=html2wt
1283 !! wikitext
1284 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1285 !! html
1286 <p>* &lt;/nowiki&gt; tag</p>
1287 !! end
1288
1289 ###
1290 ### Comments
1291 ###
1292 !! test
1293 Comments and Indent-Pre
1294 !! wikitext
1295 <!-- comment 1 --> asdf
1296
1297 <!-- comment 1 --> asdf
1298 <!-- comment 2 -->
1299
1300 <!-- comment 1 --> asdf
1301 <!-- comment 2 -->xyz
1302
1303 <!-- comment 1 --> asdf
1304 <!-- comment 2 --> xyz
1305 !! html
1306 <pre>asdf
1307 </pre>
1308 <pre>asdf
1309 </pre>
1310 <pre>asdf
1311 </pre>
1312 <p>xyz
1313 </p>
1314 <pre>asdf
1315 xyz
1316 </pre>
1317 !! end
1318
1319 !! test
1320 Comment test 2a
1321 !! wikitext
1322 asdf
1323 <!-- comment 1 -->
1324 jkl
1325 !! html
1326 <p>asdf
1327 jkl
1328 </p>
1329 !! end
1330
1331 !! test
1332 Comment test 2b
1333 !! wikitext
1334 asdf
1335 <!-- comment 1 -->
1336
1337 jkl
1338 !! html
1339 <p>asdf
1340 </p><p>jkl
1341 </p>
1342 !! end
1343
1344 !! test
1345 Comment test 3
1346 !! wikitext
1347 asdf
1348 <!-- comment 1 -->
1349 <!-- comment 2 -->
1350 jkl
1351 !! html
1352 <p>asdf
1353 jkl
1354 </p>
1355 !! end
1356
1357 !! test
1358 Comment test 4
1359 !! wikitext
1360 asdf<!-- comment 1 -->jkl
1361 !! html
1362 <p>asdfjkl
1363 </p>
1364 !! end
1365
1366 !! test
1367 Comment spacing
1368 !! wikitext
1369 a
1370 <!-- foo --> b <!-- bar -->
1371 c
1372 !! html
1373 <p>a
1374 </p>
1375 <pre> b
1376 </pre>
1377 <p>c
1378 </p>
1379 !! end
1380
1381 !! test
1382 Comment whitespace
1383 !! wikitext
1384 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1385 !! html
1386
1387 !! end
1388
1389 !! test
1390 Comment semantics and delimiters
1391 !! wikitext
1392 <!-- --><!----><!-----><!------>
1393 !! html
1394
1395 !! end
1396
1397 !! test
1398 Comment semantics and delimiters, redux
1399 !! wikitext
1400 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1401 -- foo -- funky huh? ... -->
1402 !! html
1403
1404 !! end
1405
1406 !! test
1407 Comment semantics and delimiters: directors cut
1408 !! wikitext
1409 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1410 everything starting with < followed by !-- until the first -- and > we see,
1411 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1412 -->-->
1413 !! html
1414 <p>--&gt;
1415 </p>
1416 !! end
1417
1418 !! test
1419 Comment semantics: nesting
1420 !! wikitext
1421 <!--<!-- no, we're not going to do anything fancy here -->-->
1422 !! html
1423 <p>--&gt;
1424 </p>
1425 !! end
1426
1427 !! test
1428 Comment semantics: unclosed comment at end
1429 !! wikitext
1430 <!--This comment will run out to the end of the document
1431 !! html
1432
1433 !! end
1434
1435 !! test
1436 Comment in template title
1437 !! wikitext
1438 {{f<!---->oo}}
1439 !! html
1440 <p>FOO
1441 </p>
1442 !! end
1443
1444 !! test
1445 Comment on its own line post-expand
1446 !! wikitext
1447 a
1448 {{blank}}<!---->
1449 b
1450 !! html
1451 <p>a
1452 </p><p>b
1453 </p>
1454 !! end
1455
1456 !! test
1457 Comment on its own line post-expand with non-significant whitespace
1458 !! wikitext
1459 a
1460 {{blank}} <!---->
1461 b
1462 !! html
1463 <p>a
1464 </p><p>b
1465 </p>
1466 !! end
1467
1468 !! test
1469 Multiple comments should still parse as SOL-transparent
1470 !! options
1471 parsoid=wt2html,wt2wt
1472 !! wikitext
1473 <!--c1-->*a
1474 <!--c2--><!--c3--><!--c4-->*b
1475 !! html
1476 <ul>
1477 <li>a
1478 </li>
1479 <li>b
1480 </li>
1481 </ul>
1482 !! end
1483
1484 ###
1485 ### paragraph wrapping tests
1486 ###
1487 !! test
1488 No block tags
1489 !! wikitext
1490 a
1491
1492 b
1493 !! html
1494 <p>a
1495 </p><p>b
1496 </p>
1497 !! end
1498
1499 !! test
1500 Block tag on one line (<div>)
1501 !! wikitext
1502 a <div>foo</div>
1503
1504 b
1505 !! html
1506 a <div>foo</div>
1507 <p>b
1508 </p>
1509 !! end
1510
1511 !! test
1512 Block tag on one line (<blockquote>)
1513 !! wikitext
1514 a <blockquote>foo</blockquote>
1515
1516 b
1517 !! html
1518 a <blockquote>foo</blockquote>
1519 <p>b
1520 </p>
1521 !! end
1522
1523 !! test
1524 Block tag on both lines (<div>)
1525 !! wikitext
1526 a <div>foo</div>
1527
1528 b <div>foo</div>
1529 !! html
1530 a <div>foo</div>
1531 b <div>foo</div>
1532
1533 !! end
1534
1535 !! test
1536 Block tag on both lines (<blockquote>)
1537 !! wikitext
1538 a <blockquote>foo</blockquote>
1539
1540 b <blockquote>foo</blockquote>
1541 !! html
1542 a <blockquote>foo</blockquote>
1543 b <blockquote>foo</blockquote>
1544
1545 !! end
1546
1547 !! test
1548 Multiple lines without block tags
1549 !! wikitext
1550 <div>foo</div> a
1551 b
1552 c
1553 d<!--foo--> e
1554 x <div>foo</div> z
1555 !! html
1556 <div>foo</div> a
1557 <p>b
1558 c
1559 d e
1560 </p>
1561 x <div>foo</div> z
1562
1563 !! end
1564
1565 !! test
1566 Empty lines between lines with block tags
1567 !! wikitext
1568 <div></div>
1569
1570
1571 <div></div>a
1572
1573 b
1574 <div>a</div>b
1575
1576 <div>b</div>d
1577
1578
1579 <div>e</div>
1580 !! html
1581 <div></div>
1582 <p><br />
1583 </p>
1584 <div></div>a
1585 <p>b
1586 </p>
1587 <div>a</div>b
1588 <div>b</div>d
1589 <p><br />
1590 </p>
1591 <div>e</div>
1592
1593 !! end
1594
1595 ## PHP parser emits output which is broken
1596 !! test
1597 Unclosed HTML p-tags should be handled properly
1598 !! wikitext
1599 <div><p>foo</div>
1600 a
1601
1602 b
1603 !! html/parsoid
1604 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1605 <p>a</p>
1606 <p>b</p>
1607 !! end
1608
1609 ###
1610 ### Preformatted text
1611 ###
1612 !! test
1613 Preformatted text
1614 !! wikitext
1615 This is some
1616 Preformatted text
1617 With ''italic''
1618 And '''bold'''
1619 And a [[Main Page|link]]
1620 !! html
1621 <pre>This is some
1622 Preformatted text
1623 With <i>italic</i>
1624 And <b>bold</b>
1625 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1626 </pre>
1627 !! end
1628
1629 !! test
1630 Tabs don't trigger preformatted text
1631 !! wikitext
1632 This is not
1633 preformatted text.
1634 This is preformatted text.
1635 So is this.
1636 !! html
1637 <p> This is not
1638 preformatted text.
1639 </p>
1640 <pre>This is preformatted text.
1641 So is this.
1642 </pre>
1643 !! end
1644
1645 !! test
1646 Ident preformatting with inline content
1647 !! wikitext
1648 a
1649 ''b''
1650 !! html
1651 <pre>a
1652 <i>b</i>
1653 </pre>
1654 !! end
1655
1656 !! test
1657 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1658 !! wikitext
1659 <pre><nowiki>
1660 <b>
1661 <cite>
1662 <em>
1663 </nowiki></pre>
1664 !! html
1665 <pre>
1666 &lt;b&gt;
1667 &lt;cite&gt;
1668 &lt;em&gt;
1669 </pre>
1670
1671 !! end
1672
1673 !! test
1674 Regression with preformatted in <center>
1675 !! wikitext
1676 <center>
1677 Blah
1678 </center>
1679 !! html
1680 <center>
1681 <pre>Blah
1682 </pre>
1683 </center>
1684
1685 !! end
1686
1687 !! test
1688 Bug 52763: Preformatted in <blockquote>
1689 !! wikitext
1690 <blockquote>
1691 Blah
1692 {|
1693 |
1694 indented cell (no pre-wrapping!)
1695 |}
1696 </blockquote>
1697 !! html
1698 <blockquote>
1699 <p> Blah
1700 </p>
1701 <table>
1702 <tr>
1703 <td>
1704 <p> indented cell (no pre-wrapping!)
1705 </p>
1706 </td></tr></table>
1707 </blockquote>
1708
1709 !! end
1710
1711 !! test
1712 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1713 !! wikitext
1714 <blockquote>
1715 Foo
1716
1717 Bar
1718 </blockquote>
1719 !! html
1720 <blockquote>
1721 <p>Foo
1722 </p><p>Bar
1723 </p>
1724 </blockquote>
1725
1726 !! end
1727
1728 !! test
1729 Bug 15491: <ins>/<del> in blockquote
1730 !! wikitext
1731 <blockquote>
1732 Foo <del>bar</del> <ins>baz</ins> quux
1733 </blockquote>
1734 !! html
1735 <blockquote>
1736 <p>Foo <del>bar</del> <ins>baz</ins> quux
1737 </p>
1738 </blockquote>
1739
1740 !! end
1741
1742 # Note that the p-wrapping is newline sensitive, which could be
1743 # considered a bug: tidy will wrap only the 'Foo' in the example
1744 # below in a <p> tag. (see comment 23-25 of bug #6200)
1745 !! test
1746 Bug 15491: <ins>/<del> in blockquote (2)
1747 !! wikitext
1748 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1749 </blockquote>
1750 !! html
1751 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1752 </blockquote>
1753
1754 !! end
1755
1756 !! test
1757 <pre> with attributes (bug 3202)
1758 !! wikitext
1759 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1760 !! html
1761 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1762
1763 !! end
1764
1765 !! test
1766 <pre> with width attribute (bug 3202)
1767 !! wikitext
1768 <pre width="8">Narrow screen goodies</pre>
1769 !! html
1770 <pre width="8">Narrow screen goodies</pre>
1771
1772 !! end
1773
1774 !! test
1775 <pre> with forbidden attribute (bug 3202)
1776 !! wikitext
1777 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1778 !! html
1779 <pre width="8">Narrow screen goodies</pre>
1780
1781 !! end
1782
1783 !! test
1784 Entities inside <pre>
1785 !! wikitext
1786 <pre>&lt;</pre>
1787 !! html
1788 <pre>&lt;</pre>
1789
1790 !! end
1791
1792 !! test
1793 <pre> with forbidden attribute values (bug 3202)
1794 !! wikitext
1795 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1796 !! html
1797 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1798
1799 !! end
1800
1801 !! test
1802 <nowiki> inside <pre> (bug 13238)
1803 !! wikitext
1804 <pre>
1805 <nowiki>
1806 </pre>
1807 <pre>
1808 <nowiki></nowiki>
1809 </pre>
1810 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1811 !! html
1812 <pre>
1813 &lt;nowiki&gt;
1814 </pre>
1815 <pre>
1816
1817 </pre>
1818 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1819
1820 !! end
1821
1822 !! test
1823 <nowiki> and <pre> preference (first one wins)
1824 !! wikitext
1825 <pre>
1826 <nowiki>
1827 </pre>
1828 </nowiki>
1829 </pre>
1830
1831 <nowiki>
1832 <pre>
1833 <nowiki>
1834 </pre>
1835 </nowiki>
1836 </pre>
1837
1838 !! html
1839 <pre>
1840 &lt;nowiki&gt;
1841 </pre>
1842 <p>&lt;/nowiki&gt;
1843 &lt;/pre&gt;
1844 </p><p>
1845 &lt;pre&gt;
1846 &lt;nowiki&gt;
1847 &lt;/pre&gt;
1848
1849 &lt;/pre&gt;
1850 </p>
1851 !! end
1852
1853 !! test
1854 </pre> inside nowiki
1855 !! wikitext
1856 <nowiki></pre></nowiki>
1857 !! html
1858 <p>&lt;/pre&gt;
1859 </p>
1860 !! end
1861
1862 !! test
1863 Empty pre; pre inside other HTML tags (bug 54946)
1864 !! wikitext
1865 a
1866
1867 <div><pre>
1868 foo
1869 </pre></div>
1870 <pre></pre>
1871 !! html
1872 <p>a
1873 </p>
1874 <div><pre>
1875 foo
1876 </pre></div>
1877 <pre></pre>
1878
1879 !! end
1880
1881 !! test
1882 HTML pre followed by indent-pre
1883 !! wikitext
1884 <pre>foo</pre>
1885 bar
1886 !! html
1887 <pre>foo</pre>
1888 <pre>bar
1889 </pre>
1890 !! end
1891
1892 !!test
1893 Block tag pre
1894 !!options
1895 parsoid
1896 !! wikitext
1897 <p><pre>foo</pre></p>
1898 !! html
1899 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1900 !!end
1901
1902 !!test
1903 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1904 !! wikitext
1905 {{echo|}}
1906 !! html
1907
1908 !!end
1909
1910 !!test
1911 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1912 !! wikitext
1913 {{echo|
1914 foo}}
1915 !! html
1916 <p>foo
1917 </p>
1918 !!end
1919
1920 !! test
1921 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1922 !! wikitext
1923 {{echo|a
1924 b}}
1925 !! html
1926 <pre>a
1927 </pre>
1928 <p>b
1929 </p>
1930 !!end
1931
1932 !! test
1933 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1934 !! wikitext
1935 {{echo|a
1936 b
1937 c
1938 d
1939 e
1940 }}
1941 !! html
1942 <pre>a
1943 </pre>
1944 <p>b
1945 c
1946 </p>
1947 <pre>d
1948 </pre>
1949 <p>e
1950 </p>
1951 !!end
1952
1953 !!test
1954 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1955 !! wikitext
1956 {{echo| foo}}
1957
1958 {{echo| foo}}{{echo| bar}}
1959
1960 {{echo| foo}}
1961 {{echo| bar}}
1962
1963 {{echo|<!--cmt--> foo}}
1964
1965 <!--cmt-->{{echo| foo}}
1966
1967 {{echo|{{echo| }}bar}}
1968 !! html
1969 <pre>foo
1970 </pre>
1971 <pre>foo bar
1972 </pre>
1973 <pre>foo
1974 bar
1975 </pre>
1976 <pre>foo
1977 </pre>
1978 <pre>foo
1979 </pre>
1980 <pre>bar
1981 </pre>
1982 !!end
1983
1984 !! test
1985 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1986 !! wikitext
1987 {{echo| }}a
1988
1989 {{echo|
1990 }}a
1991
1992 {{echo|
1993 b}}
1994
1995 {{echo|a
1996 }}b
1997
1998 {{echo|a
1999 }} b
2000 !! html
2001 <pre>a
2002 </pre>
2003 <p><br />
2004 </p>
2005 <pre>a
2006 </pre>
2007 <p><br />
2008 </p>
2009 <pre>b
2010 </pre>
2011 <p>a
2012 </p>
2013 <pre>b
2014 </pre>
2015 <p>a
2016 </p>
2017 <pre>b
2018 </pre>
2019 !!end
2020
2021 !! test
2022 Things that look like <pre> tags aren't treated as such
2023 !! wikitext
2024 Barack Obama <President> of the United States
2025 <President></President>
2026 !! html
2027 <p>Barack Obama &lt;President&gt; of the United States
2028 &lt;President&gt;&lt;/President&gt;
2029 </p>
2030 !! end
2031
2032 ## PHP parser discards the "<pre " string
2033 !! test
2034 Handle broken pre-like tags (bug 64025)
2035 !! options
2036 parsoid=wt2html
2037 !! wikitext
2038 {{echo|<pre <pre>x</pre>}}
2039
2040 <table><pre </table>
2041 !! html/php
2042 <pre>x</pre>
2043 <table><pre></pre></table>
2044
2045 !! html/parsoid
2046 <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>
2047 <pre>x</pre>
2048
2049 <span>&lt;pre </span>
2050 <table></table>
2051 !! end
2052
2053 !! test
2054 Parsoid: handle pre with space after attribute
2055 !! options
2056 parsoid=wt2html
2057 !! wikitext
2058 <pre style="width:50%;" >{{echo|foo}}</pre>
2059 !! html
2060 <pre style="width:50%;">{{echo|foo}}</pre>
2061 !! end
2062
2063 # TODO / maybe: fix wt2wt for this
2064 !! test
2065 Parsoid: Don't paragraph-wrap fosterable content
2066 !! options
2067 parsoid=wt2html
2068 !! wikitext
2069 {|
2070 <td></td>
2071 <td></td>
2072
2073
2074
2075 |}
2076 !! html
2077 <table>
2078
2079 <tbody>
2080 <tr>
2081 <td></td>
2082
2083 <td></td></tr>
2084
2085
2086
2087 </tbody></table>
2088 !! end
2089
2090 !! test
2091 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2092 !! options
2093 parsoid=wt2html
2094 !! wikitext
2095 {|
2096 <td>
2097 <td>
2098 </td>
2099
2100
2101
2102 |}
2103 !! html
2104 <table>
2105
2106 <tbody>
2107 <tr>
2108 <td></td>
2109
2110 <td>
2111 </td></tr>
2112
2113
2114
2115 </tbody></table>
2116 !! end
2117
2118
2119 #--------------------------------------------------------------------
2120 # Transclusion parameter whitespace stripping tests
2121 # Behavior is different for positional and named parameters
2122 #--------------------------------------------------------------------
2123 !! test
2124 Templates: Strip leading and trailing whitespace from named-param values
2125 !! wikitext
2126 {{echo|1= a }}
2127
2128 {{echo|1= {{echo|b}} }}
2129
2130 {{echo| 1 =
2131 c }}
2132
2133 {{echo| 1 =
2134 * d
2135 }}
2136 !! html
2137 <p>a
2138 </p><p>b
2139 </p><p>c
2140 </p>
2141 <ul><li> d</li></ul>
2142
2143 !! end
2144
2145 !! test
2146 Templates: Don't strip whitespace from positional-param values
2147 !! wikitext
2148 {{echo|a }}
2149
2150 {{echo|{{echo|b}} }}
2151
2152 {{echo| c
2153 }}
2154
2155 {{echo| {{echo|d}}
2156 }}
2157
2158 {{echo|
2159 e}}
2160
2161 {{echo|
2162 * f}}
2163
2164 {{echo|
2165 }}g
2166 !! html
2167 <p>a
2168 </p><p>b
2169 </p>
2170 <pre>c
2171 </pre>
2172 <p><br />
2173 </p>
2174 <pre>d
2175 </pre>
2176 <p><br />
2177 </p>
2178 <pre>e
2179 </pre>
2180 <p><br />
2181 </p>
2182 <ul><li> f</li></ul>
2183 <p><br />
2184 </p>
2185 <pre>g
2186 </pre>
2187 !! end
2188
2189 !! test
2190 Templates: Handle empty comment-and-ws-only lines correctly
2191 !! wikitext
2192 {{echo|foo
2193 <!--should be ignored-->
2194 <!--should be ignored as well-->
2195 bar}}
2196 !! html
2197 <p>foo
2198 bar
2199 </p>
2200 !! end
2201
2202 !! test
2203 Templates: Handle comments in the target
2204 !! wikitext
2205 {{echo
2206 <!-- should be ignored -->
2207 |foo}}
2208
2209 {{echo<!-- should be ignored -->
2210 |foo}}
2211
2212 {{echo<!-- should be ignored -->|foo}}
2213
2214 {{<!-- should be ignored -->echo|foo}}
2215 !!html/parsoid
2216 <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>
2217
2218 <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>
2219
2220 <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>
2221
2222 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2223 !!end
2224
2225 #--------------------------------------------------------------------
2226 # Transclusion parameter escaping tests
2227 #--------------------------------------------------------------------
2228 !! test
2229 Templates: Parsoid parameter escaping test 1
2230 !! options
2231 parsoid
2232 !! wikitext
2233 {{echo|[foo]|{{echo|[bar]}}}}
2234 !! html
2235 <p about="#mwt1" typeof="mw:Transclusion"
2236 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2237 !! end
2238
2239 !! test
2240 Parsoid: Pipes in external links in template parameter
2241 !! options
2242 parsoid
2243 !! wikitext
2244 {{echo|[{{echo|http://example.com}} link]}}
2245 !! html
2246 <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>
2247 !! end
2248
2249 !! test
2250 Parsoid: pipe in transclusion parameter
2251 !! options
2252 parsoid
2253 !! wikitext
2254 {{echo|http://foo.com/a&#124;b}}
2255 !! html
2256 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2257 typeof="mw:Transclusion"
2258 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>
2259 !! end
2260
2261 !! test
2262 Parsoid: Pipe in external link target and content in template parameter
2263 !! options
2264 parsoid=html2wt,wt2wt
2265 !! wikitext
2266 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2267 !! html
2268 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2269 typeof="mw:Transclusion"
2270 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2271 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2272 !! end
2273
2274 !! test
2275 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2276 !! options
2277 parsoid
2278 !! wikitext
2279 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2280 !! html
2281 <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>
2282 !! end
2283
2284 !! test
2285 Templates: Don't escape already nowiki-escaped text in template parameters
2286 !! options
2287 parsoid=html2wt,wt2wt
2288 !! wikitext
2289 {{echo|foo<nowiki>|</nowiki>bar}}
2290 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2291 {{echo|<nowiki></nowiki>}}
2292 !! html
2293 <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>
2294 <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>
2295 <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>
2296 </p>
2297 !! end
2298
2299 ## Bug 52824
2300 !! test
2301 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2302 !! options
2303 parsoid=html2wt,wt2wt
2304 !! wikitext
2305 {{echo|{{echo|1=bar}}}}
2306 !! html
2307 <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>
2308 !! end
2309
2310 ## Bug 56733
2311 !! test
2312 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2313 !! options
2314 parsoid
2315 !! wikitext
2316 {{echo|a : b}}
2317 !! html
2318 <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>
2319 !! end
2320
2321 ###
2322 ### Parsoid-centric tests for testing RT edge cases for pre
2323 ###
2324
2325 !!test
2326 1a. Indent-Pre and Comments
2327 !! wikitext
2328 a
2329 <!--a-->
2330 c
2331 !! html
2332 <pre>a
2333 </pre>
2334 <p>c
2335 </p>
2336 !!end
2337
2338 !!test
2339 1b. Indent-Pre and Comments
2340 !! wikitext
2341 a
2342 <!--a-->
2343 c
2344 !! html
2345 <pre>a
2346 </pre>
2347 <p>c
2348 </p>
2349 !!end
2350
2351 !!test
2352 1c. Indent-Pre and Comments
2353 !! wikitext
2354 <!--a--> a
2355
2356 <!--a--> a
2357 !! html
2358 <pre> a
2359 </pre>
2360 <pre> a
2361 </pre>
2362 !!end
2363
2364 !!test
2365 1d. Indent-Pre and Comments
2366 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2367 !! wikitext
2368 <!--a--> a
2369
2370 <!--b-->b
2371 !! html
2372 <pre>a
2373 </pre>
2374 <pre>b
2375 </pre>
2376 !!end
2377
2378 !!test
2379 2a. Indent-Pre and tables
2380 !! wikitext
2381 {|
2382 |-
2383 !h1!!h2
2384 |foo||bar
2385 |}
2386 !! html
2387 <table>
2388
2389 <tr>
2390 <th>h1</th>
2391 <th>h2
2392 </th>
2393 <td>foo</td>
2394 <td>bar
2395 </td></tr></table>
2396
2397 !!end
2398
2399 !!test
2400 2b. Indent-Pre and tables
2401 !! wikitext
2402 {|
2403 |-
2404 |foo
2405 |}
2406 !! html
2407 <table>
2408
2409 <tr>
2410 <td>foo
2411 </td></tr></table>
2412
2413 !!end
2414
2415 !!test
2416 2c. Indent-Pre and tables (bug 42252)
2417 !! wikitext
2418 {|
2419 |+ foo
2420 ! | bar
2421 |}
2422 !! html
2423 <table>
2424 <caption> foo
2425 </caption>
2426 <tr>
2427 <th> bar
2428 </th></tr></table>
2429
2430 !!end
2431
2432 !!test
2433 2d. Indent-Pre and tables
2434 !! wikitext
2435 a
2436 {|
2437 | b
2438 |}
2439 !! html/php
2440 <pre>a
2441 </pre>
2442 <table>
2443 <tr>
2444 <td> b
2445 </td></tr></table>
2446
2447 !! html/parsoid
2448 <pre>a</pre>
2449
2450 <table>
2451
2452 <tbody>
2453 <tr>
2454 <td> b</td></tr>
2455 </tbody></table>
2456 !!end
2457
2458 !!test
2459 2e. Indent-Pre and table-line syntax
2460 !! wikitext
2461 a
2462 | b
2463 | c
2464 !! html/parsoid
2465 <pre>a
2466 | b
2467 | c</pre>
2468 !!end
2469
2470 !!test
2471 2f. Indent-pre started by table-line syntax
2472 !! wikitext
2473 a
2474 | b
2475 | c
2476 !! html/parsoid
2477 <p>a</p>
2478 <pre>
2479 | b
2480 | c</pre>
2481 !!end
2482
2483 !!test
2484 3a. Indent-Pre and block tags (single-line html)
2485 !! wikitext
2486 a <p> foo </p>
2487 b <div> foo </div>
2488 c <blockquote> foo </blockquote>
2489 <span> foo </span>
2490 !! html
2491 a <p> foo </p>
2492 b <div> foo </div>
2493 c <blockquote> foo </blockquote>
2494 <pre><span> foo </span>
2495 </pre>
2496 !!end
2497
2498 !!test
2499 3b. Indent-Pre and block tags (multi-line html)
2500 !! wikitext
2501 a <span>foo</span>
2502 b <div> foo </div>
2503 !! html
2504 <pre>a <span>foo</span>
2505 </pre>
2506 b <div> foo </div>
2507
2508 !!end
2509
2510 !!test
2511 3c. Indent-Pre and block tags (pre-content on separate line)
2512 !! wikitext
2513 <p>
2514 foo
2515 </p>
2516
2517 <div>
2518 foo
2519 </div>
2520
2521 <center>
2522 foo
2523 </center>
2524
2525 <blockquote>
2526 foo
2527 </blockquote>
2528
2529 <blockquote>
2530 <pre>
2531 foo
2532 </pre>
2533 </blockquote>
2534
2535 <table><tr><td>
2536 foo
2537 </td></tr></table>
2538
2539 <ul><li>
2540 foo
2541 </li></ul>
2542
2543 !! html
2544 <p>
2545 foo
2546 </p>
2547 <div>
2548 <pre>foo
2549 </pre>
2550 </div>
2551 <center>
2552 <pre>foo
2553 </pre>
2554 </center>
2555 <blockquote>
2556 <p> foo
2557 </p>
2558 </blockquote>
2559 <blockquote>
2560 <pre>
2561 foo
2562 </pre>
2563 </blockquote>
2564 <table><tr><td>
2565 <pre>foo
2566 </pre>
2567 </td></tr></table>
2568 <ul><li>
2569 foo
2570 </li></ul>
2571
2572 !!end
2573
2574 !!test
2575 4. Indent-Pre and extension tags
2576 !! wikitext
2577 a <gallery>
2578 File:foobar.jpg
2579 </gallery>
2580 !! html
2581 a <ul class="gallery mw-gallery-traditional">
2582 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2583 <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>
2584 <div class="gallerytext">
2585 </div>
2586 </div></li>
2587 </ul>
2588
2589 !!end
2590
2591 !! test
2592 Leading pipes outside of tables
2593 !! options
2594 parsoid
2595 !! wikitext
2596 | foo
2597 !! html
2598 <p>| foo</p>
2599 !! end
2600
2601 !! test
2602 Leading pipes outside of tables 2
2603 !! options
2604 parsoid
2605 !! wikitext
2606 a
2607 | foo
2608 b
2609 !! html
2610 <p>a
2611 | foo
2612 b</p>
2613 !! end
2614
2615 !! test
2616 Leading pipes outside of tables 3
2617 !! options
2618 parsoid
2619 !! wikitext
2620 a
2621 | class="foo bar" | baz
2622 b
2623 !! html
2624 <p>a
2625 | class="foo bar" | baz
2626 b</p>
2627 !! end
2628
2629 !!test
2630 Render paragraphs when indent-pre is suppressed in blocklevels
2631 !! wikitext
2632 <blockquote>
2633 foo
2634
2635 bar
2636 </blockquote>
2637 !! html
2638 <blockquote>
2639 <p> foo
2640 </p><p> bar
2641 </p>
2642 </blockquote>
2643
2644 !!end
2645
2646 !!test
2647 4. Multiple spaces at start-of-line
2648 !! wikitext
2649 <p> foo </p>
2650 foo
2651 {|
2652 |foo
2653 |}
2654 !! html
2655 <p> foo </p>
2656 <pre> foo
2657 </pre>
2658 <table>
2659 <tr>
2660 <td>foo
2661 </td></tr></table>
2662
2663 !!end
2664
2665 ## NOTE: the leading white-space chars on empty line are significant
2666 !! test
2667 5a. White-space in indent-pre
2668 !! wikitext
2669 a<br />
2670
2671 b
2672 !! html
2673 <pre>a<br />
2674
2675 b
2676 </pre>
2677 !! end
2678
2679 ## NOTE: the leading white-space chars on empty line are significant
2680 !! test
2681 5b. White-space in indent-pre
2682 !! wikitext
2683 a
2684
2685 b
2686
2687
2688 c
2689 !! html
2690 <pre>a
2691
2692 b
2693
2694
2695 c
2696 </pre>
2697 !! end
2698
2699 !! test
2700 5c. White-space in indent-pre
2701 !! wikitext
2702 ''a''
2703 ''b''
2704 ''c''
2705 !! html
2706 <pre><i>a</i>
2707 <i>b</i>
2708 <i>c</i>
2709 </pre>
2710 !! end
2711
2712 !! test
2713 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2714 !! wikitext
2715 a
2716
2717 <!-- continue -->
2718 b
2719
2720 c
2721
2722 d
2723 !! html
2724 <pre>a
2725
2726 b
2727 </pre>
2728 <pre>c
2729
2730 </pre>
2731 <p>d
2732 </p>
2733 !! end
2734
2735 !! test
2736 7a. Indent-pre and category links
2737 !! options
2738 parsoid=wt2html,wt2wt
2739 !! wikitext
2740 [[Category:foo]] <!-- No pre-wrapping -->
2741 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2742 !! html
2743 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2744 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2745 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2746 !! end
2747
2748 !! test
2749 7b. Indent-pre and category links
2750 !! options
2751 parsoid=wt2html,wt2wt
2752 !! wikitext
2753 [[Category:foo]] a
2754 [[Category:foo]] {{echo|b}}
2755 !! html
2756 <pre>
2757 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2758
2759 <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>
2760 !! end
2761
2762 ###
2763 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2764 ###
2765
2766 !!test
2767 HTML-pre: 1. embedded newlines
2768 !! wikitext
2769 <pre>foo</pre>
2770
2771 <pre>
2772 foo
2773 </pre>
2774
2775 <pre>
2776
2777 foo
2778 </pre>
2779
2780 <pre>
2781
2782
2783 foo
2784 </pre>
2785 !! html
2786 <pre>foo</pre>
2787 <pre>
2788 foo
2789 </pre>
2790 <pre>
2791
2792 foo
2793 </pre>
2794 <pre>
2795
2796
2797 foo
2798 </pre>
2799
2800 !! html/parsoid
2801 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2802
2803 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2804 foo
2805 </pre>
2806
2807 <pre data-parsoid='{"stx":"html"}'>
2808
2809 foo
2810 </pre>
2811
2812 <pre data-parsoid='{"stx":"html"}'>
2813
2814
2815 foo
2816 </pre>
2817 !!end
2818
2819 !! test
2820 HTML-pre: big spaces
2821 !! wikitext
2822 <pre>
2823
2824
2825
2826
2827 haha
2828
2829
2830
2831
2832 haha
2833
2834
2835
2836
2837 </pre>
2838 !! html
2839 <pre>
2840
2841
2842
2843
2844 haha
2845
2846
2847
2848
2849 haha
2850
2851
2852
2853
2854 </pre>
2855
2856 !! html/parsoid
2857 <pre data-parsoid='{"stx":"html"}'>
2858
2859
2860
2861
2862 haha
2863
2864
2865
2866
2867 haha
2868
2869
2870
2871
2872 </pre>
2873 !! end
2874
2875 !!test
2876 HTML-pre: 2: indented text
2877 !! wikitext
2878 <pre>
2879 foo
2880 </pre>
2881 !! html
2882 <pre>
2883 foo
2884 </pre>
2885
2886 !!end
2887
2888 !!test
2889 HTML-pre: 3: other wikitext
2890 !! wikitext
2891 <pre>
2892 * foo
2893 # bar
2894 = no-h =
2895 '' no-italic ''
2896 [[ NoLink ]]
2897 </pre>
2898 !! html
2899 <pre>
2900 * foo
2901 # bar
2902 = no-h =
2903 '' no-italic ''
2904 [[ NoLink ]]
2905 </pre>
2906
2907 !!end
2908
2909 ###
2910 ### Definition lists
2911 ###
2912 !! test
2913 Simple definition
2914 !! wikitext
2915 ; name : Definition
2916 !! html
2917 <dl><dt> name&#160;</dt>
2918 <dd> Definition</dd></dl>
2919
2920 !! end
2921
2922 !! test
2923 Definition list for indentation only
2924 !! wikitext
2925 : Indented text
2926 !! html
2927 <dl><dd> Indented text</dd></dl>
2928
2929 !! end
2930
2931 !! test
2932 Definition list with no space
2933 !! wikitext
2934 ;name:Definition
2935 !! html
2936 <dl><dt>name</dt>
2937 <dd>Definition</dd></dl>
2938
2939 !!end
2940
2941 !! test
2942 Definition list with URL link
2943 !! wikitext
2944 ; http://example.com/ : definition
2945 !! html
2946 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2947 <dd> definition</dd></dl>
2948
2949 !! end
2950
2951 !! test
2952 Definition list with bracketed URL link
2953 !! wikitext
2954 ;[http://www.example.com/ Example]:Something about it
2955 !! html
2956 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2957 <dd>Something about it</dd></dl>
2958
2959 !! end
2960
2961 !! test
2962 Definition list with wikilink containing colon
2963 !! wikitext
2964 ; [[Help:FAQ]]: The least-read page on Wikipedia
2965 !! html
2966 <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>
2967 <dd> The least-read page on Wikipedia</dd></dl>
2968
2969 !! end
2970
2971 # At Brion's and JeLuF's insistence... :)
2972 !! test
2973 Definition list with news link containing colon
2974 !! wikitext
2975 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2976 !! html
2977 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2978 <dd> This isn't even a real newsgroup!</dd></dl>
2979
2980 !! end
2981
2982 !! test
2983 Malformed definition list with colon
2984 !! wikitext
2985 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2986 !! html
2987 <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>
2988
2989 !! end
2990
2991 !! test
2992 Definition lists: colon in external link text
2993 !! wikitext
2994 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2995 !! html
2996 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2997 <dd> OK, I made that up</dd></dl>
2998
2999 !! end
3000
3001 !! test
3002 Definition lists: colon in HTML attribute
3003 !! wikitext
3004 ;<b style="display: inline">bold</b>
3005 !! html
3006 <dl><dt><b style="display: inline">bold</b></dt></dl>
3007
3008 !! end
3009
3010 !! test
3011 Definition lists: self-closed tag
3012 !! wikitext
3013 ;one<br/>two : two-line fun
3014 !! html
3015 <dl><dt>one<br />two&#160;</dt>
3016 <dd> two-line fun</dd></dl>
3017
3018 !! end
3019
3020 !! test
3021 Bug 11748: Literal closing tags
3022 !! wikitext
3023 <dl>
3024 <dt>test 1</dt>
3025 <dd>test test test test test</dd>
3026 <dt>test 2</dt>
3027 <dd>test test test test test</dd>
3028 </dl>
3029 !! html
3030 <dl>
3031 <dt>test 1</dt>
3032 <dd>test test test test test</dd>
3033 <dt>test 2</dt>
3034 <dd>test test test test test</dd>
3035 </dl>
3036
3037 !! end
3038
3039 !! test
3040 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3041 !! wikitext
3042 <ul><li>
3043 ; term : description
3044 * unordered
3045 </li></ul>
3046 !! html
3047 <ul><li>
3048 <dl><dt> term&#160;</dt>
3049 <dd> description</dd></dl>
3050 <ul><li> unordered</li></ul>
3051 </li></ul>
3052
3053 !! end
3054
3055 !! test
3056
3057 Definition list with empty definition and following paragraph
3058 !! wikitext
3059 ; term:
3060 Paragraph text
3061 !! html
3062 <dl><dt> term</dt>
3063 <dd></dd></dl>
3064 <p>Paragraph text
3065 </p>
3066 !! end
3067
3068 !! test
3069 Nested definition lists using html syntax
3070 !! wikitext
3071 <dl><dt>x</dt>
3072 <dd>a</dd>
3073 <dd>b</dd></dl>
3074
3075 !! end
3076
3077 !! test
3078 Definition Lists: No nesting: Multiple dd's
3079 !! wikitext
3080 ;x
3081 :a
3082 :b
3083 !! html
3084 <dl><dt>x</dt>
3085 <dd>a</dd>
3086 <dd>b</dd></dl>
3087
3088 !! end
3089
3090 !! test
3091 Definition Lists: Indentation: Regular
3092 !! wikitext
3093 :i1
3094 ::i2
3095 :::i3
3096 !! html
3097 <dl><dd>i1
3098 <dl><dd>i2
3099 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3100
3101 !! end
3102
3103 !! test
3104 Definition Lists: Indentation: Missing 1st level
3105 !! wikitext
3106 ::i2
3107 :::i3
3108 !! html
3109 <dl><dd><dl><dd>i2
3110 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3111
3112 !! end
3113
3114 !! test
3115 Definition Lists: Indentation: Multi-level indent
3116 !! wikitext
3117 :::i3
3118 !! html
3119 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3120
3121 !! end
3122
3123 !! test
3124 Definition Lists: Hacky use to indent tables
3125 !! wikitext
3126 ::{|
3127 |foo
3128 |bar
3129 |}
3130 this text
3131 should be left alone
3132 !! html
3133 <dl><dd><dl><dd><table>
3134 <tr>
3135 <td>foo
3136 </td>
3137 <td>bar
3138 </td></tr></table></dd></dl></dd></dl>
3139 <p>this text
3140 should be left alone
3141 </p>
3142 !! end
3143
3144 !! test
3145 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3146 !! wikitext
3147 <!-- foo -->
3148 ::{|
3149 |foo
3150 |bar
3151 |}<!-- bar -->
3152 this text
3153 should be left alone
3154 !! html/parsoid
3155 <!-- foo -->
3156 <dl><dd><dl><dd><table><tr>
3157 <td>foo</td>
3158 <td>bar</td>
3159 </tr></table><!-- bar --></dd></dl></dd></dl>
3160 <p>this text
3161 should be left alone</p>
3162 !! end
3163
3164 !! test
3165 Definition Lists: Hacky use to indent tables, with comment before table
3166 !! wikitext
3167 ::<!-- foo -->{|
3168 |foo
3169 |}
3170 !! html/parsoid
3171 <dl><dd><dl><dd><!-- foo --><table><tr>
3172 <td>foo</td>
3173 </tr></table></dd></dl></dd></dl>
3174 !! end
3175
3176 # Bug 52473
3177 !! test
3178 Definition Lists: Hacky use to indent tables (WS-insensitive)
3179 !! options
3180 parsoid
3181 !! wikitext
3182 : {|
3183 |a
3184 |}
3185 !! html
3186 <dl>
3187 <dd> <table><tr><td>a</td></tr></table> </dd>
3188 </dl>
3189 !! end
3190 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3191 ## as an empty dt item. It also ignores all but the last ";" when followed
3192 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3193 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3194 ## ";"s.
3195 ##
3196 ## Ex: ";;t2 ::d2" is transformed into:
3197 ##
3198 ## <dl>
3199 ## <dt>t2 </dt>
3200 ## <dd>
3201 ## <dl>
3202 ## <dt></dt>
3203 ## <dd>d2</dd>
3204 ## </dl>
3205 ## </dd>
3206 ## </dl>
3207 ##
3208 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3209 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3210 ##
3211 ## <dl>
3212 ## <dt>
3213 ## <dl>
3214 ## <dt>t2 </dt>
3215 ## <dd>:d2</dd>
3216 ## </dl>
3217 ## </dt>
3218 ## </dl>
3219 ##
3220 ## All Parsoid only definition list tests have this difference.
3221 ##
3222 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3223 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3224
3225 !! test
3226 Table / list interaction: indented table with lists in table contents
3227 !! wikitext
3228 :{|
3229 |-
3230 | a
3231 * b
3232 |-
3233 | c
3234 * d
3235 |}
3236 !! html
3237 <dl><dd><table>
3238
3239 <tr>
3240 <td> a
3241 <ul><li> b</li></ul>
3242 </td></tr>
3243 <tr>
3244 <td> c
3245 <ul><li> d</li></ul>
3246 </td></tr></table></dd></dl>
3247
3248 !! end
3249
3250 !!test
3251 Table / list interaction: lists nested in tables nested in indented lists
3252 !! wikitext
3253 :{|
3254 |
3255 :a
3256 :b
3257 |
3258 *c
3259 *d
3260 |}
3261
3262 *e
3263 *f
3264 !! html
3265 <dl><dd><table>
3266 <tr>
3267 <td>
3268 <dl><dd>a</dd>
3269 <dd>b</dd></dl>
3270 </td>
3271 <td>
3272 <ul><li>c</li>
3273 <li>d</li></ul>
3274 </td></tr></table></dd></dl>
3275 <ul><li>e</li>
3276 <li>f</li></ul>
3277
3278 !!end
3279
3280 !! test
3281 Definition Lists: Nesting: Multi-level (Parsoid only)
3282 !! options
3283 parsoid
3284 !! wikitext
3285 ;t1 :d1
3286 ;;t2 ::d2
3287 ;;;t3 :::d3
3288 !! html
3289 <dl>
3290 <dt>t1 </dt>
3291 <dd>d1</dd>
3292 <dt>
3293 <dl>
3294 <dt>t2 </dt>
3295 <dd>:d2</dd>
3296 <dt>
3297 <dl>
3298 <dt>t3 </dt>
3299 <dd>::d3</dd>
3300 </dl>
3301 </dt>
3302 </dl>
3303 </dt>
3304 </dl>
3305
3306
3307 !! end
3308
3309
3310 !! test
3311 Definition Lists: Nesting: Test 2 (Parsoid only)
3312 !! options
3313 parsoid
3314 !! wikitext
3315 ;t1
3316 ::d2
3317 !! html
3318 <dl>
3319 <dt>t1</dt>
3320 <dd>
3321 <dl>
3322 <dd>d2</dd>
3323 </dl>
3324 </dd>
3325 </dl>
3326
3327 !! end
3328
3329
3330 !! test
3331 Definition Lists: Nesting: Test 3 (Parsoid only)
3332 !! options
3333 parsoid
3334 !! wikitext
3335 :;t1
3336 ::::d2
3337 !! html
3338 <dl>
3339 <dd>
3340 <dl>
3341 <dt>t1</dt>
3342 <dd>
3343 <dl>
3344 <dd>
3345 <dl>
3346 <dd>d2</dd>
3347 </dl>
3348 </dd>
3349 </dl>
3350 </dd>
3351 </dl>
3352 </dd>
3353 </dl>
3354
3355 !! end
3356
3357
3358 !! test
3359 Definition Lists: Nesting: Test 4
3360 !! wikitext
3361 ::;t3
3362 :::d3
3363 !! html
3364 <dl><dd><dl><dd><dl><dt>t3</dt>
3365 <dd>d3</dd></dl></dd></dl></dd></dl>
3366
3367 !! end
3368
3369
3370 ## The Parsoid team believes the following three test exposes a
3371 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3372 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3373 !! test
3374 Definition Lists: Mixed Lists: Test 1
3375 !! wikitext
3376 :;* foo
3377 ::* bar
3378 :; baz
3379 !! html/php
3380 <dl><dd><dl><dt><ul><li> foo</li>
3381 <li> bar</li></ul></dt></dl>
3382 <dl><dt> baz</dt></dl></dd></dl>
3383
3384 !! html/parsoid
3385 <dl>
3386 <dd><dl>
3387 <dt><ul>
3388 <li> foo
3389 </li>
3390 </ul></dt>
3391 <dd><ul>
3392 <li> bar
3393 </li>
3394 </ul></dd>
3395 <dt> baz</dt>
3396 </dl></dd>
3397 </dl>
3398 !! end
3399
3400 !! test
3401 Definition Lists: Mixed Lists: Test 2
3402 !! wikitext
3403 *: d1
3404 *: d2
3405 !! html
3406 <ul><li><dl><dd> d1</dd>
3407 <dd> d2</dd></dl></li></ul>
3408
3409 !! end
3410
3411
3412 !! test
3413 Definition Lists: Mixed Lists: Test 3
3414 !! wikitext
3415 *::: d1
3416 *::: d2
3417 !! html
3418 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3419 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3420
3421 !! end
3422
3423
3424 !! test
3425 Definition Lists: Mixed Lists: Test 4
3426 !! wikitext
3427 *;d1 :d2
3428 *;d3 :d4
3429 !! html
3430 <ul><li><dl><dt>d1&#160;</dt>
3431 <dd>d2</dd>
3432 <dt>d3&#160;</dt>
3433 <dd>d4</dd></dl></li></ul>
3434
3435 !! end
3436
3437
3438 !! test
3439 Definition Lists: Mixed Lists: Test 5
3440 !! wikitext
3441 *:d1
3442 *:: d2
3443 !! html
3444 <ul><li><dl><dd>d1
3445 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3446
3447 !! end
3448
3449
3450 !! test
3451 Definition Lists: Mixed Lists: Test 6
3452 !! wikitext
3453 #*:d1
3454 #*::: d3
3455 !! html
3456 <ol><li><ul><li><dl><dd>d1
3457 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3458
3459 !! end
3460
3461
3462 !! test
3463 Definition Lists: Mixed Lists: Test 7
3464 !! wikitext
3465 :* d1
3466 :* d2
3467 !! html
3468 <dl><dd><ul><li> d1</li>
3469 <li> d2</li></ul></dd></dl>
3470
3471 !! end
3472
3473
3474 !! test
3475 Definition Lists: Mixed Lists: Test 8
3476 !! wikitext
3477 :* d1
3478 ::* d2
3479 !! html
3480 <dl><dd><ul><li> d1</li></ul>
3481 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3482
3483 !! end
3484
3485
3486 !! test
3487 Definition Lists: Mixed Lists: Test 9
3488 !! wikitext
3489 *;foo :bar
3490 !! html
3491 <ul><li><dl><dt>foo&#160;</dt>
3492 <dd>bar</dd></dl></li></ul>
3493
3494 !! end
3495
3496
3497 !! test
3498 Definition Lists: Mixed Lists: Test 10
3499 !! wikitext
3500 *#;foo :bar
3501 !! html
3502 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3503 <dd>bar</dd></dl></li></ol></li></ul>
3504
3505 !! end
3506
3507 # The Parsoid team disagrees with the PHP parser's seemingly-random
3508 # rules regarding dd/dt on the next two tests. Parsoid is more
3509 # consistent, and recognizes the shared nesting and keeps the
3510 # still-open tags around until the nesting is complete.
3511
3512 !! test
3513 Definition Lists: Mixed Lists: Test 11
3514 !! wikitext
3515 *#*#;*;;foo :bar
3516 *#*#;boo :baz
3517 !! html/php
3518 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3519 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3520 <dl><dt>boo&#160;</dt>
3521 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3522
3523 !! html/parsoid
3524 <ul>
3525 <li>
3526 <ol>
3527 <li>
3528 <ul>
3529 <li>
3530 <ol>
3531 <li>
3532 <dl>
3533 <dt>
3534 <ul>
3535 <li>
3536 <dl>
3537 <dt>
3538 <dl>
3539 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3540 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3541 </dl></dt>
3542 </dl></li>
3543 </ul></dt>
3544 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3545 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3546 </dl></li>
3547 </ol></li>
3548 </ul></li>
3549 </ol></li>
3550 </ul>
3551 !! end
3552
3553
3554 !! test
3555 Definition Lists: Weird Ones: Test 1
3556 !! wikitext
3557 *#;*::;; foo : bar (who uses this?)
3558 !! html/php
3559 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3560 <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>
3561
3562 !! html/parsoid
3563 <ul>
3564 <li>
3565 <ol>
3566 <li>
3567 <dl>
3568 <dt>
3569 <ul>
3570 <li>
3571 <dl>
3572 <dd>
3573 <dl>
3574 <dd>
3575 <dl>
3576 <dt>
3577 <dl>
3578 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3579 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3580 </dl></dt>
3581 </dl></dd>
3582 </dl></dd>
3583 </dl></li>
3584 </ul></dt>
3585 </dl></li>
3586 </ol></li>
3587 </ul>
3588 !! end
3589
3590 ###
3591 ### External links
3592 ###
3593 !! test
3594 External links: non-bracketed
3595 !! wikitext
3596 Non-bracketed: http://example.com
3597 !! html
3598 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3599 </p>
3600 !! end
3601
3602 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3603 !! test
3604 External links: numbered
3605 !! wikitext
3606 Numbered: [http://example.com]
3607 Numbered: [http://example.net]
3608 Numbered: [http://example.com]
3609 !! html/php
3610 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3611 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3612 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3613 </p>
3614 !! html/parsoid
3615 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3616 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3617 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3618 !!end
3619
3620 !! test
3621 External links: specified text
3622 !! wikitext
3623 Specified text: [http://example.com link]
3624 !! html
3625 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3626 </p>
3627 !!end
3628
3629 !! test
3630 External links: trail
3631 !! wikitext
3632 Linktrails should not work for external links: [http://example.com link]s
3633 !! html
3634 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3635 </p>
3636 !! end
3637
3638 !! test
3639 External links: dollar sign in URL
3640 !! wikitext
3641 http://example.com/1$2345
3642 !! html
3643 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3644 </p>
3645 !! end
3646
3647 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3648 !! test
3649 External links: dollar sign in URL (autonumber)
3650 !! wikitext
3651 [http://example.com/1$2345]
3652 !! html/php
3653 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3654 </p>
3655 !! html/parsoid
3656 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3657 !!end
3658
3659 !! test
3660 External links: open square bracket forbidden in URL (bug 4377)
3661 !! options
3662 parsoid=wt2html,wt2wt,html2html
3663 !! wikitext
3664 http://example.com/1[2345
3665 !! html/php
3666 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3667 </p>
3668 !! html/parsoid
3669 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3670 !! end
3671
3672 !! test
3673 External links: open square bracket forbidden in URL (named) (bug 4377)
3674 !! options
3675 parsoid=wt2html,html2html
3676 !! wikitext
3677 [http://example.com/1[2345]
3678 !! html/php
3679 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3680 </p>
3681 !! html/parsoid
3682 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3683 !!end
3684
3685 # parsoid adds a space before the link name
3686 !! test
3687 External links: open square bracket forbidden in URL (named) (bug 4377)
3688 Parsoid variant.
3689 !! wikitext
3690 [http://example.com/1 [2345]
3691 !! html
3692 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3693 </p>
3694 !!end
3695
3696 !! test
3697 External links: nowiki in URL link text (bug 6230)
3698 !! wikitext
3699 [http://example.com/ <nowiki>''example site''</nowiki>]
3700 !! html
3701 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3702 </p>
3703 !! end
3704
3705 !! test
3706 External links: newline forbidden in text (bug 6230 regression check)
3707 !! wikitext
3708 [http://example.com/ first
3709 second]
3710 !! html
3711 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3712 second]
3713 </p>
3714 !!end
3715
3716 !! test
3717 External links: Pipe char between url and text
3718 !! wikitext
3719 [http://example.com | link]
3720 !! html
3721 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3722 </p>
3723 !!end
3724
3725 !! test
3726 External links: protocol-relative URL in brackets
3727 !! wikitext
3728 [//example.com/ Test]
3729 !! html
3730 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3731 </p>
3732 !! end
3733
3734 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3735 !! test
3736 External links: protocol-relative URL in brackets without text
3737 !! wikitext
3738 [//example.com]
3739 !! html/php
3740 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3741 </p>
3742 !! html/parsoid
3743 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3744 !! end
3745
3746 !! test
3747 External links: protocol-relative URL in free text is left alone
3748 !! wikitext
3749 //example.com/Foo
3750 !! html
3751 <p>//example.com/Foo
3752 </p>
3753 !!end
3754
3755 !! test
3756 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3757 !! wikitext
3758 foo//example.com/Foo
3759 !! html
3760 <p>foo//example.com/Foo
3761 </p>
3762 !! end
3763
3764 !! test
3765 External links: with no contents
3766 !! wikitext
3767 [http://en.wikipedia.org/wiki/Foo]
3768
3769 [[wikipedia:Foo|Bar]]
3770
3771 [[wikipedia:Foo|<span>Bar</span>]]
3772 !! html/parsoid
3773 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3774 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3775 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3776 !! end
3777
3778 !! test
3779 External image
3780 !! wikitext
3781 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3782 !! html
3783 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3784 </p>
3785 !! end
3786
3787 !! test
3788 External image from https
3789 !! wikitext
3790 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3791 !! html
3792 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3793 </p>
3794 !! end
3795
3796 !! test
3797 External image (when not allowed)
3798 !! options
3799 wgAllowExternalImages=0
3800 !! wikitext
3801 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3802 !! html
3803 <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>
3804 </p>
3805 !! end
3806
3807 !! test
3808 Link to non-http image, no img tag
3809 !! wikitext
3810 Link to non-http image, no img tag: ftp://example.com/test.jpg
3811 !! html
3812 <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>
3813 </p>
3814 !! end
3815
3816 !! test
3817 External links: terminating separator
3818 !! wikitext
3819 Terminating separator: http://example.com/thing,
3820 !! html
3821 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3822 </p>
3823 !! end
3824
3825 !! test
3826 External links: intervening separator
3827 !! wikitext
3828 Intervening separator: http://example.com/1,2,3
3829 !! html
3830 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3831 </p>
3832 !! end
3833
3834 !! test
3835 External links: old bug with URL in query
3836 !! wikitext
3837 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3838 !! html
3839 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3840 </p>
3841 !! end
3842
3843 !! test
3844 External links: old URL-in-URL bug, mixed protocols
3845 !! wikitext
3846 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3847 !! html
3848 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3849 </p>
3850 !!end
3851
3852 !! test
3853 External links: URL in text
3854 !! wikitext
3855 URL in text: [http://example.com http://example.com]
3856 !! html
3857 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3858 </p>
3859 !! end
3860
3861 !! test
3862 External links: Clickable images
3863 !! wikitext
3864 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3865 !! html
3866 <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>
3867 </p>
3868 !!end
3869
3870 !! test
3871 External links: raw ampersand
3872 !! wikitext
3873 Old &amp; use: http://x&y
3874 !! html
3875 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3876 </p>
3877 !! end
3878
3879 !! test
3880 External links: encoded ampersand
3881 !! wikitext
3882 Old &amp; use: http://x&amp;y
3883 !! html/php
3884 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3885 </p>
3886 !! html/parsoid
3887 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3888 !! end
3889
3890 !! test
3891 External links: encoded equals (bug 6102)
3892 !! wikitext
3893 http://example.com/?foo&#61;bar
3894 !! html/php
3895 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3896 </p>
3897 !! html/parsoid
3898 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3899 !! end
3900
3901 ##
3902 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3903 ## does it number them. As discussed in bug 53505, we can identify
3904 ## autonumbered links via CSS.
3905 ##
3906
3907 !! test
3908 External links: [raw ampersand]
3909 !! wikitext
3910 Old &amp; use: [http://x&y]
3911 !! html/php
3912 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3913 </p>
3914 !! html/parsoid
3915 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3916 !! end
3917
3918 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3919 # mode will return the [raw ampersand] wikitext
3920 !! test
3921 External links: [encoded ampersand]
3922 !! options
3923 parsoid=wt2html,wt2wt,html2html
3924 !! wikitext
3925 Old &amp; use: [http://x&amp;y]
3926 !! html/php
3927 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3928 </p>
3929 !! html/parsoid
3930 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3931 !! end
3932
3933 !! test
3934 External links: [raw equals]
3935 !! wikitext
3936 [http://example.com/?foo=bar]
3937 !! html/php
3938 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3939 </p>
3940 !! html/parsoid
3941 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3942 !! end
3943
3944 # note that parsoid html is identical to [raw equals] case; so html2wt
3945 # mode will return the [raw equals] wikitext
3946 !! test
3947 External links: [encoded equals] (bug 6102)
3948 !! options
3949 parsoid=wt2html,wt2wt,html2html
3950 !! wikitext
3951 [http://example.com/?foo&#61;bar]
3952 !! html/php
3953 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3954 </p>
3955 !! html/parsoid
3956 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3957 !! end
3958
3959 # xxx parsoid strips the IDN character, so the round-trip tests will
3960 # obviously fail and are disabled. --cscott
3961 !! test
3962 External links: [IDN ignored character reference in hostname; strip it right off]
3963 !! options
3964 parsoid=wt2html,wt2wt,html2html
3965 !! wikitext
3966 [http://e&zwnj;xample.com/]
3967 !! html/php
3968 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3969 </p>
3970 !! html/parsoid
3971 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3972 !! end
3973
3974 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3975 # Where an external link could easily circumvent the sanitization of the text of
3976 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3977 # test demands a higher standard. That's a bit strange.
3978 #
3979 # Example:
3980 #
3981 # http://e‌xample.com -> [http://example.com|http://example.com]
3982 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3983 #
3984 # The first example is sanitized, but the second is not. Any security benefits
3985 # from this production are trivial to circumvent. Either remove this test and
3986 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3987 # the test accordingly.
3988 #
3989 # All our love,
3990 # The Parsoid team.
3991 # xxx parsoid strips the IDN character, so the round-trip tests will
3992 # obviously fail and are disabled. --cscott
3993 !! test
3994 External links: IDN ignored character reference in hostname; strip it right off
3995 !! options
3996 parsoid=wt2html,html2html
3997 !! wikitext
3998 http://e&zwnj;xample.com/
3999 !! html/php
4000 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4001 </p>
4002 !! html/parsoid
4003 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4004 !! end
4005
4006 !! test
4007 External links: www.jpeg.org (bug 554)
4008 !! wikitext
4009 http://www.jpeg.org
4010 !! html
4011 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4012 </p>
4013 !! end
4014
4015 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4016 !! test
4017 External links: URL within URL (original bug 2)
4018 !! wikitext
4019 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4020 !! html/php
4021 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4022 </p>
4023 !! html/parsoid
4024 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4025 !! end
4026
4027 !! test
4028 BUG 361: URL inside bracketed URL
4029 !! wikitext
4030 [http://www.example.com/foo http://www.example.com/bar]
4031 !! html
4032 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4033 </p>
4034 !! end
4035
4036 !! test
4037 BUG 361: URL within URL, not bracketed
4038 !! wikitext
4039 http://www.example.com/foo?=http://www.example.com/bar
4040 !! html
4041 <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>
4042 </p>
4043 !! end
4044
4045 !! test
4046 BUG 289: ">"-token in URL-tail
4047 !! wikitext
4048 http://www.example.com/<hello>
4049 !! html
4050 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4051 </p>
4052 !!end
4053
4054 !! test
4055 BUG 289: literal ">"-token in URL-tail
4056 !! wikitext
4057 http://www.example.com/<b>html</b>
4058 !! html
4059 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4060 </p>
4061 !!end
4062
4063 !! test
4064 BUG 289: ">"-token in bracketed URL
4065 !! wikitext
4066 [http://www.example.com/<hello> stuff]
4067 !! html
4068 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4069 </p>
4070 !!end
4071
4072 !! test
4073 BUG 289: literal ">"-token in bracketed URL
4074 !! wikitext
4075 [http://www.example.com/<b>html</b> stuff]
4076 !! html
4077 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4078 </p>
4079 !!end
4080
4081 !! test
4082 BUG 289: literal double quote at end of URL
4083 !! wikitext
4084 http://www.example.com/"hello"
4085 !! html
4086 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4087 </p>
4088 !!end
4089
4090 !! test
4091 BUG 289: literal double quote in bracketed URL
4092 !! wikitext
4093 [http://www.example.com/"hello" stuff]
4094 !! html
4095 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4096 </p>
4097 !!end
4098
4099 !! test
4100 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4101 !! wikitext
4102 [http://www.example.com test]
4103 !! html
4104 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4105 </p>
4106 !! end
4107
4108 !! test
4109 External links: link text with spaces
4110 !! wikitext
4111 [http://www.example.com a b c]
4112 [http://www.example.com ''a'' ''b'']
4113 !! html
4114 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4115 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4116 </p>
4117 !! end
4118
4119 !! test
4120 External links: wiki links within external link (Bug 3695)
4121 !! wikitext
4122 [http://example.com [[wikilink]] embedded in ext link]
4123 !! html/php
4124 <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>
4125 </p>
4126 !! html/parsoid
4127 <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>
4128 !! end
4129
4130 !! test
4131 BUG 787: Links with one slash after the url protocol are invalid
4132 !! wikitext
4133 http:/example.com
4134
4135 [http:/example.com title]
4136 !! html
4137 <p>http:/example.com
4138 </p><p>[http:/example.com title]
4139 </p>
4140 !! end
4141
4142 !! test
4143 Bracketed external links with template-generated invalid target
4144 !! wikitext
4145 [{{echo|http:/example.com}} title]
4146 !! html
4147 <p>[http:/example.com title]
4148 </p>
4149 !! end
4150
4151 !! test
4152 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4153 !! wikitext
4154 ''[http://example.com text'']
4155 [http://example.com '''text]'''
4156 ''Something [http://example.com in italic'']
4157 ''Something [http://example.com mixed''''', even bold]'''
4158 '''''Now [http://example.com both''''']
4159 !! html
4160 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4161 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4162 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4163 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4164 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4165 </p>
4166 !! end
4167
4168
4169 !! test
4170 Bug 4781: %26 in URL
4171 !! wikitext
4172 http://www.example.com/?title=AT%26T
4173 !! html/php
4174 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4175 </p>
4176 !! html/parsoid
4177 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4178 !! end
4179
4180 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4181 # % is actually legal in HTML5. Any change in output would need testing though.
4182 !! test
4183 Bug 4781, 5267: %25 in URL
4184 !! wikitext
4185 http://www.example.com/?title=100%25_Bran
4186 !! html/php
4187 <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>
4188 </p>
4189 !! html/parsoid
4190 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4191 !! end
4192
4193 !! test
4194 Bug 4781, 5267: %28, %29 in URL
4195 !! wikitext
4196 http://www.example.com/?title=Ben-Hur_%281959_film%29
4197 !! html/php
4198 <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>
4199 </p>
4200 !! html/parsoid
4201 <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>
4202 !! end
4203
4204
4205 !! test
4206 Bug 4781: %26 in autonumber URL
4207 !! wikitext
4208 [http://www.example.com/?title=AT%26T]
4209 !! html/php
4210 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4211 </p>
4212 !! html/parsoid
4213 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4214 !! end
4215
4216 !! test
4217 Bug 4781, 5267: %26 in autonumber URL
4218 !! wikitext
4219 [http://www.example.com/?title=100%25_Bran]
4220 !! html/php
4221 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4222 </p>
4223 !! html/parsoid
4224 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4225 !! end
4226
4227 !! test
4228 Bug 4781, 5267: %28, %29 in autonumber URL
4229 !! wikitext
4230 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4231 !! html/php
4232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4233 </p>
4234 !! html/parsoid
4235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4236 !! end
4237
4238
4239 !! test
4240 Bug 4781: %26 in bracketed URL
4241 !! wikitext
4242 [http://www.example.com/?title=AT%26T link]
4243 !! html/php
4244 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4245 </p>
4246 !! html/parsoid
4247 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4248 !! end
4249
4250 !! test
4251 Bug 4781, 5267: %25 in bracketed URL
4252 !! wikitext
4253 [http://www.example.com/?title=100%25_Bran link]
4254 !! html
4255 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4256 </p>
4257 !! end
4258
4259 !! test
4260 Bug 4781, 5267: %28, %29 in bracketed URL
4261 !! wikitext
4262 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4263 !! html/php
4264 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4265 </p>
4266 !! html/parsoid
4267 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4268 !! end
4269
4270 !! test
4271 External link containing a period in the anchor. (bug 63947)
4272 !! wikitext
4273 [//foo.org/bar#baz. bang]
4274
4275 [//foo.org/bar. bang]
4276 !! html/php
4277 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4278 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4279 </p>
4280 !! html/parsoid
4281 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4282 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4283 !! end
4284
4285 !! test
4286 External link containing a single quote. (bug 63947)
4287 !! wikitext
4288 [//foo.org/bar'baz]
4289
4290 [//foo.org/bar'baz bang]
4291 !! html/php
4292 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4293 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4294 </p>
4295 !! html/parsoid
4296 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4297 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4298 !! end
4299
4300
4301 !! test
4302 External link containing a period in the anchor. (bug 63947)
4303 !! wikitext
4304 [//foo.org/bar#baz. bang]
4305
4306 [//foo.org/bar. bang]
4307 !! html/php
4308 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4309 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4310 </p>
4311 !! html/parsoid
4312 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4313 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4314 !! end
4315
4316 !! test
4317 External link containing a single quote. (bug 63947)
4318 !! wikitext
4319 [//foo.org/bar'baz]
4320
4321 [//foo.org/bar'baz bang]
4322 !! html/php
4323 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4324 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4325 </p>
4326 !! html/parsoid
4327 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4328 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4329 !! end
4330
4331
4332 !! test
4333 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4334 !! wikitext
4335 Some [http://example.com/ pretty ''italics'' and stuff]!
4336 !! html
4337 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4338 </p>
4339 !! end
4340
4341 !! test
4342 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4343 !! wikitext
4344 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4345 !! html
4346 <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>
4347 </p>
4348 !! end
4349
4350 !! test
4351 External link containing double-single-quotes with no space separating the url from text in italics
4352 !! wikitext
4353 [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]].]
4354 !! html/php
4355 <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>
4356 </p>
4357 !! html/parsoid
4358 <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>
4359 !! end
4360
4361 !! test
4362 External link with comments in link text
4363 !! wikitext
4364 [http://www.google.com Google <!-- comment -->]
4365 !! html
4366 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4367 </p>
4368 !! end
4369
4370 !! test
4371 URL-encoding in URL functions (single parameter)
4372 !! wikitext
4373 {{localurl:Some page|amp=&}}
4374 !! html
4375 <p>/index.php?title=Some_page&amp;amp=&amp;
4376 </p>
4377 !! end
4378
4379 !! test
4380 URL-encoding in URL functions (multiple parameters)
4381 !! wikitext
4382 {{localurl:Some page|q=?&amp=&}}
4383 !! html
4384 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4385 </p>
4386 !! end
4387
4388 !! test
4389 Brackets in urls
4390 !! wikitext
4391 http://example.com/index.php?foozoid%5B%5D=bar
4392
4393 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4394 !! html/php
4395 <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>
4396 </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>
4397 </p>
4398 !! html/parsoid
4399 <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>
4400
4401 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4402 !! end
4403
4404 !! test
4405 IPv6 urls (bug 21261)
4406 !! options
4407 disabled
4408 !! wikitext
4409 http://[2404:130:0:1000::187:2]/index.php
4410 !! html
4411 <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>
4412 </p>
4413 !! end
4414
4415 !! test
4416 Non-extlinks in brackets
4417 !! wikitext
4418 [foo]
4419 [foo bar]
4420 [foo ''bar'']
4421 [fool's] errand
4422 [fool's errand]
4423 [{{echo|foo}}]
4424 [{{echo|foo}} bar]
4425 [{{echo|foo}} ''bar'']
4426 [{{echo|foo}}l's] errand
4427 [{{echo|foo}}l's errand]
4428 [url={{echo|foo}}]
4429 [url=http://example.com]
4430 !! html
4431 <p>[foo]
4432 [foo bar]
4433 [foo <i>bar</i>]
4434 [fool's] errand
4435 [fool's errand]
4436 [foo]
4437 [foo bar]
4438 [foo <i>bar</i>]
4439 [fool's] errand
4440 [fool's errand]
4441 [url=foo]
4442 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4443 </p>
4444 !! end
4445
4446 !! test
4447 Percent encoding in external links
4448 !! wikitext
4449 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4450 !! html/php
4451 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4452 </p>
4453 !! html/parsoid
4454 <p><a rel="mw:ExtLink"
4455 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4456 !! end
4457
4458 !! test
4459 Use url link syntax for links where the content is equal the link target
4460 !! wikitext
4461 http://example.com
4462 !! html/php
4463 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4464 </p>
4465 !! html/parsoid
4466 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4467 !! end
4468
4469 !! test
4470 Parenthesis in external links, especially URL links
4471 !! wikitext
4472 http://example.com)
4473
4474 http://example.com/test)
4475
4476 http://example.com/(test)
4477
4478 http://example.com/((test)
4479
4480 (http://example.com/(test))
4481
4482 (http://example.com/(test)))))
4483
4484 http://example.com/a)b
4485
4486 [http://example.com) foo]
4487 !! html/php
4488 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4489 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4490 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4491 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4492 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4493 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4494 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4495 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4496 </p>
4497 !! html/parsoid
4498 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4499 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4500 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4501 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4502 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4503 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4504 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4505 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4506 !! end
4507
4508 !! test
4509 Parenthesis in external links, w/ transclusion or comment
4510 !! wikitext
4511 (http://example.com/{{echo|hi}})
4512
4513 (http://example.com<!-- hi -->)
4514 !! html/php
4515 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4516 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4517 </p>
4518 !! html/parsoid
4519 <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>
4520
4521 <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>
4522 !! end
4523
4524 !! test
4525 Replace invalid link targets when serializing
4526 !! options
4527 parsoid=html2wt
4528 !! html
4529 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4530 !! wikitext
4531 [[MediaWiki:Badtitletext|Manual]]
4532 !! end
4533
4534 ###
4535 ### Quotes
4536 ###
4537
4538 !! test
4539 Quotes
4540 !! wikitext
4541 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4542
4543 Normal text. '''''Bold italic text.''''' Normal text.
4544 !! html
4545 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4546 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4547 </p>
4548 !! end
4549
4550
4551 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4552 # parser strips. The wikitext contains just the first half of the bold
4553 # quote pair.
4554 !! test
4555 Unclosed and unmatched quotes
4556 !! wikitext
4557 '''''Bold italic text '''with bold deactivated''' in between.'''''
4558
4559 '''''Bold italic text ''with italic deactivated'' in between.'''''
4560
4561 '''Bold text..
4562
4563 ..spanning two paragraphs (should not work).'''
4564
4565 '''Bold tag left open
4566
4567 ''Italic tag left open
4568
4569 Normal text.
4570
4571 <!-- Unmatching number of opening, closing tags: -->
4572 '''This year''''s election ''should'' beat '''last year''''s.
4573
4574 ''Tom'''s car is bigger than ''Susan'''s.
4575
4576 Plain ''italic'''s plain
4577 !! html/php
4578 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4579 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4580 </p><p><b>Bold text..</b>
4581 </p><p>..spanning two paragraphs (should not work).
4582 </p><p><b>Bold tag left open</b>
4583 </p><p><i>Italic tag left open</i>
4584 </p><p>Normal text.
4585 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4586 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4587 </p><p>Plain <i>italic'</i>s plain
4588 </p>
4589 !! html/parsoid
4590 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4591 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4592 </p><p><b>Bold text..</b>
4593 </p><p>..spanning two paragraphs (should not work).<b></b>
4594 </p><p><b>Bold tag left open</b>
4595 </p><p><i>Italic tag left open</i>
4596 </p><p>Normal text.
4597 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4598 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4599 </p><p>Plain <i>italic'</i>s plain
4600 </p>
4601 !! end
4602
4603 ###
4604 ### Tables
4605 ###
4606 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4607 ###
4608
4609 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4610 # is the bare minimum required by the spec, see:
4611 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4612 # Parsoid team replies: empty table tags are legal in HTML5
4613 !! test
4614 A table with no data.
4615 !! options
4616 parsoid=wt2html
4617 !! wikitext
4618 {||}
4619 !! html/php
4620
4621 !! html/parsoid
4622 <table></table>
4623
4624 !! end
4625
4626 !! test
4627 A table with stray table end tags on start tag line (wt2html)
4628 !! options
4629 parsoid=wt2html
4630 !! wikitext
4631 {|style="color: red;"|}
4632
4633 {|style="color: red;" |}
4634 |foo
4635 |}
4636
4637 {|style="color: red;"|} id="foo"
4638 |foo
4639 |}
4640
4641 {|style="color: red;" |} id="foo"
4642 |foo
4643 |}
4644 !! html
4645 <table style="color: red;"></table>
4646
4647 <table style="color: red;">
4648 <tbody><tr>
4649 <td>foo</td>
4650 </tr></tbody>
4651 </table>
4652
4653 <table style="color: red;" id="foo">
4654 <tbody><tr>
4655 <td>foo</td>
4656 </tr></tbody>
4657 </table>
4658
4659 <table style="color: red;" id="foo">
4660 <tbody><tr>
4661 <td>foo</td>
4662 </tr></tbody>
4663 </table>
4664
4665 !! end
4666
4667 !! test
4668 A table with no data (take 2)
4669 !! wikitext
4670 {|
4671 |}
4672 !! html/parsoid
4673 <table></table>
4674 !! end
4675
4676 # A table with nothing but a caption is invalid XHTML, we might want to render
4677 # this as <p>caption</p>
4678 # Parsoid team replies: table with only a caption is legal in HTML5
4679 !! test
4680 A table with nothing but a caption
4681 !! wikitext
4682 {|
4683 |+ caption
4684 |}
4685 !! html/php
4686 <table>
4687 <caption> caption
4688 </caption><tr><td></td></tr></table>
4689
4690 !! html/parsoid
4691 <table><caption> caption</caption></table>
4692 !! end
4693
4694 !! test
4695 A table with caption with default-spaced attributes and a table row
4696 !! wikitext
4697 {|
4698 |+ style="color: red;" | caption1
4699 |-
4700 | foo
4701 |}
4702 !! html
4703 <table>
4704 <caption style="color: red;"> caption1
4705 </caption>
4706 <tr>
4707 <td> foo
4708 </td></tr></table>
4709
4710 !! end
4711
4712 !! test
4713 A table with captions with non-default spaced attributes and a table row
4714 !! wikitext
4715 {|
4716 |+style="color: red;"|caption2
4717 |+ style="color: red;"| caption3
4718 |-
4719 | foo
4720 |}
4721 !! html
4722 <table>
4723 <caption style="color: red;">caption2
4724 </caption>
4725 <caption style="color: red;"> caption3
4726 </caption>
4727 <tr>
4728 <td> foo
4729 </td></tr></table>
4730
4731 !! end
4732
4733 !! test
4734 Table td-cell syntax variations
4735 !! wikitext
4736 {|
4737 | foo bar foo | baz
4738 | foo bar foo || baz
4739 | style='color:red;' | baz
4740 | style='color:red;' || baz
4741 |}
4742 !! html
4743 <table>
4744 <tr>
4745 <td> baz
4746 </td>
4747 <td> foo bar foo </td>
4748 <td> baz
4749 </td>
4750 <td style="color:red;"> baz
4751 </td>
4752 <td> style='color:red;' </td>
4753 <td> baz
4754 </td></tr></table>
4755
4756 !! end
4757
4758 !! test
4759 Simple table
4760 !! wikitext
4761 {|
4762 | 1 || 2
4763 |-
4764 | 3 || 4
4765 |}
4766 !! html
4767 <table>
4768 <tr>
4769 <td> 1 </td>
4770 <td> 2
4771 </td></tr>
4772 <tr>
4773 <td> 3 </td>
4774 <td> 4
4775 </td></tr></table>
4776
4777 !! end
4778
4779 !! test
4780 Simple table but with multiple dashes for row wikitext
4781 !! wikitext
4782 {|
4783 | foo
4784 |-----
4785 | bar
4786 |}
4787 !! html
4788 <table>
4789 <tr>
4790 <td> foo
4791 </td></tr>
4792 <tr>
4793 <td> bar
4794 </td></tr></table>
4795
4796 !! end
4797 !! test
4798 Multiplication table
4799 !! wikitext
4800 {| border="1" cellpadding="2"
4801 |+Multiplication table
4802 |-
4803 ! &times; !! 1 !! 2 !! 3
4804 |-
4805 ! 1
4806 | 1 || 2 || 3
4807 |-
4808 ! 2
4809 | 2 || 4 || 6
4810 |-
4811 ! 3
4812 | 3 || 6 || 9
4813 |-
4814 ! 4
4815 | 4 || 8 || 12
4816 |-
4817 ! 5
4818 | 5 || 10 || 15
4819 |}
4820 !! html
4821 <table border="1" cellpadding="2">
4822 <caption>Multiplication table
4823 </caption>
4824 <tr>
4825 <th> &#215; </th>
4826 <th> 1 </th>
4827 <th> 2 </th>
4828 <th> 3
4829 </th></tr>
4830 <tr>
4831 <th> 1
4832 </th>
4833 <td> 1 </td>
4834 <td> 2 </td>
4835 <td> 3
4836 </td></tr>
4837 <tr>
4838 <th> 2
4839 </th>
4840 <td> 2 </td>
4841 <td> 4 </td>
4842 <td> 6
4843 </td></tr>
4844 <tr>
4845 <th> 3
4846 </th>
4847 <td> 3 </td>
4848 <td> 6 </td>
4849 <td> 9
4850 </td></tr>
4851 <tr>
4852 <th> 4
4853 </th>
4854 <td> 4 </td>
4855 <td> 8 </td>
4856 <td> 12
4857 </td></tr>
4858 <tr>
4859 <th> 5
4860 </th>
4861 <td> 5 </td>
4862 <td> 10 </td>
4863 <td> 15
4864 </td></tr></table>
4865
4866 !! end
4867
4868 !! test
4869 Accept "||" in table headings
4870 !! wikitext
4871 {|
4872 !h1 || h2
4873 |}
4874 !! html
4875 <table>
4876 <tr>
4877 <th>h1 </th>
4878 <th> h2
4879 </th></tr></table>
4880
4881 !! end
4882
4883 !! test
4884 Accept "!!" in table data
4885 !! wikitext
4886 {|
4887 | Foo!! ||
4888 |}
4889 !! html/parsoid
4890 <table data-parsoid='{}'>
4891 <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>
4892 </tbody></table>
4893 !! end
4894
4895 !! test
4896 Accept "||" in indented table headings
4897 !! wikitext
4898 :{|
4899 !h1 || h2
4900 |}
4901 !! html
4902 <dl><dd><table>
4903 <tr>
4904 <th>h1 </th>
4905 <th> h2
4906 </th></tr></table></dd></dl>
4907
4908 !! end
4909
4910 !! test
4911 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4912 !! wikitext
4913 {|
4914 !| h1
4915 || a
4916 |}
4917 !! html
4918 <table>
4919 <tr>
4920 <th> h1
4921 </th>
4922 <td> a
4923 </td></tr></table>
4924
4925 !! end
4926
4927 !!test
4928 Accept "| !" at start of line in tables (ignore !-attribute)
4929 !! wikitext
4930 {|
4931 |-
4932 | !style="color:red" | bar
4933 |}
4934 !! html
4935 <table>
4936
4937 <tr>
4938 <td> bar
4939 </td></tr></table>
4940
4941 !!end
4942
4943 !!test
4944 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 +/-
4945 !! wikitext
4946 {|
4947 |-
4948 |style='color:red;'|+1
4949 |style='color:blue;'|-1
4950 |-
4951 | 1 || 2 || 3
4952 | 1 ||+2 ||-3
4953 |-
4954 | +1
4955 | -1
4956 |}
4957 !! html
4958 <table>
4959
4960 <tr>
4961 <td style="color:red;">+1
4962 </td>
4963 <td style="color:blue;">-1
4964 </td></tr>
4965 <tr>
4966 <td> 1 </td>
4967 <td> 2 </td>
4968 <td> 3
4969 </td>
4970 <td> 1 </td>
4971 <td>+2 </td>
4972 <td>-3
4973 </td></tr>
4974 <tr>
4975 <td> +1
4976 </td>
4977 <td> -1
4978 </td></tr></table>
4979
4980 !!end
4981
4982 !! test
4983 Table rowspan
4984 !! wikitext
4985 {| border=1
4986 | Cell 1, row 1
4987 |rowspan=2| Cell 2, row 1 (and 2)
4988 | Cell 3, row 1
4989 |-
4990 | Cell 1, row 2
4991 | Cell 3, row 2
4992 |}
4993 !! html
4994 <table border="1">
4995 <tr>
4996 <td> Cell 1, row 1
4997 </td>
4998 <td rowspan="2"> Cell 2, row 1 (and 2)
4999 </td>
5000 <td> Cell 3, row 1
5001 </td></tr>
5002 <tr>
5003 <td> Cell 1, row 2
5004 </td>
5005 <td> Cell 3, row 2
5006 </td></tr></table>
5007
5008 !! end
5009
5010 !! test
5011 Nested table
5012 !! wikitext
5013 {| border=1
5014 | &alpha;
5015 |
5016 {| bgcolor=#ABCDEF border=2
5017 |nested
5018 |-
5019 |table
5020 |}
5021 |the original table again
5022 |}
5023 !! html
5024 <table border="1">
5025 <tr>
5026 <td> &#945;
5027 </td>
5028 <td>
5029 <table bgcolor="#ABCDEF" border="2">
5030 <tr>
5031 <td>nested
5032 </td></tr>
5033 <tr>
5034 <td>table
5035 </td></tr></table>
5036 </td>
5037 <td>the original table again
5038 </td></tr></table>
5039
5040 !! end
5041
5042 !! test
5043 Invalid attributes in table cell (bug 1830)
5044 !! wikitext
5045 {|
5046 |Cell:|broken
5047 |}
5048 !! html
5049 <table>
5050 <tr>
5051 <td>broken
5052 </td></tr></table>
5053
5054 !! end
5055
5056
5057 # The "|}" to close the table is missing from the input, so parsoid's
5058 # *2wt modes will fail.
5059 !! test
5060 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5061 !! options
5062 parsoid=wt2html,html2html
5063 !! wikitext
5064 {|
5065 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5066 !! html/php
5067 <table>
5068 <tr>
5069 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5070 <td>]" onmouseover="alert(document.cookie)"&gt;test
5071 </td>
5072 </tr>
5073 </table>
5074
5075 !! html/parsoid
5076 <table><tbody>
5077 <tr>
5078 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5079 !! end
5080
5081
5082 !! test
5083 Indented table markup mixed with indented pre content (proposed in bug 6200)
5084 !! wikitext
5085 <table>
5086 <tr>
5087 <td>
5088 Text that should be rendered preformatted
5089 </td>
5090 </tr>
5091 </table>
5092 !! html
5093 <table>
5094 <tr>
5095 <td>
5096 <pre>Text that should be rendered preformatted
5097 </pre>
5098 </td>
5099 </tr>
5100 </table>
5101
5102 !! end
5103
5104 !! test
5105 Template-generated table cell attributes and cell content
5106 !! wikitext
5107 {|
5108 |{{table_attribs}}
5109 | {{table_attribs}}
5110 |}
5111 !! html
5112 <table>
5113 <tr>
5114 <td style="color: red"> Foo
5115 </td>
5116 <td style="color: red"> Foo
5117 </td></tr></table>
5118
5119 !! end
5120
5121 !! test
5122 Template-generated table cell attributes and cell content (2)
5123 !! wikitext
5124 {|
5125 |align=center {{table_attribs}}
5126 |}
5127 !! html
5128 <table>
5129 <tr>
5130 <td align="center" style="color: red"> Foo
5131 </td></tr></table>
5132
5133 !! end
5134
5135 !! test
5136 Template-generated table cell attributes and cell content (3)
5137 !! wikitext
5138 {|
5139 |align=center {{table_cells}}
5140 |}
5141 !! html
5142 <table>
5143 <tr>
5144 <td align="center" style="color: red"> Foo </td>
5145 <td> Bar </td>
5146 <td> Baz
5147 </td></tr></table>
5148
5149 !! end
5150
5151 !! test
5152 Table with row followed by newlines and table heading
5153 !! wikitext
5154 {|
5155 |-
5156
5157 ! foo
5158 |}
5159 !! html
5160 <table>
5161
5162
5163 <tr>
5164 <th> foo
5165 </th></tr></table>
5166
5167 !! end
5168
5169 !! test
5170 Table with empty line following the start tag
5171 !! wikitext
5172 {|
5173
5174 |-
5175 | foo
5176 |}
5177 !! html
5178 <table>
5179
5180
5181 <tr>
5182 <td> foo
5183 </td></tr></table>
5184
5185 !! end
5186
5187 # FIXME: Preserve the attribute properly (with an empty string as value) in
5188 # the PHP parser. Parsoid implements the behavior below.
5189 !! test
5190 Table attributes with empty value
5191 !! wikitext
5192 {|
5193 | style=| hello
5194 |}
5195 !! html/parsoid
5196 <table>
5197 <tbody>
5198 <tr>
5199 <td style=""> hello
5200 </td></tr></tbody></table>
5201
5202 !! end
5203
5204 !! test
5205 Wikitext table with a lot of comments
5206 !! wikitext
5207 {|
5208 <!-- c0 -->
5209 | foo
5210 <!-- c1 -->
5211 |- <!-- c2 -->
5212 <!-- c3 -->
5213 |<!-- c4 -->
5214 <!-- c5 -->
5215 |}
5216 !! html
5217 <table>
5218 <tr>
5219 <td> foo
5220 </td></tr>
5221 <tr>
5222 <td>
5223 </td></tr></table>
5224
5225 !! end
5226
5227 !! test
5228 Wikitext table with double-line table cell
5229 !! wikitext
5230 {|
5231 |a
5232 b
5233 |}
5234 !! html
5235 <table>
5236 <tr>
5237 <td>a
5238 <p>b
5239 </p>
5240 </td></tr></table>
5241
5242 !! end
5243
5244 !! test
5245 Table cell with a single comment
5246 !! wikitext
5247 {|
5248 | <!-- c1 -->
5249 | a
5250 |}
5251 !! html
5252 <table>
5253 <tr>
5254 <td>
5255 </td>
5256 <td> a
5257 </td></tr></table>
5258
5259 !! end
5260
5261 !! test
5262 Table-cell after a comment-only-empty-line
5263 !! wikitext
5264 {|
5265 |a
5266 <!--c1-->
5267 <!--c2-->| b
5268 |}
5269 !! html/parsoid
5270 <table>
5271 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5272 <!--c1-->
5273 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5274 </tbody></table>
5275
5276 !! end
5277
5278 # The expected HTML structure in this test is debatable. The PHP parser does
5279 # not parse this kind of table at all. The main focus for Parsoid is on
5280 # round-tripping, so this output is ok for now. TODO: revisit!
5281 !! test
5282 Wikitext table with html-syntax row
5283 !! wikitext
5284 {|
5285 |-
5286 <td>foo</td>
5287 |}
5288 !! html/parsoid
5289 <table>
5290 <tbody>
5291 <tr>
5292 <td>foo</td></tr></tbody></table>
5293 !! end
5294
5295 !! test
5296 Implicit <td> after a |-
5297 (PHP parser relies on Tidy to add the missing <td> tags)
5298 !! options
5299 parsoid=wt2html,wt2wt
5300 !! wikitext
5301 {|
5302 |-
5303 a
5304 |}
5305 !! html
5306 <table>
5307 <tr><td>a</td></tr>
5308 </table>
5309 !! end
5310
5311 !! test
5312 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5313 (PHP parser relies on Tidy to add the missing <td> tags)
5314 !! options
5315 parsoid=wt2html,wt2wt
5316 !! wikitext
5317 {|
5318 |-
5319 |
5320 a
5321 |-
5322 b
5323 |}
5324 !! html
5325 <table>
5326 <tbody>
5327 <tr><td><pre>a</pre></td></tr>
5328 <tr><td> b</td></tr>
5329 </tbody>
5330 </table>
5331 !! end
5332
5333 !! test
5334 Lists should be recognized in an implicit <td> context
5335 (PHP parser relies on Tidy to add the missing <td> tags)
5336 !! options
5337 parsoid=wt2html,wt2wt
5338 !! wikitext
5339 {|
5340 |-
5341 *a
5342 |}
5343 !! html
5344 <table>
5345 <tr>
5346 <td><ul>
5347 <li>a</li>
5348 </ul></td>
5349 </tr>
5350 </table>
5351 !! end
5352
5353 !! test
5354 Parsoid: Round-trip tables directly followed by content (bug 51219)
5355 !! options
5356 parsoid=wt2html,wt2wt
5357 !! wikitext
5358 {|
5359 |foo
5360 |} bar
5361
5362 {|
5363 |baz
5364 |}<b>quux</b>
5365 !! html
5366 <table><tbody>
5367 <tr>
5368 <td>foo</td></tr></tbody></table> bar
5369 <table>
5370 <tbody>
5371 <tr>
5372 <td>baz</td></tr></tbody></table><b>quux</b>
5373 !! end
5374
5375 !! test
5376 Parsoid: Default to a newline after tables in new content (bug 51219)
5377 !! options
5378 parsoid=html2wt
5379 !! wikitext
5380 {|
5381 |foo
5382 |}
5383 <nowiki> </nowiki>bar
5384 {|
5385 |baz
5386 |}
5387 '''quux'''
5388 !! html
5389 <table><tbody>
5390 <tr><td>foo</td></tr></tbody></table> bar
5391 <table><tbody>
5392 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5393 !! end
5394
5395 !! test
5396 Parsoid: newline inducing block nodes don't suppress <nowiki>
5397 !! options
5398 parsoid=html2wt
5399 !! wikitext
5400 <nowiki> </nowiki>a
5401
5402 = foo =
5403 !! html
5404 a<h1>foo</h1>
5405 !! end
5406
5407 !! test
5408 Parsoid: Row-syntax table headings followed by comment & table cells
5409 !! options
5410 parsoid=wt2html,wt2wt
5411 !! wikitext
5412 {|
5413 ! foo || bar
5414 <!-- foo --> || baz || quux
5415 |}
5416 !! html/parsoid
5417 <table>
5418 <tbody>
5419 <tr><th>foo </th><th>bar </th>
5420 <td>baz </td>
5421 <td>quux</td></tr></tbody></table>
5422 !! end
5423
5424
5425 !!test
5426 Parsoid: Recover better from broken table attributes
5427 !!options
5428 parsoid=wt2html
5429 !!wikitext
5430 {| class="foo
5431 | class="bar" |
5432 foo
5433 |}
5434 !!html/parsoid
5435 <table class="foo">
5436 <tr>
5437 <td class="bar">
5438 <p>foo</p></td></tr>
5439 </tbody></table>
5440 !!end
5441
5442 !! test
5443 Strip unsupported table tags
5444 !! options
5445 parsoid=html2wt
5446 !! html
5447 <table>
5448 <thead>
5449 <tr>
5450 <th>Month</th>
5451 <th>Savings</th>
5452 </tr>
5453 </thead>
5454 <tbody>
5455 <tr>
5456 <td>January</td>
5457 <td>$100</td>
5458 </tr>
5459 <tr>
5460 <td>February</td>
5461 <td>$80</td>
5462 </tr>
5463 </tbody>
5464 <tfoot>
5465 <tr>
5466 <td>Sum</td>
5467 <td>$180</td>
5468 </tr>
5469 </tfoot>
5470 </table>
5471 !! wikitext
5472 {|
5473
5474 !Month
5475 !Savings
5476
5477 |January
5478 |$100
5479
5480 |-
5481 |February
5482 |$80
5483
5484 |Sum
5485 |$180
5486
5487 |}
5488 !! end
5489
5490 ###
5491 ### Internal links
5492 ###
5493 !! test
5494 Plain link, capitalized
5495 !! wikitext
5496 [[Main Page]]
5497 !! html
5498 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5499 </p>
5500 !! end
5501
5502 !! test
5503 Plain link, uncapitalized
5504 !! wikitext
5505 [[main Page]]
5506 !! html
5507 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5508 </p>
5509 !! end
5510
5511 !! test
5512 Piped link
5513 !! wikitext
5514 [[Main Page|The Main Page]]
5515 !! html
5516 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5517 </p>
5518 !! end
5519
5520 !! test
5521 Piped link with comment in link text
5522 !! wikitext
5523 [[Main Page|The Main<!--front--> Page]]
5524 !! html
5525 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5526 </p>
5527 !! end
5528
5529 !! test
5530 Piped link with multiple pipe characters in link text
5531 !! wikitext
5532 [[Main Page||The|Main|Page|]]
5533 !! html/php
5534 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5535 </p>
5536 !! html/parsoid
5537 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5538 !! end
5539
5540 !! test
5541 Broken link
5542 !! wikitext
5543 [[Zigzagzogzagzig]]
5544 !! html
5545 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5546 </p>
5547 !! end
5548
5549 !! test
5550 Broken link with fragment
5551 !! wikitext
5552 [[Zigzagzogzagzig#zug]]
5553 !! html
5554 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5555 </p>
5556 !! end
5557
5558 !! test
5559 Special page link with fragment
5560 !! wikitext
5561 [[Special:Version#anchor]]
5562 !! html
5563 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5564 </p>
5565 !! end
5566
5567 !! test
5568 Nonexistent special page link with fragment
5569 !! wikitext
5570 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5571 !! html
5572 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5573 </p>
5574 !! end
5575
5576 !! test
5577 Link with prefix
5578 !! wikitext
5579 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5580 !! html
5581 <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>
5582 </p>
5583 !! end
5584
5585 !! test
5586 Link with suffix
5587 !! wikitext
5588 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5589 !! html
5590 <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>!!!
5591 </p>
5592 !! end
5593
5594 !! article
5595 prefixed article
5596 !! text
5597 Some text
5598 !! endarticle
5599
5600 !! test
5601 Bug 43661: Piped links with identical prefixes
5602 !! wikitext
5603 [[prefixed article|prefixed articles with spaces]]
5604
5605 [[prefixed article|prefixed articlesaoeu]]
5606
5607 [[Main Page|Main Page test]]
5608 !! html
5609 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5610 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5611 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5612 </p>
5613 !! end
5614
5615
5616 !! test
5617 Link with HTML entity in suffix / tail
5618 !! wikitext
5619 [[Main Page]]&quot;, [[Main Page]]&#97;
5620 !! html
5621 <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;
5622 </p>
5623 !! end
5624
5625 !! test
5626 Link with 3 brackets
5627 !! wikitext
5628 [[[Main Page]]]
5629 !! html
5630 <p>[[[Main Page]]]
5631 </p>
5632 !! end
5633
5634 !! test
5635 Link with 4 brackets
5636 !! wikitext
5637 [[[[Main Page]]]]
5638 !! html
5639 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5640 </p>
5641 !! end
5642
5643 !! test
5644 Piped link with 3 brackets
5645 !! wikitext
5646 [[[main page|the main page]]]
5647 !! html
5648 <p>[[[main page|the main page]]]
5649 </p>
5650 !! end
5651
5652 !! test
5653 Piped link with extlink-like text
5654 !! wikitext
5655 [[Main Page|[bar]]]
5656 [[Main Page|This is a [bar]]]
5657 !! html
5658 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5659 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5660 </p>
5661 !! end
5662
5663 !! test
5664 Link with multiple pipes
5665 !! wikitext
5666 [[Main Page|The|Main|Page]]
5667 !! html
5668 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5669 </p>
5670 !! end
5671
5672 # Note that parsoid does not munge anchor text; all non-space
5673 # characters are valid in HTML5 ids.
5674 !! test
5675 Anchor containing a #. (bug 63430)
5676 !! wikitext
5677 [[Main Page#And#Link]]
5678 !! html/php
5679 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5683 !! end
5684
5685 !! test
5686 Link to namespaces
5687 !! wikitext
5688 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5689 !! html
5690 <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>
5691 </p>
5692 !! end
5693
5694 !! test
5695 Link with space in namespace
5696 !! wikitext
5697 [[User talk:Foo bar]]
5698 !! html
5699 <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>
5700 </p>
5701 !! end
5702
5703 !! article
5704 MemoryAlpha:AlphaTest
5705 !! text
5706 This is an article in the MemoryAlpha namespace
5707 (which shadows the memoryalpha interwiki link).
5708 !! endarticle
5709
5710 !! test
5711 Namespace takes precedence over interwiki link (bug 51680)
5712 !! wikitext
5713 [[MemoryAlpha:AlphaTest]]
5714 !! html
5715 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5716 </p>
5717 !! end
5718
5719 # The previous test doesn't work correctly in html2*, due to not recognizing the
5720 # link as an internal one. This one checks for the correct behavior.
5721 !! test
5722 Link to namespace preferred over interwiki with correct rel attribute
5723 !! options
5724 parsoid=html2wt,html2html
5725 !! wikitext
5726 [[MemoryAlpha:AlphaTest]]
5727 !! html
5728 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5729 </p>
5730 !! end
5731
5732 !! test
5733 Piped link to namespace
5734 !! wikitext
5735 [[Meta:Disclaimers|The disclaimers]]
5736 !! html
5737 <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>
5738 </p>
5739 !! end
5740
5741 !! test
5742 Link containing }
5743 !! wikitext
5744 [[Usually caused by a typo (oops}]]
5745 !! html
5746 <p>[[Usually caused by a typo (oops}]]
5747 </p>
5748 !! end
5749
5750 !! article
5751 7% Solution
5752 !! text
5753 Just a test of an article title containing a percent.
5754 !! endarticle
5755
5756 !! test
5757 Link containing % (not as a hex sequence)
5758 !! wikitext
5759 [[7% Solution]]
5760 !! html/php
5761 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5762 </p>
5763 !! html/parsoid
5764 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5765 !! end
5766
5767 # note that the parsoid HTML is identical to the previous test output,
5768 # so the previous test ensures that the html2wt mode will generate the
5769 # "not as a hex sequence" wikitext.
5770 !! test
5771 Link containing % as a single hex sequence interpreted to char
5772 !! options
5773 parsoid=wt2wt,wt2html,html2html
5774 !! wikitext
5775 [[7%25 Solution]]
5776 !! html/php
5777 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5778 </p>
5779 !! html/parsoid
5780 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5781 !!end
5782
5783 !! test
5784 Link containing % as a double hex sequence interpreted to hex sequence
5785 !! wikitext
5786 [[7%2525 Solution]]
5787 !! html
5788 <p>[[7%2525 Solution]]
5789 </p>
5790 !!end
5791
5792 # note that parsoid does not munge anchor text; all non-space
5793 # characters are valid in HTML5 anchors.
5794 !! test
5795 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5796 Example for such a section: == < ==
5797 !! wikitext
5798 [[%23%3c]][[%23%3e]]
5799 !! html/php
5800 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5801 </p>
5802 !! html/parsoid
5803 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5804 !! end
5805
5806 !! test
5807 Link containing "<#" and ">#" as a hex sequences
5808 !! wikitext
5809 [[%3c%23]][[%3e%23]]
5810 !! html
5811 <p>[[%3c%23]][[%3e%23]]
5812 </p>
5813 !! end
5814
5815 !! test
5816 Link containing an equals sign
5817 !! wikitext
5818 [[Special:BookSources/isbn=4-00-026157-6]]
5819 !! html/php
5820 <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>
5821 </p>
5822 !! html/parsoid
5823 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5824 !! end
5825
5826 !! article
5827 Foo~bar
5828 !! text
5829 Just a test of an article title containing a tilde.
5830 !! endarticle
5831
5832 # note that links containing signatures, like [[Foo~~~~]], are
5833 # massaged by the pre-save transform (PST) and so the tildes are never
5834 # seen by the parser.
5835 !! test
5836 Link containing a tilde
5837 !! wikitext
5838 [[Foo~bar]]
5839 !! html/php
5840 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5841 </p>
5842 !! html/parsoid
5843 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5844 !! end
5845
5846 !! test
5847 Link containing double-single-quotes '' (bug 4598)
5848 !! wikitext
5849 [[Lista d''e paise d''o munno]]
5850 !! html/php
5851 <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>
5852 </p>
5853 !! html/parsoid
5854 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5855 !! end
5856
5857 !! test
5858 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5859 !! wikitext
5860 Some [[Link|pretty ''italics'' and stuff]]!
5861 !! html/php
5862 <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>!
5863 </p>
5864 !! html/parsoid
5865 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5866 !! end
5867
5868 !! test
5869 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5870 !! wikitext
5871 ''Some [[Link|pretty ''italics'' and stuff]]!''
5872 !! html
5873 <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>
5874 </p>
5875 !! end
5876
5877 !! test
5878 Link with double quotes in title part (literal) and alternate part (interpreted)
5879 !! wikitext
5880 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5881
5882 [[''Pentecoste'']]
5883
5884 [[''Pentecoste''|Pentecoste]]
5885
5886 [[''Pentecoste''|''Pentecoste'']]
5887 !! html/php
5888 <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>
5889 </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>
5890 </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>
5891 </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>
5892 </p>
5893 !! html/parsoid
5894 <meta typeof="mw:Placeholder"/>
5895 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5896 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5897 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5898 !! end
5899
5900 !! test
5901 Broken image links with HTML captions (bug 39700)
5902 !! wikitext
5903 [[File:Nonexistent|<script></script>]]
5904 [[File:Nonexistent|100px|<script></script>]]
5905 [[File:Nonexistent|&lt;]]
5906 [[File:Nonexistent|a<i>b</i>c]]
5907 !! html
5908 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5909 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5910 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5911 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5912 </p>
5913 !! end
5914
5915 !! test
5916 Plain link to URL
5917 !! wikitext
5918 [[http://www.example.com]]
5919 !! html/php
5920 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5921 </p>
5922 !! html/parsoid
5923 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5924 !! end
5925
5926 !! test
5927 Plain link to URL with link text
5928 !! wikitext
5929 [[http://www.example.com Link text]]
5930 !! html
5931 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5932 </p>
5933 !! end
5934
5935 !! test
5936 Plain link to protocol-relative URL
5937 !! wikitext
5938 [[//www.example.com]]
5939 !! html/php
5940 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5941 </p>
5942 !! html/parsoid
5943 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5944 !! end
5945
5946 !! test
5947 Plain link to protocol-relative URL with link text
5948 !! wikitext
5949 [[//www.example.com Link text]]
5950 !! html
5951 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5952 </p>
5953 !! end
5954
5955 !! test
5956 Plain link to page with question mark in title
5957 !! wikitext
5958 [[A?b]]
5959
5960 [[A?b|Baz]]
5961 !! html
5962 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5963 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5964 </p>
5965 !! end
5966
5967
5968 # I'm fairly sure the expected result here is wrong.
5969 # We want these to be URL links, not pseudo-pages with URLs for titles....
5970 # However the current output is also pretty screwy.
5971 #
5972 # ----
5973 # I'm changing it to match the current output--it arguably makes more
5974 # sense in the light of the test above. Old expected result was:
5975 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5976 #</p>
5977 # But I think this test is bordering on "garbage in, garbage out" anyway.
5978 # -- wtm
5979 !! test
5980 Piped link to URL
5981 !! wikitext
5982 Piped link to URL: [[http://www.example.com|an example URL]]
5983 !! html/php
5984 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5985 </p>
5986 !! html/parsoid
5987 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5988 !! end
5989
5990 !! test
5991 BUG 2: [[page|http://url/]] should link to page, not http://url/
5992 !! wikitext
5993 [[Main Page|http://url/]]
5994 !! html/php
5995 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5996 </p>
5997 !! html/parsoid
5998 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5999 !! end
6000
6001 # Parsoid does not mark self-links, by design.
6002 !! test
6003 BUG 337: Escaped self-links should be bold
6004 !! options
6005 title=[[Bug462]]
6006 !! wikitext
6007 [[Bu&#103;462]] [[Bug462]]
6008 !! html/php
6009 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6010 </p>
6011 !! html/parsoid
6012 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6013 !! end
6014
6015 !! test
6016 Self-link to section should not be bold
6017 !! options
6018 title=[[Main Page]]
6019 !! wikitext
6020 [[Main Page#section]]
6021 !! html
6022 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6023 </p>
6024 !! end
6025
6026 !! article
6027 00
6028 !! text
6029 This is 00.
6030 !! endarticle
6031
6032 !!test
6033 Self-link to numeric title
6034 !!options
6035 title=[[0]]
6036 !! wikitext
6037 [[0]]
6038 !! html
6039 <p><strong class="selflink">0</strong>
6040 </p>
6041 !!end
6042
6043 !!test
6044 Link to numeric-equivalent title
6045 !!options
6046 title=[[0]]
6047 !! wikitext
6048 [[00]]
6049 !! html
6050 <p><a href="/wiki/00" title="00">00</a>
6051 </p>
6052 !!end
6053
6054 !! test
6055 <nowiki> inside a link
6056 !! wikitext
6057 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6058 !! html
6059 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6060 </p>
6061 !! end
6062
6063 !! test
6064 Non-breaking spaces in title
6065 !! wikitext
6066 [[&nbsp; Main &nbsp; Page &nbsp;]]
6067 !! html
6068 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6069 </p>
6070 !!end
6071
6072 !! test
6073 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6074 !! options
6075 language=ca
6076 !! wikitext
6077 '''[[Main Page]]'''
6078 !! html
6079 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6080 </p>
6081 !! end
6082
6083 !! test
6084 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6085 !! options
6086 language=ca
6087 !! wikitext
6088 ''[[Main Page]]''
6089 !! html
6090 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6091 </p>
6092 !! end
6093
6094 !! test
6095 Internal link with en linktrail: no apostrophes (bug 27473)
6096 !! options
6097 language=en
6098 !! wikitext
6099 [[Something]]'nice
6100 !! html
6101 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6102 </p>
6103 !! end
6104
6105 !! test
6106 Internal link with ca linktrail with apostrophes (bug 27473)
6107 !! options
6108 language=ca
6109 !! wikitext
6110 [[Something]]'nice
6111 !! html
6112 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6113 </p>
6114 !! end
6115
6116 !! test
6117 Internal link with kaa linktrail with apostrophes (bug 27473)
6118 !! options
6119 language=kaa
6120 !! wikitext
6121 [[Something]]'nice
6122 !! html
6123 <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>
6124 </p>
6125 !! end
6126
6127 !! test
6128 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6129 !! wikitext
6130 [[User:Foo/Test/63636:Bar|Test]]
6131 !! html/php
6132 <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>
6133 </p>
6134 !! html/parsoid
6135 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6136 !! end
6137
6138 !! test
6139 1. Interaction of linktrail and template encapsulation
6140 !! options
6141 parsoid
6142 !! wikitext
6143 {{echo|[[Foo]]}}l
6144 !! html
6145 <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>
6146 !! end
6147
6148 !! test
6149 2. Interaction of linktrail and template encapsulation
6150 !! options
6151 parsoid
6152 !! wikitext
6153 {{echo|Some [[Fool]]}}s
6154 !! html
6155 <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>
6156 !! end
6157
6158 !! test
6159 3. Interaction of linktrail and template encapsulation
6160 !! options
6161 parsoid
6162 !! wikitext
6163 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6164 !! html
6165 <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>
6166 !! end
6167
6168 !! article
6169 Söfnuður
6170 !! text
6171 Test.
6172 !! endarticle
6173
6174 !! test
6175 Internal link with is link prefix
6176 !! options
6177 language=is
6178 !! wikitext
6179 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6180 !! html
6181 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6182 </p>
6183 !! end
6184
6185 !! article
6186 Mótmælendatrú
6187 !! text
6188 Test.
6189 !! endarticle
6190
6191 !! test
6192 Internal link with is link trail and link prefix
6193 !! options
6194 language=is
6195 !! wikitext
6196 [[mótmælendatrú|xxx]]ar
6197 [[mótmælendatrú]]ar
6198 mótmælenda[[söfnuður]]
6199 mótmælenda[[söfnuður|söfnuðir]]
6200 mótmælenda[[söfnuður|söfnuðir]]xxx
6201 !! html
6202 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6203 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6204 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6205 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6206 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6207 </p>
6208 !! end
6209
6210 !! test
6211 Parsoid link trail escaping
6212 !! options
6213 parsoid=html2wt,html2html
6214 !! wikitext
6215 [[apple]]<nowiki/>s
6216 !! html
6217 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6218 !! end
6219
6220 !! test
6221 Parsoid link prefix escaping
6222 !! options
6223 language=is
6224 parsoid=html2wt,html2html
6225 !! wikitext
6226 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6227 !! html
6228 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6229 !! end
6230
6231 !! test
6232 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6233 !! wikitext
6234 [[Foo| bar]]
6235
6236 [[Foo| ''bar'']]
6237
6238 [http://wp.org foo]
6239
6240 [http://wp.org ''foo'']
6241 !! html
6242 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6243 </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>
6244 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6245 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6246 </p>
6247 !! end
6248
6249 !! test
6250 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6251 !! options
6252 parsoid
6253 !! wikitext
6254 [[Foo|{{echo|a}} b {{echo|c}}]]
6255 !! html
6256 <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>
6257 !! end
6258
6259 !! test
6260 Link with angle bracket after anchor
6261 !! wikitext
6262 [[Foo#<bar>]]
6263 !! html/parsoid
6264 <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>
6265 !! end
6266
6267 ###
6268 ### Interwiki links (see maintenance/interwiki.sql)
6269 ###
6270
6271 !! test
6272 Inline interwiki link
6273 !! wikitext
6274 [[MeatBall:SoftSecurity]]
6275 !! html
6276 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6277 </p>
6278 !! end
6279
6280 !! test
6281 Inline interwiki link with empty title (bug 2372)
6282 !! wikitext
6283 [[MeatBall:]]
6284 !! html
6285 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6286 </p>
6287 !! end
6288
6289 !! test
6290 Interwiki link encoding conversion (bug 1636)
6291 !! wikitext
6292 *[[Wikipedia:ro:Olteni&#0355;a]]
6293 *[[Wikipedia:ro:Olteni&#355;a]]
6294 !! html
6295 <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>
6296 <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>
6297
6298 !! end
6299
6300 !! test
6301 Interwiki link with fragment (bug 2130)
6302 !! wikitext
6303 [[MeatBall:SoftSecurity#foo]]
6304 !! html
6305 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6306 </p>
6307 !! end
6308
6309 # Ideally the wikipedia: prefix here should be proto-relative too
6310 !! test
6311 Different interwiki prefixes mapping to the same URL
6312 !! wikitext
6313 [[:en:Foo]]
6314
6315 [[:en:Foo|Foo]]
6316
6317 [[wikipedia:Foo]]
6318
6319 [[:wikipedia:Foo|Foo]]
6320
6321 [[wikipedia:en:Foo]]
6322
6323 [[:wikipedia:en:Foo]]
6324 !! html/parsoid
6325 <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>
6326
6327 <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>
6328
6329 <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>
6330
6331 <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>
6332
6333 <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>
6334
6335 <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>
6336 !! end
6337
6338 !! test
6339 Interwiki links that cannot be represented in wiki syntax
6340 !! wikitext
6341 [[meatball:ok]]
6342 [[meatball:ok#foo|ok with fragment]]
6343 [[meatball:ok_as_well?|ok ending with ? mark]]
6344 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6345 [http://de.wikipedia.org/wiki/#foo is just fragment]
6346
6347 !! html/parsoid
6348 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6349 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6350 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6351 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6352 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6353 !! end
6354
6355 !! test
6356 Interwiki links: trail
6357 !! options
6358 parsoid
6359 !! wikitext
6360 [[wikipedia:Foo|Ba]]r
6361 !! html
6362 <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>
6363 !! end
6364
6365 ###
6366 ### Interlanguage links
6367 ### Language links (so that searching for '### language' matches..)
6368 ###
6369
6370 !! test
6371 Interlanguage link
6372 !! wikitext
6373 Blah blah blah
6374 [[zh:Chinese]]
6375 !! html
6376 <p>Blah blah blah
6377 </p>
6378 !! end
6379
6380 !! test
6381 Double interlanguage link
6382 !! wikitext
6383 Blah blah blah
6384 [[es:Spanish]]
6385 [[zh:Chinese]]
6386 !! html
6387 <p>Blah blah blah
6388 </p>
6389 !! end
6390
6391 !! test
6392 Interlanguage link, with prefix links
6393 !! options
6394 language=ln
6395 !! wikitext
6396 Blah blah blah
6397 [[zh:Chinese]]
6398 !! html
6399 <p>Blah blah blah
6400 </p>
6401 !! end
6402
6403 !! test
6404 Double interlanguage link, with prefix links (bug 8897)
6405 !! options
6406 language=ln
6407 !! wikitext
6408 Blah blah blah
6409 [[es:Spanish]]
6410 [[zh:Chinese]]
6411 !! html
6412 <p>Blah blah blah
6413 </p>
6414 !! end
6415
6416 !! test
6417 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6418 !! wikitext
6419 Blah blah blah
6420 [[mul:Multilingual]]
6421 !! html
6422 <p>Blah blah blah
6423 </p>
6424 !! end
6425
6426 !! test
6427 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6428 !! options
6429 language=ln
6430 !! wikitext
6431 [[WW&nbsp;II]]
6432 !! html
6433 <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>
6434 </p>
6435 !! end
6436
6437 !! test
6438 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6439 !! options
6440 parsoid=html2wt
6441 !! wikitext
6442 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6443
6444 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6445 !! html
6446 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6447 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6448 !! end
6449
6450 !! test
6451 Parsoid: handle constructor well
6452 !! options
6453 parsoid
6454 !! wikitext
6455 [[constructor]]
6456
6457 [[constructor:foo]]
6458 !! html
6459 <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>
6460
6461 <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>
6462 !! end
6463
6464 !! test
6465 Parsoid: recognize interlanguage links without a target page
6466 !! options
6467 parsoid
6468 !! wikitext
6469 [[ko:]]
6470 !! html
6471 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6472 !! end
6473
6474 !! test
6475 Parsoid: recognize interwiki links without a target page
6476 !! options
6477 parsoid
6478 !! wikitext
6479 [[:ko:]]
6480 !! html
6481 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6482 !! end
6483
6484 !! test
6485 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6486 !! options
6487 parsoid
6488 !! wikitext
6489 [[en:Foo]]
6490 !! html
6491 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6492 !! end
6493
6494 ###
6495 ### Redirects, Parsoid-only
6496 ###
6497 !! test
6498 1. Simple redirect to page
6499 !! options
6500 parsoid
6501 !! wikitext
6502 #REDIRECT [[Main Page]]
6503 !! html
6504 <link rel="mw:PageProp/redirect" href="./Main_Page">
6505 !! end
6506
6507 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6508 !! test
6509 2. Other redirect variants
6510 !! options
6511 parsoid=wt2html,wt2wt
6512 !! wikitext
6513 #REDIRECT [[Main_Page]]
6514 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6515 !! html
6516 <link rel="mw:PageProp/redirect" href="./Main_Page">
6517 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6518 !! end
6519
6520 !! test
6521 Empty redirect
6522 !! options
6523 parsoid=wt2html,wt2wt
6524 !! wikitext
6525 #REDIRECT [[]]
6526 !! html
6527 <ol>
6528 <li>REDIRECT [[]]</li></ol>
6529 !! end
6530
6531 !! test
6532 Optional colon in #REDIRECT
6533 !! options
6534 # the colon is archaic syntax. we support it for wt2html, but we
6535 # don't care that it roundtrips back to the modern syntax.
6536 parsoid=wt2html,html2html
6537 !! wikitext
6538 #REDIRECT:[[Main Page]]
6539 !! html
6540 <link rel="mw:PageProp/redirect" href="./Main_Page">
6541 !! end
6542
6543 !! test
6544 Whitespace in #REDIRECT with optional colon
6545 !! options
6546 # the colon and gratuitous whitespace is archaic syntax. we support
6547 # it for wt2html, but we don't care that it roundtrips back to the
6548 # modern syntax (without extra whitespace)
6549 parsoid=wt2html,html2html
6550 !! wikitext
6551
6552 #REDIRECT
6553 :
6554 [[Main Page]]
6555 !! html
6556 <link rel="mw:PageProp/redirect" href="./Main_Page">
6557 !! end
6558
6559 !! test
6560 Piped link in #REDIRECT
6561 !! options
6562 # content after piped link is ignored. we support this syntax,
6563 # but don't care that the piped link is lost when we roundtrip this.
6564 parsoid=wt2html
6565 !! wikitext
6566 #REDIRECT [[Main Page|bar]]
6567 !! html
6568 <link rel="mw:PageProp/redirect" href="./Main_Page">
6569 !! end
6570
6571 !! test
6572 Redirect to category
6573 !! options
6574 parsoid=wt2html
6575 !! wikitext
6576 #REDIRECT [[Category:Foo]]
6577 !! html
6578 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6579 !! end
6580
6581 !! test
6582 Redirect to category with URL encoding
6583 !! options
6584 parsoid=wt2html
6585 !! wikitext
6586 #REDIRECT [[Category%3AFoo]]
6587 !! html
6588 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6589 !! end
6590
6591 !! test
6592 Redirect to category page
6593 !! options
6594 parsoid=wt2html,html2html
6595 !! wikitext
6596 #REDIRECT [[:Category:Foo]]
6597 !! html
6598 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6599 !! end
6600
6601 !! test
6602 Redirect to image page (1)
6603 !! options
6604 parsoid
6605 !! wikitext
6606 #REDIRECT [[File:Wiki.png]]
6607 !! html
6608 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6609 !! end
6610
6611 !! test
6612 Redirect to image page (2)
6613 !! options
6614 parsoid
6615 !! wikitext
6616 #REDIRECT [[Image:Wiki.png]]
6617 !! html
6618 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6619 !! end
6620
6621 !! test
6622 Redirect to language
6623 !! options
6624 parsoid
6625 !! wikitext
6626 #REDIRECT [[en:File:Wiki.png]]
6627 !! html
6628 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6629 !! end
6630
6631 !! test
6632 Redirect to interwiki
6633 !! options
6634 parsoid
6635 !! wikitext
6636 #REDIRECT [[meatball:File:Wiki.png]]
6637 !! html
6638 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6639 !! end
6640
6641 !! test
6642 Non-English #REDIRECT
6643 !! options
6644 parsoid
6645 language=is
6646 !! wikitext
6647 #TILVÍSUN [[Main Page]]
6648 !! html
6649 <link rel="mw:PageProp/redirect" href="./Main_Page">
6650 !! end
6651
6652 !! test
6653 New redirect
6654 !! options
6655 parsoid=html2wt
6656 !! wikitext
6657 Foo
6658 #REDIRECT [[Foo]]
6659 !! html
6660 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6661 !! end
6662
6663 ##
6664 ## XHTML tidiness
6665 ###
6666
6667 !! test
6668 <br> to <br />
6669 !! wikitext
6670 1<br>2<br />3
6671 !! html
6672 <p>1<br />2<br />3
6673 </p>
6674 !! end
6675
6676 !! test
6677 Broken br tag sanitization
6678 !! wikitext
6679 </br>
6680 !! html/php
6681 <p>&lt;/br&gt;
6682 </p>
6683 !! end
6684
6685 # TODO: Fix html2html mode (bug 51055)!
6686 !! test
6687 Parsoid: Broken br tag recognition
6688 !! options
6689 parsoid=wt2html
6690 !! wikitext
6691 </br>
6692
6693 <br/ >
6694 !! html/parsoid
6695 <p><br></p>
6696 <p><br/></p>
6697 !! end
6698
6699 !! test
6700 Incorrecly removing closing slashes from correctly formed XHTML
6701 !! wikitext
6702 <br style="clear:both;" />
6703 !! html
6704 <p><br style="clear:both;" />
6705 </p>
6706 !! end
6707
6708 !! test
6709 Failing to transform badly formed HTML into correct XHTML
6710 !! wikitext
6711 <br style="clear: left;">
6712 <br style="clear: right;">
6713 <br style="clear: both;">
6714 !! html
6715 <p><br style="clear: left;" />
6716 <br style="clear: right;" />
6717 <br style="clear: both;" />
6718 </p>
6719 !!end
6720
6721 !! test
6722 Handling html with a div self-closing tag
6723 !! wikitext
6724 <div title />
6725 <div title/>
6726 <div title/ >
6727 <div title=bar />
6728 <div title=bar/>
6729 <div title=bar/ >
6730 !! html
6731 <p>&lt;div title /&gt;
6732 &lt;div title/&gt;
6733 </p>
6734 <div>
6735 <p>&lt;div title=bar /&gt;
6736 &lt;div title=bar/&gt;
6737 </p>
6738 <div title="bar/"></div>
6739 </div>
6740
6741 !! end
6742
6743 !! test
6744 Handling html with a br self-closing tag
6745 !! wikitext
6746 <br title />
6747 <br title/>
6748 <br title/ >
6749 <br title=bar />
6750 <br title=bar/>
6751 <br title=bar/ >
6752 !! html
6753 <p><br title="title" />
6754 <br title="title" />
6755 <br />
6756 <br title="bar" />
6757 <br title="bar" />
6758 <br title="bar/" />
6759 </p>
6760 !! end
6761
6762 !! test
6763 Horizontal ruler (should it add that extra space?)
6764 !! wikitext
6765 <hr>
6766 <hr >
6767 foo <hr
6768 > bar
6769 !! html
6770 <hr />
6771 <hr />
6772 foo <hr /> bar
6773
6774 !! end
6775
6776 !! test
6777 Horizontal ruler -- 4+ dashes render hr
6778 !! wikitext
6779 ----
6780 !! html
6781 <hr />
6782
6783 !! end
6784
6785 !! test
6786 Horizontal ruler -- eats additional dashes on the same line
6787 !! wikitext
6788 ---------
6789 !! html
6790 <hr />
6791
6792 !! end
6793
6794 !! test
6795 Horizontal ruler -- does not collapse dashes on consecutive lines
6796 !! wikitext
6797 ----
6798 ----
6799 !! html
6800 <hr />
6801 <hr />
6802
6803 !! end
6804
6805 !! test
6806 Horizontal ruler -- <4 dashes render as plain text
6807 !! wikitext
6808 ---
6809 !! html
6810 <p>---
6811 </p>
6812 !! end
6813
6814 !! test
6815 Horizontal ruler -- Supports content following dashes on same line
6816 !! wikitext
6817 ---- Foo
6818 !! html
6819 <hr /> Foo
6820
6821 !! end
6822
6823 ###
6824 ### Block-level elements
6825 ###
6826 !! test
6827 Common list
6828 !! wikitext
6829 *Common list
6830 * item 2
6831 *item 3
6832 !! html
6833 <ul><li>Common list</li>
6834 <li> item 2</li>
6835 <li>item 3</li></ul>
6836
6837 !! end
6838
6839 !! test
6840 Numbered list
6841 !! wikitext
6842 #Numbered list
6843 #item 2
6844 # item 3
6845 !! html
6846 <ol><li>Numbered list</li>
6847 <li>item 2</li>
6848 <li> item 3</li></ol>
6849
6850 !! end
6851
6852 !! test
6853 Mixed list
6854 !! wikitext
6855 *Mixed list
6856 *# with numbers
6857 ** and bullets
6858 *# and numbers
6859 *bullets again
6860 **bullet level 2
6861 ***bullet level 3
6862 ***#Number on level 4
6863 **bullet level 2
6864 **#Number on level 3
6865 **#Number on level 3
6866 *#number level 2
6867 *Level 1
6868 *** Level 3
6869 #** Level 3, but ordered
6870 !! html
6871 <ul><li>Mixed list
6872 <ol><li> with numbers</li></ol>
6873 <ul><li> and bullets</li></ul>
6874 <ol><li> and numbers</li></ol></li>
6875 <li>bullets again
6876 <ul><li>bullet level 2
6877 <ul><li>bullet level 3
6878 <ol><li>Number on level 4</li></ol></li></ul></li>
6879 <li>bullet level 2
6880 <ol><li>Number on level 3</li>
6881 <li>Number on level 3</li></ol></li></ul>
6882 <ol><li>number level 2</li></ol></li>
6883 <li>Level 1
6884 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6885 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6886
6887 !! end
6888
6889 !! test
6890 Nested lists 1
6891 !! wikitext
6892 *foo
6893 **bar
6894 !! html
6895 <ul><li>foo
6896 <ul><li>bar</li></ul></li></ul>
6897
6898 !! end
6899
6900 !! test
6901 Nested lists 2
6902 !! wikitext
6903 **foo
6904 *bar
6905 !! html
6906 <ul><li><ul><li>foo</li></ul></li>
6907 <li>bar</li></ul>
6908
6909 !! end
6910
6911 !! test
6912 Nested lists 3 (first element empty)
6913 !! wikitext
6914 *
6915 **bar
6916 !! html
6917 <ul><li>
6918 <ul><li>bar</li></ul></li></ul>
6919
6920 !! end
6921
6922 !! test
6923 Nested lists 4 (first element empty)
6924 !! wikitext
6925 **
6926 *bar
6927 !! html
6928 <ul><li><ul><li></li></ul></li>
6929 <li>bar</li></ul>
6930
6931 !! end
6932
6933 !! test
6934 Nested lists 5 (both elements empty)
6935 !! wikitext
6936 **
6937 *
6938 !! html
6939 <ul><li><ul><li></li></ul></li>
6940 <li></li></ul>
6941
6942 !! end
6943
6944 !! test
6945 Nested lists 6 (both elements empty)
6946 !! wikitext
6947 *
6948 **
6949 !! html
6950 <ul><li>
6951 <ul><li></li></ul></li></ul>
6952
6953 !! end
6954
6955 !! test
6956 Nested lists 7 (skip initial nesting levels)
6957 !! wikitext
6958 *** foo
6959 !! html
6960 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6961
6962 !! end
6963
6964 !! test
6965 Nested lists 8 (multiple nesting transitions)
6966 !! wikitext
6967 * foo
6968 *** bar
6969 ** baz
6970 * boo
6971 !! html
6972 <ul><li> foo
6973 <ul><li><ul><li> bar</li></ul></li>
6974 <li> baz</li></ul></li>
6975 <li> boo</li></ul>
6976
6977 !! end
6978
6979 !! test
6980 1. Lists with start-of-line-transparent tokens before bullets: Comments
6981 !! wikitext
6982 *foo
6983 *<!--cmt-->bar
6984 <!--cmt-->*baz
6985 !! html
6986 <ul><li>foo</li>
6987 <li>bar</li>
6988 <li>baz</li></ul>
6989
6990 !! end
6991
6992 !! test
6993 2. Lists with start-of-line-transparent tokens before bullets: Template close
6994 !! wikitext
6995 *foo {{echo|bar
6996 }}*baz
6997 !! html
6998 <ul><li>foo bar</li>
6999 <li>baz</li></ul>
7000
7001 !! end
7002
7003 !! test
7004 List items are not parsed correctly following a <pre> block (bug 785)
7005 !! wikitext
7006 * <pre>foo</pre>
7007 * <pre>bar</pre>
7008 * zar
7009 !! html
7010 <ul><li> <pre>foo</pre></li>
7011 <li> <pre>bar</pre></li>
7012 <li> zar</li></ul>
7013
7014 !! end
7015
7016 !! test
7017 List items from template
7018 !! wikitext
7019
7020 {{inner list}}
7021 * item 2
7022
7023 * item 0
7024 {{inner list}}
7025 * item 2
7026
7027 * item 0
7028 * notSOL{{inner list}}
7029 * item 2
7030 !! html
7031 <ul><li> item 1</li>
7032 <li> item 2</li></ul>
7033 <ul><li> item 0</li>
7034 <li> item 1</li>
7035 <li> item 2</li></ul>
7036 <ul><li> item 0</li>
7037 <li> notSOL</li>
7038 <li> item 1</li>
7039 <li> item 2</li></ul>
7040
7041 !! end
7042
7043 !! test
7044 List interrupted by empty line or heading
7045 !! wikitext
7046 * foo
7047
7048 ** bar
7049 == A heading ==
7050 * Another list item
7051 !! html
7052 <ul><li> foo</li></ul>
7053 <ul><li><ul><li> bar</li></ul></li></ul>
7054 <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>
7055 <ul><li> Another list item</li></ul>
7056
7057 !!end
7058
7059 !!test
7060 Multiple list tags generated by templates
7061 !! wikitext
7062 {{echo|<li>}}a
7063 {{echo|<li>}}b
7064 {{echo|<li>}}c
7065 !! html
7066 <li>a
7067 <li>b
7068 <li>c</li>
7069 </li>
7070 </li>
7071
7072 !!end
7073
7074 !!test
7075 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7076 !! wikitext
7077 *a
7078 <!--This line will NOT split the list-->
7079 *b
7080 <!--This line will NOT split the list either-->
7081 *c
7082 <!--foo--> <!----> <!--This line NOT split the list either-->
7083 *d
7084 !! html
7085 <ul><li>a</li>
7086 <li>b</li>
7087 <li>c</li>
7088 <li>d</li></ul>
7089
7090 !!end
7091
7092 !!test
7093 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7094 !! wikitext
7095 *a
7096 <!--This line will NOT split the list-->
7097 *b
7098 <!--This line will NOT split the list either-->
7099 *c
7100 <!--foo--> <!----> <!--This line NOT split the list
7101 either-->
7102 *d
7103 !! html
7104 <ul><li>a</li>
7105 <li>b</li>
7106 <li>c</li>
7107 <li>d</li></ul>
7108
7109 !!end
7110
7111 !!test
7112 Test the li-hack
7113 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7114 !!options
7115 parsoid=wt2html,wt2wt
7116 !! wikitext
7117 * foo
7118 * <li>li-hack
7119 * {{echo|<li>templated li-hack}}
7120 * <!--foo--> <li> unsupported li-hack with preceding comments
7121
7122 <ul>
7123 <li><li>not a li-hack
7124 </li>
7125 </ul>
7126 !! html
7127 <ul>
7128 <li> foo</li>
7129 <li>li-hack</li>
7130 <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>
7131 <li> <!--foo--> </li>
7132 <li> li-hack with preceding comments</li>
7133 </ul>
7134
7135 <ul>
7136 <li></li>
7137 <li>not a li-hack
7138 </li>
7139 </ul>
7140 !!end
7141
7142 !! test
7143 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7144 !! options
7145 parsoid
7146 !! wikitext
7147 # foo
7148 ## bar
7149 * foo
7150 ** bar
7151 : foo
7152 :: bar
7153 !! html
7154 <ol>
7155 <li> foo<ol>
7156 <li> bar</li>
7157 </ol></li>
7158 </ol><ul>
7159 <li> foo<ul>
7160 <li> bar</li>
7161 </ul></li>
7162 </ul><dl>
7163 <dd> foo<dl>
7164 <dd> bar</dd>
7165 </dl></dd>
7166 </dl>
7167 !! end
7168
7169 !! test
7170 Parsoid: Test of whitespace serialization with Templated bullets
7171 !! options
7172 parsoid
7173 !! wikitext
7174 * {{bullet}}
7175 !! html
7176 <ul>
7177 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7178 </ul>
7179 !! end
7180
7181 # ------------------------------------------------------------------------
7182 # The next set of tests are about Parsoid's ability to handle badly nested
7183 # tags (parse, minimize scope of fixup, and roundtrip back)
7184 # ------------------------------------------------------------------------
7185
7186 !! test
7187 Unbalanced closing block tags break a list
7188 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7189 !! wikitext
7190 <div>
7191 *a</div><div>
7192 *b</div>
7193 !! html/parsoid
7194 <div>
7195 <ul>
7196 <li>a
7197 </li>
7198 </ul></div><div>
7199 <ul>
7200 <li>b
7201 </li>
7202 </ul></div>
7203 !! end
7204
7205 !! test
7206 Unbalanced closing non-block tags don't break a list
7207 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7208 !! wikitext
7209 <span>
7210 *a</span><span>
7211 *b</span>
7212 !! html/parsoid
7213 <p><span></span>
7214 </p>
7215 <ul>
7216 <li>a<span></span>
7217 </li>
7218 <li>b
7219 </li>
7220 </ul>
7221 !! end
7222
7223 !! test
7224 Unclosed formatting tags that straddle lists are closed and reopened
7225 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7226 !! wikitext
7227 # <s> a
7228 # b </s>
7229 !! html/parsoid
7230 <ol>
7231 <li> <s> a </s>
7232 </li>
7233 <li> <s> b </s>
7234 </li>
7235 </ol>
7236 !! end
7237
7238 !!test
7239 List embedded in a non-block tag
7240 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7241 !! wikitext
7242 <small>
7243 * foo
7244 </small>
7245 !! html/parsoid
7246 <p><small></small></p>
7247 <small>
7248 <ul>
7249 <li> foo</li>
7250 </ul>
7251 </small>
7252 <p><small></small></p>
7253 !!end
7254
7255 !! test
7256 Table with missing opening <tr> tag
7257 !! options
7258 parsoid=wt2html,wt2wt
7259 !! wikitext
7260 <table>
7261 <td>foo</td>
7262 </tr>
7263 </table>
7264 !! html/parsoid
7265 <table>
7266 <tr>
7267 <td>foo</td>
7268 </tr>
7269 </table>
7270 !! end
7271
7272 ###
7273 ### Magic Words
7274 ###
7275
7276 # Note that the current date is hard-coded as
7277 # 1970-01-01T00:02:03Z (a Thursday)
7278 # when running parser tests. The timezone is also fixed to GMT, so
7279 # local date will be identical to current date.
7280
7281 !! test
7282 Magic Word: {{CURRENTDAY}}
7283 !! wikitext
7284 {{CURRENTDAY}}
7285 !! html
7286 <p>1
7287 </p>
7288 !! end
7289
7290 !! test
7291 Magic Word: {{CURRENTDAY2}}
7292 !! wikitext
7293 {{CURRENTDAY2}}
7294 !! html
7295 <p>01
7296 </p>
7297 !! end
7298
7299 !! test
7300 Magic Word: {{CURRENTDAYNAME}}
7301 !! wikitext
7302 {{CURRENTDAYNAME}}
7303 !! html
7304 <p>Thursday
7305 </p>
7306 !! end
7307
7308 !! test
7309 Magic Word: {{CURRENTDOW}}
7310 !! wikitext
7311 {{CURRENTDOW}}
7312 !! html
7313 <p>4
7314 </p>
7315 !! end
7316
7317 !! test
7318 Magic Word: {{CURRENTMONTH}}
7319 !! wikitext
7320 {{CURRENTMONTH}}
7321 !! html
7322 <p>01
7323 </p>
7324 !! end
7325
7326 !! test
7327 Magic Word: {{CURRENTMONTH1}}
7328 !! wikitext
7329 {{CURRENTMONTH1}}
7330 !! html
7331 <p>1
7332 </p>
7333 !! end
7334
7335 !! test
7336 Magic Word: {{CURRENTMONTHABBREV}}
7337 !! wikitext
7338 {{CURRENTMONTHABBREV}}
7339 !! html
7340 <p>Jan
7341 </p>
7342 !! end
7343
7344 !! test
7345 Magic Word: {{CURRENTMONTHNAME}}
7346 !! wikitext
7347 {{CURRENTMONTHNAME}}
7348 !! html
7349 <p>January
7350 </p>
7351 !! end
7352
7353 !! test
7354 Magic Word: {{CURRENTMONTHNAMEGEN}}
7355 !! wikitext
7356 {{CURRENTMONTHNAMEGEN}}
7357 !! html
7358 <p>January
7359 </p>
7360 !! end
7361
7362 !! test
7363 Magic Word: {{CURRENTTIME}}
7364 !! wikitext
7365 {{CURRENTTIME}}
7366 !! html
7367 <p>00:02
7368 </p>
7369 !! end
7370
7371 !! test
7372 Magic Word: {{CURRENTHOUR}}
7373 !! wikitext
7374 {{CURRENTHOUR}}
7375 !! html
7376 <p>00
7377 </p>
7378 !! end
7379
7380 !! test
7381 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7382 !! wikitext
7383 {{CURRENTWEEK}}
7384 !! html
7385 <p>1
7386 </p>
7387 !! end
7388
7389 !! test
7390 Magic Word: {{CURRENTYEAR}}
7391 !! wikitext
7392 {{CURRENTYEAR}}
7393 !! html
7394 <p>1970
7395 </p>
7396 !! end
7397
7398 !! test
7399 Magic Word: {{CURRENTTIMESTAMP}}
7400 !! wikitext
7401 {{CURRENTTIMESTAMP}}
7402 !! html
7403 <p>19700101000203
7404 </p>
7405 !! end
7406
7407 !! test
7408 Magic Words LOCAL (UTC)
7409 !! wikitext
7410 * {{LOCALMONTH}}
7411 * {{LOCALMONTH1}}
7412 * {{LOCALMONTHNAME}}
7413 * {{LOCALMONTHNAMEGEN}}
7414 * {{LOCALMONTHABBREV}}
7415 * {{LOCALDAY}}
7416 * {{LOCALDAY2}}
7417 * {{LOCALDAYNAME}}
7418 * {{LOCALYEAR}}
7419 * {{LOCALTIME}}
7420 * {{LOCALHOUR}}
7421 * {{LOCALWEEK}}
7422 * {{LOCALDOW}}
7423 * {{LOCALTIMESTAMP}}
7424 !! html
7425 <ul><li> 01</li>
7426 <li> 1</li>
7427 <li> January</li>
7428 <li> January</li>
7429 <li> Jan</li>
7430 <li> 1</li>
7431 <li> 01</li>
7432 <li> Thursday</li>
7433 <li> 1970</li>
7434 <li> 00:02</li>
7435 <li> 00</li>
7436 <li> 1</li>
7437 <li> 4</li>
7438 <li> 19700101000203</li></ul>
7439
7440 !! end
7441
7442 !! test
7443 Magic Word: {{FULLPAGENAME}}
7444 !! options
7445 title=[[User:Ævar Arnfjörð Bjarmason]]
7446 !! wikitext
7447 {{FULLPAGENAME}}
7448 !! html
7449 <p>User:Ævar Arnfjörð Bjarmason
7450 </p>
7451 !! end
7452
7453 !! test
7454 Magic Word: {{FULLPAGENAMEE}}
7455 !! options
7456 title=[[User:Ævar Arnfjörð Bjarmason]]
7457 !! wikitext
7458 {{FULLPAGENAMEE}}
7459 !! html
7460 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7461 </p>
7462 !! end
7463
7464 !! test
7465 Magic Word: {{TALKSPACE}}
7466 !! options
7467 title=[[User:Ævar Arnfjörð Bjarmason]]
7468 !! wikitext
7469 {{TALKSPACE}}
7470 !! html
7471 <p>User talk
7472 </p>
7473 !! end
7474
7475 !! test
7476 Magic Word: {{TALKSPACE}}, same namespace
7477 !! options
7478 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7479 !! wikitext
7480 {{TALKSPACE}}
7481 !! html
7482 <p>User talk
7483 </p>
7484 !! end
7485
7486 !! test
7487 Magic Word: {{TALKSPACE}}, main namespace
7488 !! options
7489 title=[[Parser Test]]
7490 !! wikitext
7491 {{TALKSPACE}}
7492 !! html
7493 <p>Talk
7494 </p>
7495 !! end
7496
7497 !! test
7498 Magic Word: {{TALKSPACEE}}
7499 !! options
7500 title=[[User:Ævar Arnfjörð Bjarmason]]
7501 !! wikitext
7502 {{TALKSPACEE}}
7503 !! html
7504 <p>User_talk
7505 </p>
7506 !! end
7507
7508 !! test
7509 Magic Word: {{SUBJECTSPACE}}
7510 !! options
7511 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7512 !! wikitext
7513 {{SUBJECTSPACE}}
7514 !! html
7515 <p>User
7516 </p>
7517 !! end
7518
7519 !! test
7520 Magic Word: {{SUBJECTSPACE}}, same namespace
7521 !! options
7522 title=[[User:Ævar Arnfjörð Bjarmason]]
7523 !! wikitext
7524 {{SUBJECTSPACE}}
7525 !! html
7526 <p>User
7527 </p>
7528 !! end
7529
7530 !! test
7531 Magic Word: {{SUBJECTSPACE}}, main namespace
7532 !! options
7533 title=[[Parser Test]]
7534 !! wikitext
7535 {{SUBJECTSPACE}}
7536 !! html
7537
7538 !! end
7539
7540 !! test
7541 Magic Word: {{SUBJECTSPACEE}}
7542 !! options
7543 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7544 !! wikitext
7545 {{SUBJECTSPACEE}}
7546 !! html
7547 <p>User
7548 </p>
7549 !! end
7550
7551 !! test
7552 Magic Word: {{NAMESPACE}}
7553 !! options
7554 title=[[User:Ævar Arnfjörð Bjarmason]]
7555 !! wikitext
7556 {{NAMESPACE}}
7557 !! html
7558 <p>User
7559 </p>
7560 !! end
7561
7562 !! test
7563 Magic Word: {{NAMESPACEE}}
7564 !! options
7565 title=[[User:Ævar Arnfjörð Bjarmason]]
7566 !! wikitext
7567 {{NAMESPACEE}}
7568 !! html
7569 <p>User
7570 </p>
7571 !! end
7572
7573 !! test
7574 Magic Word: {{NAMESPACENUMBER}}
7575 !! options
7576 title=[[User:Ævar Arnfjörð Bjarmason]]
7577 !! wikitext
7578 {{NAMESPACENUMBER}}
7579 !! html
7580 <p>2
7581 </p>
7582 !! end
7583
7584 !! test
7585 Magic Word: {{SUBPAGENAME}}
7586 !! options
7587 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7588 !! wikitext
7589 {{SUBPAGENAME}}
7590 !! html
7591 <p>sub ö
7592 </p>
7593 !! end
7594
7595 !! test
7596 Magic Word: {{SUBPAGENAMEE}}
7597 !! options
7598 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7599 !! wikitext
7600 {{SUBPAGENAMEE}}
7601 !! html
7602 <p>sub_%C3%B6
7603 </p>
7604 !! end
7605
7606 !! test
7607 Magic Word: {{ROOTPAGENAME}}
7608 !! options
7609 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7610 !! wikitext
7611 {{ROOTPAGENAME}}
7612 !! html
7613 <p>Ævar Arnfjörð Bjarmason
7614 </p>
7615 !! end
7616
7617 !! test
7618 Magic Word: {{ROOTPAGENAMEE}}
7619 !! options
7620 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7621 !! wikitext
7622 {{ROOTPAGENAMEE}}
7623 !! html
7624 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7625 </p>
7626 !! end
7627
7628 !! test
7629 Magic Word: {{BASEPAGENAME}}
7630 !! options
7631 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7632 !! wikitext
7633 {{BASEPAGENAME}}
7634 !! html
7635 <p>Ævar Arnfjörð Bjarmason
7636 </p>
7637 !! end
7638
7639 !! test
7640 Magic Word: {{BASEPAGENAMEE}}
7641 !! options
7642 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7643 !! wikitext
7644 {{BASEPAGENAMEE}}
7645 !! html
7646 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7647 </p>
7648 !! end
7649
7650 !! test
7651 Magic Word: {{TALKPAGENAME}}
7652 !! options
7653 title=[[User:Ævar Arnfjörð Bjarmason]]
7654 !! wikitext
7655 {{TALKPAGENAME}}
7656 !! html
7657 <p>User talk:Ævar Arnfjörð Bjarmason
7658 </p>
7659 !! end
7660
7661 !! test
7662 Magic Word: {{TALKPAGENAMEE}}
7663 !! options
7664 title=[[User:Ævar Arnfjörð Bjarmason]]
7665 !! wikitext
7666 {{TALKPAGENAMEE}}
7667 !! html
7668 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7669 </p>
7670 !! end
7671
7672 !! test
7673 Magic Word: {{SUBJECTPAGENAME}}
7674 !! options
7675 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7676 !! wikitext
7677 {{SUBJECTPAGENAME}}
7678 !! html
7679 <p>User:Ævar Arnfjörð Bjarmason
7680 </p>
7681 !! end
7682
7683 !! test
7684 Magic Word: {{SUBJECTPAGENAMEE}}
7685 !! options
7686 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7687 !! wikitext
7688 {{SUBJECTPAGENAMEE}}
7689 !! html
7690 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7691 </p>
7692 !! end
7693
7694 !! test
7695 Magic Word: {{NUMBEROFFILES}}
7696 !! wikitext
7697 {{NUMBEROFFILES}}
7698 !! html
7699 <p>5
7700 </p>
7701 !! end
7702
7703 !! test
7704 Magic Word: {{PAGENAME}}
7705 !! options
7706 title=[[User:Ævar Arnfjörð Bjarmason]]
7707 !! wikitext
7708 {{PAGENAME}}
7709 !! html
7710 <p>Ævar Arnfjörð Bjarmason
7711 </p>
7712 !! end
7713
7714 !! test
7715 Magic Word: {{PAGENAME}} with metacharacters
7716 !! options
7717 title=[['foo & bar = baz']]
7718 !! wikitext
7719 ''{{PAGENAME}}''
7720 !! html
7721 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7722 </p>
7723 !! end
7724
7725 !! test
7726 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7727 !! options
7728 title=[[*RFC 1234 http://example.com/]]
7729 !! wikitext
7730 {{PAGENAME}}
7731 !! html
7732 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7733 </p>
7734 !! end
7735
7736 !! test
7737 Magic Word: {{PAGENAMEE}}
7738 !! options
7739 title=[[User:Ævar Arnfjörð Bjarmason]]
7740 !! wikitext
7741 {{PAGENAMEE}}
7742 !! html
7743 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7744 </p>
7745 !! end
7746
7747 !! test
7748 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7749 !! options
7750 title=[[*RFC 1234 http://example.com/]]
7751 !! wikitext
7752 {{PAGENAMEE}}
7753 !! html
7754 <p>&#42;RFC_1234_http&#58;//example.com/
7755 </p>
7756 !! end
7757
7758 !! test
7759 Magic Word: {{REVISIONID}}
7760 !! wikitext
7761 {{REVISIONID}}
7762 !! html
7763 <p>1337
7764 </p>
7765 !! end
7766
7767 !! test
7768 Magic Word: {{SCRIPTPATH}}
7769 !! wikitext
7770 {{SCRIPTPATH}}
7771 !! html
7772 <p>/
7773 </p>
7774 !! end
7775
7776 !! test
7777 Magic Word: {{STYLEPATH}}
7778 !! wikitext
7779 {{STYLEPATH}}
7780 !! html
7781 <p>/skins
7782 </p>
7783 !! end
7784
7785 !! test
7786 Magic Word: {{SERVER}}
7787 !! wikitext
7788 {{SERVER}}
7789 !! html
7790 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7791 </p>
7792 !! end
7793
7794 !! test
7795 Magic Word: {{SERVERNAME}}
7796 !! wikitext
7797 {{SERVERNAME}}
7798 !! html
7799 <p>example.org
7800 </p>
7801 !! end
7802
7803 !! test
7804 Magic Word: {{SITENAME}}
7805 !! wikitext
7806 {{SITENAME}}
7807 !! html
7808 <p>MediaWiki
7809 </p>
7810 !! end
7811
7812 !! test
7813 Case-sensitive magic words, when cased differently, should just be template transclusions
7814 !! wikitext
7815 {{CurrentMonth}}
7816 {{currentday}}
7817 {{cURreNTweEK}}
7818 {{currentHour}}
7819 !! html
7820 <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>
7821 <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>
7822 <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>
7823 <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>
7824 </p>
7825 !! end
7826
7827 !! test
7828 Case-insensitive magic words should still work with weird casing.
7829 !! wikitext
7830 {{sErVeRNaMe}}
7831 {{LCFirst:AOEU}}
7832 {{ucFIRST:aoeu}}
7833 {{SERver}}
7834 !! html
7835 <p>example.org
7836 aOEU
7837 Aoeu
7838 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7839 </p>
7840 !! end
7841
7842 !! test
7843 Namespace 1 {{ns:1}}
7844 !! wikitext
7845 {{ns:1}}
7846 !! html
7847 <p>Talk
7848 </p>
7849 !! end
7850
7851 !! test
7852 Namespace 1 {{ns:01}}
7853 !! wikitext
7854 {{ns:01}}
7855 !! html
7856 <p>Talk
7857 </p>
7858 !! end
7859
7860 !! test
7861 Namespace 0 {{ns:0}} (bug 4783)
7862 !! wikitext
7863 {{ns:0}}
7864 !! html
7865
7866 !! end
7867
7868 !! test
7869 Namespace 0 {{ns:00}} (bug 4783)
7870 !! wikitext
7871 {{ns:00}}
7872 !! html
7873
7874 !! end
7875
7876 !! test
7877 Namespace -1 {{ns:-1}}
7878 !! wikitext
7879 {{ns:-1}}
7880 !! html
7881 <p>Special
7882 </p>
7883 !! end
7884
7885 !! test
7886 Namespace User {{ns:User}}
7887 !! wikitext
7888 {{ns:User}}
7889 !! html
7890 <p>User
7891 </p>
7892 !! end
7893
7894 !! test
7895 Namespace User talk {{ns:User_talk}}
7896 !! wikitext
7897 {{ns:User_talk}}
7898 !! html
7899 <p>User talk
7900 </p>
7901 !! end
7902
7903 !! test
7904 Namespace User talk {{ns:uSeR tAlK}}
7905 !! wikitext
7906 {{ns:uSeR tAlK}}
7907 !! html
7908 <p>User talk
7909 </p>
7910 !! end
7911
7912 !! test
7913 Namespace File {{ns:File}}
7914 !! wikitext
7915 {{ns:File}}
7916 !! html
7917 <p>File
7918 </p>
7919 !! end
7920
7921 !! test
7922 Namespace File {{ns:Image}}
7923 !! wikitext
7924 {{ns:Image}}
7925 !! html
7926 <p>File
7927 </p>
7928 !! end
7929
7930 !! test
7931 Namespace (lang=de) Benutzer {{ns:User}}
7932 !! options
7933 language=de
7934 !! wikitext
7935 {{ns:User}}
7936 !! html
7937 <p>Benutzer
7938 </p>
7939 !! end
7940
7941 !! test
7942 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7943 !! options
7944 language=de
7945 !! wikitext
7946 {{ns:3}}
7947 !! html
7948 <p>Benutzer Diskussion
7949 </p>
7950 !! end
7951
7952
7953 !! test
7954 Urlencode
7955 !! wikitext
7956 {{urlencode:hi world?!}}
7957 {{urlencode:hi world?!|WIKI}}
7958 {{urlencode:hi world?!|PATH}}
7959 {{urlencode:hi world?!|QUERY}}
7960 !! html
7961 <p>hi+world%3F%21
7962 hi_world%3F!
7963 hi%20world%3F%21
7964 hi+world%3F%21
7965 </p>
7966 !! end
7967
7968 !! test
7969 Magic Word: prioritize type info over data-parsoid
7970 !! options
7971 parsoid=html2wt
7972 !! wikitext
7973 __FORCETOC__
7974 !! html
7975 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7976 !! end
7977
7978 !! test
7979 Magic Word: serialize on separate line (parsoid)
7980 !! options
7981 parsoid=wt2wt,html2wt
7982 !! wikitext
7983 foo
7984 __NOTOC__
7985 bar
7986 !! html
7987 foo<meta property="mw:PageProp/notoc"/>bar
7988 !! end
7989
7990 !! test
7991 Magic Word: rt non-english wikis
7992 !! options
7993 parsoid=wt2wt
7994 language=de
7995 !! wikitext
7996 __NOEDITSECTION__
7997 !! html
7998 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7999 !! end
8000
8001 ###
8002 ### Magic links
8003 ###
8004 !! test
8005 Magic links: internal link to RFC (bug 479)
8006 !! wikitext
8007 [[RFC 123]]
8008 !! html
8009 <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>
8010 </p>
8011 !! end
8012
8013 !! test
8014 Magic links: RFC (bug 479)
8015 !! wikitext
8016 RFC 822
8017 !! html
8018 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8019 </p>
8020 !! end
8021
8022 !! test
8023 Magic links: ISBN (bug 1937)
8024 !! wikitext
8025 ISBN 0-306-40615-2
8026 !! html
8027 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8028 </p>
8029 !! end
8030
8031 !! test
8032 Magic links: PMID incorrectly converts space to underscore
8033 !! wikitext
8034 PMID 1234
8035 !! html
8036 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8037 </p>
8038 !! end
8039
8040 ###
8041 ### Templates
8042 ####
8043
8044 !! test
8045 Nonexistent template
8046 !! wikitext
8047 {{thistemplatedoesnotexist}}
8048 !! html
8049 <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>
8050 </p>
8051 !! end
8052
8053 !! test
8054 Template with invalid target containing tags
8055 !! wikitext
8056 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8057 !! html
8058 <p>{{a<b>b</b>|foo|a=b|a = b}}
8059 </p>
8060 !! end
8061
8062 !! test
8063 Template with invalid target containing unclosed tag
8064 !! wikitext
8065 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8066 !! html
8067 <p>{{a<b>|foo|a=b|a = b}}</b>
8068 </p>
8069 !! end
8070
8071 !! test
8072 Template with invalid target containing wikilink
8073 !! wikitext
8074 {{[[Main Page]]}}
8075 !! html/php
8076 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8077 </p>
8078 !! html/parsoid
8079 <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>
8080 !! end
8081
8082 !! article
8083 Template:test
8084 !! text
8085 This is a test template
8086 !! endarticle
8087
8088 !! test
8089 Simple template
8090 !! wikitext
8091 {{test}}
8092 !! html
8093 <p>This is a test template
8094 </p>
8095 !! end
8096
8097 !! test
8098 Template with explicit namespace
8099 !! wikitext
8100 {{Template:test}}
8101 !! html
8102 <p>This is a test template
8103 </p>
8104 !! end
8105
8106
8107 !! article
8108 Template:paramtest
8109 !! text
8110 This is a test template with parameter {{{param}}}
8111 !! endarticle
8112
8113 !! test
8114 Template parameter
8115 !! wikitext
8116 {{paramtest|param=foo}}
8117 !! html
8118 <p>This is a test template with parameter foo
8119 </p>
8120 !! end
8121
8122 !! article
8123 Template:paramtestnum
8124 !! text
8125 [[{{{1}}}|{{{2}}}]]
8126 !! endarticle
8127
8128 !! test
8129 Template unnamed parameter
8130 !! wikitext
8131 {{paramtestnum|Main Page|the main page}}
8132 !! html
8133 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8134 </p>
8135 !! end
8136
8137 !! article
8138 Template:templatesimple
8139 !! text
8140 (test)
8141 !! endarticle
8142
8143 !! article
8144 Template:templateredirect
8145 !! text
8146 #redirect [[Template:templatesimple]]
8147 !! endarticle
8148
8149 !! article
8150 Template:templateasargtestnum
8151 !! text
8152 {{{{{1}}}}}
8153 !! endarticle
8154
8155 !! article
8156 Template:templateasargtest
8157 !! text
8158 {{template{{{templ}}}}}
8159 !! endarticle
8160
8161 !! article
8162 Template:templateasargtest2
8163 !! text
8164 {{{{{templ}}}}}
8165 !! endarticle
8166
8167 !! test
8168 Template with template name as unnamed argument
8169 !! wikitext
8170 {{templateasargtestnum|templatesimple}}
8171 !! html
8172 <p>(test)
8173 </p>
8174 !! end
8175
8176 !! test
8177 Template with template name as argument
8178 !! wikitext
8179 {{templateasargtest|templ=simple}}
8180 !! html
8181 <p>(test)
8182 </p>
8183 !! end
8184
8185 !! test
8186 Template with template name as argument (2)
8187 !! wikitext
8188 {{templateasargtest2|templ=templatesimple}}
8189 !! html
8190 <p>(test)
8191 </p>
8192 !! end
8193
8194 !! article
8195 Template:templateasargtestdefault
8196 !! text
8197 {{{{{templ|templatesimple}}}}}
8198 !! endarticle
8199
8200 !! article
8201 Template:templa
8202 !! text
8203 '''templ'''
8204 !! endarticle
8205
8206 !! test
8207 Template with default value
8208 !! wikitext
8209 {{templateasargtestdefault}}
8210 !! html
8211 <p>(test)
8212 </p>
8213 !! end
8214
8215 !! test
8216 Template with default value (value set)
8217 !! wikitext
8218 {{templateasargtestdefault|templ=templa}}
8219 !! html
8220 <p><b>templ</b>
8221 </p>
8222 !! end
8223
8224 !! test
8225 Template redirect
8226 !! wikitext
8227 {{templateredirect}}
8228 !! html
8229 <p>(test)
8230 </p>
8231 !! end
8232
8233 !! test
8234 Template with argument in separate line
8235 !! wikitext
8236 {{ templateasargtest |
8237 templ = simple }}
8238 !! html
8239 <p>(test)
8240 </p>
8241 !! end
8242
8243 !! test
8244 Template with complex template as argument
8245 !! wikitext
8246 {{paramtest|
8247 param ={{ templateasargtest |
8248 templ = simple }}}}
8249 !! html
8250 <p>This is a test template with parameter (test)
8251 </p>
8252 !! end
8253
8254 !! test
8255 Template with thumb image (with link in description)
8256 !! wikitext
8257 {{paramtest|
8258 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8259 !! html
8260 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>
8261
8262 !! end
8263
8264 !! article
8265 Template:complextemplate
8266 !! text
8267 {{{1}}} {{paramtest|
8268 param ={{{param}}}}}
8269 !! endarticle
8270
8271 !! test
8272 Template with complex arguments
8273 !! wikitext
8274 {{complextemplate|
8275 param ={{ templateasargtest |
8276 templ = simple }}|[[Template:complextemplate|link]]}}
8277 !! html
8278 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8279 </p>
8280 !! end
8281
8282 !! test
8283 BUG 553: link with two variables in a piped link
8284 !! wikitext
8285 {|
8286 |[[{{{1}}}|{{{2}}}]]
8287 |}
8288 !! html
8289 <table>
8290 <tr>
8291 <td>[[{{{1}}}|{{{2}}}]]
8292 </td></tr></table>
8293
8294 !! end
8295
8296 !! test
8297 Magic variable as template parameter
8298 !! wikitext
8299 {{paramtest|param={{SITENAME}}}}
8300 !! html
8301 <p>This is a test template with parameter MediaWiki
8302 </p>
8303 !! end
8304
8305 !! article
8306 Template:linktest
8307 !! text
8308 [[{{{param}}}|link]]
8309 !! endarticle
8310
8311 !! test
8312 Template parameter as link source
8313 !! wikitext
8314 {{linktest|param=Main Page}}
8315 !! html
8316 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8317 </p>
8318 !! end
8319
8320 !!test
8321 Template-generated attribute string (k='v')
8322 !! wikitext
8323 <span {{attr_str|id|v1}}>bar</span>
8324 !! html
8325 <p><span id="v1">bar</span>
8326 </p>
8327 !!end
8328
8329 !!article
8330 Template:paramtest2
8331 !! text
8332 including another template, {{paramtest|param={{{arg}}}}}
8333 !! endarticle
8334
8335 !! test
8336 Template passing argument to another template
8337 !! wikitext
8338 {{paramtest2|arg='hmm'}}
8339 !! html
8340 <p>including another template, This is a test template with parameter 'hmm'
8341 </p>
8342 !! end
8343
8344 !! article
8345 Template:Linktest2
8346 !! text
8347 Main Page
8348 !! endarticle
8349
8350 !! test
8351 Template as link source
8352 !! wikitext
8353 [[{{linktest2}}]]
8354
8355 [[{{linktest2}}|Main Page]]
8356
8357 [[{{linktest2}}]]Page
8358 !! html
8359 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8360 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8361 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8362 </p>
8363 !! end
8364
8365
8366 !! article
8367 Template:loop1
8368 !! text
8369 {{loop2}}
8370 !! endarticle
8371
8372 !! article
8373 Template:loop2
8374 !! text
8375 {{loop1}}
8376 !! endarticle
8377
8378 !! test
8379 Template infinite loop
8380 !! wikitext
8381 {{loop1}}
8382 !! html
8383 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8384 </p>
8385 !! end
8386
8387 !! test
8388 Template from main namespace
8389 !! wikitext
8390 {{:Main Page}}
8391 !! html
8392 <p>blah blah
8393 </p>
8394 !! end
8395
8396 !! article
8397 Template:table
8398 !! text
8399 {|
8400 | 1 || 2
8401 |-
8402 | 3 || 4
8403 |}
8404 !! endarticle
8405
8406 !! test
8407 BUG 529: Template with table, not included at beginning of line
8408 !! wikitext
8409 foo {{table}}
8410 !! html
8411 <p>foo
8412 </p>
8413 <table>
8414 <tr>
8415 <td> 1 </td>
8416 <td> 2
8417 </td></tr>
8418 <tr>
8419 <td> 3 </td>
8420 <td> 4
8421 </td></tr></table>
8422
8423 !! end
8424
8425 !! test
8426 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8427 !! wikitext
8428 foo
8429 {{table}}
8430 !! html
8431 <p>foo
8432 </p>
8433 <table>
8434 <tr>
8435 <td> 1 </td>
8436 <td> 2
8437 </td></tr>
8438 <tr>
8439 <td> 3 </td>
8440 <td> 4
8441 </td></tr></table>
8442
8443 !! end
8444
8445 !! test
8446 BUG 41: Template parameters shown as broken links
8447 !! wikitext
8448 {{{parameter}}}
8449 !! html
8450 <p>{{{parameter}}}
8451 </p>
8452 !! end
8453
8454 !! test
8455 Template with targets containing wikilinks
8456 !! wikitext
8457 {{[[foo]]}}
8458
8459 {{[[{{echo|foo}}]]}}
8460
8461 {{{{echo|[[foo}}]]}}
8462 !! html
8463 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8464 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8465 </p><p>{{[[foo}}]]
8466 </p>
8467 !! end
8468
8469 !! article
8470 Template:MSGNW test
8471 !! text
8472 ''None'' of '''this''' should be
8473 * interpreted
8474 but rather passed unmodified
8475 {{test}}
8476 <gallery>
8477 File:Foobar.jpg
8478 </gallery>
8479 !! endarticle
8480
8481 # hmm, fix this or just deprecate msgnw and document its behavior?
8482 !! test
8483 msgnw keyword
8484 !! wikitext
8485 {{msgnw:MSGNW test}}
8486 !! html
8487 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8488 &#42; interpreted
8489 &#32;but rather passed unmodified
8490 &#123;&#123;test&#125;&#125;
8491 &#60;gallery&#62;
8492 File:Foobar.jpg
8493 &#60;/gallery&#62;
8494 </p>
8495 !! end
8496
8497 !! test
8498 int keyword
8499 !! wikitext
8500 {{int:youhavenewmessages|lots of money|not!}}
8501 !! html
8502 <p>You have lots of money (not!).
8503 </p>
8504 !! end
8505
8506 !! article
8507 Template:Includes
8508 !! text
8509 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8510 !! endarticle
8511
8512 !! test
8513 <includeonly> and <noinclude> being included
8514 !! wikitext
8515 {{Includes}}
8516 !! html
8517 <p>Foobar
8518 </p>
8519 !! end
8520
8521 !! article
8522 Template:Includes2
8523 !! text
8524 <onlyinclude>Foo</onlyinclude>bar
8525 !! endarticle
8526
8527 !! test
8528 <onlyinclude> being included
8529 !! wikitext
8530 {{Includes2}}
8531 !! html
8532 <p>Foo
8533 </p>
8534 !! end
8535
8536
8537 !! article
8538 Template:Includes3
8539 !! text
8540 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8541 !! endarticle
8542
8543 !! test
8544 <onlyinclude> and <includeonly> being included
8545 !! wikitext
8546 {{Includes3}}
8547 !! html
8548 <p>Foo
8549 </p>
8550 !! end
8551
8552 !! test
8553 <includeonly> and <noinclude> on a page
8554 !! wikitext
8555 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8556 !! html
8557 <p>Foozar
8558 </p>
8559 !! end
8560
8561 !! test
8562 Un-closed <noinclude>
8563 !! wikitext
8564 <noinclude>
8565 !! html
8566 !! end
8567
8568 !! test
8569 <onlyinclude> on a page
8570 !! wikitext
8571 <onlyinclude>Foo</onlyinclude>bar
8572 !! html
8573 <p>Foobar
8574 </p>
8575 !! end
8576
8577 !! test
8578 Un-closed <onlyinclude>
8579 !! wikitext
8580 <onlyinclude>
8581 !! html
8582 !! end
8583
8584 !!test
8585 Self-closed noinclude, includeonly, onlyinclude tags
8586 !! wikitext
8587 <noinclude />
8588 <includeonly />
8589 <onlyinclude />
8590 !! html
8591 <p><br />
8592 </p>
8593 !!end
8594
8595 !!test
8596 Unbalanced includeonly and noinclude tags
8597 !! wikitext
8598 {|
8599 |a</noinclude>
8600 |b</noinclude></noinclude>
8601 |c</noinclude></includeonly>
8602 |d</includeonly></includeonly>
8603 |}
8604 !! html
8605 <table>
8606 <tr>
8607 <td>a
8608 </td>
8609 <td>b
8610 </td>
8611 <td>c&lt;/includeonly&gt;
8612 </td>
8613 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8614 </td></tr></table>
8615
8616 !!end
8617
8618 !! article
8619 Template:Includeonly section
8620 !! text
8621 <includeonly>
8622 ==Includeonly section==
8623 </includeonly>
8624 ==Section T-1==
8625 !!endarticle
8626
8627 !! test
8628 Bug 6563: Edit link generation for section shown by <includeonly>
8629 !! wikitext
8630 {{includeonly section}}
8631 !! html
8632 <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>
8633 <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>
8634
8635 !! end
8636
8637 # Uses same input as the contents of [[Template:Includeonly section]]
8638 !! test
8639 Bug 6563: Section extraction for section shown by <includeonly>
8640 !! options
8641 section=T-2
8642 !! wikitext
8643 <includeonly>
8644 ==Includeonly section==
8645 </includeonly>
8646 ==Section T-2==
8647 !! html
8648 ==Section T-2==
8649 !! end
8650
8651 !! test
8652 Bug 6563: Edit link generation for section suppressed by <includeonly>
8653 !! wikitext
8654 <includeonly>
8655 ==Includeonly section==
8656 </includeonly>
8657 ==Section 1==
8658 !! html
8659 <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>
8660
8661 !! end
8662
8663 !! test
8664 Bug 6563: Section extraction for section suppressed by <includeonly>
8665 !! options
8666 section=1
8667 !! wikitext
8668 <includeonly>
8669 ==Includeonly section==
8670 </includeonly>
8671 ==Section 1==
8672 !! html
8673 ==Section 1==
8674 !! end
8675
8676 !! test
8677 Un-closed <includeonly>
8678 !! wikitext
8679 <includeonly>
8680 !! html
8681 !! end
8682
8683 # TODO: test with DOM fragment reuse!
8684 !! test
8685 Parsoid: DOM fragment reuse
8686 !! options
8687 parsoid=wt2wt,wt2html
8688 !! wikitext
8689 a{{echo|b<table></table>c}}d
8690
8691 a{{echo|b
8692 <table></table>
8693 c}}d
8694
8695 {{echo|a
8696
8697 <table></table>
8698
8699 b}}
8700 !! html
8701 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8702 <table></table>c"}},"i":0}}]}'>b</span>
8703 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8704
8705
8706 <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">
8707 </span>
8708 <table about="#mwt2"></table><span about="#mwt2">
8709 </span>
8710 <p about="#mwt2">cd</p>
8711
8712
8713 <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">
8714
8715 </span>
8716 <table about="#mwt3"></table><span about="#mwt3">
8717
8718 </span>
8719 <p about="#mwt3">b</p>
8720 !! end
8721
8722 !! test
8723 Parsoid: Merge double tds (bug 50603)
8724 !! options
8725 parsoid
8726 !! wikitext
8727 {|
8728 |{{echo|{{!}} foo}}
8729 |}
8730 !! html
8731 <table><tbody>
8732 <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>
8733 </tbody></table>
8734 !! end
8735
8736 !! test
8737 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8738 !! options
8739 parsoid
8740 !! wikitext
8741 {{echo|<div>}}
8742 {|
8743 |{{echo|{{!}} foo}}
8744 |}
8745 {{echo|</div>}}
8746 !! html
8747 <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}}]}'>
8748 <table><tbody>
8749 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8750 </tbody></table>
8751 </div>
8752 !! end
8753
8754 ###
8755 ### <includeonly> and <noinclude> in attributes
8756 ###
8757 !!test
8758 0. includeonly around the entire attribute
8759 !! wikitext
8760 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8761 !! html
8762 <p><span id="v2">bar</span>
8763 </p>
8764 !!end
8765
8766 !!test
8767 1. includeonly in html attr key
8768 !! wikitext
8769 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8770 !! html
8771 <p><span id="foo">bar</span>
8772 </p>
8773 !!end
8774
8775 !!test
8776 2. includeonly in html attr value
8777 !! wikitext
8778 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8779 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8780 !! html
8781 <p><span id="v1">bar</span>
8782 <span id="v1">bar</span>
8783 </p>
8784 !!end
8785
8786 !!test
8787 3. includeonly in part of an attr value
8788 !! wikitext
8789 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8790 !! html
8791 <p><span style="color:red;">bar</span>
8792 </p>
8793 !!end
8794
8795 !!test
8796 4. includeonly in table attributes
8797 !! wikitext
8798 {|
8799 |- <noinclude>
8800 |-
8801 |a
8802 </noinclude>
8803 |- <includeonly>
8804 |-
8805 |b
8806 </includeonly>
8807 |}
8808 !! html
8809 <table>
8810
8811
8812 <tr>
8813 <td>a
8814 </td></tr>
8815 </table>
8816
8817 !!end
8818
8819 ###
8820 ### Token Stream Patcher tests
8821 ###
8822 ### These tests won't always pass wt2wt and other modes because
8823 ### on serialization, the table will be output on a new line.
8824 ### For now, we are blacklisting them, and using this to test selser.
8825 ###
8826
8827 !!test
8828 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8829 !!options
8830 parsoid=wt2html,wt2wt
8831 !!wikitext
8832 {{echo|}}{| width = '100%'
8833 |foo
8834 |}
8835 !!html/parsoid
8836 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8837 <table width="100%">
8838 <tbody>
8839 <tr>
8840 <td>foo</td></tr></tbody></table>
8841 !!end
8842
8843 !!test
8844 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8845 !!options
8846 parsoid=wt2html,wt2wt
8847 !!wikitext
8848 <includeonly>a</includeonly>{| {{{b}}}
8849 |c
8850 |}
8851 !!html/parsoid
8852 <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|}"}'>
8853 <tbody><tr><td>c</td></tr>
8854 </tbody></table>
8855 !!end
8856
8857 ###
8858 ### Testing parsing of templates where a template arg
8859 ### has the same name as the template itself.
8860 ###
8861
8862 !! article
8863 Template:quote
8864 !! text
8865 {{{quote|{{{1}}}}}}
8866 !! endarticle
8867
8868 !!test
8869 Templates: Template Name/Arg clash: 1. Use of positional param
8870 !! wikitext
8871 {{quote|foo}}
8872 !! html
8873 <p>foo
8874 </p>
8875 !!end
8876
8877 !!test
8878 Templates: Template Name/Arg clash: 2. Use of named param
8879 !! wikitext
8880 {{quote|quote=foo}}
8881 !! html
8882 <p>foo
8883 </p>
8884 !!end
8885
8886 !!test
8887 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8888 !! wikitext
8889 {{quote|quote}}
8890 !! html
8891 <p>quote
8892 </p>
8893 !!end
8894
8895 ###
8896 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8897 ###
8898
8899 !!test
8900 Templates: 1. Simple use
8901 !! wikitext
8902 {{echo|Foo}}
8903 !! html
8904 <p>Foo
8905 </p>
8906 !!end
8907
8908 !!test
8909 Templates: 2. Inside a block tag
8910 !! wikitext
8911 <div>{{echo|Foo}}</div>
8912 <blockquote>{{echo|Foo}}</blockquote>
8913 !! html
8914 <div>Foo</div>
8915 <blockquote>Foo</blockquote>
8916
8917 !!end
8918
8919 !!test
8920 Templates: P-wrapping: 1a. Templates on consecutive lines
8921 !! wikitext
8922 {{echo|Foo}}
8923 {{echo|bar}}
8924 !! html
8925 <p>Foo
8926 bar
8927 </p>
8928 !!end
8929
8930 !!test
8931 Templates: P-wrapping: 1b. Templates on consecutive lines
8932 !! wikitext
8933 Foo
8934
8935 {{echo|bar}}
8936 {{echo|baz}}
8937 !! html
8938 <p>Foo
8939 </p><p>bar
8940 baz
8941 </p>
8942 !!end
8943
8944 !!test
8945 Templates: P-wrapping: 1c. Templates on consecutive lines
8946 !! wikitext
8947 {{echo|Foo}}
8948 {{echo|bar}} <div>baz</div>
8949 !! html
8950 <p>Foo
8951 </p>
8952 bar <div>baz</div>
8953
8954 !!end
8955
8956 !!test
8957 Templates: P-wrapping: 1d. Template preceded by comment-only line
8958 !!options
8959 parsoid
8960 !! wikitext
8961 <!-- foo -->
8962 {{echo|Bar}}
8963 !! html
8964 <!-- foo -->
8965
8966 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8967 !!end
8968
8969 !!test
8970 Templates: Inline Text: 1. Multiple template uses
8971 !! wikitext
8972 {{echo|Foo}}bar{{echo|baz}}
8973 !! html
8974 <p>Foobarbaz
8975 </p>
8976 !!end
8977
8978 !!test
8979 Templates: Inline Text: 2. Back-to-back template uses
8980 !! wikitext
8981 {{echo|Foo}}{{echo|bar}}
8982 !! html
8983 <p>Foobar
8984 </p>
8985 !!end
8986
8987 !!test
8988 Templates: Block Tags: 1. Multiple template uses
8989 !! wikitext
8990 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8991 !! html
8992 <div>Foo</div><div>bar</div><div>baz</div>
8993
8994 !!end
8995
8996 !!test
8997 Templates: Block Tags: 2. Back-to-back template uses
8998 !! wikitext
8999 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9000 !! html
9001 <div>Foo</div><div>bar</div>
9002
9003 !!end
9004
9005 !!test
9006 Templates: Links: 1. Simple example
9007 !! wikitext
9008 {{echo|[[Foo|bar]]}}
9009 !! html
9010 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9011 </p>
9012 !!end
9013
9014 !!test
9015 Templates: Links: 2. Generation of link href
9016 !! wikitext
9017 [[{{echo|Foo}}|bar]]
9018 !! html
9019 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9020 </p>
9021 !!end
9022
9023 !!test
9024 Templates: Links: 3. Generation of part of a link href
9025 !! wikitext
9026 [[Fo{{echo|o}}|bar]]
9027
9028 [[Foo{{echo|bar}}]]
9029
9030 [[Foo{{echo|bar}}baz]]
9031
9032 [[Foo{{echo|bar}}|bar]]
9033
9034 [[:Foo{{echo|bar}}]]
9035
9036 [[:Foo{{echo|bar}}|bar]]
9037 !! html
9038 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9039 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9040 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9041 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9042 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9043 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9044 </p>
9045 !!end
9046
9047 !!test
9048 Templates: Links: 4. Multiple templates generating link href
9049 !! wikitext
9050 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9051 !! html
9052 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9053 </p>
9054 !!end
9055
9056 !!test
9057 Templates: Links: 5. Generation of link text
9058 !! wikitext
9059 [[Foo|{{echo|bar}}]]
9060 !! html
9061 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9062 </p>
9063 !!end
9064
9065 !!test
9066 Templates: Links: 5. Nested templates (only outermost template should be marked)
9067 !! wikitext
9068 {{echo|[[{{echo|Foo}}|bar]]}}
9069 !! html
9070 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9071 </p>
9072 !!end
9073
9074 !!test
9075 Templates: HTML Tag: 1. Generation of HTML attr. key
9076 !! wikitext
9077 <div {{echo|style}}="color:red;">foo</div>
9078 !! html
9079 <div style="color:red;">foo</div>
9080
9081 !!end
9082
9083 !!test
9084 Templates: HTML Tag: 2. Generation of HTML attr. value
9085 !! wikitext
9086 <div style={{echo|'color:red;'}}>foo</div>
9087 !! html
9088 <div style="color:red;">foo</div>
9089
9090 !!end
9091
9092 !!test
9093 Templates: HTML Tag: 3. Generation of HTML attr key and value
9094 !! wikitext
9095 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9096 !! html
9097 <div style="color:red;">foo</div>
9098
9099 !!end
9100
9101 !!test
9102 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9103 !! wikitext
9104 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9105 !! html
9106 <div title="This is a long title with just one piece templated">foo</div>
9107
9108 !!end
9109
9110 !!test
9111 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9112 !! wikitext
9113 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9114 !! html
9115 <div title="This is a long title with just one piece templated">foo</div>
9116
9117 !!end
9118
9119 !!test
9120 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9121 !! wikitext
9122 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9123 !! html
9124 <div title="This is a long title with just one piece templated">foo</div>
9125
9126 !!end
9127
9128 !!test
9129 Templates: HTML Tag: 7. Generation of partial attribute key string
9130 !! wikitext
9131 <div st{{echo|yle}}="color:red;">foo</div>
9132 !! html
9133 <div style="color:red;">foo</div>
9134
9135 !!end
9136
9137 !!test
9138 Templates: HTML Tables: 1. Generating start of a HTML table
9139 !! wikitext
9140 {{echo|<table><tr><td>foo</td>}}</tr></table>
9141 !! html
9142 <table><tr><td>foo</td></tr></table>
9143
9144 !!end
9145
9146 !!test
9147 Templates: HTML Tables: 2a. Generating middle of a HTML table
9148 !! wikitext
9149 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9150 !! html
9151 <table><tr><td>foo</td></tr></table>
9152
9153 !!end
9154
9155 !!test
9156 Templates: HTML Tables: 2b. Generating middle of a HTML table
9157 !! wikitext
9158 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9159 !! html
9160 <table><tr><td>foo</td></tr></table>
9161
9162 !!end
9163
9164 !!test
9165 Templates: HTML Tables: 3. Generating end of a HTML table
9166 !! wikitext
9167 <table><tr>{{echo|<td>foo</td></tr></table>}}
9168 !! html
9169 <table><tr><td>foo</td></tr></table>
9170
9171 !!end
9172
9173 !!test
9174 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9175 !! wikitext
9176 {{echo|<table>}}<tr><td>foo</td></tr></table>
9177 !! html
9178 <table><tr><td>foo</td></tr></table>
9179
9180 !!end
9181
9182 !!test
9183 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9184 !! wikitext
9185 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9186 !! html
9187 <table><tr><td>foo</td></tr></table>
9188
9189 !!end
9190
9191 !!test
9192 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9193 !! wikitext
9194 <table><tr>{{echo|<td>}}foo</td></tr></table>
9195 !! html
9196 <table><tr><td>foo</td></tr></table>
9197
9198 !!end
9199
9200 !!test
9201 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9202 !! wikitext
9203 <table><tr><td>foo{{echo|</td>}}</tr></table>
9204 !! html
9205 <table><tr><td>foo</td></tr></table>
9206
9207 !!end
9208
9209 !!test
9210 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9211 !! wikitext
9212 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9213 !! html
9214 <table><tr><td>foo</td></tr></table>
9215
9216 !!end
9217
9218 !!test
9219 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9220 !! wikitext
9221 <table><tr><td>foo</td></tr>{{echo|</table>}}
9222 !! html
9223 <table><tr><td>foo</td></tr></table>
9224
9225 !!end
9226
9227 !!test
9228 Templates: HTML Tables: 5. Proper fostering of categories from inside
9229 !!options
9230 parsoid=wt2html,wt2wt
9231 !! wikitext
9232 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9233 <!--Two categories (Bug 50330)-->
9234 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9235 !! html
9236 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9237 <!--Two categories (Bug 50330)-->
9238 <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>
9239 !!end
9240
9241 !!test
9242 Templates: Wiki Tables: 1a. Fostering of entire template content
9243 !! wikitext
9244 {|
9245 {{echo|a}}
9246 |}
9247 !! html
9248 <table>
9249 a
9250 <tr><td></td></tr></table>
9251
9252 !!end
9253
9254 !!test
9255 Templates: Wiki Tables: 1b. Fostering of entire template content
9256 !! wikitext
9257 {|
9258 {{echo|<div>}}
9259 foo
9260 {{echo|</div>}}
9261 |}
9262 !! html
9263 <table>
9264 <div>
9265 <p>foo
9266 </p>
9267 </div>
9268 <tr><td></td></tr></table>
9269
9270 !!end
9271
9272 !!test
9273 Templates: Wiki Tables: 2. Fostering of partial template content
9274 !! wikitext
9275 {|
9276 {{echo|a
9277 <div>b</div>}}
9278 |}
9279 !! html
9280 <table>
9281 a
9282 <div>b</div>
9283 <tr><td></td></tr></table>
9284
9285 !!end
9286
9287 !!test
9288 Templates: Wiki Tables: 3. td-content via multiple templates
9289 !! wikitext
9290 {|
9291 {{echo|{{pipe}}a}}{{echo|b}}
9292 |}
9293 !! html
9294 <table>
9295 <tr>
9296 <td>ab
9297 </td></tr></table>
9298
9299 !!end
9300
9301 !!test
9302 Templates: Wiki Tables: 4. Templated tags, no content
9303 !! wikitext
9304 {{tbl-start}}
9305 {{tbl-end}}
9306 !! html
9307 <table>
9308 <tr><td></td></tr></table>
9309
9310 !!end
9311
9312 !!test
9313 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9314 !! wikitext
9315 {{tbl-start}}
9316 |foo
9317 {{tbl-end}}
9318 !! html
9319 <table>
9320 <tr>
9321 <td>foo
9322 </td></tr></table>
9323
9324 !!end
9325
9326 !!test
9327 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9328 !! wikitext
9329 {{tbl-start}}
9330 {{!}}foo
9331 {{tbl-end}}
9332 !! html
9333 <table>
9334 <tr>
9335 <td>foo
9336 </td></tr></table>
9337
9338 !!end
9339
9340 !!test
9341 Templates: Lists: Multi-line list-items via templates
9342 !! wikitext
9343 *{{echo|a {{nonexistent|
9344 unused}}}}
9345 *{{echo|b {{nonexistent|
9346 unused}}}}
9347 !! html
9348 <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>
9349 <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>
9350
9351 !!end
9352
9353 !!test
9354 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9355 !! wikitext
9356 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9357 !! html
9358 <p><i>ab</i>c<i>d</i>e
9359 </p>
9360 !!end
9361
9362 !!test
9363 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9364 (PHP parser generates misnested html)
9365 !! wikitext
9366 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9367 !! html/parsoid
9368 <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>
9369 !!end
9370
9371 !!test
9372 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9373 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9374 !! options
9375 parsoid=wt2html,wt2wt
9376 !! wikitext
9377 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9378 !! html
9379 <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>
9380 <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>
9381 <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>
9382 !!end
9383
9384 !!test
9385 Templates: Ugly nesting: 4. Divs opened/closed across templates
9386 !! wikitext
9387 a<div>b{{echo|c</div>d}}e
9388 !! html
9389 a<div>bc</div>de
9390
9391 !!end
9392
9393 !!test
9394 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9395 (Parsoid-centric)
9396 !! options
9397 parsoid
9398 !! wikitext
9399 {|
9400 |{{echo|foo</table>}}
9401 |bar
9402 |}
9403 !! html
9404 <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|}"]}'>
9405
9406 <tbody>
9407 <tr>
9408 <td>foo</td></tr></tbody></table><span about="#mwt1">
9409 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9410 |}</span>
9411 !!end
9412
9413 !!test
9414 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9415 (Parsoid-centric)
9416 !! options
9417 parsoid
9418 !! wikitext
9419 <table>
9420 <tr>
9421 <td>
9422 <table>
9423 <tr>
9424 <td>1. {{echo|foo </table>}}</td>
9425 <td> bar </td>
9426 <td>2. {{echo|baz </table>}}</td>
9427 </tr>
9428 <tr>
9429 <td>abc</td>
9430 </tr>
9431 </table>
9432 </td>
9433 </tr>
9434 <tr>
9435 <td>xyz</td>
9436 </tr>
9437 </table>
9438 !! html
9439 <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>"]}'>
9440 <tbody><tr>
9441 <td>
9442 <table>
9443 <tbody><tr>
9444 <td>1. foo </td></tr></tbody></table></td>
9445 <td> bar </td>
9446 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9447 </span><span about="#mwt2">
9448 </span><span about="#mwt2">
9449 </span><span about="#mwt2">abc</span><span about="#mwt2">
9450 </span><span about="#mwt2">
9451 </span><span about="#mwt2">
9452 </span><span about="#mwt2">
9453 </span><span about="#mwt2">
9454 </span><span about="#mwt2">
9455 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9456 </span><span about="#mwt2">
9457 </span>
9458 !!end
9459
9460 !! test
9461 Templates: Ugly templates: 3. newline-only template parameter
9462 !! wikitext
9463 foo {{echo|
9464 }}
9465 !! html
9466 <p>foo
9467 </p>
9468 !! end
9469
9470 # This looks like a bug: a single newline triggers p/br for some reason.
9471 !! test
9472 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9473 !! wikitext
9474 {{echo|
9475 }}
9476 !! html
9477 <p><br />
9478 </p>
9479 !! end
9480
9481 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9482 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9483 !! test
9484 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9485 !! wikitext
9486 {{echo|<table>}}
9487 {{echo|<div>foo}}
9488 {{echo|</table>}}
9489 !! html/parsoid
9490 <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
9491 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9492 </table>
9493 !! end
9494
9495 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9496 # that are "identical" and generate nesting cycles in the algorithm
9497 !! test
9498 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9499 !! wikitext
9500 {{echo|<table><tr><td><table>}}
9501 {{echo|<div>}}
9502 {{echo|</div>}}
9503 !! html/parsoid
9504 <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"}'>
9505 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9506 </table></td></tr></tbody></table>
9507 !! end
9508
9509 !!test
9510 Parser Functions: 1. Simple example
9511 !! wikitext
9512 {{uc:foo}}
9513 !! html
9514 <p>FOO
9515 </p>
9516 !!end
9517
9518 !!test
9519 Parser Functions: 2. Nested use (only outermost should be marked up)
9520 !! wikitext
9521 {{uc:{{lc:FOO}}}}
9522 !! html
9523 <p>FOO
9524 </p>
9525 !!end
9526
9527 ###
9528 ### Pre-save transform tests
9529 ###
9530 !! test
9531 pre-save transform: subst:
9532 !! options
9533 PST
9534 !! wikitext
9535 {{subst:test}}
9536 !! html
9537 This is a test template
9538 !! end
9539
9540 !! test
9541 pre-save transform: normal template
9542 !! options
9543 PST
9544 !! wikitext
9545 {{test}}
9546 !! html
9547 {{test}}
9548 !! end
9549
9550 !! test
9551 pre-save transform: nonexistent template
9552 !! options
9553 PST
9554 !! wikitext
9555 {{thistemplatedoesnotexist}}
9556 !! html
9557 {{thistemplatedoesnotexist}}
9558 !! end
9559
9560
9561 !! test
9562 pre-save transform: subst magic variables
9563 !! options
9564 PST
9565 !! wikitext
9566 {{subst:SITENAME}}
9567 !! html
9568 MediaWiki
9569 !! end
9570
9571 # This is bug 89, which I fixed. -- wtm
9572 !! test
9573 pre-save transform: subst: templates with parameters
9574 !! options
9575 pst
9576 !! wikitext
9577 {{subst:paramtest|param="something else"}}
9578 !! html
9579 This is a test template with parameter "something else"
9580 !! end
9581
9582 !! article
9583 Template:nowikitest
9584 !! text
9585 <nowiki>'''not wiki'''</nowiki>
9586 !! endarticle
9587
9588 !! test
9589 pre-save transform: nowiki in subst (bug 1188)
9590 !! options
9591 pst
9592 !! wikitext
9593 {{subst:nowikitest}}
9594 !! html
9595 <nowiki>'''not wiki'''</nowiki>
9596 !! end
9597
9598
9599 !! article
9600 Template:commenttest
9601 !! text
9602 This template has <!-- a comment --> in it.
9603 !! endarticle
9604
9605 !! test
9606 pre-save transform: comment in subst (bug 1936)
9607 !! options
9608 pst
9609 !! wikitext
9610 {{subst:commenttest}}
9611 !! html
9612 This template has <!-- a comment --> in it.
9613 !! end
9614
9615 !! test
9616 pre-save transform: unclosed tag
9617 !! options
9618 pst noxml
9619 !! wikitext
9620 <nowiki>'''not wiki'''
9621 !! html
9622 <nowiki>'''not wiki'''
9623 !! end
9624
9625 !! test
9626 pre-save transform: mixed tag case
9627 !! options
9628 pst noxml
9629 !! wikitext
9630 <NOwiki>'''not wiki'''</noWIKI>
9631 !! html
9632 <NOwiki>'''not wiki'''</noWIKI>
9633 !! end
9634
9635 !! test
9636 pre-save transform: unclosed comment in <nowiki>
9637 !! options
9638 pst noxml
9639 !! wikitext
9640 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9641 !! html
9642 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9643 !!end
9644
9645 # Leading @ in this template definition works around a limitation
9646 # in parsoid's parserTests which otherwise strips the <span> from the
9647 # result (confusing it for a template wrapper)
9648 !! article
9649 Template:dangerous
9650 !!text
9651 @<span onmouseover="alert('crap')">Oh no</span>
9652 !!endarticle
9653
9654 !!test
9655 (confirming safety of fix for subst bug 1936)
9656 !! wikitext
9657 {{Template:dangerous}}
9658 !! html
9659 <p>@<span>Oh no</span>
9660 </p>
9661 !! end
9662
9663 !! test
9664 pre-save transform: comment containing gallery (bug 5024)
9665 !! options
9666 pst
9667 !! wikitext
9668 <!-- <gallery>data</gallery> -->
9669 !! html
9670 <!-- <gallery>data</gallery> -->
9671 !!end
9672
9673 !! test
9674 pre-save transform: comment containing extension
9675 !! options
9676 pst
9677 !! wikitext
9678 <!-- <tag>data</tag> -->
9679 !! html
9680 <!-- <tag>data</tag> -->
9681 !!end
9682
9683 !! test
9684 pre-save transform: comment containing nowiki
9685 !! options
9686 pst
9687 !! wikitext
9688 <!-- <nowiki>data</nowiki> -->
9689 !! html
9690 <!-- <nowiki>data</nowiki> -->
9691 !!end
9692
9693 !! test
9694 pre-save transform: <noinclude> in subst (bug 3298)
9695 !! options
9696 pst
9697 !! wikitext
9698 {{subst:Includes}}
9699 !! html
9700 Foobar
9701 !! end
9702
9703 !! test
9704 pre-save transform: <onlyinclude> in subst (bug 3298)
9705 !! options
9706 pst
9707 !! wikitext
9708 {{subst:Includes2}}
9709 !! html
9710 Foo
9711 !! end
9712
9713 !! article
9714 Template:SubstTest
9715 !!text
9716 {{<includeonly>subst:</includeonly>Includes}}
9717 !! endarticle
9718
9719 !! article
9720 Template:SafeSubstTest
9721 !! text
9722 {{<includeonly>safesubst:</includeonly>Includes}}
9723 !! endarticle
9724
9725 !! test
9726 bug 22297: safesubst: works during PST
9727 !! options
9728 pst
9729 !! wikitext
9730 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9731 !! html
9732 FoobarFoobar
9733 !! end
9734
9735 !! test
9736 bug 22297: safesubst: works during normal parse
9737 !! wikitext
9738 {{SafeSubstTest}}
9739 !! html
9740 <p>Foobar
9741 </p>
9742 !! end
9743
9744 !! test
9745 subst: does not work during normal parse
9746 !! wikitext
9747 {{SubstTest}}
9748 !! html
9749 <p>{{subst:Includes}}
9750 </p>
9751 !! end
9752
9753 !! test
9754 pre-save transform: context links ("pipe trick")
9755 !! options
9756 pst
9757 !! wikitext
9758 [[Article (context)|]]
9759 [[Bar:Article|]]
9760 [[:Bar:Article|]]
9761 [[Bar:Article (context)|]]
9762 [[:Bar:Article (context)|]]
9763 [[|Article]]
9764 [[|Article (context)]]
9765 [[Bar:X (Y) Z|]]
9766 [[:Bar:X (Y) Z|]]
9767 !! html
9768 [[Article (context)|Article]]
9769 [[Bar:Article|Article]]
9770 [[:Bar:Article|Article]]
9771 [[Bar:Article (context)|Article]]
9772 [[:Bar:Article (context)|Article]]
9773 [[Article]]
9774 [[Article (context)]]
9775 [[Bar:X (Y) Z|X (Y) Z]]
9776 [[:Bar:X (Y) Z|X (Y) Z]]
9777 !! end
9778
9779 !! test
9780 pre-save transform: context links ("pipe trick") with interwiki prefix
9781 !! options
9782 pst
9783 !! wikitext
9784 [[interwiki:Article|]]
9785 [[:interwiki:Article|]]
9786 [[interwiki:Bar:Article|]]
9787 [[:interwiki:Bar:Article|]]
9788 !! html
9789 [[interwiki:Article|Article]]
9790 [[:interwiki:Article|Article]]
9791 [[interwiki:Bar:Article|Bar:Article]]
9792 [[:interwiki:Bar:Article|Bar:Article]]
9793 !! end
9794
9795 !! test
9796 pre-save transform: context links ("pipe trick") with parens in title
9797 !! options
9798 pst title=[[Somearticle (context)]]
9799 !! wikitext
9800 [[|Article]]
9801 !! html
9802 [[Article (context)|Article]]
9803 !! end
9804
9805 !! test
9806 pre-save transform: context links ("pipe trick") with comma in title
9807 !! options
9808 pst title=[[Someplace, Somewhere]]
9809 !! wikitext
9810 [[|Otherplace]]
9811 [[Otherplace, Elsewhere|]]
9812 [[Otherplace, Elsewhere, Anywhere|]]
9813 !! html
9814 [[Otherplace, Somewhere|Otherplace]]
9815 [[Otherplace, Elsewhere|Otherplace]]
9816 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9817 !! end
9818
9819 !! test
9820 pre-save transform: context links ("pipe trick") with parens and comma
9821 !! options
9822 pst title=[[Someplace (IGNORED), Somewhere]]
9823 !! wikitext
9824 [[|Otherplace]]
9825 [[Otherplace (place), Elsewhere|]]
9826 !! html
9827 [[Otherplace, Somewhere|Otherplace]]
9828 [[Otherplace (place), Elsewhere|Otherplace]]
9829 !! end
9830
9831 !! test
9832 pre-save transform: context links ("pipe trick") with comma and parens
9833 !! options
9834 pst title=[[Who, me? (context)]]
9835 !! wikitext
9836 [[|Yes, you.]]
9837 [[Me, Myself, and I (1937 song)|]]
9838 !! html
9839 [[Yes, you. (context)|Yes, you.]]
9840 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9841 !! end
9842
9843 !! test
9844 pre-save transform: context links ("pipe trick") with namespace
9845 !! options
9846 pst title=[[Ns:Somearticle]]
9847 !! wikitext
9848 [[|Article]]
9849 !! html
9850 [[Ns:Article|Article]]
9851 !! end
9852
9853 !! test
9854 pre-save transform: context links ("pipe trick") with namespace and parens
9855 !! options
9856 pst title=[[Ns:Somearticle (context)]]
9857 !! wikitext
9858 [[|Article]]
9859 !! html
9860 [[Ns:Article (context)|Article]]
9861 !! end
9862
9863 !! test
9864 pre-save transform: context links ("pipe trick") with namespace and comma
9865 !! options
9866 pst title=[[Ns:Somearticle, Context, Whatever]]
9867 !! wikitext
9868 [[|Article]]
9869 !! html
9870 [[Ns:Article, Context, Whatever|Article]]
9871 !! end
9872
9873 !! test
9874 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9875 !! options
9876 pst title=[[Ns:Somearticle, Context (context)]]
9877 !! wikitext
9878 [[|Article]]
9879 !! html
9880 [[Ns:Article (context)|Article]]
9881 !! end
9882
9883 !! test
9884 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9885 !! options
9886 pst title=[[Ns:Somearticle (IGNORED), Context]]
9887 !! wikitext
9888 [[|Article]]
9889 !! html
9890 [[Ns:Article, Context|Article]]
9891 !! end
9892
9893 !! test
9894 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9895 !! options
9896 pst
9897 !! wikitext
9898 [[Article(context)|]]
9899 [[Bar:Article(context)|]]
9900 [[:Bar:Article(context)|]]
9901 [[|Article(context)]]
9902 [[Bar:X(Y)Z|]]
9903 [[:Bar:X(Y)Z|]]
9904 !! html
9905 [[Article(context)|Article]]
9906 [[Bar:Article(context)|Article]]
9907 [[:Bar:Article(context)|Article]]
9908 [[Article(context)]]
9909 [[Bar:X(Y)Z|X(Y)Z]]
9910 [[:Bar:X(Y)Z|X(Y)Z]]
9911 !! end
9912
9913 !! test
9914 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9915 !! options
9916 pst
9917 !! wikitext
9918 [[Article (context)|]]
9919 [[Bar:Article (context)|]]
9920 [[:Bar:Article (context)|]]
9921 [[|Article (context)]]
9922 [[Bar:X (Y) Z|]]
9923 [[:Bar:X (Y) Z|]]
9924 !! html
9925 [[Article (context)|Article]]
9926 [[Bar:Article (context)|Article]]
9927 [[:Bar:Article (context)|Article]]
9928 [[Article (context)]]
9929 [[Bar:X (Y) Z|X (Y) Z]]
9930 [[:Bar:X (Y) Z|X (Y) Z]]
9931 !! end
9932
9933 !! test
9934 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9935 !! options
9936 pst
9937 !! wikitext
9938 [[Article(context)|]]
9939 [[Bar:Article(context)|]]
9940 [[:Bar:Article(context)|]]
9941 [[|Article(context)]]
9942 [[Bar:X(Y)Z|]]
9943 [[:Bar:X(Y)Z|]]
9944 !! html
9945 [[Article(context)|Article]]
9946 [[Bar:Article(context)|Article]]
9947 [[:Bar:Article(context)|Article]]
9948 [[Article(context)]]
9949 [[Bar:X(Y)Z|X(Y)Z]]
9950 [[:Bar:X(Y)Z|X(Y)Z]]
9951 !! end
9952
9953 !! test
9954 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9955 !! options
9956 pst
9957 !! wikitext
9958 [[Article (context), context|]]
9959 [[Article (context),context|]]
9960 [[Bar:Article (context), context|]]
9961 [[Bar:Article (context),context|]]
9962 [[:Bar:Article (context), context|]]
9963 [[:Bar:Article (context),context|]]
9964 !! html
9965 [[Article (context), context|Article]]
9966 [[Article (context),context|Article]]
9967 [[Bar:Article (context), context|Article]]
9968 [[Bar:Article (context),context|Article]]
9969 [[:Bar:Article (context), context|Article]]
9970 [[:Bar:Article (context),context|Article]]
9971 !! end
9972
9973 !! test
9974 pre-save transform: trim trailing empty lines
9975 !! options
9976 pst
9977 !! wikitext
9978 Empty lines are trimmed
9979
9980
9981
9982
9983 !! html
9984 Empty lines are trimmed
9985 !! end
9986
9987 !! test
9988 pre-save transform: Signature expansion
9989 !! options
9990 pst
9991 !! wikitext
9992 * ~~~
9993 * <noinclude>~~~</noinclude>
9994 * <includeonly>~~~</includeonly>
9995 * <onlyinclude>~~~</onlyinclude>
9996 !! html
9997 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9998 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9999 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10000 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10001 !! end
10002
10003
10004 !! test
10005 pre-save transform: Signature expansion in nowiki tags (bug 93)
10006 !! options
10007 pst disabled
10008 !! wikitext
10009 Shall not expand:
10010
10011 <nowiki>~~~~</nowiki>
10012
10013 <includeonly><nowiki>~~~~</nowiki></includeonly>
10014
10015 <noinclude><nowiki>~~~~</nowiki></noinclude>
10016
10017 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10018
10019 {{subst:Foo}} shall be converted to FOO
10020
10021 As well as inside noinclude/onlyinclude
10022 <noinclude>{{subst:Foo}}</noinclude>
10023 <onlyinclude>{{subst:Foo}}</onlyinclude>
10024
10025 But not inside includeonly
10026 <includeonly>{{subst:Foo}}</includeonly>
10027 !! html
10028 Shall not expand:
10029
10030 <nowiki>~~~~</nowiki>
10031
10032 <includeonly><nowiki>~~~~</nowiki></includeonly>
10033
10034 <noinclude><nowiki>~~~~</nowiki></noinclude>
10035
10036 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10037
10038 FOO shall be converted to FOO
10039
10040 As well as inside noinclude/onlyinclude
10041 <noinclude>FOO</noinclude>
10042 <onlyinclude>FOO</onlyinclude>
10043
10044 But not inside includeonly
10045 <includeonly>{{subst:Foo}}</includeonly>
10046 !! end
10047
10048 !! test
10049 Parsoid: Recognize nowiki with trailing space in tags
10050 !! options
10051 parsoid=wt2html
10052 !! wikitext
10053 <nowiki ><div>[[foo]]</nowiki >
10054
10055 a<nowiki / >b
10056
10057 c<nowiki />d
10058
10059 e<nowiki/ >f
10060 !! html
10061 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10062 <p>ab</p>
10063 <p>cd</p>
10064 <p>ef</p>
10065 !! end
10066
10067 !! test
10068 Parsoid: Recognize nowiki with odd capitalization
10069 !! options
10070 parsoid=wt2html
10071 !! wikitext
10072 <noWikI ><div>[[foo]]</Nowiki >
10073 !! html
10074 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10075 !! end
10076
10077
10078 !! test
10079 Parsoid: Escape nowiki with trailing space in tags
10080 !! options
10081 parsoid=html2wt
10082 !! wikitext
10083 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10084
10085 a&lt;nowiki /&gt;b
10086
10087 c&lt;nowiki/ &gt;d
10088 !! html
10089 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10090 <p>a&lt;nowiki /&gt;b</p>
10091 <p>c&lt;nowiki/ &gt;d</p>
10092 !! end
10093
10094 !! test
10095 Parsoid: Escape weird noWikI capitalizations
10096 !! options
10097 parsoid=html2wt
10098 !! wikitext
10099 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10100 !! html
10101 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10102 !! end
10103
10104 ###
10105 ### Message transform tests
10106 ###
10107 !! test
10108 message transform: magic variables
10109 !! options
10110 msg
10111 !! wikitext
10112 {{SITENAME}}
10113 !! html
10114 MediaWiki
10115 !! end
10116
10117 !! test
10118 message transform: should not transform wiki markup
10119 !! options
10120 msg
10121 !! wikitext
10122 ''test''
10123 !! html
10124 ''test''
10125 !! end
10126
10127 !! test
10128 message transform: <noinclude> in transcluded template (bug 4926)
10129 !! options
10130 msg
10131 !! wikitext
10132 {{Includes}}
10133 !! html
10134 Foobar
10135 !! end
10136
10137 !! test
10138 message transform: <onlyinclude> in transcluded template (bug 4926)
10139 !! options
10140 msg
10141 !! wikitext
10142 {{Includes2}}
10143 !! html
10144 Foo
10145 !! end
10146
10147 !! test
10148 {{#special:}} page name, known
10149 !! options
10150 msg
10151 !! wikitext
10152 {{#special:Recentchanges}}
10153 !! html
10154 Special:RecentChanges
10155 !! end
10156
10157 !! test
10158 {{#special:}} page name with subpage, known
10159 !! options
10160 msg
10161 !! wikitext
10162 {{#special:Recentchanges/param}}
10163 !! html
10164 Special:RecentChanges/param
10165 !! end
10166
10167 !! test
10168 {{#special:}} page name, unknown
10169 !! options
10170 msg
10171 !! wikitext
10172 {{#special:foobar nonexistent}}
10173 !! html
10174 Special:Foobar nonexistent
10175 !! end
10176
10177 !! test
10178 {{#speciale:}} page name, known
10179 !! options
10180 msg
10181 !! wikitext
10182 {{#speciale:Recentchanges}}
10183 !! html
10184 Special:RecentChanges
10185 !! end
10186
10187 !! test
10188 {{#speciale:}} page name with subpage, known
10189 !! options
10190 msg
10191 !! wikitext
10192 {{#speciale:Recentchanges/param}}
10193 !! html
10194 Special:RecentChanges/param
10195 !! end
10196
10197 !! test
10198 {{#speciale:}} page name, unknown
10199 !! options
10200 msg
10201 !! wikitext
10202 {{#speciale:foobar nonexistent}}
10203 !! html
10204 Special:Foobar_nonexistent
10205 !! end
10206
10207 ###
10208 ### Images
10209 ###
10210 ### For Parsoid-specific tests, see
10211 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10212
10213 !! test
10214 Simple image
10215 !! options
10216 parsoid=wt2html,wt2wt,html2html
10217 !! wikitext
10218 [[Image:foobar.jpg]]
10219 !! html/php
10220 <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>
10221 </p>
10222 !! html/parsoid
10223 <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>
10224 </p>
10225 !! end
10226
10227 !! test
10228 Simple image (using File: namespace, now canonical)
10229 !! wikitext
10230 [[File:Foobar.jpg]]
10231 !! html/php
10232 <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>
10233 </p>
10234 !! html/parsoid
10235 <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>
10236 </p>
10237 !! end
10238
10239 !! test
10240 Right-aligned image
10241 !! wikitext
10242 [[File:Foobar.jpg|right]]
10243 !! html/php
10244 <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>
10245
10246 !! html/parsoid
10247 <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>
10248 !! end
10249
10250 !! test
10251 Image with caption
10252 !! wikitext
10253 [[File:Foobar.jpg|right|Caption text]]
10254 !! html/php
10255 <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>
10256
10257 !! html/parsoid
10258 <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>
10259 !! end
10260
10261 !! test
10262 Image with caption, bug 53312 #1
10263 !! wikitext
10264 [[File:Foobar.jpg|right|Caption page stuff]]
10265 !! html/php
10266 <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>
10267
10268 !! html/parsoid
10269 <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>
10270 !! end
10271
10272 !! test
10273 Image with caption, bug 53312 #2
10274 !! wikitext
10275 [[File:Foobar.jpg|right|Caption page=]]
10276 !! html/php
10277 <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>
10278
10279 !! html/parsoid
10280 <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>
10281 !! end
10282
10283 !! test
10284 Image with caption, bug 53312 #3
10285 !! wikitext
10286 [[File:Foobar.jpg|right|Caption page=stuff]]
10287 !! html/php
10288 <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>
10289
10290 !! html/parsoid
10291 <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>
10292 !! end
10293
10294 !! test
10295 Allow empty links in image captions (Bug 60753)
10296 !! options
10297 thumbsize=220
10298 !! wikitext
10299 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10300 [[]]
10301 [[Link2]]
10302 ]]
10303 !! html/php
10304 <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>
10305
10306 !! html/parsoid
10307 <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>
10308 [[]]
10309 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10310 </figcaption></figure>
10311 !! end
10312
10313 !! test
10314 Link with empty target
10315 !! wikitext
10316 [[]]
10317 !! html
10318 <p>[[]]
10319 </p>
10320 !! end
10321
10322 !! test
10323 Image with empty attribute
10324 !! options
10325 parsoid=wt2html,wt2wt,html2html
10326 !! wikitext
10327 [[File:Foobar.jpg|right||Caption text]]
10328 !! html/php
10329 <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>
10330
10331 !! html/parsoid
10332 <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>
10333 !! end
10334
10335 !! test
10336 1. Block image with individual attributes from templates
10337 !! wikitext
10338 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10339 !! html/php
10340 <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>
10341
10342 !! html/parsoid
10343 <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>
10344 !! end
10345
10346 !! test
10347 2. Block Image with individual attributes from templates
10348 !! wikitext
10349 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10350 !! html/php
10351 <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>
10352
10353 !! html/parsoid
10354 <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>
10355 !! end
10356
10357 !! test
10358 3. Inline image with individual attributes from templates
10359 !! wikitext
10360 [[File:Foobar.jpg|{{echo|50px}}]]
10361 !! html/php
10362 <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>
10363 </p>
10364 !! html/parsoid
10365 <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>
10366 !! end
10367
10368 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10369 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10370 !! test
10371 Image with multiple attributes from the same template
10372 !! wikitext
10373 [[File:Foobar.jpg|{{image_attribs}}]]
10374 !! html/php
10375 <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>
10376
10377 !! html/parsoid
10378 <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>
10379 !! end
10380
10381 !! test
10382 Image with link tails
10383 !! options
10384 thumbsize=220
10385 !! wikitext
10386 123[[File:Foobar.jpg]]456
10387 123[[File:Foobar.jpg|right]]456
10388 123[[File:Foobar.jpg|thumb]]456
10389 !! html/php
10390 <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
10391 </p>
10392 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
10393 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
10394
10395 !! html/parsoid
10396 <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>
10397 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
10398 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
10399 !! end
10400
10401 !! test
10402 Image with multiple captions -- only last one is accepted
10403 !! wikitext
10404 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10405 !! html/php
10406 <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>
10407
10408 !! html/parsoid
10409 <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>
10410 !! end
10411
10412 !! test
10413 Image with multiple widths -- use last
10414 !! wikitext
10415 [[File:Foobar.jpg|200px|300px|caption]]
10416 !! html/php
10417 <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>
10418 </p>
10419 !! html/parsoid
10420 <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>
10421 !! end
10422
10423 !! test
10424 Image with multiple alignments -- use first (bug 48664)
10425 !! options
10426 thumbsize=220
10427 !! wikitext
10428 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10429
10430 [[File:Foobar.jpg|middle|text-top|caption]]
10431 !! html/php
10432 <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>
10433 <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>
10434 </p>
10435 !! html/parsoid
10436 <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>
10437 <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>
10438 !! end
10439
10440 !! test
10441 Image with width attribute at different positions
10442 !! wikitext
10443 [[File:Foobar.jpg|200px|right|Caption]]
10444 [[File:Foobar.jpg|right|200px|Caption]]
10445 [[File:Foobar.jpg|right|Caption|200px]]
10446 !! html/php
10447 <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>
10448 <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>
10449 <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>
10450
10451 !! html/parsoid
10452 <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>
10453 <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>
10454 <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>
10455 !! end
10456
10457 # a sad bit of backward-compatibility
10458 !! test
10459 Image with size specified with pxpx (bug 13500, 51628)
10460 !! options
10461 parsoid=wt2html,wt2wt,html2html
10462 !! wikitext
10463 [[File:Foobar.jpg|20pxpx]]
10464 [[File:Foobar.jpg|200x20pxpx]]
10465 !! html/php
10466 <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>
10467 <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>
10468 </p>
10469 !! html/parsoid
10470 <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>
10471 !! end
10472
10473 !! test
10474 Image with link parameter, wiki target
10475 !! wikitext
10476 [[File:Foobar.jpg|link=Main Page]]
10477 !! html/php
10478 <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>
10479 </p>
10480 !! html/parsoid
10481 <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>
10482 !! end
10483
10484 # parsoid bug 49293 (part 1)
10485 !! test
10486 Image with link parameter, URL target
10487 !! wikitext
10488 [[File:Foobar.jpg|link=http://example.com/]]
10489 !! html/php
10490 <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>
10491 </p>
10492 !! html/parsoid
10493 <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>
10494 !! end
10495
10496 # parsoid bug 49293 (part 2)
10497 !! test
10498 Image with link parameter, protocol-less URL target
10499 !! wikitext
10500 [[File:Foobar.jpg|link=//example.com/]]
10501 !! html/php
10502 <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>
10503 </p>
10504 !! html/parsoid
10505 <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>
10506 !! end
10507
10508 !! test
10509 Image with link parameter, wgExternalLinkTarget
10510 !! wikitext
10511 [[Image:foobar.jpg|link=http://example.com/]]
10512 !! config
10513 wgExternalLinkTarget='foobar'
10514 !! html
10515 <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>
10516 </p>
10517 !! end
10518
10519 !! test
10520 Image with link parameter, wgNoFollowLinks set to false
10521 !! wikitext
10522 [[Image:foobar.jpg|link=http://example.com/]]
10523 !! config
10524 wgNoFollowLinks=false
10525 !! html
10526 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10527 </p>
10528 !! end
10529
10530 !! test
10531 Image with link parameter, wgNoFollowDomainExceptions
10532 !! wikitext
10533 [[Image:foobar.jpg|link=http://example.com/]]
10534 !! config
10535 wgNoFollowDomainExceptions='example.com'
10536 !! html
10537 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10538 </p>
10539 !! end
10540
10541 !! test
10542 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10543 !! wikitext
10544 [[Image:foobar.jpg|link=http://example.com/|Title]]
10545 !! config
10546 wgExternalLinkTarget='foobar'
10547 !! html
10548 <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>
10549 </p>
10550 !! end
10551
10552 !! test
10553 Image with empty link parameter
10554 !! wikitext
10555 [[File:Foobar.jpg|link=]]
10556 !! html/php
10557 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10558 </p>
10559 !! html/parsoid
10560 <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>
10561 !! end
10562
10563 !! test
10564 Image with link parameter (wiki target) and unnamed parameter
10565 !! wikitext
10566 [[File:Foobar.jpg|link=Main_Page|Title]]
10567 !! html/php
10568 <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>
10569 </p>
10570 !! html/parsoid
10571 <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>
10572 !! end
10573
10574 !! test
10575 Image with link parameter (URL target) and unnamed parameter
10576 !! wikitext
10577 [[File:Foobar.jpg|link=http://example.com/|Title]]
10578 !! html/php
10579 <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>
10580 </p>
10581 !! html/parsoid
10582 <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>
10583 !! end
10584
10585 !! test
10586 Thumbnail image with link parameter
10587 !! options
10588 thumbsize=220
10589 parsoid=wt2html,wt2wt,html2html
10590 !! wikitext
10591 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10592 !! html/php
10593 <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>
10594
10595 !! html/parsoid
10596 <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>
10597 !! end
10598
10599 !! test
10600 Manually-specified thumbnail image
10601 !! options
10602 thumbsize=220
10603 !! wikitext
10604 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10605 !! html/php
10606 <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>
10607
10608 !! html/parsoid
10609 <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>
10610 !! end
10611
10612 !! test
10613 Manually-specified thumbnail image with explicit link to wiki page
10614 !! options
10615 thumbsize=220
10616 parsoid=wt2html,wt2wt,html2html
10617 !! wikitext
10618 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10619 !! html/php
10620 <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>
10621
10622 !! html/parsoid
10623 <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>
10624 !! end
10625
10626 !! test
10627 Manually-specified thumbnail image with explicit link to url
10628 !! options
10629 thumbsize=220
10630 parsoid=wt2html,wt2wt,html2html
10631 !! wikitext
10632 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10633 !! html/php
10634 <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>
10635
10636 !! html/parsoid
10637 <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>
10638 !! end
10639
10640 !! test
10641 Manually-specified thumbnail image with explicit no link
10642 !! options
10643 thumbsize=220
10644 parsoid=wt2html,wt2wt,html2html
10645 !! wikitext
10646 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10647 !! html/php
10648 <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>
10649
10650 !! html/parsoid
10651 <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>
10652 !! end
10653
10654 !! test
10655 Manually-specified thumbnail image with explicit link and alt text
10656 !! options
10657 thumbsize=220
10658 parsoid=wt2html,wt2wt,html2html
10659 !! wikitext
10660 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10661 !! html/php
10662 <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>
10663
10664 !! html/parsoid
10665 <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>
10666 !! end
10667
10668 !! test
10669 Image with frame and link
10670 !! options
10671 parsoid=wt2html,wt2wt,html2html
10672 !! wikitext
10673 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10674 !! html/php
10675 <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>
10676
10677 !! html/parsoid
10678 <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>
10679 !! end
10680
10681 !! test
10682 Image with frame and link and explicit alt
10683 !! options
10684 parsoid=wt2html,wt2wt,html2html
10685 !! wikitext
10686 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10687 !! html/php
10688 <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>
10689
10690 !! html/parsoid
10691 <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>
10692 !! end
10693
10694 !! test
10695 Image with wiki markup in implicit alt
10696 !! options
10697 parsoid=wt2html,wt2wt,html2html
10698 !! wikitext
10699 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10700
10701 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10702 !! html/php
10703 <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>
10704 </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>
10705 </p>
10706 !! html/parsoid
10707 <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>
10708 <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>
10709 !! end
10710
10711 ###################
10712 # Conflicting image format options.
10713 # First option specified should 'win'.
10714 # All three cases in each test should be identical.
10715
10716 !! test
10717 Image with 'frameless' first.
10718 !! options
10719 parsoid=wt2html,wt2wt,html2html
10720 !! wikitext
10721 [[File:Foobar.jpg|frameless|caption]]
10722
10723 [[File:Foobar.jpg|frameless|frame|caption]]
10724
10725 [[File:Foobar.jpg|frameless|thumb|caption]]
10726 !! html/php
10727 <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>
10728 </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>
10729 </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>
10730 </p>
10731 !! html/parsoid
10732 <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>
10733 <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>
10734 <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>
10735 !! end
10736
10737 !! test
10738 Image with 'frame' first.
10739 !! options
10740 parsoid=wt2html,wt2wt,html2html
10741 !! wikitext
10742 [[File:Foobar.jpg|frame|caption]]
10743 [[File:Foobar.jpg|frame|frameless|caption]]
10744 [[File:Foobar.jpg|frame|thumb|caption]]
10745 !! html/php
10746 <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>
10747 <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>
10748 <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>
10749
10750 !! html/parsoid
10751 <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>
10752 !! end
10753
10754 !! test
10755 Image with 'thumb' first.
10756 !! options
10757 parsoid=wt2html,wt2wt,html2html
10758 !! wikitext
10759 [[File:Foobar.jpg|thumb|caption]]
10760 [[File:Foobar.jpg|thumb|frameless|caption]]
10761 [[File:Foobar.jpg|thumb|frame|caption]]
10762 !! html/php
10763 <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>
10764 <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>
10765 <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>
10766
10767 !! html/parsoid
10768 <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>
10769 !! end
10770
10771 ###################
10772 # Image sizing.
10773 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10774 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10775 # Foobar has actual size of 1941x220
10776 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10777 # a scalable format.
10778 # 2. Framed images always ignore size options; always render at default size.
10779 # 3. "Unspecified format" and border are the only types which can be
10780 # enlarged.
10781
10782 !! test
10783 Image: "unspecified format" and border enlarge
10784 !! options
10785 parsoid=wt2html,wt2wt,html2html
10786 !! wikitext
10787 [[File:Foobar.jpg|2000px]]
10788
10789 [[File:Foobar.jpg|border|2000px]]
10790 !! html/php
10791 <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>
10792 </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>
10793 </p>
10794 !! html/parsoid
10795 <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>
10796 <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>
10797 !! end
10798
10799 !! test
10800 Image: "unspecified format" and border reduce
10801 !! options
10802 parsoid=wt2html,wt2wt,html2html
10803 !! wikitext
10804 [[File:Foobar.jpg|1000px]]
10805
10806 [[File:Foobar.jpg|border|1000px]]
10807 !! html/php
10808 <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>
10809 </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>
10810 </p>
10811 !! html/parsoid
10812 <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>
10813 <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>
10814 !! end
10815
10816 !! test
10817 Image: thumbs reduce
10818 !! options
10819 parsoid=wt2html,wt2wt,html2html
10820 !! wikitext
10821 [[File:Foobar.jpg|thumb|50px]]
10822 !! html/php
10823 <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>
10824
10825 !! html/parsoid
10826 <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>
10827 !! end
10828
10829 !! test
10830 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10831 !! options
10832 parsoid=wt2html,wt2wt,html2html
10833 !! wikitext
10834 [[File:Foobar.jpg|thumb|2000px]]
10835
10836 [[File:Foobar.svg|thumb|2000px]]
10837 !! html/php
10838 <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>
10839 <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>
10840
10841 !! html/parsoid
10842 <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>
10843 <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>
10844 !! end
10845
10846 !! test
10847 Image: frameless can reduce in size
10848 !! options
10849 parsoid=wt2html,wt2wt,html2html
10850 !! wikitext
10851 [[File:Foobar.jpg|frameless|50px]]
10852 !! html/php
10853 <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>
10854 </p>
10855 !! html/parsoid
10856 <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>
10857 !! end
10858
10859 !! test
10860 Image: bitmap frameless can't be enlarged past original size, but vector can
10861 !! options
10862 parsoid=wt2html,wt2wt,html2html
10863 !! wikitext
10864 [[File:Foobar.jpg|frameless|2000px]]
10865
10866 [[File:Foobar.svg|frameless|2000px]]
10867 !! html/php
10868 <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>
10869 </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>
10870 </p>
10871 !! html/parsoid
10872 <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>
10873 <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>
10874 !! end
10875
10876 !! test
10877 Image: framed images are always unscaled.
10878 !! options
10879 parsoid=wt2html,wt2wt,html2html
10880 !! wikitext
10881 [[File:Foobar.jpg|frame]]
10882
10883 [[File:Foobar.jpg|frame|50px]]
10884
10885 [[File:Foobar.jpg|frame|50x50px]]
10886
10887 [[File:Foobar.jpg|frame|2000px]]
10888 !! html/php
10889 <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>
10890 <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>
10891 <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>
10892 <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>
10893
10894 !! html/parsoid
10895 <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>
10896 !! end
10897
10898 ###################
10899
10900 !! test
10901 Link to image page- image page normally doesn't exists, hence edit link
10902 Add test with existing image page
10903 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10904 !! wikitext
10905 [[:Image:test]]
10906 !! html
10907 <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>
10908 </p>
10909 !! end
10910
10911 !! test
10912 bug 18784 Link to non-existent image page with caption should use caption as link text
10913 !! wikitext
10914 [[:Image:test|caption]]
10915 !! html
10916 <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>
10917 </p>
10918 !! end
10919
10920 !! test
10921 Frameless image caption with a free URL
10922 !! wikitext
10923 [[File:Foobar.jpg|http://example.com]]
10924 !! html/php
10925 <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>
10926 </p>
10927 !! html/parsoid
10928 <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>
10929 !! end
10930
10931 !! test
10932 Thumbnail image caption with a free URL
10933 !! options
10934 thumbsize=220
10935 !! wikitext
10936 [[File:Foobar.jpg|thumb|http://example.com]]
10937 !! html/php
10938 <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>
10939
10940 !! html/parsoid
10941 <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>
10942 !! end
10943
10944 !! test
10945 Thumbnail image caption with a free URL and explicit alt
10946 !! options
10947 thumbsize=220
10948 parsoid=wt2html,wt2wt,html2html
10949 !! wikitext
10950 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10951 !! html/php
10952 <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>
10953
10954 !! html/parsoid
10955 <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>
10956 !! end
10957
10958 !! test
10959 SVG thumbnails with no language set
10960 !! options
10961 !! wikitext
10962 [[File:Foobar.svg|thumb|caption]]
10963 !! html/php
10964 <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>
10965
10966 !! html/parsoid
10967 <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>
10968 !! end
10969
10970 !! test
10971 SVG thumbnails with language de
10972 !! options
10973 parsoid=wt2html,wt2wt,html2html
10974 !! wikitext
10975 [[File:Foobar.svg|thumb|caption|lang=de]]
10976 !! html/php
10977 <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>
10978
10979 !! html/parsoid
10980 <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>
10981 !! end
10982
10983 !! test
10984 SVG thumbnails with invalid language code
10985 !! options
10986 parsoid=wt2html,wt2wt,html2html
10987 !! wikitext
10988 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10989 !! html/php
10990 <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>
10991
10992 !! html/parsoid
10993 <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>
10994 !! end
10995
10996 !! test
10997 BUG 1887: A ISBN with a thumbnail
10998 !! wikitext
10999 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11000 !! html/php
11001 <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>
11002
11003 !! html/parsoid
11004 <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>
11005 !! end
11006
11007 !! test
11008 BUG 1887: A RFC with a thumbnail
11009 !! wikitext
11010 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11011 !! html/php
11012 <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>
11013
11014 !! html/parsoid
11015 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
11016 !! end
11017
11018 !! test
11019 BUG 1887: A mailto link with a thumbnail
11020 !! wikitext
11021 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11022 !! html/php
11023 <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>
11024
11025 !! html/parsoid
11026 <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>
11027 !! end
11028
11029 # Pending resolution to bug 368
11030 !! test
11031 BUG 648: Frameless image caption with a link
11032 !! wikitext
11033 [[File:Foobar.jpg|text with a [[link]] in it]]
11034 !! html/php
11035 <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>
11036 </p>
11037 !! html/parsoid
11038 <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>
11039 !! end
11040
11041 !! test
11042 BUG 648: Frameless image caption with a link (suffix)
11043 !! wikitext
11044 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11045 !! html/php
11046 <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>
11047 </p>
11048 !! html/parsoid
11049 <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>
11050 !! end
11051
11052 !! test
11053 BUG 648: Frameless image caption with an interwiki link
11054 !! wikitext
11055 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11056 !! html/php
11057 <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>
11058 </p>
11059 !! html/parsoid
11060 <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>
11061 !! end
11062
11063 !! test
11064 BUG 648: Frameless image caption with a piped interwiki link
11065 !! wikitext
11066 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11067 !! html/php
11068 <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>
11069 </p>
11070 !! html/parsoid
11071 <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>
11072 !! end
11073
11074 !! test
11075 Escape HTML special chars in image alt text
11076 !! wikitext
11077 [[File:Foobar.jpg|& < > "]]
11078 !! html/php
11079 <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>
11080 </p>
11081 !! html/parsoid
11082 <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>
11083 !! end
11084
11085 !! test
11086 BUG 499: Alt text should have &#1234;, not &amp;1234;
11087 !! wikitext
11088 [[File:Foobar.jpg|&#9792;]]
11089 !! html/php
11090 <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>
11091 </p>
11092 !! html/parsoid
11093 <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>
11094 !! end
11095
11096 !! test
11097 Broken image caption with link
11098 !! options
11099 parsoid=wt2html,wt2wt,html2html
11100 !! wikitext
11101 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11102 !! html/php
11103 <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.
11104 </p>
11105 !! html/parsoid
11106 <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>
11107 !! end
11108
11109 !! test
11110 Image caption containing another image
11111 !! wikitext
11112 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11113 !! html/php
11114 <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>
11115
11116 !! html/parsoid
11117 <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>
11118 !! end
11119
11120 !! test
11121 Image: caption containing a newline
11122 !! wikitext
11123 [[File:Foobar.jpg|This
11124 *is some text]]
11125 !! html/php
11126 <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>
11127 </p>
11128 !! html/parsoid
11129 <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>
11130 !!end
11131
11132 !!test
11133 Image: caption containing leading space
11134 (The leading space should not trigger nowiki escaping in wt2wt mode)
11135 !! wikitext
11136 [[File:Foobar.jpg|thumb| bar]]
11137 !! html/php
11138 <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>
11139
11140 !! html/parsoid
11141 <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>
11142 !!end
11143
11144 !! test
11145 Image: caption containing a table
11146 !! options
11147 parsoid=wt2html,wt2wt,html2html
11148 !! wikitext
11149 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11150 {|
11151 ! Foo !! Bar
11152 |-
11153 | Foo1 || Bar1
11154 |}
11155 and some more text.]]
11156 !! html/php
11157 <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>
11158
11159 !! html/parsoid
11160 <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
11161 <table>
11162 <tbody>
11163 <tr><th>Foo </th><th>Bar</th></tr>
11164 <tr>
11165 <td>Foo1 </td>
11166 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11167 !! end
11168
11169 !! test
11170 Bug 3090: External links other than http: in image captions
11171 !! wikitext
11172 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11173 !! html/php
11174 <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>
11175
11176 !! html/parsoid
11177 <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>
11178 !! end
11179
11180 !! test
11181 Custom class
11182 !! options
11183 parsoid=wt2html,wt2wt,html2html
11184 !! wikitext
11185 [[Image:foobar.jpg|a|class=b]]
11186 !! html/php
11187 <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>
11188 </p>
11189 !! html/parsoid
11190 <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>
11191 !! end
11192
11193 !! test
11194 Localized image handling (1).
11195 !! options
11196 parsoid=wt2html,wt2wt,html2html
11197 language=es
11198 !! wikitext
11199 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11200 !! html/php
11201 <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>
11202
11203 !! html/parsoid
11204 <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>
11205 !! end
11206
11207 !! test
11208 Localized image handling (2).
11209 !! options
11210 thumbsize=220
11211 parsoid=wt2html,wt2wt,html2html
11212 language=es
11213 !! wikitext
11214 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11215 !! html/php
11216 <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>
11217
11218 !! html/parsoid
11219 <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>
11220 !! end
11221
11222 !! test
11223 "border", "frameless" and "class" attributes on an image.
11224 !! options
11225 thumbsize=220
11226 parsoid=wt2html,wt2wt,html2html
11227 !! wikitext
11228 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11229 !! html/php
11230 <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>
11231 </p>
11232 !! html/parsoid
11233 <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>
11234 !! end
11235
11236 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11237 !! test
11238 Invalid image attributes (bug 62500)
11239 !! options
11240 thumbsize=220
11241 parsoid=wt2html,wt2wt,html2html
11242 !! wikitext
11243 [[File:Foobar.jpg|thumb|float|left|caption]]
11244
11245 [[File:Foobar.jpg|thumb|righ|caption]]
11246
11247 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11248 !! html/php
11249 <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>
11250 <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>
11251 <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>
11252
11253 !! html/parsoid
11254 <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>
11255 !! end
11256
11257 !! article
11258 File:Barfoo.jpg
11259 !! text
11260 #REDIRECT [[File:Barfoo.jpg]]
11261 !! endarticle
11262
11263 !! test
11264 Redirected image
11265 !! wikitext
11266 [[Image:Barfoo.jpg]]
11267 !! html
11268 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11269 </p>
11270 !! end
11271
11272 !! test
11273 Missing image with uploads disabled
11274 !! options
11275 wgEnableUploads=0
11276 !! wikitext
11277 [[Image:Foobaz.jpg]]
11278 !! html
11279 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11280 </p>
11281 !! end
11282
11283 # Parsoid-specific testing for images
11284 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11285 # Currently imperfect due to a flaw in the Parsoid testrunner
11286 # Work in progress
11287 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11288 # image tests.
11289
11290 !! test
11291 Parsoid-specific image handling - simple image with size and middle alignment
11292 !! wikitext
11293 [[File:Foobar.jpg|middle|50px]]
11294 !! html/parsoid
11295 <p><span class="mw-valign-middle" typeof="mw:Image">
11296 <a href="File:Foobar.jpg">
11297 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11298 </a>
11299 </span>
11300 </p>
11301 !! end
11302
11303 !! test
11304 Parsoid-specific image handling - simple image with size, middle alignment,
11305 non-standard namespace alias
11306 !! options
11307 parsoid=wt2wt,wt2html,html2html
11308 !! wikitext
11309 [[Image:Foobar.jpg|middle|50px]]
11310 !! html/parsoid
11311 <p><span class="mw-valign-middle" typeof="mw:Image">
11312 <a href="File:Foobar.jpg">
11313 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11314 </a>
11315 </span>
11316 </p>
11317 !! end
11318
11319 !! test
11320 Parsoid-specific image handling - simple image with size and middle alignment
11321 (existing content)
11322 !! wikitext
11323 [[File:Foobar.jpg|50px|middle]]
11324 !! html/parsoid
11325 <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>
11326 !! end
11327
11328 !! test
11329 Parsoid-specific image handling - simple image with size and middle alignment
11330 and non-standard namespace name
11331 !! options
11332 parsoid=wt2html,wt2wt,html2html
11333 !! wikitext
11334 [[Image:Foobar.jpg|50px|middle]]
11335 !! html/parsoid
11336 <p><span class="mw-valign-middle" typeof="mw:Image">
11337 <a href="File:Foobar.jpg">
11338 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11339 </a>
11340 </span>
11341 </p>
11342 !! end
11343
11344 !! test
11345 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11346 !! wikitext
11347 [[File:Foobar.jpg|500x10px|baseline|caption]]
11348 !! html/parsoid
11349 <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>
11350 !! end
11351
11352 !! test
11353 Parsoid-specific image handling - simple image with border and size spec
11354 !! wikitext
11355 [[File:Foobar.jpg|50px|border|caption]]
11356 !! html/parsoid
11357 <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>
11358 !! end
11359
11360 !! test
11361 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11362 !! wikitext
11363 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11364 !! html/parsoid
11365 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11366 <a href="File:Foobar.jpg">
11367 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11368 </a>
11369 <figcaption>caption content</figcaption>
11370 </figure>
11371 !! end
11372
11373 !! test
11374 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11375 (existing content)
11376 !! wikitext
11377 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11378 !! html/parsoid
11379 <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>
11380 !! end
11381
11382 !! test
11383 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11384 !! wikitext
11385 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11386 !! html/parsoid
11387 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11388 <a href="File:Foobar.jpg">
11389 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11390 </a>
11391 <figcaption>caption</figcaption>
11392 </figure>
11393 !! end
11394
11395 !! test
11396 Parsoid-specific image handling - thumbnail with specific size, halign,
11397 valign, and caption (existing content)
11398 !! wikitext
11399 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11400 !! html/parsoid
11401 <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>
11402 !! end
11403
11404 !! test
11405 Parsoid-specific image handling - framed image with specific size and caption
11406 (size is ignored)
11407 !! options
11408 parsoid=wt2html,wt2wt,html2html
11409 !! wikitext
11410 [[File:Foobar.jpg|frame|500x50px|caption]]
11411 !! html/parsoid
11412 <figure typeof="mw:Image/Frame">
11413 <a href="File:Foobar.jpg">
11414 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11415 </a>
11416 <figcaption>caption</figcaption>
11417 </figure>
11418 !! end
11419
11420 !! test
11421 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11422 (size is ignored)
11423 !! options
11424 parsoid=wt2html,wt2wt,html2html
11425 !! wikitext
11426 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11427 !! html/parsoid
11428 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11429 <a href="File:Foobar.jpg">
11430 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11431 </a>
11432 <figcaption>caption</figcaption>
11433 </figure>
11434 !! end
11435
11436 !! test
11437 Parsoid-specific image handling - frameless image with specific size, border, and caption
11438 !! wikitext
11439 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11440 !! html/parsoid
11441 <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>
11442 !! end
11443
11444 !! test
11445 Parsoid-specific image handling - simple image with a formatted caption
11446 !! wikitext
11447 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11448 !! html/parsoid
11449 <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>"}'>
11450 <a href="File:Foobar.jpg">
11451 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11452 </a></span></p>
11453 !! end
11454
11455 !! test
11456 Parsoid-specific image handling - caption with a template in it
11457 !! wikitext
11458 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11459 !! html/parsoid
11460 <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>
11461 !! end
11462
11463 !! test
11464 Parsoid-specific image handling - caption with unbalanced tags in it
11465 !! options
11466 parsoid=wt2html,wt2wt,html2html
11467 !! wikitext
11468 foo
11469 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11470 bar
11471 !! html/parsoid
11472 <p>foo</p>
11473 <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>
11474 <p>bar</p>
11475 !! end
11476
11477 !! test
11478 Parsoid-specific image handling - empty caption (1)
11479 !! options
11480 parsoid=wt2html,wt2wt
11481 !! wikitext
11482 [[File:Foobar.jpg|thumb|]]
11483 !! html/parsoid
11484 <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>
11485 !! end
11486
11487 # empty captions don't get serialized unless we're in the "round trip" case
11488 !! test
11489 Parsoid-specific image handling - empty caption (2)
11490 !! options
11491 parsoid=html2wt
11492 !! html/parsoid
11493 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11494 <a href="File:Foobar.jpg">
11495 <img resource="./File:Foobar.jpg"
11496 src="//example.com/images/3/3a/Foobar.jpg"
11497 height="25" width="220"/>
11498 </a>
11499 <figcaption></figcaption>
11500 </figure>
11501 !! wikitext
11502 [[File:Foobar.jpg|thumb]]
11503 !! end
11504
11505 !! test
11506 Parsoid-specific image handling - whitespace caption
11507 !! wikitext
11508 [[File:Foobar.jpg|thumb| ]]
11509 !! html/parsoid
11510 <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>
11511 !! end
11512
11513 !! test
11514 Parsoid-specific image handling - lang option
11515 !! wikitext
11516 foo
11517 [[File:Foobar.svg|lang=de|caption]]
11518 bar
11519 !! html/parsoid
11520 <p>foo
11521 <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>
11522 bar</p>
11523 !! end
11524
11525
11526 ###
11527 ### Subpages
11528 ###
11529 !! article
11530 Subpage test/subpage
11531 !! text
11532 foo
11533 !! endarticle
11534
11535 !! test
11536 Subpage link
11537 !! options
11538 subpage title=[[Subpage test]]
11539 !! wikitext
11540 [[/subpage]]
11541 !! html
11542 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11543 </p>
11544 !! end
11545
11546 !! test
11547 Subpage noslash link
11548 !! options
11549 subpage title=[[Subpage test]]
11550 !! wikitext
11551 [[/subpage/]]
11552 !! html
11553 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11554 </p>
11555 !! end
11556
11557 # TODO: make this PHP-parser compatible!
11558 !! test
11559 Relative subpage noslash link
11560 !! options
11561 parsoid=wt2wt,wt2html,html2html
11562 subpage title=[[Subpage test/1/2/3/4]]
11563 !! wikitext
11564 [[../../subpage/]]
11565
11566 [[../../subpage]]
11567 !! html
11568 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11569 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11570 !! end
11571
11572 !! test
11573 Parsoid: dot-slash prefixed wikilinks
11574 !! wikitext
11575 [[./foo]]
11576
11577 [[././bar]]
11578
11579 [[././baz/]]
11580 !! html/php
11581 <p>[[./foo]]
11582 </p><p>[[././bar]]
11583 </p><p>[[././baz/]]
11584 </p>
11585 !! html/parsoid
11586 <p>[[./foo]]
11587 </p><p>[[././bar]]
11588 </p><p>[[././baz/]]
11589 </p>
11590 !! end
11591
11592 !! test
11593 Render invalid page names as plain text (bug 51090)
11594 !! wikitext
11595 [[./../foo|bar]]
11596 [[foo�|bar]]
11597 [[foo/.|bar]]
11598 [[foo/..|bar]]
11599 [[foo~~~bar]]
11600 [[foo>bar]]
11601 [[foo[bar]]
11602 [[.]]
11603 [[..]]
11604 [[foo././bar]]
11605
11606 [[{{echo|./../foo}}|bar]]
11607 [[{{echo|foo/.}}|bar]]
11608 [[{{echo|foo/..}}|bar]]
11609 [[{{echo|foo~~~~bar}}]]
11610 [[{{echo|foo>bar}}]]
11611 [[{{echo|foo././bar}}]]
11612 [[{{echo|foo{bar}}]]
11613 [[{{echo|foo}bar}}]]
11614 [[{{echo|foo[bar}}]]
11615 [[{{echo|foo]bar}}]]
11616 [[{{echo|foo<bar}}]]
11617 !!html/php
11618 <p>[[./../foo|bar]]
11619 [[foo�|bar]]
11620 [[foo/.|bar]]
11621 [[foo/..|bar]]
11622 [[foo~~~bar]]
11623 [[foo&gt;bar]]
11624 [[foo[bar]]
11625 [[.]]
11626 [[..]]
11627 [[foo././bar]]
11628 </p><p>[[./../foo|bar]]
11629 [[foo/.|bar]]
11630 [[foo/..|bar]]
11631 [[foo~~~~bar]]
11632 [[foo&gt;bar]]
11633 [[foo././bar]]
11634 [[foo{bar]]
11635 [[foo}bar]]
11636 [[foo[bar]]
11637 [[foo]bar]]
11638 [[foo&lt;bar]]
11639 </p>
11640 !!html/parsoid
11641 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11642 <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>
11643 !!end
11644
11645 !! test
11646 Disabled subpages
11647 !! wikitext
11648 [[/subpage]]
11649 !! html
11650 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11651 </p>
11652 !! end
11653
11654 !! test
11655 BUG 561: {{/Subpage}}
11656 !! options
11657 subpage title=[[Page]]
11658 !! wikitext
11659 {{/Subpage}}
11660 !! html
11661 <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>
11662 </p>
11663 !! end
11664
11665 ###
11666 ### Categories
11667 ###
11668 !! article
11669 Category:MediaWiki User's Guide
11670 !! text
11671 blah
11672 !! endarticle
11673
11674 !! test
11675 Link to category
11676 !! wikitext
11677 [[:Category:MediaWiki User's Guide]]
11678 !! html
11679 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11680 </p>
11681 !! end
11682
11683 !! test
11684 Simple category
11685 !! options
11686 cat
11687 !! wikitext
11688 [[Category:MediaWiki User's Guide]]
11689 !! html
11690 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11691 !! end
11692
11693 !! test
11694 PAGESINCATEGORY invalid title fatal (r33546 fix)
11695 !! wikitext
11696 {{PAGESINCATEGORY:<bogus>}}
11697 !! html
11698 <p>0
11699 </p>
11700 !! end
11701
11702 !! test
11703 Category with different sort key
11704 !! options
11705 cat
11706 !! wikitext
11707 [[Category:MediaWiki User's Guide|Foo]]
11708 !! html
11709 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11710 !! end
11711
11712 !! test
11713 Category with identical sort key
11714 !! options
11715 cat
11716 !! wikitext
11717 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11718 !! html
11719 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11720 !! end
11721
11722 !! test
11723 Category with empty sort key
11724 !! options
11725 cat
11726 pst
11727 !! wikitext
11728 [[Category:MediaWiki User's Guide|]]
11729 !! html
11730 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11731 !! end
11732
11733 !! test
11734 Category with empty sort key and parentheses
11735 !! options
11736 cat
11737 pst
11738 !! wikitext
11739 [[Category:Foo (bar)|]]
11740 !! html
11741 [[Category:Foo (bar)|Foo]]
11742 !! end
11743
11744 !! test
11745 Category with link tail
11746 !! options
11747 cat
11748 pst
11749 !! wikitext
11750 123[[Category:Foo]]456
11751 !! html
11752 123[[Category:Foo]]456
11753 !! end
11754
11755 !! test
11756 Category with template
11757 !! options
11758 cat
11759 pst
11760 !! wikitext
11761 [[Category:{{echo|Foo}}]]
11762 !! html
11763 [[Category:{{echo|Foo}}]]
11764 !! end
11765
11766 !! test
11767 Category with template in sort key
11768 !! options
11769 cat
11770 pst
11771 !! wikitext
11772 [[Category:Foo|{{echo|Bar}}]]
11773 !! html
11774 [[Category:Foo|{{echo|Bar}}]]
11775 !! end
11776
11777 !! test
11778 Category with template in sort key and title
11779 !! options
11780 cat
11781 pst
11782 !! wikitext
11783 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11784 !! html
11785 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11786 !! end
11787
11788 !! test
11789 Category / paragraph interactions
11790 !! wikitext
11791 Foo [[Category:Baz]] Bar
11792
11793 Foo [[Category:Baz]]
11794 Bar
11795
11796 Foo
11797 [[Category:Baz]]
11798 Bar
11799
11800 Foo
11801 [[Category:Baz]] Bar
11802
11803 Foo
11804 [[Category:Baz]]
11805 [[Category:Baz]]
11806 [[Category:Baz]]
11807 Bar
11808
11809 [[Category:Baz]]
11810 [[Category:Baz]]
11811 [[Category:Baz]]
11812
11813 [[Category:Baz]]
11814 {{echo|[[Category:Baz]]}}
11815 [[Category:Baz]]
11816 !! html
11817 <p>Foo Bar
11818 </p><p>Foo
11819 Bar
11820 </p><p>Foo
11821 Bar
11822 </p><p>Foo Bar
11823 </p><p>Foo
11824 Bar
11825 </p>
11826 !! end
11827
11828 !! test
11829 Parsoid: Serialize link to category page with colon escape
11830 !! options
11831 parsoid
11832 !! wikitext
11833
11834 [[:Category:Foo]]
11835 [[:Category:Foo|Bar]]
11836 !! html
11837 <p>
11838 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11839 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11840 </p>
11841 !! end
11842
11843 !! test
11844 Parsoid: Link prefix/suffixes aren't applied to category links
11845 !! options
11846 parsoid=wt2html,wt2wt,html2html
11847 language=is
11848 !! wikitext
11849 x[[Category:Foo]]y
11850 !! html
11851 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11852 !! end
11853
11854 !! test
11855 Parsoid: Serialize link to file page with colon escape
11856 !! options
11857 parsoid
11858 !! wikitext
11859
11860 [[:File:Foo.png]]
11861 [[:File:Foo.png|Bar]]
11862 !! html
11863 <p>
11864 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11865 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11866 </p>
11867 !! end
11868
11869 !! test
11870 Parsoid: Serialize a genuine category link without colon escape
11871 !! options
11872 parsoid
11873 !! wikitext
11874 [[Category:Foo]]
11875 [[Category:Foo|Bar]]
11876 !! html
11877 <link rel="mw:PageProp/Category" href="Category:Foo">
11878 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11879 !! end
11880
11881 !! test
11882 Parsoid: Defaultsort
11883 !! options
11884 parsoid
11885 !! wikitext
11886 {{DEFAULTSORT:Foo}}
11887 !! html
11888 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11889 !! end
11890
11891 ###
11892 ### Inter-language links
11893 ###
11894 !! test
11895 Inter-language links
11896 !! options
11897 ill
11898 !! wikitext
11899 [[es:Alimento]]
11900 [[fr:Nourriture]]
11901 [[zh:&#39135;&#21697;]]
11902 !! html
11903 es:Alimento fr:Nourriture zh:食品
11904 !! end
11905
11906 !! test
11907 Duplicate interlanguage links (bug 24502)
11908 !! options
11909 ill
11910 !! wikitext
11911 [[es:1]]
11912 [[es:2]]
11913 [[fr:1]]
11914 [[fr:2]]
11915 !! html
11916 es:1 fr:1
11917 !! end
11918
11919 ###
11920 ### Sections
11921 ###
11922 !! test
11923 Basic section headings
11924 !! wikitext
11925 == Headline 1 ==
11926 Some text
11927
11928 ==Headline 2==
11929 More
11930 ===Smaller headline===
11931 Blah blah
11932 !! html
11933 <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>
11934 <p>Some text
11935 </p>
11936 <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>
11937 <p>More
11938 </p>
11939 <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>
11940 <p>Blah blah
11941 </p>
11942 !! end
11943
11944 !! test
11945 Section headings with TOC
11946 !! wikitext
11947 == Headline 1 ==
11948 === Subheadline 1 ===
11949 ===== Skipping a level =====
11950 ====== Skipping a level ======
11951
11952 == Headline 2 ==
11953 Some text
11954 ===Another headline===
11955 !! html
11956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11957 <ul>
11958 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11959 <ul>
11960 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11961 <ul>
11962 <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>
11963 <ul>
11964 <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>
11965 </ul>
11966 </li>
11967 </ul>
11968 </li>
11969 </ul>
11970 </li>
11971 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11972 <ul>
11973 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11974 </ul>
11975 </li>
11976 </ul>
11977 </div>
11978
11979 <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>
11980 <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>
11981 <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>
11982 <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>
11983 <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>
11984 <p>Some text
11985 </p>
11986 <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>
11987
11988 !! end
11989
11990 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11991 !! test
11992 Handling of sections up to level 6 and beyond
11993 !! wikitext
11994 = Level 1 Heading=
11995 == Level 2 Heading==
11996 === Level 3 Heading===
11997 ==== Level 4 Heading====
11998 ===== Level 5 Heading=====
11999 ====== Level 6 Heading======
12000 ======= Level 7 Heading=======
12001 ======== Level 8 Heading========
12002 ========= Level 9 Heading=========
12003 ========== Level 10 Heading==========
12004 !! html
12005 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12006 <ul>
12007 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12008 <ul>
12009 <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>
12010 <ul>
12011 <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>
12012 <ul>
12013 <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>
12014 <ul>
12015 <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>
12016 <ul>
12017 <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>
12018 <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>
12019 <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>
12020 <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>
12021 <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>
12022 </ul>
12023 </li>
12024 </ul>
12025 </li>
12026 </ul>
12027 </li>
12028 </ul>
12029 </li>
12030 </ul>
12031 </li>
12032 </ul>
12033 </div>
12034
12035 <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>
12036 <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>
12037 <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>
12038 <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>
12039 <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>
12040 <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>
12041 <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>
12042 <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>
12043 <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>
12044 <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>
12045
12046 !! end
12047
12048 !! test
12049 TOC regression (bug 9764)
12050 !! wikitext
12051 == title 1 ==
12052 === title 1.1 ===
12053 ==== title 1.1.1 ====
12054 === title 1.2 ===
12055 == title 2 ==
12056 === title 2.1 ===
12057 !! html
12058 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12059 <ul>
12060 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12061 <ul>
12062 <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>
12063 <ul>
12064 <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>
12065 </ul>
12066 </li>
12067 <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>
12068 </ul>
12069 </li>
12070 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12071 <ul>
12072 <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>
12073 </ul>
12074 </li>
12075 </ul>
12076 </div>
12077
12078 <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>
12079 <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>
12080 <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>
12081 <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>
12082 <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>
12083 <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>
12084
12085 !! end
12086
12087 !! test
12088 TOC with wgMaxTocLevel=3 (bug 6204)
12089 !! options
12090 wgMaxTocLevel=3
12091 !! wikitext
12092 == title 1 ==
12093 === title 1.1 ===
12094 ==== title 1.1.1 ====
12095 === title 1.2 ===
12096 == title 2 ==
12097 === title 2.1 ===
12098 !! html
12099 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12100 <ul>
12101 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12102 <ul>
12103 <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>
12104 <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>
12105 </ul>
12106 </li>
12107 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12108 <ul>
12109 <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>
12110 </ul>
12111 </li>
12112 </ul>
12113 </div>
12114
12115 <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>
12116 <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>
12117 <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>
12118 <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>
12119 <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>
12120 <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>
12121
12122 !! end
12123
12124 !! test
12125 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12126 !! options
12127 wgMaxTocLevel=3
12128 !! wikitext
12129 ==Section 1==
12130 ===Section 1.1===
12131 ====Section 1.1.1====
12132 ====Section 1.1.1.1====
12133 ==Section 2==
12134 !! html
12135 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12136 <ul>
12137 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12138 <ul>
12139 <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>
12140 </ul>
12141 </li>
12142 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12143 </ul>
12144 </div>
12145
12146 <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>
12147 <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>
12148 <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>
12149 <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>
12150 <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>
12151
12152 !! end
12153
12154
12155 !! test
12156 Resolving duplicate section names
12157 !! wikitext
12158 == Foo bar ==
12159 == Foo bar ==
12160 !! html
12161 <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>
12162 <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>
12163
12164 !! end
12165
12166 !! test
12167 Resolving duplicate section names with differing case (bug 10721)
12168 !! wikitext
12169 == Foo bar ==
12170 == Foo Bar ==
12171 !! html
12172 <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>
12173 <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>
12174
12175 !! end
12176
12177 !! article
12178 Template:sections
12179 !! text
12180 ===Section 1===
12181 ==Section 2==
12182 !! endarticle
12183
12184 !! test
12185 Template with sections, __NOTOC__
12186 !! wikitext
12187 __NOTOC__
12188 ==Section 0==
12189 {{sections}}
12190 ==Section 4==
12191 !! html
12192 <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>
12193 <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>
12194 <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>
12195 <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>
12196
12197 !! end
12198
12199 !! test
12200 __NOEDITSECTION__ keyword
12201 !! wikitext
12202 __NOEDITSECTION__
12203 ==Section 1==
12204 ==Section 2==
12205 !! html
12206 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12207 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12208
12209 !! end
12210
12211 !! test
12212 Link inside a section heading
12213 !! wikitext
12214 ==Section with a [[Main Page|link]] in it==
12215 !! html
12216 <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>
12217
12218 !! end
12219
12220 !! test
12221 TOC regression (bug 12077)
12222 !! wikitext
12223 __TOC__
12224 == title 1 ==
12225 === title 1.1 ===
12226 == title 2 ==
12227 !! html
12228 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12229 <ul>
12230 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12231 <ul>
12232 <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>
12233 </ul>
12234 </li>
12235 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12236 </ul>
12237 </div>
12238
12239 <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>
12240 <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>
12241 <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>
12242
12243 !! end
12244
12245 !! test
12246 BUG 1219 URL next to image (good)
12247 !! wikitext
12248 http://example.com [[Image:foobar.jpg]]
12249 !! html
12250 <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>
12251 </p>
12252 !!end
12253
12254 !! test
12255 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12256 !! wikitext
12257 ===
12258 The line above must have a trailing space!
12259 === <!--
12260 --> <!-- -->
12261 But just in case it doesn't...
12262 !! html
12263 <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>
12264 <p>The line above must have a trailing space!
12265 </p>
12266 <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>
12267 <p>But just in case it doesn't...
12268 </p>
12269 !! end
12270
12271 !! test
12272 Header with special characters (bug 25462)
12273 !! wikitext
12274 The tooltips shall not show entities to the user (ie. be double escaped)
12275
12276 == text > text ==
12277 section 1
12278
12279 == text < text ==
12280 section 2
12281
12282 == text & text ==
12283 section 3
12284
12285 == text ' text ==
12286 section 4
12287
12288 == text " text ==
12289 section 5
12290 !! html
12291 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12292 </p>
12293 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12294 <ul>
12295 <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>
12296 <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>
12297 <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>
12298 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12299 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12300 </ul>
12301 </div>
12302
12303 <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>
12304 <p>section 1
12305 </p>
12306 <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>
12307 <p>section 2
12308 </p>
12309 <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>
12310 <p>section 3
12311 </p>
12312 <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>
12313 <p>section 4
12314 </p>
12315 <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>
12316 <p>section 5
12317 </p>
12318 !! end
12319
12320 !! test
12321 Headers with excess '=' characters
12322 (Are similar tests necessary beyond the 1st level?)
12323 !! wikitext
12324 =foo==
12325 ==foo=
12326 =''italic'' heading==
12327 ==''italic'' heading=
12328 !! html
12329 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12330 <ul>
12331 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12332 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12333 <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>
12334 <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>
12335 </ul>
12336 </div>
12337
12338 <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>
12339 <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>
12340 <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>
12341 <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>
12342
12343 !! end
12344
12345 !! test
12346 HTML headers vs TOC (bug 23393)
12347 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12348 !! wikitext
12349 <h1>Header 1</h1>
12350 == Header 1.1 ==
12351 == Header 1.2 ==
12352
12353 <h1>Header 2
12354 </h1>
12355 == Header 2.1 ==
12356 == Header 2.2 ==
12357 __NOEDITSECTION__
12358 !! html
12359 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12360 <ul>
12361 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12362 <ul>
12363 <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>
12364 <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>
12365 </ul>
12366 </li>
12367 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12368 <ul>
12369 <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>
12370 <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>
12371 </ul>
12372 </li>
12373 </ul>
12374 </div>
12375
12376 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12377 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12378 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12379 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12380 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12381 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12382
12383 !! end
12384
12385 !! test
12386 Single-line or multiline-comments can follow headings
12387 !! options
12388 parsoid=wt2html,wt2wt
12389 !! wikitext
12390 ==foo==<!---->
12391 ==bar==<!--c1-->
12392 ==baz==<!--
12393 c2
12394 c3-->
12395 !! html
12396 <h2><span class="mw-headline" id="foo">foo</span></h2>
12397 <h2><span class="mw-headline" id="bar">bar</span></h2>
12398 <h2><span class="mw-headline" id="baz">baz</span></h2>
12399
12400 !! end
12401
12402 !! test
12403 BUG 1219 URL next to image (broken)
12404 !! wikitext
12405 http://example.com[[Image:foobar.jpg]]
12406 !! html
12407 <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>
12408 </p>
12409 !!end
12410
12411 !! test
12412 Bug 1186 news: in the middle of text
12413 !! wikitext
12414 http://en.wikinews.org/wiki/Wikinews:Workplace
12415 !! html
12416 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12417 </p>
12418 !!end
12419
12420
12421 !! test
12422 Namespaced link must have a title
12423 !! wikitext
12424 [[Project:]]
12425 !! html
12426 <p>[[Project:]]
12427 </p>
12428 !!end
12429
12430 !! test
12431 Namespaced link must have a title (bad fragment version)
12432 !! wikitext
12433 [[Project:#fragment]]
12434 !! html
12435 <p>[[Project:#fragment]]
12436 </p>
12437 !!end
12438
12439
12440 ###
12441 ### HTML tags and HTML attributes
12442 ###
12443
12444 !! test
12445 div with no attributes
12446 !! wikitext
12447 <div>HTML rocks</div>
12448 !! html
12449 <div>HTML rocks</div>
12450
12451 !! end
12452
12453 !! test
12454 div with double-quoted attribute
12455 !! wikitext
12456 <div id="rock">HTML rocks</div>
12457 !! html
12458 <div id="rock">HTML rocks</div>
12459
12460 !! end
12461
12462 !! test
12463 div with single-quoted attribute
12464 !! wikitext
12465 <div id='rock'>HTML rocks</div>
12466 !! html
12467 <div id="rock">HTML rocks</div>
12468
12469 !! end
12470
12471 !! test
12472 div with unquoted attribute
12473 !! wikitext
12474 <div id=rock>HTML rocks</div>
12475 !! html
12476 <div id="rock">HTML rocks</div>
12477
12478 !! end
12479
12480 !! test
12481 div with illegal double attributes
12482 !! wikitext
12483 <div id="a" id="b">HTML rocks</div>
12484 !! html
12485 <div id="b">HTML rocks</div>
12486
12487 !!end
12488
12489 # FIXME: produce empty string instead of "class" in the PHP parser, following
12490 # the HTML5 spec.
12491 !! test
12492 div with empty attribute value, space before equals
12493 !! options
12494 parsoid
12495 !! wikitext
12496 <div class =>HTML rocks</div>
12497 !! html
12498 <div class="">HTML rocks</div>
12499
12500 !! end
12501
12502 # The PHP parser escapes the opening brace to &#123; for some reason, so
12503 # disabled this test for it.
12504 !! test
12505 div with braces in attribute value
12506 !! options
12507 parsoid
12508 !! wikitext
12509 <div title="{}">Foo</div>
12510 !! html
12511 <div title="{}">Foo</div>
12512 !! end
12513
12514 # This it very inconsistent in the PHP parser: it returns
12515 # class="class" if there is a space between the name and the equal sign (see
12516 # 'div with empty attribute value, space before equals'), but strips the
12517 # attribute completely if the space is missing. We hope that not much content
12518 # depends on this, so are implementing the behavior below in Parsoid for
12519 # consistencies' sake. Disabled for the PHP parser.
12520 # FIXME: fix this behavior in the PHP parser?
12521 !! test
12522 div with empty attribute value, no space before equals
12523 !! options
12524 parsoid
12525 !! wikitext
12526 <div class=>HTML rocks</div>
12527 !! html
12528 <div class="">HTML rocks</div>
12529
12530 !! end
12531
12532 !! test
12533 HTML multiple attributes correction
12534 !! wikitext
12535 <p class="error" class="awesome">Awesome!</p>
12536 !! html
12537 <p class="awesome">Awesome!</p>
12538
12539 !!end
12540
12541 !! test
12542 Table multiple attributes correction
12543 !! wikitext
12544 {|
12545 !+ class="error" class="awesome"| status
12546 |}
12547 !! html
12548 <table>
12549 <tr>
12550 <th class="awesome"> status
12551 </th></tr></table>
12552
12553 !!end
12554
12555 !! test
12556 DIV IN UPPERCASE
12557 !! wikitext
12558 <DIV ID="x">HTML ROCKS</DIV>
12559 !! html
12560 <div id="x">HTML ROCKS</div>
12561
12562 !!end
12563
12564 !! test
12565 Non-ASCII pseudo-tags are rendered as text
12566 !! wikitext
12567 <khyô>
12568 !! html
12569 <p>&lt;khyô&gt;
12570 </p>
12571 !! end
12572
12573 !! test
12574 Pseudo-tag with URL 'name' renders as url link
12575 !! wikitext
12576 <http://example.com/>
12577 !! html
12578 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12579 </p>
12580 !! end
12581
12582 !! test
12583 text with amp in the middle of nowhere
12584 !! wikitext
12585 Remember AT&T?
12586 !! html
12587 <p>Remember AT&amp;T?
12588 </p>
12589 !! end
12590
12591 !! test
12592 text with character entity: eacute
12593 !! wikitext
12594 I always thought &eacute; was a cute letter.
12595 !! html
12596 <p>I always thought &#233; was a cute letter.
12597 </p>
12598 !! end
12599
12600 !! test
12601 text with entity-escaped character entity-like string: eacute
12602 !! wikitext
12603 I always thought &amp;eacute; was a cute letter.
12604 !! html
12605 <p>I always thought &amp;eacute; was a cute letter.
12606 </p>
12607 !! end
12608
12609 !! test
12610 text with undefined character entity: xacute
12611 !! wikitext
12612 I always thought &xacute; was a cute letter.
12613 !! html
12614 <p>I always thought &amp;xacute; was a cute letter.
12615 </p>
12616 !! end
12617
12618 # TODO: generalize to PHP parser?
12619 !! test
12620 HTML5 tags
12621 !! options
12622 parsoid
12623 !! wikitext
12624 <data value="5">five</data>
12625 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12626 <mark>This highlighted text</mark>
12627 !! html
12628 <p><data value="5">five</data>
12629 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12630 <mark>This highlighted text</mark></p>
12631 !! end
12632
12633 !! test
12634 HTML tag with leading space is parsed as text
12635 !! wikitext
12636 < div>foo< /div>
12637 !! html
12638 <p>&lt; div&gt;foo&lt; /div&gt;
12639 </p>
12640 !! end
12641
12642 ###
12643 ### Nesting tests (see bug 41545, 50604, 51081)
12644 ###
12645
12646 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12647 # Note that html2wt is considerably more difficult if we use <b> in
12648 # the test case, instead of <big>
12649 !! test
12650 Ensure that HTML adoption agency algorithm is properly implemented.
12651 !! wikitext
12652 <big>X<big>Y</big>Z</big>
12653 !! html
12654 <p><big>X<big>Y</big>Z</big>
12655 </p>
12656 !! end
12657
12658 # This was bug 41545 in the PHP parser.
12659 !! test
12660 Nesting of <kbd>
12661 !! wikitext
12662 <kbd>X<kbd>Y</kbd>Z</kbd>
12663 !! html
12664 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12665 </p>
12666 !! end
12667
12668 # The following cases were bug 51081 in the PHP parser.
12669 # Note that there are some other nestable tags (b, i, etc) which are
12670 # not covered; see bug 51081 for discussion.
12671 !! test
12672 Nesting of <em>
12673 !! wikitext
12674 <em>X<em>Y</em>Z</em>
12675 !! html
12676 <p><em>X<em>Y</em>Z</em>
12677 </p>
12678 !! end
12679
12680 !! test
12681 Nesting of <strong>
12682 !! wikitext
12683 <strong>X<strong>Y</strong>Z</strong>
12684 !! html
12685 <p><strong>X<strong>Y</strong>Z</strong>
12686 </p>
12687 !! end
12688
12689 !! test
12690 Nesting of <q>
12691 !! wikitext
12692 <q>X<q>Y</q>Z</q>
12693 !! html
12694 <p><q>X<q>Y</q>Z</q>
12695 </p>
12696 !! end
12697
12698 !! test
12699 Nesting of <ruby>
12700 !! wikitext
12701 <ruby>X<ruby>Y</ruby>Z</ruby>
12702 !! html
12703 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12704 </p>
12705 !! end
12706
12707 !! test
12708 Nesting of <bdo>
12709 !! wikitext
12710 <bdo>X<bdo>Y</bdo>Z</bdo>
12711 !! html
12712 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12713 </p>
12714 !! end
12715
12716
12717 ###
12718 ### Media links
12719 ###
12720
12721 !! test
12722 Media link
12723 !! wikitext
12724 [[Media:Foobar.jpg]]
12725 !! html
12726 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12727 </p>
12728 !! end
12729
12730 !! test
12731 Media link with text
12732 !! wikitext
12733 [[Media:Foobar.jpg|A neat file to look at]]
12734 !! html
12735 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12736 </p>
12737 !! end
12738
12739 # FIXME: this is still bad HTML tag nesting
12740 !! test
12741 Media link with nasty text
12742 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12743 !! wikitext
12744 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12745 !! html
12746 <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>
12747
12748 !! end
12749
12750 !! test
12751 Media link to nonexistent file (bug 1702)
12752 !! wikitext
12753 [[Media:No such.jpg]]
12754 !! html
12755 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12756 </p>
12757 !! end
12758
12759 !! test
12760 Image link to nonexistent file (bug 1850 - good)
12761 !! wikitext
12762 [[Image:No such.jpg]]
12763 !! html
12764 <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>
12765 </p>
12766 !! end
12767
12768 !! test
12769 :Image link to nonexistent file (bug 1850 - bad)
12770 !! wikitext
12771 [[:Image:No such.jpg]]
12772 !! html
12773 <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>
12774 </p>
12775 !! end
12776
12777
12778
12779 !! test
12780 Character reference normalization in link text (bug 1938)
12781 !! wikitext
12782 [[Main Page|this&that]]
12783 !! html
12784 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12785 </p>
12786 !!end
12787
12788 !! article
12789 אַ
12790 !! text
12791 Test for unicode normalization
12792
12793 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12794 !! endarticle
12795
12796 !! test
12797 (bug 19451) Links should refer to the normalized form.
12798 !! wikitext
12799 [[&#xFB2E;]]
12800 [[&#x5d0;&#x5b7;]]
12801 [[&#x5d0;ַ]]
12802 [[א&#x5b7;]]
12803 [[אַ]]
12804 !! html
12805 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12806 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12807 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12808 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12809 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12810 </p>
12811 !! end
12812
12813 !! test
12814 Empty attribute crash test (bug 2067)
12815 !! wikitext
12816 <font color="">foo</font>
12817 !! html
12818 <p><font color="">foo</font>
12819 </p>
12820 !! end
12821
12822 !! test
12823 Empty attribute crash test single-quotes (bug 2067)
12824 !! wikitext
12825 <font color=''>foo</font>
12826 !! html
12827 <p><font color="">foo</font>
12828 </p>
12829 !! end
12830
12831 !! test
12832 Attribute test: equals, then nothing
12833 !! wikitext
12834 <font color=>foo</font>
12835 !! html
12836 <p><font>foo</font>
12837 </p>
12838 !! end
12839
12840 !! test
12841 Attribute test: unquoted value
12842 !! wikitext
12843 <font color=x>foo</font>
12844 !! html
12845 <p><font color="x">foo</font>
12846 </p>
12847 !! end
12848
12849 !! test
12850 Attribute test: unquoted but illegal value (hash)
12851 !! wikitext
12852 <font color=#x>foo</font>
12853 !! html
12854 <p><font color="#x">foo</font>
12855 </p>
12856 !! end
12857
12858 !! test
12859 Attribute test: no value
12860 !! wikitext
12861 <font color>foo</font>
12862 !! html
12863 <p><font color="color">foo</font>
12864 </p>
12865 !! end
12866
12867 !! test
12868 Bug 2095: link with three closing brackets
12869 !! wikitext
12870 [[Main Page]]]
12871 !! html/php
12872 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12873 </p>
12874 !! html/parsoid
12875 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12876 !! end
12877
12878 !! test
12879 Bug 2095: link with pipe and three closing brackets
12880 !! wikitext
12881 [[Main Page|link]]]
12882 !! html/php
12883 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12884 </p>
12885 !! html/parsoid
12886 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12887 !! end
12888
12889 !! test
12890 Bug 2095: link with pipe and three closing brackets, version 2
12891 !! wikitext
12892 [[Main Page|[http://example.com/]]]
12893 !! html/php
12894 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12895 </p>
12896 !! html/parsoid
12897 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12898 !! end
12899
12900
12901 ###
12902 ### Safety
12903 ###
12904
12905 !! article
12906 Template:Dangerous attribute
12907 !! text
12908 " onmouseover="alert(document.cookie)
12909 !! endarticle
12910
12911 !! article
12912 Template:Dangerous style attribute
12913 !! text
12914 border-size: expression(alert(document.cookie))
12915 !! endarticle
12916
12917 !! article
12918 Template:Div style
12919 !! text
12920 <div style="float: right; {{{1}}}">Magic div</div>
12921 !! endarticle
12922
12923 !! test
12924 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12925 !! wikitext
12926 <div title="{{test}}"></div>
12927 !! html
12928 <div title="This is a test template"></div>
12929
12930 !! end
12931
12932 !! test
12933 Bug 2304: HTML attribute safety (dangerous template; 2309)
12934 !! wikitext
12935 <div title="{{dangerous attribute}}"></div>
12936 !! html
12937 <div title=""></div>
12938
12939 !! end
12940
12941 !! test
12942 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12943 !! wikitext
12944 <div style="{{dangerous style attribute}}"></div>
12945 !! html
12946 <div style="/* insecure input */"></div>
12947
12948 !! end
12949
12950 !! test
12951 Bug 2304: HTML attribute safety (safe parameter; 2309)
12952 !! wikitext
12953 {{div style|width: 200px}}
12954 !! html
12955 <div style="float: right; width: 200px">Magic div</div>
12956
12957 !! end
12958
12959 !! test
12960 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12961 !! wikitext
12962 {{div style|width: expression(alert(document.cookie))}}
12963 !! html
12964 <div style="/* insecure input */">Magic div</div>
12965
12966 !! end
12967
12968 !! test
12969 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12970 !! wikitext
12971 {{div style|"><script>alert(document.cookie)</script>}}
12972 !! html
12973 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12974
12975 !! end
12976
12977 !! test
12978 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12979 !! wikitext
12980 {{div style|" ><script>alert(document.cookie)</script>}}
12981 !! html
12982 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12983
12984 !! end
12985
12986 !! test
12987 Bug 2304: HTML attribute safety (link)
12988 !! wikitext
12989 <div title="[[Main Page]]"></div>
12990 !! html
12991 <div title="&#91;&#91;Main Page]]"></div>
12992
12993 !! end
12994
12995 !! test
12996 Bug 2304: HTML attribute safety (italics)
12997 !! wikitext
12998 <div title="''foobar''"></div>
12999 !! html
13000 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13001
13002 !! end
13003
13004 !! test
13005 Bug 2304: HTML attribute safety (bold)
13006 !! wikitext
13007 <div title="'''foobar'''"></div>
13008 !! html
13009 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13010
13011 !! end
13012
13013
13014 !! test
13015 Bug 2304: HTML attribute safety (ISBN)
13016 !! wikitext
13017 <div title="ISBN 1234567890"></div>
13018 !! html
13019 <div title="&#73;SBN 1234567890"></div>
13020
13021 !! end
13022
13023 !! test
13024 Bug 2304: HTML attribute safety (RFC)
13025 !! wikitext
13026 <div title="RFC 1234"></div>
13027 !! html
13028 <div title="&#82;FC 1234"></div>
13029
13030 !! end
13031
13032 !! test
13033 Bug 2304: HTML attribute safety (PMID)
13034 !! wikitext
13035 <div title="PMID 1234567890"></div>
13036 !! html
13037 <div title="&#80;MID 1234567890"></div>
13038
13039 !! end
13040
13041 !! test
13042 Bug 2304: HTML attribute safety (web link)
13043 !! wikitext
13044 <div title="http://example.com/"></div>
13045 !! html
13046 <div title="http&#58;//example.com/"></div>
13047
13048 !! end
13049
13050 !! test
13051 Bug 2304: HTML attribute safety (named web link)
13052 !! wikitext
13053 <div title="[http://example.com/ link]"></div>
13054 !! html
13055 <div title="&#91;http&#58;//example.com/ link]"></div>
13056
13057 !! end
13058
13059 !! test
13060 Bug 3244: HTML attribute safety (extension; safe)
13061 !! wikitext
13062 <div style="<nowiki>background:blue</nowiki>"></div>
13063 !! html
13064 <div style="background:blue"></div>
13065
13066 !! end
13067
13068 !! test
13069 Bug 3244: HTML attribute safety (extension; unsafe)
13070 !! wikitext
13071 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13072 !! html
13073 <div style="/* insecure input */"></div>
13074
13075 !! end
13076
13077 # More MSIE fun discovered by Tom Gilder
13078
13079 !! test
13080 MSIE CSS safety test: spurious slash
13081 !! wikitext
13082 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13083 !! html
13084 <div style="/* insecure input */">evil</div>
13085
13086 !! end
13087
13088 !! test
13089 MSIE CSS safety test: hex code
13090 !! wikitext
13091 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13092 !! html
13093 <div style="/* insecure input */">evil</div>
13094
13095 !! end
13096
13097 !! test
13098 MSIE CSS safety test: comment in url
13099 !! wikitext
13100 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13101 !! html
13102 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13103
13104 !! end
13105
13106 !! test
13107 MSIE CSS safety test: comment in expression
13108 !! wikitext
13109 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13110 !! html
13111 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13112
13113 !! end
13114
13115 !! test
13116 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13117 !! wikitext
13118 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13119 !! html
13120 <p style="/* invalid control char */">A</p>
13121
13122 !! end
13123
13124 !! test
13125 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13126 !! wikitext
13127 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13128 <div style="top:EXPRESSION(alert())">B</div>
13129 !! html
13130 <p style="/* insecure input */">A</p>
13131 <div style="/* insecure input */">B</div>
13132
13133 !! end
13134
13135 !! test
13136 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13137 !! wikitext
13138 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13139 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13140 !! html
13141 <div style="/* insecure input */">A</div>
13142 <p style="/* insecure input */">B</p>
13143
13144 !! end
13145
13146 !! test
13147 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13148 !! wikitext
13149 <div style="background-image:url⁽javascript:alert())">A</div>
13150 <div style="background-image:url₍javascript:alert())">B</div>
13151 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13152 !! html
13153 <div style="/* insecure input */">A</div>
13154 <div style="/* insecure input */">B</div>
13155 <p style="/* insecure input */">C</p>
13156
13157 !! end
13158
13159 !! test
13160 Opera -o-link CSS
13161 !! wikitext
13162 <div
13163 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;"
13164 style="-o-link:attr(title);-o-link-source:current">X</div>
13165 !! html
13166 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13167
13168 !! end
13169
13170 !! test
13171 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13172 !! wikitext
13173 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13174 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13175 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13176 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13177 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13178 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13179 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13180 !! html
13181 <p style="/* insecure input */">A</p>
13182 <p style="/* insecure input */">B</p>
13183 <p style="/* insecure input */">C</p>
13184 <p style="/* insecure input */">D</p>
13185 <p style="/* insecure input */">E</p>
13186 <p style="/* insecure input */">F</p>
13187 <p style="/* insecure input */">G</p>
13188
13189 !! end
13190
13191 !! test
13192 Table attribute legitimate extension
13193 !! wikitext
13194 {|
13195 !+ style="<nowiki>color:blue</nowiki>"| status
13196 |}
13197 !! html
13198 <table>
13199 <tr>
13200 <th style="color:blue"> status
13201 </th></tr></table>
13202
13203 !!end
13204
13205 !! test
13206 Table attribute safety
13207 !! wikitext
13208 {|
13209 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13210 |}
13211 !! html
13212 <table>
13213 <tr>
13214 <th style="/* insecure input */"> status
13215 </th></tr></table>
13216
13217 !! end
13218
13219 !! test
13220 CSS line continuation 1
13221 !! wikitext
13222 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13223 !! html
13224 <div style="/* insecure input */"></div>
13225
13226 !! end
13227
13228 !! test
13229 CSS line continuation 2
13230 !! wikitext
13231 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13232 !! html
13233 <div style="/* insecure input */"></div>
13234
13235 !! end
13236
13237 !! article
13238 Template:Identity
13239 !! text
13240 {{{1}}}
13241 !! endarticle
13242
13243 !! test
13244 Expansion of multi-line templates in attribute values (bug 6255)
13245 !! wikitext
13246 <div style="background: {{identity|#00FF00}}">-</div>
13247 !! html
13248 <div style="background: #00FF00">-</div>
13249
13250 !! end
13251
13252
13253 !! test
13254 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13255 !! wikitext
13256 <div style="background:
13257 #00FF00">-</div>
13258 !! html
13259 <div style="background: #00FF00">-</div>
13260
13261 !! end
13262
13263 !! test
13264 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13265 !! wikitext
13266 <div style="background: &#10;#00FF00">-</div>
13267 !! html
13268 <div style="background: &#10;#00FF00">-</div>
13269
13270 !! end
13271
13272 ###
13273 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13274 ###
13275 !! test
13276 Parser hook: empty input
13277 !! wikitext
13278 <tag></tag>
13279 !! html
13280 <pre>
13281 ''
13282 array (
13283 )
13284 </pre>
13285
13286 !! end
13287
13288 !! test
13289 Parser hook: empty input using terminated empty elements
13290 !! wikitext
13291 <tag/>
13292 !! html
13293 <pre>
13294 NULL
13295 array (
13296 )
13297 </pre>
13298
13299 !! end
13300
13301 !! test
13302 Parser hook: empty input using terminated empty elements (space before)
13303 !! wikitext
13304 <tag />
13305 !! html
13306 <pre>
13307 NULL
13308 array (
13309 )
13310 </pre>
13311
13312 !! end
13313
13314 !! test
13315 Parser hook: basic input
13316 !! wikitext
13317 <tag>input</tag>
13318 !! html
13319 <pre>
13320 'input'
13321 array (
13322 )
13323 </pre>
13324
13325 !! end
13326
13327
13328 !! test
13329 Parser hook: case insensitive
13330 !! wikitext
13331 <TAG>input</TAG>
13332 !! html
13333 <pre>
13334 'input'
13335 array (
13336 )
13337 </pre>
13338
13339 !! end
13340
13341
13342 !! test
13343 Parser hook: case insensitive, redux
13344 !! wikitext
13345 <TaG>input</TAg>
13346 !! html
13347 <pre>
13348 'input'
13349 array (
13350 )
13351 </pre>
13352
13353 !! end
13354
13355 !! test
13356 Parser hook: nested tags
13357 !! options
13358 noxml
13359 !! wikitext
13360 <tag><tag></tag></tag>
13361 !! html
13362 <pre>
13363 '<tag>'
13364 array (
13365 )
13366 </pre>&lt;/tag&gt;
13367
13368 !! end
13369
13370 !! test
13371 Parser hook: basic arguments
13372 !! wikitext
13373 <tag width=200 height = "100" depth = '50' square></tag>
13374 !! html
13375 <pre>
13376 ''
13377 array (
13378 'width' => '200',
13379 'height' => '100',
13380 'depth' => '50',
13381 'square' => 'square',
13382 )
13383 </pre>
13384
13385 !! end
13386
13387 !! test
13388 Parser hook: argument containing a forward slash (bug 5344)
13389 !! wikitext
13390 <tag filename='/tmp/bla'></tag>
13391 !! html
13392 <pre>
13393 ''
13394 array (
13395 'filename' => '/tmp/bla',
13396 )
13397 </pre>
13398
13399 !! end
13400
13401 !! test
13402 Parser hook: empty input using terminated empty elements (bug 2374)
13403 !! wikitext
13404 <tag foo=bar/>text
13405 !! html
13406 <pre>
13407 NULL
13408 array (
13409 'foo' => 'bar',
13410 )
13411 </pre>text
13412
13413 !! end
13414
13415 # </tag> should be output literally since there is no matching tag that begins it
13416 !! test
13417 Parser hook: basic arguments using terminated empty elements (bug 2374)
13418 !! wikitext
13419 <tag width=200 height = "100" depth = '50' square/>
13420 other stuff
13421 </tag>
13422 !! html
13423 <pre>
13424 NULL
13425 array (
13426 'width' => '200',
13427 'height' => '100',
13428 'depth' => '50',
13429 'square' => 'square',
13430 )
13431 </pre>
13432 <p>other stuff
13433 &lt;/tag&gt;
13434 </p>
13435 !! end
13436
13437 ###
13438 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13439 ###
13440
13441 !! test
13442 Parser hook: static parser hook not inside a comment
13443 !! wikitext
13444 <statictag>hello, world</statictag>
13445 <statictag action=flush/>
13446 !! html
13447 <p>hello, world
13448 </p>
13449 !! end
13450
13451
13452 !! test
13453 Parser hook: static parser hook inside a comment
13454 !! wikitext
13455 <!-- <statictag>hello, world</statictag> -->
13456 <statictag action=flush/>
13457 !! html
13458 <p><br />
13459 </p>
13460 !! end
13461
13462 # Nested template calls; this case was broken by Parser.php rev 1.506,
13463 # since reverted.
13464
13465 !! article
13466 Template:One-parameter
13467 !! text
13468 (My parameter is: {{{1}}})
13469 !! endarticle
13470
13471 !! article
13472 Template:Map-one-parameter
13473 !! text
13474 {{{{{1}}}|{{{2}}}}}
13475 !! endarticle
13476
13477 !! test
13478 Nested template calls
13479 !! wikitext
13480 {{Map-one-parameter|One-parameter|param}}
13481 !! html
13482 <p>(My parameter is: param)
13483 </p>
13484 !! end
13485
13486
13487 ###
13488 ### Sanitizer
13489 ###
13490 !! test
13491 Sanitizer: Closing of open tags
13492 !! wikitext
13493 <s></s><table></table>
13494 !! html
13495 <s></s><table></table>
13496
13497 !! end
13498
13499 !! test
13500 Sanitizer: Closing of open but not closed tags
13501 !! wikitext
13502 <s>foo
13503 !! html
13504 <p><s>foo</s>
13505 </p>
13506 !! end
13507
13508 !! test
13509 Sanitizer: Closing of closed but not open tags
13510 !! wikitext
13511 </s>
13512 !! html
13513 <p>&lt;/s&gt;
13514 </p>
13515 !! end
13516
13517 !! test
13518 Sanitizer: Closing of closed but not open table tags
13519 !! wikitext
13520 Table not started</td></tr></table>
13521 !! html
13522 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13523 </p>
13524 !! end
13525
13526 !! test
13527 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13528 !! wikitext
13529 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13530 !! html
13531 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13532 </p>
13533 !! end
13534
13535 !! test
13536 Sanitizer: Validating the contents of the id attribute (bug 4515)
13537 !! options
13538 disabled
13539 !! wikitext
13540 <br id=9 />
13541 !! html
13542 Something, but definitely not <br id="9" />...
13543 !! end
13544
13545 !! test
13546 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13547 !! options
13548 disabled
13549 !! wikitext
13550 <br id="foo" /><br id="foo" />
13551 !! html
13552 Something need to be done. foo-2 ?
13553 !! end
13554
13555 !! test
13556 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13557 !! wikitext
13558 <div itemscope>
13559 <meta itemprop="hello" content="world">
13560 <meta http-equiv="refresh" content="5">
13561 <meta itemprop="hello" http-equiv="refresh" content="5">
13562 <link itemprop="hello" href="{{SERVER}}">
13563 <link rel="stylesheet" href="{{SERVER}}">
13564 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13565 </div>
13566 !! html
13567 <div itemscope="itemscope">
13568 <p> <meta itemprop="hello" content="world" />
13569 &lt;meta http-equiv="refresh" content="5"&gt;
13570 <meta itemprop="hello" content="5" />
13571 </p>
13572 <link itemprop="hello" href="http&#58;//example.org" />
13573 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13574 <link itemprop="hello" href="http&#58;//example.org" />
13575 </div>
13576
13577 !! end
13578
13579 !! test
13580 Language converter: output gets cut off unexpectedly (bug 5757)
13581 !! options
13582 language=zh
13583 !! wikitext
13584 this bit is safe: }-
13585
13586 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13587
13588 then we get cut off here: }-
13589
13590 all additional text is vanished
13591 !! html
13592 <p>this bit is safe: }-
13593 </p><p>but if we add a conversion instance: xxx
13594 </p><p>then we get cut off here: }-
13595 </p><p>all additional text is vanished
13596 </p>
13597 !! end
13598
13599 !! test
13600 Self closed html pairs (bug 5487)
13601 !! options
13602 !! wikitext
13603 <center><font id="bug" />Centered text</center>
13604 <div><font id="bug2" />In div text</div>
13605 !! html
13606 <center>&lt;font id="bug" /&gt;Centered text</center>
13607 <div>&lt;font id="bug2" /&gt;In div text</div>
13608
13609 !! end
13610
13611 #
13612 #
13613 #
13614
13615 !! test
13616 Punctuation: nbsp before exclamation
13617 !! wikitext
13618 C'est grave !
13619 !! html
13620 <p>C'est grave&#160;!
13621 </p>
13622 !! end
13623
13624 !! test
13625 Punctuation: CSS !important (bug 11874)
13626 !! wikitext
13627 <div style="width:50% !important">important</div>
13628 !! html
13629 <div style="width:50% !important">important</div>
13630
13631 !!end
13632
13633 !! test
13634 Punctuation: CSS ! important (bug 11874; with space after)
13635 !! wikitext
13636 <div style="width:50% ! important">important</div>
13637 !! html
13638 <div style="width:50% ! important">important</div>
13639
13640 !!end
13641
13642
13643 !! test
13644 HTML bullet list, closed tags (bug 5497)
13645 !! wikitext
13646 <ul>
13647 <li>One</li>
13648 <li>Two</li>
13649 </ul>
13650 !! html
13651 <ul>
13652 <li>One</li>
13653 <li>Two</li>
13654 </ul>
13655
13656 !! end
13657
13658 !! test
13659 HTML bullet list, unclosed tags (bug 5497)
13660 !! options
13661 disabled
13662 !! wikitext
13663 <ul>
13664 <li>One
13665 <li>Two
13666 </ul>
13667 !! html
13668 <ul>
13669 <li>One
13670 </li>
13671 <li>Two
13672 </li>
13673 </ul>
13674
13675 !! end
13676
13677 !! test
13678 HTML ordered list, closed tags (bug 5497)
13679 !! wikitext
13680 <ol>
13681 <li>One</li>
13682 <li>Two</li>
13683 </ol>
13684 !! html
13685 <ol>
13686 <li>One</li>
13687 <li>Two</li>
13688 </ol>
13689
13690 !! end
13691
13692 !! test
13693 HTML ordered list, unclosed tags (bug 5497)
13694 !! options
13695 disabled
13696 !! wikitext
13697 <ol>
13698 <li>One
13699 <li>Two
13700 </ol>
13701 !! html
13702 <ol>
13703 <li>One
13704 </li>
13705 <li>Two
13706 </li>
13707 </ol>
13708
13709 !! end
13710
13711 !! test
13712 HTML nested bullet list, closed tags (bug 5497)
13713 !! wikitext
13714 <ul>
13715 <li>One</li>
13716 <li>Two:
13717 <ul>
13718 <li>Sub-one</li>
13719 <li>Sub-two</li>
13720 </ul>
13721 </li>
13722 </ul>
13723 !! html
13724 <ul>
13725 <li>One</li>
13726 <li>Two:
13727 <ul>
13728 <li>Sub-one</li>
13729 <li>Sub-two</li>
13730 </ul>
13731 </li>
13732 </ul>
13733
13734 !! end
13735
13736 !! test
13737 HTML nested bullet list, open tags (bug 5497)
13738 !! options
13739 disabled
13740 !! wikitext
13741 <ul>
13742 <li>One
13743 <li>Two:
13744 <ul>
13745 <li>Sub-one
13746 <li>Sub-two
13747 </ul>
13748 </ul>
13749 !! html
13750 <ul>
13751 <li>One
13752 </li>
13753 <li>Two:
13754 <ul>
13755 <li>Sub-one
13756 </li>
13757 <li>Sub-two
13758 </li>
13759 </ul>
13760 </li>
13761 </ul>
13762
13763 !! end
13764
13765 !! test
13766 HTML nested ordered list, closed tags (bug 5497)
13767 !! wikitext
13768 <ol>
13769 <li>One</li>
13770 <li>Two:
13771 <ol>
13772 <li>Sub-one</li>
13773 <li>Sub-two</li>
13774 </ol>
13775 </li>
13776 </ol>
13777 !! html
13778 <ol>
13779 <li>One</li>
13780 <li>Two:
13781 <ol>
13782 <li>Sub-one</li>
13783 <li>Sub-two</li>
13784 </ol>
13785 </li>
13786 </ol>
13787
13788 !! end
13789
13790 !! test
13791 HTML nested ordered list, open tags (bug 5497)
13792 !! options
13793 disabled
13794 !! wikitext
13795 <ol>
13796 <li>One
13797 <li>Two:
13798 <ol>
13799 <li>Sub-one
13800 <li>Sub-two
13801 </ol>
13802 </ol>
13803 !! html
13804 <ol>
13805 <li>One
13806 </li>
13807 <li>Two:
13808 <ol>
13809 <li>Sub-one
13810 </li>
13811 <li>Sub-two
13812 </li>
13813 </ol>
13814 </li>
13815 </ol>
13816
13817 !! end
13818
13819 !! test
13820 HTML ordered list item with parameters oddity
13821 !! wikitext
13822 <ol><li id="fragment">One</li>
13823 </ol>
13824 !! html
13825 <ol><li id="fragment">One</li>
13826 </ol>
13827
13828 !! end
13829
13830 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13831 !!test
13832 bug 5918: autonumbering
13833 !! wikitext
13834 [http://first/] [http://second] [ftp://ftp]
13835
13836 ftp://inlineftp
13837
13838 [mailto:enclosed@mail.tld With target]
13839
13840 [mailto:enclosed@mail.tld]
13841
13842 mailto:inline@mail.tld
13843 !! html/php
13844 <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>
13845 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13846 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13847 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13848 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13849 </p>
13850 !! html/parsoid
13851 <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>
13852 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13853 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13854 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13855 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13856 !! end
13857
13858
13859 #
13860 # Security and HTML correctness
13861 # From Nick Jenkins' fuzz testing
13862 #
13863
13864 !! test
13865 Fuzz testing: Parser13
13866 !! wikitext
13867 {|
13868 | http://a|
13869 !! html
13870 <table>
13871 <tr>
13872 <td>
13873 </td>
13874 </tr>
13875 </table>
13876
13877 !! end
13878
13879 !! test
13880 Fuzz testing: Parser14
13881 !! wikitext
13882 == onmouseover= ==
13883 http://__TOC__
13884 !! html
13885 <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>
13886 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13887 <ul>
13888 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13889 </ul>
13890 </div>
13891
13892
13893 !! end
13894
13895 !! test
13896 Fuzz testing: Parser14-table
13897 !! wikitext
13898 ==a==
13899 {| STYLE=__TOC__
13900 !! html
13901 <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>
13902 <table style="&#95;_TOC&#95;_">
13903 <tr><td></td></tr>
13904 </table>
13905
13906 !! end
13907
13908 # Known to produce bogus xml (extra </td>)
13909 !! test
13910 Fuzz testing: Parser16
13911 !! options
13912 noxml
13913 !! wikitext
13914 {|
13915 !https://||||||
13916 !! html
13917 <table>
13918 <tr>
13919 <th>https://</th>
13920 <th></th>
13921 <th></th>
13922 <th>
13923 </td>
13924 </tr>
13925 </table>
13926
13927 !! end
13928
13929 !! test
13930 Fuzz testing: Parser21
13931 !! wikitext
13932 {|
13933 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13934 |
13935 !! html
13936 <table>
13937 <tr>
13938 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13939 </th>
13940 <td>
13941 </td>
13942 </tr>
13943 </table>
13944
13945 !! end
13946
13947 !! test
13948 Fuzz testing: Parser22
13949 !! wikitext
13950 http://===r:::https://b
13951
13952 {|
13953 !! html
13954 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13955 </p>
13956 <table>
13957 <tr><td></td></tr>
13958 </table>
13959
13960 !! end
13961
13962 # Known to produce bad XML for now
13963 !! test
13964 Fuzz testing: Parser24
13965 !! options
13966 noxml
13967 !! wikitext
13968 {|
13969 {{{|
13970 <u CLASS=
13971 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13972 <br style="onmouseover='alert(document.cookie);' " />
13973
13974 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13975 |
13976 !! html
13977 <table>
13978 {{{|
13979 <u class="&#124;">}}}} &gt;
13980 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13981
13982 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13983 <tr>
13984 <td></u>
13985 </td>
13986 </tr>
13987 </table>
13988
13989 !! end
13990
13991 # Note: the current result listed for this is not what the original one was,
13992 # but the original bug was JavaScript injection, which is fixed in any case.
13993 # It's not clear that the original result listed was any more correct than the
13994 # current one. Original result:
13995 # <p>{{{|
13996 # </p>
13997 # <li class="&#124;&#124;">
13998 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13999 !!test
14000 Fuzz testing: Parser25 (bug 6055)
14001 !! wikitext
14002 {{{
14003 |
14004 <LI CLASS=||
14005 >
14006 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14007 !! html
14008 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14009 </p>
14010 !! end
14011
14012 !!test
14013 Fuzz testing: URL adjacent extension (with space, clean)
14014 !! options
14015 !! wikitext
14016 http://example.com <nowiki>junk</nowiki>
14017 !! html
14018 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14019 </p>
14020 !!end
14021
14022 !!test
14023 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14024 !! options
14025 !! wikitext
14026 http://example.com<nowiki>junk</nowiki>
14027 !! html
14028 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14029 </p>
14030 !!end
14031
14032 !!test
14033 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14034 !! options
14035 !! wikitext
14036 http://example.com<pre>junk</pre>
14037 !! html
14038 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14039
14040 !!end
14041
14042 !!test
14043 Fuzz testing: image with bogus manual thumbnail
14044 !! wikitext
14045 [[Image:foobar.jpg|thumbnail= ]]
14046 !! html/php
14047 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14048
14049 !! html/parsoid
14050 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14051 !!end
14052
14053 !! test
14054 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14055 !! wikitext
14056 <pre dir="&#10;"></pre>
14057 !! html
14058 <pre dir="&#10;"></pre>
14059
14060 !! end
14061
14062 !! test
14063 Parsing optional HTML elements (Bug 6171)
14064 !! options
14065 !! wikitext
14066 <table>
14067 <tr>
14068 <td> Some tabular data</td>
14069 <td> More tabular data ...
14070 <td> And yet som tabular data</td>
14071 </tr>
14072 </table>
14073 !! html
14074 <table>
14075 <tr>
14076 <td> Some tabular data</td>
14077 <td> More tabular data ...
14078 </td><td> And yet som tabular data</td>
14079 </tr>
14080 </table>
14081
14082 !! end
14083
14084 !! test
14085 Correct handling of <td>, <tr> (Bug 6171)
14086 !! options
14087 !! wikitext
14088 <table>
14089 <tr>
14090 <td> Some tabular data</td>
14091 <td> More tabular data ...</td>
14092 <td> And yet som tabular data</td>
14093 </tr>
14094 </table>
14095 !! html
14096 <table>
14097 <tr>
14098 <td> Some tabular data</td>
14099 <td> More tabular data ...</td>
14100 <td> And yet som tabular data</td>
14101 </tr>
14102 </table>
14103
14104 !! end
14105
14106
14107 !! test
14108 Parsing crashing regression (fr:JavaScript)
14109 !! wikitext
14110 </body></x>
14111 !! html
14112 <p>&lt;/body&gt;&lt;/x&gt;
14113 </p>
14114 !! end
14115
14116 !! test
14117 Inline wiki vs wiki block nesting
14118 !! wikitext
14119 '''Bold paragraph
14120
14121 New wiki paragraph
14122 !! html
14123 <p><b>Bold paragraph</b>
14124 </p><p>New wiki paragraph
14125 </p>
14126 !! end
14127
14128 !! test
14129 Inline HTML vs wiki block nesting
14130 !! options
14131 disabled
14132 !! wikitext
14133 <b>Bold paragraph
14134
14135 New wiki paragraph
14136 !! html
14137 <p><b>Bold paragraph</b>
14138 </p><p>New wiki paragraph
14139 </p>
14140 !! end
14141
14142 # Original result was this:
14143 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14144 # </p>
14145 # While that might be marginally more intuitive, maybe, the six-apostrophe
14146 # construct is clearly pathological and the result stated here (which is what
14147 # the parser actually does) is about as reasonable as anything.
14148 !!test
14149 Mixing markup for italics and bold
14150 !! options
14151 !! wikitext
14152 '''bold''''''bold''bolditalics'''''
14153 !! html
14154 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14155 </p>
14156 !! end
14157
14158
14159 !! article
14160 Xyzzyx
14161 !! text
14162 Article for special page transclusion test
14163 !! endarticle
14164
14165 !! test
14166 Special page transclusion
14167 !! options
14168 !! wikitext
14169 {{Special:Prefixindex/Xyzzyx}}
14170 !! html
14171 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14172
14173 !! end
14174
14175 !! test
14176 Special page transclusion twice (bug 5021)
14177 !! options
14178 !! wikitext
14179 {{Special:Prefixindex/Xyzzyx}}
14180 {{Special:Prefixindex/Xyzzyx}}
14181 !! html
14182 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14183 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14184
14185 !! end
14186
14187 !! test
14188 Transclusion of default MediaWiki message
14189 !! wikitext
14190 {{MediaWiki:Mainpage}}
14191 !! html
14192 <p>Main Page
14193 </p>
14194 !! end
14195
14196 !! test
14197 Transclusion of nonexistent MediaWiki message
14198 !! wikitext
14199 {{MediaWiki:Mainpagexxx}}
14200 !! html
14201 <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>
14202 </p>
14203 !! end
14204
14205 !! test
14206 Transclusion of MediaWiki message with underscore
14207 !! wikitext
14208 {{MediaWiki:history_short}}
14209 !! html
14210 <p>History
14211 </p>
14212 !! end
14213
14214 !! test
14215 Transclusion of MediaWiki message with space
14216 !! wikitext
14217 {{MediaWiki:history short}}
14218 !! html
14219 <p>History
14220 </p>
14221 !! end
14222
14223 !! test
14224 Invalid header with following text
14225 !! wikitext
14226 = x = y
14227 !! html
14228 <p>= x = y
14229 </p>
14230 !! end
14231
14232
14233 !! test
14234 Section extraction test (section 0)
14235 !! options
14236 section=0
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 start
14251 !! end
14252
14253 !! test
14254 Section extraction test (section 1)
14255 !! options
14256 section=1
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 ==a==
14271 ===aa===
14272 ====aaa====
14273 !! end
14274
14275 !! test
14276 Section extraction test (section 2)
14277 !! options
14278 section=2
14279 !! wikitext
14280 start
14281 ==a==
14282 ===aa===
14283 ====aaa====
14284 ==b==
14285 ===ba===
14286 ===bb===
14287 ====bba====
14288 ===bc===
14289 ==c==
14290 ===ca===
14291 !! html
14292 ===aa===
14293 ====aaa====
14294 !! end
14295
14296 !! test
14297 Section extraction test (section 3)
14298 !! options
14299 section=3
14300 !! wikitext
14301 start
14302 ==a==
14303 ===aa===
14304 ====aaa====
14305 ==b==
14306 ===ba===
14307 ===bb===
14308 ====bba====
14309 ===bc===
14310 ==c==
14311 ===ca===
14312 !! html
14313 ====aaa====
14314 !! end
14315
14316 !! test
14317 Section extraction test (section 4)
14318 !! options
14319 section=4
14320 !! wikitext
14321 start
14322 ==a==
14323 ===aa===
14324 ====aaa====
14325 ==b==
14326 ===ba===
14327 ===bb===
14328 ====bba====
14329 ===bc===
14330 ==c==
14331 ===ca===
14332 !! html
14333 ==b==
14334 ===ba===
14335 ===bb===
14336 ====bba====
14337 ===bc===
14338 !! end
14339
14340 !! test
14341 Section extraction test (section 5)
14342 !! options
14343 section=5
14344 !! wikitext
14345 start
14346 ==a==
14347 ===aa===
14348 ====aaa====
14349 ==b==
14350 ===ba===
14351 ===bb===
14352 ====bba====
14353 ===bc===
14354 ==c==
14355 ===ca===
14356 !! html
14357 ===ba===
14358 !! end
14359
14360 !! test
14361 Section extraction test (section 6)
14362 !! options
14363 section=6
14364 !! wikitext
14365 start
14366 ==a==
14367 ===aa===
14368 ====aaa====
14369 ==b==
14370 ===ba===
14371 ===bb===
14372 ====bba====
14373 ===bc===
14374 ==c==
14375 ===ca===
14376 !! html
14377 ===bb===
14378 ====bba====
14379 !! end
14380
14381 !! test
14382 Section extraction test (section 7)
14383 !! options
14384 section=7
14385 !! wikitext
14386 start
14387 ==a==
14388 ===aa===
14389 ====aaa====
14390 ==b==
14391 ===ba===
14392 ===bb===
14393 ====bba====
14394 ===bc===
14395 ==c==
14396 ===ca===
14397 !! html
14398 ====bba====
14399 !! end
14400
14401 !! test
14402 Section extraction test (section 8)
14403 !! options
14404 section=8
14405 !! wikitext
14406 start
14407 ==a==
14408 ===aa===
14409 ====aaa====
14410 ==b==
14411 ===ba===
14412 ===bb===
14413 ====bba====
14414 ===bc===
14415 ==c==
14416 ===ca===
14417 !! html
14418 ===bc===
14419 !! end
14420
14421 !! test
14422 Section extraction test (section 9)
14423 !! options
14424 section=9
14425 !! wikitext
14426 start
14427 ==a==
14428 ===aa===
14429 ====aaa====
14430 ==b==
14431 ===ba===
14432 ===bb===
14433 ====bba====
14434 ===bc===
14435 ==c==
14436 ===ca===
14437 !! html
14438 ==c==
14439 ===ca===
14440 !! end
14441
14442 !! test
14443 Section extraction test (section 10)
14444 !! options
14445 section=10
14446 !! wikitext
14447 start
14448 ==a==
14449 ===aa===
14450 ====aaa====
14451 ==b==
14452 ===ba===
14453 ===bb===
14454 ====bba====
14455 ===bc===
14456 ==c==
14457 ===ca===
14458 !! html
14459 ===ca===
14460 !! end
14461
14462 !! test
14463 Section extraction test (nonexistent section 11)
14464 !! options
14465 section=11
14466 !! wikitext
14467 start
14468 ==a==
14469 ===aa===
14470 ====aaa====
14471 ==b==
14472 ===ba===
14473 ===bb===
14474 ====bba====
14475 ===bc===
14476 ==c==
14477 ===ca===
14478 !! html
14479 !! end
14480
14481 !! test
14482 Section extraction test with bogus heading (section 1)
14483 !! options
14484 section=1
14485 !! wikitext
14486 ==a==
14487 ==bogus== not a legal section
14488 ==b==
14489 !! html
14490 ==a==
14491 ==bogus== not a legal section
14492 !! end
14493
14494 !! test
14495 Section extraction test with bogus heading (section 2)
14496 !! options
14497 section=2
14498 !! wikitext
14499 ==a==
14500 ==bogus== not a legal section
14501 ==b==
14502 !! html
14503 ==b==
14504 !! end
14505
14506 !! test
14507 Section extraction test with comment after heading (section 1)
14508 !! options
14509 section=1
14510 !! wikitext
14511 ==a==
14512 ==b== <!-- -->
14513 ==c==
14514 !! html
14515 ==a==
14516 !! end
14517
14518 !! test
14519 Section extraction test with comment after heading (section 2)
14520 !! options
14521 section=2
14522 !! wikitext
14523 ==a==
14524 ==b== <!-- -->
14525 ==c==
14526 !! html
14527 ==b== <!-- -->
14528 !! end
14529
14530 !! test
14531 Section extraction test with bogus <nowiki> heading (section 1)
14532 !! options
14533 section=1
14534 !! wikitext
14535 ==a==
14536 ==bogus== <nowiki>not a legal section</nowiki>
14537 ==b==
14538 !! html
14539 ==a==
14540 ==bogus== <nowiki>not a legal section</nowiki>
14541 !! end
14542
14543 !! test
14544 Section extraction test with bogus <nowiki> heading (section 2)
14545 !! options
14546 section=2
14547 !! wikitext
14548 ==a==
14549 ==bogus== <nowiki>not a legal section</nowiki>
14550 ==b==
14551 !! html
14552 ==b==
14553 !! end
14554
14555
14556 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14557 # instead of respecting commented sections
14558 !! test
14559 Section extraction prefixed by comment (section 1)
14560 !! options
14561 section=1
14562 !! wikitext
14563 <!-- -->==sec1==
14564 ==sec2==
14565 !! html
14566 ==sec2==
14567 !!end
14568
14569 !! test
14570 Section extraction prefixed by comment (section 2)
14571 !! options
14572 section=2
14573 !! wikitext
14574 <!-- -->==sec1==
14575 ==sec2==
14576 !! html
14577
14578 !!end
14579
14580
14581 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14582 # instead of respecting HTML-style headings
14583 !! test
14584 Section extraction, mixed wiki and html (section 1)
14585 !! options
14586 section=1
14587 !! wikitext
14588 <h2>unmarked</h2>
14589 unmarked
14590 ==1==
14591 one
14592 ==2==
14593 two
14594 !! html
14595 ==1==
14596 one
14597 !! end
14598
14599 !! test
14600 Section extraction, mixed wiki and html (section 2)
14601 !! options
14602 section=2
14603 !! wikitext
14604 <h2>unmarked</h2>
14605 unmarked
14606 ==1==
14607 one
14608 ==2==
14609 two
14610 !! html
14611 ==2==
14612 two
14613 !! end
14614
14615
14616 # Formerly testing for bug 3342
14617 !! test
14618 Section extraction, heading surrounded by <noinclude>
14619 !! options
14620 section=1
14621 !! wikitext
14622 <noinclude>==unmarked==</noinclude>
14623 ==marked==
14624 !! html
14625 ==marked==
14626 !!end
14627
14628 # Test behavior of bug 19910
14629 !! test
14630 Sectiion with all-equals
14631 !! options
14632 section=2
14633 !! wikitext
14634 ===
14635 The line above must have a trailing space
14636 === <!--
14637 --> <!-- -->
14638 But just in case it doesn't...
14639 !! html
14640 === <!--
14641 --> <!-- -->
14642 But just in case it doesn't...
14643 !! end
14644
14645 !! test
14646 Section replacement test (section 0)
14647 !! options
14648 replace=0,"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 xxx
14663
14664 ==a==
14665 ===aa===
14666 ====aaa====
14667 ==b==
14668 ===ba===
14669 ===bb===
14670 ====bba====
14671 ===bc===
14672 ==c==
14673 ===ca===
14674 !! end
14675
14676 !! test
14677 Section replacement test (section 1)
14678 !! options
14679 replace=1,"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 xxx
14695
14696 ==b==
14697 ===ba===
14698 ===bb===
14699 ====bba====
14700 ===bc===
14701 ==c==
14702 ===ca===
14703 !! end
14704
14705 !! test
14706 Section replacement test (section 2)
14707 !! options
14708 replace=2,"xxx"
14709 !! wikitext
14710 start
14711 ==a==
14712 ===aa===
14713 ====aaa====
14714 ==b==
14715 ===ba===
14716 ===bb===
14717 ====bba====
14718 ===bc===
14719 ==c==
14720 ===ca===
14721 !! html
14722 start
14723 ==a==
14724 xxx
14725
14726 ==b==
14727 ===ba===
14728 ===bb===
14729 ====bba====
14730 ===bc===
14731 ==c==
14732 ===ca===
14733 !! end
14734
14735 !! test
14736 Section replacement test (section 3)
14737 !! options
14738 replace=3,"xxx"
14739 !! wikitext
14740 start
14741 ==a==
14742 ===aa===
14743 ====aaa====
14744 ==b==
14745 ===ba===
14746 ===bb===
14747 ====bba====
14748 ===bc===
14749 ==c==
14750 ===ca===
14751 !! html
14752 start
14753 ==a==
14754 ===aa===
14755 xxx
14756
14757 ==b==
14758 ===ba===
14759 ===bb===
14760 ====bba====
14761 ===bc===
14762 ==c==
14763 ===ca===
14764 !! end
14765
14766 !! test
14767 Section replacement test (section 4)
14768 !! options
14769 replace=4,"xxx"
14770 !! wikitext
14771 start
14772 ==a==
14773 ===aa===
14774 ====aaa====
14775 ==b==
14776 ===ba===
14777 ===bb===
14778 ====bba====
14779 ===bc===
14780 ==c==
14781 ===ca===
14782 !! html
14783 start
14784 ==a==
14785 ===aa===
14786 ====aaa====
14787 xxx
14788
14789 ==c==
14790 ===ca===
14791 !! end
14792
14793 !! test
14794 Section replacement test (section 5)
14795 !! options
14796 replace=5,"xxx"
14797 !! wikitext
14798 start
14799 ==a==
14800 ===aa===
14801 ====aaa====
14802 ==b==
14803 ===ba===
14804 ===bb===
14805 ====bba====
14806 ===bc===
14807 ==c==
14808 ===ca===
14809 !! html
14810 start
14811 ==a==
14812 ===aa===
14813 ====aaa====
14814 ==b==
14815 xxx
14816
14817 ===bb===
14818 ====bba====
14819 ===bc===
14820 ==c==
14821 ===ca===
14822 !! end
14823
14824 !! test
14825 Section replacement test (section 6)
14826 !! options
14827 replace=6,"xxx"
14828 !! wikitext
14829 start
14830 ==a==
14831 ===aa===
14832 ====aaa====
14833 ==b==
14834 ===ba===
14835 ===bb===
14836 ====bba====
14837 ===bc===
14838 ==c==
14839 ===ca===
14840 !! html
14841 start
14842 ==a==
14843 ===aa===
14844 ====aaa====
14845 ==b==
14846 ===ba===
14847 xxx
14848
14849 ===bc===
14850 ==c==
14851 ===ca===
14852 !! end
14853
14854 !! test
14855 Section replacement test (section 7)
14856 !! options
14857 replace=7,"xxx"
14858 !! wikitext
14859 start
14860 ==a==
14861 ===aa===
14862 ====aaa====
14863 ==b==
14864 ===ba===
14865 ===bb===
14866 ====bba====
14867 ===bc===
14868 ==c==
14869 ===ca===
14870 !! html
14871 start
14872 ==a==
14873 ===aa===
14874 ====aaa====
14875 ==b==
14876 ===ba===
14877 ===bb===
14878 xxx
14879
14880 ===bc===
14881 ==c==
14882 ===ca===
14883 !! end
14884
14885 !! test
14886 Section replacement test (section 8)
14887 !! options
14888 replace=8,"xxx"
14889 !! wikitext
14890 start
14891 ==a==
14892 ===aa===
14893 ====aaa====
14894 ==b==
14895 ===ba===
14896 ===bb===
14897 ====bba====
14898 ===bc===
14899 ==c==
14900 ===ca===
14901 !! html
14902 start
14903 ==a==
14904 ===aa===
14905 ====aaa====
14906 ==b==
14907 ===ba===
14908 ===bb===
14909 ====bba====
14910 xxx
14911
14912 ==c==
14913 ===ca===
14914 !!end
14915
14916 !! test
14917 Section replacement test (section 9)
14918 !! options
14919 replace=9,"xxx"
14920 !! wikitext
14921 start
14922 ==a==
14923 ===aa===
14924 ====aaa====
14925 ==b==
14926 ===ba===
14927 ===bb===
14928 ====bba====
14929 ===bc===
14930 ==c==
14931 ===ca===
14932 !! html
14933 start
14934 ==a==
14935 ===aa===
14936 ====aaa====
14937 ==b==
14938 ===ba===
14939 ===bb===
14940 ====bba====
14941 ===bc===
14942 xxx
14943 !! end
14944
14945 !! test
14946 Section replacement test (section 10)
14947 !! options
14948 replace=10,"xxx"
14949 !! wikitext
14950 start
14951 ==a==
14952 ===aa===
14953 ====aaa====
14954 ==b==
14955 ===ba===
14956 ===bb===
14957 ====bba====
14958 ===bc===
14959 ==c==
14960 ===ca===
14961 !! html
14962 start
14963 ==a==
14964 ===aa===
14965 ====aaa====
14966 ==b==
14967 ===ba===
14968 ===bb===
14969 ====bba====
14970 ===bc===
14971 ==c==
14972 xxx
14973 !! end
14974
14975 !! test
14976 Section replacement test with initial whitespace (bug 13728)
14977 !! options
14978 replace=2,"xxx"
14979 !! wikitext
14980 Preformatted initial line
14981 ==a==
14982 ===a===
14983 !! html
14984 Preformatted initial line
14985 ==a==
14986 xxx
14987 !! end
14988
14989
14990 !! test
14991 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14992 !! options
14993 section=1
14994 !! wikitext
14995 ==a==
14996 a
14997 !! html
14998 ==a==
14999 a
15000 !! end
15001
15002 !! test
15003 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15004 !! options
15005 section=1
15006 !! wikitext
15007 ==a==
15008 a
15009 !! html
15010 ==a==
15011 a
15012 !! end
15013
15014
15015 !! test
15016 Section extraction, <pre> around bogus header (bug 10309)
15017 !! options
15018 noxml section=2
15019 !! wikitext
15020 == Section One ==
15021 <pre>
15022 =======
15023 </pre>
15024
15025 == Section Two ==
15026 stuff
15027 !! html
15028 == Section Two ==
15029 stuff
15030 !! end
15031
15032 !! test
15033 Section replacement, <pre> around bogus header (bug 10309)
15034 !! options
15035 noxml replace=2,"xxx"
15036 !! wikitext
15037 == Section One ==
15038 <pre>
15039 =======
15040 </pre>
15041
15042 == Section Two ==
15043 stuff
15044 !! html
15045 == Section One ==
15046 <pre>
15047 =======
15048 </pre>
15049
15050 xxx
15051 !! end
15052
15053
15054
15055 !! test
15056 Handling of &#x0A; in URLs
15057 !! wikitext
15058 ** irc://&#x0A;a
15059 !! html/php
15060 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15061
15062 !! html/parsoid
15063 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15064 a">irc://
15065 a</a></li></ul></li></ul>
15066 !! end
15067
15068 !! test
15069 Handling of %0A in URLs
15070 !! wikitext
15071 ** irc://%0Aa
15072 !! html/php
15073 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15074
15075 !! html/parsoid
15076 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15077 !! end
15078
15079
15080 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15081 !! test
15082 5 quotes, code coverage +1 line
15083 !! options
15084 parsoid=wt2html
15085 !! wikitext
15086 '''''
15087 !! html/php
15088 !! html/parsoid
15089 <p><b><i></i></b></p>
15090 !! end
15091
15092 # same html as previous, but wikitext adjusted to match parsoid html2wt
15093 # note that wt2html and html2html will put the <i> before the <b>
15094 !! test
15095 5 quotes, code coverage +1 line w/ nowiki (1)
15096 !! options
15097 parsoid=wt2wt,html2wt
15098 !! wikitext
15099 '''''<nowiki/>'''''
15100 !! html/php
15101 <p><i></i>
15102 </p>
15103 !! html/parsoid
15104 <p><b><i></i></b></p>
15105 !! end
15106
15107 # same as previous, just swapping the <i> and <b>
15108 !! test
15109 5 quotes, code coverage +1 line w/ nowiki (2)
15110 !! wikitext
15111 '''''<nowiki/>'''''
15112 !! html/php
15113 <p><i></i>
15114 </p>
15115 !! html/parsoid
15116 <p><i><b></b></i></p>
15117 !! end
15118
15119 !! test
15120 Special:Search page linking.
15121 !! wikitext
15122 {{Special:search}}
15123 !! html
15124 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15125 </p>
15126 !! end
15127
15128 !! test
15129 Say the magic word
15130 !! options
15131 title=[[Parser test]]
15132 !! wikitext
15133 * {{PAGENAME}}
15134 * {{PAGENAMEE}}
15135 * {{FULLPAGENAME}}
15136 * {{FULLPAGENAMEE}}
15137 * {{BASEPAGENAME}}
15138 * {{BASEPAGENAMEE}}
15139 * {{SUBPAGENAME}}
15140 * {{SUBPAGENAMEE}}
15141 * {{ROOTPAGENAME}}
15142 * {{ROOTPAGENAMEE}}
15143 * {{TALKPAGENAME}}
15144 * {{TALKPAGENAMEE}}
15145 * {{SUBJECTPAGENAME}}
15146 * {{SUBJECTPAGENAMEE}}
15147 * {{NAMESPACEE}}
15148 * {{NAMESPACE}}
15149 * {{NAMESPACENUMBER}}
15150 * {{TALKSPACE}}
15151 * {{TALKSPACEE}}
15152 * {{SUBJECTSPACE}}
15153 * {{SUBJECTSPACEE}}
15154 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15155 !! html
15156 <ul><li> Parser test</li>
15157 <li> Parser_test</li>
15158 <li> Parser test</li>
15159 <li> Parser_test</li>
15160 <li> Parser test</li>
15161 <li> Parser_test</li>
15162 <li> Parser test</li>
15163 <li> Parser_test</li>
15164 <li> Parser test</li>
15165 <li> Parser_test</li>
15166 <li> Talk:Parser test</li>
15167 <li> Talk:Parser_test</li>
15168 <li> Parser test</li>
15169 <li> Parser_test</li>
15170 <li> </li>
15171 <li> </li>
15172 <li> 0</li>
15173 <li> Talk</li>
15174 <li> Talk</li>
15175 <li> </li>
15176 <li> </li>
15177 <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>
15178
15179 !! end
15180 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15181
15182 !! test
15183 Gallery
15184 !! wikitext
15185 <gallery>
15186 image1.png |
15187 image2.gif|||||
15188
15189 image3|
15190 image4 |300px| centre
15191 image5.svg| http://///////
15192 [[x|xx]]]]
15193 * image6
15194 </gallery>
15195 !! html
15196 <ul class="gallery mw-gallery-traditional">
15197 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15198 <div class="thumb" style="height: 150px;">Image1.png</div>
15199 <div class="gallerytext">
15200 </div>
15201 </div></li>
15202 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15203 <div class="thumb" style="height: 150px;">Image2.gif</div>
15204 <div class="gallerytext">
15205 <p>||||
15206 </p>
15207 </div>
15208 </div></li>
15209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15210 <div class="thumb" style="height: 150px;">Image3</div>
15211 <div class="gallerytext">
15212 </div>
15213 </div></li>
15214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15215 <div class="thumb" style="height: 150px;">Image4</div>
15216 <div class="gallerytext">
15217 <p>300px| centre
15218 </p>
15219 </div>
15220 </div></li>
15221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15222 <div class="thumb" style="height: 150px;">Image5.svg</div>
15223 <div class="gallerytext">
15224 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15225 </p>
15226 </div>
15227 </div></li>
15228 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15229 <div class="thumb" style="height: 150px;">* image6</div>
15230 <div class="gallerytext">
15231 </div>
15232 </div></li>
15233 </ul>
15234
15235 !! end
15236
15237 !! test
15238 Gallery (with options)
15239 !! wikitext
15240 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15241 File:Nonexistant.jpg|caption
15242 File:Nonexistant.jpg
15243 image:foobar.jpg|some '''caption''' [[Main Page]]
15244 image:foobar.jpg
15245 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15246 </gallery>
15247 !! html
15248 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15249 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15250 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15251 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15252 <div class="gallerytext">
15253 <p>caption
15254 </p>
15255 </div>
15256 </div></li>
15257 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15258 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15259 <div class="gallerytext">
15260 </div>
15261 </div></li>
15262 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15263 <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>
15264 <div class="gallerytext">
15265 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15266 </p>
15267 </div>
15268 </div></li>
15269 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15270 <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>
15271 <div class="gallerytext">
15272 </div>
15273 </div></li>
15274 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15275 <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>
15276 <div class="gallerytext">
15277 <p>Blabla|blabla.
15278 </p>
15279 </div>
15280 </div></li>
15281 </ul>
15282
15283 !! end
15284
15285 !! test
15286 Gallery with link that has fragment
15287 !! wikitext
15288 <gallery>
15289 image:foobar.jpg|link=Main_Page
15290 image:foobar.jpg|link=Main_Page#section
15291 image:foobar.jpg|link=Main Page#section|caption
15292 </gallery>
15293 !! html
15294 <ul class="gallery mw-gallery-traditional">
15295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15296 <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>
15297 <div class="gallerytext">
15298 </div>
15299 </div></li>
15300 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15301 <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>
15302 <div class="gallerytext">
15303 </div>
15304 </div></li>
15305 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15306 <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>
15307 <div class="gallerytext">
15308 <p>caption
15309 </p>
15310 </div>
15311 </div></li>
15312 </ul>
15313
15314 !! end
15315
15316 !! test
15317 Gallery with wikitext inside caption
15318 !! wikitext
15319 <gallery>
15320 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15321 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15322 </gallery>
15323 !! html
15324 <ul class="gallery mw-gallery-traditional">
15325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15326 <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>
15327 <div class="gallerytext">
15328 <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>
15329 </p>
15330 </div>
15331 </div></li>
15332 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15333 <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>
15334 <div class="gallerytext">
15335 <p>This is a test template
15336 </p>
15337 </div>
15338 </div></li>
15339 </ul>
15340
15341 !! end
15342
15343 !! test
15344 gallery (with showfilename option)
15345 !! wikitext
15346 <gallery showfilename>
15347 File:Nonexistant.jpg|caption
15348 File:Nonexistant.jpg
15349 image:foobar.jpg|some '''caption''' [[Main Page]]
15350 File:Foobar.jpg
15351 </gallery>
15352 !! html
15353 <ul class="gallery mw-gallery-traditional">
15354 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15355 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15356 <div class="gallerytext">
15357 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15358 caption
15359 </p>
15360 </div>
15361 </div></li>
15362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15363 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15364 <div class="gallerytext">
15365 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15366 </p>
15367 </div>
15368 </div></li>
15369 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15370 <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>
15371 <div class="gallerytext">
15372 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15373 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15374 </p>
15375 </div>
15376 </div></li>
15377 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15378 <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>
15379 <div class="gallerytext">
15380 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15381 </p>
15382 </div>
15383 </div></li>
15384 </ul>
15385
15386 !! end
15387
15388 !! test
15389 Gallery (with namespace-less filenames)
15390 !! wikitext
15391 <gallery>
15392 File:Nonexistant.jpg
15393 Nonexistant.jpg
15394 image:foobar.jpg
15395 foobar.jpg
15396 </gallery>
15397 !! html
15398 <ul class="gallery mw-gallery-traditional">
15399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15400 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15401 <div class="gallerytext">
15402 </div>
15403 </div></li>
15404 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15405 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15406 <div class="gallerytext">
15407 </div>
15408 </div></li>
15409 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15410 <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>
15411 <div class="gallerytext">
15412 </div>
15413 </div></li>
15414 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15415 <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>
15416 <div class="gallerytext">
15417 </div>
15418 </div></li>
15419 </ul>
15420
15421 !! end
15422
15423 !! test
15424 HTML Hex character encoding (spells the word "JavaScript")
15425 !! options
15426 parsoid=wt2html,wt2wt,html2html
15427 !! wikitext
15428 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15429 !! html/php
15430 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15431 </p>
15432 !! html/parsoid
15433 <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>
15434 !! end
15435
15436 !! test
15437 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15438 !! wikitext
15439 &#xsee;&#XSEE;
15440 !! html/php
15441 <p>&amp;#xsee;&amp;#XSEE;
15442 </p>
15443 !! html/parsoid
15444 <p>&amp;#xsee;&amp;#XSEE;</p>
15445 !! end
15446
15447 !! test
15448 HTML Hex character encoding mixed case
15449 !! options
15450 parsoid=wt2html,wt2wt,html2html
15451 !! wikitext
15452 &#xEE;&#Xee;
15453 !! html/php
15454 <p>&#xee;&#xee;
15455 </p>
15456 !! html/parsoid
15457 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15458 !! end
15459
15460 !! test
15461 __FORCETOC__ override
15462 !! wikitext
15463 __NEWSECTIONLINK__
15464 __FORCETOC__
15465 !! html
15466 <p><br />
15467 </p>
15468 !! end
15469
15470 !! test
15471 ISBN code coverage
15472 !! wikitext
15473 ISBN 978-0-1234-56&#x20;789
15474 !! html
15475 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15476 </p>
15477 !! end
15478
15479 !! test
15480 ISBN followed by 5 spaces
15481 !! wikitext
15482 ISBN
15483 !! html
15484 <p>ISBN
15485 </p>
15486 !! end
15487
15488 !! test
15489 Double ISBN
15490 !! wikitext
15491 ISBN ISBN 1234567890
15492 !! html
15493 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15494 </p>
15495 !! end
15496
15497 !! test
15498 ISBN with an X
15499 !! wikitext
15500 ISBN 3-462-04561-X
15501 !! html
15502 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15503 </p>
15504 !! end
15505
15506 !! test
15507 ISBN with empty prefix (parsoid test)
15508 !! wikitext
15509 ISBN 1234567890
15510 !! html/parsoid
15511 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15512 !! end
15513
15514 !! test
15515 Bug 22905: <abbr> followed by ISBN followed by </a>
15516 !! wikitext
15517 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15518 !! html
15519 <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>
15520 </p>
15521 !! end
15522
15523 !! test
15524 Double RFC
15525 !! wikitext
15526 RFC RFC 1234
15527 !! html
15528 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15529 </p>
15530 !! end
15531
15532 !! test
15533 Double RFC with a wiki link
15534 !! wikitext
15535 RFC [[RFC 1234]]
15536 !! html
15537 <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>
15538 </p>
15539 !! end
15540
15541 !! test
15542 RFC code coverage
15543 !! wikitext
15544 RFC 983&#x20;987
15545 !! html
15546 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15547 </p>
15548 !! end
15549
15550 !! test
15551 Centre-aligned image
15552 !! wikitext
15553 [[Image:foobar.jpg|centre]]
15554 !! html
15555 <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>
15556
15557 !!end
15558
15559 !! test
15560 None-aligned image
15561 !! wikitext
15562 [[Image:foobar.jpg|none]]
15563 !! html
15564 <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>
15565
15566 !!end
15567
15568 !! test
15569 Width + Height sized image (using px) (height is ignored)
15570 !! wikitext
15571 [[Image:foobar.jpg|640x480px]]
15572 !! html
15573 <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>
15574 </p>
15575 !!end
15576
15577 !! test
15578 Width-sized image (using px, no following whitespace)
15579 !! wikitext
15580 [[Image:foobar.jpg|640px]]
15581 !! html
15582 <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>
15583 </p>
15584 !!end
15585
15586 !! test
15587 Width-sized image (using px, with following whitespace - test regression from r39467)
15588 !! wikitext
15589 [[Image:foobar.jpg|640px ]]
15590 !! html
15591 <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>
15592 </p>
15593 !!end
15594
15595 !! test
15596 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15597 !! wikitext
15598 [[Image:foobar.jpg| 640px]]
15599 !! html
15600 <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>
15601 </p>
15602 !!end
15603
15604 !! test
15605 Image with page parameter
15606 !! options
15607 djvu
15608 !! wikitext
15609 [[File:LoremIpsum.djvu|page=2]]
15610 !! html
15611 <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>
15612 </p>
15613 !! end
15614
15615 !! test
15616 Another italics / bold test
15617 !! wikitext
15618 ''' ''x'
15619 !! html
15620 <pre>'<i> </i>x'
15621 </pre>
15622 !!end
15623
15624 # Note the results may be incorrect, as parserTest output included this:
15625 # XML error: Mismatched tag at byte 6120:
15626 # ...<dd> </dt></dl> </dd...
15627 !! test
15628 dt/dd/dl test
15629 !! options
15630 disabled
15631 !! wikitext
15632 :;;;::
15633 !! html
15634 <dl>
15635 <dd><dl>
15636 <dt><dl>
15637 <dt><dl>
15638 <dt><dl>
15639 <dd><dl>
15640 <dd>
15641 </dd>
15642 </dl>
15643 </dd>
15644 </dl>
15645 </dt>
15646 </dl>
15647 </dt>
15648 </dl>
15649 </dt>
15650 </dl>
15651 </dd>
15652 </dl>
15653
15654 !!end
15655
15656
15657 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15658 !! test
15659 Images with the "|" character in the comment
15660 !! wikitext
15661 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15662 !! html/php
15663 <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>
15664
15665 !! html/parsoid
15666 <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>
15667 !! end
15668
15669 !! test
15670 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15671 !! wikitext
15672 <html><script>alert(1);</script></html>
15673 !! html
15674 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15675 </p>
15676 !! end
15677
15678 !! test
15679 HTML with raw HTML ($wgRawHtml==true)
15680 !! options
15681 wgRawHtml=1
15682 !! wikitext
15683 <html><script>alert(1);</script></html>
15684 !! html
15685 <p><script>alert(1);</script>
15686 </p>
15687 !! end
15688
15689 !! test
15690 Parents of subpages, one level up
15691 !! options
15692 subpage title=[[Subpage test/L1/L2/L3]]
15693 !! wikitext
15694 [[../|L2]]
15695 !! html
15696 <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>
15697 </p>
15698 !! end
15699
15700
15701 !! test
15702 Parents of subpages, one level up, not named
15703 !! options
15704 subpage title=[[Subpage test/L1/L2/L3]]
15705 !! wikitext
15706 [[../]]
15707 !! html
15708 <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>
15709 </p>
15710 !! end
15711
15712
15713
15714 !! test
15715 Parents of subpages, two levels up
15716 !! options
15717 subpage title=[[Subpage test/L1/L2/L3]]
15718 !! wikitext
15719 [[../../|L1]]2
15720
15721 [[../../|L1]]l
15722 !! html
15723 <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
15724 </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>
15725 </p>
15726 !! end
15727
15728 !! test
15729 Parents of subpages, two levels up, without trailing slash or name.
15730 !! options
15731 subpage title=[[Subpage test/L1/L2/L3]]
15732 !! wikitext
15733 [[../..]]
15734 !! html
15735 <p>[[../..]]
15736 </p>
15737 !! end
15738
15739 !! test
15740 Parents of subpages, two levels up, with lots of extra trailing slashes.
15741 !! options
15742 subpage title=[[Subpage test/L1/L2/L3]]
15743 !! wikitext
15744 [[../../////]]
15745 !! html
15746 <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>
15747 </p>
15748 !! end
15749
15750 !! article
15751 Subpage test/L1/L2/L3Sibling
15752 !! text
15753 Sibling article
15754 !! endarticle
15755
15756 !! test
15757 Transclusion of a sibling page (one level up)
15758 !! options
15759 subpage title=[[Subpage test/L1/L2/L3]]
15760 !! wikitext
15761 {{../L3Sibling}}
15762 !! html
15763 <p>Sibling article
15764 </p>
15765 !! end
15766
15767 !! test
15768 Transclusion of a child page
15769 !! options
15770 subpage title=[[Subpage test/L1/L2]]
15771 !! wikitext
15772 {{/L3Sibling}}
15773 !! html
15774 <p>Sibling article
15775 </p>
15776 !! end
15777
15778 !! test
15779 Non-transclusion because of too many up levels
15780 !! options
15781 subpage title=[[Subpage test/L1/L2/L3]]
15782 !! wikitext
15783 {{../../../../More than parent}}
15784 !! html
15785 <p>{{../../../../More than parent}}
15786 </p>
15787 !! end
15788
15789 !! test
15790 Definition list code coverage
15791 !! wikitext
15792 ; title : def
15793 ; title : def
15794 ;title: def
15795 !! html
15796 <dl><dt> title &#160;</dt>
15797 <dd> def</dd>
15798 <dt> title&#160;</dt>
15799 <dd> def</dd>
15800 <dt>title</dt>
15801 <dd> def</dd></dl>
15802
15803 !! end
15804
15805 !! test
15806 Don't fall for the self-closing div
15807 !! wikitext
15808 <div>hello world</div/>
15809 !! html
15810 <div>hello world</div>
15811
15812 !! end
15813
15814 !! test
15815 MSGNW magic word
15816 !! wikitext
15817 {{MSGNW:msg}}
15818 !! html
15819 <p>&#91;&#91;:Template:Msg&#93;&#93;
15820 </p>
15821 !! end
15822
15823 !! test
15824 RAW magic word
15825 !! wikitext
15826 {{RAW:QUERTY}}
15827 !! html
15828 <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>
15829 </p>
15830 !! end
15831
15832 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15833 !! test
15834 Always escape literal '>' in output, not just after '<'
15835 !! wikitext
15836 ><>
15837 !! html
15838 <p>&gt;&lt;&gt;
15839 </p>
15840 !! end
15841
15842 !! test
15843 Template caching
15844 !! wikitext
15845 {{Test}}
15846 {{Test}}
15847 !! html
15848 <p>This is a test template
15849 This is a test template
15850 </p>
15851 !! end
15852
15853
15854 !! article
15855 MediaWiki:Fake
15856 !! text
15857 ==header==
15858 !! endarticle
15859
15860 !! test
15861 Inclusion of !userCanEdit() content
15862 !! wikitext
15863 {{MediaWiki:Fake}}
15864 !! html
15865 <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>
15866
15867 !! end
15868
15869
15870 !! test
15871 Out-of-order TOC heading levels
15872 !! wikitext
15873 ==2==
15874 ======6======
15875 ===3===
15876 =1=
15877 =====5=====
15878 ==2==
15879 !! html
15880 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15881 <ul>
15882 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15883 <ul>
15884 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15885 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15886 </ul>
15887 </li>
15888 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15889 <ul>
15890 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15891 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15892 </ul>
15893 </li>
15894 </ul>
15895 </div>
15896
15897 <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>
15898 <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>
15899 <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>
15900 <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>
15901 <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>
15902 <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>
15903
15904 !! end
15905
15906
15907 !! test
15908 ISBN with a dummy number
15909 !! wikitext
15910 ISBN ---
15911 !! html
15912 <p>ISBN ---
15913 </p>
15914 !! end
15915
15916
15917 !! test
15918 ISBN with space-delimited number
15919 !! wikitext
15920 ISBN 92 9017 032 8
15921 !! html
15922 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15923 </p>
15924 !! end
15925
15926
15927 !! test
15928 ISBN with multiple spaces, no number
15929 !! wikitext
15930 ISBN foo
15931 !! html
15932 <p>ISBN foo
15933 </p>
15934 !! end
15935
15936
15937 !! test
15938 ISBN length
15939 !! wikitext
15940 ISBN 123456789
15941
15942 ISBN 1234567890
15943
15944 ISBN 12345678901
15945 !! html
15946 <p>ISBN 123456789
15947 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15948 </p><p>ISBN 12345678901
15949 </p>
15950 !! end
15951
15952
15953 !! test
15954 ISBN with trailing year (bug 8110)
15955 !! wikitext
15956 ISBN 1-234-56789-0 - 2006
15957
15958 ISBN 1 234 56789 0 - 2006
15959 !! html
15960 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15961 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15962 </p>
15963 !! end
15964
15965
15966 !! test
15967 anchorencode
15968 !! wikitext
15969 {{anchorencode:foo bar©#%n}}
15970 !! html
15971 <p>foo_bar.C2.A9.23.25n
15972 </p>
15973 !! end
15974
15975 !! test
15976 anchorencode trims spaces
15977 !! wikitext
15978 {{anchorencode: __pretty__please__}}
15979 !! html
15980 <p>pretty_please
15981 </p>
15982 !! end
15983
15984 !! test
15985 anchorencode deals with links
15986 !! wikitext
15987 {{anchorencode: [[hello|world]] [[hi]]}}
15988 !! html
15989 <p>world_hi
15990 </p>
15991 !! end
15992
15993 !! test
15994 anchorencode deals with templates
15995 !! wikitext
15996 {{anchorencode: {{Foo}} }}
15997 !! html
15998 <p>FOO
15999 </p>
16000 !! end
16001
16002 !! test
16003 anchorencode encodes like the TOC generator: (bug 18431)
16004 !! wikitext
16005 === _ +:.3A%3A&&amp;]] ===
16006 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16007 __NOEDITSECTION__
16008 !! html
16009 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16010 <p>.2B:.3A.253A.26.26.5D.5D
16011 </p>
16012 !! end
16013
16014 !! test
16015 Bug 6200: blockquotes and paragraph formatting
16016 !! wikitext
16017 <blockquote>
16018 foo
16019 </blockquote>
16020
16021 bar
16022
16023 baz
16024 !! html
16025 <blockquote>
16026 <p>foo
16027 </p>
16028 </blockquote>
16029 <p>bar
16030 </p>
16031 <pre>baz
16032 </pre>
16033 !! end
16034
16035 !! test
16036 Bug 8293: Use of center tag ruins paragraph formatting
16037 !! wikitext
16038 <center>
16039 foo
16040 </center>
16041
16042 bar
16043
16044 baz
16045 !! html
16046 <center>
16047 <p>foo
16048 </p>
16049 </center>
16050 <p>bar
16051 </p>
16052 <pre>baz
16053 </pre>
16054 !! end
16055
16056 !!test
16057 Parsing of overlapping (improperly nested) inline html tags
16058 !! wikitext
16059 <span><s>x</span></s>
16060 !! html/php
16061 <p><span><s>x&lt;/span&gt;</s></span>
16062 </p>
16063 !! html/parsoid
16064 <p><span><s>x</s></span>
16065 </p>
16066 !!end
16067
16068 ###
16069 ### Language variants related tests
16070 ###
16071 !! test
16072 Self-link in language variants
16073 !! options
16074 title=[[Dunav]] language=sr
16075 !! wikitext
16076 Both [[Dunav]] and [[Дунав]] are names for this river.
16077 !! html
16078 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16079 </p>
16080 !!end
16081
16082 !! article
16083 Дуна
16084 !! text
16085 content
16086 !! endarticle
16087
16088 !! test
16089 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16090 !! options
16091 title=[[Duna]] language=sr
16092 !! wikitext
16093 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16094 !! html
16095 <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.
16096 </p>
16097 !! end
16098
16099 !! test
16100 Link to a section of a variant of this title shouldn't be parsed as self-link
16101 !! options
16102 title=[[Duna]] language=sr
16103 !! wikitext
16104 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16105 !! html
16106 <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.
16107 </p>
16108 !! end
16109
16110 !! test
16111 Link to pages in language variants
16112 !! options
16113 language=sr
16114 !! wikitext
16115 Main Page can be written as [[Маин Паге]]
16116 !! html
16117 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16118 </p>
16119 !!end
16120
16121
16122 !! test
16123 Multiple links to pages in language variants
16124 !! options
16125 language=sr
16126 !! wikitext
16127 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16128 !! html
16129 <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>.
16130 </p>
16131 !!end
16132
16133
16134 !! test
16135 Simple template in language variants
16136 !! options
16137 language=sr
16138 !! wikitext
16139 {{тест}}
16140 !! html
16141 <p>This is a test template
16142 </p>
16143 !! end
16144
16145
16146 !! test
16147 Template with explicit namespace in language variants
16148 !! options
16149 language=sr
16150 !! wikitext
16151 {{Template:тест}}
16152 !! html
16153 <p>This is a test template
16154 </p>
16155 !! end
16156
16157
16158 !! test
16159 Basic test for template parameter in language variants
16160 !! options
16161 language=sr
16162 !! wikitext
16163 {{парамтест|param=foo}}
16164 !! html
16165 <p>This is a test template with parameter foo
16166 </p>
16167 !! end
16168
16169
16170 !! test
16171 Simple category in language variants
16172 !! options
16173 language=sr cat
16174 !! wikitext
16175 [[Category:МедиаWики Усер'с Гуиде]]
16176 !! html
16177 <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>
16178 !! end
16179
16180
16181 !! article
16182 Category:分类
16183 !! text
16184 blah
16185 !! endarticle
16186
16187 !! article
16188 Category:分類
16189 !! text
16190 blah
16191 !! endarticle
16192
16193 !! test
16194 Don't convert blue categorylinks to another variant (bug 33210)
16195 !! options
16196 language=zh cat
16197 !! wikitext
16198 [[A]][[Category:分类]]
16199 !! html
16200 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16201 !! end
16202
16203
16204 !! test
16205 Stripping -{}- tags (language variants)
16206 !! options
16207 language=sr
16208 !! wikitext
16209 Latin proverb: -{Ne nuntium necare}-
16210 !! html
16211 <p>Latin proverb: Ne nuntium necare
16212 </p>
16213 !! end
16214
16215
16216 !! test
16217 Prevent conversion with -{}- tags (language variants)
16218 !! options
16219 language=sr variant=sr-ec
16220 !! wikitext
16221 Latinski: -{Ne nuntium necare}-
16222 !! html
16223 <p>Латински: Ne nuntium necare
16224 </p>
16225 !! end
16226
16227
16228 !! test
16229 Prevent conversion of text with -{}- tags (language variants)
16230 !! options
16231 language=sr variant=sr-ec
16232 !! wikitext
16233 Latinski: -{Ne nuntium necare}-
16234 !! html
16235 <p>Латински: Ne nuntium necare
16236 </p>
16237 !! end
16238
16239
16240 !! test
16241 Prevent conversion of links with -{}- tags (language variants)
16242 !! options
16243 language=sr variant=sr-ec
16244 !! wikitext
16245 -{[[Main Page]]}-
16246 !! html
16247 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16248 </p>
16249 !! end
16250
16251
16252 !! test
16253 -{}- tags within headlines (within html for parserConvert())
16254 !! options
16255 language=sr variant=sr-ec
16256 !! wikitext
16257 == -{Naslov}- ==
16258 !! html
16259 <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>
16260
16261 !! end
16262
16263
16264 !! test
16265 Explicit definition of language variant alternatives
16266 !! options
16267 language=zh variant=zh-tw
16268 !! wikitext
16269 -{zh:China;zh-tw:Taiwan}-, not China
16270 !! html
16271 <p>Taiwan, not China
16272 </p>
16273 !! end
16274
16275
16276 !! test
16277 Conversion around HTML tags
16278 !! options
16279 language=sr variant=sr-ec
16280 !! wikitext
16281 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16282 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16283 !! html
16284 <p>
16285 <span title="ЛаCтин">ски</span>
16286 </p>
16287 !! end
16288
16289
16290 !! test
16291 Explicit session-wise language variant mapping (A flag and - flag)
16292 !! options
16293 language=zh variant=zh-tw
16294 !! wikitext
16295 Taiwan is not China.
16296 But -{A|zh:China;zh-tw:Taiwan}- is China,
16297 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16298 and -{China}- is China.
16299 !! html
16300 <p>Taiwan is not China.
16301 But Taiwan is Taiwan,
16302 (This should be stripped!)
16303 and China is China.
16304 </p>
16305 !! end
16306
16307 !! test
16308 Explicit session-wise language variant mapping (H flag for hide)
16309 !! options
16310 language=zh variant=zh-tw
16311 !! wikitext
16312 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16313 Taiwan is China.
16314 !! html
16315 <p>(This should be stripped!)
16316 Taiwan is Taiwan.
16317 </p>
16318 !! end
16319
16320 !! test
16321 Adding explicit conversion rule for title (T flag)
16322 !! options
16323 language=zh variant=zh-tw showtitle
16324 !! wikitext
16325 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16326 !! html
16327 Taiwan
16328 <p>Should be stripped!
16329 </p>
16330 !! end
16331
16332 !! test
16333 Testing that changing the language variant here in the tests actually works
16334 !! options
16335 language=zh variant=zh showtitle
16336 !! wikitext
16337 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16338 !! html
16339 China
16340 <p>Should be stripped!
16341 </p>
16342 !! end
16343
16344 !! test
16345 Recursive conversion of alt and title attrs shouldn't clear converter state
16346 !! options
16347 language=zh variant=zh-cn showtitle
16348 !! wikitext
16349 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16350 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16351 !! html
16352 China
16353 <p>
16354 Should be stripped<span title="Exclamation">!</span>
16355 </p>
16356 !! end
16357
16358 !! test
16359 Bug 24072: more test on conversion rule for title
16360 !! options
16361 language=zh variant=zh-tw showtitle
16362 !! wikitext
16363 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16364 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16365 !! html
16366 Taiwan
16367 <p>This should be stripped!
16368 This won't take interferes with the title rule.
16369 </p>
16370 !! end
16371
16372 !! test
16373 Partly disable title conversion if variant == main language code
16374 !! options
16375 language=zh variant=zh title=[[ZH]] showtitle
16376 !! wikitext
16377 -{T|zh-cn:CN;zh-tw:TW}-
16378 !! html
16379 ZH
16380 <p>
16381 </p>
16382 !! end
16383
16384 !! test
16385 Partly disable title conversion if variant == main language code, more
16386 !! options
16387 language=zh variant=zh title=[[ZH]] showtitle
16388 !! wikitext
16389 -{T|TW}-
16390 !! html
16391 ZH
16392 <p>
16393 </p>
16394 !! end
16395
16396 !! test
16397 Raw output of variant escape tags (R flag)
16398 !! options
16399 language=zh variant=zh-tw
16400 !! wikitext
16401 Raw: -{R|zh:China;zh-tw:Taiwan}-
16402 !! html
16403 <p>Raw: zh:China;zh-tw:Taiwan
16404 </p>
16405 !! end
16406
16407 !! test
16408 Nested using of manual convert syntax
16409 !! options
16410 language=zh variant=zh-hk
16411 !! wikitext
16412 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16413 !! html
16414 <p>Nested: Hello Hong Kong!
16415 </p>
16416 !! end
16417
16418 !! test
16419 Proper conversion of text in external links
16420 !! options
16421 language=sr variant=sr-ec
16422 !! wikitext
16423 http://www.google.com
16424 gopher://www.google.com
16425 [http://www.google.com http://www.google.com]
16426 [gopher://www.google.com gopher://www.google.com]
16427 [https://www.google.com irc://www.google.com]
16428 [ftp://www.google.com www.google.com/ftp://dir]
16429 [//www.google.com www.google.com]
16430 !! html
16431 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16432 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16433 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16434 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16435 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16436 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16437 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16438 </p>
16439 !! end
16440
16441 !! test
16442 Do not convert roman numbers to language variants
16443 !! options
16444 language=sr variant=sr-ec
16445 !! wikitext
16446 Fridrih IV je car.
16447 !! html
16448 <p>Фридрих IV је цар.
16449 </p>
16450 !! end
16451
16452 !! test
16453 Unclosed language converter markup "-{"
16454 !! options
16455 language=sr
16456 !! wikitext
16457 -{T|hello
16458 !! html
16459 <p>-{T|hello
16460 </p>
16461 !! end
16462
16463 !! test
16464 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16465 !! options
16466 language=sr
16467 !! wikitext
16468 -{R|=&gt;}-
16469 !! html
16470 <p>=&gt;
16471 </p>
16472 !!end
16473
16474 !! test
16475 Don't break link parsing if language converter markup is in the caption.
16476 !! options
16477 language=sr variant=sr-ec
16478 !! wikitext
16479 [[Main Page|-{R|main page}-]]
16480 !! html
16481 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16482 </p>
16483 !! end
16484
16485 # This test is currently broken in the PHP parser (bug 52661)
16486 !! test
16487 Don't break image parsing if language converter markup is in the caption.
16488 !! options
16489 language=sr
16490 disabled
16491 !! wikitext
16492 [[File:Foobar.jpg|-{R|caption}-]]
16493 !! html
16494 <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>
16495 </p>
16496 !! end
16497
16498 # This test is currently broken in the PHP parser (bug 52661)
16499 !! test
16500 Don't break list handling if language converter markup is in the item.
16501 !! options
16502 language=zh variant=zh-cn
16503 disabled
16504 !! wikitext
16505 ;-{zh-cn:AAA;zh-tw:BBB}-
16506 !! html
16507 <dl><dt>AAA
16508 </dt></dl>
16509
16510 !! end
16511
16512 # This test is currently broken in the PHP parser (bug 52661)
16513 !! test
16514 Don't break table handling if language converter markup is in the cell.
16515 !! options
16516 language=sr variant=sr-ec
16517 disabled
16518 !! wikitext
16519 {|
16520 |-
16521 | -{R|B}-
16522 |}
16523 !! html
16524 <table>
16525
16526 <tr>
16527 <td> B
16528 </td></tr></table>
16529
16530 !! end
16531
16532 !! test
16533 Bug 529: Uncovered bullet
16534 !! wikitext
16535 * Foo {{bullet}}
16536 !! html
16537 <ul><li> Foo </li>
16538 <li> Bar</li></ul>
16539
16540 !! end
16541
16542 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16543 # Templates in Wikipedia rely on this behavior, as tidy has always been
16544 # enabled there. These tests are normally run *without* tidy, so specify the
16545 # full output here.
16546 # To test realistic parsing behavior, apply a tidy-like transformation to both
16547 # the expected output and your parser's output.
16548 !! test
16549 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16550 !! wikitext
16551 ******* Foo {{bullet}}
16552 !! html
16553 <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>
16554 <li> Bar</li></ul>
16555
16556 !! end
16557
16558 !! test
16559 Bug 529: Uncovered table already at line-start
16560 !! wikitext
16561 x
16562
16563 {{table}}
16564 y
16565 !! html
16566 <p>x
16567 </p>
16568 <table>
16569 <tr>
16570 <td> 1 </td>
16571 <td> 2
16572 </td></tr>
16573 <tr>
16574 <td> 3 </td>
16575 <td> 4
16576 </td></tr></table>
16577 <p>y
16578 </p>
16579 !! end
16580
16581 !! test
16582 Bug 529: Uncovered bullet in parser function result
16583 !! wikitext
16584 * Foo {{lc:{{bullet}} }}
16585 !! html
16586 <ul><li> Foo </li>
16587 <li> bar</li></ul>
16588
16589 !! end
16590
16591 !! test
16592 Bug 5678: Double-parsed template argument
16593 !! wikitext
16594 {{lc:{{{1}}}|hello}}
16595 !! html
16596 <p>{{{1}}}
16597 </p>
16598 !! end
16599
16600 !! test
16601 Bug 5678: Double-parsed template invocation
16602 !! wikitext
16603 {{lc:{{paramtest {{!}} param = hello }} }}
16604 !! html
16605 <p>{{paramtest | param = hello }}
16606 </p>
16607 !! end
16608
16609 !! test
16610 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16611 !! options
16612 language=cs
16613 title=[[Main Page]]
16614 !! wikitext
16615 {{PRVNÍVELKÉ:ěščř}}
16616 {{prvnívelké:ěščř}}
16617 {{PRVNÍMALÉ:ěščř}}
16618 {{prvnímalé:ěščř}}
16619 {{MALÁ:ěščř}}
16620 {{malá:ěščř}}
16621 {{VELKÁ:ěščř}}
16622 {{velká:ěščř}}
16623 !! html
16624 <p>Ěščř
16625 Ěščř
16626 ěščř
16627 ěščř
16628 ěščř
16629 ěščř
16630 ĚŠČŘ
16631 ĚŠČŘ
16632 </p>
16633 !! end
16634
16635 !! test
16636 Morwen/13: Unclosed link followed by heading
16637 !! wikitext
16638 [[link
16639 ==heading==
16640 !! html
16641 <p>[[link
16642 </p>
16643 <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>
16644
16645 !! end
16646
16647 !! test
16648 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16649 !! wikitext
16650 {{foo|
16651 =heading=
16652 !! html
16653 <p>{{foo|
16654 </p>
16655 <h1><span class="mw-headline" id="heading">heading</span></h1>
16656
16657 !! end
16658
16659 !! test
16660 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16661 !! wikitext
16662 {{foo|
16663 ==heading==
16664 !! html
16665 <p>{{foo|
16666 </p>
16667 <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>
16668
16669 !! end
16670
16671 !! test
16672 Tildes in comments
16673 !! options
16674 pst
16675 !! wikitext
16676 <!-- ~~~~ -->
16677 !! html
16678 <!-- ~~~~ -->
16679 !! end
16680
16681 !! test
16682 Paragraphs inside divs (no extra line breaks)
16683 !! wikitext
16684 <div>Line one
16685
16686 Line two</div>
16687 !! html
16688 <div>Line one
16689 Line two</div>
16690
16691 !! end
16692
16693 !! test
16694 Paragraphs inside divs (extra line break on open)
16695 !! wikitext
16696 <div>
16697 Line one
16698
16699 Line two</div>
16700 !! html
16701 <div>
16702 <p>Line one
16703 </p>
16704 Line two</div>
16705
16706 !! end
16707
16708 !! test
16709 Paragraphs inside divs (extra line break on close)
16710 !! wikitext
16711 <div>Line one
16712
16713 Line two
16714 </div>
16715 !! html
16716 <div>Line one
16717 <p>Line two
16718 </p>
16719 </div>
16720
16721 !! end
16722
16723 !! test
16724 Paragraphs inside divs (extra line break on open and close)
16725 !! wikitext
16726 <div>
16727 Line one
16728
16729 Line two
16730 </div>
16731 !! html
16732 <div>
16733 <p>Line one
16734 </p><p>Line two
16735 </p>
16736 </div>
16737
16738 !! end
16739
16740 !! test
16741 Nesting tags, paragraphs on lines which begin with <div>
16742 !! options
16743 disabled
16744 !! wikitext
16745 <div></div><strong>A
16746 B</strong>
16747 !! html
16748 <div></div>
16749 <p><strong>A
16750 B</strong>
16751 </p>
16752 !! end
16753
16754 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16755 !! test
16756 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16757 !! wikitext
16758 <blockquote>Line one
16759
16760 Line two</blockquote>
16761 !! html
16762 <blockquote>Line one
16763 Line two</blockquote>
16764
16765 !! end
16766
16767 !! test
16768 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16769 !! wikitext
16770 <blockquote>
16771 Line one
16772
16773 Line two</blockquote>
16774 !! html
16775 <blockquote>
16776 <p>Line one
16777 </p>
16778 Line two</blockquote>
16779
16780 !! end
16781
16782 !! test
16783 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16784 !! wikitext
16785 <blockquote>Line one
16786
16787 Line two
16788 </blockquote>
16789 !! html
16790 <blockquote>Line one
16791 <p>Line two
16792 </p>
16793 </blockquote>
16794
16795 !! end
16796
16797 !! test
16798 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16799 !! wikitext
16800 <blockquote>
16801 Line one
16802
16803 Line two
16804 </blockquote>
16805 !! html
16806 <blockquote>
16807 <p>Line one
16808 </p><p>Line two
16809 </p>
16810 </blockquote>
16811
16812 !! end
16813
16814 !! test
16815 Paragraphs inside blockquotes/divs (no extra line breaks)
16816 !! wikitext
16817 <blockquote><div>Line one
16818
16819 Line two</div></blockquote>
16820 !! html
16821 <blockquote><div>Line one
16822 Line two</div></blockquote>
16823
16824 !! end
16825
16826 !! test
16827 Paragraphs inside blockquotes/divs (extra line break on open)
16828 !! wikitext
16829 <blockquote><div>
16830 Line one
16831
16832 Line two</div></blockquote>
16833 !! html
16834 <blockquote><div>
16835 <p>Line one
16836 </p>
16837 Line two</div></blockquote>
16838
16839 !! end
16840
16841 !! test
16842 Paragraphs inside blockquotes/divs (extra line break on close)
16843 !! wikitext
16844 <blockquote><div>Line one
16845
16846 Line two
16847 </div></blockquote>
16848 !! html
16849 <blockquote><div>Line one
16850 <p>Line two
16851 </p>
16852 </div></blockquote>
16853
16854 !! end
16855
16856 !! test
16857 Paragraphs inside blockquotes/divs (extra line break on open and close)
16858 !! wikitext
16859 <blockquote><div>
16860 Line one
16861
16862 Line two
16863 </div></blockquote>
16864 !! html
16865 <blockquote><div>
16866 <p>Line one
16867 </p><p>Line two
16868 </p>
16869 </div></blockquote>
16870
16871 !! end
16872
16873 !! test
16874 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16875 !! options
16876 wgLinkHolderBatchSize=0
16877 !! wikitext
16878 [[meatball:1]]
16879 [[meatball:2]]
16880 [[meatball:3]]
16881 !! html
16882 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16883 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16884 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16885 </p>
16886 !! end
16887
16888 !! test
16889 Free external link invading image caption
16890 !! wikitext
16891 [[Image:Foobar.jpg|thumb|http://x|hello]]
16892 !! html
16893 <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>
16894
16895 !! end
16896
16897 !! test
16898 Bug 15196: localised external link numbers
16899 !! options
16900 language=fa
16901 !! wikitext
16902 [http://en.wikipedia.org/]
16903 !! html/php
16904 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16905 </p>
16906 !! html/parsoid
16907 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16908 !! end
16909
16910 !! test
16911 Multibyte character in padleft
16912 !! wikitext
16913 {{padleft:-Hello|7|Æ}}
16914 !! html
16915 <p>Æ-Hello
16916 </p>
16917 !! end
16918
16919 !! test
16920 Multibyte character in padright
16921 !! wikitext
16922 {{padright:Hello-|7|Æ}}
16923 !! html
16924 <p>Hello-Æ
16925 </p>
16926 !! end
16927
16928 !!test
16929 formatdate parser function
16930 !! wikitext
16931 {{#formatdate:2009-03-24}}
16932 !! html
16933 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16934 </p>
16935 !! end
16936
16937 !!test
16938 formatdate parser function, with default format
16939 !! wikitext
16940 {{#formatdate:2009-03-24|mdy}}
16941 !! html
16942 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16943 </p>
16944 !! end
16945
16946 !! test
16947 Spacing of numbers in formatted dates
16948 !! wikitext
16949 {{#formatdate:January 15}}
16950 !! html
16951 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16952 </p>
16953 !! end
16954
16955 !! test
16956 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
16957 !! options
16958 language=nl title=[[MediaWiki:Common.css]]
16959 !! wikitext
16960 {{#formatdate:2009-03-24|dmy}}
16961 !! html
16962 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16963 </p>
16964 !! end
16965
16966 #
16967 #
16968 #
16969
16970 #
16971 # Edit comments
16972 #
16973
16974 !! test
16975 Edit comment with link
16976 !! options
16977 comment
16978 !! wikitext
16979 I like the [[Main Page]] a lot
16980 !! html
16981 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16982 !!end
16983
16984 !! test
16985 Edit comment with link and link text
16986 !! options
16987 comment
16988 !! wikitext
16989 I like the [[Main Page|best pages]] a lot
16990 !! html
16991 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16992 !!end
16993
16994 !! test
16995 Edit comment with link and link text with suffix
16996 !! options
16997 comment
16998 !! wikitext
16999 I like the [[Main Page|best page]]s a lot
17000 !! html
17001 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17002 !!end
17003
17004 !! test
17005 Edit comment with section link (non-local, eg in history list)
17006 !! options
17007 comment title=[[Main Page]]
17008 !! wikitext
17009 /* External links */ removed bogus entries
17010 !! html
17011 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17012 !!end
17013
17014 !! test
17015 Edit comment with section link and text before it (non-local, eg in history list)
17016 !! options
17017 comment title=[[Main Page]]
17018 !! wikitext
17019 pre-comment text /* External links */ removed bogus entries
17020 !! html
17021 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>
17022 !!end
17023
17024 !! test
17025 Edit comment with section link (local, eg in diff view)
17026 !! options
17027 comment local title=[[Main Page]]
17028 !! wikitext
17029 /* External links */ removed bogus entries
17030 !! html
17031 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17032 !!end
17033
17034 !! test
17035 Edit comment with subpage link (bug 14080)
17036 !! options
17037 comment
17038 subpage
17039 title=[[Subpage test]]
17040 !! wikitext
17041 Poked at a [[/subpage]] here...
17042 !! html
17043 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17044 !!end
17045
17046 !! test
17047 Edit comment with subpage link and link text (bug 14080)
17048 !! options
17049 comment
17050 subpage
17051 title=[[Subpage test]]
17052 !! wikitext
17053 Poked at a [[/subpage|neat little page]] here...
17054 !! html
17055 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17056 !!end
17057
17058 !! test
17059 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17060 !! options
17061 comment
17062 title=[[Subpage test]]
17063 !! wikitext
17064 Poked at a [[/subpage]] here...
17065 !! html
17066 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...
17067 !!end
17068
17069 !! test
17070 Edit comment with bare anchor link (local, as on diff)
17071 !! options
17072 comment
17073 local
17074 title=[[Main Page]]
17075 !! wikitext
17076 [[#section]]
17077 !! html
17078 <a href="#section">#section</a>
17079 !! end
17080
17081 !! test
17082 Edit comment with bare anchor link (non-local, as on history)
17083 !! options
17084 comment
17085 title=[[Main Page]]
17086 !! wikitext
17087 [[#section]]
17088 !! html
17089 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17090 !! end
17091
17092 !! test
17093 Anchor starting with underscore
17094 !! wikitext
17095 [[#_ref|One]]
17096 !! html
17097 <p><a href="#_ref">One</a>
17098 </p>
17099 !! end
17100
17101 !! test
17102 Id starting with underscore
17103 !! wikitext
17104 <div id="_ref"></div>
17105 !! html
17106 <div id="_ref"></div>
17107
17108 !! end
17109
17110 !! test
17111 Space normalisation on autocomment (bug 22784)
17112 !! options
17113 comment
17114 title=[[Main Page]]
17115 !! wikitext
17116 /* __hello__world__ */
17117 !! html
17118 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17119 !! end
17120
17121 !! test
17122 percent-encoding and + signs in comments (Bug 26410)
17123 !! options
17124 comment
17125 !! wikitext
17126 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17127 !! html
17128 <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>
17129 !! end
17130
17131 !! test
17132 Bad images - basic functionality
17133 !! options
17134 disabled
17135 !! wikitext
17136 [[File:Bad.jpg]]
17137 !! html
17138 !! end
17139
17140 !! test
17141 Bad images - bug 16039: text after bad image disappears
17142 !! options
17143 disabled
17144 !! wikitext
17145 Foo bar
17146 [[File:Bad.jpg]]
17147 Bar foo
17148 !! html
17149 <p>Foo bar
17150 </p><p>Bar foo
17151 </p>
17152 !! end
17153
17154 !! test
17155 Verify that displaytitle works (bug #22501) no displaytitle
17156 !! options
17157 showtitle
17158 !! config
17159 wgAllowDisplayTitle=true
17160 wgRestrictDisplayTitle=false
17161 !! wikitext
17162 this is not the the title
17163 !! html
17164 Parser test
17165 <p>this is not the the title
17166 </p>
17167 !! end
17168
17169 !! test
17170 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17171 !! options
17172 showtitle
17173 title=[[Screen]]
17174 !! config
17175 wgAllowDisplayTitle=true
17176 wgRestrictDisplayTitle=false
17177 !! wikitext
17178 this is not the the title
17179 {{DISPLAYTITLE:whatever}}
17180 !! html
17181 whatever
17182 <p>this is not the the title
17183 </p>
17184 !! end
17185
17186 !! test
17187 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17188 !! options
17189 showtitle
17190 title=[[Screen]]
17191 !! config
17192 wgAllowDisplayTitle=true
17193 wgRestrictDisplayTitle=true
17194 !! wikitext
17195 this is not the the title
17196 {{DISPLAYTITLE:whatever}}
17197 !! html
17198 Screen
17199 <p>this is not the the title
17200 </p>
17201 !! end
17202
17203 !! test
17204 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17205 !! options
17206 showtitle
17207 title=[[Screen]]
17208 !! config
17209 wgAllowDisplayTitle=true
17210 wgRestrictDisplayTitle=true
17211 !! wikitext
17212 this is not the the title
17213 {{DISPLAYTITLE:screen}}
17214 !! html
17215 screen
17216 <p>this is not the the title
17217 </p>
17218 !! end
17219
17220 !! test
17221 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17222 !! options
17223 showtitle
17224 title=[[Screen]]
17225 !! config
17226 wgAllowDisplayTitle=false
17227 !! wikitext
17228 this is not the the title
17229 {{DISPLAYTITLE:screen}}
17230 !! html
17231 Screen
17232 <p>this is not the the title
17233 <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>
17234 </p>
17235 !! end
17236
17237 !! test
17238 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17239 !! options
17240 showtitle
17241 title=[[Screen]]
17242 !! config
17243 wgAllowDisplayTitle=false
17244 !! wikitext
17245 this is not the the title
17246 !! html
17247 Screen
17248 <p>this is not the the title
17249 </p>
17250 !! end
17251
17252 !! test
17253 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17254 !! options
17255 showtitle
17256 title=[[Screen]]
17257 !! config
17258 wgAllowDisplayTitle=true
17259 wgRestrictDisplayTitle=true
17260 !! wikitext
17261 this is not the the title
17262 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17263 !! html
17264 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17265 <p>this is not the the title
17266 </p>
17267 !! end
17268
17269 !! test
17270 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17271 !! options
17272 showtitle
17273 title=[[Screen]]
17274 !! config
17275 wgAllowDisplayTitle=true
17276 wgRestrictDisplayTitle=true
17277 !! wikitext
17278 this is not the the title
17279 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17280 !! html
17281 <span style="color: red;">s</span>creen
17282 <p>this is not the the title
17283 </p>
17284 !! end
17285
17286 !! test
17287 preload: check <noinclude> and <includeonly>
17288 !! options
17289 preload
17290 !! wikitext
17291 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17292 !! html
17293 Hello kind world.
17294 !! end
17295
17296 !! test
17297 preload: check <onlyinclude>
17298 !! options
17299 preload
17300 !! wikitext
17301 Goodbye <onlyinclude>Hello world</onlyinclude>
17302 !! html
17303 Hello world
17304 !! end
17305
17306 !! test
17307 preload: can pass tags through if we want to
17308 !! options
17309 preload
17310 !! wikitext
17311 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17312 !! html
17313 <includeonly>Hello world</includeonly>
17314 !! end
17315
17316 !! test
17317 preload: check that it doesn't try to do tricks
17318 !! options
17319 preload
17320 !! wikitext
17321 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17322 !! html
17323 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17324 !! end
17325
17326 !! test
17327 Play a bit with r67090 and bug 3158
17328 !! options
17329 disabled
17330 !! wikitext
17331 <div style="width:50% !important">&nbsp;</div>
17332 <div style="width:50%&nbsp;!important">&nbsp;</div>
17333 <div style="width:50%&#160;!important">&nbsp;</div>
17334 <div style="border : solid;">&nbsp;</div>
17335 !! html
17336 <div style="width:50% !important">&nbsp;</div>
17337 <div style="width:50% !important">&nbsp;</div>
17338 <div style="width:50% !important">&nbsp;</div>
17339 <div style="border&#160;: solid;">&nbsp;</div>
17340
17341 !! end
17342
17343 !! test
17344 HTML5 data attributes
17345 !! wikitext
17346 <span data-foo="bar">Baz</span>
17347 <p data-abc-def_hij="">Quuz</p>
17348 !! html
17349 <p><span data-foo="bar">Baz</span>
17350 </p>
17351 <p data-abc-def_hij="">Quuz</p>
17352
17353 !! end
17354
17355 !! test
17356 percent-encoding and + signs in internal links (Bug 26410)
17357 !! wikitext
17358 [[User:+%]] [[Page+title%]]
17359 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17360 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17361 [[%33%45]] [[%33%45+]]
17362 !! html
17363 <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>
17364 <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>
17365 <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>
17366 <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>
17367 </p>
17368 !! end
17369
17370 !! test
17371 Special characters in embedded file links (bug 27679)
17372 !! wikitext
17373 [[File:Contains & ampersand.jpg]]
17374 [[File:Does not exist.jpg|Title with & ampersand]]
17375 !! html
17376 <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>
17377 <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>
17378 </p>
17379 !! end
17380
17381
17382 !! test
17383 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17384 !! wikitext
17385 Text&apos;s been normalized?
17386 !! html
17387 <p>Text&#39;s been normalized?
17388 </p>
17389 !! end
17390
17391 !! test
17392 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17393 !! wikitext
17394 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17395 !! html
17396 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17397 </p>
17398 !! end
17399
17400 !! test
17401 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17402 !! wikitext
17403 [http://www.example.org/ ideograms]
17404 !! html
17405 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17406 </p>
17407 !! end
17408
17409 !! test
17410 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17411 !! wikitext
17412 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17413 !! html
17414 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17415 </p>
17416 !! end
17417
17418 !! article
17419 Mediawiki:loop1
17420 !! text
17421 {{Identical|A}}
17422 !! endarticle
17423
17424 !! article
17425 Mediawiki:loop2
17426 !! text
17427 {{Identical|B}}
17428 !! endarticle
17429
17430 !! article
17431 Template:Identical
17432 !! text
17433 {{int:loop1}}
17434 {{int:loop2}}
17435 !! endarticle
17436
17437 !! test
17438 Bug 31098 Template which includes system messages which includes the template
17439 !! wikitext
17440 {{Identical}}
17441 !! html
17442 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17443 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17444 </p>
17445 !! end
17446
17447 !! test
17448 Bug31490 Turkish: ucfirst 'blah'
17449 !! options
17450 language=tr
17451 !! wikitext
17452 {{ucfirst:blah}}
17453 !! html
17454 <p>Blah
17455 </p>
17456 !! end
17457
17458 !! test
17459 Bug31490 Turkish: ucfirst 'ix'
17460 !! options
17461 language=tr
17462 !! wikitext
17463 {{ucfirst:ix}}
17464 !! html
17465 <p>İx
17466 </p>
17467 !! end
17468
17469 !! test
17470 Bug31490 Turkish: lcfirst 'BLAH'
17471 !! options
17472 language=tr
17473 !! wikitext
17474 {{lcfirst:BLAH}}
17475 !! html
17476 <p>bLAH
17477 </p>
17478 !! end
17479
17480 !! test
17481 Bug31490 Turkish: ucfırst (with a dotless i)
17482 !! options
17483 language=tr
17484 !! wikitext
17485 {{ucfırst:blah}}
17486 !! html
17487 <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>
17488 </p>
17489 !! end
17490
17491 !! test
17492 Bug31490 ucfırst (with a dotless i) with English language
17493 !! options
17494 language=en
17495 !! wikitext
17496 {{ucfırst:blah}}
17497 !! html
17498 <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>
17499 </p>
17500 !! end
17501
17502 !! test
17503 Bug 26375: TOC with italics
17504 !! options
17505 title=[[Main Page]]
17506 !! wikitext
17507 __TOC__
17508 == ''Lost'' episodes ==
17509 !! html
17510 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17511 <ul>
17512 <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>
17513 </ul>
17514 </div>
17515
17516 <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>
17517
17518 !! end
17519
17520 !! test
17521 Bug 26375: TOC with bold
17522 !! options
17523 title=[[Main Page]]
17524 !! wikitext
17525 __TOC__
17526 == '''should be bold''' then normal text ==
17527 !! html
17528 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17529 <ul>
17530 <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>
17531 </ul>
17532 </div>
17533
17534 <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>
17535
17536 !! end
17537
17538 !! test
17539 Bug 33845: Headings become cursive in TOC when they contain an image
17540 !! options
17541 title=[[Main Page]]
17542 !! wikitext
17543 __TOC__
17544 == Image [[Image:foobar.jpg]] ==
17545 !! html
17546 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17547 <ul>
17548 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17549 </ul>
17550 </div>
17551
17552 <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>
17553
17554 !! end
17555
17556 !! test
17557 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17558 !! options
17559 title=[[Main Page]]
17560 !! wikitext
17561 __TOC__
17562 == <blockquote>Quote</blockquote> ==
17563 !! html
17564 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17565 <ul>
17566 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17567 </ul>
17568 </div>
17569
17570 <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>
17571
17572 !! end
17573
17574 !! test
17575 Unclosed tags in TOC
17576 !! options
17577 title=[[Main Page]]
17578 !! wikitext
17579 __TOC__
17580 == Proof: 2 < 3 ==
17581 <small>Hanc marginis exiguitas non caperet.</small>
17582 QED
17583 !! html
17584 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17585 <ul>
17586 <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>
17587 </ul>
17588 </div>
17589
17590 <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>
17591 <p><small>Hanc marginis exiguitas non caperet.</small>
17592 QED
17593 </p>
17594 !! end
17595
17596 !! test
17597 Multiple tags in TOC
17598 !! wikitext
17599 __TOC__
17600 == <i>Foo</i> <b>Bar</b> ==
17601
17602 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17603 !! html
17604 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17605 <ul>
17606 <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>
17607 <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>
17608 </ul>
17609 </div>
17610
17611 <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>
17612 <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>
17613
17614 !! end
17615
17616 !! test
17617 Tags with parameters in TOC
17618 !! wikitext
17619 __TOC__
17620 == <sup class="in-h2">Hello</sup> ==
17621
17622 == <sup class="a > b">Evilbye</sup> ==
17623 !! html
17624 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17625 <ul>
17626 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17627 <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>
17628 </ul>
17629 </div>
17630
17631 <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>
17632 <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>
17633
17634 !! end
17635
17636 !! test
17637 span tags with directionality in TOC
17638 !! wikitext
17639 __TOC__
17640 == <span dir="ltr">C++</span> ==
17641
17642 == <span dir="rtl">זבנג!</span> ==
17643
17644 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17645
17646 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17647
17648 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17649 !! html
17650 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17651 <ul>
17652 <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>
17653 <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>
17654 <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>
17655 <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>
17656 <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>
17657 </ul>
17658 </div>
17659
17660 <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>
17661 <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>
17662 <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>
17663 <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>
17664 <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>
17665
17666 !! end
17667
17668 !! article
17669 MediaWiki:Bug32057
17670 !! text
17671 == {{int:headline_sample}} ==
17672 !! endarticle
17673
17674 !! test
17675 Bug 32057: Title needed when expanding <h> nodes.
17676 !! options
17677 title=[[Main Page]]
17678 !! wikitext
17679 {{int:Bug32057}}
17680 !! html
17681 <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>
17682
17683 !! end
17684
17685 !! test
17686 Strip marker in urlencode
17687 !! wikitext
17688 {{urlencode:x<nowiki/>y}}
17689 {{urlencode:x<nowiki/>y|wiki}}
17690 {{urlencode:x<nowiki/>y|path}}
17691 !! html
17692 <p>xy
17693 xy
17694 xy
17695 </p>
17696 !! end
17697
17698 !! test
17699 Strip marker in lc
17700 !! wikitext
17701 {{lc:x<nowiki/>y}}
17702 !! html
17703 <p>xy
17704 </p>
17705 !! end
17706
17707 !! test
17708 Strip marker in uc
17709 !! wikitext
17710 {{uc:x<nowiki/>y}}
17711 !! html
17712 <p>XY
17713 </p>
17714 !! end
17715
17716 !! test
17717 Strip marker in formatNum
17718 !! wikitext
17719 {{formatnum:1<nowiki/>2}}
17720 {{formatnum:1<nowiki/>2|R}}
17721 !! html
17722 <p>12
17723 12
17724 </p>
17725 !! end
17726
17727 !! test
17728 Check noCommafy in formatNum
17729 !! options
17730 language=be-tarask
17731 !! wikitext
17732 {{formatnum:123456.78}}
17733 {{formatnum:123456.78|NOSEP}}
17734 !! html
17735 <p>123 456,78
17736 123456.78
17737 </p>
17738 !! end
17739
17740 !! test
17741 Wrong option for formatNum (bug 56199)
17742 !! wikitext
17743 {{formatnum:1,234.56|Random}}
17744 {{formatnum:1,234.56|EVERYTHING}}
17745 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17746 !! html
17747 <p>1,234.56
17748 1,234.56
17749 1,234.56
17750 </p>
17751 !! end
17752
17753 !! test
17754 Strip marker in grammar
17755 !! options
17756 language=fi
17757 !! wikitext
17758 {{grammar:elative|foo<nowiki/>bar}}
17759 !! html
17760 <p>foobarista
17761 </p>
17762 !! end
17763
17764 !! test
17765 Strip marker in padleft
17766 !! wikitext
17767 {{padleft:|2|x<nowiki/>y}}
17768 !! html
17769 <p>xy
17770 </p>
17771 !! end
17772
17773 !! test
17774 Strip marker in padright
17775 !! wikitext
17776 {{padright:|2|x<nowiki/>y}}
17777 !! html
17778 <p>xy
17779 </p>
17780 !! end
17781
17782 !! test
17783 Strip marker in anchorencode
17784 !! wikitext
17785 {{anchorencode:x<nowiki/>y}}
17786 !! html
17787 <p>xy
17788 </p>
17789 !! end
17790
17791 !! test
17792 nowiki inside link inside heading (bug 18295)
17793 !! wikitext
17794 ==[[foo|x<nowiki>y</nowiki>z]]==
17795 !! html
17796 <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>
17797
17798 !! end
17799
17800 !! test
17801 new support for bdi element (bug 31817)
17802 !! wikitext
17803 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17804 !! html
17805 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17806
17807 !!end
17808
17809 !! test
17810 Ignore pipe between table row attributes
17811 !! wikitext
17812 {|
17813 | quux
17814 |- id=foo | style='color: red'
17815 | bar
17816 |}
17817 !! html
17818 <table>
17819 <tr>
17820 <td> quux
17821 </td></tr>
17822 <tr id="foo" style="color: red">
17823 <td> bar
17824 </td></tr></table>
17825
17826 !! end
17827
17828 !!test
17829 Gallery override link with WikiLink (bug 34852)
17830 !! wikitext
17831 <gallery>
17832 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17833 </gallery>
17834 !! html
17835 <ul class="gallery mw-gallery-traditional">
17836 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17837 <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>
17838 <div class="gallerytext">
17839 <p>caption
17840 </p>
17841 </div>
17842 </div></li>
17843 </ul>
17844
17845 !! end
17846
17847 !!test
17848 Gallery override link with absolute external link (bug 34852)
17849 !! wikitext
17850 <gallery>
17851 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17852 </gallery>
17853 !! html
17854 <ul class="gallery mw-gallery-traditional">
17855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17856 <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>
17857 <div class="gallerytext">
17858 <p>caption
17859 </p>
17860 </div>
17861 </div></li>
17862 </ul>
17863
17864 !! end
17865
17866 !!test
17867 Gallery override link with malicious javascript (bug 34852)
17868 !! wikitext
17869 <gallery>
17870 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17871 </gallery>
17872 !! html
17873 <ul class="gallery mw-gallery-traditional">
17874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17875 <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>
17876 <div class="gallerytext">
17877 <p>caption
17878 </p>
17879 </div>
17880 </div></li>
17881 </ul>
17882
17883 !! end
17884
17885 !!test
17886 Gallery with invalid title as link (bug 43964)
17887 !! wikitext
17888 <gallery>
17889 File:foobar.jpg|link=<
17890 </gallery>
17891 !! html
17892 <ul class="gallery mw-gallery-traditional">
17893 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17894 <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>
17895 <div class="gallerytext">
17896 </div>
17897 </div></li>
17898 </ul>
17899
17900 !! end
17901
17902 !!test
17903 Language parser function
17904 !! wikitext
17905 {{#language:ar}}
17906 !! html
17907 <p>العربية
17908 </p>
17909 !! end
17910
17911 !!test
17912 Padleft and padright as substr
17913 !! wikitext
17914 {{padleft:|3|abcde}}
17915 {{padright:|3|abcde}}
17916 !! html
17917 <p>abc
17918 abc
17919 </p>
17920 !! end
17921
17922 !!test
17923 Special parser function
17924 !! wikitext
17925 {{#special:RandomPage}}
17926 {{#special:BaDtItLe}}
17927 {{#special:Foobar}}
17928 !! html
17929 <p>Special:Random
17930 Special:Badtitle
17931 Special:Foobar
17932 </p>
17933 !! end
17934
17935 !!test
17936 Bug 34939 - Case insensitive link parsing ([HttP://])
17937 !! wikitext
17938 [HttP://MediaWiki.Org/]
17939 !! html/php
17940 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17941 </p>
17942 !! html/parsoid
17943 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17944 !! end
17945
17946 !!test
17947 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17948 !! wikitext
17949 [HttP://MediaWiki.Org/ MediaWiki]
17950 !! html
17951 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17952 </p>
17953 !! end
17954
17955 !!test
17956 Bug 34939 - Case insensitive link parsing (HttP://)
17957 !! wikitext
17958 HttP://MediaWiki.Org/
17959 !! html/php
17960 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17961 </p>
17962 !! html/parsoid
17963 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17964 !! end
17965
17966 !!test
17967 Disable TOC
17968 !! options
17969 notoc
17970 !! wikitext
17971 Lead
17972 == Section 1 ==
17973 == Section 2 ==
17974 == Section 3 ==
17975 == Section 4 ==
17976 == Section 5 ==
17977 !! html
17978 <p>Lead
17979 </p>
17980
17981 <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>
17982 <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>
17983 <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>
17984 <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>
17985 <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>
17986
17987 !! end
17988
17989
17990 ###
17991 ### Parsoid-specific tests
17992 ### Parsoid-PHP parser incompatibilities
17993 ###
17994 !!test
17995 1. SOL-sensitive wikitext tokens as template-args
17996 !!options
17997 parsoid=wt2html,wt2wt
17998 !! wikitext
17999 {{echo|*a}}
18000 {{echo|#a}}
18001 {{echo|:a}}
18002 !! html
18003 <span about="#mwt1" typeof="mw:Transclusion">
18004 </span><ul about="#mwt1"><li>a</li>
18005 </ul>
18006 <span about="#mwt2" typeof="mw:Transclusion">
18007 </span><ol about="#mwt2"><li>a</li>
18008 </ol>
18009 <span about="#mwt3" typeof="mw:Transclusion">
18010 </span><dl about="#mwt3"><dd>a</dd>
18011 </dl>
18012 !!end
18013
18014 #### -----------------------------------------------------------------
18015 #### Parsoid-specific functionality tests
18016 #### -----------------------------------------------------------------
18017
18018 # Bug 63642: Formatting elt fixup is cleaned up.
18019 # We know wt2wt will fail, but we expect selser to pass.
18020 # Due to the nature of our testing, wt2wt and selser tests will enter the
18021 # blacklist and we'll catch selser regressions based on changes to the
18022 # blacklist entries for selser tests.
18023 !! test
18024 Bad treebuilder fixup of formatting elt is cleaned up
18025 !! options
18026 parsoid=wt2html,wt2wt
18027 !! wikitext
18028 {|
18029 |
18030 <small>
18031 [[Image:Foobar.jpg|right|Test]]
18032 </small>
18033 |}
18034 !! html/parsoid
18035 <table>
18036 <tbody><tr><td>
18037 <p><small></small></p>
18038 <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>
18039 <p></p></td></tr>
18040 </tbody></table>
18041 !! end
18042
18043 #### ----------------------------------------------------------------
18044 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18045 #### tags. Parsoid's output for these tags differs from that of the
18046 #### PHP parser.
18047 #### ----------------------------------------------------------------
18048
18049 !!test
18050 Ref: 1. ref-location should be replaced with an index span
18051 !!options
18052 parsoid
18053 !! wikitext
18054 A <ref>foo</ref>
18055 B <ref name="x">foo</ref>
18056 C <ref name="y" />
18057 !! html
18058 <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>
18059 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>
18060 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>
18061 !!end
18062
18063 !!test
18064 Ref: 2. ref-tags with identical names should all get the same index
18065 !!options
18066 parsoid
18067 !! wikitext
18068 A <ref name="x">foo</ref>
18069 B <ref name="x" />
18070 !! html
18071 <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>
18072 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>
18073 !!end
18074
18075 !!test
18076 Ref: 3. spaces in ref-names should be ignored
18077 !!options
18078 parsoid
18079 !! wikitext
18080 A <ref name="x">foo</ref>
18081 B <ref name=" x " />
18082 C <ref name= x />
18083 !! html
18084 <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>
18085 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>
18086 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>
18087 !!end
18088
18089 !!test
18090 Ref: 4. 'constructor' should be accepted as a valid ref-name
18091 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18092 !!options
18093 parsoid
18094 !! wikitext
18095 A <ref name="constructor">foo</ref>
18096 !! html
18097 <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>
18098 !!end
18099
18100 !!test
18101 Ref: 5. body should accept generic wikitext
18102 !!options
18103 parsoid
18104 !! wikitext
18105 A <ref>
18106 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18107 </ref>
18108
18109 <references />
18110 !! html
18111 <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>
18112
18113 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18114 <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>
18115 </li>
18116 </ol>
18117 !!end
18118
18119 !!test
18120 Ref: 6. indent-pres should not be output in ref-body
18121 !!options
18122 parsoid
18123 !! wikitext
18124 A <ref>
18125 foo
18126 bar
18127 baz
18128 </ref>
18129
18130 <references />
18131 !! html
18132 <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>
18133
18134 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18135 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18136 bar
18137 baz
18138 </li>
18139 </ol>
18140 !!end
18141
18142 !!test
18143 Ref: 7. No p-wrapping in ref-body
18144 !!options
18145 parsoid
18146 !! wikitext
18147 A <ref>
18148 foo
18149
18150 bar
18151
18152
18153 baz
18154
18155
18156
18157 booz
18158 </ref>
18159
18160 <references />
18161 !! html
18162 <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>
18163
18164 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18165 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18166
18167 bar
18168
18169
18170 baz
18171
18172
18173
18174 booz
18175 </li>
18176 </ol>
18177 !!end
18178
18179 !!test
18180 Ref: 8. transclusion wikitext has lower precedence
18181 !!options
18182 parsoid
18183 !! wikitext
18184 A <ref> foo {{echo|</ref> B C}}
18185
18186 <references />
18187 !! html
18188 <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>
18189 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18190 <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>
18191 </ol>
18192 !!end
18193
18194 !!test
18195 Ref: 9. unclosed comments should not leak out of ref-body
18196 !!options
18197 parsoid
18198 !! wikitext
18199 A <ref> foo <!--</ref> B C
18200 <references />
18201 !! html
18202 <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>
18203 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18204 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18205 </ol>
18206 !!end
18207
18208 !!test
18209 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18210 !!options
18211 parsoid
18212 !! wikitext
18213 A <ref> <b> foo </ref> B C
18214
18215 <references />
18216 !! html
18217 <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>
18218
18219
18220 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18221 <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>
18222 </ol>
18223 !!end
18224
18225 !!test
18226 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18227 !!options
18228 parsoid
18229 !! wikitext
18230 A <ref>foo</ref> B
18231 C <ref>bar</ref> D
18232 !! html
18233 <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
18234 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>
18235 !!end
18236
18237 !!test
18238 Ref: 12. ref-tags act as trailing newline migration barrier
18239 !!options
18240 parsoid
18241 !! wikitext
18242 <!--the newline at the end of this line moves out of the p-tag-->a
18243
18244 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18245 <ref />
18246
18247 c
18248 !! html
18249 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18250
18251
18252 <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>
18253 <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>
18254
18255
18256 <p>c</p>
18257 !!end
18258
18259 !!test
18260 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18261 !!options
18262 parsoid
18263 !! wikitext
18264 <ref>foo</ref> A
18265 <ref>bar
18266 </ref> B
18267 !! html
18268 <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
18269 <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>
18270 !!end
18271
18272 !!test
18273 Ref: 14. A nested ref-tag should be emitted as plain text
18274 !!options
18275 parsoid
18276 !! wikitext
18277 <ref>foo <ref>bar</ref> baz</ref>
18278
18279 <references />
18280 !! html
18281 <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>
18282
18283 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18284 <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>
18285 </ol>
18286 !!end
18287
18288 !!test
18289 Ref: 15. ref-tags with identical names should get identical indexes
18290 !!options
18291 parsoid
18292 !! wikitext
18293 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18294 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18295
18296 <references />
18297 !! html
18298 <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>
18299 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>
18300
18301 <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>
18302 </ol>
18303 !!end
18304
18305 ## We don't bother wt2wt-ing non-standard whitespace
18306 !!test
18307 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18308 !!options
18309 parsoid=wt2html
18310 !! wikitext
18311 A <ref >foo</ref >
18312
18313 <references />
18314 !! html
18315 <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>
18316
18317 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18318 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18319 !!end
18320
18321 !!test
18322 References: 1. references tag without any refs should be handled properly
18323 !!options
18324 parsoid
18325 !! wikitext
18326 <references />
18327 !! html
18328 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18329 !!end
18330
18331 !!test
18332 References: 2. references tag with group only outputs references from that group
18333 !!options
18334 parsoid
18335 !! wikitext
18336 A <ref group="a">foo</ref>
18337 B <ref group="b">bar</ref>
18338
18339 <references group="a" />
18340 !! html
18341 <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>
18342 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>
18343
18344 <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>
18345 </ol>
18346 !!end
18347
18348 !!test
18349 References: 3. ref list should be cleared after processing references
18350 !!options
18351 parsoid
18352 !! wikitext
18353 A <ref>foo</ref>
18354
18355 <references />
18356
18357 B <ref>bar</ref>
18358
18359 <references />
18360 !! html
18361 <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>
18362
18363 <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>
18364 </ol>
18365
18366 <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>
18367
18368 <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>
18369 </ol>
18370 !!end
18371
18372 !!test
18373 References: 4. only referenced group should be cleared after processing references
18374 !!options
18375 parsoid
18376 !! wikitext
18377 A <ref group="a">afoo</ref>
18378 B <ref>bfoo</ref>
18379
18380 <references group="a" />
18381
18382 C <ref>cfoo</ref>
18383
18384 <references />
18385 !! html
18386 <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>
18387 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>
18388
18389 <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>
18390 </ol>
18391
18392 <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>
18393
18394 <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>
18395 </ol>
18396 !!end
18397
18398 !!test
18399 References: 5. ref tags in references should be processed while ignoring all other content
18400 !!options
18401 parsoid
18402 !! wikitext
18403 A <ref name="a" />
18404 B <ref name="b">bar</ref>
18405
18406 <references>
18407 <ref name="a">foo</ref>
18408 This should just get lost.
18409 </references>
18410 !! html
18411 <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>
18412 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>
18413
18414
18415 <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":{}}'>
18416 <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>
18417 <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>
18418 </ol>
18419 !!end
18420
18421 !!test
18422 References: 6. <references /> from a transclusion
18423 !!options
18424 parsoid
18425 !! wikitext
18426 <ref>Foo</ref> {{echo|<references />}}
18427 !! html
18428 <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>
18429 !!end
18430
18431 !! test
18432 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18433 !! options
18434 parsoid
18435 !! wikitext
18436 A <ref>foo bar for a</ref>
18437 B <ref group="X" name="b" />
18438
18439 <references />
18440
18441 <references group="X">
18442 <ref name="b">foo</ref>
18443 </references>
18444 !! html
18445 <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>
18446 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>
18447
18448 <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>
18449
18450 <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>
18451 !! end
18452
18453 !! test
18454 Entities in ref name
18455 !! options
18456 parsoid
18457 !! wikitext
18458 <ref name="test &amp; me">hi</ref>
18459 !! html
18460 <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>
18461 !! end
18462
18463 # This test is wt2html only because we're permitting the serializer to produce
18464 # dirty diffs, normalizing the unclosed references to the self-closed version.
18465 !! test
18466 Generate references for unclosed references tag
18467 !! options
18468 parsoid=wt2html
18469 !! wikitext
18470 a<ref>foo</ref>
18471
18472 <references>
18473 !! html
18474 <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>
18475
18476
18477 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18478 <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>
18479 !! end
18480
18481 !! test
18482 New reference serializes on its own line
18483 !! options
18484 parsoid=wt2wt,html2wt
18485 !! wikitext
18486 foo
18487 <references />
18488 !! html
18489 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18490 !! end
18491
18492 #### ----------------------------------------------------------------
18493 #### The following section of tests are primarily to test
18494 #### wikitext escaping capabilities of Parsoid. Given that
18495 #### escaping can be done any number of ways, the wikitext (input)
18496 #### is always adjusted to reflect how Parsoid adds nowiki
18497 #### escape tags.
18498 ####
18499 #### We are marking several tests as parsoid-only since the
18500 #### HTML in the result section is different from what the
18501 #### PHP parser generates for it.
18502 #### ----------------------------------------------------------------
18503
18504
18505 #### --------------- Headings ---------------
18506 #### 0. Unnested
18507 #### 1. Nested inside html <h1>=foo=</h1>
18508 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18509 #### 3. Nested inside html with wikitext split by html tags
18510 #### 4. No escape needed
18511 #### 5. Empty headings <h1></h1>
18512 #### 6. Heading chars in SOL context
18513 #### ----------------------------------------
18514 !! test
18515 Headings: 0. Unnested
18516 !! options
18517 parsoid
18518 !! wikitext
18519 <nowiki>=foo=</nowiki>
18520
18521 <nowiki> =foo= </nowiki>
18522 <!--cmt-->
18523 <nowiki>=foo=</nowiki>
18524
18525 =foo''a''<nowiki>=</nowiki>
18526 !! html
18527 <p><span typeof="mw:Nowiki">=foo=</span></p>
18528
18529 <p><span typeof="mw:Nowiki"> =foo= </span>
18530 <!--cmt-->
18531 <span typeof="mw:Nowiki">=foo=</span></p>
18532
18533 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18534 !!end
18535
18536 !! test
18537 Headings: 1. Nested inside html
18538 (New headings and existing headings are handled differently)
18539 !! options
18540 parsoid=html2wt
18541 !! wikitext
18542 = =foo= =
18543
18544 == =foo= ==
18545
18546 === =foo= ===
18547
18548 =<nowiki>=foo=</nowiki>=
18549 ==<nowiki>=foo=</nowiki>==
18550 ===<nowiki>=foo=</nowiki>===
18551 ====<nowiki>=foo=</nowiki>====
18552 =====<nowiki>=foo=</nowiki>=====
18553 ======<nowiki>=foo=</nowiki>======
18554
18555 !! html
18556 <h1>=foo=</h1>
18557 <h2>=foo=</h2>
18558 <h3>=foo=</h3>
18559
18560 <h1 data-parsoid='{}'>=foo=</h1>
18561 <h2 data-parsoid='{}'>=foo=</h2>
18562 <h3 data-parsoid='{}'>=foo=</h3>
18563 <h4 data-parsoid='{}'>=foo=</h4>
18564 <h5 data-parsoid='{}'>=foo=</h5>
18565 <h6 data-parsoid='{}'>=foo=</h6>
18566 !!end
18567
18568 !! test
18569 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18570 !! options
18571 parsoid=html2wt
18572 !! wikitext
18573 = foo =
18574 <nowiki>*</nowiki>bar
18575
18576 = foo =
18577 =bar
18578
18579 = foo =
18580 <nowiki>=bar=</nowiki>
18581 !! html
18582 <h1>foo</h1>*bar
18583 <h1>foo</h1>=bar
18584 <h1>foo</h1>=bar=
18585 !!end
18586
18587 !! test
18588 Headings: 3. Nested inside html with wikitext split by html tags
18589 !! options
18590 parsoid=html2wt
18591 !! wikitext
18592 = ='''bold'''<nowiki>foo=</nowiki> =
18593 !! html
18594 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18595 !!end
18596
18597 !! test
18598 Headings: 4a. No escaping needed (testing just h1 and h2)
18599 !! options
18600 parsoid=html2wt
18601 !! wikitext
18602 = =foo =
18603
18604 = foo= =
18605
18606 = =foo= =
18607
18608 = =foo= bar =
18609
18610 == =foo ==
18611
18612 == foo= ==
18613
18614 = ''=''foo= =
18615
18616 = <nowiki>=</nowiki> =
18617 !! html
18618 <h1>=foo</h1>
18619 <h1>foo=</h1>
18620 <h1> =foo= </h1>
18621 <h1>=foo= bar</h1>
18622 <h2>=foo</h2>
18623 <h2>foo=</h2>
18624 <h1><i>=</i>foo=</h1>
18625 <h1><span typeof="mw:Nowiki">=</span></h1>
18626 !!end
18627
18628 !! test
18629 Headings: 4b. No escaping needed (inside p-tags)
18630 !! options
18631 parsoid=html2wt
18632 !! wikitext
18633 ===
18634 =foo= x
18635 =foo= <s></s>
18636 !! html
18637 <p>===
18638 =foo= x
18639 =foo= <s></s>
18640 </p>
18641 !!end
18642
18643 !! test
18644 Headings: 5. Empty headings
18645 !! options
18646 parsoid
18647 !! wikitext
18648 =<nowiki/>=
18649
18650 ==<nowiki/>==
18651
18652 ===<nowiki/>===
18653
18654 ====<nowiki/>====
18655
18656 =====<nowiki/>=====
18657
18658 ======<nowiki/>======
18659 !! html
18660 <h1></h1>
18661 <h2></h2>
18662 <h3></h3>
18663 <h4></h4>
18664 <h5></h5>
18665 <h6></h6>
18666 !!end
18667
18668 !! test
18669 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18670 !! options
18671 parsoid
18672 !! wikitext
18673 <nowiki>=a=</nowiki>
18674
18675 <nowiki>=a=</nowiki>
18676
18677 <nowiki>=a=</nowiki>
18678
18679 <nowiki>=a=</nowiki>
18680 !! html
18681 <p>=a=</p>
18682 <p>=a= </p>
18683 <p>=a= </p>
18684 <p>=a= </p>
18685 !!end
18686
18687 !! test
18688 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18689 !! options
18690 parsoid
18691 !! wikitext
18692 <nowiki>=a=
18693 b</nowiki>
18694
18695 <nowiki>=a=
18696 b</nowiki>
18697
18698 <nowiki>=a=
18699 b</nowiki>
18700
18701 <nowiki>=a=
18702 b</nowiki>
18703 !! html
18704 <p>=a=
18705 b</p>
18706 <p>=a=
18707 b</p>
18708 <p>=a=
18709 b</p>
18710 <p>=a=
18711 b</p>
18712 </p>
18713 !!end
18714
18715 !! test
18716 Headings: 6c. Heading chars in SOL context (leading newline break)
18717 !! options
18718 parsoid
18719 !! wikitext
18720 a
18721 <nowiki>=b=</nowiki>
18722 !! html
18723 <p>a
18724 =b=</p>
18725 !!end
18726
18727 !! test
18728 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18729 !! options
18730 parsoid
18731 !! wikitext
18732 <!--c0--><nowiki>=a=</nowiki>
18733
18734 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18735 !! html
18736 <p><!--c0-->=a=</p>
18737 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18738 !!end
18739
18740 !! test
18741 Headings: 6d. Heading chars in SOL context (No escaping needed)
18742 !! options
18743 parsoid=html2wt
18744 !! wikitext
18745 =a=<div>b</div>
18746 !! html
18747 =a=<div>b</div>
18748 !!end
18749
18750 #### --------------- Lists ---------------
18751 #### 0. Outside nests (*foo, etc.)
18752 #### 1. Nested inside html <ul><li>*foo</li></ul>
18753 #### 2. Inside definition lists
18754 #### 3. Only bullets at start should be escaped
18755 #### 4. No escapes needed
18756 #### 5. No unnecessary escapes
18757 #### 6. Escape bullets in SOL position
18758 #### 7. Escape bullets in a multi-line context
18759 #### ----------------------------------------
18760
18761 !! test
18762 Lists: 0. Outside nests
18763 !! wikitext
18764 <nowiki>*</nowiki>foo
18765
18766 <nowiki>#</nowiki>foo
18767
18768 <nowiki>;Foo:</nowiki>bar
18769 !! html
18770 <p>*foo
18771 </p><p>#foo
18772 </p><p>;Foo:bar
18773 </p>
18774 !!end
18775
18776 !! test
18777 Lists: 1. Nested inside html
18778 !! wikitext
18779 *<nowiki>*foo</nowiki>
18780
18781 *<nowiki>#foo</nowiki>
18782
18783 *<nowiki>:foo</nowiki>
18784
18785 *<nowiki>;foo</nowiki>
18786
18787 #<nowiki>*foo</nowiki>
18788
18789 #<nowiki>#foo</nowiki>
18790
18791 #<nowiki>:foo</nowiki>
18792
18793 #<nowiki>;foo</nowiki>
18794 !! html
18795 <ul><li>*foo</li></ul>
18796 <ul><li>#foo</li></ul>
18797 <ul><li>:foo</li></ul>
18798 <ul><li>;foo</li></ul>
18799 <ol><li>*foo</li></ol>
18800 <ol><li>#foo</li></ol>
18801 <ol><li>:foo</li></ol>
18802 <ol><li>;foo</li></ol>
18803
18804 !!end
18805
18806 !! test
18807 Lists: 2. Inside definition lists
18808 !! wikitext
18809 ;<nowiki>;foo</nowiki>
18810
18811 ;<nowiki>:foo</nowiki>
18812
18813 ;<nowiki>:foo</nowiki>
18814 :bar
18815
18816 :<nowiki>:foo</nowiki>
18817 !! html
18818 <dl><dt>;foo</dt></dl>
18819 <dl><dt>:foo</dt></dl>
18820 <dl><dt>:foo</dt>
18821 <dd>bar</dd></dl>
18822 <dl><dd>:foo</dd></dl>
18823
18824 !!end
18825
18826 !! test
18827 Lists: 3. Only bullets at start of text should be escaped
18828 !! wikitext
18829 *<nowiki>*foo*bar</nowiki>
18830
18831 *<nowiki>*foo</nowiki>''it''*bar
18832 !! html
18833 <ul><li>*foo*bar</li></ul>
18834 <ul><li>*foo<i>it</i>*bar</li></ul>
18835
18836 !!end
18837
18838 !! test
18839 Lists: 4. No escapes needed
18840 !! options
18841 parsoid
18842 !! wikitext
18843 *foo*bar
18844
18845 *''foo''*bar
18846
18847 *[[Foo]]: bar
18848
18849 *[[Foo]]*bar
18850 !! html
18851 <ul>
18852 <li>foo*bar
18853 </li>
18854 </ul>
18855 <ul>
18856 <li><i>foo</i>*bar
18857 </li>
18858 </ul>
18859 <ul>
18860 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18861 </li>
18862 </ul>
18863 <ul>
18864 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18865 </li>
18866 </ul>
18867 !!end
18868
18869 !! test
18870 Lists: 5. No unnecessary escapes
18871 !! wikitext
18872 * bar <span><nowiki>[[foo]]</nowiki></span>
18873
18874 *=bar <span><nowiki>[[foo]]</nowiki></span>
18875
18876 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18877
18878 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18879
18880 *=bar <span>foo]]</span>=
18881
18882 * <s></s>: a
18883 !! html
18884 <ul><li> bar <span>[[foo]]</span></li></ul>
18885 <ul><li>=bar <span>[[foo]]</span></li></ul>
18886 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18887 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18888 <ul><li>=bar <span>foo]]</span>=</li></ul>
18889 <ul><li> <s></s>: a</li></ul>
18890
18891 !!end
18892
18893 !! test
18894 Lists: 6. Escape bullets in SOL position
18895 !! options
18896 parsoid
18897 !! wikitext
18898 <!--cmt--><nowiki>*foo</nowiki>
18899 !! html
18900 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18901 !!end
18902
18903 !! test
18904 Lists: 7. Escape bullets in a multi-line context
18905 !! wikitext
18906 a
18907 <nowiki>*</nowiki>b
18908 !! html
18909 <p>a
18910 *b
18911 </p>
18912 !!end
18913
18914 #### --------------- HRs ---------------
18915 #### 1. Single line
18916 #### -----------------------------------
18917
18918 !! test
18919 HRs: 1. Single line
18920 !! options
18921 parsoid
18922 !! wikitext
18923 ----<nowiki>----</nowiki>
18924 ----=foo=
18925 ----*foo
18926 !! html
18927 <hr><span typeof="mw:Nowiki">----</span>
18928 <hr>=foo=
18929 <hr>*foo
18930 !! end
18931
18932 #### --------------- Tables ---------------
18933 #### 1a. Simple example
18934 #### 1b. No escaping needed (!foo)
18935 #### 1c. No escaping needed (|foo)
18936 #### 1d. No escaping needed (|}foo)
18937 ####
18938 #### 2a. Nested in td (<td>foo|bar</td>)
18939 #### 2b. Nested in td (<td>foo||bar</td>)
18940 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18941 ####
18942 #### 3a. Nested in th (<th>foo!bar</th>)
18943 #### 3b. Nested in th (<th>foo!!bar</th>)
18944 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18945 ####
18946 #### 4a. Escape -
18947 #### 4b. Escape +
18948 #### 4c. No escaping needed
18949 #### --------------------------------------
18950
18951 !! test
18952 Tables: 1a. Simple example
18953 !! wikitext
18954 <nowiki>{|
18955 |}</nowiki>
18956 !! html
18957 <p>{|
18958 |}
18959 </p>
18960 !! end
18961
18962 !! test
18963 Tables: 1b. No escaping needed
18964 !! wikitext
18965 !foo
18966 !! html
18967 <p>!foo
18968 </p>
18969 !! end
18970
18971 !! test
18972 Tables: 1c. No escaping needed
18973 !! wikitext
18974 |foo
18975 !! html
18976 <p>|foo
18977 </p>
18978 !! end
18979
18980 !! test
18981 Tables: 1d. No escaping needed
18982 !! wikitext
18983 |}foo
18984 !! html
18985 <p>|}foo
18986 </p>
18987 !! end
18988
18989 !! test
18990 Tables: 2a. Nested in td
18991 !! options
18992 parsoid=html2wt
18993 !! wikitext
18994 {|
18995 |<nowiki>foo|bar</nowiki>
18996 |-
18997 |x<div><nowiki>a|b</nowiki></div>
18998 |}
18999 !! html
19000 <table><tbody><tr>
19001 <td>foo|bar</td></tr>
19002 <tr><td>x<div>a|b</div></td>
19003 </tbody></table>
19004 !! end
19005
19006 !! test
19007 Tables: 2b. Nested in td
19008 !! options
19009 parsoid
19010 !! wikitext
19011 {|
19012 |<nowiki>foo||bar</nowiki>
19013 |''it''<nowiki>foo||bar</nowiki>
19014 |}
19015 !! html
19016 <table><tbody><tr>
19017 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19018 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19019 !! end
19020
19021 !! test
19022 Tables: 2c. Nested in td -- no escaping needed
19023 !! options
19024 parsoid
19025 !! wikitext
19026 {|
19027 |foo!!bar
19028 |}
19029 !! html
19030 <table><tbody><tr><td>foo!!bar
19031 </td></tr></tbody></table>
19032
19033 !! end
19034
19035 !! test
19036 Tables: 3a. Nested in th
19037 !! options
19038 parsoid
19039 !! wikitext
19040 {|
19041 !foo!bar
19042 |}
19043 !! html
19044 <table><tbody><tr><th>foo!bar
19045 </th></tr></tbody></table>
19046
19047 !! end
19048
19049 !! test
19050 Tables: 3b. Nested in th
19051 !! options
19052 parsoid
19053 !! wikitext
19054 {|
19055 !<nowiki>foo!!bar</nowiki>
19056 |}
19057 !! html
19058 <table>
19059 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19060 </tbody></table>
19061 !! end
19062
19063 !! test
19064 Tables: 3c. Nested in th -- no escaping needed
19065 !! options
19066 parsoid
19067 !! wikitext
19068 {|
19069 !<nowiki>foo||bar</nowiki>
19070 |}
19071 !! html
19072 <table><tbody><tr>
19073 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19074 !! end
19075
19076 !! test
19077 Tables: 4a. Escape -
19078 !! options
19079 parsoid
19080 !! wikitext
19081 {|
19082 !-bar
19083 |-
19084 |<nowiki>-bar</nowiki>
19085 |}
19086 !! html
19087 <table><tbody>
19088 <tr><th>-bar</th></tr>
19089 <tr>
19090 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19091 !! end
19092
19093 !! test
19094 Tables: 4b. Escape +
19095 !! options
19096 parsoid
19097 !! wikitext
19098 {|
19099 !+bar
19100 |-
19101 |<nowiki>+bar</nowiki>
19102 |}
19103 !! html
19104 <table><tbody>
19105 <tr><th>+bar</th></tr>
19106 <tr>
19107 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19108 !! end
19109
19110 !! test
19111 Tables: 4c. No escaping needed
19112 !! options
19113 parsoid
19114 !! wikitext
19115 {|
19116 |foo-bar
19117 |foo+bar
19118 |-
19119 |''foo''-bar
19120 |''foo''+bar
19121 |-
19122 |foo
19123 bar|baz
19124 +bar
19125 -bar
19126 |-
19127 |x
19128 <div>a|b</div>
19129 |}
19130 !! html
19131 <table><tbody>
19132 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19133 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19134 <tr><td>foo
19135 <p>bar|baz
19136 +bar
19137 -bar</p></td></tr>
19138 <tr><td>x
19139 <div>a|b</div></td>
19140 </tbody></table>
19141 !! end
19142
19143 !! test
19144 Tables: 4d. No escaping needed
19145 !! options
19146 parsoid
19147 !! wikitext
19148 {|
19149 |[[Foo]]-bar
19150 ||+1
19151 ||-2
19152 |}
19153 !! html
19154 <table>
19155 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19156 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19157 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19158 </tbody></table>
19159 !! end
19160
19161 !! test
19162 Tables: Digest broken attributes on table and tr tag
19163 !! options
19164 parsoid=wt2html
19165 !! wikitext
19166 {| || |} ++
19167 |- || || ++ --
19168 |- > [
19169 |}
19170 !! html
19171 <table>
19172 <tbody>
19173 <tr></tr>
19174 <tr></tr>
19175 </tbody></table>
19176 !! end
19177
19178 #### --------------- Links ----------------
19179 #### 1. Quote marks in link text
19180 #### 2. Wikilinks: Escapes needed
19181 #### 3. Wikilinks: No escapes needed
19182 #### 4. Extlinks: Escapes needed
19183 #### 5. Extlinks: No escapes needed
19184 #### --------------------------------------
19185 !! test
19186 Links 1. Quote marks in link text
19187 !! options
19188 parsoid
19189 !! wikitext
19190 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19191 !! html
19192 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19193 !! end
19194
19195 !! test
19196 Links 2. WikiLinks: Escapes needed
19197 !! options
19198 parsoid
19199 !! wikitext
19200 [[Foo|[Foobar]]]
19201 [[Foo|<nowiki>Foobar]</nowiki>]]
19202 [[Foo|x [Foobar] x]]
19203 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19204 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19205 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19206 [[Foo|<nowiki>|Bar</nowiki>]]
19207 [[Foo|<nowiki>]]bar</nowiki>]]
19208 [[Foo|<nowiki>[[bar</nowiki>]]
19209 [[Foo|<nowiki>x [[ y</nowiki>]]
19210 [[Foo|<nowiki>x ]] y</nowiki>]]
19211 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19212 !! html
19213 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19214 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19215 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19216 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19217 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19218 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19219 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19220 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19221 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19222 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19223 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19224 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19225 !! end
19226
19227 !! test
19228 Links 3. WikiLinks: No escapes needed
19229 !! options
19230 parsoid
19231 !! wikitext
19232 [[Foo|[Foobar]]
19233 [[Foo|foo|bar]]
19234 !! html
19235 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19236 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19237 !! end
19238
19239 !! test
19240 Links 4. ExtLinks: Escapes needed
19241 !! options
19242 parsoid
19243 !! wikitext
19244 [http://google.com <nowiki>[google]</nowiki>]
19245 [http://google.com <nowiki>google]</nowiki>]
19246
19247 <nowiki>[http://google.com]</nowiki>
19248
19249 <nowiki>[http://google.com google]</nowiki>
19250
19251 !! html
19252 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19253 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19254 <p>[http://google.com]</p>
19255 <p>[http://google.com google]</p>
19256 !! end
19257
19258 !! test
19259 Links 5. ExtLinks: No escapes needed
19260 !! options
19261 parsoid
19262 !! wikitext
19263 [http://google.com [google]
19264 !! html
19265 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19266 !! end
19267
19268 !! test
19269 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19270 !! html/parsoid
19271 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19272 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19273 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19274 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19275 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19276 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19277 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19278 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19279 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19280 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19281 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19282 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19283 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19284 </p>
19285 !! wikitext
19286 x<nowiki/>http://example.com<nowiki/>y
19287 http://example.com<nowiki/>?x
19288 http://example.com<nowiki/>&x
19289 http://example.com<nowiki/>'x
19290 http://example.com<nowiki/>,x
19291 http://example.com<nowiki/>.x
19292 http://example.com<nowiki/>;x
19293 http://example.com<nowiki/>:x
19294 http://example.com<nowiki/>;x
19295 http://example.com<nowiki/>!x
19296 http://example.com<nowiki/>=x
19297 http://example.com<nowiki/>(x)
19298 http://example.com(x<nowiki/>)
19299 !! end
19300
19301 !! test
19302 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19303 !! html/parsoid
19304 <p>x
19305 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19306 y
19307 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19308 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19309 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19310 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19311 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19312 </p>
19313 !! wikitext
19314 x
19315 http://example.com
19316 y
19317 "http://example.com"
19318 (http://example.com)
19319 (http://example.com) foo
19320 http://example.com,
19321 http://example.com, foo
19322 !! end
19323
19324 ## Parsoid currently fails wt2html on this one!
19325 !! test
19326 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19327 !! html/parsoid
19328 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19329 !! wikitext
19330 http://example.com.,;:!?
19331 !! end
19332
19333 !! test
19334 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19335 !! html/parsoid
19336 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19337 !! wikitext
19338 RFC 123<nowiki/>4
19339 !! end
19340
19341 !! test
19342 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19343 !! html/parsoid
19344 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19345 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19346 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19347 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19348 </p>
19349 !! wikitext
19350 xRFC 123y
19351 XRFC 123y
19352 RFC 123?foo
19353 RFC 123&foo
19354 !! end
19355
19356 !! test
19357 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19358 !! html/parsoid
19359 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19360 !! wikitext
19361 PMID 123<nowiki/>4
19362 !! end
19363
19364 !! test
19365 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19366 !! html/parsoid
19367 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19368 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19369 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19370 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19371 </p>
19372 !! wikitext
19373 xPMID 123y
19374 XPMID 123y
19375 PMID 123?foo
19376 PMID 123&foo
19377 !! end
19378
19379 !! test
19380 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19381 !! html/parsoid
19382 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19383 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19384 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19385 </p>
19386 !! wikitext
19387 ISBN 1234567890<nowiki/>1
19388 ISBN 1234567890<nowiki/>x
19389 ISBN 1234567890<nowiki/>b
19390 !! end
19391
19392 !! test
19393 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19394 !! html/parsoid
19395 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19396 !! wikitext
19397 ISBN 1234567890's
19398 !! end
19399
19400 #### --------------- Quotes ---------------
19401 #### 1. Quotes inside <b> and <i>
19402 #### 2. Link fragments separated by <i> and <b> tags
19403 #### 3. Link fragments inside <i> and <b>
19404 #### 4. No escaping needed
19405 #### --------------------------------------
19406 !! test
19407 1. Quotes inside <b> and <i>
19408 !! options
19409 parsoid=html2wt,wt2wt
19410 !! wikitext
19411 ''<nowiki>'foo'</nowiki>''
19412 ''<nowiki>''foo''</nowiki>''
19413 ''<nowiki>'''foo'''</nowiki>''
19414 ''foo''<nowiki/>'s
19415 '''<nowiki>'foo'</nowiki>'''
19416 '''<nowiki>''foo''</nowiki>'''
19417 '''<nowiki>'''foo'''</nowiki>'''
19418 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19419 '''foo'''<nowiki/>'s
19420 '''foo''
19421 ''foo''<nowiki/>'
19422 '<nowiki/>''foo''<nowiki/>'
19423 ''''foo'''
19424 '''foo'''<nowiki/>'
19425 '<nowiki/>'''foo'''<nowiki/>'
19426 ''fools'<span> errand</span>''
19427 ''<span>fool</span>'s errand''
19428 !! html
19429 <p><i>'foo'</i>
19430 <i>''foo''</i>
19431 <i>'''foo'''</i>
19432 <i>foo</i>'s
19433 <b>'foo'</b>
19434 <b>''foo''</b>
19435 <b>'''foo'''</b>
19436 <b>foo'<i>bar'</i>baz</b>
19437 <b>foo</b>'s
19438 '<i>foo</i>
19439 <i>foo</i>'
19440 '<i>foo</i>'
19441 '<b>foo</b>
19442 <b>foo</b>'
19443 '<b>foo</b>'</p>
19444 <i>fools'<span> errand</span></i>
19445 <i><span>fool</span>'s errand</i>
19446 !! end
19447
19448 !! test
19449 2. Link fragments separated by <i> and <b> tags
19450 !! wikitext
19451 [[''foo''<nowiki>hello]]</nowiki>
19452
19453 [['''foo'''<nowiki>hello]]</nowiki>
19454 !! html
19455 <p>[[<i>foo</i>hello]]
19456 </p><p>[[<b>foo</b>hello]]
19457 </p>
19458 !! end
19459
19460 !! test
19461 3. Link fragments inside <i> and <b>
19462 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19463 this is one of the shortcomings of this format)
19464 !! wikitext
19465 ''[[foo''<nowiki>]]</nowiki>
19466
19467 '''[[foo'''<nowiki>]]</nowiki>
19468 !! html
19469 <p><i>[[foo</i>]]
19470 </p><p><b>[[foo</b>]]
19471 </p>
19472 !! end
19473
19474 !! test
19475 4. No escaping needed
19476 !! wikitext
19477 '<span>''bar''</span>'
19478 '<span>'''bar'''</span>'
19479 !! html
19480 <p>'<span><i>bar</i></span>'
19481 '<span><b>bar</b></span>'
19482 </p>
19483 !! end
19484
19485 #### ----------- Paragraphs ---------------
19486 #### 1. No unnecessary escapes
19487 #### --------------------------------------
19488
19489 !! test
19490 1. No unnecessary escapes
19491 !! wikitext
19492 bar <span><nowiki>[[foo]]</nowiki></span>
19493
19494 =bar <span><nowiki>[[foo]]</nowiki></span>
19495
19496 [[bar <span><nowiki>[[foo]]</nowiki></span>
19497
19498 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19499
19500 =bar <span>foo]]</span><nowiki>=</nowiki>
19501 !! html
19502 <p>bar <span>[[foo]]</span>
19503 </p><p>=bar <span>[[foo]]</span>
19504 </p><p>[[bar <span>[[foo]]</span>
19505 </p><p>]]bar <span>[[foo]]</span>
19506 </p><p>=bar <span>foo]]</span>=
19507 </p>
19508 !!end
19509
19510 #### ----------------------- PRE --------------------------
19511 #### 1. Leading whitespace in SOL context should be escaped
19512 #### ------------------------------------------------------
19513 !! test
19514 1. Leading whitespace in SOL context should be escaped
19515 !! options
19516 parsoid
19517 !! wikitext
19518 <nowiki> </nowiki>a
19519
19520 <nowiki> </nowiki> a
19521
19522 <nowiki> </nowiki>a(tab)
19523
19524 <nowiki> </nowiki> a
19525 <!--cmt-->
19526 <nowiki> </nowiki> a
19527
19528 a
19529 <nowiki> </nowiki>b
19530
19531 a
19532 <nowiki> </nowiki>b
19533
19534 a
19535 <nowiki> </nowiki> b
19536 !! html
19537 <p> a</p>
19538 <p> a</p>
19539 <p> a(tab)</p>
19540 <p> a</p>
19541 <p><!--cmt--> a</p>
19542 <p>a
19543 b</p>
19544 <p>a
19545 b</p>
19546 <p>a
19547 b</p>
19548 !! end
19549
19550 !! test
19551 2. Leading whitespace in non-indent-pre contexts should not be escaped
19552 !! options
19553 parsoid
19554 !! wikitext
19555 foo <ref>''a''
19556 b</ref>
19557 !! html
19558 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19559 !! end
19560
19561 !! test
19562 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19563 !! options
19564 parsoid
19565 !! wikitext
19566 <blockquote>
19567 a
19568 <span>b</span>
19569 c
19570 </blockquote>
19571 !! html
19572 <blockquote>
19573 <p>
19574 a
19575 <span>b</span>
19576 c</p>
19577 </blockquote>
19578 !! end
19579
19580 !! test
19581 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19582 !! options
19583 parsoid
19584 !! wikitext
19585 [[File:Foobar.jpg|thumb|caption]]
19586 !! html
19587 !! html/parsoid
19588 <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>
19589 !! end
19590
19591 #### --------------- Behavior Switches --------------------
19592 !! test
19593 1. Valid behavior switches should be escaped
19594 !! options
19595 parsoid=html2wt
19596 !! wikitext
19597 <nowiki>__TOC__</nowiki>
19598 ''<nowiki>__TOC__</nowiki>''
19599 !! html
19600 __TOC__
19601 <i>__TOC__</i>
19602 !! end
19603
19604 !! test
19605 2. Invalid behavior switches should not be escaped
19606 !! options
19607 parsoid=html2wt
19608 !! wikitext
19609 __TOO__
19610 __|__
19611 !! html
19612 __TOO__
19613 __|__
19614 !! end
19615
19616 #### --------------- HTML tags ---------------
19617 #### 1. a tags
19618 #### 2. other tags
19619 #### 3. multi-line html tag
19620 #### 4. extension tags
19621 #### -----------------------------------------
19622 !! test
19623 1. a tags
19624 !! options
19625 parsoid
19626 !! wikitext
19627 <a href="http://google.com">google</a>
19628 !! html
19629 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19630 !! end
19631
19632 !! test
19633 2. other tags
19634 !! wikitext
19635 <nowiki><div>foo</div>
19636 <div style="color:red">foo</div></nowiki>
19637 !! html
19638 <p>&lt;div&gt;foo&lt;/div&gt;
19639 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19640 </p>
19641 !! end
19642
19643 !! test
19644 3. multi-line html tag
19645 !! wikitext
19646 <nowiki><div
19647 >foo</div
19648 ></nowiki>
19649 !! html
19650 <p>&lt;div
19651 &gt;foo&lt;/div
19652 &gt;
19653 </p>
19654 !! end
19655
19656 !! test
19657 4. extension tags
19658 !! wikitext
19659 <nowiki><ref>foo</ref></nowiki>
19660
19661 <nowiki><ref>bar</nowiki>
19662
19663 baz<nowiki></ref></nowiki>
19664 !! html
19665 <p>&lt;ref&gt;foo&lt;/ref&gt;
19666 </p><p>&lt;ref&gt;bar
19667 </p><p>baz&lt;/ref&gt;
19668 </p>
19669 !! end
19670
19671 #### --------------- Others ---------------
19672 !! test
19673 Escaping nowikis
19674 !! wikitext
19675 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19676 !! html
19677 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19678 </p>
19679 !! end
19680
19681 ## The quote-char in the input is necessary for triggering the bug
19682 !! test
19683 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19684 !! options
19685 parsoid=wt2wt,html2wt
19686 !! wikitext
19687 foo's bar :
19688 !! html
19689 <p>foo's bar :</p>
19690 !! end
19691
19692 !! test
19693
19694 Tag-like HTML structures are passed through as text
19695 !! wikitext
19696 <x y>
19697
19698 <x.y>
19699
19700 <x-y>
19701
19702 1>2
19703
19704 x<y
19705
19706 a>b
19707
19708 1<d e>f
19709 !! html
19710 <p>&lt;x y&gt;
19711 </p><p>&lt;x.y&gt;
19712 </p><p>&lt;x-y&gt;
19713 </p><p>1&gt;2
19714 </p><p>x&lt;y
19715 </p><p>a&gt;b
19716 </p><p>1&lt;d e&gt;f
19717 </p>
19718 !! end
19719
19720
19721 # This was a bug in the PHP parser (see bug 17663 and its dups,
19722 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19723 !! test
19724 Tag names followed by punctuation should not be recognized as tags
19725 !! wikitext
19726 <s.ome> text
19727 !! html
19728 <p>&lt;s.ome&gt; text
19729 </p>
19730 !! end
19731
19732 !! test
19733 HTML tag with necessary entities in attributes
19734 !! wikitext
19735 <span title="&amp;amp;">foo</span>
19736 !! html
19737 <p><span title="&amp;amp;">foo</span>
19738 </p>
19739 !! end
19740
19741 !! test
19742 HTML tag with 'unnecessary' entity encoding in attributes
19743 !! wikitext
19744 <span title="&amp;">foo</span>
19745 !! html
19746 <p><span title="&amp;">foo</span>
19747 </p>
19748 !! end
19749
19750 !! test
19751 HTML tag with broken attribute value quoting
19752 !! wikitext
19753 <span title="Hello world>Foo</span>
19754 !! html
19755 <p><span>Foo</span>
19756 </p>
19757 !! end
19758
19759 !! test
19760 Parsoid-only: HTML tag with broken attribute value quoting
19761 !! options
19762 parsoid
19763 !! wikitext
19764 <span title="Hello world>Foo</span>
19765 !! html
19766 <p><span title="Hello world">Foo</span>
19767 </p>
19768 !! end
19769
19770 !! test
19771 Table with broken attribute value quoting
19772 !! wikitext
19773 {|
19774 | title="Hello world|Foo
19775 |}
19776 !! html
19777 <table>
19778 <tr>
19779 <td>Foo
19780 </td></tr></table>
19781
19782 !! end
19783
19784 !! test
19785 Table with broken attribute value quoting on consecutive lines
19786 !! wikitext
19787 {|
19788 | title="Hello world|Foo
19789 | style="color:red|Bar
19790 |}
19791 !! html
19792 <table>
19793 <tr>
19794 <td>Foo
19795 </td>
19796 <td>Bar
19797 </td></tr></table>
19798
19799 !! end
19800
19801 !! test
19802 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19803 !! options
19804 parsoid
19805 !! wikitext
19806 {|
19807 | title="Hello world|Foo
19808 | style="color:red|Bar
19809 |}
19810 !! html
19811 <table><tbody>
19812 <tr>
19813 <td title="Hello world">Foo
19814 </td><td style="color: red">Bar
19815 </td></tr></tbody></table>
19816
19817 !! end
19818
19819 !! test
19820 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19821 !! options
19822 parsoid
19823 !! wikitext
19824 {{}}
19825 !! html
19826 {{}}
19827 !! end
19828
19829 !! test
19830 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19831 !! options
19832 parsoid
19833 !! wikitext
19834 }}{{
19835 !! html
19836 }}{{
19837 !! end
19838
19839 !!test
19840 Accept empty td cell attribute
19841 !! wikitext
19842 {|
19843 | align="center" | foo || |
19844 |}
19845 !! html
19846 <table>
19847 <tr>
19848 <td align="center"> foo </td>
19849 <td>
19850 </td></tr></table>
19851
19852 !!end
19853
19854 !!test
19855 Non-empty attributes in th-cells
19856 !! wikitext
19857 {|
19858 ! Foo !! style="color: red" | Bar
19859 |}
19860 !! html
19861 <table>
19862 <tr>
19863 <th> Foo </th>
19864 <th style="color: red"> Bar
19865 </th></tr></table>
19866
19867 !!end
19868
19869 !!test
19870 Accept empty attributes in th-cells
19871 !! wikitext
19872 {|
19873 !| foo !!| bar
19874 |}
19875 !! html
19876 <table>
19877 <tr>
19878 <th> foo </th>
19879 <th> bar
19880 </th></tr></table>
19881
19882 !!end
19883
19884 !!test
19885 Empty table rows go away
19886 !! wikitext
19887 {|
19888 | Hello
19889 | there
19890 |- class="foo"
19891 |-
19892 |}
19893 !! html
19894 <table>
19895 <tr>
19896 <td> Hello
19897 </td>
19898 <td> there
19899 </td></tr>
19900
19901 </table>
19902
19903 !! end
19904
19905 ###
19906 ### Parsoid-centric tests for testing RTing of inter-element separators
19907 ### Edge cases not tested by existing parser tests and specific to
19908 ### Parsoid-specific serialization strategies.
19909 ###
19910
19911 !!test
19912 RT-ed inter-element separators should be valid separators
19913 !! wikitext
19914 {|
19915 |- [[foo]]
19916 |}
19917 !! html
19918 <table>
19919
19920 </table>
19921
19922 !!end
19923
19924 !!test
19925 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19926 (Parsoid-only since PHP parser relies on Tidy for correct output)
19927 !!options
19928 parsoid
19929 !! wikitext
19930 {|
19931 |<small>foo
19932 bar
19933 |}
19934
19935 {|
19936 |<small>foo<small>
19937 |}
19938 !! html
19939 !!end
19940
19941 !!test
19942 Empty TD followed by TD with tpl-generated attribute
19943 !! wikitext
19944 {|
19945 |-
19946 |
19947 |{{echo|style='color:red'}}|foo
19948 |}
19949 !! html
19950 <table>
19951
19952 <tr>
19953 <td>
19954 </td>
19955 <td>foo
19956 </td></tr></table>
19957
19958 !!end
19959
19960 !!test
19961 Indented table with an empty td
19962 !! wikitext
19963 {|
19964 |-
19965 |
19966 |foo
19967 |}
19968 !! html
19969 <table>
19970
19971 <tr>
19972 <td>
19973 </td>
19974 <td>foo
19975 </td></tr></table>
19976
19977 !!end
19978
19979 !!test
19980 Indented block & table
19981 !! wikitext
19982 <div>foo</div>
19983 {|
19984 |foo
19985 |}
19986 !! html/parsoid
19987 <div data-parsoid='{"stx":"html"}'>foo</div>
19988 <table><tbody>
19989 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19990 </tbody></table>
19991 !!end
19992
19993 !! test
19994 Indent and comment before table row
19995 !! wikitext
19996 {|
19997 <!--hi-->|-
19998 | there
19999 |}
20000 !! html/parsoid
20001 <table data-parsoid='{}'>
20002 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20003 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20004 </tbody></table>
20005 !! end
20006
20007 !!test
20008 Empty TR followed by a template-generated TR
20009 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20010 !!options
20011 parsoid
20012 !! wikitext
20013 {|
20014 |-
20015 {{echo|<tr><td>foo</td></tr>}}
20016 |}
20017 !! html
20018 <table>
20019 <tbody>
20020 <tr></tr>
20021 <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}}]}'>
20022 <td>foo</td></tr>
20023 </tbody></table>
20024 !!end
20025
20026 ## PHP and parsoid output differ for this, and since this is primarily
20027 ## for testing Parsoid's serializer, marking this Parsoid only
20028 !!test
20029 Empty TR followed by mixed-ws-comment line should RT correctly
20030 !!options
20031 parsoid
20032 !! wikitext
20033 {|
20034 |-
20035 <!--c-->
20036 |-
20037 <!--c--> <!--d-->
20038 |}
20039 !! html
20040 <table>
20041 <tbody>
20042 <tr></tr>
20043 <!--c-->
20044 <tr>
20045 <!--c--> </tr><!--d-->
20046 </tbody></table>
20047
20048 !!end
20049
20050 !!test
20051 Multi-line image caption generated by templates with/without trailing newlines
20052 !!options
20053 parsoid
20054 !! wikitext
20055 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20056 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20057 !! html
20058 <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>
20059 <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>
20060
20061 !!end
20062
20063 !! test
20064 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20065 !! options
20066 parsoid=html2wt
20067 !! wikitext
20068 <includeonly>foo</includeonly>
20069 new para
20070
20071 [[./Category:Foo]]
20072
20073 = new heading =
20074 !! html
20075 <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>
20076
20077 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20078 !! end
20079
20080 ## PHP emits broken html for this, and since this is primarily
20081 ## a Parsoid serializer test, marking this Parsoid only
20082 !!test
20083 Improperly nested inline or quotes tags with whitespace in between
20084 !!options
20085 parsoid
20086 !! wikitext
20087 <span> <s>x</span> </s>
20088 ''' ''x''' ''
20089 !! html
20090 <p><span> <s>x</s></span><s> </s>
20091 <b> <i>x</i></b><i> </i>
20092 </p>
20093 !!end
20094
20095 !!test
20096 Encapsulate protected attributes from wt
20097 !!options
20098 parsoid
20099 !! wikitext
20100 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20101 !! html
20102 <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>
20103 </body>
20104 !!end
20105
20106 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20107 ## Having nested or stray pre tags results in the attempt to add duplicates,
20108 ## causing an assertion fail. This test tries to prevent that situation.
20109 !!test
20110 Ensure ParagraphWrapper can deal with stray closing pre tags
20111 !!options
20112 parsoid=wt2html
20113 !! wikitext
20114 plain text</pre>
20115 !! html
20116 plain text
20117 !!end
20118
20119 !!test
20120 1. Ensure fostered text content is wrapped in spans
20121 !!options
20122 parsoid=wt2html
20123 !! wikitext
20124 <table>hi</table><table>ho</table>
20125 !! html
20126 <span>hi</span>
20127 <table></table>
20128 <span>ho</span>
20129 <table></table>
20130 !!end
20131
20132 !!test
20133 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20134 !!options
20135 parsoid=wt2html,wt2wt
20136 !! wikitext
20137 <table>
20138 <tr> || ||
20139 <td> a
20140 </table>
20141 !! html
20142 <span> || ||</span>
20143 <table>
20144 <tbody>
20145 <tr>
20146 <td> a</td></tr>
20147 </tbody></table>
20148 !!end
20149
20150 !!test
20151 Encapsulation properly handles null DSR information from foster box
20152 !!options
20153 parsoid=wt2html,wt2wt
20154 !! wikitext
20155 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20156 !! html
20157 <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;
20158 <table>foo
20159 <tr>
20160 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20161 <table>
20162 <tbody>
20163 <tr>
20164 <td>bar</td></tr></tbody></table>
20165 !!end
20166
20167 !!test
20168 1. Encapsulate foster-parented transclusion content
20169 !!options
20170 parsoid=wt2wt,wt2html
20171 !! wikitext
20172 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20173 !! html
20174 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20175 <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
20176 <tr>
20177 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20178 <table>
20179 <tbody>
20180 <tr>
20181 <td>bar</td></tr></tbody></table>
20182 !!end
20183
20184 !!test
20185 2. Encapsulate foster-parented transclusion content
20186 !!options
20187 parsoid=wt2wt,wt2html
20188 !! wikitext
20189 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20190 !! html
20191 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20192 <table>
20193 <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>
20194 <tr>
20195 <td>bar</td></tr></table>&quot;]}">foo</div>
20196 <table>
20197 <tbody>
20198 <tr>
20199 <td>bar</td></tr></tbody></table>
20200 !!end
20201
20202 !!test
20203 3. Encapsulate foster-parented transclusion content
20204 !!options
20205 parsoid=wt2wt,wt2html
20206 !! wikitext
20207 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20208 !! html
20209 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20210 <table>
20211 <div>
20212 <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>
20213 <tr>
20214 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20215 <p>foo</p></div>
20216 <table>
20217 <tbody>
20218 <tr>
20219 <td>bar</td></tr></tbody></table>
20220 !!end
20221
20222 !!test
20223 4. Encapsulate foster-parented transclusion content
20224 !!options
20225 parsoid=wt2wt,wt2html
20226 !! wikitext
20227 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20228 !! html
20229 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20230 <table>
20231 <div>
20232 <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>
20233 <tr>
20234 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20235 <p>foo</p></div>
20236 <table>
20237 <tbody>
20238 <tr>
20239 <td>bar</td></tr></tbody></table>
20240 !!end
20241
20242 !!test
20243 5. Encapsulate foster-parented transclusion content
20244 !!options
20245 parsoid=wt2wt,wt2html
20246 !! wikitext
20247 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20248 !! html
20249 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20250 <table>
20251 <tr>
20252 <td>
20253 <div>
20254 <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>
20255 <table>
20256 <tbody>
20257 <tr>
20258 <td>
20259 <div>
20260 <p>foo</p></div></td></tr></tbody></table>
20261 !!end
20262
20263 !!test
20264 6. Encapsulate foster-parented transclusion content
20265 !!options
20266 parsoid=wt2wt,wt2html
20267 !! wikitext
20268 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20269 !! html
20270 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20271 <table>
20272 <tr>
20273 <td>
20274 <div>
20275 <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>
20276 <table>
20277 <tbody>
20278 <tr>
20279 <td>
20280 <div>
20281 <p>foo</p></div></td></tr></tbody></table>
20282 <p>ok</p>
20283 !!end
20284
20285 !!test
20286 7. Encapsulate foster-parented transclusion content
20287 !!options
20288 parsoid=wt2wt,wt2html
20289 !! wikitext
20290 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20291 !! html
20292 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20293 <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;
20294 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20295 <td>bar</td></table>&quot;]}">foo</p>
20296 <table>
20297 <tbody>
20298 <tr>
20299 <td>bar</td></tr></tbody></table>
20300 !!end
20301
20302 !!test
20303 8. Encapsulate foster-parented transclusion content
20304 !!options
20305 parsoid=wt2wt,wt2html
20306 !! wikitext
20307 {{echo|a
20308 }}{|{{echo|style='color:red'}}
20309 |-
20310 |b
20311 |}
20312 !! html
20313 <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>
20314 <table>
20315 <tbody>
20316 <tr>
20317 <td>b</td></tr></tbody></table>
20318 !!end
20319
20320 !!test
20321 9. Encapsulate foster-parented transclusion content
20322 !!options
20323 parsoid=wt2wt,wt2html
20324 !! wikitext
20325 <table>{{echo|hi</table>hello}}
20326 !! html
20327 <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>
20328 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20329 !!end
20330
20331 !!test
20332 Table in fosterable position
20333 !!options
20334 parsoid=wt2html,wt2wt
20335 !! wikitext
20336 {{OpenTable}}
20337 <div>
20338 {|
20339 |}
20340 </div>
20341 |}
20342 !! html
20343 <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="{}">
20344 </span>
20345 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20346
20347 <table>
20348 </table>
20349 !!end
20350
20351 # Parsoid only for bug 64747
20352 !! test
20353 Properly encapsulate empty-content transclusions in fosterable positions
20354 !! wikitext
20355 <table>
20356 {{#if:|
20357 <td>foo</td>
20358 }}
20359 </table>
20360 !! html/parsoid
20361 <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>"}'>
20362
20363 </table>
20364 !! end
20365
20366 !!test
20367 Support <object> element with .data attribute
20368 !!options
20369 parsoid=html2wt
20370 !! wikitext
20371 <object data="test.swf"></object>
20372 !! html
20373 <object data="test.swf"></object>
20374 !!end
20375
20376 # -----------------------------------------------------------------
20377 # The following section of tests are primarily to spec requirements
20378 # around serialization of new/edited content.
20379 #
20380 # All these tests are marked Parsoid html2wt and html2html only
20381 # ----------------------------------------------------------------
20382
20383 !! test
20384 Image: Modifying size of an image (1)
20385 !! options
20386 parsoid={
20387 "modes": ["wt2wt"],
20388 "changes": [
20389 ["img[height]", "attr", "height", "22"],
20390 ["img[width]", "attr", "width", "200"]
20391 ]
20392 }
20393 !! wikitext
20394 [[Image:Foobar.jpg|230x230px]]
20395 !! wikitext/edited
20396 [[Image:Foobar.jpg|200x200px]]
20397 !!end
20398
20399 !! test
20400 Image: Modifying size of an image (2)
20401 !! options
20402 parsoid={
20403 "modes": ["wt2wt"],
20404 "changes": [
20405 ["img[height]", "attr", "height", "100"],
20406 ["img[width]", "attr", "width", "500"]
20407 ]
20408 }
20409 !! wikitext
20410 [[Image:Foobar.jpg|230x230px]]
20411 !! wikitext/edited
20412 [[Image:Foobar.jpg|500x500px]]
20413 !!end
20414
20415 # Change in size is ignored so long as class='mw-default-size'
20416 !! test
20417 Image: Modifying size of an image (3)
20418 !! options
20419 parsoid={
20420 "modes": ["wt2wt"],
20421 "changes": [
20422 ["figure[class]", "removeClass", "mw-default-size"],
20423 ["figure img", "attr", "height", "19"],
20424 ["figure img", "attr", "width", "170"]
20425 ]
20426 }
20427 !! wikitext
20428 [[Image:Foobar.jpg|thumb]]
20429 !! wikitext/edited
20430 [[Image:Foobar.jpg|thumb|170x170px]]
20431 !!end
20432
20433 !! test
20434 Image: Modifying alignment of an image (bug 48665)
20435 !! options
20436 parsoid={
20437 "modes": ["wt2wt"],
20438 "changes": [
20439 ["figure[class]", "removeClass", "mw-halign-right"],
20440 ["figure[class]", "addClass", "mw-halign-left"]
20441 ]
20442 }
20443 !! wikitext
20444 [[Image:Foobar.jpg|thumb|caption|right]]
20445 !! wikitext/edited
20446 [[Image:Foobar.jpg|thumb|caption|left]]
20447 !! end
20448
20449 !! test
20450 Image: Modifying mw-default-size of an frameless image (bug 62805)
20451 !! options
20452 parsoid={
20453 "modes": ["wt2wt"],
20454 "changes": [
20455 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20456 ]
20457 }
20458 !! wikitext
20459 [[Image:Foobar.jpg|frameless|right]]
20460 !! wikitext/edited
20461 [[Image:Foobar.jpg|frameless|right|220x220px]]
20462 !! end
20463
20464 !! test
20465 Image: Modifying valign of an image (bug 49221)
20466 !! options
20467 parsoid={
20468 "modes": ["wt2wt"],
20469 "changes": [
20470 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20471 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20472 ]
20473 }
20474 !! wikitext
20475 [[File:Foobar.jpg|20px|middle]]
20476 !! wikitext/edited
20477 [[File:Foobar.jpg|20px|text-top]]
20478 !! end
20479
20480 !! test
20481 Image: Modifying alt attribute of an image (bug 56400)
20482 !! options
20483 parsoid={
20484 "modes": ["wt2wt"],
20485 "changes": [
20486 ["img[alt]", "attr", "alt", "some alternate edited text"]
20487 ]
20488 }
20489 !! wikitext
20490 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20491 !! wikitext/edited
20492 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20493 !!end
20494
20495 !! test
20496 Image: Modifying caption of an image
20497 !! options
20498 parsoid={
20499 "modes": ["wt2wt"],
20500 "changes": [
20501 ["figcaption", "text", "new caption"]
20502 ]
20503 }
20504 !! wikitext
20505 [[Image:Foobar.jpg|thumb|original caption]]
20506 !! wikitext/edited
20507 [[Image:Foobar.jpg|thumb|new caption]]
20508 !!end
20509
20510 !! test
20511 Image: empty alt attribute (bug 48924)
20512 !! options
20513 parsoid
20514 !! wikitext
20515 [[File:Foobar.jpg|thumb|alt=|bar]]
20516 !! html
20517 <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>
20518 !! end
20519
20520 #!! test
20521 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20522 #!! options
20523 #parsoid=html2wt
20524 #language=ar
20525 #!! input
20526 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20527 #!! result
20528 #<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>
20529 #!! end
20530
20531 !! test
20532 Image: Block level image should have \n before and after
20533 !! options
20534 parsoid
20535 !! wikitext
20536 123
20537 [[File:Foobar.jpg|right|thumb|150x150px]]
20538 456
20539 !! html
20540 <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>
20541 !!end
20542
20543 !! test
20544 Image: New block level image should have \n before and after (existing
20545 content)
20546 !! options
20547 parsoid
20548 !! wikitext
20549 123
20550 [[File:Foobar.jpg|right|thumb|150x150px]]
20551 456
20552 !! html
20553 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20554 <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>
20555 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20556 !!end
20557
20558 !! test
20559 Image: upright option (parsoid)
20560 !! options
20561 parsoid
20562 !! wikitext
20563 [[File:Foobar.jpg|thumb|upright|caption]]
20564 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20565 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20566 !! html
20567 <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>
20568 !!end
20569
20570 !! test
20571 Image: upright option is ignored on inline and frame images (parsoid)
20572 !! options
20573 parsoid
20574 !! wikitext
20575 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20576 !! html
20577 <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>
20578 !!end
20579
20580 !! test
20581 Image: from basic HTML (1)
20582 !! options
20583 parsoid=html2wt
20584 !! html/parsoid
20585 <span typeof="mw:Image">
20586 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20587 </span>
20588 !! wikitext
20589 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20590 !! end
20591
20592 !! test
20593 Image: from basic HTML (2)
20594 !! options
20595 parsoid=html2wt
20596 !! html/parsoid
20597 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20598 !! wikitext
20599 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20600 !! end
20601
20602 !! test
20603 Image: from basic HTML (3)
20604 !! options
20605 parsoid=html2wt
20606 !! html/parsoid
20607 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20608 !! wikitext
20609 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20610 !! end
20611
20612 !! test
20613 Image: from basic HTML (4)
20614 !! options
20615 parsoid=html2wt
20616 !! html/parsoid
20617 <img src="File:Foobar.jpg">
20618 !! wikitext
20619 [[File:Foobar.jpg|link=]]
20620 !! end
20621
20622 !! test
20623 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20624 !! options
20625 parsoid=html2wt
20626 !! wikitext
20627 * foo
20628 !! html
20629 <ul>
20630 <li><p>foo</p></li>
20631 </ul>
20632 !! end
20633
20634 !! test
20635 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20636 !! options
20637 parsoid=html2wt
20638 !! wikitext
20639 * foo
20640 !! html
20641 <ul> <li>foo</li></ul>
20642 !! end
20643
20644 !! test
20645 Don't strip leading whitespace when handling indent-pre suppressing tags
20646 !! options
20647 parsoid=html2wt
20648 !! wikitext
20649 {|
20650 | indented row
20651 |}
20652 <blockquote>
20653 '''This is very bold of you!'''
20654
20655 {|
20656 |
20657 indented cell (no pre-wrapping!)
20658 |}
20659 </blockquote>
20660 foo
20661 <div>bar</div>
20662 !! html
20663 <table>
20664 <tr><td> indented row</td></tr>
20665 </table>
20666 <blockquote><p>
20667 <b>This is very bold of you!</b>
20668 </p>
20669 <table><tr><td>
20670 indented cell (no pre-wrapping!)
20671 </td></tr></table>
20672 </blockquote>
20673 <p>foo</p>
20674 <div>bar</div>
20675 !! end
20676
20677 !! test
20678 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20679 !! options
20680 parsoid=html2wt
20681 !! wikitext
20682 foo
20683 <nowiki> </nowiki><span>bar</span>
20684
20685 <span>foo2
20686 <nowiki> </nowiki></span>bar2
20687
20688 <div>foo</div>
20689 <nowiki> </nowiki><span>bar</span>
20690
20691 <div>
20692 <nowiki> </nowiki><span>foo</span>
20693 </div>
20694 !! html
20695 <p>foo</p>
20696 <span>bar</span>
20697
20698 <span>foo2
20699 </span>bar2
20700
20701 <div>foo</div>
20702 <span>bar</span>
20703
20704 <div>
20705 <span>foo</span>
20706 </div>
20707 !! end
20708
20709 !! test
20710 Lists: Add space after bullets
20711 !! options
20712 parsoid=html2wt
20713 !! wikitext
20714 * foo
20715 * bar
20716 * <span> baz</span>
20717 !! html
20718 <ul>
20719 <li>foo</li>
20720 <li> bar</li>
20721 <li><span> baz</span></li>
20722 </ul>
20723 !! end
20724
20725 !! test
20726 Lists: Dont insert newlines in a serialized list item.
20727 !! options
20728 parsoid=html2wt
20729 !! wikitext
20730 * a<br>b
20731 * c
20732 !! html
20733 <ul><li>a<br>b</li><li>c</li></ul>
20734 !! end
20735
20736 !! test
20737 Headings: Add space before/after == (Bug 51744)
20738 !! options
20739 parsoid=html2wt
20740 !! wikitext
20741 == foo ==
20742
20743 == bar ==
20744
20745 == baz ==
20746
20747 == <span> baz</span> ==
20748 !! html
20749 <h2>foo</h2>
20750 <h2> bar</h2>
20751 <h2>baz </h2>
20752 <h2><span> baz</span></h2>
20753 !! end
20754
20755 !! test
20756 Parsoid: Serialize positional parameters with = in them as named parameter
20757 !! options
20758 parsoid=html2wt
20759 !! wikitext
20760 {{echo|1 = f=oo}}
20761
20762 {{echo|1 = f=oo|2 = bar}}
20763
20764 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20765 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20766 {{echo|<nowiki>f=oo</nowiki>|bar}}
20767 !! html
20768 <p about="#mwt1" typeof="mw:Transclusion"
20769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20770
20771 <p about="#mwt1" typeof="mw:Transclusion"
20772 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20773
20774 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20775 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20776 <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>
20777 !! end
20778
20779 !! test
20780 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20781 !! options
20782 parsoid=html2wt
20783 !! wikitext
20784 <div>a
20785 b
20786 </div>
20787 <div>a
20788 b
20789 </div>
20790 <div>
20791 a
20792
20793 b
20794 </div>
20795 !! html
20796 <div>a<p>b</p></div>
20797 <div>a
20798 <p>b</p></div>
20799 <div>
20800 a
20801 <p>b</p></div>
20802 !! end
20803
20804 !! test
20805 Substrings resembling wikitext in hrefs should not get nowiki escapes
20806 !! options
20807 parsoid=html2wt
20808 !! wikitext
20809 [[Foo''bar''baz]]
20810 !! html
20811 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20812 !! end
20813
20814 #-----------------------------
20815 # I/B quote minimization tests
20816 #-----------------------------
20817
20818 !! test
20819 1. I/B quote minimization: wikitext-only tags should be combined
20820 !! options
20821 parsoid=html2wt
20822 !! wikitext
20823 ''AB''
20824
20825 '''AB'''
20826
20827 ''A'''B'''''
20828
20829 '''A''B'''''
20830
20831 '''A''BC''D'''
20832
20833 '''''AB'''''
20834
20835 '''''AB'''''
20836
20837 '''''AB'''''
20838 !! html
20839 <p><i>A</i><i>B</i></p>
20840 <p><b>A</b><b>B</b></p>
20841 <p><i>A</i><b><i>B</i></b></p>
20842 <p><b>A</b><i><b>B</b></i></p>
20843 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20844 <p><i><b>A</b></i><i><b>B</b></i></p>
20845 <p><i><b>A</b></i><b><i>B</i></b></p>
20846 <p><b><i>A</i></b><i><b>B</b></i></p>
20847 !! end
20848
20849 !! test
20850 2. I/B quote minimization: wikitext and html tags should not be combined
20851 !! options
20852 parsoid=html2wt
20853 !! wikitext
20854 ''A''<i>B</i>
20855
20856 ''A'''''<i>B</i>'''
20857 !! html
20858 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20859 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20860 !! end
20861
20862 !! test
20863 3. I/B quote minimization: templated content stops minimization
20864 !! options
20865 parsoid=html2wt
20866 !! wikitext
20867 ''A''{{echo|''B''}}
20868
20869 ''A''{{echo|'''''B'''''}}
20870 !! html
20871 <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>
20872 <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>
20873 !! end
20874
20875 !! test
20876 4. I/B quote minimization: new content should be mimimized with adjacent old content
20877 !! options
20878 parsoid=html2wt
20879 !! wikitext
20880 ''AB''
20881
20882 '''AB'''
20883
20884 ''A'''B'''''
20885 !! html
20886 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20887 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20888 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20889 !! end
20890
20891 #------------------------------------
20892 # End of I/B quote minimization tests
20893 #------------------------------------
20894
20895 !!test
20896 Bug 54262: New entities
20897 !! options
20898 parsoid=html2wt
20899 !! wikitext
20900 &nbsp;
20901 !! html
20902 <span typeof="mw:Entity">&nbsp;</span>
20903 !! end
20904
20905 ## Note that there is no wikitext output for 'unknownproperty' ##
20906 ## Unknown magic words are silently dropped ##
20907
20908 !! test
20909 Magic words
20910 !! options
20911 parsoid=html2wt
20912 !! wikitext
20913 __TOC__
20914 __NOTOC__
20915 __FORCETOC__
20916 __INDEX__
20917 __NOINDEX__
20918 __NOGALLERY__
20919 __NOEDITSECTION__
20920 __NOTITLECONVERT__
20921 __NOCONTENTCONVERT__
20922 !! html
20923 <meta property='mw:PageProp/toc' />
20924 <meta property='mw:PageProp/notoc' />
20925 <meta property='mw:PageProp/forcetoc' />
20926 <meta property='mw:PageProp/index' />
20927 <meta property='mw:PageProp/noindex' />
20928 <meta property='mw:PageProp/nogallery' />
20929 <meta property='mw:PageProp/noeditsection' />
20930 <meta property='mw:PageProp/notitleconvert' />
20931 <meta property='mw:PageProp/nocontentconvert' />
20932 <meta property='mw:PageProp/unknownproperty' />
20933 !! end
20934
20935 !! test
20936 Consecutive <pre>s should not get merged
20937 !! options
20938 parsoid=html2wt,html2html
20939 !! wikitext
20940 a
20941
20942 b
20943
20944 c
20945
20946 d
20947
20948 e
20949
20950
20951
20952 f
20953 !! html
20954 <pre>a</pre><pre>b</pre>
20955
20956 <pre>c
20957 </pre><pre>
20958 d</pre>
20959
20960 <pre>e
20961
20962 </pre><pre>
20963
20964 f</pre>
20965 !! end
20966
20967 !! test
20968 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20969 !! options
20970 parsoid=html2wt
20971 !! wikitext
20972 [[Special:BookSources/1234567890|ISBN 1234567895]]
20973 !! html
20974 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20975 !! end
20976
20977 !! test
20978 Edited RFC links not serializable as RFC links should serialize as extlinks
20979 !! options
20980 parsoid=html2wt
20981 !! wikitext
20982 [//tools.ietf.org/html/rfc123 New RFC]
20983 !! html
20984 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20985 !! end
20986
20987 !! test
20988 Edited PMID links not serializable as PMID links should serialize as extlinks
20989 !! options
20990 parsoid=html2wt
20991 !! wikitext
20992 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20993 !! html
20994 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20995 !! end
20996
20997 !! test
20998 Edited Redirect link should emit a non-piped wikitext link
20999 !! options
21000 parsoid=html2wt
21001 !! wikitext
21002 #REDIRECT [[Bar]]
21003 !! html
21004 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21005 !! end
21006
21007 # -----------------------------------------------------------------
21008 # End of section for Parsoid-only html2wt tests for serialization
21009 # of new content
21010 # -----------------------------------------------------------------
21011
21012 TODO:
21013 more images
21014 more tables
21015 character entities
21016 and much more
21017 Try for 100% code coverage