Sync up with Parsoid parserTests.
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Template:Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
59
60 !! article
61 Template:pipe
62 !! text
63 |
64 !! endarticle
65
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
71
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
77
78 !! article
79 Template:tbl-start
80 !! text
81 {|
82 !! endarticle
83
84 !! article
85 Template:tbl-end
86 !! text
87 |}
88 !! endarticle
89
90 !! article
91 Template:!
92 !! text
93 |
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 ###
159 ### Basic tests
160 ###
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
166
167
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
180 foo
181
182 bar
183
184
185 baz
186
187
188
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
194 baz
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
199
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
204 a
205 <!--foo-->
206 b
207 ----
208 a
209 <!--foo--><!--More than 1 comment, still stripped-->
210 b
211 ----
212 a
213 <!--foo--> <!----> <!-- bar -->
214 b
215 ----
216 a
217 <!--foo-->
218
219 b
220 ----
221 a
222
223 <!--foo-->
224 b
225 ----
226 a
227 <!--foo-->
228
229
230 b
231 ----
232 a
233
234
235 <!--foo-->
236 b
237 ----
238 !! html
239 <hr />
240 <p>a
241 b
242 </p>
243 <hr />
244 <p>a
245 b
246 </p>
247 <hr />
248 <p>a
249 b
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
262 b
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
267 b
268 </p>
269 <hr />
270
271 !! end
272
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
277 a
278
279 b
280 ----
281 a
282
283
284 b
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br />
294 b
295 </p>
296 <hr />
297
298 !! end
299
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
304 a
305 <!--foo-->
306 b
307 ----
308 a
309 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316 b
317 ----
318 a
319
320 <!--foo-->
321 <!--bar-->
322
323 b
324 ----
325 !! html
326 <hr />
327 <p>a
328 b
329 </p>
330 <hr />
331 <p>a
332 b
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br />
341 b
342 </p>
343 <hr />
344
345 !! end
346
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
350 a
351
352 <!--boo-->
353
354 b
355 !! html
356 <p>a
357 </p><p><br />
358 b
359 </p>
360 !!end
361
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
365 a
366
367
368
369 =b=
370 [[a]]
371
372
373 =b=
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
383
384 !! end
385
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
389 =b=
390
391
392
393 [[a]]
394 !! html
395 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
399
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
409
410 !! test
411 Simple list
412 !! wikitext
413 * Item 1
414 * Item 2
415 !! html
416 <ul><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 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6418 !! options
6419 language=ln
6420 !! wikitext
6421 [[WW&nbsp;II]]
6422 !! html
6423 <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>
6424 </p>
6425 !! end
6426
6427 !! test
6428 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6429 !! options
6430 parsoid=html2wt
6431 !! wikitext
6432 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6433
6434 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6435 !! html
6436 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6437 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6438 !! end
6439
6440 !! test
6441 Parsoid: handle constructor well
6442 !! options
6443 parsoid
6444 !! wikitext
6445 [[constructor]]
6446
6447 [[constructor:foo]]
6448 !! html
6449 <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>
6450
6451 <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>
6452 !! end
6453
6454 !! test
6455 Parsoid: recognize interlanguage links without a target page
6456 !! options
6457 parsoid
6458 !! wikitext
6459 [[ko:]]
6460 !! html
6461 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6462 !! end
6463
6464 !! test
6465 Parsoid: recognize interwiki links without a target page
6466 !! options
6467 parsoid
6468 !! wikitext
6469 [[:ko:]]
6470 !! html
6471 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6472 !! end
6473
6474 !! test
6475 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6476 !! options
6477 parsoid
6478 !! wikitext
6479 [[en:Foo]]
6480 !! html
6481 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6482 !! end
6483
6484 ###
6485 ### Redirects, Parsoid-only
6486 ###
6487 !! test
6488 1. Simple redirect to page
6489 !! options
6490 parsoid
6491 !! wikitext
6492 #REDIRECT [[Main Page]]
6493 !! html
6494 <link rel="mw:PageProp/redirect" href="./Main_Page">
6495 !! end
6496
6497 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6498 !! test
6499 2. Other redirect variants
6500 !! options
6501 parsoid=wt2html,wt2wt
6502 !! wikitext
6503 #REDIRECT [[Main_Page]]
6504 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6505 !! html
6506 <link rel="mw:PageProp/redirect" href="./Main_Page">
6507 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6508 !! end
6509
6510 !! test
6511 Empty redirect
6512 !! options
6513 parsoid=wt2html,wt2wt
6514 !! wikitext
6515 #REDIRECT [[]]
6516 !! html
6517 <ol>
6518 <li>REDIRECT [[]]</li></ol>
6519 !! end
6520
6521 !! test
6522 Optional colon in #REDIRECT
6523 !! options
6524 # the colon is archaic syntax. we support it for wt2html, but we
6525 # don't care that it roundtrips back to the modern syntax.
6526 parsoid=wt2html,html2html
6527 !! wikitext
6528 #REDIRECT:[[Main Page]]
6529 !! html
6530 <link rel="mw:PageProp/redirect" href="./Main_Page">
6531 !! end
6532
6533 !! test
6534 Whitespace in #REDIRECT with optional colon
6535 !! options
6536 # the colon and gratuitous whitespace is archaic syntax. we support
6537 # it for wt2html, but we don't care that it roundtrips back to the
6538 # modern syntax (without extra whitespace)
6539 parsoid=wt2html,html2html
6540 !! wikitext
6541
6542 #REDIRECT
6543 :
6544 [[Main Page]]
6545 !! html
6546 <link rel="mw:PageProp/redirect" href="./Main_Page">
6547 !! end
6548
6549 !! test
6550 Piped link in #REDIRECT
6551 !! options
6552 # content after piped link is ignored. we support this syntax,
6553 # but don't care that the piped link is lost when we roundtrip this.
6554 parsoid=wt2html
6555 !! wikitext
6556 #REDIRECT [[Main Page|bar]]
6557 !! html
6558 <link rel="mw:PageProp/redirect" href="./Main_Page">
6559 !! end
6560
6561 !! test
6562 Redirect to category
6563 !! options
6564 parsoid=wt2html
6565 !! wikitext
6566 #REDIRECT [[Category:Foo]]
6567 !! html
6568 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6569 !! end
6570
6571 !! test
6572 Redirect to category with URL encoding
6573 !! options
6574 parsoid=wt2html
6575 !! wikitext
6576 #REDIRECT [[Category%3AFoo]]
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 page
6583 !! options
6584 parsoid=wt2html,html2html
6585 !! wikitext
6586 #REDIRECT [[:Category:Foo]]
6587 !! html
6588 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6589 !! end
6590
6591 !! test
6592 Redirect to image page (1)
6593 !! options
6594 parsoid
6595 !! wikitext
6596 #REDIRECT [[File:Wiki.png]]
6597 !! html
6598 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6599 !! end
6600
6601 !! test
6602 Redirect to image page (2)
6603 !! options
6604 parsoid
6605 !! wikitext
6606 #REDIRECT [[Image:Wiki.png]]
6607 !! html
6608 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6609 !! end
6610
6611 !! test
6612 Redirect to language
6613 !! options
6614 parsoid
6615 !! wikitext
6616 #REDIRECT [[en:File:Wiki.png]]
6617 !! html
6618 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6619 !! end
6620
6621 !! test
6622 Redirect to interwiki
6623 !! options
6624 parsoid
6625 !! wikitext
6626 #REDIRECT [[meatball:File:Wiki.png]]
6627 !! html
6628 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6629 !! end
6630
6631 !! test
6632 Non-English #REDIRECT
6633 !! options
6634 parsoid
6635 language=is
6636 !! wikitext
6637 #TILVÍSUN [[Main Page]]
6638 !! html
6639 <link rel="mw:PageProp/redirect" href="./Main_Page">
6640 !! end
6641
6642 !! test
6643 New redirect
6644 !! options
6645 parsoid=html2wt
6646 !! wikitext
6647 Foo
6648 #REDIRECT [[Foo]]
6649 !! html
6650 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6651 !! end
6652
6653 ##
6654 ## XHTML tidiness
6655 ###
6656
6657 !! test
6658 <br> to <br />
6659 !! wikitext
6660 1<br>2<br />3
6661 !! html
6662 <p>1<br />2<br />3
6663 </p>
6664 !! end
6665
6666 !! test
6667 Broken br tag sanitization
6668 !! wikitext
6669 </br>
6670 !! html/php
6671 <p>&lt;/br&gt;
6672 </p>
6673 !! end
6674
6675 # TODO: Fix html2html mode (bug 51055)!
6676 !! test
6677 Parsoid: Broken br tag recognition
6678 !! options
6679 parsoid=wt2html
6680 !! wikitext
6681 </br>
6682
6683 <br/ >
6684 !! html/parsoid
6685 <p><br></p>
6686 <p><br/></p>
6687 !! end
6688
6689 !! test
6690 Incorrecly removing closing slashes from correctly formed XHTML
6691 !! wikitext
6692 <br style="clear:both;" />
6693 !! html
6694 <p><br style="clear:both;" />
6695 </p>
6696 !! end
6697
6698 !! test
6699 Failing to transform badly formed HTML into correct XHTML
6700 !! wikitext
6701 <br style="clear: left;">
6702 <br style="clear: right;">
6703 <br style="clear: both;">
6704 !! html
6705 <p><br style="clear: left;" />
6706 <br style="clear: right;" />
6707 <br style="clear: both;" />
6708 </p>
6709 !!end
6710
6711 !! test
6712 Handling html with a div self-closing tag
6713 !! wikitext
6714 <div title />
6715 <div title/>
6716 <div title/ >
6717 <div title=bar />
6718 <div title=bar/>
6719 <div title=bar/ >
6720 !! html
6721 <p>&lt;div title /&gt;
6722 &lt;div title/&gt;
6723 </p>
6724 <div>
6725 <p>&lt;div title=bar /&gt;
6726 &lt;div title=bar/&gt;
6727 </p>
6728 <div title="bar/"></div>
6729 </div>
6730
6731 !! end
6732
6733 !! test
6734 Handling html with a br self-closing tag
6735 !! wikitext
6736 <br title />
6737 <br title/>
6738 <br title/ >
6739 <br title=bar />
6740 <br title=bar/>
6741 <br title=bar/ >
6742 !! html
6743 <p><br title="title" />
6744 <br title="title" />
6745 <br />
6746 <br title="bar" />
6747 <br title="bar" />
6748 <br title="bar/" />
6749 </p>
6750 !! end
6751
6752 !! test
6753 Horizontal ruler (should it add that extra space?)
6754 !! wikitext
6755 <hr>
6756 <hr >
6757 foo <hr
6758 > bar
6759 !! html
6760 <hr />
6761 <hr />
6762 foo <hr /> bar
6763
6764 !! end
6765
6766 !! test
6767 Horizontal ruler -- 4+ dashes render hr
6768 !! wikitext
6769 ----
6770 !! html
6771 <hr />
6772
6773 !! end
6774
6775 !! test
6776 Horizontal ruler -- eats additional dashes on the same line
6777 !! wikitext
6778 ---------
6779 !! html
6780 <hr />
6781
6782 !! end
6783
6784 !! test
6785 Horizontal ruler -- does not collapse dashes on consecutive lines
6786 !! wikitext
6787 ----
6788 ----
6789 !! html
6790 <hr />
6791 <hr />
6792
6793 !! end
6794
6795 !! test
6796 Horizontal ruler -- <4 dashes render as plain text
6797 !! wikitext
6798 ---
6799 !! html
6800 <p>---
6801 </p>
6802 !! end
6803
6804 !! test
6805 Horizontal ruler -- Supports content following dashes on same line
6806 !! wikitext
6807 ---- Foo
6808 !! html
6809 <hr /> Foo
6810
6811 !! end
6812
6813 ###
6814 ### Block-level elements
6815 ###
6816 !! test
6817 Common list
6818 !! wikitext
6819 *Common list
6820 * item 2
6821 *item 3
6822 !! html
6823 <ul><li>Common list</li>
6824 <li> item 2</li>
6825 <li>item 3</li></ul>
6826
6827 !! end
6828
6829 !! test
6830 Numbered list
6831 !! wikitext
6832 #Numbered list
6833 #item 2
6834 # item 3
6835 !! html
6836 <ol><li>Numbered list</li>
6837 <li>item 2</li>
6838 <li> item 3</li></ol>
6839
6840 !! end
6841
6842 !! test
6843 Mixed list
6844 !! wikitext
6845 *Mixed list
6846 *# with numbers
6847 ** and bullets
6848 *# and numbers
6849 *bullets again
6850 **bullet level 2
6851 ***bullet level 3
6852 ***#Number on level 4
6853 **bullet level 2
6854 **#Number on level 3
6855 **#Number on level 3
6856 *#number level 2
6857 *Level 1
6858 *** Level 3
6859 #** Level 3, but ordered
6860 !! html
6861 <ul><li>Mixed list
6862 <ol><li> with numbers</li></ol>
6863 <ul><li> and bullets</li></ul>
6864 <ol><li> and numbers</li></ol></li>
6865 <li>bullets again
6866 <ul><li>bullet level 2
6867 <ul><li>bullet level 3
6868 <ol><li>Number on level 4</li></ol></li></ul></li>
6869 <li>bullet level 2
6870 <ol><li>Number on level 3</li>
6871 <li>Number on level 3</li></ol></li></ul>
6872 <ol><li>number level 2</li></ol></li>
6873 <li>Level 1
6874 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6875 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6876
6877 !! end
6878
6879 !! test
6880 Nested lists 1
6881 !! wikitext
6882 *foo
6883 **bar
6884 !! html
6885 <ul><li>foo
6886 <ul><li>bar</li></ul></li></ul>
6887
6888 !! end
6889
6890 !! test
6891 Nested lists 2
6892 !! wikitext
6893 **foo
6894 *bar
6895 !! html
6896 <ul><li><ul><li>foo</li></ul></li>
6897 <li>bar</li></ul>
6898
6899 !! end
6900
6901 !! test
6902 Nested lists 3 (first element empty)
6903 !! wikitext
6904 *
6905 **bar
6906 !! html
6907 <ul><li>
6908 <ul><li>bar</li></ul></li></ul>
6909
6910 !! end
6911
6912 !! test
6913 Nested lists 4 (first element empty)
6914 !! wikitext
6915 **
6916 *bar
6917 !! html
6918 <ul><li><ul><li></li></ul></li>
6919 <li>bar</li></ul>
6920
6921 !! end
6922
6923 !! test
6924 Nested lists 5 (both elements empty)
6925 !! wikitext
6926 **
6927 *
6928 !! html
6929 <ul><li><ul><li></li></ul></li>
6930 <li></li></ul>
6931
6932 !! end
6933
6934 !! test
6935 Nested lists 6 (both elements empty)
6936 !! wikitext
6937 *
6938 **
6939 !! html
6940 <ul><li>
6941 <ul><li></li></ul></li></ul>
6942
6943 !! end
6944
6945 !! test
6946 Nested lists 7 (skip initial nesting levels)
6947 !! wikitext
6948 *** foo
6949 !! html
6950 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6951
6952 !! end
6953
6954 !! test
6955 Nested lists 8 (multiple nesting transitions)
6956 !! wikitext
6957 * foo
6958 *** bar
6959 ** baz
6960 * boo
6961 !! html
6962 <ul><li> foo
6963 <ul><li><ul><li> bar</li></ul></li>
6964 <li> baz</li></ul></li>
6965 <li> boo</li></ul>
6966
6967 !! end
6968
6969 !! test
6970 1. Lists with start-of-line-transparent tokens before bullets: Comments
6971 !! wikitext
6972 *foo
6973 *<!--cmt-->bar
6974 <!--cmt-->*baz
6975 !! html
6976 <ul><li>foo</li>
6977 <li>bar</li>
6978 <li>baz</li></ul>
6979
6980 !! end
6981
6982 !! test
6983 2. Lists with start-of-line-transparent tokens before bullets: Template close
6984 !! wikitext
6985 *foo {{echo|bar
6986 }}*baz
6987 !! html
6988 <ul><li>foo bar</li>
6989 <li>baz</li></ul>
6990
6991 !! end
6992
6993 !! test
6994 List items are not parsed correctly following a <pre> block (bug 785)
6995 !! wikitext
6996 * <pre>foo</pre>
6997 * <pre>bar</pre>
6998 * zar
6999 !! html
7000 <ul><li> <pre>foo</pre></li>
7001 <li> <pre>bar</pre></li>
7002 <li> zar</li></ul>
7003
7004 !! end
7005
7006 !! test
7007 List items from template
7008 !! wikitext
7009
7010 {{inner list}}
7011 * item 2
7012
7013 * item 0
7014 {{inner list}}
7015 * item 2
7016
7017 * item 0
7018 * notSOL{{inner list}}
7019 * item 2
7020 !! html
7021 <ul><li> item 1</li>
7022 <li> item 2</li></ul>
7023 <ul><li> item 0</li>
7024 <li> item 1</li>
7025 <li> item 2</li></ul>
7026 <ul><li> item 0</li>
7027 <li> notSOL</li>
7028 <li> item 1</li>
7029 <li> item 2</li></ul>
7030
7031 !! end
7032
7033 !! test
7034 List interrupted by empty line or heading
7035 !! wikitext
7036 * foo
7037
7038 ** bar
7039 == A heading ==
7040 * Another list item
7041 !! html
7042 <ul><li> foo</li></ul>
7043 <ul><li><ul><li> bar</li></ul></li></ul>
7044 <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>
7045 <ul><li> Another list item</li></ul>
7046
7047 !!end
7048
7049 !!test
7050 Multiple list tags generated by templates
7051 !! wikitext
7052 {{echo|<li>}}a
7053 {{echo|<li>}}b
7054 {{echo|<li>}}c
7055 !! html
7056 <li>a
7057 <li>b
7058 <li>c</li>
7059 </li>
7060 </li>
7061
7062 !!end
7063
7064 !!test
7065 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7066 !! wikitext
7067 *a
7068 <!--This line will NOT split the list-->
7069 *b
7070 <!--This line will NOT split the list either-->
7071 *c
7072 <!--foo--> <!----> <!--This line NOT split the list either-->
7073 *d
7074 !! html
7075 <ul><li>a</li>
7076 <li>b</li>
7077 <li>c</li>
7078 <li>d</li></ul>
7079
7080 !!end
7081
7082 !!test
7083 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7084 !! wikitext
7085 *a
7086 <!--This line will NOT split the list-->
7087 *b
7088 <!--This line will NOT split the list either-->
7089 *c
7090 <!--foo--> <!----> <!--This line NOT split the list
7091 either-->
7092 *d
7093 !! html
7094 <ul><li>a</li>
7095 <li>b</li>
7096 <li>c</li>
7097 <li>d</li></ul>
7098
7099 !!end
7100
7101 !!test
7102 Test the li-hack
7103 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7104 !!options
7105 parsoid=wt2html,wt2wt
7106 !! wikitext
7107 * foo
7108 * <li>li-hack
7109 * {{echo|<li>templated li-hack}}
7110 * <!--foo--> <li> unsupported li-hack with preceding comments
7111
7112 <ul>
7113 <li><li>not a li-hack
7114 </li>
7115 </ul>
7116 !! html
7117 <ul>
7118 <li> foo</li>
7119 <li>li-hack</li>
7120 <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>
7121 <li> <!--foo--> </li>
7122 <li> li-hack with preceding comments</li>
7123 </ul>
7124
7125 <ul>
7126 <li></li>
7127 <li>not a li-hack
7128 </li>
7129 </ul>
7130 !!end
7131
7132 !! test
7133 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7134 !! options
7135 parsoid
7136 !! wikitext
7137 # foo
7138 ## bar
7139 * foo
7140 ** bar
7141 : foo
7142 :: bar
7143 !! html
7144 <ol>
7145 <li> foo<ol>
7146 <li> bar</li>
7147 </ol></li>
7148 </ol><ul>
7149 <li> foo<ul>
7150 <li> bar</li>
7151 </ul></li>
7152 </ul><dl>
7153 <dd> foo<dl>
7154 <dd> bar</dd>
7155 </dl></dd>
7156 </dl>
7157 !! end
7158
7159 !! test
7160 Parsoid: Test of whitespace serialization with Templated bullets
7161 !! options
7162 parsoid
7163 !! wikitext
7164 * {{bullet}}
7165 !! html
7166 <ul>
7167 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7168 </ul>
7169 !! end
7170
7171 # ------------------------------------------------------------------------
7172 # The next set of tests are about Parsoid's ability to handle badly nested
7173 # tags (parse, minimize scope of fixup, and roundtrip back)
7174 # ------------------------------------------------------------------------
7175
7176 !! test
7177 Unbalanced closing block tags break a list
7178 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7179 !! wikitext
7180 <div>
7181 *a</div><div>
7182 *b</div>
7183 !! html/parsoid
7184 <div>
7185 <ul>
7186 <li>a
7187 </li>
7188 </ul></div><div>
7189 <ul>
7190 <li>b
7191 </li>
7192 </ul></div>
7193 !! end
7194
7195 !! test
7196 Unbalanced closing non-block tags don't break a list
7197 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7198 !! wikitext
7199 <span>
7200 *a</span><span>
7201 *b</span>
7202 !! html/parsoid
7203 <p><span></span>
7204 </p>
7205 <ul>
7206 <li>a<span></span>
7207 </li>
7208 <li>b
7209 </li>
7210 </ul>
7211 !! end
7212
7213 !! test
7214 Unclosed formatting tags that straddle lists are closed and reopened
7215 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7216 !! wikitext
7217 # <s> a
7218 # b </s>
7219 !! html/parsoid
7220 <ol>
7221 <li> <s> a </s>
7222 </li>
7223 <li> <s> b </s>
7224 </li>
7225 </ol>
7226 !! end
7227
7228 !!test
7229 List embedded in a non-block tag
7230 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7231 !! wikitext
7232 <small>
7233 * foo
7234 </small>
7235 !! html/parsoid
7236 <p><small></small></p>
7237 <small>
7238 <ul>
7239 <li> foo</li>
7240 </ul>
7241 </small>
7242 <p><small></small></p>
7243 !!end
7244
7245 !! test
7246 Table with missing opening <tr> tag
7247 !! options
7248 parsoid=wt2html,wt2wt
7249 !! wikitext
7250 <table>
7251 <td>foo</td>
7252 </tr>
7253 </table>
7254 !! html/parsoid
7255 <table>
7256 <tr>
7257 <td>foo</td>
7258 </tr>
7259 </table>
7260 !! end
7261
7262 ###
7263 ### Magic Words
7264 ###
7265
7266 # Note that the current date is hard-coded as
7267 # 1970-01-01T00:02:03Z (a Thursday)
7268 # when running parser tests. The timezone is also fixed to GMT, so
7269 # local date will be identical to current date.
7270
7271 !! test
7272 Magic Word: {{CURRENTDAY}}
7273 !! wikitext
7274 {{CURRENTDAY}}
7275 !! html
7276 <p>1
7277 </p>
7278 !! end
7279
7280 !! test
7281 Magic Word: {{CURRENTDAY2}}
7282 !! wikitext
7283 {{CURRENTDAY2}}
7284 !! html
7285 <p>01
7286 </p>
7287 !! end
7288
7289 !! test
7290 Magic Word: {{CURRENTDAYNAME}}
7291 !! wikitext
7292 {{CURRENTDAYNAME}}
7293 !! html
7294 <p>Thursday
7295 </p>
7296 !! end
7297
7298 !! test
7299 Magic Word: {{CURRENTDOW}}
7300 !! wikitext
7301 {{CURRENTDOW}}
7302 !! html
7303 <p>4
7304 </p>
7305 !! end
7306
7307 !! test
7308 Magic Word: {{CURRENTMONTH}}
7309 !! wikitext
7310 {{CURRENTMONTH}}
7311 !! html
7312 <p>01
7313 </p>
7314 !! end
7315
7316 !! test
7317 Magic Word: {{CURRENTMONTH1}}
7318 !! wikitext
7319 {{CURRENTMONTH1}}
7320 !! html
7321 <p>1
7322 </p>
7323 !! end
7324
7325 !! test
7326 Magic Word: {{CURRENTMONTHABBREV}}
7327 !! wikitext
7328 {{CURRENTMONTHABBREV}}
7329 !! html
7330 <p>Jan
7331 </p>
7332 !! end
7333
7334 !! test
7335 Magic Word: {{CURRENTMONTHNAME}}
7336 !! wikitext
7337 {{CURRENTMONTHNAME}}
7338 !! html
7339 <p>January
7340 </p>
7341 !! end
7342
7343 !! test
7344 Magic Word: {{CURRENTMONTHNAMEGEN}}
7345 !! wikitext
7346 {{CURRENTMONTHNAMEGEN}}
7347 !! html
7348 <p>January
7349 </p>
7350 !! end
7351
7352 !! test
7353 Magic Word: {{CURRENTTIME}}
7354 !! wikitext
7355 {{CURRENTTIME}}
7356 !! html
7357 <p>00:02
7358 </p>
7359 !! end
7360
7361 !! test
7362 Magic Word: {{CURRENTHOUR}}
7363 !! wikitext
7364 {{CURRENTHOUR}}
7365 !! html
7366 <p>00
7367 </p>
7368 !! end
7369
7370 !! test
7371 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7372 !! wikitext
7373 {{CURRENTWEEK}}
7374 !! html
7375 <p>1
7376 </p>
7377 !! end
7378
7379 !! test
7380 Magic Word: {{CURRENTYEAR}}
7381 !! wikitext
7382 {{CURRENTYEAR}}
7383 !! html
7384 <p>1970
7385 </p>
7386 !! end
7387
7388 !! test
7389 Magic Word: {{CURRENTTIMESTAMP}}
7390 !! wikitext
7391 {{CURRENTTIMESTAMP}}
7392 !! html
7393 <p>19700101000203
7394 </p>
7395 !! end
7396
7397 !! test
7398 Magic Words LOCAL (UTC)
7399 !! wikitext
7400 * {{LOCALMONTH}}
7401 * {{LOCALMONTH1}}
7402 * {{LOCALMONTHNAME}}
7403 * {{LOCALMONTHNAMEGEN}}
7404 * {{LOCALMONTHABBREV}}
7405 * {{LOCALDAY}}
7406 * {{LOCALDAY2}}
7407 * {{LOCALDAYNAME}}
7408 * {{LOCALYEAR}}
7409 * {{LOCALTIME}}
7410 * {{LOCALHOUR}}
7411 * {{LOCALWEEK}}
7412 * {{LOCALDOW}}
7413 * {{LOCALTIMESTAMP}}
7414 !! html
7415 <ul><li> 01</li>
7416 <li> 1</li>
7417 <li> January</li>
7418 <li> January</li>
7419 <li> Jan</li>
7420 <li> 1</li>
7421 <li> 01</li>
7422 <li> Thursday</li>
7423 <li> 1970</li>
7424 <li> 00:02</li>
7425 <li> 00</li>
7426 <li> 1</li>
7427 <li> 4</li>
7428 <li> 19700101000203</li></ul>
7429
7430 !! end
7431
7432 !! test
7433 Magic Word: {{FULLPAGENAME}}
7434 !! options
7435 title=[[User:Ævar Arnfjörð Bjarmason]]
7436 !! wikitext
7437 {{FULLPAGENAME}}
7438 !! html
7439 <p>User:Ævar Arnfjörð Bjarmason
7440 </p>
7441 !! end
7442
7443 !! test
7444 Magic Word: {{FULLPAGENAMEE}}
7445 !! options
7446 title=[[User:Ævar Arnfjörð Bjarmason]]
7447 !! wikitext
7448 {{FULLPAGENAMEE}}
7449 !! html
7450 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7451 </p>
7452 !! end
7453
7454 !! test
7455 Magic Word: {{TALKSPACE}}
7456 !! options
7457 title=[[User:Ævar Arnfjörð Bjarmason]]
7458 !! wikitext
7459 {{TALKSPACE}}
7460 !! html
7461 <p>User talk
7462 </p>
7463 !! end
7464
7465 !! test
7466 Magic Word: {{TALKSPACE}}, same namespace
7467 !! options
7468 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7469 !! wikitext
7470 {{TALKSPACE}}
7471 !! html
7472 <p>User talk
7473 </p>
7474 !! end
7475
7476 !! test
7477 Magic Word: {{TALKSPACE}}, main namespace
7478 !! options
7479 title=[[Parser Test]]
7480 !! wikitext
7481 {{TALKSPACE}}
7482 !! html
7483 <p>Talk
7484 </p>
7485 !! end
7486
7487 !! test
7488 Magic Word: {{TALKSPACEE}}
7489 !! options
7490 title=[[User:Ævar Arnfjörð Bjarmason]]
7491 !! wikitext
7492 {{TALKSPACEE}}
7493 !! html
7494 <p>User_talk
7495 </p>
7496 !! end
7497
7498 !! test
7499 Magic Word: {{SUBJECTSPACE}}
7500 !! options
7501 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7502 !! wikitext
7503 {{SUBJECTSPACE}}
7504 !! html
7505 <p>User
7506 </p>
7507 !! end
7508
7509 !! test
7510 Magic Word: {{SUBJECTSPACE}}, same namespace
7511 !! options
7512 title=[[User:Ævar Arnfjörð Bjarmason]]
7513 !! wikitext
7514 {{SUBJECTSPACE}}
7515 !! html
7516 <p>User
7517 </p>
7518 !! end
7519
7520 !! test
7521 Magic Word: {{SUBJECTSPACE}}, main namespace
7522 !! options
7523 title=[[Parser Test]]
7524 !! wikitext
7525 {{SUBJECTSPACE}}
7526 !! html
7527
7528 !! end
7529
7530 !! test
7531 Magic Word: {{SUBJECTSPACEE}}
7532 !! options
7533 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7534 !! wikitext
7535 {{SUBJECTSPACEE}}
7536 !! html
7537 <p>User
7538 </p>
7539 !! end
7540
7541 !! test
7542 Magic Word: {{NAMESPACE}}
7543 !! options
7544 title=[[User:Ævar Arnfjörð Bjarmason]]
7545 !! wikitext
7546 {{NAMESPACE}}
7547 !! html
7548 <p>User
7549 </p>
7550 !! end
7551
7552 !! test
7553 Magic Word: {{NAMESPACEE}}
7554 !! options
7555 title=[[User:Ævar Arnfjörð Bjarmason]]
7556 !! wikitext
7557 {{NAMESPACEE}}
7558 !! html
7559 <p>User
7560 </p>
7561 !! end
7562
7563 !! test
7564 Magic Word: {{NAMESPACENUMBER}}
7565 !! options
7566 title=[[User:Ævar Arnfjörð Bjarmason]]
7567 !! wikitext
7568 {{NAMESPACENUMBER}}
7569 !! html
7570 <p>2
7571 </p>
7572 !! end
7573
7574 !! test
7575 Magic Word: {{SUBPAGENAME}}
7576 !! options
7577 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7578 !! wikitext
7579 {{SUBPAGENAME}}
7580 !! html
7581 <p>sub ö
7582 </p>
7583 !! end
7584
7585 !! test
7586 Magic Word: {{SUBPAGENAMEE}}
7587 !! options
7588 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7589 !! wikitext
7590 {{SUBPAGENAMEE}}
7591 !! html
7592 <p>sub_%C3%B6
7593 </p>
7594 !! end
7595
7596 !! test
7597 Magic Word: {{ROOTPAGENAME}}
7598 !! options
7599 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7600 !! wikitext
7601 {{ROOTPAGENAME}}
7602 !! html
7603 <p>Ævar Arnfjörð Bjarmason
7604 </p>
7605 !! end
7606
7607 !! test
7608 Magic Word: {{ROOTPAGENAMEE}}
7609 !! options
7610 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7611 !! wikitext
7612 {{ROOTPAGENAMEE}}
7613 !! html
7614 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7615 </p>
7616 !! end
7617
7618 !! test
7619 Magic Word: {{BASEPAGENAME}}
7620 !! options
7621 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7622 !! wikitext
7623 {{BASEPAGENAME}}
7624 !! html
7625 <p>Ævar Arnfjörð Bjarmason
7626 </p>
7627 !! end
7628
7629 !! test
7630 Magic Word: {{BASEPAGENAMEE}}
7631 !! options
7632 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7633 !! wikitext
7634 {{BASEPAGENAMEE}}
7635 !! html
7636 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7637 </p>
7638 !! end
7639
7640 !! test
7641 Magic Word: {{TALKPAGENAME}}
7642 !! options
7643 title=[[User:Ævar Arnfjörð Bjarmason]]
7644 !! wikitext
7645 {{TALKPAGENAME}}
7646 !! html
7647 <p>User talk:Ævar Arnfjörð Bjarmason
7648 </p>
7649 !! end
7650
7651 !! test
7652 Magic Word: {{TALKPAGENAMEE}}
7653 !! options
7654 title=[[User:Ævar Arnfjörð Bjarmason]]
7655 !! wikitext
7656 {{TALKPAGENAMEE}}
7657 !! html
7658 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7659 </p>
7660 !! end
7661
7662 !! test
7663 Magic Word: {{SUBJECTPAGENAME}}
7664 !! options
7665 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7666 !! wikitext
7667 {{SUBJECTPAGENAME}}
7668 !! html
7669 <p>User:Ævar Arnfjörð Bjarmason
7670 </p>
7671 !! end
7672
7673 !! test
7674 Magic Word: {{SUBJECTPAGENAMEE}}
7675 !! options
7676 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7677 !! wikitext
7678 {{SUBJECTPAGENAMEE}}
7679 !! html
7680 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7681 </p>
7682 !! end
7683
7684 !! test
7685 Magic Word: {{NUMBEROFFILES}}
7686 !! wikitext
7687 {{NUMBEROFFILES}}
7688 !! html
7689 <p>5
7690 </p>
7691 !! end
7692
7693 !! test
7694 Magic Word: {{PAGENAME}}
7695 !! options
7696 title=[[User:Ævar Arnfjörð Bjarmason]]
7697 !! wikitext
7698 {{PAGENAME}}
7699 !! html
7700 <p>Ævar Arnfjörð Bjarmason
7701 </p>
7702 !! end
7703
7704 !! test
7705 Magic Word: {{PAGENAME}} with metacharacters
7706 !! options
7707 title=[['foo & bar = baz']]
7708 !! wikitext
7709 ''{{PAGENAME}}''
7710 !! html
7711 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7712 </p>
7713 !! end
7714
7715 !! test
7716 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7717 !! options
7718 title=[[*RFC 1234 http://example.com/]]
7719 !! wikitext
7720 {{PAGENAME}}
7721 !! html
7722 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7723 </p>
7724 !! end
7725
7726 !! test
7727 Magic Word: {{PAGENAMEE}}
7728 !! options
7729 title=[[User:Ævar Arnfjörð Bjarmason]]
7730 !! wikitext
7731 {{PAGENAMEE}}
7732 !! html
7733 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7734 </p>
7735 !! end
7736
7737 !! test
7738 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7739 !! options
7740 title=[[*RFC 1234 http://example.com/]]
7741 !! wikitext
7742 {{PAGENAMEE}}
7743 !! html
7744 <p>&#42;RFC_1234_http&#58;//example.com/
7745 </p>
7746 !! end
7747
7748 !! test
7749 Magic Word: {{REVISIONID}}
7750 !! wikitext
7751 {{REVISIONID}}
7752 !! html
7753 <p>1337
7754 </p>
7755 !! end
7756
7757 !! test
7758 Magic Word: {{SCRIPTPATH}}
7759 !! wikitext
7760 {{SCRIPTPATH}}
7761 !! html
7762 <p>/
7763 </p>
7764 !! end
7765
7766 !! test
7767 Magic Word: {{STYLEPATH}}
7768 !! wikitext
7769 {{STYLEPATH}}
7770 !! html
7771 <p>/skins
7772 </p>
7773 !! end
7774
7775 !! test
7776 Magic Word: {{SERVER}}
7777 !! wikitext
7778 {{SERVER}}
7779 !! html
7780 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Magic Word: {{SERVERNAME}}
7786 !! wikitext
7787 {{SERVERNAME}}
7788 !! html
7789 <p>example.org
7790 </p>
7791 !! end
7792
7793 !! test
7794 Magic Word: {{SITENAME}}
7795 !! wikitext
7796 {{SITENAME}}
7797 !! html
7798 <p>MediaWiki
7799 </p>
7800 !! end
7801
7802 !! test
7803 Case-sensitive magic words, when cased differently, should just be template transclusions
7804 !! wikitext
7805 {{CurrentMonth}}
7806 {{currentday}}
7807 {{cURreNTweEK}}
7808 {{currentHour}}
7809 !! html
7810 <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>
7811 <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>
7812 <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>
7813 <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>
7814 </p>
7815 !! end
7816
7817 !! test
7818 Case-insensitive magic words should still work with weird casing.
7819 !! wikitext
7820 {{sErVeRNaMe}}
7821 {{LCFirst:AOEU}}
7822 {{ucFIRST:aoeu}}
7823 {{SERver}}
7824 !! html
7825 <p>example.org
7826 aOEU
7827 Aoeu
7828 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7829 </p>
7830 !! end
7831
7832 !! test
7833 Namespace 1 {{ns:1}}
7834 !! wikitext
7835 {{ns:1}}
7836 !! html
7837 <p>Talk
7838 </p>
7839 !! end
7840
7841 !! test
7842 Namespace 1 {{ns:01}}
7843 !! wikitext
7844 {{ns:01}}
7845 !! html
7846 <p>Talk
7847 </p>
7848 !! end
7849
7850 !! test
7851 Namespace 0 {{ns:0}} (bug 4783)
7852 !! wikitext
7853 {{ns:0}}
7854 !! html
7855
7856 !! end
7857
7858 !! test
7859 Namespace 0 {{ns:00}} (bug 4783)
7860 !! wikitext
7861 {{ns:00}}
7862 !! html
7863
7864 !! end
7865
7866 !! test
7867 Namespace -1 {{ns:-1}}
7868 !! wikitext
7869 {{ns:-1}}
7870 !! html
7871 <p>Special
7872 </p>
7873 !! end
7874
7875 !! test
7876 Namespace User {{ns:User}}
7877 !! wikitext
7878 {{ns:User}}
7879 !! html
7880 <p>User
7881 </p>
7882 !! end
7883
7884 !! test
7885 Namespace User talk {{ns:User_talk}}
7886 !! wikitext
7887 {{ns:User_talk}}
7888 !! html
7889 <p>User talk
7890 </p>
7891 !! end
7892
7893 !! test
7894 Namespace User talk {{ns:uSeR tAlK}}
7895 !! wikitext
7896 {{ns:uSeR tAlK}}
7897 !! html
7898 <p>User talk
7899 </p>
7900 !! end
7901
7902 !! test
7903 Namespace File {{ns:File}}
7904 !! wikitext
7905 {{ns:File}}
7906 !! html
7907 <p>File
7908 </p>
7909 !! end
7910
7911 !! test
7912 Namespace File {{ns:Image}}
7913 !! wikitext
7914 {{ns:Image}}
7915 !! html
7916 <p>File
7917 </p>
7918 !! end
7919
7920 !! test
7921 Namespace (lang=de) Benutzer {{ns:User}}
7922 !! options
7923 language=de
7924 !! wikitext
7925 {{ns:User}}
7926 !! html
7927 <p>Benutzer
7928 </p>
7929 !! end
7930
7931 !! test
7932 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7933 !! options
7934 language=de
7935 !! wikitext
7936 {{ns:3}}
7937 !! html
7938 <p>Benutzer Diskussion
7939 </p>
7940 !! end
7941
7942
7943 !! test
7944 Urlencode
7945 !! wikitext
7946 {{urlencode:hi world?!}}
7947 {{urlencode:hi world?!|WIKI}}
7948 {{urlencode:hi world?!|PATH}}
7949 {{urlencode:hi world?!|QUERY}}
7950 !! html
7951 <p>hi+world%3F%21
7952 hi_world%3F!
7953 hi%20world%3F%21
7954 hi+world%3F%21
7955 </p>
7956 !! end
7957
7958 !! test
7959 Magic Word: prioritize type info over data-parsoid
7960 !! options
7961 parsoid=html2wt
7962 !! wikitext
7963 __FORCETOC__
7964 !! html
7965 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7966 !! end
7967
7968 !! test
7969 Magic Word: serialize on separate line (parsoid)
7970 !! options
7971 parsoid=wt2wt,html2wt
7972 !! wikitext
7973 foo
7974 __NOTOC__
7975 bar
7976 !! html
7977 foo<meta property="mw:PageProp/notoc"/>bar
7978 !! end
7979
7980 !! test
7981 Magic Word: rt non-english wikis
7982 !! options
7983 parsoid=wt2wt
7984 language=de
7985 !! wikitext
7986 __NOEDITSECTION__
7987 !! html
7988 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7989 !! end
7990
7991 ###
7992 ### Magic links
7993 ###
7994 !! test
7995 Magic links: internal link to RFC (bug 479)
7996 !! wikitext
7997 [[RFC 123]]
7998 !! html
7999 <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>
8000 </p>
8001 !! end
8002
8003 !! test
8004 Magic links: RFC (bug 479)
8005 !! wikitext
8006 RFC 822
8007 !! html
8008 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8009 </p>
8010 !! end
8011
8012 !! test
8013 Magic links: ISBN (bug 1937)
8014 !! wikitext
8015 ISBN 0-306-40615-2
8016 !! html
8017 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8018 </p>
8019 !! end
8020
8021 !! test
8022 Magic links: PMID incorrectly converts space to underscore
8023 !! wikitext
8024 PMID 1234
8025 !! html
8026 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8027 </p>
8028 !! end
8029
8030 ###
8031 ### Templates
8032 ####
8033
8034 !! test
8035 Nonexistent template
8036 !! wikitext
8037 {{thistemplatedoesnotexist}}
8038 !! html
8039 <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>
8040 </p>
8041 !! end
8042
8043 !! test
8044 Template with invalid target containing tags
8045 !! wikitext
8046 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8047 !! html
8048 <p>{{a<b>b</b>|foo|a=b|a = b}}
8049 </p>
8050 !! end
8051
8052 !! test
8053 Template with invalid target containing unclosed tag
8054 !! wikitext
8055 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8056 !! html
8057 <p>{{a<b>|foo|a=b|a = b}}</b>
8058 </p>
8059 !! end
8060
8061 !! test
8062 Template with invalid target containing wikilink
8063 !! wikitext
8064 {{[[Main Page]]}}
8065 !! html/php
8066 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8067 </p>
8068 !! html/parsoid
8069 <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>
8070 !! end
8071
8072 !! article
8073 Template:test
8074 !! text
8075 This is a test template
8076 !! endarticle
8077
8078 !! test
8079 Simple template
8080 !! wikitext
8081 {{test}}
8082 !! html
8083 <p>This is a test template
8084 </p>
8085 !! end
8086
8087 !! test
8088 Template with explicit namespace
8089 !! wikitext
8090 {{Template:test}}
8091 !! html
8092 <p>This is a test template
8093 </p>
8094 !! end
8095
8096
8097 !! article
8098 Template:paramtest
8099 !! text
8100 This is a test template with parameter {{{param}}}
8101 !! endarticle
8102
8103 !! test
8104 Template parameter
8105 !! wikitext
8106 {{paramtest|param=foo}}
8107 !! html
8108 <p>This is a test template with parameter foo
8109 </p>
8110 !! end
8111
8112 !! article
8113 Template:paramtestnum
8114 !! text
8115 [[{{{1}}}|{{{2}}}]]
8116 !! endarticle
8117
8118 !! test
8119 Template unnamed parameter
8120 !! wikitext
8121 {{paramtestnum|Main Page|the main page}}
8122 !! html
8123 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8124 </p>
8125 !! end
8126
8127 !! article
8128 Template:templatesimple
8129 !! text
8130 (test)
8131 !! endarticle
8132
8133 !! article
8134 Template:templateredirect
8135 !! text
8136 #redirect [[Template:templatesimple]]
8137 !! endarticle
8138
8139 !! article
8140 Template:templateasargtestnum
8141 !! text
8142 {{{{{1}}}}}
8143 !! endarticle
8144
8145 !! article
8146 Template:templateasargtest
8147 !! text
8148 {{template{{{templ}}}}}
8149 !! endarticle
8150
8151 !! article
8152 Template:templateasargtest2
8153 !! text
8154 {{{{{templ}}}}}
8155 !! endarticle
8156
8157 !! test
8158 Template with template name as unnamed argument
8159 !! wikitext
8160 {{templateasargtestnum|templatesimple}}
8161 !! html
8162 <p>(test)
8163 </p>
8164 !! end
8165
8166 !! test
8167 Template with template name as argument
8168 !! wikitext
8169 {{templateasargtest|templ=simple}}
8170 !! html
8171 <p>(test)
8172 </p>
8173 !! end
8174
8175 !! test
8176 Template with template name as argument (2)
8177 !! wikitext
8178 {{templateasargtest2|templ=templatesimple}}
8179 !! html
8180 <p>(test)
8181 </p>
8182 !! end
8183
8184 !! article
8185 Template:templateasargtestdefault
8186 !! text
8187 {{{{{templ|templatesimple}}}}}
8188 !! endarticle
8189
8190 !! article
8191 Template:templa
8192 !! text
8193 '''templ'''
8194 !! endarticle
8195
8196 !! test
8197 Template with default value
8198 !! wikitext
8199 {{templateasargtestdefault}}
8200 !! html
8201 <p>(test)
8202 </p>
8203 !! end
8204
8205 !! test
8206 Template with default value (value set)
8207 !! wikitext
8208 {{templateasargtestdefault|templ=templa}}
8209 !! html
8210 <p><b>templ</b>
8211 </p>
8212 !! end
8213
8214 !! test
8215 Template redirect
8216 !! wikitext
8217 {{templateredirect}}
8218 !! html
8219 <p>(test)
8220 </p>
8221 !! end
8222
8223 !! test
8224 Template with argument in separate line
8225 !! wikitext
8226 {{ templateasargtest |
8227 templ = simple }}
8228 !! html
8229 <p>(test)
8230 </p>
8231 !! end
8232
8233 !! test
8234 Template with complex template as argument
8235 !! wikitext
8236 {{paramtest|
8237 param ={{ templateasargtest |
8238 templ = simple }}}}
8239 !! html
8240 <p>This is a test template with parameter (test)
8241 </p>
8242 !! end
8243
8244 !! test
8245 Template with thumb image (with link in description)
8246 !! wikitext
8247 {{paramtest|
8248 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8249 !! html
8250 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>
8251
8252 !! end
8253
8254 !! article
8255 Template:complextemplate
8256 !! text
8257 {{{1}}} {{paramtest|
8258 param ={{{param}}}}}
8259 !! endarticle
8260
8261 !! test
8262 Template with complex arguments
8263 !! wikitext
8264 {{complextemplate|
8265 param ={{ templateasargtest |
8266 templ = simple }}|[[Template:complextemplate|link]]}}
8267 !! html
8268 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8269 </p>
8270 !! end
8271
8272 !! test
8273 BUG 553: link with two variables in a piped link
8274 !! wikitext
8275 {|
8276 |[[{{{1}}}|{{{2}}}]]
8277 |}
8278 !! html
8279 <table>
8280 <tr>
8281 <td>[[{{{1}}}|{{{2}}}]]
8282 </td></tr></table>
8283
8284 !! end
8285
8286 !! test
8287 Magic variable as template parameter
8288 !! wikitext
8289 {{paramtest|param={{SITENAME}}}}
8290 !! html
8291 <p>This is a test template with parameter MediaWiki
8292 </p>
8293 !! end
8294
8295 !! article
8296 Template:linktest
8297 !! text
8298 [[{{{param}}}|link]]
8299 !! endarticle
8300
8301 !! test
8302 Template parameter as link source
8303 !! wikitext
8304 {{linktest|param=Main Page}}
8305 !! html
8306 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8307 </p>
8308 !! end
8309
8310 !!test
8311 Template-generated attribute string (k='v')
8312 !! wikitext
8313 <span {{attr_str|id|v1}}>bar</span>
8314 !! html
8315 <p><span id="v1">bar</span>
8316 </p>
8317 !!end
8318
8319 !!article
8320 Template:paramtest2
8321 !! text
8322 including another template, {{paramtest|param={{{arg}}}}}
8323 !! endarticle
8324
8325 !! test
8326 Template passing argument to another template
8327 !! wikitext
8328 {{paramtest2|arg='hmm'}}
8329 !! html
8330 <p>including another template, This is a test template with parameter 'hmm'
8331 </p>
8332 !! end
8333
8334 !! article
8335 Template:Linktest2
8336 !! text
8337 Main Page
8338 !! endarticle
8339
8340 !! test
8341 Template as link source
8342 !! wikitext
8343 [[{{linktest2}}]]
8344
8345 [[{{linktest2}}|Main Page]]
8346
8347 [[{{linktest2}}]]Page
8348 !! html
8349 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8350 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8351 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8352 </p>
8353 !! end
8354
8355
8356 !! article
8357 Template:loop1
8358 !! text
8359 {{loop2}}
8360 !! endarticle
8361
8362 !! article
8363 Template:loop2
8364 !! text
8365 {{loop1}}
8366 !! endarticle
8367
8368 !! test
8369 Template infinite loop
8370 !! wikitext
8371 {{loop1}}
8372 !! html
8373 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8374 </p>
8375 !! end
8376
8377 !! test
8378 Template from main namespace
8379 !! wikitext
8380 {{:Main Page}}
8381 !! html
8382 <p>blah blah
8383 </p>
8384 !! end
8385
8386 !! article
8387 Template:table
8388 !! text
8389 {|
8390 | 1 || 2
8391 |-
8392 | 3 || 4
8393 |}
8394 !! endarticle
8395
8396 !! test
8397 BUG 529: Template with table, not included at beginning of line
8398 !! wikitext
8399 foo {{table}}
8400 !! html
8401 <p>foo
8402 </p>
8403 <table>
8404 <tr>
8405 <td> 1 </td>
8406 <td> 2
8407 </td></tr>
8408 <tr>
8409 <td> 3 </td>
8410 <td> 4
8411 </td></tr></table>
8412
8413 !! end
8414
8415 !! test
8416 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8417 !! wikitext
8418 foo
8419 {{table}}
8420 !! html
8421 <p>foo
8422 </p>
8423 <table>
8424 <tr>
8425 <td> 1 </td>
8426 <td> 2
8427 </td></tr>
8428 <tr>
8429 <td> 3 </td>
8430 <td> 4
8431 </td></tr></table>
8432
8433 !! end
8434
8435 !! test
8436 BUG 41: Template parameters shown as broken links
8437 !! wikitext
8438 {{{parameter}}}
8439 !! html
8440 <p>{{{parameter}}}
8441 </p>
8442 !! end
8443
8444 !! test
8445 Template with targets containing wikilinks
8446 !! wikitext
8447 {{[[foo]]}}
8448
8449 {{[[{{echo|foo}}]]}}
8450
8451 {{{{echo|[[foo}}]]}}
8452 !! html
8453 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8454 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8455 </p><p>{{[[foo}}]]
8456 </p>
8457 !! end
8458
8459 !! article
8460 Template:MSGNW test
8461 !! text
8462 ''None'' of '''this''' should be
8463 * interpreted
8464 but rather passed unmodified
8465 {{test}}
8466 <gallery>
8467 File:Foobar.jpg
8468 </gallery>
8469 !! endarticle
8470
8471 # hmm, fix this or just deprecate msgnw and document its behavior?
8472 !! test
8473 msgnw keyword
8474 !! wikitext
8475 {{msgnw:MSGNW test}}
8476 !! html
8477 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8478 &#42; interpreted
8479 &#32;but rather passed unmodified
8480 &#123;&#123;test&#125;&#125;
8481 &#60;gallery&#62;
8482 File:Foobar.jpg
8483 &#60;/gallery&#62;
8484 </p>
8485 !! end
8486
8487 !! test
8488 int keyword
8489 !! wikitext
8490 {{int:youhavenewmessages|lots of money|not!}}
8491 !! html
8492 <p>You have lots of money (not!).
8493 </p>
8494 !! end
8495
8496 !! article
8497 Template:Includes
8498 !! text
8499 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8500 !! endarticle
8501
8502 !! test
8503 <includeonly> and <noinclude> being included
8504 !! wikitext
8505 {{Includes}}
8506 !! html
8507 <p>Foobar
8508 </p>
8509 !! end
8510
8511 !! article
8512 Template:Includes2
8513 !! text
8514 <onlyinclude>Foo</onlyinclude>bar
8515 !! endarticle
8516
8517 !! test
8518 <onlyinclude> being included
8519 !! wikitext
8520 {{Includes2}}
8521 !! html
8522 <p>Foo
8523 </p>
8524 !! end
8525
8526
8527 !! article
8528 Template:Includes3
8529 !! text
8530 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8531 !! endarticle
8532
8533 !! test
8534 <onlyinclude> and <includeonly> being included
8535 !! wikitext
8536 {{Includes3}}
8537 !! html
8538 <p>Foo
8539 </p>
8540 !! end
8541
8542 !! test
8543 <includeonly> and <noinclude> on a page
8544 !! wikitext
8545 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8546 !! html
8547 <p>Foozar
8548 </p>
8549 !! end
8550
8551 !! test
8552 Un-closed <noinclude>
8553 !! wikitext
8554 <noinclude>
8555 !! html
8556 !! end
8557
8558 !! test
8559 <onlyinclude> on a page
8560 !! wikitext
8561 <onlyinclude>Foo</onlyinclude>bar
8562 !! html
8563 <p>Foobar
8564 </p>
8565 !! end
8566
8567 !! test
8568 Un-closed <onlyinclude>
8569 !! wikitext
8570 <onlyinclude>
8571 !! html
8572 !! end
8573
8574 !!test
8575 Self-closed noinclude, includeonly, onlyinclude tags
8576 !! wikitext
8577 <noinclude />
8578 <includeonly />
8579 <onlyinclude />
8580 !! html
8581 <p><br />
8582 </p>
8583 !!end
8584
8585 !!test
8586 Unbalanced includeonly and noinclude tags
8587 !! wikitext
8588 {|
8589 |a</noinclude>
8590 |b</noinclude></noinclude>
8591 |c</noinclude></includeonly>
8592 |d</includeonly></includeonly>
8593 |}
8594 !! html
8595 <table>
8596 <tr>
8597 <td>a
8598 </td>
8599 <td>b
8600 </td>
8601 <td>c&lt;/includeonly&gt;
8602 </td>
8603 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8604 </td></tr></table>
8605
8606 !!end
8607
8608 !! article
8609 Template:Includeonly section
8610 !! text
8611 <includeonly>
8612 ==Includeonly section==
8613 </includeonly>
8614 ==Section T-1==
8615 !!endarticle
8616
8617 !! test
8618 Bug 6563: Edit link generation for section shown by <includeonly>
8619 !! wikitext
8620 {{includeonly section}}
8621 !! html
8622 <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>
8623 <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>
8624
8625 !! end
8626
8627 # Uses same input as the contents of [[Template:Includeonly section]]
8628 !! test
8629 Bug 6563: Section extraction for section shown by <includeonly>
8630 !! options
8631 section=T-2
8632 !! wikitext
8633 <includeonly>
8634 ==Includeonly section==
8635 </includeonly>
8636 ==Section T-2==
8637 !! html
8638 ==Section T-2==
8639 !! end
8640
8641 !! test
8642 Bug 6563: Edit link generation for section suppressed by <includeonly>
8643 !! wikitext
8644 <includeonly>
8645 ==Includeonly section==
8646 </includeonly>
8647 ==Section 1==
8648 !! html
8649 <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>
8650
8651 !! end
8652
8653 !! test
8654 Bug 6563: Section extraction for section suppressed by <includeonly>
8655 !! options
8656 section=1
8657 !! wikitext
8658 <includeonly>
8659 ==Includeonly section==
8660 </includeonly>
8661 ==Section 1==
8662 !! html
8663 ==Section 1==
8664 !! end
8665
8666 !! test
8667 Un-closed <includeonly>
8668 !! wikitext
8669 <includeonly>
8670 !! html
8671 !! end
8672
8673 # TODO: test with DOM fragment reuse!
8674 !! test
8675 Parsoid: DOM fragment reuse
8676 !! options
8677 parsoid=wt2wt,wt2html
8678 !! wikitext
8679 a{{echo|b<table></table>c}}d
8680
8681 a{{echo|b
8682 <table></table>
8683 c}}d
8684
8685 {{echo|a
8686
8687 <table></table>
8688
8689 b}}
8690 !! html
8691 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8692 <table></table>c"}},"i":0}}]}'>b</span>
8693 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8694
8695
8696 <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">
8697 </span>
8698 <table about="#mwt2"></table><span about="#mwt2">
8699 </span>
8700 <p about="#mwt2">cd</p>
8701
8702
8703 <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">
8704
8705 </span>
8706 <table about="#mwt3"></table><span about="#mwt3">
8707
8708 </span>
8709 <p about="#mwt3">b</p>
8710 !! end
8711
8712 !! test
8713 Parsoid: Merge double tds (bug 50603)
8714 !! options
8715 parsoid
8716 !! wikitext
8717 {|
8718 |{{echo|{{!}} foo}}
8719 |}
8720 !! html
8721 <table><tbody>
8722 <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>
8723 </tbody></table>
8724 !! end
8725
8726 !! test
8727 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8728 !! options
8729 parsoid
8730 !! wikitext
8731 {{echo|<div>}}
8732 {|
8733 |{{echo|{{!}} foo}}
8734 |}
8735 {{echo|</div>}}
8736 !! html
8737 <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}}]}'>
8738 <table><tbody>
8739 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8740 </tbody></table>
8741 </div>
8742 !! end
8743
8744 ###
8745 ### <includeonly> and <noinclude> in attributes
8746 ###
8747 !!test
8748 0. includeonly around the entire attribute
8749 !! wikitext
8750 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8751 !! html
8752 <p><span id="v2">bar</span>
8753 </p>
8754 !!end
8755
8756 !!test
8757 1. includeonly in html attr key
8758 !! wikitext
8759 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8760 !! html
8761 <p><span id="foo">bar</span>
8762 </p>
8763 !!end
8764
8765 !!test
8766 2. includeonly in html attr value
8767 !! wikitext
8768 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8769 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8770 !! html
8771 <p><span id="v1">bar</span>
8772 <span id="v1">bar</span>
8773 </p>
8774 !!end
8775
8776 !!test
8777 3. includeonly in part of an attr value
8778 !! wikitext
8779 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8780 !! html
8781 <p><span style="color:red;">bar</span>
8782 </p>
8783 !!end
8784
8785 !!test
8786 4. includeonly in table attributes
8787 !! wikitext
8788 {|
8789 |- <noinclude>
8790 |-
8791 |a
8792 </noinclude>
8793 |- <includeonly>
8794 |-
8795 |b
8796 </includeonly>
8797 |}
8798 !! html
8799 <table>
8800
8801
8802 <tr>
8803 <td>a
8804 </td></tr>
8805 </table>
8806
8807 !!end
8808
8809 ###
8810 ### Token Stream Patcher tests
8811 ###
8812 ### These tests won't always pass wt2wt and other modes because
8813 ### on serialization, the table will be output on a new line.
8814 ### For now, we are blacklisting them, and using this to test selser.
8815 ###
8816
8817 !!test
8818 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8819 !!options
8820 parsoid=wt2html,wt2wt
8821 !!wikitext
8822 {{echo|}}{| width = '100%'
8823 |foo
8824 |}
8825 !!html/parsoid
8826 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8827 <table width="100%">
8828 <tbody>
8829 <tr>
8830 <td>foo</td></tr></tbody></table>
8831 !!end
8832
8833 !!test
8834 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8835 !!options
8836 parsoid=wt2html,wt2wt
8837 !!wikitext
8838 <includeonly>a</includeonly>{| {{{b}}}
8839 |c
8840 |}
8841 !!html/parsoid
8842 <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|}"}'>
8843 <tbody><tr><td>c</td></tr>
8844 </tbody></table>
8845 !!end
8846
8847 ###
8848 ### Testing parsing of templates where a template arg
8849 ### has the same name as the template itself.
8850 ###
8851
8852 !! article
8853 Template:quote
8854 !! text
8855 {{{quote|{{{1}}}}}}
8856 !! endarticle
8857
8858 !!test
8859 Templates: Template Name/Arg clash: 1. Use of positional param
8860 !! wikitext
8861 {{quote|foo}}
8862 !! html
8863 <p>foo
8864 </p>
8865 !!end
8866
8867 !!test
8868 Templates: Template Name/Arg clash: 2. Use of named param
8869 !! wikitext
8870 {{quote|quote=foo}}
8871 !! html
8872 <p>foo
8873 </p>
8874 !!end
8875
8876 !!test
8877 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8878 !! wikitext
8879 {{quote|quote}}
8880 !! html
8881 <p>quote
8882 </p>
8883 !!end
8884
8885 ###
8886 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8887 ###
8888
8889 !!test
8890 Templates: 1. Simple use
8891 !! wikitext
8892 {{echo|Foo}}
8893 !! html
8894 <p>Foo
8895 </p>
8896 !!end
8897
8898 !!test
8899 Templates: 2. Inside a block tag
8900 !! wikitext
8901 <div>{{echo|Foo}}</div>
8902 <blockquote>{{echo|Foo}}</blockquote>
8903 !! html
8904 <div>Foo</div>
8905 <blockquote>Foo</blockquote>
8906
8907 !!end
8908
8909 !!test
8910 Templates: P-wrapping: 1a. Templates on consecutive lines
8911 !! wikitext
8912 {{echo|Foo}}
8913 {{echo|bar}}
8914 !! html
8915 <p>Foo
8916 bar
8917 </p>
8918 !!end
8919
8920 !!test
8921 Templates: P-wrapping: 1b. Templates on consecutive lines
8922 !! wikitext
8923 Foo
8924
8925 {{echo|bar}}
8926 {{echo|baz}}
8927 !! html
8928 <p>Foo
8929 </p><p>bar
8930 baz
8931 </p>
8932 !!end
8933
8934 !!test
8935 Templates: P-wrapping: 1c. Templates on consecutive lines
8936 !! wikitext
8937 {{echo|Foo}}
8938 {{echo|bar}} <div>baz</div>
8939 !! html
8940 <p>Foo
8941 </p>
8942 bar <div>baz</div>
8943
8944 !!end
8945
8946 !!test
8947 Templates: P-wrapping: 1d. Template preceded by comment-only line
8948 !!options
8949 parsoid
8950 !! wikitext
8951 <!-- foo -->
8952 {{echo|Bar}}
8953 !! html
8954 <!-- foo -->
8955
8956 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8957 !!end
8958
8959 !!test
8960 Templates: Inline Text: 1. Multiple template uses
8961 !! wikitext
8962 {{echo|Foo}}bar{{echo|baz}}
8963 !! html
8964 <p>Foobarbaz
8965 </p>
8966 !!end
8967
8968 !!test
8969 Templates: Inline Text: 2. Back-to-back template uses
8970 !! wikitext
8971 {{echo|Foo}}{{echo|bar}}
8972 !! html
8973 <p>Foobar
8974 </p>
8975 !!end
8976
8977 !!test
8978 Templates: Block Tags: 1. Multiple template uses
8979 !! wikitext
8980 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8981 !! html
8982 <div>Foo</div><div>bar</div><div>baz</div>
8983
8984 !!end
8985
8986 !!test
8987 Templates: Block Tags: 2. Back-to-back template uses
8988 !! wikitext
8989 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8990 !! html
8991 <div>Foo</div><div>bar</div>
8992
8993 !!end
8994
8995 !!test
8996 Templates: Links: 1. Simple example
8997 !! wikitext
8998 {{echo|[[Foo|bar]]}}
8999 !! html
9000 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9001 </p>
9002 !!end
9003
9004 !!test
9005 Templates: Links: 2. Generation of link href
9006 !! wikitext
9007 [[{{echo|Foo}}|bar]]
9008 !! html
9009 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9010 </p>
9011 !!end
9012
9013 !!test
9014 Templates: Links: 3. Generation of part of a link href
9015 !! wikitext
9016 [[Fo{{echo|o}}|bar]]
9017
9018 [[Foo{{echo|bar}}]]
9019
9020 [[Foo{{echo|bar}}baz]]
9021
9022 [[Foo{{echo|bar}}|bar]]
9023
9024 [[:Foo{{echo|bar}}]]
9025
9026 [[:Foo{{echo|bar}}|bar]]
9027 !! html
9028 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9029 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9030 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9031 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9032 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9033 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9034 </p>
9035 !!end
9036
9037 !!test
9038 Templates: Links: 4. Multiple templates generating link href
9039 !! wikitext
9040 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9041 !! html
9042 <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>
9044 !!end
9045
9046 !!test
9047 Templates: Links: 5. Generation of link text
9048 !! wikitext
9049 [[Foo|{{echo|bar}}]]
9050 !! html
9051 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9052 </p>
9053 !!end
9054
9055 !!test
9056 Templates: Links: 5. Nested templates (only outermost template should be marked)
9057 !! wikitext
9058 {{echo|[[{{echo|Foo}}|bar]]}}
9059 !! html
9060 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9061 </p>
9062 !!end
9063
9064 !!test
9065 Templates: HTML Tag: 1. Generation of HTML attr. key
9066 !! wikitext
9067 <div {{echo|style}}="color:red;">foo</div>
9068 !! html
9069 <div style="color:red;">foo</div>
9070
9071 !!end
9072
9073 !!test
9074 Templates: HTML Tag: 2. Generation of HTML attr. value
9075 !! wikitext
9076 <div style={{echo|'color:red;'}}>foo</div>
9077 !! html
9078 <div style="color:red;">foo</div>
9079
9080 !!end
9081
9082 !!test
9083 Templates: HTML Tag: 3. Generation of HTML attr key and value
9084 !! wikitext
9085 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9086 !! html
9087 <div style="color:red;">foo</div>
9088
9089 !!end
9090
9091 !!test
9092 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9093 !! wikitext
9094 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9095 !! html
9096 <div title="This is a long title with just one piece templated">foo</div>
9097
9098 !!end
9099
9100 !!test
9101 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9102 !! wikitext
9103 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9104 !! html
9105 <div title="This is a long title with just one piece templated">foo</div>
9106
9107 !!end
9108
9109 !!test
9110 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9111 !! wikitext
9112 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9113 !! html
9114 <div title="This is a long title with just one piece templated">foo</div>
9115
9116 !!end
9117
9118 !!test
9119 Templates: HTML Tag: 7. Generation of partial attribute key string
9120 !! wikitext
9121 <div st{{echo|yle}}="color:red;">foo</div>
9122 !! html
9123 <div style="color:red;">foo</div>
9124
9125 !!end
9126
9127 !!test
9128 Templates: HTML Tables: 1. Generating start of a HTML table
9129 !! wikitext
9130 {{echo|<table><tr><td>foo</td>}}</tr></table>
9131 !! html
9132 <table><tr><td>foo</td></tr></table>
9133
9134 !!end
9135
9136 !!test
9137 Templates: HTML Tables: 2a. Generating middle of a HTML table
9138 !! wikitext
9139 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9140 !! html
9141 <table><tr><td>foo</td></tr></table>
9142
9143 !!end
9144
9145 !!test
9146 Templates: HTML Tables: 2b. Generating middle of a HTML table
9147 !! wikitext
9148 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9149 !! html
9150 <table><tr><td>foo</td></tr></table>
9151
9152 !!end
9153
9154 !!test
9155 Templates: HTML Tables: 3. Generating end of a HTML table
9156 !! wikitext
9157 <table><tr>{{echo|<td>foo</td></tr></table>}}
9158 !! html
9159 <table><tr><td>foo</td></tr></table>
9160
9161 !!end
9162
9163 !!test
9164 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9165 !! wikitext
9166 {{echo|<table>}}<tr><td>foo</td></tr></table>
9167 !! html
9168 <table><tr><td>foo</td></tr></table>
9169
9170 !!end
9171
9172 !!test
9173 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9174 !! wikitext
9175 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9176 !! html
9177 <table><tr><td>foo</td></tr></table>
9178
9179 !!end
9180
9181 !!test
9182 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9183 !! wikitext
9184 <table><tr>{{echo|<td>}}foo</td></tr></table>
9185 !! html
9186 <table><tr><td>foo</td></tr></table>
9187
9188 !!end
9189
9190 !!test
9191 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9192 !! wikitext
9193 <table><tr><td>foo{{echo|</td>}}</tr></table>
9194 !! html
9195 <table><tr><td>foo</td></tr></table>
9196
9197 !!end
9198
9199 !!test
9200 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9201 !! wikitext
9202 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9203 !! html
9204 <table><tr><td>foo</td></tr></table>
9205
9206 !!end
9207
9208 !!test
9209 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9210 !! wikitext
9211 <table><tr><td>foo</td></tr>{{echo|</table>}}
9212 !! html
9213 <table><tr><td>foo</td></tr></table>
9214
9215 !!end
9216
9217 !!test
9218 Templates: HTML Tables: 5. Proper fostering of categories from inside
9219 !!options
9220 parsoid=wt2html,wt2wt
9221 !! wikitext
9222 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9223 <!--Two categories (Bug 50330)-->
9224 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9225 !! html
9226 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9227 <!--Two categories (Bug 50330)-->
9228 <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>
9229 !!end
9230
9231 !!test
9232 Templates: Wiki Tables: 1a. Fostering of entire template content
9233 !! wikitext
9234 {|
9235 {{echo|a}}
9236 |}
9237 !! html
9238 <table>
9239 a
9240 <tr><td></td></tr></table>
9241
9242 !!end
9243
9244 !!test
9245 Templates: Wiki Tables: 1b. Fostering of entire template content
9246 !! wikitext
9247 {|
9248 {{echo|<div>}}
9249 foo
9250 {{echo|</div>}}
9251 |}
9252 !! html
9253 <table>
9254 <div>
9255 <p>foo
9256 </p>
9257 </div>
9258 <tr><td></td></tr></table>
9259
9260 !!end
9261
9262 !!test
9263 Templates: Wiki Tables: 2. Fostering of partial template content
9264 !! wikitext
9265 {|
9266 {{echo|a
9267 <div>b</div>}}
9268 |}
9269 !! html
9270 <table>
9271 a
9272 <div>b</div>
9273 <tr><td></td></tr></table>
9274
9275 !!end
9276
9277 !!test
9278 Templates: Wiki Tables: 3. td-content via multiple templates
9279 !! wikitext
9280 {|
9281 {{echo|{{pipe}}a}}{{echo|b}}
9282 |}
9283 !! html
9284 <table>
9285 <tr>
9286 <td>ab
9287 </td></tr></table>
9288
9289 !!end
9290
9291 !!test
9292 Templates: Wiki Tables: 4. Templated tags, no content
9293 !! wikitext
9294 {{tbl-start}}
9295 {{tbl-end}}
9296 !! html
9297 <table>
9298 <tr><td></td></tr></table>
9299
9300 !!end
9301
9302 !!test
9303 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9304 !! wikitext
9305 {{tbl-start}}
9306 |foo
9307 {{tbl-end}}
9308 !! html
9309 <table>
9310 <tr>
9311 <td>foo
9312 </td></tr></table>
9313
9314 !!end
9315
9316 !!test
9317 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9318 !! wikitext
9319 {{tbl-start}}
9320 {{!}}foo
9321 {{tbl-end}}
9322 !! html
9323 <table>
9324 <tr>
9325 <td>foo
9326 </td></tr></table>
9327
9328 !!end
9329
9330 !!test
9331 Templates: Lists: Multi-line list-items via templates
9332 !! wikitext
9333 *{{echo|a {{nonexistent|
9334 unused}}}}
9335 *{{echo|b {{nonexistent|
9336 unused}}}}
9337 !! html
9338 <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>
9339 <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>
9340
9341 !!end
9342
9343 !!test
9344 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9345 !! wikitext
9346 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9347 !! html
9348 <p><i>ab</i>c<i>d</i>e
9349 </p>
9350 !!end
9351
9352 !!test
9353 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9354 (PHP parser generates misnested html)
9355 !! wikitext
9356 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9357 !! html/parsoid
9358 <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>
9359 !!end
9360
9361 !!test
9362 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9363 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9364 !! options
9365 parsoid=wt2html,wt2wt
9366 !! wikitext
9367 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9368 !! html
9369 <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>
9370 <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>
9371 <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>
9372 !!end
9373
9374 !!test
9375 Templates: Ugly nesting: 4. Divs opened/closed across templates
9376 !! wikitext
9377 a<div>b{{echo|c</div>d}}e
9378 !! html
9379 a<div>bc</div>de
9380
9381 !!end
9382
9383 !!test
9384 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9385 (Parsoid-centric)
9386 !! options
9387 parsoid
9388 !! wikitext
9389 {|
9390 |{{echo|foo</table>}}
9391 |bar
9392 |}
9393 !! html
9394 <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|}"]}'>
9395
9396 <tbody>
9397 <tr>
9398 <td>foo</td></tr></tbody></table><span about="#mwt1">
9399 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9400 |}</span>
9401 !!end
9402
9403 !!test
9404 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9405 (Parsoid-centric)
9406 !! options
9407 parsoid
9408 !! wikitext
9409 <table>
9410 <tr>
9411 <td>
9412 <table>
9413 <tr>
9414 <td>1. {{echo|foo </table>}}</td>
9415 <td> bar </td>
9416 <td>2. {{echo|baz </table>}}</td>
9417 </tr>
9418 <tr>
9419 <td>abc</td>
9420 </tr>
9421 </table>
9422 </td>
9423 </tr>
9424 <tr>
9425 <td>xyz</td>
9426 </tr>
9427 </table>
9428 !! html
9429 <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>"]}'>
9430 <tbody><tr>
9431 <td>
9432 <table>
9433 <tbody><tr>
9434 <td>1. foo </td></tr></tbody></table></td>
9435 <td> bar </td>
9436 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9437 </span><span about="#mwt2">
9438 </span><span about="#mwt2">
9439 </span><span about="#mwt2">abc</span><span about="#mwt2">
9440 </span><span about="#mwt2">
9441 </span><span about="#mwt2">
9442 </span><span about="#mwt2">
9443 </span><span about="#mwt2">
9444 </span><span about="#mwt2">
9445 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9446 </span><span about="#mwt2">
9447 </span>
9448 !!end
9449
9450 !! test
9451 Templates: Ugly templates: 3. newline-only template parameter
9452 !! wikitext
9453 foo {{echo|
9454 }}
9455 !! html
9456 <p>foo
9457 </p>
9458 !! end
9459
9460 # This looks like a bug: a single newline triggers p/br for some reason.
9461 !! test
9462 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9463 !! wikitext
9464 {{echo|
9465 }}
9466 !! html
9467 <p><br />
9468 </p>
9469 !! end
9470
9471 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9472 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9473 !! test
9474 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9475 !! wikitext
9476 {{echo|<table>}}
9477 {{echo|<div>foo}}
9478 {{echo|</table>}}
9479 !! html/parsoid
9480 <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
9481 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9482 </table>
9483 !! end
9484
9485 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9486 # that are "identical" and generate nesting cycles in the algorithm
9487 !! test
9488 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9489 !! wikitext
9490 {{echo|<table><tr><td><table>}}
9491 {{echo|<div>}}
9492 {{echo|</div>}}
9493 !! html/parsoid
9494 <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"}'>
9495 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9496 </table></td></tr></tbody></table>
9497 !! end
9498
9499 !!test
9500 Parser Functions: 1. Simple example
9501 !! wikitext
9502 {{uc:foo}}
9503 !! html
9504 <p>FOO
9505 </p>
9506 !!end
9507
9508 !!test
9509 Parser Functions: 2. Nested use (only outermost should be marked up)
9510 !! wikitext
9511 {{uc:{{lc:FOO}}}}
9512 !! html
9513 <p>FOO
9514 </p>
9515 !!end
9516
9517 ###
9518 ### Pre-save transform tests
9519 ###
9520 !! test
9521 pre-save transform: subst:
9522 !! options
9523 PST
9524 !! wikitext
9525 {{subst:test}}
9526 !! html
9527 This is a test template
9528 !! end
9529
9530 !! test
9531 pre-save transform: normal template
9532 !! options
9533 PST
9534 !! wikitext
9535 {{test}}
9536 !! html
9537 {{test}}
9538 !! end
9539
9540 !! test
9541 pre-save transform: nonexistent template
9542 !! options
9543 PST
9544 !! wikitext
9545 {{thistemplatedoesnotexist}}
9546 !! html
9547 {{thistemplatedoesnotexist}}
9548 !! end
9549
9550
9551 !! test
9552 pre-save transform: subst magic variables
9553 !! options
9554 PST
9555 !! wikitext
9556 {{subst:SITENAME}}
9557 !! html
9558 MediaWiki
9559 !! end
9560
9561 # This is bug 89, which I fixed. -- wtm
9562 !! test
9563 pre-save transform: subst: templates with parameters
9564 !! options
9565 pst
9566 !! wikitext
9567 {{subst:paramtest|param="something else"}}
9568 !! html
9569 This is a test template with parameter "something else"
9570 !! end
9571
9572 !! article
9573 Template:nowikitest
9574 !! text
9575 <nowiki>'''not wiki'''</nowiki>
9576 !! endarticle
9577
9578 !! test
9579 pre-save transform: nowiki in subst (bug 1188)
9580 !! options
9581 pst
9582 !! wikitext
9583 {{subst:nowikitest}}
9584 !! html
9585 <nowiki>'''not wiki'''</nowiki>
9586 !! end
9587
9588
9589 !! article
9590 Template:commenttest
9591 !! text
9592 This template has <!-- a comment --> in it.
9593 !! endarticle
9594
9595 !! test
9596 pre-save transform: comment in subst (bug 1936)
9597 !! options
9598 pst
9599 !! wikitext
9600 {{subst:commenttest}}
9601 !! html
9602 This template has <!-- a comment --> in it.
9603 !! end
9604
9605 !! test
9606 pre-save transform: unclosed tag
9607 !! options
9608 pst noxml
9609 !! wikitext
9610 <nowiki>'''not wiki'''
9611 !! html
9612 <nowiki>'''not wiki'''
9613 !! end
9614
9615 !! test
9616 pre-save transform: mixed tag case
9617 !! options
9618 pst noxml
9619 !! wikitext
9620 <NOwiki>'''not wiki'''</noWIKI>
9621 !! html
9622 <NOwiki>'''not wiki'''</noWIKI>
9623 !! end
9624
9625 !! test
9626 pre-save transform: unclosed comment in <nowiki>
9627 !! options
9628 pst noxml
9629 !! wikitext
9630 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9631 !! html
9632 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9633 !!end
9634
9635 # Leading @ in this template definition works around a limitation
9636 # in parsoid's parserTests which otherwise strips the <span> from the
9637 # result (confusing it for a template wrapper)
9638 !! article
9639 Template:dangerous
9640 !!text
9641 @<span onmouseover="alert('crap')">Oh no</span>
9642 !!endarticle
9643
9644 !!test
9645 (confirming safety of fix for subst bug 1936)
9646 !! wikitext
9647 {{Template:dangerous}}
9648 !! html
9649 <p>@<span>Oh no</span>
9650 </p>
9651 !! end
9652
9653 !! test
9654 pre-save transform: comment containing gallery (bug 5024)
9655 !! options
9656 pst
9657 !! wikitext
9658 <!-- <gallery>data</gallery> -->
9659 !! html
9660 <!-- <gallery>data</gallery> -->
9661 !!end
9662
9663 !! test
9664 pre-save transform: comment containing extension
9665 !! options
9666 pst
9667 !! wikitext
9668 <!-- <tag>data</tag> -->
9669 !! html
9670 <!-- <tag>data</tag> -->
9671 !!end
9672
9673 !! test
9674 pre-save transform: comment containing nowiki
9675 !! options
9676 pst
9677 !! wikitext
9678 <!-- <nowiki>data</nowiki> -->
9679 !! html
9680 <!-- <nowiki>data</nowiki> -->
9681 !!end
9682
9683 !! test
9684 pre-save transform: <noinclude> in subst (bug 3298)
9685 !! options
9686 pst
9687 !! wikitext
9688 {{subst:Includes}}
9689 !! html
9690 Foobar
9691 !! end
9692
9693 !! test
9694 pre-save transform: <onlyinclude> in subst (bug 3298)
9695 !! options
9696 pst
9697 !! wikitext
9698 {{subst:Includes2}}
9699 !! html
9700 Foo
9701 !! end
9702
9703 !! article
9704 Template:SubstTest
9705 !!text
9706 {{<includeonly>subst:</includeonly>Includes}}
9707 !! endarticle
9708
9709 !! article
9710 Template:SafeSubstTest
9711 !! text
9712 {{<includeonly>safesubst:</includeonly>Includes}}
9713 !! endarticle
9714
9715 !! test
9716 bug 22297: safesubst: works during PST
9717 !! options
9718 pst
9719 !! wikitext
9720 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9721 !! html
9722 FoobarFoobar
9723 !! end
9724
9725 !! test
9726 bug 22297: safesubst: works during normal parse
9727 !! wikitext
9728 {{SafeSubstTest}}
9729 !! html
9730 <p>Foobar
9731 </p>
9732 !! end
9733
9734 !! test
9735 subst: does not work during normal parse
9736 !! wikitext
9737 {{SubstTest}}
9738 !! html
9739 <p>{{subst:Includes}}
9740 </p>
9741 !! end
9742
9743 !! test
9744 pre-save transform: context links ("pipe trick")
9745 !! options
9746 pst
9747 !! wikitext
9748 [[Article (context)|]]
9749 [[Bar:Article|]]
9750 [[:Bar:Article|]]
9751 [[Bar:Article (context)|]]
9752 [[:Bar:Article (context)|]]
9753 [[|Article]]
9754 [[|Article (context)]]
9755 [[Bar:X (Y) Z|]]
9756 [[:Bar:X (Y) Z|]]
9757 !! html
9758 [[Article (context)|Article]]
9759 [[Bar:Article|Article]]
9760 [[:Bar:Article|Article]]
9761 [[Bar:Article (context)|Article]]
9762 [[:Bar:Article (context)|Article]]
9763 [[Article]]
9764 [[Article (context)]]
9765 [[Bar:X (Y) Z|X (Y) Z]]
9766 [[:Bar:X (Y) Z|X (Y) Z]]
9767 !! end
9768
9769 !! test
9770 pre-save transform: context links ("pipe trick") with interwiki prefix
9771 !! options
9772 pst
9773 !! wikitext
9774 [[interwiki:Article|]]
9775 [[:interwiki:Article|]]
9776 [[interwiki:Bar:Article|]]
9777 [[:interwiki:Bar:Article|]]
9778 !! html
9779 [[interwiki:Article|Article]]
9780 [[:interwiki:Article|Article]]
9781 [[interwiki:Bar:Article|Bar:Article]]
9782 [[:interwiki:Bar:Article|Bar:Article]]
9783 !! end
9784
9785 !! test
9786 pre-save transform: context links ("pipe trick") with parens in title
9787 !! options
9788 pst title=[[Somearticle (context)]]
9789 !! wikitext
9790 [[|Article]]
9791 !! html
9792 [[Article (context)|Article]]
9793 !! end
9794
9795 !! test
9796 pre-save transform: context links ("pipe trick") with comma in title
9797 !! options
9798 pst title=[[Someplace, Somewhere]]
9799 !! wikitext
9800 [[|Otherplace]]
9801 [[Otherplace, Elsewhere|]]
9802 [[Otherplace, Elsewhere, Anywhere|]]
9803 !! html
9804 [[Otherplace, Somewhere|Otherplace]]
9805 [[Otherplace, Elsewhere|Otherplace]]
9806 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9807 !! end
9808
9809 !! test
9810 pre-save transform: context links ("pipe trick") with parens and comma
9811 !! options
9812 pst title=[[Someplace (IGNORED), Somewhere]]
9813 !! wikitext
9814 [[|Otherplace]]
9815 [[Otherplace (place), Elsewhere|]]
9816 !! html
9817 [[Otherplace, Somewhere|Otherplace]]
9818 [[Otherplace (place), Elsewhere|Otherplace]]
9819 !! end
9820
9821 !! test
9822 pre-save transform: context links ("pipe trick") with comma and parens
9823 !! options
9824 pst title=[[Who, me? (context)]]
9825 !! wikitext
9826 [[|Yes, you.]]
9827 [[Me, Myself, and I (1937 song)|]]
9828 !! html
9829 [[Yes, you. (context)|Yes, you.]]
9830 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9831 !! end
9832
9833 !! test
9834 pre-save transform: context links ("pipe trick") with namespace
9835 !! options
9836 pst title=[[Ns:Somearticle]]
9837 !! wikitext
9838 [[|Article]]
9839 !! html
9840 [[Ns:Article|Article]]
9841 !! end
9842
9843 !! test
9844 pre-save transform: context links ("pipe trick") with namespace and parens
9845 !! options
9846 pst title=[[Ns:Somearticle (context)]]
9847 !! wikitext
9848 [[|Article]]
9849 !! html
9850 [[Ns:Article (context)|Article]]
9851 !! end
9852
9853 !! test
9854 pre-save transform: context links ("pipe trick") with namespace and comma
9855 !! options
9856 pst title=[[Ns:Somearticle, Context, Whatever]]
9857 !! wikitext
9858 [[|Article]]
9859 !! html
9860 [[Ns:Article, Context, Whatever|Article]]
9861 !! end
9862
9863 !! test
9864 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9865 !! options
9866 pst title=[[Ns:Somearticle, Context (context)]]
9867 !! wikitext
9868 [[|Article]]
9869 !! html
9870 [[Ns:Article (context)|Article]]
9871 !! end
9872
9873 !! test
9874 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9875 !! options
9876 pst title=[[Ns:Somearticle (IGNORED), 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 full-width parens and no space (Japanese and Chinese style, bug 30149)
9885 !! options
9886 pst
9887 !! wikitext
9888 [[Article(context)|]]
9889 [[Bar:Article(context)|]]
9890 [[:Bar:Article(context)|]]
9891 [[|Article(context)]]
9892 [[Bar:X(Y)Z|]]
9893 [[:Bar:X(Y)Z|]]
9894 !! html
9895 [[Article(context)|Article]]
9896 [[Bar:Article(context)|Article]]
9897 [[:Bar:Article(context)|Article]]
9898 [[Article(context)]]
9899 [[Bar:X(Y)Z|X(Y)Z]]
9900 [[:Bar:X(Y)Z|X(Y)Z]]
9901 !! end
9902
9903 !! test
9904 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9905 !! options
9906 pst
9907 !! wikitext
9908 [[Article (context)|]]
9909 [[Bar:Article (context)|]]
9910 [[:Bar:Article (context)|]]
9911 [[|Article (context)]]
9912 [[Bar:X (Y) Z|]]
9913 [[:Bar:X (Y) Z|]]
9914 !! html
9915 [[Article (context)|Article]]
9916 [[Bar:Article (context)|Article]]
9917 [[:Bar:Article (context)|Article]]
9918 [[Article (context)]]
9919 [[Bar:X (Y) Z|X (Y) Z]]
9920 [[:Bar:X (Y) Z|X (Y) Z]]
9921 !! end
9922
9923 !! test
9924 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9925 !! options
9926 pst
9927 !! wikitext
9928 [[Article(context)|]]
9929 [[Bar:Article(context)|]]
9930 [[:Bar:Article(context)|]]
9931 [[|Article(context)]]
9932 [[Bar:X(Y)Z|]]
9933 [[:Bar:X(Y)Z|]]
9934 !! html
9935 [[Article(context)|Article]]
9936 [[Bar:Article(context)|Article]]
9937 [[:Bar:Article(context)|Article]]
9938 [[Article(context)]]
9939 [[Bar:X(Y)Z|X(Y)Z]]
9940 [[:Bar:X(Y)Z|X(Y)Z]]
9941 !! end
9942
9943 !! test
9944 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9945 !! options
9946 pst
9947 !! wikitext
9948 [[Article (context), context|]]
9949 [[Article (context),context|]]
9950 [[Bar:Article (context), context|]]
9951 [[Bar:Article (context),context|]]
9952 [[:Bar:Article (context), context|]]
9953 [[:Bar:Article (context),context|]]
9954 !! html
9955 [[Article (context), context|Article]]
9956 [[Article (context),context|Article]]
9957 [[Bar:Article (context), context|Article]]
9958 [[Bar:Article (context),context|Article]]
9959 [[:Bar:Article (context), context|Article]]
9960 [[:Bar:Article (context),context|Article]]
9961 !! end
9962
9963 !! test
9964 pre-save transform: trim trailing empty lines
9965 !! options
9966 pst
9967 !! wikitext
9968 Empty lines are trimmed
9969
9970
9971
9972
9973 !! html
9974 Empty lines are trimmed
9975 !! end
9976
9977 !! test
9978 pre-save transform: Signature expansion
9979 !! options
9980 pst
9981 !! wikitext
9982 * ~~~
9983 * <noinclude>~~~</noinclude>
9984 * <includeonly>~~~</includeonly>
9985 * <onlyinclude>~~~</onlyinclude>
9986 !! html
9987 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9988 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9989 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9990 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9991 !! end
9992
9993
9994 !! test
9995 pre-save transform: Signature expansion in nowiki tags (bug 93)
9996 !! options
9997 pst disabled
9998 !! wikitext
9999 Shall not expand:
10000
10001 <nowiki>~~~~</nowiki>
10002
10003 <includeonly><nowiki>~~~~</nowiki></includeonly>
10004
10005 <noinclude><nowiki>~~~~</nowiki></noinclude>
10006
10007 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10008
10009 {{subst:Foo}} shall be converted to FOO
10010
10011 As well as inside noinclude/onlyinclude
10012 <noinclude>{{subst:Foo}}</noinclude>
10013 <onlyinclude>{{subst:Foo}}</onlyinclude>
10014
10015 But not inside includeonly
10016 <includeonly>{{subst:Foo}}</includeonly>
10017 !! html
10018 Shall not expand:
10019
10020 <nowiki>~~~~</nowiki>
10021
10022 <includeonly><nowiki>~~~~</nowiki></includeonly>
10023
10024 <noinclude><nowiki>~~~~</nowiki></noinclude>
10025
10026 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10027
10028 FOO shall be converted to FOO
10029
10030 As well as inside noinclude/onlyinclude
10031 <noinclude>FOO</noinclude>
10032 <onlyinclude>FOO</onlyinclude>
10033
10034 But not inside includeonly
10035 <includeonly>{{subst:Foo}}</includeonly>
10036 !! end
10037
10038 !! test
10039 Parsoid: Recognize nowiki with trailing space in tags
10040 !! options
10041 parsoid=wt2html
10042 !! wikitext
10043 <nowiki ><div>[[foo]]</nowiki >
10044
10045 a<nowiki / >b
10046
10047 c<nowiki />d
10048
10049 e<nowiki/ >f
10050 !! html
10051 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10052 <p>ab</p>
10053 <p>cd</p>
10054 <p>ef</p>
10055 !! end
10056
10057 !! test
10058 Parsoid: Recognize nowiki with odd capitalization
10059 !! options
10060 parsoid=wt2html
10061 !! wikitext
10062 <noWikI ><div>[[foo]]</Nowiki >
10063 !! html
10064 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10065 !! end
10066
10067
10068 !! test
10069 Parsoid: Escape nowiki with trailing space in tags
10070 !! options
10071 parsoid=html2wt
10072 !! wikitext
10073 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10074
10075 a&lt;nowiki /&gt;b
10076
10077 c&lt;nowiki/ &gt;d
10078 !! html
10079 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10080 <p>a&lt;nowiki /&gt;b</p>
10081 <p>c&lt;nowiki/ &gt;d</p>
10082 !! end
10083
10084 !! test
10085 Parsoid: Escape weird noWikI capitalizations
10086 !! options
10087 parsoid=html2wt
10088 !! wikitext
10089 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10090 !! html
10091 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10092 !! end
10093
10094 ###
10095 ### Message transform tests
10096 ###
10097 !! test
10098 message transform: magic variables
10099 !! options
10100 msg
10101 !! wikitext
10102 {{SITENAME}}
10103 !! html
10104 MediaWiki
10105 !! end
10106
10107 !! test
10108 message transform: should not transform wiki markup
10109 !! options
10110 msg
10111 !! wikitext
10112 ''test''
10113 !! html
10114 ''test''
10115 !! end
10116
10117 !! test
10118 message transform: <noinclude> in transcluded template (bug 4926)
10119 !! options
10120 msg
10121 !! wikitext
10122 {{Includes}}
10123 !! html
10124 Foobar
10125 !! end
10126
10127 !! test
10128 message transform: <onlyinclude> in transcluded template (bug 4926)
10129 !! options
10130 msg
10131 !! wikitext
10132 {{Includes2}}
10133 !! html
10134 Foo
10135 !! end
10136
10137 !! test
10138 {{#special:}} page name, known
10139 !! options
10140 msg
10141 !! wikitext
10142 {{#special:Recentchanges}}
10143 !! html
10144 Special:RecentChanges
10145 !! end
10146
10147 !! test
10148 {{#special:}} page name with subpage, known
10149 !! options
10150 msg
10151 !! wikitext
10152 {{#special:Recentchanges/param}}
10153 !! html
10154 Special:RecentChanges/param
10155 !! end
10156
10157 !! test
10158 {{#special:}} page name, unknown
10159 !! options
10160 msg
10161 !! wikitext
10162 {{#special:foobar nonexistent}}
10163 !! html
10164 Special:Foobar nonexistent
10165 !! end
10166
10167 !! test
10168 {{#speciale:}} page name, known
10169 !! options
10170 msg
10171 !! wikitext
10172 {{#speciale:Recentchanges}}
10173 !! html
10174 Special:RecentChanges
10175 !! end
10176
10177 !! test
10178 {{#speciale:}} page name with subpage, known
10179 !! options
10180 msg
10181 !! wikitext
10182 {{#speciale:Recentchanges/param}}
10183 !! html
10184 Special:RecentChanges/param
10185 !! end
10186
10187 !! test
10188 {{#speciale:}} page name, unknown
10189 !! options
10190 msg
10191 !! wikitext
10192 {{#speciale:foobar nonexistent}}
10193 !! html
10194 Special:Foobar_nonexistent
10195 !! end
10196
10197 ###
10198 ### Images
10199 ###
10200 ### For Parsoid-specific tests, see
10201 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10202
10203 !! test
10204 Simple image
10205 !! options
10206 parsoid=wt2html,wt2wt,html2html
10207 !! wikitext
10208 [[Image:foobar.jpg]]
10209 !! html/php
10210 <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>
10211 </p>
10212 !! html/parsoid
10213 <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>
10214 </p>
10215 !! end
10216
10217 !! test
10218 Simple image (using File: namespace, now canonical)
10219 !! wikitext
10220 [[File:Foobar.jpg]]
10221 !! html/php
10222 <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>
10223 </p>
10224 !! html/parsoid
10225 <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>
10226 </p>
10227 !! end
10228
10229 !! test
10230 Right-aligned image
10231 !! wikitext
10232 [[File:Foobar.jpg|right]]
10233 !! html/php
10234 <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>
10235
10236 !! html/parsoid
10237 <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>
10238 !! end
10239
10240 !! test
10241 Image with caption
10242 !! wikitext
10243 [[File:Foobar.jpg|right|Caption text]]
10244 !! html/php
10245 <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>
10246
10247 !! html/parsoid
10248 <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>
10249 !! end
10250
10251 !! test
10252 Image with caption, bug 53312 #1
10253 !! wikitext
10254 [[File:Foobar.jpg|right|Caption page stuff]]
10255 !! html/php
10256 <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>
10257
10258 !! html/parsoid
10259 <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>
10260 !! end
10261
10262 !! test
10263 Image with caption, bug 53312 #2
10264 !! wikitext
10265 [[File:Foobar.jpg|right|Caption page=]]
10266 !! html/php
10267 <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>
10268
10269 !! html/parsoid
10270 <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>
10271 !! end
10272
10273 !! test
10274 Image with caption, bug 53312 #3
10275 !! wikitext
10276 [[File:Foobar.jpg|right|Caption page=stuff]]
10277 !! html/php
10278 <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>
10279
10280 !! html/parsoid
10281 <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>
10282 !! end
10283
10284 !! test
10285 Allow empty links in image captions (Bug 60753)
10286 !! options
10287 thumbsize=220
10288 !! wikitext
10289 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10290 [[]]
10291 [[Link2]]
10292 ]]
10293 !! html/php
10294 <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>
10295
10296 !! html/parsoid
10297 <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>
10298 [[]]
10299 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10300 </figcaption></figure>
10301 !! end
10302
10303 !! test
10304 Link with empty target
10305 !! wikitext
10306 [[]]
10307 !! html
10308 <p>[[]]
10309 </p>
10310 !! end
10311
10312 !! test
10313 Image with empty attribute
10314 !! options
10315 parsoid=wt2html,wt2wt,html2html
10316 !! wikitext
10317 [[File:Foobar.jpg|right||Caption text]]
10318 !! html/php
10319 <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>
10320
10321 !! html/parsoid
10322 <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>
10323 !! end
10324
10325 !! test
10326 1. Block image with individual attributes from templates
10327 !! wikitext
10328 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10329 !! html/php
10330 <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>
10331
10332 !! html/parsoid
10333 <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>
10334 !! end
10335
10336 !! test
10337 2. Block Image with individual attributes from templates
10338 !! wikitext
10339 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10340 !! html/php
10341 <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>
10342
10343 !! html/parsoid
10344 <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>
10345 !! end
10346
10347 !! test
10348 3. Inline image with individual attributes from templates
10349 !! wikitext
10350 [[File:Foobar.jpg|{{echo|50px}}]]
10351 !! html/php
10352 <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>
10353 </p>
10354 !! html/parsoid
10355 <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>
10356 !! end
10357
10358 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10359 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10360 !! test
10361 Image with multiple attributes from the same template
10362 !! wikitext
10363 [[File:Foobar.jpg|{{image_attribs}}]]
10364 !! html/php
10365 <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>
10366
10367 !! html/parsoid
10368 <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>
10369 !! end
10370
10371 !! test
10372 Image with link tails
10373 !! options
10374 thumbsize=220
10375 !! wikitext
10376 123[[File:Foobar.jpg]]456
10377 123[[File:Foobar.jpg|right]]456
10378 123[[File:Foobar.jpg|thumb]]456
10379 !! html/php
10380 <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
10381 </p>
10382 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
10383 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
10384
10385 !! html/parsoid
10386 <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>
10387 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
10388 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
10389 !! end
10390
10391 !! test
10392 Image with multiple captions -- only last one is accepted
10393 !! wikitext
10394 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10395 !! html/php
10396 <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>
10397
10398 !! html/parsoid
10399 <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>
10400 !! end
10401
10402 !! test
10403 Image with multiple widths -- use last
10404 !! wikitext
10405 [[File:Foobar.jpg|200px|300px|caption]]
10406 !! html/php
10407 <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>
10408 </p>
10409 !! html/parsoid
10410 <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>
10411 !! end
10412
10413 !! test
10414 Image with multiple alignments -- use first (bug 48664)
10415 !! options
10416 thumbsize=220
10417 !! wikitext
10418 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10419
10420 [[File:Foobar.jpg|middle|text-top|caption]]
10421 !! html/php
10422 <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>
10423 <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>
10424 </p>
10425 !! html/parsoid
10426 <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>
10427 <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>
10428 !! end
10429
10430 !! test
10431 Image with width attribute at different positions
10432 !! wikitext
10433 [[File:Foobar.jpg|200px|right|Caption]]
10434 [[File:Foobar.jpg|right|200px|Caption]]
10435 [[File:Foobar.jpg|right|Caption|200px]]
10436 !! html/php
10437 <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>
10438 <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>
10439 <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>
10440
10441 !! html/parsoid
10442 <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>
10443 <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>
10444 <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>
10445 !! end
10446
10447 # a sad bit of backward-compatibility
10448 !! test
10449 Image with size specified with pxpx (bug 13500, 51628)
10450 !! options
10451 parsoid=wt2html,wt2wt,html2html
10452 !! wikitext
10453 [[File:Foobar.jpg|20pxpx]]
10454 [[File:Foobar.jpg|200x20pxpx]]
10455 !! html/php
10456 <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>
10457 <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>
10458 </p>
10459 !! html/parsoid
10460 <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>
10461 !! end
10462
10463 !! test
10464 Image with link parameter, wiki target
10465 !! wikitext
10466 [[File:Foobar.jpg|link=Main Page]]
10467 !! html/php
10468 <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>
10469 </p>
10470 !! html/parsoid
10471 <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>
10472 !! end
10473
10474 # parsoid bug 49293 (part 1)
10475 !! test
10476 Image with link parameter, URL target
10477 !! wikitext
10478 [[File:Foobar.jpg|link=http://example.com/]]
10479 !! html/php
10480 <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>
10481 </p>
10482 !! html/parsoid
10483 <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>
10484 !! end
10485
10486 # parsoid bug 49293 (part 2)
10487 !! test
10488 Image with link parameter, protocol-less URL target
10489 !! wikitext
10490 [[File:Foobar.jpg|link=//example.com/]]
10491 !! html/php
10492 <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>
10493 </p>
10494 !! html/parsoid
10495 <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>
10496 !! end
10497
10498 !! test
10499 Image with link parameter, wgExternalLinkTarget
10500 !! wikitext
10501 [[Image:foobar.jpg|link=http://example.com/]]
10502 !! config
10503 wgExternalLinkTarget='foobar'
10504 !! html
10505 <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>
10506 </p>
10507 !! end
10508
10509 !! test
10510 Image with link parameter, wgNoFollowLinks set to false
10511 !! wikitext
10512 [[Image:foobar.jpg|link=http://example.com/]]
10513 !! config
10514 wgNoFollowLinks=false
10515 !! html
10516 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10517 </p>
10518 !! end
10519
10520 !! test
10521 Image with link parameter, wgNoFollowDomainExceptions
10522 !! wikitext
10523 [[Image:foobar.jpg|link=http://example.com/]]
10524 !! config
10525 wgNoFollowDomainExceptions='example.com'
10526 !! html
10527 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10528 </p>
10529 !! end
10530
10531 !! test
10532 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10533 !! wikitext
10534 [[Image:foobar.jpg|link=http://example.com/|Title]]
10535 !! config
10536 wgExternalLinkTarget='foobar'
10537 !! html
10538 <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>
10539 </p>
10540 !! end
10541
10542 !! test
10543 Image with empty link parameter
10544 !! wikitext
10545 [[File:Foobar.jpg|link=]]
10546 !! html/php
10547 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10548 </p>
10549 !! html/parsoid
10550 <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>
10551 !! end
10552
10553 !! test
10554 Image with link parameter (wiki target) and unnamed parameter
10555 !! wikitext
10556 [[File:Foobar.jpg|link=Main_Page|Title]]
10557 !! html/php
10558 <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>
10559 </p>
10560 !! html/parsoid
10561 <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>
10562 !! end
10563
10564 !! test
10565 Image with link parameter (URL target) and unnamed parameter
10566 !! wikitext
10567 [[File:Foobar.jpg|link=http://example.com/|Title]]
10568 !! html/php
10569 <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>
10570 </p>
10571 !! html/parsoid
10572 <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>
10573 !! end
10574
10575 !! test
10576 Thumbnail image with link parameter
10577 !! options
10578 thumbsize=220
10579 parsoid=wt2html,wt2wt,html2html
10580 !! wikitext
10581 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10582 !! html/php
10583 <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>
10584
10585 !! html/parsoid
10586 <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>
10587 !! end
10588
10589 !! test
10590 Manually-specified thumbnail image
10591 !! options
10592 thumbsize=220
10593 !! wikitext
10594 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10595 !! html/php
10596 <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>
10597
10598 !! html/parsoid
10599 <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>
10600 !! end
10601
10602 !! test
10603 Manually-specified thumbnail image with explicit link to wiki page
10604 !! options
10605 thumbsize=220
10606 parsoid=wt2html,wt2wt,html2html
10607 !! wikitext
10608 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10609 !! html/php
10610 <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>
10611
10612 !! html/parsoid
10613 <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>
10614 !! end
10615
10616 !! test
10617 Manually-specified thumbnail image with explicit link to url
10618 !! options
10619 thumbsize=220
10620 parsoid=wt2html,wt2wt,html2html
10621 !! wikitext
10622 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10623 !! html/php
10624 <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>
10625
10626 !! html/parsoid
10627 <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>
10628 !! end
10629
10630 !! test
10631 Manually-specified thumbnail image with explicit no link
10632 !! options
10633 thumbsize=220
10634 parsoid=wt2html,wt2wt,html2html
10635 !! wikitext
10636 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10637 !! html/php
10638 <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>
10639
10640 !! html/parsoid
10641 <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>
10642 !! end
10643
10644 !! test
10645 Manually-specified thumbnail image with explicit link and alt text
10646 !! options
10647 thumbsize=220
10648 parsoid=wt2html,wt2wt,html2html
10649 !! wikitext
10650 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10651 !! html/php
10652 <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>
10653
10654 !! html/parsoid
10655 <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>
10656 !! end
10657
10658 !! test
10659 Image with frame and link
10660 !! options
10661 parsoid=wt2html,wt2wt,html2html
10662 !! wikitext
10663 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10664 !! html/php
10665 <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>
10666
10667 !! html/parsoid
10668 <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>
10669 !! end
10670
10671 !! test
10672 Image with frame and link and explicit alt
10673 !! options
10674 parsoid=wt2html,wt2wt,html2html
10675 !! wikitext
10676 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10677 !! html/php
10678 <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>
10679
10680 !! html/parsoid
10681 <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>
10682 !! end
10683
10684 !! test
10685 Image with wiki markup in implicit alt
10686 !! options
10687 parsoid=wt2html,wt2wt,html2html
10688 !! wikitext
10689 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10690
10691 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10692 !! html/php
10693 <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>
10694 </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>
10695 </p>
10696 !! html/parsoid
10697 <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>
10698 <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>
10699 !! end
10700
10701 ###################
10702 # Conflicting image format options.
10703 # First option specified should 'win'.
10704 # All three cases in each test should be identical.
10705
10706 !! test
10707 Image with 'frameless' first.
10708 !! options
10709 parsoid=wt2html,wt2wt,html2html
10710 !! wikitext
10711 [[File:Foobar.jpg|frameless|caption]]
10712
10713 [[File:Foobar.jpg|frameless|frame|caption]]
10714
10715 [[File:Foobar.jpg|frameless|thumb|caption]]
10716 !! html/php
10717 <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>
10718 </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>
10719 </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>
10720 </p>
10721 !! html/parsoid
10722 <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>
10723 <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>
10724 <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>
10725 !! end
10726
10727 !! test
10728 Image with 'frame' first.
10729 !! options
10730 parsoid=wt2html,wt2wt,html2html
10731 !! wikitext
10732 [[File:Foobar.jpg|frame|caption]]
10733 [[File:Foobar.jpg|frame|frameless|caption]]
10734 [[File:Foobar.jpg|frame|thumb|caption]]
10735 !! html/php
10736 <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>
10737 <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>
10738 <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>
10739
10740 !! html/parsoid
10741 <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>
10742 !! end
10743
10744 !! test
10745 Image with 'thumb' first.
10746 !! options
10747 parsoid=wt2html,wt2wt,html2html
10748 !! wikitext
10749 [[File:Foobar.jpg|thumb|caption]]
10750 [[File:Foobar.jpg|thumb|frameless|caption]]
10751 [[File:Foobar.jpg|thumb|frame|caption]]
10752 !! html/php
10753 <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>
10754 <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>
10755 <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>
10756
10757 !! html/parsoid
10758 <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>
10759 !! end
10760
10761 ###################
10762 # Image sizing.
10763 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10764 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10765 # Foobar has actual size of 1941x220
10766 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10767 # a scalable format.
10768 # 2. Framed images always ignore size options; always render at default size.
10769 # 3. "Unspecified format" and border are the only types which can be
10770 # enlarged.
10771
10772 !! test
10773 Image: "unspecified format" and border enlarge
10774 !! options
10775 parsoid=wt2html,wt2wt,html2html
10776 !! wikitext
10777 [[File:Foobar.jpg|2000px]]
10778
10779 [[File:Foobar.jpg|border|2000px]]
10780 !! html/php
10781 <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>
10782 </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>
10783 </p>
10784 !! html/parsoid
10785 <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>
10786 <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>
10787 !! end
10788
10789 !! test
10790 Image: "unspecified format" and border reduce
10791 !! options
10792 parsoid=wt2html,wt2wt,html2html
10793 !! wikitext
10794 [[File:Foobar.jpg|1000px]]
10795
10796 [[File:Foobar.jpg|border|1000px]]
10797 !! html/php
10798 <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>
10799 </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>
10800 </p>
10801 !! html/parsoid
10802 <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>
10803 <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>
10804 !! end
10805
10806 !! test
10807 Image: thumbs reduce
10808 !! options
10809 parsoid=wt2html,wt2wt,html2html
10810 !! wikitext
10811 [[File:Foobar.jpg|thumb|50px]]
10812 !! html/php
10813 <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>
10814
10815 !! html/parsoid
10816 <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>
10817 !! end
10818
10819 !! test
10820 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10821 !! options
10822 parsoid=wt2html,wt2wt,html2html
10823 !! wikitext
10824 [[File:Foobar.jpg|thumb|2000px]]
10825
10826 [[File:Foobar.svg|thumb|2000px]]
10827 !! html/php
10828 <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>
10829 <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>
10830
10831 !! html/parsoid
10832 <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>
10833 <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>
10834 !! end
10835
10836 !! test
10837 Image: frameless can reduce in size
10838 !! options
10839 parsoid=wt2html,wt2wt,html2html
10840 !! wikitext
10841 [[File:Foobar.jpg|frameless|50px]]
10842 !! html/php
10843 <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>
10844 </p>
10845 !! html/parsoid
10846 <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>
10847 !! end
10848
10849 !! test
10850 Image: bitmap frameless can't be enlarged past original size, but vector can
10851 !! options
10852 parsoid=wt2html,wt2wt,html2html
10853 !! wikitext
10854 [[File:Foobar.jpg|frameless|2000px]]
10855
10856 [[File:Foobar.svg|frameless|2000px]]
10857 !! html/php
10858 <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>
10859 </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>
10860 </p>
10861 !! html/parsoid
10862 <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>
10863 <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>
10864 !! end
10865
10866 !! test
10867 Image: framed images are always unscaled.
10868 !! options
10869 parsoid=wt2html,wt2wt,html2html
10870 !! wikitext
10871 [[File:Foobar.jpg|frame]]
10872
10873 [[File:Foobar.jpg|frame|50px]]
10874
10875 [[File:Foobar.jpg|frame|50x50px]]
10876
10877 [[File:Foobar.jpg|frame|2000px]]
10878 !! html/php
10879 <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>
10880 <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>
10881 <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>
10882 <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>
10883
10884 !! html/parsoid
10885 <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>
10886 !! end
10887
10888 ###################
10889
10890 !! test
10891 Link to image page- image page normally doesn't exists, hence edit link
10892 Add test with existing image page
10893 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10894 !! wikitext
10895 [[:Image:test]]
10896 !! html
10897 <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>
10898 </p>
10899 !! end
10900
10901 !! test
10902 bug 18784 Link to non-existent image page with caption should use caption as link text
10903 !! wikitext
10904 [[:Image:test|caption]]
10905 !! html
10906 <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>
10907 </p>
10908 !! end
10909
10910 !! test
10911 Frameless image caption with a free URL
10912 !! wikitext
10913 [[File:Foobar.jpg|http://example.com]]
10914 !! html/php
10915 <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>
10916 </p>
10917 !! html/parsoid
10918 <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>
10919 !! end
10920
10921 !! test
10922 Thumbnail image caption with a free URL
10923 !! options
10924 thumbsize=220
10925 !! wikitext
10926 [[File:Foobar.jpg|thumb|http://example.com]]
10927 !! html/php
10928 <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>
10929
10930 !! html/parsoid
10931 <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>
10932 !! end
10933
10934 !! test
10935 Thumbnail image caption with a free URL and explicit alt
10936 !! options
10937 thumbsize=220
10938 parsoid=wt2html,wt2wt,html2html
10939 !! wikitext
10940 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10941 !! html/php
10942 <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>
10943
10944 !! html/parsoid
10945 <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>
10946 !! end
10947
10948 !! test
10949 SVG thumbnails with no language set
10950 !! options
10951 !! wikitext
10952 [[File:Foobar.svg|thumb|caption]]
10953 !! html/php
10954 <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>
10955
10956 !! html/parsoid
10957 <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>
10958 !! end
10959
10960 !! test
10961 SVG thumbnails with language de
10962 !! options
10963 parsoid=wt2html,wt2wt,html2html
10964 !! wikitext
10965 [[File:Foobar.svg|thumb|caption|lang=de]]
10966 !! html/php
10967 <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>
10968
10969 !! html/parsoid
10970 <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>
10971 !! end
10972
10973 !! test
10974 SVG thumbnails with invalid language code
10975 !! options
10976 parsoid=wt2html,wt2wt,html2html
10977 !! wikitext
10978 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10979 !! html/php
10980 <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>
10981
10982 !! html/parsoid
10983 <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>
10984 !! end
10985
10986 !! test
10987 BUG 1887: A ISBN with a thumbnail
10988 !! wikitext
10989 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10990 !! html/php
10991 <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>
10992
10993 !! html/parsoid
10994 <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>
10995 !! end
10996
10997 !! test
10998 BUG 1887: A RFC with a thumbnail
10999 !! wikitext
11000 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11001 !! html/php
11002 <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>
11003
11004 !! html/parsoid
11005 <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>
11006 !! end
11007
11008 !! test
11009 BUG 1887: A mailto link with a thumbnail
11010 !! wikitext
11011 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11012 !! html/php
11013 <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>
11014
11015 !! html/parsoid
11016 <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>
11017 !! end
11018
11019 # Pending resolution to bug 368
11020 !! test
11021 BUG 648: Frameless image caption with a link
11022 !! wikitext
11023 [[File:Foobar.jpg|text with a [[link]] in it]]
11024 !! html/php
11025 <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>
11026 </p>
11027 !! html/parsoid
11028 <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>
11029 !! end
11030
11031 !! test
11032 BUG 648: Frameless image caption with a link (suffix)
11033 !! wikitext
11034 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11035 !! html/php
11036 <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>
11037 </p>
11038 !! html/parsoid
11039 <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>
11040 !! end
11041
11042 !! test
11043 BUG 648: Frameless image caption with an interwiki link
11044 !! wikitext
11045 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11046 !! html/php
11047 <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>
11048 </p>
11049 !! html/parsoid
11050 <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>
11051 !! end
11052
11053 !! test
11054 BUG 648: Frameless image caption with a piped interwiki link
11055 !! wikitext
11056 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11057 !! html/php
11058 <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>
11059 </p>
11060 !! html/parsoid
11061 <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>
11062 !! end
11063
11064 !! test
11065 Escape HTML special chars in image alt text
11066 !! wikitext
11067 [[File:Foobar.jpg|& < > "]]
11068 !! html/php
11069 <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>
11070 </p>
11071 !! html/parsoid
11072 <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>
11073 !! end
11074
11075 !! test
11076 BUG 499: Alt text should have &#1234;, not &amp;1234;
11077 !! wikitext
11078 [[File:Foobar.jpg|&#9792;]]
11079 !! html/php
11080 <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>
11081 </p>
11082 !! html/parsoid
11083 <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>
11084 !! end
11085
11086 !! test
11087 Broken image caption with link
11088 !! options
11089 parsoid=wt2html,wt2wt,html2html
11090 !! wikitext
11091 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11092 !! html/php
11093 <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.
11094 </p>
11095 !! html/parsoid
11096 <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>
11097 !! end
11098
11099 !! test
11100 Image caption containing another image
11101 !! wikitext
11102 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11103 !! html/php
11104 <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>
11105
11106 !! html/parsoid
11107 <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>
11108 !! end
11109
11110 !! test
11111 Image: caption containing a newline
11112 !! wikitext
11113 [[File:Foobar.jpg|This
11114 *is some text]]
11115 !! html/php
11116 <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>
11117 </p>
11118 !! html/parsoid
11119 <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>
11120 !!end
11121
11122 !!test
11123 Image: caption containing leading space
11124 (The leading space should not trigger nowiki escaping in wt2wt mode)
11125 !! wikitext
11126 [[File:Foobar.jpg|thumb| bar]]
11127 !! html/php
11128 <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>
11129
11130 !! html/parsoid
11131 <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>
11132 !!end
11133
11134 !! test
11135 Image: caption containing a table
11136 !! options
11137 parsoid=wt2html,wt2wt,html2html
11138 !! wikitext
11139 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11140 {|
11141 ! Foo !! Bar
11142 |-
11143 | Foo1 || Bar1
11144 |}
11145 and some more text.]]
11146 !! html/php
11147 <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>
11148
11149 !! html/parsoid
11150 <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
11151 <table>
11152 <tbody>
11153 <tr><th>Foo </th><th>Bar</th></tr>
11154 <tr>
11155 <td>Foo1 </td>
11156 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11157 !! end
11158
11159 !! test
11160 Bug 3090: External links other than http: in image captions
11161 !! wikitext
11162 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11163 !! html/php
11164 <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>
11165
11166 !! html/parsoid
11167 <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>
11168 !! end
11169
11170 !! test
11171 Custom class
11172 !! options
11173 parsoid=wt2html,wt2wt,html2html
11174 !! wikitext
11175 [[Image:foobar.jpg|a|class=b]]
11176 !! html/php
11177 <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>
11178 </p>
11179 !! html/parsoid
11180 <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>
11181 !! end
11182
11183 !! test
11184 Localized image handling (1).
11185 !! options
11186 parsoid=wt2html,wt2wt,html2html
11187 language=es
11188 !! wikitext
11189 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11190 !! html/php
11191 <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>
11192
11193 !! html/parsoid
11194 <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>
11195 !! end
11196
11197 !! test
11198 Localized image handling (2).
11199 !! options
11200 thumbsize=220
11201 parsoid=wt2html,wt2wt,html2html
11202 language=es
11203 !! wikitext
11204 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11205 !! html/php
11206 <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>
11207
11208 !! html/parsoid
11209 <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>
11210 !! end
11211
11212 !! test
11213 "border", "frameless" and "class" attributes on an image.
11214 !! options
11215 thumbsize=220
11216 parsoid=wt2html,wt2wt,html2html
11217 !! wikitext
11218 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11219 !! html/php
11220 <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>
11221 </p>
11222 !! html/parsoid
11223 <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>
11224 !! end
11225
11226 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11227 !! test
11228 Invalid image attributes (bug 62500)
11229 !! options
11230 thumbsize=220
11231 parsoid=wt2html,wt2wt,html2html
11232 !! wikitext
11233 [[File:Foobar.jpg|thumb|float|left|caption]]
11234
11235 [[File:Foobar.jpg|thumb|righ|caption]]
11236
11237 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11238 !! html/php
11239 <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>
11240 <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>
11241 <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>
11242
11243 !! html/parsoid
11244 <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>
11245 !! end
11246
11247 !! article
11248 File:Barfoo.jpg
11249 !! text
11250 #REDIRECT [[File:Barfoo.jpg]]
11251 !! endarticle
11252
11253 !! test
11254 Redirected image
11255 !! wikitext
11256 [[Image:Barfoo.jpg]]
11257 !! html
11258 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11259 </p>
11260 !! end
11261
11262 !! test
11263 Missing image with uploads disabled
11264 !! options
11265 wgEnableUploads=0
11266 !! wikitext
11267 [[Image:Foobaz.jpg]]
11268 !! html
11269 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11270 </p>
11271 !! end
11272
11273 # Parsoid-specific testing for images
11274 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11275 # Currently imperfect due to a flaw in the Parsoid testrunner
11276 # Work in progress
11277 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11278 # image tests.
11279
11280 !! test
11281 Parsoid-specific image handling - simple image with size and middle alignment
11282 !! wikitext
11283 [[File:Foobar.jpg|middle|50px]]
11284 !! html/parsoid
11285 <p><span class="mw-valign-middle" typeof="mw:Image">
11286 <a href="File:Foobar.jpg">
11287 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11288 </a>
11289 </span>
11290 </p>
11291 !! end
11292
11293 !! test
11294 Parsoid-specific image handling - simple image with size, middle alignment,
11295 non-standard namespace alias
11296 !! options
11297 parsoid=wt2wt,wt2html,html2html
11298 !! wikitext
11299 [[Image:Foobar.jpg|middle|50px]]
11300 !! html/parsoid
11301 <p><span class="mw-valign-middle" typeof="mw:Image">
11302 <a href="File:Foobar.jpg">
11303 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11304 </a>
11305 </span>
11306 </p>
11307 !! end
11308
11309 !! test
11310 Parsoid-specific image handling - simple image with size and middle alignment
11311 (existing content)
11312 !! wikitext
11313 [[File:Foobar.jpg|50px|middle]]
11314 !! html/parsoid
11315 <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>
11316 !! end
11317
11318 !! test
11319 Parsoid-specific image handling - simple image with size and middle alignment
11320 and non-standard namespace name
11321 !! options
11322 parsoid=wt2html,wt2wt,html2html
11323 !! wikitext
11324 [[Image:Foobar.jpg|50px|middle]]
11325 !! html/parsoid
11326 <p><span class="mw-valign-middle" typeof="mw:Image">
11327 <a href="File:Foobar.jpg">
11328 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11329 </a>
11330 </span>
11331 </p>
11332 !! end
11333
11334 !! test
11335 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11336 !! wikitext
11337 [[File:Foobar.jpg|500x10px|baseline|caption]]
11338 !! html/parsoid
11339 <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>
11340 !! end
11341
11342 !! test
11343 Parsoid-specific image handling - simple image with border and size spec
11344 !! wikitext
11345 [[File:Foobar.jpg|50px|border|caption]]
11346 !! html/parsoid
11347 <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>
11348 !! end
11349
11350 !! test
11351 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11352 !! wikitext
11353 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11354 !! html/parsoid
11355 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11356 <a href="File:Foobar.jpg">
11357 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11358 </a>
11359 <figcaption>caption content</figcaption>
11360 </figure>
11361 !! end
11362
11363 !! test
11364 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11365 (existing content)
11366 !! wikitext
11367 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11368 !! html/parsoid
11369 <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>
11370 !! end
11371
11372 !! test
11373 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11374 !! wikitext
11375 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11376 !! html/parsoid
11377 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11378 <a href="File:Foobar.jpg">
11379 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11380 </a>
11381 <figcaption>caption</figcaption>
11382 </figure>
11383 !! end
11384
11385 !! test
11386 Parsoid-specific image handling - thumbnail with specific size, halign,
11387 valign, and caption (existing content)
11388 !! wikitext
11389 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11390 !! html/parsoid
11391 <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>
11392 !! end
11393
11394 !! test
11395 Parsoid-specific image handling - framed image with specific size and caption
11396 (size is ignored)
11397 !! options
11398 parsoid=wt2html,wt2wt,html2html
11399 !! wikitext
11400 [[File:Foobar.jpg|frame|500x50px|caption]]
11401 !! html/parsoid
11402 <figure typeof="mw:Image/Frame">
11403 <a href="File:Foobar.jpg">
11404 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11405 </a>
11406 <figcaption>caption</figcaption>
11407 </figure>
11408 !! end
11409
11410 !! test
11411 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11412 (size is ignored)
11413 !! options
11414 parsoid=wt2html,wt2wt,html2html
11415 !! wikitext
11416 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11417 !! html/parsoid
11418 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11419 <a href="File:Foobar.jpg">
11420 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11421 </a>
11422 <figcaption>caption</figcaption>
11423 </figure>
11424 !! end
11425
11426 !! test
11427 Parsoid-specific image handling - frameless image with specific size, border, and caption
11428 !! wikitext
11429 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11430 !! html/parsoid
11431 <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>
11432 !! end
11433
11434 !! test
11435 Parsoid-specific image handling - simple image with a formatted caption
11436 !! wikitext
11437 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11438 !! html/parsoid
11439 <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>"}'>
11440 <a href="File:Foobar.jpg">
11441 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11442 </a></span></p>
11443 !! end
11444
11445 !! test
11446 Parsoid-specific image handling - caption with a template in it
11447 !! wikitext
11448 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11449 !! html/parsoid
11450 <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>
11451 !! end
11452
11453 !! test
11454 Parsoid-specific image handling - caption with unbalanced tags in it
11455 !! options
11456 parsoid=wt2html,wt2wt,html2html
11457 !! wikitext
11458 foo
11459 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11460 bar
11461 !! html/parsoid
11462 <p>foo</p>
11463 <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>
11464 <p>bar</p>
11465 !! end
11466
11467 !! test
11468 Parsoid-specific image handling - empty caption (1)
11469 !! options
11470 parsoid=wt2html,wt2wt
11471 !! wikitext
11472 [[File:Foobar.jpg|thumb|]]
11473 !! html/parsoid
11474 <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>
11475 !! end
11476
11477 # empty captions don't get serialized unless we're in the "round trip" case
11478 !! test
11479 Parsoid-specific image handling - empty caption (2)
11480 !! options
11481 parsoid=html2wt
11482 !! html/parsoid
11483 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11484 <a href="File:Foobar.jpg">
11485 <img resource="./File:Foobar.jpg"
11486 src="//example.com/images/3/3a/Foobar.jpg"
11487 height="25" width="220"/>
11488 </a>
11489 <figcaption></figcaption>
11490 </figure>
11491 !! wikitext
11492 [[File:Foobar.jpg|thumb]]
11493 !! end
11494
11495 !! test
11496 Parsoid-specific image handling - whitespace caption
11497 !! wikitext
11498 [[File:Foobar.jpg|thumb| ]]
11499 !! html/parsoid
11500 <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>
11501 !! end
11502
11503 !! test
11504 Parsoid-specific image handling - lang option
11505 !! wikitext
11506 foo
11507 [[File:Foobar.svg|lang=de|caption]]
11508 bar
11509 !! html/parsoid
11510 <p>foo
11511 <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>
11512 bar</p>
11513 !! end
11514
11515
11516 ###
11517 ### Subpages
11518 ###
11519 !! article
11520 Subpage test/subpage
11521 !! text
11522 foo
11523 !! endarticle
11524
11525 !! test
11526 Subpage link
11527 !! options
11528 subpage title=[[Subpage test]]
11529 !! wikitext
11530 [[/subpage]]
11531 !! html
11532 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11533 </p>
11534 !! end
11535
11536 !! test
11537 Subpage noslash link
11538 !! options
11539 subpage title=[[Subpage test]]
11540 !! wikitext
11541 [[/subpage/]]
11542 !! html
11543 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11544 </p>
11545 !! end
11546
11547 # TODO: make this PHP-parser compatible!
11548 !! test
11549 Relative subpage noslash link
11550 !! options
11551 parsoid=wt2wt,wt2html,html2html
11552 subpage title=[[Subpage test/1/2/3/4]]
11553 !! wikitext
11554 [[../../subpage/]]
11555
11556 [[../../subpage]]
11557 !! html
11558 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11559 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11560 !! end
11561
11562 !! test
11563 Parsoid: dot-slash prefixed wikilinks
11564 !! wikitext
11565 [[./foo]]
11566
11567 [[././bar]]
11568
11569 [[././baz/]]
11570 !! html/php
11571 <p>[[./foo]]
11572 </p><p>[[././bar]]
11573 </p><p>[[././baz/]]
11574 </p>
11575 !! html/parsoid
11576 <p>[[./foo]]
11577 </p><p>[[././bar]]
11578 </p><p>[[././baz/]]
11579 </p>
11580 !! end
11581
11582 !! test
11583 Render invalid page names as plain text (bug 51090)
11584 !! wikitext
11585 [[./../foo|bar]]
11586 [[foo�|bar]]
11587 [[foo/.|bar]]
11588 [[foo/..|bar]]
11589 [[foo~~~bar]]
11590 [[foo>bar]]
11591 [[foo[bar]]
11592 [[.]]
11593 [[..]]
11594 [[foo././bar]]
11595
11596 [[{{echo|./../foo}}|bar]]
11597 [[{{echo|foo/.}}|bar]]
11598 [[{{echo|foo/..}}|bar]]
11599 [[{{echo|foo~~~~bar}}]]
11600 [[{{echo|foo>bar}}]]
11601 [[{{echo|foo././bar}}]]
11602 [[{{echo|foo{bar}}]]
11603 [[{{echo|foo}bar}}]]
11604 [[{{echo|foo[bar}}]]
11605 [[{{echo|foo]bar}}]]
11606 [[{{echo|foo<bar}}]]
11607 !!html/php
11608 <p>[[./../foo|bar]]
11609 [[foo�|bar]]
11610 [[foo/.|bar]]
11611 [[foo/..|bar]]
11612 [[foo~~~bar]]
11613 [[foo&gt;bar]]
11614 [[foo[bar]]
11615 [[.]]
11616 [[..]]
11617 [[foo././bar]]
11618 </p><p>[[./../foo|bar]]
11619 [[foo/.|bar]]
11620 [[foo/..|bar]]
11621 [[foo~~~~bar]]
11622 [[foo&gt;bar]]
11623 [[foo././bar]]
11624 [[foo{bar]]
11625 [[foo}bar]]
11626 [[foo[bar]]
11627 [[foo]bar]]
11628 [[foo&lt;bar]]
11629 </p>
11630 !!html/parsoid
11631 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11632 <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>
11633 !!end
11634
11635 !! test
11636 Disabled subpages
11637 !! wikitext
11638 [[/subpage]]
11639 !! html
11640 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11641 </p>
11642 !! end
11643
11644 !! test
11645 BUG 561: {{/Subpage}}
11646 !! options
11647 subpage title=[[Page]]
11648 !! wikitext
11649 {{/Subpage}}
11650 !! html
11651 <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>
11652 </p>
11653 !! end
11654
11655 ###
11656 ### Categories
11657 ###
11658 !! article
11659 Category:MediaWiki User's Guide
11660 !! text
11661 blah
11662 !! endarticle
11663
11664 !! test
11665 Link to category
11666 !! wikitext
11667 [[:Category:MediaWiki User's Guide]]
11668 !! html
11669 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11670 </p>
11671 !! end
11672
11673 !! test
11674 Simple category
11675 !! options
11676 cat
11677 !! wikitext
11678 [[Category:MediaWiki User's Guide]]
11679 !! html
11680 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11681 !! end
11682
11683 !! test
11684 PAGESINCATEGORY invalid title fatal (r33546 fix)
11685 !! wikitext
11686 {{PAGESINCATEGORY:<bogus>}}
11687 !! html
11688 <p>0
11689 </p>
11690 !! end
11691
11692 !! test
11693 Category with different sort key
11694 !! options
11695 cat
11696 !! wikitext
11697 [[Category:MediaWiki User's Guide|Foo]]
11698 !! html
11699 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11700 !! end
11701
11702 !! test
11703 Category with identical sort key
11704 !! options
11705 cat
11706 !! wikitext
11707 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
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 empty sort key
11714 !! options
11715 cat
11716 pst
11717 !! wikitext
11718 [[Category:MediaWiki User's Guide|]]
11719 !! html
11720 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11721 !! end
11722
11723 !! test
11724 Category with empty sort key and parentheses
11725 !! options
11726 cat
11727 pst
11728 !! wikitext
11729 [[Category:Foo (bar)|]]
11730 !! html
11731 [[Category:Foo (bar)|Foo]]
11732 !! end
11733
11734 !! test
11735 Category with link tail
11736 !! options
11737 cat
11738 pst
11739 !! wikitext
11740 123[[Category:Foo]]456
11741 !! html
11742 123[[Category:Foo]]456
11743 !! end
11744
11745 !! test
11746 Category with template
11747 !! options
11748 cat
11749 pst
11750 !! wikitext
11751 [[Category:{{echo|Foo}}]]
11752 !! html
11753 [[Category:{{echo|Foo}}]]
11754 !! end
11755
11756 !! test
11757 Category with template in sort key
11758 !! options
11759 cat
11760 pst
11761 !! wikitext
11762 [[Category:Foo|{{echo|Bar}}]]
11763 !! html
11764 [[Category:Foo|{{echo|Bar}}]]
11765 !! end
11766
11767 !! test
11768 Category with template in sort key and title
11769 !! options
11770 cat
11771 pst
11772 !! wikitext
11773 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11774 !! html
11775 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11776 !! end
11777
11778 !! test
11779 Category / paragraph interactions
11780 !! wikitext
11781 Foo [[Category:Baz]] Bar
11782
11783 Foo [[Category:Baz]]
11784 Bar
11785
11786 Foo
11787 [[Category:Baz]]
11788 Bar
11789
11790 Foo
11791 [[Category:Baz]] Bar
11792
11793 Foo
11794 [[Category:Baz]]
11795 [[Category:Baz]]
11796 [[Category:Baz]]
11797 Bar
11798
11799 [[Category:Baz]]
11800 [[Category:Baz]]
11801 [[Category:Baz]]
11802
11803 [[Category:Baz]]
11804 {{echo|[[Category:Baz]]}}
11805 [[Category:Baz]]
11806 !! html
11807 <p>Foo Bar
11808 </p><p>Foo
11809 Bar
11810 </p><p>Foo
11811 Bar
11812 </p><p>Foo Bar
11813 </p><p>Foo
11814 Bar
11815 </p>
11816 !! end
11817
11818 !! test
11819 Parsoid: Serialize link to category page with colon escape
11820 !! options
11821 parsoid
11822 !! wikitext
11823
11824 [[:Category:Foo]]
11825 [[:Category:Foo|Bar]]
11826 !! html
11827 <p>
11828 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11829 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11830 </p>
11831 !! end
11832
11833 !! test
11834 Parsoid: Link prefix/suffixes aren't applied to category links
11835 !! options
11836 parsoid=wt2html,wt2wt,html2html
11837 language=is
11838 !! wikitext
11839 x[[Category:Foo]]y
11840 !! html
11841 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11842 !! end
11843
11844 !! test
11845 Parsoid: Serialize link to file page with colon escape
11846 !! options
11847 parsoid
11848 !! wikitext
11849
11850 [[:File:Foo.png]]
11851 [[:File:Foo.png|Bar]]
11852 !! html
11853 <p>
11854 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11855 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11856 </p>
11857 !! end
11858
11859 !! test
11860 Parsoid: Serialize a genuine category link without colon escape
11861 !! options
11862 parsoid
11863 !! wikitext
11864 [[Category:Foo]]
11865 [[Category:Foo|Bar]]
11866 !! html
11867 <link rel="mw:PageProp/Category" href="Category:Foo">
11868 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11869 !! end
11870
11871 !! test
11872 Parsoid: Defaultsort
11873 !! options
11874 parsoid
11875 !! wikitext
11876 {{DEFAULTSORT:Foo}}
11877 !! html
11878 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11879 !! end
11880
11881 ###
11882 ### Inter-language links
11883 ###
11884 !! test
11885 Inter-language links
11886 !! options
11887 ill
11888 !! wikitext
11889 [[es:Alimento]]
11890 [[fr:Nourriture]]
11891 [[zh:&#39135;&#21697;]]
11892 !! html
11893 es:Alimento fr:Nourriture zh:食品
11894 !! end
11895
11896 !! test
11897 Duplicate interlanguage links (bug 24502)
11898 !! options
11899 ill
11900 !! wikitext
11901 [[es:1]]
11902 [[es:2]]
11903 [[fr:1]]
11904 [[fr:2]]
11905 !! html
11906 es:1 fr:1
11907 !! end
11908
11909 ###
11910 ### Sections
11911 ###
11912 !! test
11913 Basic section headings
11914 !! wikitext
11915 == Headline 1 ==
11916 Some text
11917
11918 ==Headline 2==
11919 More
11920 ===Smaller headline===
11921 Blah blah
11922 !! html
11923 <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>
11924 <p>Some text
11925 </p>
11926 <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>
11927 <p>More
11928 </p>
11929 <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>
11930 <p>Blah blah
11931 </p>
11932 !! end
11933
11934 !! test
11935 Section headings with TOC
11936 !! wikitext
11937 == Headline 1 ==
11938 === Subheadline 1 ===
11939 ===== Skipping a level =====
11940 ====== Skipping a level ======
11941
11942 == Headline 2 ==
11943 Some text
11944 ===Another headline===
11945 !! html
11946 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11947 <ul>
11948 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11949 <ul>
11950 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11951 <ul>
11952 <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>
11953 <ul>
11954 <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>
11955 </ul>
11956 </li>
11957 </ul>
11958 </li>
11959 </ul>
11960 </li>
11961 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11962 <ul>
11963 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11964 </ul>
11965 </li>
11966 </ul>
11967 </div>
11968
11969 <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>
11970 <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>
11971 <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>
11972 <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>
11973 <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>
11974 <p>Some text
11975 </p>
11976 <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>
11977
11978 !! end
11979
11980 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11981 !! test
11982 Handling of sections up to level 6 and beyond
11983 !! wikitext
11984 = Level 1 Heading=
11985 == Level 2 Heading==
11986 === Level 3 Heading===
11987 ==== Level 4 Heading====
11988 ===== Level 5 Heading=====
11989 ====== Level 6 Heading======
11990 ======= Level 7 Heading=======
11991 ======== Level 8 Heading========
11992 ========= Level 9 Heading=========
11993 ========== Level 10 Heading==========
11994 !! html
11995 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11996 <ul>
11997 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11998 <ul>
11999 <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>
12000 <ul>
12001 <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>
12002 <ul>
12003 <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>
12004 <ul>
12005 <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>
12006 <ul>
12007 <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>
12008 <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>
12009 <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>
12010 <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>
12011 <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>
12012 </ul>
12013 </li>
12014 </ul>
12015 </li>
12016 </ul>
12017 </li>
12018 </ul>
12019 </li>
12020 </ul>
12021 </li>
12022 </ul>
12023 </div>
12024
12025 <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>
12026 <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>
12027 <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>
12028 <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>
12029 <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>
12030 <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>
12031 <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>
12032 <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>
12033 <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>
12034 <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>
12035
12036 !! end
12037
12038 !! test
12039 TOC regression (bug 9764)
12040 !! wikitext
12041 == title 1 ==
12042 === title 1.1 ===
12043 ==== title 1.1.1 ====
12044 === title 1.2 ===
12045 == title 2 ==
12046 === title 2.1 ===
12047 !! html
12048 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12049 <ul>
12050 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12051 <ul>
12052 <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>
12053 <ul>
12054 <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>
12055 </ul>
12056 </li>
12057 <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>
12058 </ul>
12059 </li>
12060 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12061 <ul>
12062 <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>
12063 </ul>
12064 </li>
12065 </ul>
12066 </div>
12067
12068 <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>
12069 <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>
12070 <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>
12071 <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>
12072 <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>
12073 <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>
12074
12075 !! end
12076
12077 !! test
12078 TOC with wgMaxTocLevel=3 (bug 6204)
12079 !! options
12080 wgMaxTocLevel=3
12081 !! wikitext
12082 == title 1 ==
12083 === title 1.1 ===
12084 ==== title 1.1.1 ====
12085 === title 1.2 ===
12086 == title 2 ==
12087 === title 2.1 ===
12088 !! html
12089 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12090 <ul>
12091 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12092 <ul>
12093 <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>
12094 <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>
12095 </ul>
12096 </li>
12097 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12098 <ul>
12099 <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>
12100 </ul>
12101 </li>
12102 </ul>
12103 </div>
12104
12105 <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>
12106 <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>
12107 <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>
12108 <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>
12109 <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>
12110 <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>
12111
12112 !! end
12113
12114 !! test
12115 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12116 !! options
12117 wgMaxTocLevel=3
12118 !! wikitext
12119 ==Section 1==
12120 ===Section 1.1===
12121 ====Section 1.1.1====
12122 ====Section 1.1.1.1====
12123 ==Section 2==
12124 !! html
12125 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12126 <ul>
12127 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12128 <ul>
12129 <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>
12130 </ul>
12131 </li>
12132 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12133 </ul>
12134 </div>
12135
12136 <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>
12137 <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>
12138 <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>
12139 <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>
12140 <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>
12141
12142 !! end
12143
12144
12145 !! test
12146 Resolving duplicate section names
12147 !! wikitext
12148 == Foo bar ==
12149 == Foo bar ==
12150 !! html
12151 <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>
12152 <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>
12153
12154 !! end
12155
12156 !! test
12157 Resolving duplicate section names with differing case (bug 10721)
12158 !! wikitext
12159 == Foo bar ==
12160 == Foo Bar ==
12161 !! html
12162 <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>
12163 <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>
12164
12165 !! end
12166
12167 !! article
12168 Template:sections
12169 !! text
12170 ===Section 1===
12171 ==Section 2==
12172 !! endarticle
12173
12174 !! test
12175 Template with sections, __NOTOC__
12176 !! wikitext
12177 __NOTOC__
12178 ==Section 0==
12179 {{sections}}
12180 ==Section 4==
12181 !! html
12182 <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>
12183 <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>
12184 <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>
12185 <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>
12186
12187 !! end
12188
12189 !! test
12190 __NOEDITSECTION__ keyword
12191 !! wikitext
12192 __NOEDITSECTION__
12193 ==Section 1==
12194 ==Section 2==
12195 !! html
12196 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12197 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12198
12199 !! end
12200
12201 !! test
12202 Link inside a section heading
12203 !! wikitext
12204 ==Section with a [[Main Page|link]] in it==
12205 !! html
12206 <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>
12207
12208 !! end
12209
12210 !! test
12211 TOC regression (bug 12077)
12212 !! wikitext
12213 __TOC__
12214 == title 1 ==
12215 === title 1.1 ===
12216 == title 2 ==
12217 !! html
12218 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12219 <ul>
12220 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12221 <ul>
12222 <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>
12223 </ul>
12224 </li>
12225 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12226 </ul>
12227 </div>
12228
12229 <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>
12230 <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>
12231 <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>
12232
12233 !! end
12234
12235 !! test
12236 BUG 1219 URL next to image (good)
12237 !! wikitext
12238 http://example.com [[Image:foobar.jpg]]
12239 !! html
12240 <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>
12241 </p>
12242 !!end
12243
12244 !! test
12245 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12246 !! wikitext
12247 ===
12248 The line above must have a trailing space!
12249 === <!--
12250 --> <!-- -->
12251 But just in case it doesn't...
12252 !! html
12253 <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>
12254 <p>The line above must have a trailing space!
12255 </p>
12256 <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>
12257 <p>But just in case it doesn't...
12258 </p>
12259 !! end
12260
12261 !! test
12262 Header with special characters (bug 25462)
12263 !! wikitext
12264 The tooltips shall not show entities to the user (ie. be double escaped)
12265
12266 == text > text ==
12267 section 1
12268
12269 == text < text ==
12270 section 2
12271
12272 == text & text ==
12273 section 3
12274
12275 == text ' text ==
12276 section 4
12277
12278 == text " text ==
12279 section 5
12280 !! html
12281 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12282 </p>
12283 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12284 <ul>
12285 <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>
12286 <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>
12287 <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>
12288 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12289 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12290 </ul>
12291 </div>
12292
12293 <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>
12294 <p>section 1
12295 </p>
12296 <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>
12297 <p>section 2
12298 </p>
12299 <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>
12300 <p>section 3
12301 </p>
12302 <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>
12303 <p>section 4
12304 </p>
12305 <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>
12306 <p>section 5
12307 </p>
12308 !! end
12309
12310 !! test
12311 Headers with excess '=' characters
12312 (Are similar tests necessary beyond the 1st level?)
12313 !! wikitext
12314 =foo==
12315 ==foo=
12316 =''italic'' heading==
12317 ==''italic'' heading=
12318 !! html
12319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12320 <ul>
12321 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12322 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12323 <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>
12324 <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>
12325 </ul>
12326 </div>
12327
12328 <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>
12329 <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>
12330 <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>
12331 <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>
12332
12333 !! end
12334
12335 !! test
12336 HTML headers vs TOC (bug 23393)
12337 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12338 !! wikitext
12339 <h1>Header 1</h1>
12340 == Header 1.1 ==
12341 == Header 1.2 ==
12342
12343 <h1>Header 2
12344 </h1>
12345 == Header 2.1 ==
12346 == Header 2.2 ==
12347 __NOEDITSECTION__
12348 !! html
12349 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12350 <ul>
12351 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12352 <ul>
12353 <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>
12354 <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>
12355 </ul>
12356 </li>
12357 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12358 <ul>
12359 <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>
12360 <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>
12361 </ul>
12362 </li>
12363 </ul>
12364 </div>
12365
12366 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12367 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12368 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12369 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12370 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12371 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12372
12373 !! end
12374
12375 !! test
12376 Single-line or multiline-comments can follow headings
12377 !! options
12378 parsoid=wt2html,wt2wt
12379 !! wikitext
12380 ==foo==<!---->
12381 ==bar==<!--c1-->
12382 ==baz==<!--
12383 c2
12384 c3-->
12385 !! html
12386 <h2><span class="mw-headline" id="foo">foo</span></h2>
12387 <h2><span class="mw-headline" id="bar">bar</span></h2>
12388 <h2><span class="mw-headline" id="baz">baz</span></h2>
12389
12390 !! end
12391
12392 !! test
12393 BUG 1219 URL next to image (broken)
12394 !! wikitext
12395 http://example.com[[Image:foobar.jpg]]
12396 !! html
12397 <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>
12398 </p>
12399 !!end
12400
12401 !! test
12402 Bug 1186 news: in the middle of text
12403 !! wikitext
12404 http://en.wikinews.org/wiki/Wikinews:Workplace
12405 !! html
12406 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12407 </p>
12408 !!end
12409
12410
12411 !! test
12412 Namespaced link must have a title
12413 !! wikitext
12414 [[Project:]]
12415 !! html
12416 <p>[[Project:]]
12417 </p>
12418 !!end
12419
12420 !! test
12421 Namespaced link must have a title (bad fragment version)
12422 !! wikitext
12423 [[Project:#fragment]]
12424 !! html
12425 <p>[[Project:#fragment]]
12426 </p>
12427 !!end
12428
12429
12430 ###
12431 ### HTML tags and HTML attributes
12432 ###
12433
12434 !! test
12435 div with no attributes
12436 !! wikitext
12437 <div>HTML rocks</div>
12438 !! html
12439 <div>HTML rocks</div>
12440
12441 !! end
12442
12443 !! test
12444 div with double-quoted attribute
12445 !! wikitext
12446 <div id="rock">HTML rocks</div>
12447 !! html
12448 <div id="rock">HTML rocks</div>
12449
12450 !! end
12451
12452 !! test
12453 div with single-quoted attribute
12454 !! wikitext
12455 <div id='rock'>HTML rocks</div>
12456 !! html
12457 <div id="rock">HTML rocks</div>
12458
12459 !! end
12460
12461 !! test
12462 div with unquoted attribute
12463 !! wikitext
12464 <div id=rock>HTML rocks</div>
12465 !! html
12466 <div id="rock">HTML rocks</div>
12467
12468 !! end
12469
12470 !! test
12471 div with illegal double attributes
12472 !! wikitext
12473 <div id="a" id="b">HTML rocks</div>
12474 !! html
12475 <div id="b">HTML rocks</div>
12476
12477 !!end
12478
12479 # FIXME: produce empty string instead of "class" in the PHP parser, following
12480 # the HTML5 spec.
12481 !! test
12482 div with empty attribute value, space before equals
12483 !! options
12484 parsoid
12485 !! wikitext
12486 <div class =>HTML rocks</div>
12487 !! html
12488 <div class="">HTML rocks</div>
12489
12490 !! end
12491
12492 # The PHP parser escapes the opening brace to &#123; for some reason, so
12493 # disabled this test for it.
12494 !! test
12495 div with braces in attribute value
12496 !! options
12497 parsoid
12498 !! wikitext
12499 <div title="{}">Foo</div>
12500 !! html
12501 <div title="{}">Foo</div>
12502 !! end
12503
12504 # This it very inconsistent in the PHP parser: it returns
12505 # class="class" if there is a space between the name and the equal sign (see
12506 # 'div with empty attribute value, space before equals'), but strips the
12507 # attribute completely if the space is missing. We hope that not much content
12508 # depends on this, so are implementing the behavior below in Parsoid for
12509 # consistencies' sake. Disabled for the PHP parser.
12510 # FIXME: fix this behavior in the PHP parser?
12511 !! test
12512 div with empty attribute value, no space before equals
12513 !! options
12514 parsoid
12515 !! wikitext
12516 <div class=>HTML rocks</div>
12517 !! html
12518 <div class="">HTML rocks</div>
12519
12520 !! end
12521
12522 !! test
12523 HTML multiple attributes correction
12524 !! wikitext
12525 <p class="error" class="awesome">Awesome!</p>
12526 !! html
12527 <p class="awesome">Awesome!</p>
12528
12529 !!end
12530
12531 !! test
12532 Table multiple attributes correction
12533 !! wikitext
12534 {|
12535 !+ class="error" class="awesome"| status
12536 |}
12537 !! html
12538 <table>
12539 <tr>
12540 <th class="awesome"> status
12541 </th></tr></table>
12542
12543 !!end
12544
12545 !! test
12546 DIV IN UPPERCASE
12547 !! wikitext
12548 <DIV ID="x">HTML ROCKS</DIV>
12549 !! html
12550 <div id="x">HTML ROCKS</div>
12551
12552 !!end
12553
12554 !! test
12555 Non-ASCII pseudo-tags are rendered as text
12556 !! wikitext
12557 <khyô>
12558 !! html
12559 <p>&lt;khyô&gt;
12560 </p>
12561 !! end
12562
12563 !! test
12564 Pseudo-tag with URL 'name' renders as url link
12565 !! wikitext
12566 <http://example.com/>
12567 !! html
12568 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12569 </p>
12570 !! end
12571
12572 !! test
12573 text with amp in the middle of nowhere
12574 !! wikitext
12575 Remember AT&T?
12576 !! html
12577 <p>Remember AT&amp;T?
12578 </p>
12579 !! end
12580
12581 !! test
12582 text with character entity: eacute
12583 !! wikitext
12584 I always thought &eacute; was a cute letter.
12585 !! html
12586 <p>I always thought &#233; was a cute letter.
12587 </p>
12588 !! end
12589
12590 !! test
12591 text with entity-escaped character entity-like string: eacute
12592 !! wikitext
12593 I always thought &amp;eacute; was a cute letter.
12594 !! html
12595 <p>I always thought &amp;eacute; was a cute letter.
12596 </p>
12597 !! end
12598
12599 !! test
12600 text with undefined character entity: xacute
12601 !! wikitext
12602 I always thought &xacute; was a cute letter.
12603 !! html
12604 <p>I always thought &amp;xacute; was a cute letter.
12605 </p>
12606 !! end
12607
12608 # TODO: generalize to PHP parser?
12609 !! test
12610 HTML5 tags
12611 !! options
12612 parsoid
12613 !! wikitext
12614 <data value="5">five</data>
12615 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12616 <mark>This highlighted text</mark>
12617 !! html
12618 <p><data value="5">five</data>
12619 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12620 <mark>This highlighted text</mark></p>
12621 !! end
12622
12623 !! test
12624 HTML tag with leading space is parsed as text
12625 !! wikitext
12626 < div>foo< /div>
12627 !! html
12628 <p>&lt; div&gt;foo&lt; /div&gt;
12629 </p>
12630 !! end
12631
12632 ###
12633 ### Nesting tests (see bug 41545, 50604, 51081)
12634 ###
12635
12636 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12637 # Note that html2wt is considerably more difficult if we use <b> in
12638 # the test case, instead of <big>
12639 !! test
12640 Ensure that HTML adoption agency algorithm is properly implemented.
12641 !! wikitext
12642 <big>X<big>Y</big>Z</big>
12643 !! html
12644 <p><big>X<big>Y</big>Z</big>
12645 </p>
12646 !! end
12647
12648 # This was bug 41545 in the PHP parser.
12649 !! test
12650 Nesting of <kbd>
12651 !! wikitext
12652 <kbd>X<kbd>Y</kbd>Z</kbd>
12653 !! html
12654 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12655 </p>
12656 !! end
12657
12658 # The following cases were bug 51081 in the PHP parser.
12659 # Note that there are some other nestable tags (b, i, etc) which are
12660 # not covered; see bug 51081 for discussion.
12661 !! test
12662 Nesting of <em>
12663 !! wikitext
12664 <em>X<em>Y</em>Z</em>
12665 !! html
12666 <p><em>X<em>Y</em>Z</em>
12667 </p>
12668 !! end
12669
12670 !! test
12671 Nesting of <strong>
12672 !! wikitext
12673 <strong>X<strong>Y</strong>Z</strong>
12674 !! html
12675 <p><strong>X<strong>Y</strong>Z</strong>
12676 </p>
12677 !! end
12678
12679 !! test
12680 Nesting of <q>
12681 !! wikitext
12682 <q>X<q>Y</q>Z</q>
12683 !! html
12684 <p><q>X<q>Y</q>Z</q>
12685 </p>
12686 !! end
12687
12688 !! test
12689 Nesting of <ruby>
12690 !! wikitext
12691 <ruby>X<ruby>Y</ruby>Z</ruby>
12692 !! html
12693 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12694 </p>
12695 !! end
12696
12697 !! test
12698 Nesting of <bdo>
12699 !! wikitext
12700 <bdo>X<bdo>Y</bdo>Z</bdo>
12701 !! html
12702 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12703 </p>
12704 !! end
12705
12706
12707 ###
12708 ### Media links
12709 ###
12710
12711 !! test
12712 Media link
12713 !! wikitext
12714 [[Media:Foobar.jpg]]
12715 !! html
12716 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12717 </p>
12718 !! end
12719
12720 !! test
12721 Media link with text
12722 !! wikitext
12723 [[Media:Foobar.jpg|A neat file to look at]]
12724 !! html
12725 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12726 </p>
12727 !! end
12728
12729 # FIXME: this is still bad HTML tag nesting
12730 !! test
12731 Media link with nasty text
12732 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12733 !! wikitext
12734 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12735 !! html
12736 <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>
12737
12738 !! end
12739
12740 !! test
12741 Media link to nonexistent file (bug 1702)
12742 !! wikitext
12743 [[Media:No such.jpg]]
12744 !! html
12745 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12746 </p>
12747 !! end
12748
12749 !! test
12750 Image link to nonexistent file (bug 1850 - good)
12751 !! wikitext
12752 [[Image:No such.jpg]]
12753 !! html
12754 <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>
12755 </p>
12756 !! end
12757
12758 !! test
12759 :Image link to nonexistent file (bug 1850 - bad)
12760 !! wikitext
12761 [[:Image:No such.jpg]]
12762 !! html
12763 <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>
12764 </p>
12765 !! end
12766
12767
12768
12769 !! test
12770 Character reference normalization in link text (bug 1938)
12771 !! wikitext
12772 [[Main Page|this&that]]
12773 !! html
12774 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12775 </p>
12776 !!end
12777
12778 !! article
12779 אַ
12780 !! text
12781 Test for unicode normalization
12782
12783 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12784 !! endarticle
12785
12786 !! test
12787 (bug 19451) Links should refer to the normalized form.
12788 !! wikitext
12789 [[&#xFB2E;]]
12790 [[&#x5d0;&#x5b7;]]
12791 [[&#x5d0;ַ]]
12792 [[א&#x5b7;]]
12793 [[אַ]]
12794 !! html
12795 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12796 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12797 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12798 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12799 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12800 </p>
12801 !! end
12802
12803 !! test
12804 Empty attribute crash test (bug 2067)
12805 !! wikitext
12806 <font color="">foo</font>
12807 !! html
12808 <p><font color="">foo</font>
12809 </p>
12810 !! end
12811
12812 !! test
12813 Empty attribute crash test single-quotes (bug 2067)
12814 !! wikitext
12815 <font color=''>foo</font>
12816 !! html
12817 <p><font color="">foo</font>
12818 </p>
12819 !! end
12820
12821 !! test
12822 Attribute test: equals, then nothing
12823 !! wikitext
12824 <font color=>foo</font>
12825 !! html
12826 <p><font>foo</font>
12827 </p>
12828 !! end
12829
12830 !! test
12831 Attribute test: unquoted value
12832 !! wikitext
12833 <font color=x>foo</font>
12834 !! html
12835 <p><font color="x">foo</font>
12836 </p>
12837 !! end
12838
12839 !! test
12840 Attribute test: unquoted but illegal value (hash)
12841 !! wikitext
12842 <font color=#x>foo</font>
12843 !! html
12844 <p><font color="#x">foo</font>
12845 </p>
12846 !! end
12847
12848 !! test
12849 Attribute test: no value
12850 !! wikitext
12851 <font color>foo</font>
12852 !! html
12853 <p><font color="color">foo</font>
12854 </p>
12855 !! end
12856
12857 !! test
12858 Bug 2095: link with three closing brackets
12859 !! wikitext
12860 [[Main Page]]]
12861 !! html/php
12862 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12863 </p>
12864 !! html/parsoid
12865 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12866 !! end
12867
12868 !! test
12869 Bug 2095: link with pipe and three closing brackets
12870 !! wikitext
12871 [[Main Page|link]]]
12872 !! html/php
12873 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12874 </p>
12875 !! html/parsoid
12876 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12877 !! end
12878
12879 !! test
12880 Bug 2095: link with pipe and three closing brackets, version 2
12881 !! wikitext
12882 [[Main Page|[http://example.com/]]]
12883 !! html/php
12884 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12885 </p>
12886 !! html/parsoid
12887 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12888 !! end
12889
12890
12891 ###
12892 ### Safety
12893 ###
12894
12895 !! article
12896 Template:Dangerous attribute
12897 !! text
12898 " onmouseover="alert(document.cookie)
12899 !! endarticle
12900
12901 !! article
12902 Template:Dangerous style attribute
12903 !! text
12904 border-size: expression(alert(document.cookie))
12905 !! endarticle
12906
12907 !! article
12908 Template:Div style
12909 !! text
12910 <div style="float: right; {{{1}}}">Magic div</div>
12911 !! endarticle
12912
12913 !! test
12914 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12915 !! wikitext
12916 <div title="{{test}}"></div>
12917 !! html
12918 <div title="This is a test template"></div>
12919
12920 !! end
12921
12922 !! test
12923 Bug 2304: HTML attribute safety (dangerous template; 2309)
12924 !! wikitext
12925 <div title="{{dangerous attribute}}"></div>
12926 !! html
12927 <div title=""></div>
12928
12929 !! end
12930
12931 !! test
12932 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12933 !! wikitext
12934 <div style="{{dangerous style attribute}}"></div>
12935 !! html
12936 <div style="/* insecure input */"></div>
12937
12938 !! end
12939
12940 !! test
12941 Bug 2304: HTML attribute safety (safe parameter; 2309)
12942 !! wikitext
12943 {{div style|width: 200px}}
12944 !! html
12945 <div style="float: right; width: 200px">Magic div</div>
12946
12947 !! end
12948
12949 !! test
12950 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12951 !! wikitext
12952 {{div style|width: expression(alert(document.cookie))}}
12953 !! html
12954 <div style="/* insecure input */">Magic div</div>
12955
12956 !! end
12957
12958 !! test
12959 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12960 !! wikitext
12961 {{div style|"><script>alert(document.cookie)</script>}}
12962 !! html
12963 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12964
12965 !! end
12966
12967 !! test
12968 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12969 !! wikitext
12970 {{div style|" ><script>alert(document.cookie)</script>}}
12971 !! html
12972 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12973
12974 !! end
12975
12976 !! test
12977 Bug 2304: HTML attribute safety (link)
12978 !! wikitext
12979 <div title="[[Main Page]]"></div>
12980 !! html
12981 <div title="&#91;&#91;Main Page]]"></div>
12982
12983 !! end
12984
12985 !! test
12986 Bug 2304: HTML attribute safety (italics)
12987 !! wikitext
12988 <div title="''foobar''"></div>
12989 !! html
12990 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12991
12992 !! end
12993
12994 !! test
12995 Bug 2304: HTML attribute safety (bold)
12996 !! wikitext
12997 <div title="'''foobar'''"></div>
12998 !! html
12999 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13000
13001 !! end
13002
13003
13004 !! test
13005 Bug 2304: HTML attribute safety (ISBN)
13006 !! wikitext
13007 <div title="ISBN 1234567890"></div>
13008 !! html
13009 <div title="&#73;SBN 1234567890"></div>
13010
13011 !! end
13012
13013 !! test
13014 Bug 2304: HTML attribute safety (RFC)
13015 !! wikitext
13016 <div title="RFC 1234"></div>
13017 !! html
13018 <div title="&#82;FC 1234"></div>
13019
13020 !! end
13021
13022 !! test
13023 Bug 2304: HTML attribute safety (PMID)
13024 !! wikitext
13025 <div title="PMID 1234567890"></div>
13026 !! html
13027 <div title="&#80;MID 1234567890"></div>
13028
13029 !! end
13030
13031 !! test
13032 Bug 2304: HTML attribute safety (web link)
13033 !! wikitext
13034 <div title="http://example.com/"></div>
13035 !! html
13036 <div title="http&#58;//example.com/"></div>
13037
13038 !! end
13039
13040 !! test
13041 Bug 2304: HTML attribute safety (named web link)
13042 !! wikitext
13043 <div title="[http://example.com/ link]"></div>
13044 !! html
13045 <div title="&#91;http&#58;//example.com/ link]"></div>
13046
13047 !! end
13048
13049 !! test
13050 Bug 3244: HTML attribute safety (extension; safe)
13051 !! wikitext
13052 <div style="<nowiki>background:blue</nowiki>"></div>
13053 !! html
13054 <div style="background:blue"></div>
13055
13056 !! end
13057
13058 !! test
13059 Bug 3244: HTML attribute safety (extension; unsafe)
13060 !! wikitext
13061 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13062 !! html
13063 <div style="/* insecure input */"></div>
13064
13065 !! end
13066
13067 # More MSIE fun discovered by Tom Gilder
13068
13069 !! test
13070 MSIE CSS safety test: spurious slash
13071 !! wikitext
13072 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13073 !! html
13074 <div style="/* insecure input */">evil</div>
13075
13076 !! end
13077
13078 !! test
13079 MSIE CSS safety test: hex code
13080 !! wikitext
13081 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13082 !! html
13083 <div style="/* insecure input */">evil</div>
13084
13085 !! end
13086
13087 !! test
13088 MSIE CSS safety test: comment in url
13089 !! wikitext
13090 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13091 !! html
13092 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13093
13094 !! end
13095
13096 !! test
13097 MSIE CSS safety test: comment in expression
13098 !! wikitext
13099 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13100 !! html
13101 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13102
13103 !! end
13104
13105 !! test
13106 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13107 !! wikitext
13108 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13109 !! html
13110 <p style="/* invalid control char */">A</p>
13111
13112 !! end
13113
13114 !! test
13115 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13116 !! wikitext
13117 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13118 <div style="top:EXPRESSION(alert())">B</div>
13119 !! html
13120 <p style="/* insecure input */">A</p>
13121 <div style="/* insecure input */">B</div>
13122
13123 !! end
13124
13125 !! test
13126 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13127 !! wikitext
13128 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13129 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13130 !! html
13131 <div style="/* insecure input */">A</div>
13132 <p style="/* insecure input */">B</p>
13133
13134 !! end
13135
13136 !! test
13137 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13138 !! wikitext
13139 <div style="background-image:url⁽javascript:alert())">A</div>
13140 <div style="background-image:url₍javascript:alert())">B</div>
13141 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13142 !! html
13143 <div style="/* insecure input */">A</div>
13144 <div style="/* insecure input */">B</div>
13145 <p style="/* insecure input */">C</p>
13146
13147 !! end
13148
13149 !! test
13150 Opera -o-link CSS
13151 !! wikitext
13152 <div
13153 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;"
13154 style="-o-link:attr(title);-o-link-source:current">X</div>
13155 !! html
13156 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13157
13158 !! end
13159
13160 !! test
13161 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13162 !! wikitext
13163 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13164 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13165 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13166 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13167 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13168 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13169 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13170 !! html
13171 <p style="/* insecure input */">A</p>
13172 <p style="/* insecure input */">B</p>
13173 <p style="/* insecure input */">C</p>
13174 <p style="/* insecure input */">D</p>
13175 <p style="/* insecure input */">E</p>
13176 <p style="/* insecure input */">F</p>
13177 <p style="/* insecure input */">G</p>
13178
13179 !! end
13180
13181 !! test
13182 Table attribute legitimate extension
13183 !! wikitext
13184 {|
13185 !+ style="<nowiki>color:blue</nowiki>"| status
13186 |}
13187 !! html
13188 <table>
13189 <tr>
13190 <th style="color:blue"> status
13191 </th></tr></table>
13192
13193 !!end
13194
13195 !! test
13196 Table attribute safety
13197 !! wikitext
13198 {|
13199 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13200 |}
13201 !! html
13202 <table>
13203 <tr>
13204 <th style="/* insecure input */"> status
13205 </th></tr></table>
13206
13207 !! end
13208
13209 !! test
13210 CSS line continuation 1
13211 !! wikitext
13212 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13213 !! html
13214 <div style="/* insecure input */"></div>
13215
13216 !! end
13217
13218 !! test
13219 CSS line continuation 2
13220 !! wikitext
13221 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13222 !! html
13223 <div style="/* insecure input */"></div>
13224
13225 !! end
13226
13227 !! article
13228 Template:Identity
13229 !! text
13230 {{{1}}}
13231 !! endarticle
13232
13233 !! test
13234 Expansion of multi-line templates in attribute values (bug 6255)
13235 !! wikitext
13236 <div style="background: {{identity|#00FF00}}">-</div>
13237 !! html
13238 <div style="background: #00FF00">-</div>
13239
13240 !! end
13241
13242
13243 !! test
13244 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13245 !! wikitext
13246 <div style="background:
13247 #00FF00">-</div>
13248 !! html
13249 <div style="background: #00FF00">-</div>
13250
13251 !! end
13252
13253 !! test
13254 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13255 !! wikitext
13256 <div style="background: &#10;#00FF00">-</div>
13257 !! html
13258 <div style="background: &#10;#00FF00">-</div>
13259
13260 !! end
13261
13262 ###
13263 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13264 ###
13265 !! test
13266 Parser hook: empty input
13267 !! wikitext
13268 <tag></tag>
13269 !! html
13270 <pre>
13271 ''
13272 array (
13273 )
13274 </pre>
13275
13276 !! end
13277
13278 !! test
13279 Parser hook: empty input using terminated empty elements
13280 !! wikitext
13281 <tag/>
13282 !! html
13283 <pre>
13284 NULL
13285 array (
13286 )
13287 </pre>
13288
13289 !! end
13290
13291 !! test
13292 Parser hook: empty input using terminated empty elements (space before)
13293 !! wikitext
13294 <tag />
13295 !! html
13296 <pre>
13297 NULL
13298 array (
13299 )
13300 </pre>
13301
13302 !! end
13303
13304 !! test
13305 Parser hook: basic input
13306 !! wikitext
13307 <tag>input</tag>
13308 !! html
13309 <pre>
13310 'input'
13311 array (
13312 )
13313 </pre>
13314
13315 !! end
13316
13317
13318 !! test
13319 Parser hook: case insensitive
13320 !! wikitext
13321 <TAG>input</TAG>
13322 !! html
13323 <pre>
13324 'input'
13325 array (
13326 )
13327 </pre>
13328
13329 !! end
13330
13331
13332 !! test
13333 Parser hook: case insensitive, redux
13334 !! wikitext
13335 <TaG>input</TAg>
13336 !! html
13337 <pre>
13338 'input'
13339 array (
13340 )
13341 </pre>
13342
13343 !! end
13344
13345 !! test
13346 Parser hook: nested tags
13347 !! options
13348 noxml
13349 !! wikitext
13350 <tag><tag></tag></tag>
13351 !! html
13352 <pre>
13353 '<tag>'
13354 array (
13355 )
13356 </pre>&lt;/tag&gt;
13357
13358 !! end
13359
13360 !! test
13361 Parser hook: basic arguments
13362 !! wikitext
13363 <tag width=200 height = "100" depth = '50' square></tag>
13364 !! html
13365 <pre>
13366 ''
13367 array (
13368 'width' => '200',
13369 'height' => '100',
13370 'depth' => '50',
13371 'square' => 'square',
13372 )
13373 </pre>
13374
13375 !! end
13376
13377 !! test
13378 Parser hook: argument containing a forward slash (bug 5344)
13379 !! wikitext
13380 <tag filename='/tmp/bla'></tag>
13381 !! html
13382 <pre>
13383 ''
13384 array (
13385 'filename' => '/tmp/bla',
13386 )
13387 </pre>
13388
13389 !! end
13390
13391 !! test
13392 Parser hook: empty input using terminated empty elements (bug 2374)
13393 !! wikitext
13394 <tag foo=bar/>text
13395 !! html
13396 <pre>
13397 NULL
13398 array (
13399 'foo' => 'bar',
13400 )
13401 </pre>text
13402
13403 !! end
13404
13405 # </tag> should be output literally since there is no matching tag that begins it
13406 !! test
13407 Parser hook: basic arguments using terminated empty elements (bug 2374)
13408 !! wikitext
13409 <tag width=200 height = "100" depth = '50' square/>
13410 other stuff
13411 </tag>
13412 !! html
13413 <pre>
13414 NULL
13415 array (
13416 'width' => '200',
13417 'height' => '100',
13418 'depth' => '50',
13419 'square' => 'square',
13420 )
13421 </pre>
13422 <p>other stuff
13423 &lt;/tag&gt;
13424 </p>
13425 !! end
13426
13427 ###
13428 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13429 ###
13430
13431 !! test
13432 Parser hook: static parser hook not inside a comment
13433 !! wikitext
13434 <statictag>hello, world</statictag>
13435 <statictag action=flush/>
13436 !! html
13437 <p>hello, world
13438 </p>
13439 !! end
13440
13441
13442 !! test
13443 Parser hook: static parser hook inside a comment
13444 !! wikitext
13445 <!-- <statictag>hello, world</statictag> -->
13446 <statictag action=flush/>
13447 !! html
13448 <p><br />
13449 </p>
13450 !! end
13451
13452 # Nested template calls; this case was broken by Parser.php rev 1.506,
13453 # since reverted.
13454
13455 !! article
13456 Template:One-parameter
13457 !! text
13458 (My parameter is: {{{1}}})
13459 !! endarticle
13460
13461 !! article
13462 Template:Map-one-parameter
13463 !! text
13464 {{{{{1}}}|{{{2}}}}}
13465 !! endarticle
13466
13467 !! test
13468 Nested template calls
13469 !! wikitext
13470 {{Map-one-parameter|One-parameter|param}}
13471 !! html
13472 <p>(My parameter is: param)
13473 </p>
13474 !! end
13475
13476
13477 ###
13478 ### Sanitizer
13479 ###
13480 !! test
13481 Sanitizer: Closing of open tags
13482 !! wikitext
13483 <s></s><table></table>
13484 !! html
13485 <s></s><table></table>
13486
13487 !! end
13488
13489 !! test
13490 Sanitizer: Closing of open but not closed tags
13491 !! wikitext
13492 <s>foo
13493 !! html
13494 <p><s>foo</s>
13495 </p>
13496 !! end
13497
13498 !! test
13499 Sanitizer: Closing of closed but not open tags
13500 !! wikitext
13501 </s>
13502 !! html
13503 <p>&lt;/s&gt;
13504 </p>
13505 !! end
13506
13507 !! test
13508 Sanitizer: Closing of closed but not open table tags
13509 !! wikitext
13510 Table not started</td></tr></table>
13511 !! html
13512 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13513 </p>
13514 !! end
13515
13516 !! test
13517 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13518 !! wikitext
13519 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13520 !! html
13521 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13522 </p>
13523 !! end
13524
13525 !! test
13526 Sanitizer: Validating the contents of the id attribute (bug 4515)
13527 !! options
13528 disabled
13529 !! wikitext
13530 <br id=9 />
13531 !! html
13532 Something, but definitely not <br id="9" />...
13533 !! end
13534
13535 !! test
13536 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13537 !! options
13538 disabled
13539 !! wikitext
13540 <br id="foo" /><br id="foo" />
13541 !! html
13542 Something need to be done. foo-2 ?
13543 !! end
13544
13545 !! test
13546 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13547 !! wikitext
13548 <div itemscope>
13549 <meta itemprop="hello" content="world">
13550 <meta http-equiv="refresh" content="5">
13551 <meta itemprop="hello" http-equiv="refresh" content="5">
13552 <link itemprop="hello" href="{{SERVER}}">
13553 <link rel="stylesheet" href="{{SERVER}}">
13554 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13555 </div>
13556 !! html
13557 <div itemscope="itemscope">
13558 <p> <meta itemprop="hello" content="world" />
13559 &lt;meta http-equiv="refresh" content="5"&gt;
13560 <meta itemprop="hello" content="5" />
13561 </p>
13562 <link itemprop="hello" href="http&#58;//example.org" />
13563 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13564 <link itemprop="hello" href="http&#58;//example.org" />
13565 </div>
13566
13567 !! end
13568
13569 !! test
13570 Language converter: output gets cut off unexpectedly (bug 5757)
13571 !! options
13572 language=zh
13573 !! wikitext
13574 this bit is safe: }-
13575
13576 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13577
13578 then we get cut off here: }-
13579
13580 all additional text is vanished
13581 !! html
13582 <p>this bit is safe: }-
13583 </p><p>but if we add a conversion instance: xxx
13584 </p><p>then we get cut off here: }-
13585 </p><p>all additional text is vanished
13586 </p>
13587 !! end
13588
13589 !! test
13590 Self closed html pairs (bug 5487)
13591 !! options
13592 !! wikitext
13593 <center><font id="bug" />Centered text</center>
13594 <div><font id="bug2" />In div text</div>
13595 !! html
13596 <center>&lt;font id="bug" /&gt;Centered text</center>
13597 <div>&lt;font id="bug2" /&gt;In div text</div>
13598
13599 !! end
13600
13601 #
13602 #
13603 #
13604
13605 !! test
13606 Punctuation: nbsp before exclamation
13607 !! wikitext
13608 C'est grave !
13609 !! html
13610 <p>C'est grave&#160;!
13611 </p>
13612 !! end
13613
13614 !! test
13615 Punctuation: CSS !important (bug 11874)
13616 !! wikitext
13617 <div style="width:50% !important">important</div>
13618 !! html
13619 <div style="width:50% !important">important</div>
13620
13621 !!end
13622
13623 !! test
13624 Punctuation: CSS ! important (bug 11874; with space after)
13625 !! wikitext
13626 <div style="width:50% ! important">important</div>
13627 !! html
13628 <div style="width:50% ! important">important</div>
13629
13630 !!end
13631
13632
13633 !! test
13634 HTML bullet list, closed tags (bug 5497)
13635 !! wikitext
13636 <ul>
13637 <li>One</li>
13638 <li>Two</li>
13639 </ul>
13640 !! html
13641 <ul>
13642 <li>One</li>
13643 <li>Two</li>
13644 </ul>
13645
13646 !! end
13647
13648 !! test
13649 HTML bullet list, unclosed tags (bug 5497)
13650 !! options
13651 disabled
13652 !! wikitext
13653 <ul>
13654 <li>One
13655 <li>Two
13656 </ul>
13657 !! html
13658 <ul>
13659 <li>One
13660 </li>
13661 <li>Two
13662 </li>
13663 </ul>
13664
13665 !! end
13666
13667 !! test
13668 HTML ordered list, closed tags (bug 5497)
13669 !! wikitext
13670 <ol>
13671 <li>One</li>
13672 <li>Two</li>
13673 </ol>
13674 !! html
13675 <ol>
13676 <li>One</li>
13677 <li>Two</li>
13678 </ol>
13679
13680 !! end
13681
13682 !! test
13683 HTML ordered list, unclosed tags (bug 5497)
13684 !! options
13685 disabled
13686 !! wikitext
13687 <ol>
13688 <li>One
13689 <li>Two
13690 </ol>
13691 !! html
13692 <ol>
13693 <li>One
13694 </li>
13695 <li>Two
13696 </li>
13697 </ol>
13698
13699 !! end
13700
13701 !! test
13702 HTML nested bullet list, closed tags (bug 5497)
13703 !! wikitext
13704 <ul>
13705 <li>One</li>
13706 <li>Two:
13707 <ul>
13708 <li>Sub-one</li>
13709 <li>Sub-two</li>
13710 </ul>
13711 </li>
13712 </ul>
13713 !! html
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
13724 !! end
13725
13726 !! test
13727 HTML nested bullet list, open tags (bug 5497)
13728 !! options
13729 disabled
13730 !! wikitext
13731 <ul>
13732 <li>One
13733 <li>Two:
13734 <ul>
13735 <li>Sub-one
13736 <li>Sub-two
13737 </ul>
13738 </ul>
13739 !! html
13740 <ul>
13741 <li>One
13742 </li>
13743 <li>Two:
13744 <ul>
13745 <li>Sub-one
13746 </li>
13747 <li>Sub-two
13748 </li>
13749 </ul>
13750 </li>
13751 </ul>
13752
13753 !! end
13754
13755 !! test
13756 HTML nested ordered list, closed tags (bug 5497)
13757 !! wikitext
13758 <ol>
13759 <li>One</li>
13760 <li>Two:
13761 <ol>
13762 <li>Sub-one</li>
13763 <li>Sub-two</li>
13764 </ol>
13765 </li>
13766 </ol>
13767 !! html
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
13778 !! end
13779
13780 !! test
13781 HTML nested ordered list, open tags (bug 5497)
13782 !! options
13783 disabled
13784 !! wikitext
13785 <ol>
13786 <li>One
13787 <li>Two:
13788 <ol>
13789 <li>Sub-one
13790 <li>Sub-two
13791 </ol>
13792 </ol>
13793 !! html
13794 <ol>
13795 <li>One
13796 </li>
13797 <li>Two:
13798 <ol>
13799 <li>Sub-one
13800 </li>
13801 <li>Sub-two
13802 </li>
13803 </ol>
13804 </li>
13805 </ol>
13806
13807 !! end
13808
13809 !! test
13810 HTML ordered list item with parameters oddity
13811 !! wikitext
13812 <ol><li id="fragment">One</li>
13813 </ol>
13814 !! html
13815 <ol><li id="fragment">One</li>
13816 </ol>
13817
13818 !! end
13819
13820 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13821 !!test
13822 bug 5918: autonumbering
13823 !! wikitext
13824 [http://first/] [http://second] [ftp://ftp]
13825
13826 ftp://inlineftp
13827
13828 [mailto:enclosed@mail.tld With target]
13829
13830 [mailto:enclosed@mail.tld]
13831
13832 mailto:inline@mail.tld
13833 !! html/php
13834 <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>
13835 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13836 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13837 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13838 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13839 </p>
13840 !! html/parsoid
13841 <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>
13842 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13843 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13844 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13845 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13846 !! end
13847
13848
13849 #
13850 # Security and HTML correctness
13851 # From Nick Jenkins' fuzz testing
13852 #
13853
13854 !! test
13855 Fuzz testing: Parser13
13856 !! wikitext
13857 {|
13858 | http://a|
13859 !! html
13860 <table>
13861 <tr>
13862 <td>
13863 </td>
13864 </tr>
13865 </table>
13866
13867 !! end
13868
13869 !! test
13870 Fuzz testing: Parser14
13871 !! wikitext
13872 == onmouseover= ==
13873 http://__TOC__
13874 !! html
13875 <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>
13876 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13877 <ul>
13878 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13879 </ul>
13880 </div>
13881
13882
13883 !! end
13884
13885 !! test
13886 Fuzz testing: Parser14-table
13887 !! wikitext
13888 ==a==
13889 {| STYLE=__TOC__
13890 !! html
13891 <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>
13892 <table style="&#95;_TOC&#95;_">
13893 <tr><td></td></tr>
13894 </table>
13895
13896 !! end
13897
13898 # Known to produce bogus xml (extra </td>)
13899 !! test
13900 Fuzz testing: Parser16
13901 !! options
13902 noxml
13903 !! wikitext
13904 {|
13905 !https://||||||
13906 !! html
13907 <table>
13908 <tr>
13909 <th>https://</th>
13910 <th></th>
13911 <th></th>
13912 <th>
13913 </td>
13914 </tr>
13915 </table>
13916
13917 !! end
13918
13919 !! test
13920 Fuzz testing: Parser21
13921 !! wikitext
13922 {|
13923 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13924 |
13925 !! html
13926 <table>
13927 <tr>
13928 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13929 </th>
13930 <td>
13931 </td>
13932 </tr>
13933 </table>
13934
13935 !! end
13936
13937 !! test
13938 Fuzz testing: Parser22
13939 !! wikitext
13940 http://===r:::https://b
13941
13942 {|
13943 !! html
13944 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13945 </p>
13946 <table>
13947 <tr><td></td></tr>
13948 </table>
13949
13950 !! end
13951
13952 # Known to produce bad XML for now
13953 !! test
13954 Fuzz testing: Parser24
13955 !! options
13956 noxml
13957 !! wikitext
13958 {|
13959 {{{|
13960 <u CLASS=
13961 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13962 <br style="onmouseover='alert(document.cookie);' " />
13963
13964 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13965 |
13966 !! html
13967 <table>
13968 {{{|
13969 <u class="&#124;">}}}} &gt;
13970 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13971
13972 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13973 <tr>
13974 <td></u>
13975 </td>
13976 </tr>
13977 </table>
13978
13979 !! end
13980
13981 # Note: the current result listed for this is not what the original one was,
13982 # but the original bug was JavaScript injection, which is fixed in any case.
13983 # It's not clear that the original result listed was any more correct than the
13984 # current one. Original result:
13985 # <p>{{{|
13986 # </p>
13987 # <li class="&#124;&#124;">
13988 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13989 !!test
13990 Fuzz testing: Parser25 (bug 6055)
13991 !! wikitext
13992 {{{
13993 |
13994 <LI CLASS=||
13995 >
13996 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13997 !! html
13998 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13999 </p>
14000 !! end
14001
14002 !!test
14003 Fuzz testing: URL adjacent extension (with space, clean)
14004 !! options
14005 !! wikitext
14006 http://example.com <nowiki>junk</nowiki>
14007 !! html
14008 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14009 </p>
14010 !!end
14011
14012 !!test
14013 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
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; pre)
14024 !! options
14025 !! wikitext
14026 http://example.com<pre>junk</pre>
14027 !! html
14028 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14029
14030 !!end
14031
14032 !!test
14033 Fuzz testing: image with bogus manual thumbnail
14034 !! wikitext
14035 [[Image:foobar.jpg|thumbnail= ]]
14036 !! html/php
14037 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14038
14039 !! html/parsoid
14040 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14041 !!end
14042
14043 !! test
14044 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14045 !! wikitext
14046 <pre dir="&#10;"></pre>
14047 !! html
14048 <pre dir="&#10;"></pre>
14049
14050 !! end
14051
14052 !! test
14053 Parsing optional HTML elements (Bug 6171)
14054 !! options
14055 !! wikitext
14056 <table>
14057 <tr>
14058 <td> Some tabular data</td>
14059 <td> More tabular data ...
14060 <td> And yet som tabular data</td>
14061 </tr>
14062 </table>
14063 !! html
14064 <table>
14065 <tr>
14066 <td> Some tabular data</td>
14067 <td> More tabular data ...
14068 </td><td> And yet som tabular data</td>
14069 </tr>
14070 </table>
14071
14072 !! end
14073
14074 !! test
14075 Correct handling of <td>, <tr> (Bug 6171)
14076 !! options
14077 !! wikitext
14078 <table>
14079 <tr>
14080 <td> Some tabular data</td>
14081 <td> More tabular data ...</td>
14082 <td> And yet som tabular data</td>
14083 </tr>
14084 </table>
14085 !! html
14086 <table>
14087 <tr>
14088 <td> Some tabular data</td>
14089 <td> More tabular data ...</td>
14090 <td> And yet som tabular data</td>
14091 </tr>
14092 </table>
14093
14094 !! end
14095
14096
14097 !! test
14098 Parsing crashing regression (fr:JavaScript)
14099 !! wikitext
14100 </body></x>
14101 !! html
14102 <p>&lt;/body&gt;&lt;/x&gt;
14103 </p>
14104 !! end
14105
14106 !! test
14107 Inline wiki vs wiki block nesting
14108 !! wikitext
14109 '''Bold paragraph
14110
14111 New wiki paragraph
14112 !! html
14113 <p><b>Bold paragraph</b>
14114 </p><p>New wiki paragraph
14115 </p>
14116 !! end
14117
14118 !! test
14119 Inline HTML vs wiki block nesting
14120 !! options
14121 disabled
14122 !! wikitext
14123 <b>Bold paragraph
14124
14125 New wiki paragraph
14126 !! html
14127 <p><b>Bold paragraph</b>
14128 </p><p>New wiki paragraph
14129 </p>
14130 !! end
14131
14132 # Original result was this:
14133 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14134 # </p>
14135 # While that might be marginally more intuitive, maybe, the six-apostrophe
14136 # construct is clearly pathological and the result stated here (which is what
14137 # the parser actually does) is about as reasonable as anything.
14138 !!test
14139 Mixing markup for italics and bold
14140 !! options
14141 !! wikitext
14142 '''bold''''''bold''bolditalics'''''
14143 !! html
14144 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14145 </p>
14146 !! end
14147
14148
14149 !! article
14150 Xyzzyx
14151 !! text
14152 Article for special page transclusion test
14153 !! endarticle
14154
14155 !! test
14156 Special page transclusion
14157 !! options
14158 !! wikitext
14159 {{Special:Prefixindex/Xyzzyx}}
14160 !! html
14161 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14162
14163 !! end
14164
14165 !! test
14166 Special page transclusion twice (bug 5021)
14167 !! options
14168 !! wikitext
14169 {{Special:Prefixindex/Xyzzyx}}
14170 {{Special:Prefixindex/Xyzzyx}}
14171 !! html
14172 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14173 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14174
14175 !! end
14176
14177 !! test
14178 Transclusion of default MediaWiki message
14179 !! wikitext
14180 {{MediaWiki:Mainpage}}
14181 !! html
14182 <p>Main Page
14183 </p>
14184 !! end
14185
14186 !! test
14187 Transclusion of nonexistent MediaWiki message
14188 !! wikitext
14189 {{MediaWiki:Mainpagexxx}}
14190 !! html
14191 <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>
14192 </p>
14193 !! end
14194
14195 !! test
14196 Transclusion of MediaWiki message with underscore
14197 !! wikitext
14198 {{MediaWiki:history_short}}
14199 !! html
14200 <p>History
14201 </p>
14202 !! end
14203
14204 !! test
14205 Transclusion of MediaWiki message with space
14206 !! wikitext
14207 {{MediaWiki:history short}}
14208 !! html
14209 <p>History
14210 </p>
14211 !! end
14212
14213 !! test
14214 Invalid header with following text
14215 !! wikitext
14216 = x = y
14217 !! html
14218 <p>= x = y
14219 </p>
14220 !! end
14221
14222
14223 !! test
14224 Section extraction test (section 0)
14225 !! options
14226 section=0
14227 !! wikitext
14228 start
14229 ==a==
14230 ===aa===
14231 ====aaa====
14232 ==b==
14233 ===ba===
14234 ===bb===
14235 ====bba====
14236 ===bc===
14237 ==c==
14238 ===ca===
14239 !! html
14240 start
14241 !! end
14242
14243 !! test
14244 Section extraction test (section 1)
14245 !! options
14246 section=1
14247 !! wikitext
14248 start
14249 ==a==
14250 ===aa===
14251 ====aaa====
14252 ==b==
14253 ===ba===
14254 ===bb===
14255 ====bba====
14256 ===bc===
14257 ==c==
14258 ===ca===
14259 !! html
14260 ==a==
14261 ===aa===
14262 ====aaa====
14263 !! end
14264
14265 !! test
14266 Section extraction test (section 2)
14267 !! options
14268 section=2
14269 !! wikitext
14270 start
14271 ==a==
14272 ===aa===
14273 ====aaa====
14274 ==b==
14275 ===ba===
14276 ===bb===
14277 ====bba====
14278 ===bc===
14279 ==c==
14280 ===ca===
14281 !! html
14282 ===aa===
14283 ====aaa====
14284 !! end
14285
14286 !! test
14287 Section extraction test (section 3)
14288 !! options
14289 section=3
14290 !! wikitext
14291 start
14292 ==a==
14293 ===aa===
14294 ====aaa====
14295 ==b==
14296 ===ba===
14297 ===bb===
14298 ====bba====
14299 ===bc===
14300 ==c==
14301 ===ca===
14302 !! html
14303 ====aaa====
14304 !! end
14305
14306 !! test
14307 Section extraction test (section 4)
14308 !! options
14309 section=4
14310 !! wikitext
14311 start
14312 ==a==
14313 ===aa===
14314 ====aaa====
14315 ==b==
14316 ===ba===
14317 ===bb===
14318 ====bba====
14319 ===bc===
14320 ==c==
14321 ===ca===
14322 !! html
14323 ==b==
14324 ===ba===
14325 ===bb===
14326 ====bba====
14327 ===bc===
14328 !! end
14329
14330 !! test
14331 Section extraction test (section 5)
14332 !! options
14333 section=5
14334 !! wikitext
14335 start
14336 ==a==
14337 ===aa===
14338 ====aaa====
14339 ==b==
14340 ===ba===
14341 ===bb===
14342 ====bba====
14343 ===bc===
14344 ==c==
14345 ===ca===
14346 !! html
14347 ===ba===
14348 !! end
14349
14350 !! test
14351 Section extraction test (section 6)
14352 !! options
14353 section=6
14354 !! wikitext
14355 start
14356 ==a==
14357 ===aa===
14358 ====aaa====
14359 ==b==
14360 ===ba===
14361 ===bb===
14362 ====bba====
14363 ===bc===
14364 ==c==
14365 ===ca===
14366 !! html
14367 ===bb===
14368 ====bba====
14369 !! end
14370
14371 !! test
14372 Section extraction test (section 7)
14373 !! options
14374 section=7
14375 !! wikitext
14376 start
14377 ==a==
14378 ===aa===
14379 ====aaa====
14380 ==b==
14381 ===ba===
14382 ===bb===
14383 ====bba====
14384 ===bc===
14385 ==c==
14386 ===ca===
14387 !! html
14388 ====bba====
14389 !! end
14390
14391 !! test
14392 Section extraction test (section 8)
14393 !! options
14394 section=8
14395 !! wikitext
14396 start
14397 ==a==
14398 ===aa===
14399 ====aaa====
14400 ==b==
14401 ===ba===
14402 ===bb===
14403 ====bba====
14404 ===bc===
14405 ==c==
14406 ===ca===
14407 !! html
14408 ===bc===
14409 !! end
14410
14411 !! test
14412 Section extraction test (section 9)
14413 !! options
14414 section=9
14415 !! wikitext
14416 start
14417 ==a==
14418 ===aa===
14419 ====aaa====
14420 ==b==
14421 ===ba===
14422 ===bb===
14423 ====bba====
14424 ===bc===
14425 ==c==
14426 ===ca===
14427 !! html
14428 ==c==
14429 ===ca===
14430 !! end
14431
14432 !! test
14433 Section extraction test (section 10)
14434 !! options
14435 section=10
14436 !! wikitext
14437 start
14438 ==a==
14439 ===aa===
14440 ====aaa====
14441 ==b==
14442 ===ba===
14443 ===bb===
14444 ====bba====
14445 ===bc===
14446 ==c==
14447 ===ca===
14448 !! html
14449 ===ca===
14450 !! end
14451
14452 !! test
14453 Section extraction test (nonexistent section 11)
14454 !! options
14455 section=11
14456 !! wikitext
14457 start
14458 ==a==
14459 ===aa===
14460 ====aaa====
14461 ==b==
14462 ===ba===
14463 ===bb===
14464 ====bba====
14465 ===bc===
14466 ==c==
14467 ===ca===
14468 !! html
14469 !! end
14470
14471 !! test
14472 Section extraction test with bogus heading (section 1)
14473 !! options
14474 section=1
14475 !! wikitext
14476 ==a==
14477 ==bogus== not a legal section
14478 ==b==
14479 !! html
14480 ==a==
14481 ==bogus== not a legal section
14482 !! end
14483
14484 !! test
14485 Section extraction test with bogus heading (section 2)
14486 !! options
14487 section=2
14488 !! wikitext
14489 ==a==
14490 ==bogus== not a legal section
14491 ==b==
14492 !! html
14493 ==b==
14494 !! end
14495
14496 !! test
14497 Section extraction test with comment after heading (section 1)
14498 !! options
14499 section=1
14500 !! wikitext
14501 ==a==
14502 ==b== <!-- -->
14503 ==c==
14504 !! html
14505 ==a==
14506 !! end
14507
14508 !! test
14509 Section extraction test with comment after heading (section 2)
14510 !! options
14511 section=2
14512 !! wikitext
14513 ==a==
14514 ==b== <!-- -->
14515 ==c==
14516 !! html
14517 ==b== <!-- -->
14518 !! end
14519
14520 !! test
14521 Section extraction test with bogus <nowiki> heading (section 1)
14522 !! options
14523 section=1
14524 !! wikitext
14525 ==a==
14526 ==bogus== <nowiki>not a legal section</nowiki>
14527 ==b==
14528 !! html
14529 ==a==
14530 ==bogus== <nowiki>not a legal section</nowiki>
14531 !! end
14532
14533 !! test
14534 Section extraction test with bogus <nowiki> heading (section 2)
14535 !! options
14536 section=2
14537 !! wikitext
14538 ==a==
14539 ==bogus== <nowiki>not a legal section</nowiki>
14540 ==b==
14541 !! html
14542 ==b==
14543 !! end
14544
14545
14546 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14547 # instead of respecting commented sections
14548 !! test
14549 Section extraction prefixed by comment (section 1)
14550 !! options
14551 section=1
14552 !! wikitext
14553 <!-- -->==sec1==
14554 ==sec2==
14555 !! html
14556 ==sec2==
14557 !!end
14558
14559 !! test
14560 Section extraction prefixed by comment (section 2)
14561 !! options
14562 section=2
14563 !! wikitext
14564 <!-- -->==sec1==
14565 ==sec2==
14566 !! html
14567
14568 !!end
14569
14570
14571 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14572 # instead of respecting HTML-style headings
14573 !! test
14574 Section extraction, mixed wiki and html (section 1)
14575 !! options
14576 section=1
14577 !! wikitext
14578 <h2>unmarked</h2>
14579 unmarked
14580 ==1==
14581 one
14582 ==2==
14583 two
14584 !! html
14585 ==1==
14586 one
14587 !! end
14588
14589 !! test
14590 Section extraction, mixed wiki and html (section 2)
14591 !! options
14592 section=2
14593 !! wikitext
14594 <h2>unmarked</h2>
14595 unmarked
14596 ==1==
14597 one
14598 ==2==
14599 two
14600 !! html
14601 ==2==
14602 two
14603 !! end
14604
14605
14606 # Formerly testing for bug 3342
14607 !! test
14608 Section extraction, heading surrounded by <noinclude>
14609 !! options
14610 section=1
14611 !! wikitext
14612 <noinclude>==unmarked==</noinclude>
14613 ==marked==
14614 !! html
14615 ==marked==
14616 !!end
14617
14618 # Test behavior of bug 19910
14619 !! test
14620 Sectiion with all-equals
14621 !! options
14622 section=2
14623 !! wikitext
14624 ===
14625 The line above must have a trailing space
14626 === <!--
14627 --> <!-- -->
14628 But just in case it doesn't...
14629 !! html
14630 === <!--
14631 --> <!-- -->
14632 But just in case it doesn't...
14633 !! end
14634
14635 !! test
14636 Section replacement test (section 0)
14637 !! options
14638 replace=0,"xxx"
14639 !! wikitext
14640 start
14641 ==a==
14642 ===aa===
14643 ====aaa====
14644 ==b==
14645 ===ba===
14646 ===bb===
14647 ====bba====
14648 ===bc===
14649 ==c==
14650 ===ca===
14651 !! html
14652 xxx
14653
14654 ==a==
14655 ===aa===
14656 ====aaa====
14657 ==b==
14658 ===ba===
14659 ===bb===
14660 ====bba====
14661 ===bc===
14662 ==c==
14663 ===ca===
14664 !! end
14665
14666 !! test
14667 Section replacement test (section 1)
14668 !! options
14669 replace=1,"xxx"
14670 !! wikitext
14671 start
14672 ==a==
14673 ===aa===
14674 ====aaa====
14675 ==b==
14676 ===ba===
14677 ===bb===
14678 ====bba====
14679 ===bc===
14680 ==c==
14681 ===ca===
14682 !! html
14683 start
14684 xxx
14685
14686 ==b==
14687 ===ba===
14688 ===bb===
14689 ====bba====
14690 ===bc===
14691 ==c==
14692 ===ca===
14693 !! end
14694
14695 !! test
14696 Section replacement test (section 2)
14697 !! options
14698 replace=2,"xxx"
14699 !! wikitext
14700 start
14701 ==a==
14702 ===aa===
14703 ====aaa====
14704 ==b==
14705 ===ba===
14706 ===bb===
14707 ====bba====
14708 ===bc===
14709 ==c==
14710 ===ca===
14711 !! html
14712 start
14713 ==a==
14714 xxx
14715
14716 ==b==
14717 ===ba===
14718 ===bb===
14719 ====bba====
14720 ===bc===
14721 ==c==
14722 ===ca===
14723 !! end
14724
14725 !! test
14726 Section replacement test (section 3)
14727 !! options
14728 replace=3,"xxx"
14729 !! wikitext
14730 start
14731 ==a==
14732 ===aa===
14733 ====aaa====
14734 ==b==
14735 ===ba===
14736 ===bb===
14737 ====bba====
14738 ===bc===
14739 ==c==
14740 ===ca===
14741 !! html
14742 start
14743 ==a==
14744 ===aa===
14745 xxx
14746
14747 ==b==
14748 ===ba===
14749 ===bb===
14750 ====bba====
14751 ===bc===
14752 ==c==
14753 ===ca===
14754 !! end
14755
14756 !! test
14757 Section replacement test (section 4)
14758 !! options
14759 replace=4,"xxx"
14760 !! wikitext
14761 start
14762 ==a==
14763 ===aa===
14764 ====aaa====
14765 ==b==
14766 ===ba===
14767 ===bb===
14768 ====bba====
14769 ===bc===
14770 ==c==
14771 ===ca===
14772 !! html
14773 start
14774 ==a==
14775 ===aa===
14776 ====aaa====
14777 xxx
14778
14779 ==c==
14780 ===ca===
14781 !! end
14782
14783 !! test
14784 Section replacement test (section 5)
14785 !! options
14786 replace=5,"xxx"
14787 !! wikitext
14788 start
14789 ==a==
14790 ===aa===
14791 ====aaa====
14792 ==b==
14793 ===ba===
14794 ===bb===
14795 ====bba====
14796 ===bc===
14797 ==c==
14798 ===ca===
14799 !! html
14800 start
14801 ==a==
14802 ===aa===
14803 ====aaa====
14804 ==b==
14805 xxx
14806
14807 ===bb===
14808 ====bba====
14809 ===bc===
14810 ==c==
14811 ===ca===
14812 !! end
14813
14814 !! test
14815 Section replacement test (section 6)
14816 !! options
14817 replace=6,"xxx"
14818 !! wikitext
14819 start
14820 ==a==
14821 ===aa===
14822 ====aaa====
14823 ==b==
14824 ===ba===
14825 ===bb===
14826 ====bba====
14827 ===bc===
14828 ==c==
14829 ===ca===
14830 !! html
14831 start
14832 ==a==
14833 ===aa===
14834 ====aaa====
14835 ==b==
14836 ===ba===
14837 xxx
14838
14839 ===bc===
14840 ==c==
14841 ===ca===
14842 !! end
14843
14844 !! test
14845 Section replacement test (section 7)
14846 !! options
14847 replace=7,"xxx"
14848 !! wikitext
14849 start
14850 ==a==
14851 ===aa===
14852 ====aaa====
14853 ==b==
14854 ===ba===
14855 ===bb===
14856 ====bba====
14857 ===bc===
14858 ==c==
14859 ===ca===
14860 !! html
14861 start
14862 ==a==
14863 ===aa===
14864 ====aaa====
14865 ==b==
14866 ===ba===
14867 ===bb===
14868 xxx
14869
14870 ===bc===
14871 ==c==
14872 ===ca===
14873 !! end
14874
14875 !! test
14876 Section replacement test (section 8)
14877 !! options
14878 replace=8,"xxx"
14879 !! wikitext
14880 start
14881 ==a==
14882 ===aa===
14883 ====aaa====
14884 ==b==
14885 ===ba===
14886 ===bb===
14887 ====bba====
14888 ===bc===
14889 ==c==
14890 ===ca===
14891 !! html
14892 start
14893 ==a==
14894 ===aa===
14895 ====aaa====
14896 ==b==
14897 ===ba===
14898 ===bb===
14899 ====bba====
14900 xxx
14901
14902 ==c==
14903 ===ca===
14904 !!end
14905
14906 !! test
14907 Section replacement test (section 9)
14908 !! options
14909 replace=9,"xxx"
14910 !! wikitext
14911 start
14912 ==a==
14913 ===aa===
14914 ====aaa====
14915 ==b==
14916 ===ba===
14917 ===bb===
14918 ====bba====
14919 ===bc===
14920 ==c==
14921 ===ca===
14922 !! html
14923 start
14924 ==a==
14925 ===aa===
14926 ====aaa====
14927 ==b==
14928 ===ba===
14929 ===bb===
14930 ====bba====
14931 ===bc===
14932 xxx
14933 !! end
14934
14935 !! test
14936 Section replacement test (section 10)
14937 !! options
14938 replace=10,"xxx"
14939 !! wikitext
14940 start
14941 ==a==
14942 ===aa===
14943 ====aaa====
14944 ==b==
14945 ===ba===
14946 ===bb===
14947 ====bba====
14948 ===bc===
14949 ==c==
14950 ===ca===
14951 !! html
14952 start
14953 ==a==
14954 ===aa===
14955 ====aaa====
14956 ==b==
14957 ===ba===
14958 ===bb===
14959 ====bba====
14960 ===bc===
14961 ==c==
14962 xxx
14963 !! end
14964
14965 !! test
14966 Section replacement test with initial whitespace (bug 13728)
14967 !! options
14968 replace=2,"xxx"
14969 !! wikitext
14970 Preformatted initial line
14971 ==a==
14972 ===a===
14973 !! html
14974 Preformatted initial line
14975 ==a==
14976 xxx
14977 !! end
14978
14979
14980 !! test
14981 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14982 !! options
14983 section=1
14984 !! wikitext
14985 ==a==
14986 a
14987 !! html
14988 ==a==
14989 a
14990 !! end
14991
14992 !! test
14993 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14994 !! options
14995 section=1
14996 !! wikitext
14997 ==a==
14998 a
14999 !! html
15000 ==a==
15001 a
15002 !! end
15003
15004
15005 !! test
15006 Section extraction, <pre> around bogus header (bug 10309)
15007 !! options
15008 noxml section=2
15009 !! wikitext
15010 == Section One ==
15011 <pre>
15012 =======
15013 </pre>
15014
15015 == Section Two ==
15016 stuff
15017 !! html
15018 == Section Two ==
15019 stuff
15020 !! end
15021
15022 !! test
15023 Section replacement, <pre> around bogus header (bug 10309)
15024 !! options
15025 noxml replace=2,"xxx"
15026 !! wikitext
15027 == Section One ==
15028 <pre>
15029 =======
15030 </pre>
15031
15032 == Section Two ==
15033 stuff
15034 !! html
15035 == Section One ==
15036 <pre>
15037 =======
15038 </pre>
15039
15040 xxx
15041 !! end
15042
15043
15044
15045 !! test
15046 Handling of &#x0A; in URLs
15047 !! wikitext
15048 ** irc://&#x0A;a
15049 !! html/php
15050 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15051
15052 !! html/parsoid
15053 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15054 a">irc://
15055 a</a></li></ul></li></ul>
15056 !! end
15057
15058 !! test
15059 Handling of %0A in URLs
15060 !! wikitext
15061 ** irc://%0Aa
15062 !! html/php
15063 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15064
15065 !! html/parsoid
15066 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15067 !! end
15068
15069
15070 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15071 !! test
15072 5 quotes, code coverage +1 line
15073 !! options
15074 parsoid=wt2html
15075 !! wikitext
15076 '''''
15077 !! html/php
15078 !! html/parsoid
15079 <p><b><i></i></b></p>
15080 !! end
15081
15082 # same html as previous, but wikitext adjusted to match parsoid html2wt
15083 # note that wt2html and html2html will put the <i> before the <b>
15084 !! test
15085 5 quotes, code coverage +1 line w/ nowiki (1)
15086 !! options
15087 parsoid=wt2wt,html2wt
15088 !! wikitext
15089 '''''<nowiki/>'''''
15090 !! html/php
15091 <p><i></i>
15092 </p>
15093 !! html/parsoid
15094 <p><b><i></i></b></p>
15095 !! end
15096
15097 # same as previous, just swapping the <i> and <b>
15098 !! test
15099 5 quotes, code coverage +1 line w/ nowiki (2)
15100 !! wikitext
15101 '''''<nowiki/>'''''
15102 !! html/php
15103 <p><i></i>
15104 </p>
15105 !! html/parsoid
15106 <p><i><b></b></i></p>
15107 !! end
15108
15109 !! test
15110 Special:Search page linking.
15111 !! wikitext
15112 {{Special:search}}
15113 !! html
15114 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15115 </p>
15116 !! end
15117
15118 !! test
15119 Say the magic word
15120 !! options
15121 title=[[Parser test]]
15122 !! wikitext
15123 * {{PAGENAME}}
15124 * {{PAGENAMEE}}
15125 * {{FULLPAGENAME}}
15126 * {{FULLPAGENAMEE}}
15127 * {{BASEPAGENAME}}
15128 * {{BASEPAGENAMEE}}
15129 * {{SUBPAGENAME}}
15130 * {{SUBPAGENAMEE}}
15131 * {{ROOTPAGENAME}}
15132 * {{ROOTPAGENAMEE}}
15133 * {{TALKPAGENAME}}
15134 * {{TALKPAGENAMEE}}
15135 * {{SUBJECTPAGENAME}}
15136 * {{SUBJECTPAGENAMEE}}
15137 * {{NAMESPACEE}}
15138 * {{NAMESPACE}}
15139 * {{NAMESPACENUMBER}}
15140 * {{TALKSPACE}}
15141 * {{TALKSPACEE}}
15142 * {{SUBJECTSPACE}}
15143 * {{SUBJECTSPACEE}}
15144 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15145 !! html
15146 <ul><li> Parser test</li>
15147 <li> Parser_test</li>
15148 <li> Parser test</li>
15149 <li> Parser_test</li>
15150 <li> Parser test</li>
15151 <li> Parser_test</li>
15152 <li> Parser test</li>
15153 <li> Parser_test</li>
15154 <li> Parser test</li>
15155 <li> Parser_test</li>
15156 <li> Talk:Parser test</li>
15157 <li> Talk:Parser_test</li>
15158 <li> Parser test</li>
15159 <li> Parser_test</li>
15160 <li> </li>
15161 <li> </li>
15162 <li> 0</li>
15163 <li> Talk</li>
15164 <li> Talk</li>
15165 <li> </li>
15166 <li> </li>
15167 <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>
15168
15169 !! end
15170 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15171
15172 !! test
15173 Gallery
15174 !! wikitext
15175 <gallery>
15176 image1.png |
15177 image2.gif|||||
15178
15179 image3|
15180 image4 |300px| centre
15181 image5.svg| http://///////
15182 [[x|xx]]]]
15183 * image6
15184 </gallery>
15185 !! html
15186 <ul class="gallery mw-gallery-traditional">
15187 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15188 <div class="thumb" style="height: 150px;">Image1.png</div>
15189 <div class="gallerytext">
15190 </div>
15191 </div></li>
15192 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15193 <div class="thumb" style="height: 150px;">Image2.gif</div>
15194 <div class="gallerytext">
15195 <p>||||
15196 </p>
15197 </div>
15198 </div></li>
15199 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15200 <div class="thumb" style="height: 150px;">Image3</div>
15201 <div class="gallerytext">
15202 </div>
15203 </div></li>
15204 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15205 <div class="thumb" style="height: 150px;">Image4</div>
15206 <div class="gallerytext">
15207 <p>300px| centre
15208 </p>
15209 </div>
15210 </div></li>
15211 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15212 <div class="thumb" style="height: 150px;">Image5.svg</div>
15213 <div class="gallerytext">
15214 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15215 </p>
15216 </div>
15217 </div></li>
15218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15219 <div class="thumb" style="height: 150px;">* image6</div>
15220 <div class="gallerytext">
15221 </div>
15222 </div></li>
15223 </ul>
15224
15225 !! end
15226
15227 !! test
15228 Gallery (with options)
15229 !! wikitext
15230 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15231 File:Nonexistant.jpg|caption
15232 File:Nonexistant.jpg
15233 image:foobar.jpg|some '''caption''' [[Main Page]]
15234 image:foobar.jpg
15235 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15236 </gallery>
15237 !! html
15238 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15239 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15240 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15241 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15242 <div class="gallerytext">
15243 <p>caption
15244 </p>
15245 </div>
15246 </div></li>
15247 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15248 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15249 <div class="gallerytext">
15250 </div>
15251 </div></li>
15252 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15253 <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>
15254 <div class="gallerytext">
15255 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15256 </p>
15257 </div>
15258 </div></li>
15259 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15260 <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>
15261 <div class="gallerytext">
15262 </div>
15263 </div></li>
15264 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15265 <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>
15266 <div class="gallerytext">
15267 <p>Blabla|blabla.
15268 </p>
15269 </div>
15270 </div></li>
15271 </ul>
15272
15273 !! end
15274
15275 !! test
15276 Gallery with link that has fragment
15277 !! wikitext
15278 <gallery>
15279 image:foobar.jpg|link=Main_Page
15280 image:foobar.jpg|link=Main_Page#section
15281 image:foobar.jpg|link=Main Page#section|caption
15282 </gallery>
15283 !! html
15284 <ul class="gallery mw-gallery-traditional">
15285 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15286 <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>
15287 <div class="gallerytext">
15288 </div>
15289 </div></li>
15290 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15291 <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>
15292 <div class="gallerytext">
15293 </div>
15294 </div></li>
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#section"><img alt="" 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 <p>caption
15299 </p>
15300 </div>
15301 </div></li>
15302 </ul>
15303
15304 !! end
15305
15306 !! test
15307 Gallery with wikitext inside caption
15308 !! wikitext
15309 <gallery>
15310 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15311 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15312 </gallery>
15313 !! html
15314 <ul class="gallery mw-gallery-traditional">
15315 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15316 <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>
15317 <div class="gallerytext">
15318 <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>
15319 </p>
15320 </div>
15321 </div></li>
15322 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15323 <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>
15324 <div class="gallerytext">
15325 <p>This is a test template
15326 </p>
15327 </div>
15328 </div></li>
15329 </ul>
15330
15331 !! end
15332
15333 !! test
15334 gallery (with showfilename option)
15335 !! wikitext
15336 <gallery showfilename>
15337 File:Nonexistant.jpg|caption
15338 File:Nonexistant.jpg
15339 image:foobar.jpg|some '''caption''' [[Main Page]]
15340 File:Foobar.jpg
15341 </gallery>
15342 !! html
15343 <ul class="gallery mw-gallery-traditional">
15344 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15345 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15346 <div class="gallerytext">
15347 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15348 caption
15349 </p>
15350 </div>
15351 </div></li>
15352 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15353 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15354 <div class="gallerytext">
15355 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15356 </p>
15357 </div>
15358 </div></li>
15359 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15360 <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>
15361 <div class="gallerytext">
15362 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15363 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15364 </p>
15365 </div>
15366 </div></li>
15367 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15368 <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>
15369 <div class="gallerytext">
15370 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15371 </p>
15372 </div>
15373 </div></li>
15374 </ul>
15375
15376 !! end
15377
15378 !! test
15379 Gallery (with namespace-less filenames)
15380 !! wikitext
15381 <gallery>
15382 File:Nonexistant.jpg
15383 Nonexistant.jpg
15384 image:foobar.jpg
15385 foobar.jpg
15386 </gallery>
15387 !! html
15388 <ul class="gallery mw-gallery-traditional">
15389 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15390 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15391 <div class="gallerytext">
15392 </div>
15393 </div></li>
15394 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15395 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15396 <div class="gallerytext">
15397 </div>
15398 </div></li>
15399 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15400 <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>
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="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>
15406 <div class="gallerytext">
15407 </div>
15408 </div></li>
15409 </ul>
15410
15411 !! end
15412
15413 !! test
15414 HTML Hex character encoding (spells the word "JavaScript")
15415 !! options
15416 parsoid=wt2html,wt2wt,html2html
15417 !! wikitext
15418 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15419 !! html/php
15420 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15421 </p>
15422 !! html/parsoid
15423 <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>
15424 !! end
15425
15426 !! test
15427 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15428 !! wikitext
15429 &#xsee;&#XSEE;
15430 !! html/php
15431 <p>&amp;#xsee;&amp;#XSEE;
15432 </p>
15433 !! html/parsoid
15434 <p>&amp;#xsee;&amp;#XSEE;</p>
15435 !! end
15436
15437 !! test
15438 HTML Hex character encoding mixed case
15439 !! options
15440 parsoid=wt2html,wt2wt,html2html
15441 !! wikitext
15442 &#xEE;&#Xee;
15443 !! html/php
15444 <p>&#xee;&#xee;
15445 </p>
15446 !! html/parsoid
15447 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15448 !! end
15449
15450 !! test
15451 __FORCETOC__ override
15452 !! wikitext
15453 __NEWSECTIONLINK__
15454 __FORCETOC__
15455 !! html
15456 <p><br />
15457 </p>
15458 !! end
15459
15460 !! test
15461 ISBN code coverage
15462 !! wikitext
15463 ISBN 978-0-1234-56&#x20;789
15464 !! html
15465 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15466 </p>
15467 !! end
15468
15469 !! test
15470 ISBN followed by 5 spaces
15471 !! wikitext
15472 ISBN
15473 !! html
15474 <p>ISBN
15475 </p>
15476 !! end
15477
15478 !! test
15479 Double ISBN
15480 !! wikitext
15481 ISBN ISBN 1234567890
15482 !! html
15483 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15484 </p>
15485 !! end
15486
15487 !! test
15488 ISBN with an X
15489 !! wikitext
15490 ISBN 3-462-04561-X
15491 !! html
15492 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15493 </p>
15494 !! end
15495
15496 !! test
15497 ISBN with empty prefix (parsoid test)
15498 !! wikitext
15499 ISBN 1234567890
15500 !! html/parsoid
15501 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15502 !! end
15503
15504 !! test
15505 Bug 22905: <abbr> followed by ISBN followed by </a>
15506 !! wikitext
15507 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15508 !! html
15509 <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>
15510 </p>
15511 !! end
15512
15513 !! test
15514 Double RFC
15515 !! wikitext
15516 RFC RFC 1234
15517 !! html
15518 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15519 </p>
15520 !! end
15521
15522 !! test
15523 Double RFC with a wiki link
15524 !! wikitext
15525 RFC [[RFC 1234]]
15526 !! html
15527 <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>
15528 </p>
15529 !! end
15530
15531 !! test
15532 RFC code coverage
15533 !! wikitext
15534 RFC 983&#x20;987
15535 !! html
15536 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15537 </p>
15538 !! end
15539
15540 !! test
15541 Centre-aligned image
15542 !! wikitext
15543 [[Image:foobar.jpg|centre]]
15544 !! html
15545 <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>
15546
15547 !!end
15548
15549 !! test
15550 None-aligned image
15551 !! wikitext
15552 [[Image:foobar.jpg|none]]
15553 !! html
15554 <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>
15555
15556 !!end
15557
15558 !! test
15559 Width + Height sized image (using px) (height is ignored)
15560 !! wikitext
15561 [[Image:foobar.jpg|640x480px]]
15562 !! html
15563 <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>
15564 </p>
15565 !!end
15566
15567 !! test
15568 Width-sized image (using px, no following whitespace)
15569 !! wikitext
15570 [[Image:foobar.jpg|640px]]
15571 !! html
15572 <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>
15573 </p>
15574 !!end
15575
15576 !! test
15577 Width-sized image (using px, with following whitespace - test regression from r39467)
15578 !! wikitext
15579 [[Image:foobar.jpg|640px ]]
15580 !! html
15581 <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>
15582 </p>
15583 !!end
15584
15585 !! test
15586 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15587 !! wikitext
15588 [[Image:foobar.jpg| 640px]]
15589 !! html
15590 <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>
15591 </p>
15592 !!end
15593
15594 !! test
15595 Image with page parameter
15596 !! options
15597 djvu
15598 !! wikitext
15599 [[File:LoremIpsum.djvu|page=2]]
15600 !! html
15601 <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>
15602 </p>
15603 !! end
15604
15605 !! test
15606 Another italics / bold test
15607 !! wikitext
15608 ''' ''x'
15609 !! html
15610 <pre>'<i> </i>x'
15611 </pre>
15612 !!end
15613
15614 # Note the results may be incorrect, as parserTest output included this:
15615 # XML error: Mismatched tag at byte 6120:
15616 # ...<dd> </dt></dl> </dd...
15617 !! test
15618 dt/dd/dl test
15619 !! options
15620 disabled
15621 !! wikitext
15622 :;;;::
15623 !! html
15624 <dl>
15625 <dd><dl>
15626 <dt><dl>
15627 <dt><dl>
15628 <dt><dl>
15629 <dd><dl>
15630 <dd>
15631 </dd>
15632 </dl>
15633 </dd>
15634 </dl>
15635 </dt>
15636 </dl>
15637 </dt>
15638 </dl>
15639 </dt>
15640 </dl>
15641 </dd>
15642 </dl>
15643
15644 !!end
15645
15646
15647 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15648 !! test
15649 Images with the "|" character in the comment
15650 !! wikitext
15651 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15652 !! html/php
15653 <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>
15654
15655 !! html/parsoid
15656 <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>
15657 !! end
15658
15659 !! test
15660 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15661 !! wikitext
15662 <html><script>alert(1);</script></html>
15663 !! html
15664 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15665 </p>
15666 !! end
15667
15668 !! test
15669 HTML with raw HTML ($wgRawHtml==true)
15670 !! options
15671 wgRawHtml=1
15672 !! wikitext
15673 <html><script>alert(1);</script></html>
15674 !! html
15675 <p><script>alert(1);</script>
15676 </p>
15677 !! end
15678
15679 !! test
15680 Parents of subpages, one level up
15681 !! options
15682 subpage title=[[Subpage test/L1/L2/L3]]
15683 !! wikitext
15684 [[../|L2]]
15685 !! html
15686 <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>
15687 </p>
15688 !! end
15689
15690
15691 !! test
15692 Parents of subpages, one level up, not named
15693 !! options
15694 subpage title=[[Subpage test/L1/L2/L3]]
15695 !! wikitext
15696 [[../]]
15697 !! html
15698 <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>
15699 </p>
15700 !! end
15701
15702
15703
15704 !! test
15705 Parents of subpages, two levels up
15706 !! options
15707 subpage title=[[Subpage test/L1/L2/L3]]
15708 !! wikitext
15709 [[../../|L1]]2
15710
15711 [[../../|L1]]l
15712 !! html
15713 <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
15714 </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>
15715 </p>
15716 !! end
15717
15718 !! test
15719 Parents of subpages, two levels up, without trailing slash or name.
15720 !! options
15721 subpage title=[[Subpage test/L1/L2/L3]]
15722 !! wikitext
15723 [[../..]]
15724 !! html
15725 <p>[[../..]]
15726 </p>
15727 !! end
15728
15729 !! test
15730 Parents of subpages, two levels up, with lots of extra trailing slashes.
15731 !! options
15732 subpage title=[[Subpage test/L1/L2/L3]]
15733 !! wikitext
15734 [[../../////]]
15735 !! html
15736 <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>
15737 </p>
15738 !! end
15739
15740 !! article
15741 Subpage test/L1/L2/L3Sibling
15742 !! text
15743 Sibling article
15744 !! endarticle
15745
15746 !! test
15747 Transclusion of a sibling page (one level up)
15748 !! options
15749 subpage title=[[Subpage test/L1/L2/L3]]
15750 !! wikitext
15751 {{../L3Sibling}}
15752 !! html
15753 <p>Sibling article
15754 </p>
15755 !! end
15756
15757 !! test
15758 Transclusion of a child page
15759 !! options
15760 subpage title=[[Subpage test/L1/L2]]
15761 !! wikitext
15762 {{/L3Sibling}}
15763 !! html
15764 <p>Sibling article
15765 </p>
15766 !! end
15767
15768 !! test
15769 Non-transclusion because of too many up levels
15770 !! options
15771 subpage title=[[Subpage test/L1/L2/L3]]
15772 !! wikitext
15773 {{../../../../More than parent}}
15774 !! html
15775 <p>{{../../../../More than parent}}
15776 </p>
15777 !! end
15778
15779 !! test
15780 Definition list code coverage
15781 !! wikitext
15782 ; title : def
15783 ; title : def
15784 ;title: def
15785 !! html
15786 <dl><dt> title &#160;</dt>
15787 <dd> def</dd>
15788 <dt> title&#160;</dt>
15789 <dd> def</dd>
15790 <dt>title</dt>
15791 <dd> def</dd></dl>
15792
15793 !! end
15794
15795 !! test
15796 Don't fall for the self-closing div
15797 !! wikitext
15798 <div>hello world</div/>
15799 !! html
15800 <div>hello world</div>
15801
15802 !! end
15803
15804 !! test
15805 MSGNW magic word
15806 !! wikitext
15807 {{MSGNW:msg}}
15808 !! html
15809 <p>&#91;&#91;:Template:Msg&#93;&#93;
15810 </p>
15811 !! end
15812
15813 !! test
15814 RAW magic word
15815 !! wikitext
15816 {{RAW:QUERTY}}
15817 !! html
15818 <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>
15819 </p>
15820 !! end
15821
15822 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15823 !! test
15824 Always escape literal '>' in output, not just after '<'
15825 !! wikitext
15826 ><>
15827 !! html
15828 <p>&gt;&lt;&gt;
15829 </p>
15830 !! end
15831
15832 !! test
15833 Template caching
15834 !! wikitext
15835 {{Test}}
15836 {{Test}}
15837 !! html
15838 <p>This is a test template
15839 This is a test template
15840 </p>
15841 !! end
15842
15843
15844 !! article
15845 MediaWiki:Fake
15846 !! text
15847 ==header==
15848 !! endarticle
15849
15850 !! test
15851 Inclusion of !userCanEdit() content
15852 !! wikitext
15853 {{MediaWiki:Fake}}
15854 !! html
15855 <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>
15856
15857 !! end
15858
15859
15860 !! test
15861 Out-of-order TOC heading levels
15862 !! wikitext
15863 ==2==
15864 ======6======
15865 ===3===
15866 =1=
15867 =====5=====
15868 ==2==
15869 !! html
15870 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15871 <ul>
15872 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15873 <ul>
15874 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15875 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15876 </ul>
15877 </li>
15878 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15879 <ul>
15880 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15881 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15882 </ul>
15883 </li>
15884 </ul>
15885 </div>
15886
15887 <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>
15888 <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>
15889 <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>
15890 <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>
15891 <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>
15892 <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>
15893
15894 !! end
15895
15896
15897 !! test
15898 ISBN with a dummy number
15899 !! wikitext
15900 ISBN ---
15901 !! html
15902 <p>ISBN ---
15903 </p>
15904 !! end
15905
15906
15907 !! test
15908 ISBN with space-delimited number
15909 !! wikitext
15910 ISBN 92 9017 032 8
15911 !! html
15912 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15913 </p>
15914 !! end
15915
15916
15917 !! test
15918 ISBN with multiple spaces, no number
15919 !! wikitext
15920 ISBN foo
15921 !! html
15922 <p>ISBN foo
15923 </p>
15924 !! end
15925
15926
15927 !! test
15928 ISBN length
15929 !! wikitext
15930 ISBN 123456789
15931
15932 ISBN 1234567890
15933
15934 ISBN 12345678901
15935 !! html
15936 <p>ISBN 123456789
15937 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15938 </p><p>ISBN 12345678901
15939 </p>
15940 !! end
15941
15942
15943 !! test
15944 ISBN with trailing year (bug 8110)
15945 !! wikitext
15946 ISBN 1-234-56789-0 - 2006
15947
15948 ISBN 1 234 56789 0 - 2006
15949 !! html
15950 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15951 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15952 </p>
15953 !! end
15954
15955
15956 !! test
15957 anchorencode
15958 !! wikitext
15959 {{anchorencode:foo bar©#%n}}
15960 !! html
15961 <p>foo_bar.C2.A9.23.25n
15962 </p>
15963 !! end
15964
15965 !! test
15966 anchorencode trims spaces
15967 !! wikitext
15968 {{anchorencode: __pretty__please__}}
15969 !! html
15970 <p>pretty_please
15971 </p>
15972 !! end
15973
15974 !! test
15975 anchorencode deals with links
15976 !! wikitext
15977 {{anchorencode: [[hello|world]] [[hi]]}}
15978 !! html
15979 <p>world_hi
15980 </p>
15981 !! end
15982
15983 !! test
15984 anchorencode deals with templates
15985 !! wikitext
15986 {{anchorencode: {{Foo}} }}
15987 !! html
15988 <p>FOO
15989 </p>
15990 !! end
15991
15992 !! test
15993 anchorencode encodes like the TOC generator: (bug 18431)
15994 !! wikitext
15995 === _ +:.3A%3A&&amp;]] ===
15996 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15997 __NOEDITSECTION__
15998 !! html
15999 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16000 <p>.2B:.3A.253A.26.26.5D.5D
16001 </p>
16002 !! end
16003
16004 !! test
16005 Bug 6200: blockquotes and paragraph formatting
16006 !! wikitext
16007 <blockquote>
16008 foo
16009 </blockquote>
16010
16011 bar
16012
16013 baz
16014 !! html
16015 <blockquote>
16016 <p>foo
16017 </p>
16018 </blockquote>
16019 <p>bar
16020 </p>
16021 <pre>baz
16022 </pre>
16023 !! end
16024
16025 !! test
16026 Bug 8293: Use of center tag ruins paragraph formatting
16027 !! wikitext
16028 <center>
16029 foo
16030 </center>
16031
16032 bar
16033
16034 baz
16035 !! html
16036 <center>
16037 <p>foo
16038 </p>
16039 </center>
16040 <p>bar
16041 </p>
16042 <pre>baz
16043 </pre>
16044 !! end
16045
16046 !!test
16047 Parsing of overlapping (improperly nested) inline html tags
16048 !! wikitext
16049 <span><s>x</span></s>
16050 !! html/php
16051 <p><span><s>x&lt;/span&gt;</s></span>
16052 </p>
16053 !! html/parsoid
16054 <p><span><s>x</s></span>
16055 </p>
16056 !!end
16057
16058 ###
16059 ### Language variants related tests
16060 ###
16061 !! test
16062 Self-link in language variants
16063 !! options
16064 title=[[Dunav]] language=sr
16065 !! wikitext
16066 Both [[Dunav]] and [[Дунав]] are names for this river.
16067 !! html
16068 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16069 </p>
16070 !!end
16071
16072 !! article
16073 Дуна
16074 !! text
16075 content
16076 !! endarticle
16077
16078 !! test
16079 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16080 !! options
16081 title=[[Duna]] language=sr
16082 !! wikitext
16083 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16084 !! html
16085 <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.
16086 </p>
16087 !! end
16088
16089 !! test
16090 Link to a section of a variant of this title shouldn't be parsed as self-link
16091 !! options
16092 title=[[Duna]] language=sr
16093 !! wikitext
16094 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16095 !! html
16096 <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.
16097 </p>
16098 !! end
16099
16100 !! test
16101 Link to pages in language variants
16102 !! options
16103 language=sr
16104 !! wikitext
16105 Main Page can be written as [[Маин Паге]]
16106 !! html
16107 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16108 </p>
16109 !!end
16110
16111
16112 !! test
16113 Multiple links to pages in language variants
16114 !! options
16115 language=sr
16116 !! wikitext
16117 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16118 !! html
16119 <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>.
16120 </p>
16121 !!end
16122
16123
16124 !! test
16125 Simple template in language variants
16126 !! options
16127 language=sr
16128 !! wikitext
16129 {{тест}}
16130 !! html
16131 <p>This is a test template
16132 </p>
16133 !! end
16134
16135
16136 !! test
16137 Template with explicit namespace in language variants
16138 !! options
16139 language=sr
16140 !! wikitext
16141 {{Template:тест}}
16142 !! html
16143 <p>This is a test template
16144 </p>
16145 !! end
16146
16147
16148 !! test
16149 Basic test for template parameter in language variants
16150 !! options
16151 language=sr
16152 !! wikitext
16153 {{парамтест|param=foo}}
16154 !! html
16155 <p>This is a test template with parameter foo
16156 </p>
16157 !! end
16158
16159
16160 !! test
16161 Simple category in language variants
16162 !! options
16163 language=sr cat
16164 !! wikitext
16165 [[Category:МедиаWики Усер'с Гуиде]]
16166 !! html
16167 <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>
16168 !! end
16169
16170
16171 !! article
16172 Category:分类
16173 !! text
16174 blah
16175 !! endarticle
16176
16177 !! article
16178 Category:分類
16179 !! text
16180 blah
16181 !! endarticle
16182
16183 !! test
16184 Don't convert blue categorylinks to another variant (bug 33210)
16185 !! options
16186 language=zh cat
16187 !! wikitext
16188 [[A]][[Category:分类]]
16189 !! html
16190 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16191 !! end
16192
16193
16194 !! test
16195 Stripping -{}- tags (language variants)
16196 !! options
16197 language=sr
16198 !! wikitext
16199 Latin proverb: -{Ne nuntium necare}-
16200 !! html
16201 <p>Latin proverb: Ne nuntium necare
16202 </p>
16203 !! end
16204
16205
16206 !! test
16207 Prevent conversion with -{}- tags (language variants)
16208 !! options
16209 language=sr variant=sr-ec
16210 !! wikitext
16211 Latinski: -{Ne nuntium necare}-
16212 !! html
16213 <p>Латински: Ne nuntium necare
16214 </p>
16215 !! end
16216
16217
16218 !! test
16219 Prevent conversion of text with -{}- tags (language variants)
16220 !! options
16221 language=sr variant=sr-ec
16222 !! wikitext
16223 Latinski: -{Ne nuntium necare}-
16224 !! html
16225 <p>Латински: Ne nuntium necare
16226 </p>
16227 !! end
16228
16229
16230 !! test
16231 Prevent conversion of links with -{}- tags (language variants)
16232 !! options
16233 language=sr variant=sr-ec
16234 !! wikitext
16235 -{[[Main Page]]}-
16236 !! html
16237 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16238 </p>
16239 !! end
16240
16241
16242 !! test
16243 -{}- tags within headlines (within html for parserConvert())
16244 !! options
16245 language=sr variant=sr-ec
16246 !! wikitext
16247 == -{Naslov}- ==
16248 !! html
16249 <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>
16250
16251 !! end
16252
16253
16254 !! test
16255 Explicit definition of language variant alternatives
16256 !! options
16257 language=zh variant=zh-tw
16258 !! wikitext
16259 -{zh:China;zh-tw:Taiwan}-, not China
16260 !! html
16261 <p>Taiwan, not China
16262 </p>
16263 !! end
16264
16265
16266 !! test
16267 Conversion around HTML tags
16268 !! options
16269 language=sr variant=sr-ec
16270 !! wikitext
16271 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16272 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16273 !! html
16274 <p>
16275 <span title="ЛаCтин">ски</span>
16276 </p>
16277 !! end
16278
16279
16280 !! test
16281 Explicit session-wise language variant mapping (A flag and - flag)
16282 !! options
16283 language=zh variant=zh-tw
16284 !! wikitext
16285 Taiwan is not China.
16286 But -{A|zh:China;zh-tw:Taiwan}- is China,
16287 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16288 and -{China}- is China.
16289 !! html
16290 <p>Taiwan is not China.
16291 But Taiwan is Taiwan,
16292 (This should be stripped!)
16293 and China is China.
16294 </p>
16295 !! end
16296
16297 !! test
16298 Explicit session-wise language variant mapping (H flag for hide)
16299 !! options
16300 language=zh variant=zh-tw
16301 !! wikitext
16302 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16303 Taiwan is China.
16304 !! html
16305 <p>(This should be stripped!)
16306 Taiwan is Taiwan.
16307 </p>
16308 !! end
16309
16310 !! test
16311 Adding explicit conversion rule for title (T flag)
16312 !! options
16313 language=zh variant=zh-tw showtitle
16314 !! wikitext
16315 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16316 !! html
16317 Taiwan
16318 <p>Should be stripped!
16319 </p>
16320 !! end
16321
16322 !! test
16323 Testing that changing the language variant here in the tests actually works
16324 !! options
16325 language=zh variant=zh showtitle
16326 !! wikitext
16327 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16328 !! html
16329 China
16330 <p>Should be stripped!
16331 </p>
16332 !! end
16333
16334 !! test
16335 Recursive conversion of alt and title attrs shouldn't clear converter state
16336 !! options
16337 language=zh variant=zh-cn showtitle
16338 !! wikitext
16339 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16340 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16341 !! html
16342 China
16343 <p>
16344 Should be stripped<span title="Exclamation">!</span>
16345 </p>
16346 !! end
16347
16348 !! test
16349 Bug 24072: more test on conversion rule for title
16350 !! options
16351 language=zh variant=zh-tw showtitle
16352 !! wikitext
16353 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16354 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16355 !! html
16356 Taiwan
16357 <p>This should be stripped!
16358 This won't take interferes with the title rule.
16359 </p>
16360 !! end
16361
16362 !! test
16363 Partly disable title conversion if variant == main language code
16364 !! options
16365 language=zh variant=zh title=[[ZH]] showtitle
16366 !! wikitext
16367 -{T|zh-cn:CN;zh-tw:TW}-
16368 !! html
16369 ZH
16370 <p>
16371 </p>
16372 !! end
16373
16374 !! test
16375 Partly disable title conversion if variant == main language code, more
16376 !! options
16377 language=zh variant=zh title=[[ZH]] showtitle
16378 !! wikitext
16379 -{T|TW}-
16380 !! html
16381 ZH
16382 <p>
16383 </p>
16384 !! end
16385
16386 !! test
16387 Raw output of variant escape tags (R flag)
16388 !! options
16389 language=zh variant=zh-tw
16390 !! wikitext
16391 Raw: -{R|zh:China;zh-tw:Taiwan}-
16392 !! html
16393 <p>Raw: zh:China;zh-tw:Taiwan
16394 </p>
16395 !! end
16396
16397 !! test
16398 Nested using of manual convert syntax
16399 !! options
16400 language=zh variant=zh-hk
16401 !! wikitext
16402 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16403 !! html
16404 <p>Nested: Hello Hong Kong!
16405 </p>
16406 !! end
16407
16408 !! test
16409 Proper conversion of text in external links
16410 !! options
16411 language=sr variant=sr-ec
16412 !! wikitext
16413 http://www.google.com
16414 gopher://www.google.com
16415 [http://www.google.com http://www.google.com]
16416 [gopher://www.google.com gopher://www.google.com]
16417 [https://www.google.com irc://www.google.com]
16418 [ftp://www.google.com www.google.com/ftp://dir]
16419 [//www.google.com www.google.com]
16420 !! html
16421 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16422 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16423 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16424 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16425 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16426 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16427 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16428 </p>
16429 !! end
16430
16431 !! test
16432 Do not convert roman numbers to language variants
16433 !! options
16434 language=sr variant=sr-ec
16435 !! wikitext
16436 Fridrih IV je car.
16437 !! html
16438 <p>Фридрих IV је цар.
16439 </p>
16440 !! end
16441
16442 !! test
16443 Unclosed language converter markup "-{"
16444 !! options
16445 language=sr
16446 !! wikitext
16447 -{T|hello
16448 !! html
16449 <p>-{T|hello
16450 </p>
16451 !! end
16452
16453 !! test
16454 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16455 !! options
16456 language=sr
16457 !! wikitext
16458 -{R|=&gt;}-
16459 !! html
16460 <p>=&gt;
16461 </p>
16462 !!end
16463
16464 !! test
16465 Don't break link parsing if language converter markup is in the caption.
16466 !! options
16467 language=sr variant=sr-ec
16468 !! wikitext
16469 [[Main Page|-{R|main page}-]]
16470 !! html
16471 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16472 </p>
16473 !! end
16474
16475 # This test is currently broken in the PHP parser (bug 52661)
16476 !! test
16477 Don't break image parsing if language converter markup is in the caption.
16478 !! options
16479 language=sr
16480 disabled
16481 !! wikitext
16482 [[File:Foobar.jpg|-{R|caption}-]]
16483 !! html
16484 <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>
16485 </p>
16486 !! end
16487
16488 # This test is currently broken in the PHP parser (bug 52661)
16489 !! test
16490 Don't break list handling if language converter markup is in the item.
16491 !! options
16492 language=zh variant=zh-cn
16493 disabled
16494 !! wikitext
16495 ;-{zh-cn:AAA;zh-tw:BBB}-
16496 !! html
16497 <dl><dt>AAA
16498 </dt></dl>
16499
16500 !! end
16501
16502 # This test is currently broken in the PHP parser (bug 52661)
16503 !! test
16504 Don't break table handling if language converter markup is in the cell.
16505 !! options
16506 language=sr variant=sr-ec
16507 disabled
16508 !! wikitext
16509 {|
16510 |-
16511 | -{R|B}-
16512 |}
16513 !! html
16514 <table>
16515
16516 <tr>
16517 <td> B
16518 </td></tr></table>
16519
16520 !! end
16521
16522 !! test
16523 Bug 529: Uncovered bullet
16524 !! wikitext
16525 * Foo {{bullet}}
16526 !! html
16527 <ul><li> Foo </li>
16528 <li> Bar</li></ul>
16529
16530 !! end
16531
16532 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16533 # Templates in Wikipedia rely on this behavior, as tidy has always been
16534 # enabled there. These tests are normally run *without* tidy, so specify the
16535 # full output here.
16536 # To test realistic parsing behavior, apply a tidy-like transformation to both
16537 # the expected output and your parser's output.
16538 !! test
16539 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16540 !! wikitext
16541 ******* Foo {{bullet}}
16542 !! html
16543 <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>
16544 <li> Bar</li></ul>
16545
16546 !! end
16547
16548 !! test
16549 Bug 529: Uncovered table already at line-start
16550 !! wikitext
16551 x
16552
16553 {{table}}
16554 y
16555 !! html
16556 <p>x
16557 </p>
16558 <table>
16559 <tr>
16560 <td> 1 </td>
16561 <td> 2
16562 </td></tr>
16563 <tr>
16564 <td> 3 </td>
16565 <td> 4
16566 </td></tr></table>
16567 <p>y
16568 </p>
16569 !! end
16570
16571 !! test
16572 Bug 529: Uncovered bullet in parser function result
16573 !! wikitext
16574 * Foo {{lc:{{bullet}} }}
16575 !! html
16576 <ul><li> Foo </li>
16577 <li> bar</li></ul>
16578
16579 !! end
16580
16581 !! test
16582 Bug 5678: Double-parsed template argument
16583 !! wikitext
16584 {{lc:{{{1}}}|hello}}
16585 !! html
16586 <p>{{{1}}}
16587 </p>
16588 !! end
16589
16590 !! test
16591 Bug 5678: Double-parsed template invocation
16592 !! wikitext
16593 {{lc:{{paramtest {{!}} param = hello }} }}
16594 !! html
16595 <p>{{paramtest | param = hello }}
16596 </p>
16597 !! end
16598
16599 !! test
16600 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16601 !! options
16602 language=cs
16603 title=[[Main Page]]
16604 !! wikitext
16605 {{PRVNÍVELKÉ:ěščř}}
16606 {{prvnívelké:ěščř}}
16607 {{PRVNÍMALÉ:ěščř}}
16608 {{prvnímalé:ěščř}}
16609 {{MALÁ:ěščř}}
16610 {{malá:ěščř}}
16611 {{VELKÁ:ěščř}}
16612 {{velká:ěščř}}
16613 !! html
16614 <p>Ěščř
16615 Ěščř
16616 ěščř
16617 ěščř
16618 ěščř
16619 ěščř
16620 ĚŠČŘ
16621 ĚŠČŘ
16622 </p>
16623 !! end
16624
16625 !! test
16626 Morwen/13: Unclosed link followed by heading
16627 !! wikitext
16628 [[link
16629 ==heading==
16630 !! html
16631 <p>[[link
16632 </p>
16633 <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>
16634
16635 !! end
16636
16637 !! test
16638 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16639 !! wikitext
16640 {{foo|
16641 =heading=
16642 !! html
16643 <p>{{foo|
16644 </p>
16645 <h1><span class="mw-headline" id="heading">heading</span></h1>
16646
16647 !! end
16648
16649 !! test
16650 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16651 !! wikitext
16652 {{foo|
16653 ==heading==
16654 !! html
16655 <p>{{foo|
16656 </p>
16657 <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>
16658
16659 !! end
16660
16661 !! test
16662 Tildes in comments
16663 !! options
16664 pst
16665 !! wikitext
16666 <!-- ~~~~ -->
16667 !! html
16668 <!-- ~~~~ -->
16669 !! end
16670
16671 !! test
16672 Paragraphs inside divs (no extra line breaks)
16673 !! wikitext
16674 <div>Line one
16675
16676 Line two</div>
16677 !! html
16678 <div>Line one
16679 Line two</div>
16680
16681 !! end
16682
16683 !! test
16684 Paragraphs inside divs (extra line break on open)
16685 !! wikitext
16686 <div>
16687 Line one
16688
16689 Line two</div>
16690 !! html
16691 <div>
16692 <p>Line one
16693 </p>
16694 Line two</div>
16695
16696 !! end
16697
16698 !! test
16699 Paragraphs inside divs (extra line break on close)
16700 !! wikitext
16701 <div>Line one
16702
16703 Line two
16704 </div>
16705 !! html
16706 <div>Line one
16707 <p>Line two
16708 </p>
16709 </div>
16710
16711 !! end
16712
16713 !! test
16714 Paragraphs inside divs (extra line break on open and close)
16715 !! wikitext
16716 <div>
16717 Line one
16718
16719 Line two
16720 </div>
16721 !! html
16722 <div>
16723 <p>Line one
16724 </p><p>Line two
16725 </p>
16726 </div>
16727
16728 !! end
16729
16730 !! test
16731 Nesting tags, paragraphs on lines which begin with <div>
16732 !! options
16733 disabled
16734 !! wikitext
16735 <div></div><strong>A
16736 B</strong>
16737 !! html
16738 <div></div>
16739 <p><strong>A
16740 B</strong>
16741 </p>
16742 !! end
16743
16744 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16745 !! test
16746 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16747 !! wikitext
16748 <blockquote>Line one
16749
16750 Line two</blockquote>
16751 !! html
16752 <blockquote>Line one
16753 Line two</blockquote>
16754
16755 !! end
16756
16757 !! test
16758 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16759 !! wikitext
16760 <blockquote>
16761 Line one
16762
16763 Line two</blockquote>
16764 !! html
16765 <blockquote>
16766 <p>Line one
16767 </p>
16768 Line two</blockquote>
16769
16770 !! end
16771
16772 !! test
16773 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16774 !! wikitext
16775 <blockquote>Line one
16776
16777 Line two
16778 </blockquote>
16779 !! html
16780 <blockquote>Line one
16781 <p>Line two
16782 </p>
16783 </blockquote>
16784
16785 !! end
16786
16787 !! test
16788 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16789 !! wikitext
16790 <blockquote>
16791 Line one
16792
16793 Line two
16794 </blockquote>
16795 !! html
16796 <blockquote>
16797 <p>Line one
16798 </p><p>Line two
16799 </p>
16800 </blockquote>
16801
16802 !! end
16803
16804 !! test
16805 Paragraphs inside blockquotes/divs (no extra line breaks)
16806 !! wikitext
16807 <blockquote><div>Line one
16808
16809 Line two</div></blockquote>
16810 !! html
16811 <blockquote><div>Line one
16812 Line two</div></blockquote>
16813
16814 !! end
16815
16816 !! test
16817 Paragraphs inside blockquotes/divs (extra line break on open)
16818 !! wikitext
16819 <blockquote><div>
16820 Line one
16821
16822 Line two</div></blockquote>
16823 !! html
16824 <blockquote><div>
16825 <p>Line one
16826 </p>
16827 Line two</div></blockquote>
16828
16829 !! end
16830
16831 !! test
16832 Paragraphs inside blockquotes/divs (extra line break on close)
16833 !! wikitext
16834 <blockquote><div>Line one
16835
16836 Line two
16837 </div></blockquote>
16838 !! html
16839 <blockquote><div>Line one
16840 <p>Line two
16841 </p>
16842 </div></blockquote>
16843
16844 !! end
16845
16846 !! test
16847 Paragraphs inside blockquotes/divs (extra line break on open and close)
16848 !! wikitext
16849 <blockquote><div>
16850 Line one
16851
16852 Line two
16853 </div></blockquote>
16854 !! html
16855 <blockquote><div>
16856 <p>Line one
16857 </p><p>Line two
16858 </p>
16859 </div></blockquote>
16860
16861 !! end
16862
16863 !! test
16864 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16865 !! options
16866 wgLinkHolderBatchSize=0
16867 !! wikitext
16868 [[meatball:1]]
16869 [[meatball:2]]
16870 [[meatball:3]]
16871 !! html
16872 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16873 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16874 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16875 </p>
16876 !! end
16877
16878 !! test
16879 Free external link invading image caption
16880 !! wikitext
16881 [[Image:Foobar.jpg|thumb|http://x|hello]]
16882 !! html
16883 <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>
16884
16885 !! end
16886
16887 !! test
16888 Bug 15196: localised external link numbers
16889 !! options
16890 language=fa
16891 !! wikitext
16892 [http://en.wikipedia.org/]
16893 !! html/php
16894 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16895 </p>
16896 !! html/parsoid
16897 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16898 !! end
16899
16900 !! test
16901 Multibyte character in padleft
16902 !! wikitext
16903 {{padleft:-Hello|7|Æ}}
16904 !! html
16905 <p>Æ-Hello
16906 </p>
16907 !! end
16908
16909 !! test
16910 Multibyte character in padright
16911 !! wikitext
16912 {{padright:Hello-|7|Æ}}
16913 !! html
16914 <p>Hello-Æ
16915 </p>
16916 !! end
16917
16918 !!test
16919 formatdate parser function
16920 !! wikitext
16921 {{#formatdate:2009-03-24}}
16922 !! html
16923 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16924 </p>
16925 !! end
16926
16927 !!test
16928 formatdate parser function, with default format
16929 !! wikitext
16930 {{#formatdate:2009-03-24|mdy}}
16931 !! html
16932 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16933 </p>
16934 !! end
16935
16936 !! test
16937 Spacing of numbers in formatted dates
16938 !! wikitext
16939 {{#formatdate:January 15}}
16940 !! html
16941 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16942 </p>
16943 !! end
16944
16945 !! test
16946 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
16947 !! options
16948 language=nl title=[[MediaWiki:Common.css]]
16949 !! wikitext
16950 {{#formatdate:2009-03-24|dmy}}
16951 !! html
16952 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16953 </p>
16954 !! end
16955
16956 #
16957 #
16958 #
16959
16960 #
16961 # Edit comments
16962 #
16963
16964 !! test
16965 Edit comment with link
16966 !! options
16967 comment
16968 !! wikitext
16969 I like the [[Main Page]] a lot
16970 !! html
16971 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16972 !!end
16973
16974 !! test
16975 Edit comment with link and link text
16976 !! options
16977 comment
16978 !! wikitext
16979 I like the [[Main Page|best pages]] a lot
16980 !! html
16981 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16982 !!end
16983
16984 !! test
16985 Edit comment with link and link text with suffix
16986 !! options
16987 comment
16988 !! wikitext
16989 I like the [[Main Page|best page]]s 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 section link (non-local, eg in history list)
16996 !! options
16997 comment title=[[Main Page]]
16998 !! wikitext
16999 /* External links */ removed bogus entries
17000 !! html
17001 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17002 !!end
17003
17004 !! test
17005 Edit comment with section link and text before it (non-local, eg in history list)
17006 !! options
17007 comment title=[[Main Page]]
17008 !! wikitext
17009 pre-comment text /* External links */ removed bogus entries
17010 !! html
17011 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>
17012 !!end
17013
17014 !! test
17015 Edit comment with section link (local, eg in diff view)
17016 !! options
17017 comment local title=[[Main Page]]
17018 !! wikitext
17019 /* External links */ removed bogus entries
17020 !! html
17021 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17022 !!end
17023
17024 !! test
17025 Edit comment with subpage link (bug 14080)
17026 !! options
17027 comment
17028 subpage
17029 title=[[Subpage test]]
17030 !! wikitext
17031 Poked at a [[/subpage]] here...
17032 !! html
17033 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17034 !!end
17035
17036 !! test
17037 Edit comment with subpage link and link text (bug 14080)
17038 !! options
17039 comment
17040 subpage
17041 title=[[Subpage test]]
17042 !! wikitext
17043 Poked at a [[/subpage|neat little page]] here...
17044 !! html
17045 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17046 !!end
17047
17048 !! test
17049 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17050 !! options
17051 comment
17052 title=[[Subpage test]]
17053 !! wikitext
17054 Poked at a [[/subpage]] here...
17055 !! html
17056 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...
17057 !!end
17058
17059 !! test
17060 Edit comment with bare anchor link (local, as on diff)
17061 !! options
17062 comment
17063 local
17064 title=[[Main Page]]
17065 !! wikitext
17066 [[#section]]
17067 !! html
17068 <a href="#section">#section</a>
17069 !! end
17070
17071 !! test
17072 Edit comment with bare anchor link (non-local, as on history)
17073 !! options
17074 comment
17075 title=[[Main Page]]
17076 !! wikitext
17077 [[#section]]
17078 !! html
17079 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17080 !! end
17081
17082 !! test
17083 Anchor starting with underscore
17084 !! wikitext
17085 [[#_ref|One]]
17086 !! html
17087 <p><a href="#_ref">One</a>
17088 </p>
17089 !! end
17090
17091 !! test
17092 Id starting with underscore
17093 !! wikitext
17094 <div id="_ref"></div>
17095 !! html
17096 <div id="_ref"></div>
17097
17098 !! end
17099
17100 !! test
17101 Space normalisation on autocomment (bug 22784)
17102 !! options
17103 comment
17104 title=[[Main Page]]
17105 !! wikitext
17106 /* __hello__world__ */
17107 !! html
17108 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17109 !! end
17110
17111 !! test
17112 percent-encoding and + signs in comments (Bug 26410)
17113 !! options
17114 comment
17115 !! wikitext
17116 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17117 !! html
17118 <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>
17119 !! end
17120
17121 !! test
17122 Bad images - basic functionality
17123 !! options
17124 disabled
17125 !! wikitext
17126 [[File:Bad.jpg]]
17127 !! html
17128 !! end
17129
17130 !! test
17131 Bad images - bug 16039: text after bad image disappears
17132 !! options
17133 disabled
17134 !! wikitext
17135 Foo bar
17136 [[File:Bad.jpg]]
17137 Bar foo
17138 !! html
17139 <p>Foo bar
17140 </p><p>Bar foo
17141 </p>
17142 !! end
17143
17144 !! test
17145 Verify that displaytitle works (bug #22501) no displaytitle
17146 !! options
17147 showtitle
17148 !! config
17149 wgAllowDisplayTitle=true
17150 wgRestrictDisplayTitle=false
17151 !! wikitext
17152 this is not the the title
17153 !! html
17154 Parser test
17155 <p>this is not the the title
17156 </p>
17157 !! end
17158
17159 !! test
17160 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17161 !! options
17162 showtitle
17163 title=[[Screen]]
17164 !! config
17165 wgAllowDisplayTitle=true
17166 wgRestrictDisplayTitle=false
17167 !! wikitext
17168 this is not the the title
17169 {{DISPLAYTITLE:whatever}}
17170 !! html
17171 whatever
17172 <p>this is not the the title
17173 </p>
17174 !! end
17175
17176 !! test
17177 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17178 !! options
17179 showtitle
17180 title=[[Screen]]
17181 !! config
17182 wgAllowDisplayTitle=true
17183 wgRestrictDisplayTitle=true
17184 !! wikitext
17185 this is not the the title
17186 {{DISPLAYTITLE:whatever}}
17187 !! html
17188 Screen
17189 <p>this is not the the title
17190 </p>
17191 !! end
17192
17193 !! test
17194 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17195 !! options
17196 showtitle
17197 title=[[Screen]]
17198 !! config
17199 wgAllowDisplayTitle=true
17200 wgRestrictDisplayTitle=true
17201 !! wikitext
17202 this is not the the title
17203 {{DISPLAYTITLE:screen}}
17204 !! html
17205 screen
17206 <p>this is not the the title
17207 </p>
17208 !! end
17209
17210 !! test
17211 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17212 !! options
17213 showtitle
17214 title=[[Screen]]
17215 !! config
17216 wgAllowDisplayTitle=false
17217 !! wikitext
17218 this is not the the title
17219 {{DISPLAYTITLE:screen}}
17220 !! html
17221 Screen
17222 <p>this is not the the title
17223 <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>
17224 </p>
17225 !! end
17226
17227 !! test
17228 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17229 !! options
17230 showtitle
17231 title=[[Screen]]
17232 !! config
17233 wgAllowDisplayTitle=false
17234 !! wikitext
17235 this is not the the title
17236 !! html
17237 Screen
17238 <p>this is not the the title
17239 </p>
17240 !! end
17241
17242 !! test
17243 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17244 !! options
17245 showtitle
17246 title=[[Screen]]
17247 !! config
17248 wgAllowDisplayTitle=true
17249 wgRestrictDisplayTitle=true
17250 !! wikitext
17251 this is not the the title
17252 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17253 !! html
17254 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17255 <p>this is not the the title
17256 </p>
17257 !! end
17258
17259 !! test
17260 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17261 !! options
17262 showtitle
17263 title=[[Screen]]
17264 !! config
17265 wgAllowDisplayTitle=true
17266 wgRestrictDisplayTitle=true
17267 !! wikitext
17268 this is not the the title
17269 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17270 !! html
17271 <span style="color: red;">s</span>creen
17272 <p>this is not the the title
17273 </p>
17274 !! end
17275
17276 !! test
17277 preload: check <noinclude> and <includeonly>
17278 !! options
17279 preload
17280 !! wikitext
17281 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17282 !! html
17283 Hello kind world.
17284 !! end
17285
17286 !! test
17287 preload: check <onlyinclude>
17288 !! options
17289 preload
17290 !! wikitext
17291 Goodbye <onlyinclude>Hello world</onlyinclude>
17292 !! html
17293 Hello world
17294 !! end
17295
17296 !! test
17297 preload: can pass tags through if we want to
17298 !! options
17299 preload
17300 !! wikitext
17301 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17302 !! html
17303 <includeonly>Hello world</includeonly>
17304 !! end
17305
17306 !! test
17307 preload: check that it doesn't try to do tricks
17308 !! options
17309 preload
17310 !! wikitext
17311 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17312 !! html
17313 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17314 !! end
17315
17316 !! test
17317 Play a bit with r67090 and bug 3158
17318 !! options
17319 disabled
17320 !! wikitext
17321 <div style="width:50% !important">&nbsp;</div>
17322 <div style="width:50%&nbsp;!important">&nbsp;</div>
17323 <div style="width:50%&#160;!important">&nbsp;</div>
17324 <div style="border : solid;">&nbsp;</div>
17325 !! html
17326 <div style="width:50% !important">&nbsp;</div>
17327 <div style="width:50% !important">&nbsp;</div>
17328 <div style="width:50% !important">&nbsp;</div>
17329 <div style="border&#160;: solid;">&nbsp;</div>
17330
17331 !! end
17332
17333 !! test
17334 HTML5 data attributes
17335 !! wikitext
17336 <span data-foo="bar">Baz</span>
17337 <p data-abc-def_hij="">Quuz</p>
17338 !! html
17339 <p><span data-foo="bar">Baz</span>
17340 </p>
17341 <p data-abc-def_hij="">Quuz</p>
17342
17343 !! end
17344
17345 !! test
17346 percent-encoding and + signs in internal links (Bug 26410)
17347 !! wikitext
17348 [[User:+%]] [[Page+title%]]
17349 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17350 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17351 [[%33%45]] [[%33%45+]]
17352 !! html
17353 <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>
17354 <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>
17355 <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>
17356 <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>
17357 </p>
17358 !! end
17359
17360 !! test
17361 Special characters in embedded file links (bug 27679)
17362 !! wikitext
17363 [[File:Contains & ampersand.jpg]]
17364 [[File:Does not exist.jpg|Title with & ampersand]]
17365 !! html
17366 <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>
17367 <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>
17368 </p>
17369 !! end
17370
17371
17372 !! test
17373 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17374 !! wikitext
17375 Text&apos;s been normalized?
17376 !! html
17377 <p>Text&#39;s been normalized?
17378 </p>
17379 !! end
17380
17381 !! test
17382 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17383 !! wikitext
17384 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17385 !! html
17386 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17387 </p>
17388 !! end
17389
17390 !! test
17391 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17392 !! wikitext
17393 [http://www.example.org/ ideograms]
17394 !! html
17395 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17396 </p>
17397 !! end
17398
17399 !! test
17400 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17401 !! wikitext
17402 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17403 !! html
17404 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17405 </p>
17406 !! end
17407
17408 !! article
17409 Mediawiki:loop1
17410 !! text
17411 {{Identical|A}}
17412 !! endarticle
17413
17414 !! article
17415 Mediawiki:loop2
17416 !! text
17417 {{Identical|B}}
17418 !! endarticle
17419
17420 !! article
17421 Template:Identical
17422 !! text
17423 {{int:loop1}}
17424 {{int:loop2}}
17425 !! endarticle
17426
17427 !! test
17428 Bug 31098 Template which includes system messages which includes the template
17429 !! wikitext
17430 {{Identical}}
17431 !! html
17432 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17433 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17434 </p>
17435 !! end
17436
17437 !! test
17438 Bug31490 Turkish: ucfirst 'blah'
17439 !! options
17440 language=tr
17441 !! wikitext
17442 {{ucfirst:blah}}
17443 !! html
17444 <p>Blah
17445 </p>
17446 !! end
17447
17448 !! test
17449 Bug31490 Turkish: ucfirst 'ix'
17450 !! options
17451 language=tr
17452 !! wikitext
17453 {{ucfirst:ix}}
17454 !! html
17455 <p>İx
17456 </p>
17457 !! end
17458
17459 !! test
17460 Bug31490 Turkish: lcfirst 'BLAH'
17461 !! options
17462 language=tr
17463 !! wikitext
17464 {{lcfirst:BLAH}}
17465 !! html
17466 <p>bLAH
17467 </p>
17468 !! end
17469
17470 !! test
17471 Bug31490 Turkish: ucfırst (with a dotless i)
17472 !! options
17473 language=tr
17474 !! wikitext
17475 {{ucfırst:blah}}
17476 !! html
17477 <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>
17478 </p>
17479 !! end
17480
17481 !! test
17482 Bug31490 ucfırst (with a dotless i) with English language
17483 !! options
17484 language=en
17485 !! wikitext
17486 {{ucfırst:blah}}
17487 !! html
17488 <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>
17489 </p>
17490 !! end
17491
17492 !! test
17493 Bug 26375: TOC with italics
17494 !! options
17495 title=[[Main Page]]
17496 !! wikitext
17497 __TOC__
17498 == ''Lost'' episodes ==
17499 !! html
17500 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17501 <ul>
17502 <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>
17503 </ul>
17504 </div>
17505
17506 <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>
17507
17508 !! end
17509
17510 !! test
17511 Bug 26375: TOC with bold
17512 !! options
17513 title=[[Main Page]]
17514 !! wikitext
17515 __TOC__
17516 == '''should be bold''' then normal text ==
17517 !! html
17518 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17519 <ul>
17520 <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>
17521 </ul>
17522 </div>
17523
17524 <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>
17525
17526 !! end
17527
17528 !! test
17529 Bug 33845: Headings become cursive in TOC when they contain an image
17530 !! options
17531 title=[[Main Page]]
17532 !! wikitext
17533 __TOC__
17534 == Image [[Image:foobar.jpg]] ==
17535 !! html
17536 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17537 <ul>
17538 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17539 </ul>
17540 </div>
17541
17542 <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>
17543
17544 !! end
17545
17546 !! test
17547 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17548 !! options
17549 title=[[Main Page]]
17550 !! wikitext
17551 __TOC__
17552 == <blockquote>Quote</blockquote> ==
17553 !! html
17554 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17555 <ul>
17556 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17557 </ul>
17558 </div>
17559
17560 <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>
17561
17562 !! end
17563
17564 !! test
17565 Unclosed tags in TOC
17566 !! options
17567 title=[[Main Page]]
17568 !! wikitext
17569 __TOC__
17570 == Proof: 2 < 3 ==
17571 <small>Hanc marginis exiguitas non caperet.</small>
17572 QED
17573 !! html
17574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17575 <ul>
17576 <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>
17577 </ul>
17578 </div>
17579
17580 <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>
17581 <p><small>Hanc marginis exiguitas non caperet.</small>
17582 QED
17583 </p>
17584 !! end
17585
17586 !! test
17587 Multiple tags in TOC
17588 !! wikitext
17589 __TOC__
17590 == <i>Foo</i> <b>Bar</b> ==
17591
17592 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17593 !! html
17594 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17595 <ul>
17596 <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>
17597 <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>
17598 </ul>
17599 </div>
17600
17601 <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>
17602 <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>
17603
17604 !! end
17605
17606 !! test
17607 Tags with parameters in TOC
17608 !! wikitext
17609 __TOC__
17610 == <sup class="in-h2">Hello</sup> ==
17611
17612 == <sup class="a > b">Evilbye</sup> ==
17613 !! html
17614 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17615 <ul>
17616 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17617 <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>
17618 </ul>
17619 </div>
17620
17621 <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>
17622 <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>
17623
17624 !! end
17625
17626 !! test
17627 span tags with directionality in TOC
17628 !! wikitext
17629 __TOC__
17630 == <span dir="ltr">C++</span> ==
17631
17632 == <span dir="rtl">זבנג!</span> ==
17633
17634 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17635
17636 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17637
17638 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17639 !! html
17640 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17641 <ul>
17642 <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>
17643 <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>
17644 <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>
17645 <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>
17646 <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>
17647 </ul>
17648 </div>
17649
17650 <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>
17651 <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>
17652 <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>
17653 <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>
17654 <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>
17655
17656 !! end
17657
17658 !! article
17659 MediaWiki:Bug32057
17660 !! text
17661 == {{int:headline_sample}} ==
17662 !! endarticle
17663
17664 !! test
17665 Bug 32057: Title needed when expanding <h> nodes.
17666 !! options
17667 title=[[Main Page]]
17668 !! wikitext
17669 {{int:Bug32057}}
17670 !! html
17671 <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>
17672
17673 !! end
17674
17675 !! test
17676 Strip marker in urlencode
17677 !! wikitext
17678 {{urlencode:x<nowiki/>y}}
17679 {{urlencode:x<nowiki/>y|wiki}}
17680 {{urlencode:x<nowiki/>y|path}}
17681 !! html
17682 <p>xy
17683 xy
17684 xy
17685 </p>
17686 !! end
17687
17688 !! test
17689 Strip marker in lc
17690 !! wikitext
17691 {{lc:x<nowiki/>y}}
17692 !! html
17693 <p>xy
17694 </p>
17695 !! end
17696
17697 !! test
17698 Strip marker in uc
17699 !! wikitext
17700 {{uc:x<nowiki/>y}}
17701 !! html
17702 <p>XY
17703 </p>
17704 !! end
17705
17706 !! test
17707 Strip marker in formatNum
17708 !! wikitext
17709 {{formatnum:1<nowiki/>2}}
17710 {{formatnum:1<nowiki/>2|R}}
17711 !! html
17712 <p>12
17713 12
17714 </p>
17715 !! end
17716
17717 !! test
17718 Check noCommafy in formatNum
17719 !! options
17720 language=be-tarask
17721 !! wikitext
17722 {{formatnum:123456.78}}
17723 {{formatnum:123456.78|NOSEP}}
17724 !! html
17725 <p>123 456,78
17726 123456.78
17727 </p>
17728 !! end
17729
17730 !! test
17731 Wrong option for formatNum (bug 56199)
17732 !! wikitext
17733 {{formatnum:1,234.56|Random}}
17734 {{formatnum:1,234.56|EVERYTHING}}
17735 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17736 !! html
17737 <p>1,234.56
17738 1,234.56
17739 1,234.56
17740 </p>
17741 !! end
17742
17743 !! test
17744 Strip marker in grammar
17745 !! options
17746 language=fi
17747 !! wikitext
17748 {{grammar:elative|foo<nowiki/>bar}}
17749 !! html
17750 <p>foobarista
17751 </p>
17752 !! end
17753
17754 !! test
17755 Strip marker in padleft
17756 !! wikitext
17757 {{padleft:|2|x<nowiki/>y}}
17758 !! html
17759 <p>xy
17760 </p>
17761 !! end
17762
17763 !! test
17764 Strip marker in padright
17765 !! wikitext
17766 {{padright:|2|x<nowiki/>y}}
17767 !! html
17768 <p>xy
17769 </p>
17770 !! end
17771
17772 !! test
17773 Strip marker in anchorencode
17774 !! wikitext
17775 {{anchorencode:x<nowiki/>y}}
17776 !! html
17777 <p>xy
17778 </p>
17779 !! end
17780
17781 !! test
17782 nowiki inside link inside heading (bug 18295)
17783 !! wikitext
17784 ==[[foo|x<nowiki>y</nowiki>z]]==
17785 !! html
17786 <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>
17787
17788 !! end
17789
17790 !! test
17791 new support for bdi element (bug 31817)
17792 !! wikitext
17793 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17794 !! html
17795 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17796
17797 !!end
17798
17799 !! test
17800 Ignore pipe between table row attributes
17801 !! wikitext
17802 {|
17803 | quux
17804 |- id=foo | style='color: red'
17805 | bar
17806 |}
17807 !! html
17808 <table>
17809 <tr>
17810 <td> quux
17811 </td></tr>
17812 <tr id="foo" style="color: red">
17813 <td> bar
17814 </td></tr></table>
17815
17816 !! end
17817
17818 !!test
17819 Gallery override link with WikiLink (bug 34852)
17820 !! wikitext
17821 <gallery>
17822 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17823 </gallery>
17824 !! html
17825 <ul class="gallery mw-gallery-traditional">
17826 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17827 <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>
17828 <div class="gallerytext">
17829 <p>caption
17830 </p>
17831 </div>
17832 </div></li>
17833 </ul>
17834
17835 !! end
17836
17837 !!test
17838 Gallery override link with absolute external link (bug 34852)
17839 !! wikitext
17840 <gallery>
17841 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17842 </gallery>
17843 !! html
17844 <ul class="gallery mw-gallery-traditional">
17845 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17846 <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>
17847 <div class="gallerytext">
17848 <p>caption
17849 </p>
17850 </div>
17851 </div></li>
17852 </ul>
17853
17854 !! end
17855
17856 !!test
17857 Gallery override link with malicious javascript (bug 34852)
17858 !! wikitext
17859 <gallery>
17860 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17861 </gallery>
17862 !! html
17863 <ul class="gallery mw-gallery-traditional">
17864 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17865 <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>
17866 <div class="gallerytext">
17867 <p>caption
17868 </p>
17869 </div>
17870 </div></li>
17871 </ul>
17872
17873 !! end
17874
17875 !!test
17876 Gallery with invalid title as link (bug 43964)
17877 !! wikitext
17878 <gallery>
17879 File:foobar.jpg|link=<
17880 </gallery>
17881 !! html
17882 <ul class="gallery mw-gallery-traditional">
17883 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17884 <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>
17885 <div class="gallerytext">
17886 </div>
17887 </div></li>
17888 </ul>
17889
17890 !! end
17891
17892 !!test
17893 Language parser function
17894 !! wikitext
17895 {{#language:ar}}
17896 !! html
17897 <p>العربية
17898 </p>
17899 !! end
17900
17901 !!test
17902 Padleft and padright as substr
17903 !! wikitext
17904 {{padleft:|3|abcde}}
17905 {{padright:|3|abcde}}
17906 !! html
17907 <p>abc
17908 abc
17909 </p>
17910 !! end
17911
17912 !!test
17913 Special parser function
17914 !! wikitext
17915 {{#special:RandomPage}}
17916 {{#special:BaDtItLe}}
17917 {{#special:Foobar}}
17918 !! html
17919 <p>Special:Random
17920 Special:Badtitle
17921 Special:Foobar
17922 </p>
17923 !! end
17924
17925 !!test
17926 Bug 34939 - Case insensitive link parsing ([HttP://])
17927 !! wikitext
17928 [HttP://MediaWiki.Org/]
17929 !! html/php
17930 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17931 </p>
17932 !! html/parsoid
17933 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17934 !! end
17935
17936 !!test
17937 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17938 !! wikitext
17939 [HttP://MediaWiki.Org/ MediaWiki]
17940 !! html
17941 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17942 </p>
17943 !! end
17944
17945 !!test
17946 Bug 34939 - Case insensitive link parsing (HttP://)
17947 !! wikitext
17948 HttP://MediaWiki.Org/
17949 !! html/php
17950 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17951 </p>
17952 !! html/parsoid
17953 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17954 !! end
17955
17956 !!test
17957 Disable TOC
17958 !! options
17959 notoc
17960 !! wikitext
17961 Lead
17962 == Section 1 ==
17963 == Section 2 ==
17964 == Section 3 ==
17965 == Section 4 ==
17966 == Section 5 ==
17967 !! html
17968 <p>Lead
17969 </p>
17970
17971 <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>
17972 <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>
17973 <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>
17974 <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>
17975 <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>
17976
17977 !! end
17978
17979
17980 ###
17981 ### Parsoid-specific tests
17982 ### Parsoid-PHP parser incompatibilities
17983 ###
17984 !!test
17985 1. SOL-sensitive wikitext tokens as template-args
17986 !!options
17987 parsoid=wt2html,wt2wt
17988 !! wikitext
17989 {{echo|*a}}
17990 {{echo|#a}}
17991 {{echo|:a}}
17992 !! html
17993 <span about="#mwt1" typeof="mw:Transclusion">
17994 </span><ul about="#mwt1"><li>a</li>
17995 </ul>
17996 <span about="#mwt2" typeof="mw:Transclusion">
17997 </span><ol about="#mwt2"><li>a</li>
17998 </ol>
17999 <span about="#mwt3" typeof="mw:Transclusion">
18000 </span><dl about="#mwt3"><dd>a</dd>
18001 </dl>
18002 !!end
18003
18004 #### -----------------------------------------------------------------
18005 #### Parsoid-specific functionality tests
18006 #### -----------------------------------------------------------------
18007
18008 # Bug 63642: Formatting elt fixup is cleaned up.
18009 # We know wt2wt will fail, but we expect selser to pass.
18010 # Due to the nature of our testing, wt2wt and selser tests will enter the
18011 # blacklist and we'll catch selser regressions based on changes to the
18012 # blacklist entries for selser tests.
18013 !! test
18014 Bad treebuilder fixup of formatting elt is cleaned up
18015 !! options
18016 parsoid=wt2html,wt2wt
18017 !! wikitext
18018 {|
18019 |
18020 <small>
18021 [[Image:Foobar.jpg|right|Test]]
18022 </small>
18023 |}
18024 !! html/parsoid
18025 <table>
18026 <tbody><tr><td>
18027 <p><small></small></p>
18028 <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>
18029 <p></p></td></tr>
18030 </tbody></table>
18031 !! end
18032
18033 #### ----------------------------------------------------------------
18034 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18035 #### tags. Parsoid's output for these tags differs from that of the
18036 #### PHP parser.
18037 #### ----------------------------------------------------------------
18038
18039 !!test
18040 Ref: 1. ref-location should be replaced with an index span
18041 !!options
18042 parsoid
18043 !! wikitext
18044 A <ref>foo</ref>
18045 B <ref name="x">foo</ref>
18046 C <ref name="y" />
18047 !! html
18048 <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>
18049 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>
18050 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>
18051 !!end
18052
18053 !!test
18054 Ref: 2. ref-tags with identical names should all get the same index
18055 !!options
18056 parsoid
18057 !! wikitext
18058 A <ref name="x">foo</ref>
18059 B <ref name="x" />
18060 !! html
18061 <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>
18062 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>
18063 !!end
18064
18065 !!test
18066 Ref: 3. spaces in ref-names should be ignored
18067 !!options
18068 parsoid
18069 !! wikitext
18070 A <ref name="x">foo</ref>
18071 B <ref name=" x " />
18072 C <ref name= x />
18073 !! html
18074 <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>
18075 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>
18076 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>
18077 !!end
18078
18079 !!test
18080 Ref: 4. 'constructor' should be accepted as a valid ref-name
18081 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18082 !!options
18083 parsoid
18084 !! wikitext
18085 A <ref name="constructor">foo</ref>
18086 !! html
18087 <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>
18088 !!end
18089
18090 !!test
18091 Ref: 5. body should accept generic wikitext
18092 !!options
18093 parsoid
18094 !! wikitext
18095 A <ref>
18096 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18097 </ref>
18098
18099 <references />
18100 !! html
18101 <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>
18102
18103 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18104 <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>
18105 </li>
18106 </ol>
18107 !!end
18108
18109 !!test
18110 Ref: 6. indent-pres should not be output in ref-body
18111 !!options
18112 parsoid
18113 !! wikitext
18114 A <ref>
18115 foo
18116 bar
18117 baz
18118 </ref>
18119
18120 <references />
18121 !! html
18122 <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>
18123
18124 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18125 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18126 bar
18127 baz
18128 </li>
18129 </ol>
18130 !!end
18131
18132 !!test
18133 Ref: 7. No p-wrapping in ref-body
18134 !!options
18135 parsoid
18136 !! wikitext
18137 A <ref>
18138 foo
18139
18140 bar
18141
18142
18143 baz
18144
18145
18146
18147 booz
18148 </ref>
18149
18150 <references />
18151 !! html
18152 <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>
18153
18154 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18155 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18156
18157 bar
18158
18159
18160 baz
18161
18162
18163
18164 booz
18165 </li>
18166 </ol>
18167 !!end
18168
18169 !!test
18170 Ref: 8. transclusion wikitext has lower precedence
18171 !!options
18172 parsoid
18173 !! wikitext
18174 A <ref> foo {{echo|</ref> B C}}
18175
18176 <references />
18177 !! html
18178 <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>
18179 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18180 <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>
18181 </ol>
18182 !!end
18183
18184 !!test
18185 Ref: 9. unclosed comments should not leak out of ref-body
18186 !!options
18187 parsoid
18188 !! wikitext
18189 A <ref> foo <!--</ref> B C
18190 <references />
18191 !! html
18192 <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>
18193 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18194 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18195 </ol>
18196 !!end
18197
18198 !!test
18199 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18200 !!options
18201 parsoid
18202 !! wikitext
18203 A <ref> <b> foo </ref> B C
18204
18205 <references />
18206 !! html
18207 <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>
18208
18209
18210 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18211 <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>
18212 </ol>
18213 !!end
18214
18215 !!test
18216 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18217 !!options
18218 parsoid
18219 !! wikitext
18220 A <ref>foo</ref> B
18221 C <ref>bar</ref> D
18222 !! html
18223 <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
18224 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>
18225 !!end
18226
18227 !!test
18228 Ref: 12. ref-tags act as trailing newline migration barrier
18229 !!options
18230 parsoid
18231 !! wikitext
18232 <!--the newline at the end of this line moves out of the p-tag-->a
18233
18234 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18235 <ref />
18236
18237 c
18238 !! html
18239 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18240
18241
18242 <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>
18243 <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>
18244
18245
18246 <p>c</p>
18247 !!end
18248
18249 !!test
18250 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18251 !!options
18252 parsoid
18253 !! wikitext
18254 <ref>foo</ref> A
18255 <ref>bar
18256 </ref> B
18257 !! html
18258 <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
18259 <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>
18260 !!end
18261
18262 !!test
18263 Ref: 14. A nested ref-tag should be emitted as plain text
18264 !!options
18265 parsoid
18266 !! wikitext
18267 <ref>foo <ref>bar</ref> baz</ref>
18268
18269 <references />
18270 !! html
18271 <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>
18272
18273 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18274 <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>
18275 </ol>
18276 !!end
18277
18278 !!test
18279 Ref: 15. ref-tags with identical names should get identical indexes
18280 !!options
18281 parsoid
18282 !! wikitext
18283 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18284 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18285
18286 <references />
18287 !! html
18288 <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>
18289 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>
18290
18291 <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>
18292 </ol>
18293 !!end
18294
18295 ## We don't bother wt2wt-ing non-standard whitespace
18296 !!test
18297 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18298 !!options
18299 parsoid=wt2html
18300 !! wikitext
18301 A <ref >foo</ref >
18302
18303 <references />
18304 !! html
18305 <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>
18306
18307 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18308 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18309 !!end
18310
18311 !!test
18312 References: 1. references tag without any refs should be handled properly
18313 !!options
18314 parsoid
18315 !! wikitext
18316 <references />
18317 !! html
18318 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18319 !!end
18320
18321 !!test
18322 References: 2. references tag with group only outputs references from that group
18323 !!options
18324 parsoid
18325 !! wikitext
18326 A <ref group="a">foo</ref>
18327 B <ref group="b">bar</ref>
18328
18329 <references group="a" />
18330 !! html
18331 <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>
18332 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>
18333
18334 <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>
18335 </ol>
18336 !!end
18337
18338 !!test
18339 References: 3. ref list should be cleared after processing references
18340 !!options
18341 parsoid
18342 !! wikitext
18343 A <ref>foo</ref>
18344
18345 <references />
18346
18347 B <ref>bar</ref>
18348
18349 <references />
18350 !! html
18351 <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>
18352
18353 <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>
18354 </ol>
18355
18356 <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>
18357
18358 <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>
18359 </ol>
18360 !!end
18361
18362 !!test
18363 References: 4. only referenced group should be cleared after processing references
18364 !!options
18365 parsoid
18366 !! wikitext
18367 A <ref group="a">afoo</ref>
18368 B <ref>bfoo</ref>
18369
18370 <references group="a" />
18371
18372 C <ref>cfoo</ref>
18373
18374 <references />
18375 !! html
18376 <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>
18377 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>
18378
18379 <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>
18380 </ol>
18381
18382 <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>
18383
18384 <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>
18385 </ol>
18386 !!end
18387
18388 !!test
18389 References: 5. ref tags in references should be processed while ignoring all other content
18390 !!options
18391 parsoid
18392 !! wikitext
18393 A <ref name="a" />
18394 B <ref name="b">bar</ref>
18395
18396 <references>
18397 <ref name="a">foo</ref>
18398 This should just get lost.
18399 </references>
18400 !! html
18401 <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>
18402 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>
18403
18404
18405 <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":{}}'>
18406 <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>
18407 <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>
18408 </ol>
18409 !!end
18410
18411 !!test
18412 References: 6. <references /> from a transclusion
18413 !!options
18414 parsoid
18415 !! wikitext
18416 <ref>Foo</ref> {{echo|<references />}}
18417 !! html
18418 <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>
18419 !!end
18420
18421 !! test
18422 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18423 !! options
18424 parsoid
18425 !! wikitext
18426 A <ref>foo bar for a</ref>
18427 B <ref group="X" name="b" />
18428
18429 <references />
18430
18431 <references group="X">
18432 <ref name="b">foo</ref>
18433 </references>
18434 !! html
18435 <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>
18436 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>
18437
18438 <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>
18439
18440 <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>
18441 !! end
18442
18443 !! test
18444 Entities in ref name
18445 !! options
18446 parsoid
18447 !! wikitext
18448 <ref name="test &amp; me">hi</ref>
18449 !! html
18450 <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>
18451 !! end
18452
18453 # This test is wt2html only because we're permitting the serializer to produce
18454 # dirty diffs, normalizing the unclosed references to the self-closed version.
18455 !! test
18456 Generate references for unclosed references tag
18457 !! options
18458 parsoid=wt2html
18459 !! wikitext
18460 a<ref>foo</ref>
18461
18462 <references>
18463 !! html
18464 <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>
18465
18466
18467 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18468 <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>
18469 !! end
18470
18471 !! test
18472 New reference serializes on its own line
18473 !! options
18474 parsoid=wt2wt,html2wt
18475 !! wikitext
18476 foo
18477 <references />
18478 !! html
18479 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18480 !! end
18481
18482 #### ----------------------------------------------------------------
18483 #### The following section of tests are primarily to test
18484 #### wikitext escaping capabilities of Parsoid. Given that
18485 #### escaping can be done any number of ways, the wikitext (input)
18486 #### is always adjusted to reflect how Parsoid adds nowiki
18487 #### escape tags.
18488 ####
18489 #### We are marking several tests as parsoid-only since the
18490 #### HTML in the result section is different from what the
18491 #### PHP parser generates for it.
18492 #### ----------------------------------------------------------------
18493
18494
18495 #### --------------- Headings ---------------
18496 #### 0. Unnested
18497 #### 1. Nested inside html <h1>=foo=</h1>
18498 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18499 #### 3. Nested inside html with wikitext split by html tags
18500 #### 4. No escape needed
18501 #### 5. Empty headings <h1></h1>
18502 #### 6. Heading chars in SOL context
18503 #### ----------------------------------------
18504 !! test
18505 Headings: 0. Unnested
18506 !! options
18507 parsoid
18508 !! wikitext
18509 <nowiki>=foo=</nowiki>
18510
18511 <nowiki> =foo= </nowiki>
18512 <!--cmt-->
18513 <nowiki>=foo=</nowiki>
18514
18515 =foo''a''<nowiki>=</nowiki>
18516 !! html
18517 <p><span typeof="mw:Nowiki">=foo=</span></p>
18518
18519 <p><span typeof="mw:Nowiki"> =foo= </span>
18520 <!--cmt-->
18521 <span typeof="mw:Nowiki">=foo=</span></p>
18522
18523 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18524 !!end
18525
18526 !! test
18527 Headings: 1. Nested inside html
18528 (New headings and existing headings are handled differently)
18529 !! options
18530 parsoid=html2wt
18531 !! wikitext
18532 = =foo= =
18533
18534 == =foo= ==
18535
18536 === =foo= ===
18537
18538 =<nowiki>=foo=</nowiki>=
18539 ==<nowiki>=foo=</nowiki>==
18540 ===<nowiki>=foo=</nowiki>===
18541 ====<nowiki>=foo=</nowiki>====
18542 =====<nowiki>=foo=</nowiki>=====
18543 ======<nowiki>=foo=</nowiki>======
18544
18545 !! html
18546 <h1>=foo=</h1>
18547 <h2>=foo=</h2>
18548 <h3>=foo=</h3>
18549
18550 <h1 data-parsoid='{}'>=foo=</h1>
18551 <h2 data-parsoid='{}'>=foo=</h2>
18552 <h3 data-parsoid='{}'>=foo=</h3>
18553 <h4 data-parsoid='{}'>=foo=</h4>
18554 <h5 data-parsoid='{}'>=foo=</h5>
18555 <h6 data-parsoid='{}'>=foo=</h6>
18556 !!end
18557
18558 !! test
18559 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18560 !! options
18561 parsoid=html2wt
18562 !! wikitext
18563 = foo =
18564 <nowiki>*</nowiki>bar
18565
18566 = foo =
18567 =bar
18568
18569 = foo =
18570 <nowiki>=bar=</nowiki>
18571 !! html
18572 <h1>foo</h1>*bar
18573 <h1>foo</h1>=bar
18574 <h1>foo</h1>=bar=
18575 !!end
18576
18577 !! test
18578 Headings: 3. Nested inside html with wikitext split by html tags
18579 !! options
18580 parsoid=html2wt
18581 !! wikitext
18582 = ='''bold'''<nowiki>foo=</nowiki> =
18583 !! html
18584 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18585 !!end
18586
18587 !! test
18588 Headings: 4a. No escaping needed (testing just h1 and h2)
18589 !! options
18590 parsoid=html2wt
18591 !! wikitext
18592 = =foo =
18593
18594 = foo= =
18595
18596 = =foo= =
18597
18598 = =foo= bar =
18599
18600 == =foo ==
18601
18602 == foo= ==
18603
18604 = ''=''foo= =
18605
18606 = <nowiki>=</nowiki> =
18607 !! html
18608 <h1>=foo</h1>
18609 <h1>foo=</h1>
18610 <h1> =foo= </h1>
18611 <h1>=foo= bar</h1>
18612 <h2>=foo</h2>
18613 <h2>foo=</h2>
18614 <h1><i>=</i>foo=</h1>
18615 <h1><span typeof="mw:Nowiki">=</span></h1>
18616 !!end
18617
18618 !! test
18619 Headings: 4b. No escaping needed (inside p-tags)
18620 !! options
18621 parsoid=html2wt
18622 !! wikitext
18623 ===
18624 =foo= x
18625 =foo= <s></s>
18626 !! html
18627 <p>===
18628 =foo= x
18629 =foo= <s></s>
18630 </p>
18631 !!end
18632
18633 !! test
18634 Headings: 5. Empty headings
18635 !! options
18636 parsoid
18637 !! wikitext
18638 =<nowiki/>=
18639
18640 ==<nowiki/>==
18641
18642 ===<nowiki/>===
18643
18644 ====<nowiki/>====
18645
18646 =====<nowiki/>=====
18647
18648 ======<nowiki/>======
18649 !! html
18650 <h1></h1>
18651 <h2></h2>
18652 <h3></h3>
18653 <h4></h4>
18654 <h5></h5>
18655 <h6></h6>
18656 !!end
18657
18658 !! test
18659 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18660 !! options
18661 parsoid
18662 !! wikitext
18663 <nowiki>=a=</nowiki>
18664
18665 <nowiki>=a=</nowiki>
18666
18667 <nowiki>=a=</nowiki>
18668
18669 <nowiki>=a=</nowiki>
18670 !! html
18671 <p>=a=</p>
18672 <p>=a= </p>
18673 <p>=a= </p>
18674 <p>=a= </p>
18675 !!end
18676
18677 !! test
18678 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18679 !! options
18680 parsoid
18681 !! wikitext
18682 <nowiki>=a=
18683 b</nowiki>
18684
18685 <nowiki>=a=
18686 b</nowiki>
18687
18688 <nowiki>=a=
18689 b</nowiki>
18690
18691 <nowiki>=a=
18692 b</nowiki>
18693 !! html
18694 <p>=a=
18695 b</p>
18696 <p>=a=
18697 b</p>
18698 <p>=a=
18699 b</p>
18700 <p>=a=
18701 b</p>
18702 </p>
18703 !!end
18704
18705 !! test
18706 Headings: 6c. Heading chars in SOL context (leading newline break)
18707 !! options
18708 parsoid
18709 !! wikitext
18710 a
18711 <nowiki>=b=</nowiki>
18712 !! html
18713 <p>a
18714 =b=</p>
18715 !!end
18716
18717 !! test
18718 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18719 !! options
18720 parsoid
18721 !! wikitext
18722 <!--c0--><nowiki>=a=</nowiki>
18723
18724 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18725 !! html
18726 <p><!--c0-->=a=</p>
18727 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18728 !!end
18729
18730 !! test
18731 Headings: 6d. Heading chars in SOL context (No escaping needed)
18732 !! options
18733 parsoid=html2wt
18734 !! wikitext
18735 =a=<div>b</div>
18736 !! html
18737 =a=<div>b</div>
18738 !!end
18739
18740 #### --------------- Lists ---------------
18741 #### 0. Outside nests (*foo, etc.)
18742 #### 1. Nested inside html <ul><li>*foo</li></ul>
18743 #### 2. Inside definition lists
18744 #### 3. Only bullets at start should be escaped
18745 #### 4. No escapes needed
18746 #### 5. No unnecessary escapes
18747 #### 6. Escape bullets in SOL position
18748 #### 7. Escape bullets in a multi-line context
18749 #### ----------------------------------------
18750
18751 !! test
18752 Lists: 0. Outside nests
18753 !! wikitext
18754 <nowiki>*</nowiki>foo
18755
18756 <nowiki>#</nowiki>foo
18757
18758 <nowiki>;Foo:</nowiki>bar
18759 !! html
18760 <p>*foo
18761 </p><p>#foo
18762 </p><p>;Foo:bar
18763 </p>
18764 !!end
18765
18766 !! test
18767 Lists: 1. Nested inside html
18768 !! wikitext
18769 *<nowiki>*foo</nowiki>
18770
18771 *<nowiki>#foo</nowiki>
18772
18773 *<nowiki>:foo</nowiki>
18774
18775 *<nowiki>;foo</nowiki>
18776
18777 #<nowiki>*foo</nowiki>
18778
18779 #<nowiki>#foo</nowiki>
18780
18781 #<nowiki>:foo</nowiki>
18782
18783 #<nowiki>;foo</nowiki>
18784 !! html
18785 <ul><li>*foo</li></ul>
18786 <ul><li>#foo</li></ul>
18787 <ul><li>:foo</li></ul>
18788 <ul><li>;foo</li></ul>
18789 <ol><li>*foo</li></ol>
18790 <ol><li>#foo</li></ol>
18791 <ol><li>:foo</li></ol>
18792 <ol><li>;foo</li></ol>
18793
18794 !!end
18795
18796 !! test
18797 Lists: 2. Inside definition lists
18798 !! wikitext
18799 ;<nowiki>;foo</nowiki>
18800
18801 ;<nowiki>:foo</nowiki>
18802
18803 ;<nowiki>:foo</nowiki>
18804 :bar
18805
18806 :<nowiki>:foo</nowiki>
18807 !! html
18808 <dl><dt>;foo</dt></dl>
18809 <dl><dt>:foo</dt></dl>
18810 <dl><dt>:foo</dt>
18811 <dd>bar</dd></dl>
18812 <dl><dd>:foo</dd></dl>
18813
18814 !!end
18815
18816 !! test
18817 Lists: 3. Only bullets at start of text should be escaped
18818 !! wikitext
18819 *<nowiki>*foo*bar</nowiki>
18820
18821 *<nowiki>*foo</nowiki>''it''*bar
18822 !! html
18823 <ul><li>*foo*bar</li></ul>
18824 <ul><li>*foo<i>it</i>*bar</li></ul>
18825
18826 !!end
18827
18828 !! test
18829 Lists: 4. No escapes needed
18830 !! options
18831 parsoid
18832 !! wikitext
18833 *foo*bar
18834
18835 *''foo''*bar
18836
18837 *[[Foo]]: bar
18838
18839 *[[Foo]]*bar
18840 !! html
18841 <ul>
18842 <li>foo*bar
18843 </li>
18844 </ul>
18845 <ul>
18846 <li><i>foo</i>*bar
18847 </li>
18848 </ul>
18849 <ul>
18850 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18851 </li>
18852 </ul>
18853 <ul>
18854 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18855 </li>
18856 </ul>
18857 !!end
18858
18859 !! test
18860 Lists: 5. No unnecessary escapes
18861 !! wikitext
18862 * bar <span><nowiki>[[foo]]</nowiki></span>
18863
18864 *=bar <span><nowiki>[[foo]]</nowiki></span>
18865
18866 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18867
18868 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18869
18870 *=bar <span>foo]]</span>=
18871
18872 * <s></s>: a
18873 !! html
18874 <ul><li> bar <span>[[foo]]</span></li></ul>
18875 <ul><li>=bar <span>[[foo]]</span></li></ul>
18876 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18877 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18878 <ul><li>=bar <span>foo]]</span>=</li></ul>
18879 <ul><li> <s></s>: a</li></ul>
18880
18881 !!end
18882
18883 !! test
18884 Lists: 6. Escape bullets in SOL position
18885 !! options
18886 parsoid
18887 !! wikitext
18888 <!--cmt--><nowiki>*foo</nowiki>
18889 !! html
18890 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18891 !!end
18892
18893 !! test
18894 Lists: 7. Escape bullets in a multi-line context
18895 !! wikitext
18896 a
18897 <nowiki>*</nowiki>b
18898 !! html
18899 <p>a
18900 *b
18901 </p>
18902 !!end
18903
18904 #### --------------- HRs ---------------
18905 #### 1. Single line
18906 #### -----------------------------------
18907
18908 !! test
18909 HRs: 1. Single line
18910 !! options
18911 parsoid
18912 !! wikitext
18913 ----<nowiki>----</nowiki>
18914 ----=foo=
18915 ----*foo
18916 !! html
18917 <hr><span typeof="mw:Nowiki">----</span>
18918 <hr>=foo=
18919 <hr>*foo
18920 !! end
18921
18922 #### --------------- Tables ---------------
18923 #### 1a. Simple example
18924 #### 1b. No escaping needed (!foo)
18925 #### 1c. No escaping needed (|foo)
18926 #### 1d. No escaping needed (|}foo)
18927 ####
18928 #### 2a. Nested in td (<td>foo|bar</td>)
18929 #### 2b. Nested in td (<td>foo||bar</td>)
18930 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18931 ####
18932 #### 3a. Nested in th (<th>foo!bar</th>)
18933 #### 3b. Nested in th (<th>foo!!bar</th>)
18934 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18935 ####
18936 #### 4a. Escape -
18937 #### 4b. Escape +
18938 #### 4c. No escaping needed
18939 #### --------------------------------------
18940
18941 !! test
18942 Tables: 1a. Simple example
18943 !! wikitext
18944 <nowiki>{|
18945 |}</nowiki>
18946 !! html
18947 <p>{|
18948 |}
18949 </p>
18950 !! end
18951
18952 !! test
18953 Tables: 1b. No escaping needed
18954 !! wikitext
18955 !foo
18956 !! html
18957 <p>!foo
18958 </p>
18959 !! end
18960
18961 !! test
18962 Tables: 1c. No escaping needed
18963 !! wikitext
18964 |foo
18965 !! html
18966 <p>|foo
18967 </p>
18968 !! end
18969
18970 !! test
18971 Tables: 1d. No escaping needed
18972 !! wikitext
18973 |}foo
18974 !! html
18975 <p>|}foo
18976 </p>
18977 !! end
18978
18979 !! test
18980 Tables: 2a. Nested in td
18981 !! options
18982 parsoid=html2wt
18983 !! wikitext
18984 {|
18985 |<nowiki>foo|bar</nowiki>
18986 |-
18987 |x<div><nowiki>a|b</nowiki></div>
18988 |}
18989 !! html
18990 <table><tbody><tr>
18991 <td>foo|bar</td></tr>
18992 <tr><td>x<div>a|b</div></td>
18993 </tbody></table>
18994 !! end
18995
18996 !! test
18997 Tables: 2b. Nested in td
18998 !! options
18999 parsoid
19000 !! wikitext
19001 {|
19002 |<nowiki>foo||bar</nowiki>
19003 |''it''<nowiki>foo||bar</nowiki>
19004 |}
19005 !! html
19006 <table><tbody><tr>
19007 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19008 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19009 !! end
19010
19011 !! test
19012 Tables: 2c. Nested in td -- no escaping needed
19013 !! options
19014 parsoid
19015 !! wikitext
19016 {|
19017 |foo!!bar
19018 |}
19019 !! html
19020 <table><tbody><tr><td>foo!!bar
19021 </td></tr></tbody></table>
19022
19023 !! end
19024
19025 !! test
19026 Tables: 3a. Nested in th
19027 !! options
19028 parsoid
19029 !! wikitext
19030 {|
19031 !foo!bar
19032 |}
19033 !! html
19034 <table><tbody><tr><th>foo!bar
19035 </th></tr></tbody></table>
19036
19037 !! end
19038
19039 !! test
19040 Tables: 3b. Nested in th
19041 !! options
19042 parsoid
19043 !! wikitext
19044 {|
19045 !<nowiki>foo!!bar</nowiki>
19046 |}
19047 !! html
19048 <table>
19049 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19050 </tbody></table>
19051 !! end
19052
19053 !! test
19054 Tables: 3c. Nested in th -- no escaping needed
19055 !! options
19056 parsoid
19057 !! wikitext
19058 {|
19059 !<nowiki>foo||bar</nowiki>
19060 |}
19061 !! html
19062 <table><tbody><tr>
19063 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19064 !! end
19065
19066 !! test
19067 Tables: 4a. Escape -
19068 !! options
19069 parsoid
19070 !! wikitext
19071 {|
19072 !-bar
19073 |-
19074 |<nowiki>-bar</nowiki>
19075 |}
19076 !! html
19077 <table><tbody>
19078 <tr><th>-bar</th></tr>
19079 <tr>
19080 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19081 !! end
19082
19083 !! test
19084 Tables: 4b. Escape +
19085 !! options
19086 parsoid
19087 !! wikitext
19088 {|
19089 !+bar
19090 |-
19091 |<nowiki>+bar</nowiki>
19092 |}
19093 !! html
19094 <table><tbody>
19095 <tr><th>+bar</th></tr>
19096 <tr>
19097 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19098 !! end
19099
19100 !! test
19101 Tables: 4c. No escaping needed
19102 !! options
19103 parsoid
19104 !! wikitext
19105 {|
19106 |foo-bar
19107 |foo+bar
19108 |-
19109 |''foo''-bar
19110 |''foo''+bar
19111 |-
19112 |foo
19113 bar|baz
19114 +bar
19115 -bar
19116 |-
19117 |x
19118 <div>a|b</div>
19119 |}
19120 !! html
19121 <table><tbody>
19122 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19123 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19124 <tr><td>foo
19125 <p>bar|baz
19126 +bar
19127 -bar</p></td></tr>
19128 <tr><td>x
19129 <div>a|b</div></td>
19130 </tbody></table>
19131 !! end
19132
19133 !! test
19134 Tables: 4d. No escaping needed
19135 !! options
19136 parsoid
19137 !! wikitext
19138 {|
19139 |[[Foo]]-bar
19140 ||+1
19141 ||-2
19142 |}
19143 !! html
19144 <table>
19145 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19146 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19147 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19148 </tbody></table>
19149 !! end
19150
19151 !! test
19152 Tables: Digest broken attributes on table and tr tag
19153 !! options
19154 parsoid=wt2html
19155 !! wikitext
19156 {| || |} ++
19157 |- || || ++ --
19158 |- > [
19159 |}
19160 !! html
19161 <table>
19162 <tbody>
19163 <tr></tr>
19164 <tr></tr>
19165 </tbody></table>
19166 !! end
19167
19168 #### --------------- Links ----------------
19169 #### 1. Quote marks in link text
19170 #### 2. Wikilinks: Escapes needed
19171 #### 3. Wikilinks: No escapes needed
19172 #### 4. Extlinks: Escapes needed
19173 #### 5. Extlinks: No escapes needed
19174 #### --------------------------------------
19175 !! test
19176 Links 1. Quote marks in link text
19177 !! options
19178 parsoid
19179 !! wikitext
19180 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19181 !! html
19182 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19183 !! end
19184
19185 !! test
19186 Links 2. WikiLinks: Escapes needed
19187 !! options
19188 parsoid
19189 !! wikitext
19190 [[Foo|[Foobar]]]
19191 [[Foo|<nowiki>Foobar]</nowiki>]]
19192 [[Foo|x [Foobar] x]]
19193 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19194 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19195 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19196 [[Foo|<nowiki>|Bar</nowiki>]]
19197 [[Foo|<nowiki>]]bar</nowiki>]]
19198 [[Foo|<nowiki>[[bar</nowiki>]]
19199 [[Foo|<nowiki>x [[ y</nowiki>]]
19200 [[Foo|<nowiki>x ]] y</nowiki>]]
19201 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19202 !! html
19203 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19204 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19205 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19206 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19207 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19208 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19209 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19210 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19211 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19212 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19213 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19214 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19215 !! end
19216
19217 !! test
19218 Links 3. WikiLinks: No escapes needed
19219 !! options
19220 parsoid
19221 !! wikitext
19222 [[Foo|[Foobar]]
19223 [[Foo|foo|bar]]
19224 !! html
19225 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19226 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19227 !! end
19228
19229 !! test
19230 Links 4. ExtLinks: Escapes needed
19231 !! options
19232 parsoid
19233 !! wikitext
19234 [http://google.com <nowiki>[google]</nowiki>]
19235 [http://google.com <nowiki>google]</nowiki>]
19236
19237 <nowiki>[http://google.com]</nowiki>
19238
19239 <nowiki>[http://google.com google]</nowiki>
19240
19241 !! html
19242 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19243 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19244 <p>[http://google.com]</p>
19245 <p>[http://google.com google]</p>
19246 !! end
19247
19248 !! test
19249 Links 5. ExtLinks: No escapes needed
19250 !! options
19251 parsoid
19252 !! wikitext
19253 [http://google.com [google]
19254 !! html
19255 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19256 !! end
19257
19258 !! test
19259 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19260 !! html/parsoid
19261 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19262 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19263 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19264 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19265 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19266 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19267 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19268 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19269 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19270 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19271 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
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(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19274 </p>
19275 !! wikitext
19276 x<nowiki/>http://example.com<nowiki/>y
19277 http://example.com<nowiki/>?x
19278 http://example.com<nowiki/>&x
19279 http://example.com<nowiki/>'x
19280 http://example.com<nowiki/>,x
19281 http://example.com<nowiki/>.x
19282 http://example.com<nowiki/>;x
19283 http://example.com<nowiki/>:x
19284 http://example.com<nowiki/>;x
19285 http://example.com<nowiki/>!x
19286 http://example.com<nowiki/>=x
19287 http://example.com<nowiki/>(x)
19288 http://example.com(x<nowiki/>)
19289 !! end
19290
19291 !! test
19292 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19293 !! html/parsoid
19294 <p>x
19295 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19296 y
19297 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19298 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19299 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19300 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19301 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19302 </p>
19303 !! wikitext
19304 x
19305 http://example.com
19306 y
19307 "http://example.com"
19308 (http://example.com)
19309 (http://example.com) foo
19310 http://example.com,
19311 http://example.com, foo
19312 !! end
19313
19314 ## Parsoid currently fails wt2html on this one!
19315 !! test
19316 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19317 !! html/parsoid
19318 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19319 !! wikitext
19320 http://example.com.,;:!?
19321 !! end
19322
19323 !! test
19324 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19325 !! html/parsoid
19326 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19327 !! wikitext
19328 RFC 123<nowiki/>4
19329 !! end
19330
19331 !! test
19332 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19333 !! html/parsoid
19334 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19335 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19336 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19337 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19338 </p>
19339 !! wikitext
19340 xRFC 123y
19341 XRFC 123y
19342 RFC 123?foo
19343 RFC 123&foo
19344 !! end
19345
19346 !! test
19347 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19348 !! html/parsoid
19349 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19350 !! wikitext
19351 PMID 123<nowiki/>4
19352 !! end
19353
19354 !! test
19355 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19356 !! html/parsoid
19357 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19358 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19359 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19360 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19361 </p>
19362 !! wikitext
19363 xPMID 123y
19364 XPMID 123y
19365 PMID 123?foo
19366 PMID 123&foo
19367 !! end
19368
19369 !! test
19370 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19371 !! html/parsoid
19372 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19373 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19374 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19375 </p>
19376 !! wikitext
19377 ISBN 1234567890<nowiki/>1
19378 ISBN 1234567890<nowiki/>x
19379 ISBN 1234567890<nowiki/>b
19380 !! end
19381
19382 !! test
19383 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19384 !! html/parsoid
19385 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19386 !! wikitext
19387 ISBN 1234567890's
19388 !! end
19389
19390 #### --------------- Quotes ---------------
19391 #### 1. Quotes inside <b> and <i>
19392 #### 2. Link fragments separated by <i> and <b> tags
19393 #### 3. Link fragments inside <i> and <b>
19394 #### 4. No escaping needed
19395 #### --------------------------------------
19396 !! test
19397 1. Quotes inside <b> and <i>
19398 !! options
19399 parsoid=html2wt,wt2wt
19400 !! wikitext
19401 ''<nowiki>'foo'</nowiki>''
19402 ''<nowiki>''foo''</nowiki>''
19403 ''<nowiki>'''foo'''</nowiki>''
19404 ''foo''<nowiki/>'s
19405 '''<nowiki>'foo'</nowiki>'''
19406 '''<nowiki>''foo''</nowiki>'''
19407 '''<nowiki>'''foo'''</nowiki>'''
19408 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19409 '''foo'''<nowiki/>'s
19410 '''foo''
19411 ''foo''<nowiki/>'
19412 '<nowiki/>''foo''<nowiki/>'
19413 ''''foo'''
19414 '''foo'''<nowiki/>'
19415 '<nowiki/>'''foo'''<nowiki/>'
19416 ''fools'<span> errand</span>''
19417 ''<span>fool</span>'s errand''
19418 !! html
19419 <p><i>'foo'</i>
19420 <i>''foo''</i>
19421 <i>'''foo'''</i>
19422 <i>foo</i>'s
19423 <b>'foo'</b>
19424 <b>''foo''</b>
19425 <b>'''foo'''</b>
19426 <b>foo'<i>bar'</i>baz</b>
19427 <b>foo</b>'s
19428 '<i>foo</i>
19429 <i>foo</i>'
19430 '<i>foo</i>'
19431 '<b>foo</b>
19432 <b>foo</b>'
19433 '<b>foo</b>'</p>
19434 <i>fools'<span> errand</span></i>
19435 <i><span>fool</span>'s errand</i>
19436 !! end
19437
19438 !! test
19439 2. Link fragments separated by <i> and <b> tags
19440 !! wikitext
19441 [[''foo''<nowiki>hello]]</nowiki>
19442
19443 [['''foo'''<nowiki>hello]]</nowiki>
19444 !! html
19445 <p>[[<i>foo</i>hello]]
19446 </p><p>[[<b>foo</b>hello]]
19447 </p>
19448 !! end
19449
19450 !! test
19451 3. Link fragments inside <i> and <b>
19452 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19453 this is one of the shortcomings of this format)
19454 !! wikitext
19455 ''[[foo''<nowiki>]]</nowiki>
19456
19457 '''[[foo'''<nowiki>]]</nowiki>
19458 !! html
19459 <p><i>[[foo</i>]]
19460 </p><p><b>[[foo</b>]]
19461 </p>
19462 !! end
19463
19464 !! test
19465 4. No escaping needed
19466 !! wikitext
19467 '<span>''bar''</span>'
19468 '<span>'''bar'''</span>'
19469 !! html
19470 <p>'<span><i>bar</i></span>'
19471 '<span><b>bar</b></span>'
19472 </p>
19473 !! end
19474
19475 #### ----------- Paragraphs ---------------
19476 #### 1. No unnecessary escapes
19477 #### --------------------------------------
19478
19479 !! test
19480 1. No unnecessary escapes
19481 !! wikitext
19482 bar <span><nowiki>[[foo]]</nowiki></span>
19483
19484 =bar <span><nowiki>[[foo]]</nowiki></span>
19485
19486 [[bar <span><nowiki>[[foo]]</nowiki></span>
19487
19488 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19489
19490 =bar <span>foo]]</span><nowiki>=</nowiki>
19491 !! html
19492 <p>bar <span>[[foo]]</span>
19493 </p><p>=bar <span>[[foo]]</span>
19494 </p><p>[[bar <span>[[foo]]</span>
19495 </p><p>]]bar <span>[[foo]]</span>
19496 </p><p>=bar <span>foo]]</span>=
19497 </p>
19498 !!end
19499
19500 #### ----------------------- PRE --------------------------
19501 #### 1. Leading whitespace in SOL context should be escaped
19502 #### ------------------------------------------------------
19503 !! test
19504 1. Leading whitespace in SOL context should be escaped
19505 !! options
19506 parsoid
19507 !! wikitext
19508 <nowiki> </nowiki>a
19509
19510 <nowiki> </nowiki> a
19511
19512 <nowiki> </nowiki>a(tab)
19513
19514 <nowiki> </nowiki> a
19515 <!--cmt-->
19516 <nowiki> </nowiki> a
19517
19518 a
19519 <nowiki> </nowiki>b
19520
19521 a
19522 <nowiki> </nowiki>b
19523
19524 a
19525 <nowiki> </nowiki> b
19526 !! html
19527 <p> a</p>
19528 <p> a</p>
19529 <p> a(tab)</p>
19530 <p> a</p>
19531 <p><!--cmt--> a</p>
19532 <p>a
19533 b</p>
19534 <p>a
19535 b</p>
19536 <p>a
19537 b</p>
19538 !! end
19539
19540 !! test
19541 2. Leading whitespace in non-indent-pre contexts should not be escaped
19542 !! options
19543 parsoid
19544 !! wikitext
19545 foo <ref>''a''
19546 b</ref>
19547 !! html
19548 <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>
19549 !! end
19550
19551 !! test
19552 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19553 !! options
19554 parsoid
19555 !! wikitext
19556 <blockquote>
19557 a
19558 <span>b</span>
19559 c
19560 </blockquote>
19561 !! html
19562 <blockquote>
19563 <p>
19564 a
19565 <span>b</span>
19566 c</p>
19567 </blockquote>
19568 !! end
19569
19570 !! test
19571 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19572 !! options
19573 parsoid
19574 !! wikitext
19575 [[File:Foobar.jpg|thumb|caption]]
19576 !! html
19577 !! html/parsoid
19578 <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>
19579 !! end
19580
19581 #### --------------- Behavior Switches --------------------
19582 !! test
19583 1. Valid behavior switches should be escaped
19584 !! options
19585 parsoid=html2wt
19586 !! wikitext
19587 <nowiki>__TOC__</nowiki>
19588 ''<nowiki>__TOC__</nowiki>''
19589 !! html
19590 __TOC__
19591 <i>__TOC__</i>
19592 !! end
19593
19594 !! test
19595 2. Invalid behavior switches should not be escaped
19596 !! options
19597 parsoid=html2wt
19598 !! wikitext
19599 __TOO__
19600 __|__
19601 !! html
19602 __TOO__
19603 __|__
19604 !! end
19605
19606 #### --------------- HTML tags ---------------
19607 #### 1. a tags
19608 #### 2. other tags
19609 #### 3. multi-line html tag
19610 #### 4. extension tags
19611 #### -----------------------------------------
19612 !! test
19613 1. a tags
19614 !! options
19615 parsoid
19616 !! wikitext
19617 <a href="http://google.com">google</a>
19618 !! html
19619 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19620 !! end
19621
19622 !! test
19623 2. other tags
19624 !! wikitext
19625 <nowiki><div>foo</div>
19626 <div style="color:red">foo</div></nowiki>
19627 !! html
19628 <p>&lt;div&gt;foo&lt;/div&gt;
19629 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19630 </p>
19631 !! end
19632
19633 !! test
19634 3. multi-line html tag
19635 !! wikitext
19636 <nowiki><div
19637 >foo</div
19638 ></nowiki>
19639 !! html
19640 <p>&lt;div
19641 &gt;foo&lt;/div
19642 &gt;
19643 </p>
19644 !! end
19645
19646 !! test
19647 4. extension tags
19648 !! wikitext
19649 <nowiki><ref>foo</ref></nowiki>
19650
19651 <nowiki><ref>bar</nowiki>
19652
19653 baz<nowiki></ref></nowiki>
19654 !! html
19655 <p>&lt;ref&gt;foo&lt;/ref&gt;
19656 </p><p>&lt;ref&gt;bar
19657 </p><p>baz&lt;/ref&gt;
19658 </p>
19659 !! end
19660
19661 #### --------------- Others ---------------
19662 !! test
19663 Escaping nowikis
19664 !! wikitext
19665 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19666 !! html
19667 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19668 </p>
19669 !! end
19670
19671 ## The quote-char in the input is necessary for triggering the bug
19672 !! test
19673 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19674 !! options
19675 parsoid=wt2wt,html2wt
19676 !! wikitext
19677 foo's bar :
19678 !! html
19679 <p>foo's bar :</p>
19680 !! end
19681
19682 !! test
19683
19684 Tag-like HTML structures are passed through as text
19685 !! wikitext
19686 <x y>
19687
19688 <x.y>
19689
19690 <x-y>
19691
19692 1>2
19693
19694 x<y
19695
19696 a>b
19697
19698 1<d e>f
19699 !! html
19700 <p>&lt;x y&gt;
19701 </p><p>&lt;x.y&gt;
19702 </p><p>&lt;x-y&gt;
19703 </p><p>1&gt;2
19704 </p><p>x&lt;y
19705 </p><p>a&gt;b
19706 </p><p>1&lt;d e&gt;f
19707 </p>
19708 !! end
19709
19710
19711 # This was a bug in the PHP parser (see bug 17663 and its dups,
19712 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19713 !! test
19714 Tag names followed by punctuation should not be recognized as tags
19715 !! wikitext
19716 <s.ome> text
19717 !! html
19718 <p>&lt;s.ome&gt; text
19719 </p>
19720 !! end
19721
19722 !! test
19723 HTML tag with necessary entities in attributes
19724 !! wikitext
19725 <span title="&amp;amp;">foo</span>
19726 !! html
19727 <p><span title="&amp;amp;">foo</span>
19728 </p>
19729 !! end
19730
19731 !! test
19732 HTML tag with 'unnecessary' entity encoding in attributes
19733 !! wikitext
19734 <span title="&amp;">foo</span>
19735 !! html
19736 <p><span title="&amp;">foo</span>
19737 </p>
19738 !! end
19739
19740 !! test
19741 HTML tag with broken attribute value quoting
19742 !! wikitext
19743 <span title="Hello world>Foo</span>
19744 !! html
19745 <p><span>Foo</span>
19746 </p>
19747 !! end
19748
19749 !! test
19750 Parsoid-only: HTML tag with broken attribute value quoting
19751 !! options
19752 parsoid
19753 !! wikitext
19754 <span title="Hello world>Foo</span>
19755 !! html
19756 <p><span title="Hello world">Foo</span>
19757 </p>
19758 !! end
19759
19760 !! test
19761 Table with broken attribute value quoting
19762 !! wikitext
19763 {|
19764 | title="Hello world|Foo
19765 |}
19766 !! html
19767 <table>
19768 <tr>
19769 <td>Foo
19770 </td></tr></table>
19771
19772 !! end
19773
19774 !! test
19775 Table with broken attribute value quoting on consecutive lines
19776 !! wikitext
19777 {|
19778 | title="Hello world|Foo
19779 | style="color:red|Bar
19780 |}
19781 !! html
19782 <table>
19783 <tr>
19784 <td>Foo
19785 </td>
19786 <td>Bar
19787 </td></tr></table>
19788
19789 !! end
19790
19791 !! test
19792 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19793 !! options
19794 parsoid
19795 !! wikitext
19796 {|
19797 | title="Hello world|Foo
19798 | style="color:red|Bar
19799 |}
19800 !! html
19801 <table><tbody>
19802 <tr>
19803 <td title="Hello world">Foo
19804 </td><td style="color: red">Bar
19805 </td></tr></tbody></table>
19806
19807 !! end
19808
19809 !! test
19810 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19811 !! options
19812 parsoid
19813 !! wikitext
19814 {{}}
19815 !! html
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 Accept empty td cell attribute
19831 !! wikitext
19832 {|
19833 | align="center" | foo || |
19834 |}
19835 !! html
19836 <table>
19837 <tr>
19838 <td align="center"> foo </td>
19839 <td>
19840 </td></tr></table>
19841
19842 !!end
19843
19844 !!test
19845 Non-empty attributes in th-cells
19846 !! wikitext
19847 {|
19848 ! Foo !! style="color: red" | Bar
19849 |}
19850 !! html
19851 <table>
19852 <tr>
19853 <th> Foo </th>
19854 <th style="color: red"> Bar
19855 </th></tr></table>
19856
19857 !!end
19858
19859 !!test
19860 Accept empty attributes in th-cells
19861 !! wikitext
19862 {|
19863 !| foo !!| bar
19864 |}
19865 !! html
19866 <table>
19867 <tr>
19868 <th> foo </th>
19869 <th> bar
19870 </th></tr></table>
19871
19872 !!end
19873
19874 !!test
19875 Empty table rows go away
19876 !! wikitext
19877 {|
19878 | Hello
19879 | there
19880 |- class="foo"
19881 |-
19882 |}
19883 !! html
19884 <table>
19885 <tr>
19886 <td> Hello
19887 </td>
19888 <td> there
19889 </td></tr>
19890
19891 </table>
19892
19893 !! end
19894
19895 ###
19896 ### Parsoid-centric tests for testing RTing of inter-element separators
19897 ### Edge cases not tested by existing parser tests and specific to
19898 ### Parsoid-specific serialization strategies.
19899 ###
19900
19901 !!test
19902 RT-ed inter-element separators should be valid separators
19903 !! wikitext
19904 {|
19905 |- [[foo]]
19906 |}
19907 !! html
19908 <table>
19909
19910 </table>
19911
19912 !!end
19913
19914 !!test
19915 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19916 (Parsoid-only since PHP parser relies on Tidy for correct output)
19917 !!options
19918 parsoid
19919 !! wikitext
19920 {|
19921 |<small>foo
19922 bar
19923 |}
19924
19925 {|
19926 |<small>foo<small>
19927 |}
19928 !! html
19929 !!end
19930
19931 !!test
19932 Empty TD followed by TD with tpl-generated attribute
19933 !! wikitext
19934 {|
19935 |-
19936 |
19937 |{{echo|style='color:red'}}|foo
19938 |}
19939 !! html
19940 <table>
19941
19942 <tr>
19943 <td>
19944 </td>
19945 <td>foo
19946 </td></tr></table>
19947
19948 !!end
19949
19950 !!test
19951 Indented table with an empty td
19952 !! wikitext
19953 {|
19954 |-
19955 |
19956 |foo
19957 |}
19958 !! html
19959 <table>
19960
19961 <tr>
19962 <td>
19963 </td>
19964 <td>foo
19965 </td></tr></table>
19966
19967 !!end
19968
19969 !!test
19970 Indented block & table
19971 !! wikitext
19972 <div>foo</div>
19973 {|
19974 |foo
19975 |}
19976 !! html/parsoid
19977 <div data-parsoid='{"stx":"html"}'>foo</div>
19978 <table><tbody>
19979 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19980 </tbody></table>
19981 !!end
19982
19983 !! test
19984 Indent and comment before table row
19985 !! wikitext
19986 {|
19987 <!--hi-->|-
19988 | there
19989 |}
19990 !! html/parsoid
19991 <table data-parsoid='{}'>
19992 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
19993 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
19994 </tbody></table>
19995 !! end
19996
19997 !!test
19998 Empty TR followed by a template-generated TR
19999 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20000 !!options
20001 parsoid
20002 !! wikitext
20003 {|
20004 |-
20005 {{echo|<tr><td>foo</td></tr>}}
20006 |}
20007 !! html
20008 <table>
20009 <tbody>
20010 <tr></tr>
20011 <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}}]}'>
20012 <td>foo</td></tr>
20013 </tbody></table>
20014 !!end
20015
20016 ## PHP and parsoid output differ for this, and since this is primarily
20017 ## for testing Parsoid's serializer, marking this Parsoid only
20018 !!test
20019 Empty TR followed by mixed-ws-comment line should RT correctly
20020 !!options
20021 parsoid
20022 !! wikitext
20023 {|
20024 |-
20025 <!--c-->
20026 |-
20027 <!--c--> <!--d-->
20028 |}
20029 !! html
20030 <table>
20031 <tbody>
20032 <tr></tr>
20033 <!--c-->
20034 <tr>
20035 <!--c--> </tr><!--d-->
20036 </tbody></table>
20037
20038 !!end
20039
20040 !!test
20041 Multi-line image caption generated by templates with/without trailing newlines
20042 !!options
20043 parsoid
20044 !! wikitext
20045 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20046 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20047 !! html
20048 <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>
20049 <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>
20050
20051 !!end
20052
20053 !! test
20054 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20055 !! options
20056 parsoid=html2wt
20057 !! wikitext
20058 <includeonly>foo</includeonly>
20059 new para
20060
20061 [[./Category:Foo]]
20062
20063 = new heading =
20064 !! html
20065 <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>
20066
20067 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20068 !! end
20069
20070 ## PHP emits broken html for this, and since this is primarily
20071 ## a Parsoid serializer test, marking this Parsoid only
20072 !!test
20073 Improperly nested inline or quotes tags with whitespace in between
20074 !!options
20075 parsoid
20076 !! wikitext
20077 <span> <s>x</span> </s>
20078 ''' ''x''' ''
20079 !! html
20080 <p><span> <s>x</s></span><s> </s>
20081 <b> <i>x</i></b><i> </i>
20082 </p>
20083 !!end
20084
20085 !!test
20086 Encapsulate protected attributes from wt
20087 !!options
20088 parsoid
20089 !! wikitext
20090 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20091 !! html
20092 <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>
20093 </body>
20094 !!end
20095
20096 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20097 ## Having nested or stray pre tags results in the attempt to add duplicates,
20098 ## causing an assertion fail. This test tries to prevent that situation.
20099 !!test
20100 Ensure ParagraphWrapper can deal with stray closing pre tags
20101 !!options
20102 parsoid=wt2html
20103 !! wikitext
20104 plain text</pre>
20105 !! html
20106 plain text
20107 !!end
20108
20109 !!test
20110 1. Ensure fostered text content is wrapped in spans
20111 !!options
20112 parsoid=wt2html
20113 !! wikitext
20114 <table>hi</table><table>ho</table>
20115 !! html
20116 <span>hi</span>
20117 <table></table>
20118 <span>ho</span>
20119 <table></table>
20120 !!end
20121
20122 !!test
20123 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20124 !!options
20125 parsoid=wt2html,wt2wt
20126 !! wikitext
20127 <table>
20128 <tr> || ||
20129 <td> a
20130 </table>
20131 !! html
20132 <span> || ||</span>
20133 <table>
20134 <tbody>
20135 <tr>
20136 <td> a</td></tr>
20137 </tbody></table>
20138 !!end
20139
20140 !!test
20141 Encapsulation properly handles null DSR information from foster box
20142 !!options
20143 parsoid=wt2html,wt2wt
20144 !! wikitext
20145 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20146 !! html
20147 <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;
20148 <table>foo
20149 <tr>
20150 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20151 <table>
20152 <tbody>
20153 <tr>
20154 <td>bar</td></tr></tbody></table>
20155 !!end
20156
20157 !!test
20158 1. Encapsulate foster-parented transclusion content
20159 !!options
20160 parsoid=wt2wt,wt2html
20161 !! wikitext
20162 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20163 !! html
20164 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20165 <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
20166 <tr>
20167 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20168 <table>
20169 <tbody>
20170 <tr>
20171 <td>bar</td></tr></tbody></table>
20172 !!end
20173
20174 !!test
20175 2. Encapsulate foster-parented transclusion content
20176 !!options
20177 parsoid=wt2wt,wt2html
20178 !! wikitext
20179 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20180 !! html
20181 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20182 <table>
20183 <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>
20184 <tr>
20185 <td>bar</td></tr></table>&quot;]}">foo</div>
20186 <table>
20187 <tbody>
20188 <tr>
20189 <td>bar</td></tr></tbody></table>
20190 !!end
20191
20192 !!test
20193 3. Encapsulate foster-parented transclusion content
20194 !!options
20195 parsoid=wt2wt,wt2html
20196 !! wikitext
20197 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20198 !! html
20199 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20200 <table>
20201 <div>
20202 <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>
20203 <tr>
20204 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20205 <p>foo</p></div>
20206 <table>
20207 <tbody>
20208 <tr>
20209 <td>bar</td></tr></tbody></table>
20210 !!end
20211
20212 !!test
20213 4. Encapsulate foster-parented transclusion content
20214 !!options
20215 parsoid=wt2wt,wt2html
20216 !! wikitext
20217 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20218 !! html
20219 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20220 <table>
20221 <div>
20222 <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>
20223 <tr>
20224 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20225 <p>foo</p></div>
20226 <table>
20227 <tbody>
20228 <tr>
20229 <td>bar</td></tr></tbody></table>
20230 !!end
20231
20232 !!test
20233 5. Encapsulate foster-parented transclusion content
20234 !!options
20235 parsoid=wt2wt,wt2html
20236 !! wikitext
20237 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20238 !! html
20239 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20240 <table>
20241 <tr>
20242 <td>
20243 <div>
20244 <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>
20245 <table>
20246 <tbody>
20247 <tr>
20248 <td>
20249 <div>
20250 <p>foo</p></div></td></tr></tbody></table>
20251 !!end
20252
20253 !!test
20254 6. Encapsulate foster-parented transclusion content
20255 !!options
20256 parsoid=wt2wt,wt2html
20257 !! wikitext
20258 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20259 !! html
20260 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20261 <table>
20262 <tr>
20263 <td>
20264 <div>
20265 <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>
20266 <table>
20267 <tbody>
20268 <tr>
20269 <td>
20270 <div>
20271 <p>foo</p></div></td></tr></tbody></table>
20272 <p>ok</p>
20273 !!end
20274
20275 !!test
20276 7. Encapsulate foster-parented transclusion content
20277 !!options
20278 parsoid=wt2wt,wt2html
20279 !! wikitext
20280 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20281 !! html
20282 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20283 <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;
20284 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20285 <td>bar</td></table>&quot;]}">foo</p>
20286 <table>
20287 <tbody>
20288 <tr>
20289 <td>bar</td></tr></tbody></table>
20290 !!end
20291
20292 !!test
20293 8. Encapsulate foster-parented transclusion content
20294 !!options
20295 parsoid=wt2wt,wt2html
20296 !! wikitext
20297 {{echo|a
20298 }}{|{{echo|style='color:red'}}
20299 |-
20300 |b
20301 |}
20302 !! html
20303 <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>
20304 <table>
20305 <tbody>
20306 <tr>
20307 <td>b</td></tr></tbody></table>
20308 !!end
20309
20310 !!test
20311 9. Encapsulate foster-parented transclusion content
20312 !!options
20313 parsoid=wt2wt,wt2html
20314 !! wikitext
20315 <table>{{echo|hi</table>hello}}
20316 !! html
20317 <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>
20318 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20319 !!end
20320
20321 !!test
20322 Table in fosterable position
20323 !!options
20324 parsoid=wt2html,wt2wt
20325 !! wikitext
20326 {{OpenTable}}
20327 <div>
20328 {|
20329 |}
20330 </div>
20331 |}
20332 !! html
20333 <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="{}">
20334 </span>
20335 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20336
20337 <table>
20338 </table>
20339 !!end
20340
20341 # Parsoid only for bug 64747
20342 !! test
20343 Properly encapsulate empty-content transclusions in fosterable positions
20344 !! wikitext
20345 <table>
20346 {{#if:|
20347 <td>foo</td>
20348 }}
20349 </table>
20350 !! html/parsoid
20351 <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>"}'>
20352
20353 </table>
20354 !! end
20355
20356 !!test
20357 Support <object> element with .data attribute
20358 !!options
20359 parsoid=html2wt
20360 !! wikitext
20361 <object data="test.swf"></object>
20362 !! html
20363 <object data="test.swf"></object>
20364 !!end
20365
20366 # -----------------------------------------------------------------
20367 # The following section of tests are primarily to spec requirements
20368 # around serialization of new/edited content.
20369 #
20370 # All these tests are marked Parsoid html2wt and html2html only
20371 # ----------------------------------------------------------------
20372
20373 !! test
20374 Image: Modifying size of an image (1)
20375 !! options
20376 parsoid={
20377 "modes": ["wt2wt"],
20378 "changes": [
20379 ["img[height]", "attr", "height", "22"],
20380 ["img[width]", "attr", "width", "200"]
20381 ]
20382 }
20383 !! wikitext
20384 [[Image:Foobar.jpg|230x230px]]
20385 !! wikitext/edited
20386 [[Image:Foobar.jpg|200x200px]]
20387 !!end
20388
20389 !! test
20390 Image: Modifying size of an image (2)
20391 !! options
20392 parsoid={
20393 "modes": ["wt2wt"],
20394 "changes": [
20395 ["img[height]", "attr", "height", "100"],
20396 ["img[width]", "attr", "width", "500"]
20397 ]
20398 }
20399 !! wikitext
20400 [[Image:Foobar.jpg|230x230px]]
20401 !! wikitext/edited
20402 [[Image:Foobar.jpg|500x500px]]
20403 !!end
20404
20405 # Change in size is ignored so long as class='mw-default-size'
20406 !! test
20407 Image: Modifying size of an image (3)
20408 !! options
20409 parsoid={
20410 "modes": ["wt2wt"],
20411 "changes": [
20412 ["figure[class]", "removeClass", "mw-default-size"],
20413 ["figure img", "attr", "height", "19"],
20414 ["figure img", "attr", "width", "170"]
20415 ]
20416 }
20417 !! wikitext
20418 [[Image:Foobar.jpg|thumb]]
20419 !! wikitext/edited
20420 [[Image:Foobar.jpg|thumb|170x170px]]
20421 !!end
20422
20423 !! test
20424 Image: Modifying alignment of an image (bug 48665)
20425 !! options
20426 parsoid={
20427 "modes": ["wt2wt"],
20428 "changes": [
20429 ["figure[class]", "removeClass", "mw-halign-right"],
20430 ["figure[class]", "addClass", "mw-halign-left"]
20431 ]
20432 }
20433 !! wikitext
20434 [[Image:Foobar.jpg|thumb|caption|right]]
20435 !! wikitext/edited
20436 [[Image:Foobar.jpg|thumb|caption|left]]
20437 !! end
20438
20439 !! test
20440 Image: Modifying mw-default-size of an frameless image (bug 62805)
20441 !! options
20442 parsoid={
20443 "modes": ["wt2wt"],
20444 "changes": [
20445 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20446 ]
20447 }
20448 !! wikitext
20449 [[Image:Foobar.jpg|frameless|right]]
20450 !! wikitext/edited
20451 [[Image:Foobar.jpg|frameless|right|220x220px]]
20452 !! end
20453
20454 !! test
20455 Image: Modifying valign of an image (bug 49221)
20456 !! options
20457 parsoid={
20458 "modes": ["wt2wt"],
20459 "changes": [
20460 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20461 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20462 ]
20463 }
20464 !! wikitext
20465 [[File:Foobar.jpg|20px|middle]]
20466 !! wikitext/edited
20467 [[File:Foobar.jpg|20px|text-top]]
20468 !! end
20469
20470 !! test
20471 Image: Modifying alt attribute of an image (bug 56400)
20472 !! options
20473 parsoid={
20474 "modes": ["wt2wt"],
20475 "changes": [
20476 ["img[alt]", "attr", "alt", "some alternate edited text"]
20477 ]
20478 }
20479 !! wikitext
20480 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20481 !! wikitext/edited
20482 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20483 !!end
20484
20485 !! test
20486 Image: Modifying caption of an image
20487 !! options
20488 parsoid={
20489 "modes": ["wt2wt"],
20490 "changes": [
20491 ["figcaption", "text", "new caption"]
20492 ]
20493 }
20494 !! wikitext
20495 [[Image:Foobar.jpg|thumb|original caption]]
20496 !! wikitext/edited
20497 [[Image:Foobar.jpg|thumb|new caption]]
20498 !!end
20499
20500 !! test
20501 Image: empty alt attribute (bug 48924)
20502 !! options
20503 parsoid
20504 !! wikitext
20505 [[File:Foobar.jpg|thumb|alt=|bar]]
20506 !! html
20507 <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>
20508 !! end
20509
20510 #!! test
20511 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20512 #!! options
20513 #parsoid=html2wt
20514 #language=ar
20515 #!! input
20516 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20517 #!! result
20518 #<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>
20519 #!! end
20520
20521 !! test
20522 Image: Block level image should have \n before and after
20523 !! options
20524 parsoid
20525 !! wikitext
20526 123
20527 [[File:Foobar.jpg|right|thumb|150x150px]]
20528 456
20529 !! html
20530 <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>
20531 !!end
20532
20533 !! test
20534 Image: New block level image should have \n before and after (existing
20535 content)
20536 !! options
20537 parsoid
20538 !! wikitext
20539 123
20540 [[File:Foobar.jpg|right|thumb|150x150px]]
20541 456
20542 !! html
20543 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20544 <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>
20545 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20546 !!end
20547
20548 !! test
20549 Image: upright option (parsoid)
20550 !! options
20551 parsoid
20552 !! wikitext
20553 [[File:Foobar.jpg|thumb|upright|caption]]
20554 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20555 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20556 !! html
20557 <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>
20558 !!end
20559
20560 !! test
20561 Image: upright option is ignored on inline and frame images (parsoid)
20562 !! options
20563 parsoid
20564 !! wikitext
20565 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20566 !! html
20567 <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>
20568 !!end
20569
20570 !! test
20571 Image: from basic HTML (1)
20572 !! options
20573 parsoid=html2wt
20574 !! html/parsoid
20575 <span typeof="mw:Image">
20576 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20577 </span>
20578 !! wikitext
20579 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20580 !! end
20581
20582 !! test
20583 Image: from basic HTML (2)
20584 !! options
20585 parsoid=html2wt
20586 !! html/parsoid
20587 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20588 !! wikitext
20589 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20590 !! end
20591
20592 !! test
20593 Image: from basic HTML (3)
20594 !! options
20595 parsoid=html2wt
20596 !! html/parsoid
20597 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20598 !! wikitext
20599 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20600 !! end
20601
20602 !! test
20603 Image: from basic HTML (4)
20604 !! options
20605 parsoid=html2wt
20606 !! html/parsoid
20607 <img src="File:Foobar.jpg">
20608 !! wikitext
20609 [[File:Foobar.jpg|link=]]
20610 !! end
20611
20612 !! test
20613 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20614 !! options
20615 parsoid=html2wt
20616 !! wikitext
20617 * foo
20618 !! html
20619 <ul>
20620 <li><p>foo</p></li>
20621 </ul>
20622 !! end
20623
20624 !! test
20625 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20626 !! options
20627 parsoid=html2wt
20628 !! wikitext
20629 * foo
20630 !! html
20631 <ul> <li>foo</li></ul>
20632 !! end
20633
20634 !! test
20635 Don't strip leading whitespace when handling indent-pre suppressing tags
20636 !! options
20637 parsoid=html2wt
20638 !! wikitext
20639 {|
20640 | indented row
20641 |}
20642 <blockquote>
20643 '''This is very bold of you!'''
20644
20645 {|
20646 |
20647 indented cell (no pre-wrapping!)
20648 |}
20649 </blockquote>
20650 foo
20651 <div>bar</div>
20652 !! html
20653 <table>
20654 <tr><td> indented row</td></tr>
20655 </table>
20656 <blockquote><p>
20657 <b>This is very bold of you!</b>
20658 </p>
20659 <table><tr><td>
20660 indented cell (no pre-wrapping!)
20661 </td></tr></table>
20662 </blockquote>
20663 <p>foo</p>
20664 <div>bar</div>
20665 !! end
20666
20667 !! test
20668 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20669 !! options
20670 parsoid=html2wt
20671 !! wikitext
20672 foo
20673 <nowiki> </nowiki><span>bar</span>
20674
20675 <span>foo2
20676 <nowiki> </nowiki></span>bar2
20677
20678 <div>foo</div>
20679 <nowiki> </nowiki><span>bar</span>
20680
20681 <div>
20682 <nowiki> </nowiki><span>foo</span>
20683 </div>
20684 !! html
20685 <p>foo</p>
20686 <span>bar</span>
20687
20688 <span>foo2
20689 </span>bar2
20690
20691 <div>foo</div>
20692 <span>bar</span>
20693
20694 <div>
20695 <span>foo</span>
20696 </div>
20697 !! end
20698
20699 !! test
20700 Lists: Add space after bullets
20701 !! options
20702 parsoid=html2wt
20703 !! wikitext
20704 * foo
20705 * bar
20706 * <span> baz</span>
20707 !! html
20708 <ul>
20709 <li>foo</li>
20710 <li> bar</li>
20711 <li><span> baz</span></li>
20712 </ul>
20713 !! end
20714
20715 !! test
20716 Lists: Dont insert newlines in a serialized list item.
20717 !! options
20718 parsoid=html2wt
20719 !! wikitext
20720 * a<br>b
20721 * c
20722 !! html
20723 <ul><li>a<br>b</li><li>c</li></ul>
20724 !! end
20725
20726 !! test
20727 Headings: Add space before/after == (Bug 51744)
20728 !! options
20729 parsoid=html2wt
20730 !! wikitext
20731 == foo ==
20732
20733 == bar ==
20734
20735 == baz ==
20736
20737 == <span> baz</span> ==
20738 !! html
20739 <h2>foo</h2>
20740 <h2> bar</h2>
20741 <h2>baz </h2>
20742 <h2><span> baz</span></h2>
20743 !! end
20744
20745 !! test
20746 Parsoid: Serialize positional parameters with = in them as named parameter
20747 !! options
20748 parsoid=html2wt
20749 !! wikitext
20750 {{echo|1 = f=oo}}
20751
20752 {{echo|1 = f=oo|2 = bar}}
20753
20754 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20755 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20756 {{echo|<nowiki>f=oo</nowiki>|bar}}
20757 !! html
20758 <p about="#mwt1" typeof="mw:Transclusion"
20759 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20760
20761 <p about="#mwt1" typeof="mw:Transclusion"
20762 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
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 <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>
20767 !! end
20768
20769 !! test
20770 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20771 !! options
20772 parsoid=html2wt
20773 !! wikitext
20774 <div>a
20775 b
20776 </div>
20777 <div>a
20778 b
20779 </div>
20780 <div>
20781 a
20782
20783 b
20784 </div>
20785 !! html
20786 <div>a<p>b</p></div>
20787 <div>a
20788 <p>b</p></div>
20789 <div>
20790 a
20791 <p>b</p></div>
20792 !! end
20793
20794 !! test
20795 Substrings resembling wikitext in hrefs should not get nowiki escapes
20796 !! options
20797 parsoid=html2wt
20798 !! wikitext
20799 [[Foo''bar''baz]]
20800 !! html
20801 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20802 !! end
20803
20804 #-----------------------------
20805 # I/B quote minimization tests
20806 #-----------------------------
20807
20808 !! test
20809 1. I/B quote minimization: wikitext-only tags should be combined
20810 !! options
20811 parsoid=html2wt
20812 !! wikitext
20813 ''AB''
20814
20815 '''AB'''
20816
20817 ''A'''B'''''
20818
20819 '''A''B'''''
20820
20821 '''A''BC''D'''
20822
20823 '''''AB'''''
20824
20825 '''''AB'''''
20826
20827 '''''AB'''''
20828 !! html
20829 <p><i>A</i><i>B</i></p>
20830 <p><b>A</b><b>B</b></p>
20831 <p><i>A</i><b><i>B</i></b></p>
20832 <p><b>A</b><i><b>B</b></i></p>
20833 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20834 <p><i><b>A</b></i><i><b>B</b></i></p>
20835 <p><i><b>A</b></i><b><i>B</i></b></p>
20836 <p><b><i>A</i></b><i><b>B</b></i></p>
20837 !! end
20838
20839 !! test
20840 2. I/B quote minimization: wikitext and html tags should not be combined
20841 !! options
20842 parsoid=html2wt
20843 !! wikitext
20844 ''A''<i>B</i>
20845
20846 ''A'''''<i>B</i>'''
20847 !! html
20848 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20849 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20850 !! end
20851
20852 !! test
20853 3. I/B quote minimization: templated content stops minimization
20854 !! options
20855 parsoid=html2wt
20856 !! wikitext
20857 ''A''{{echo|''B''}}
20858
20859 ''A''{{echo|'''''B'''''}}
20860 !! html
20861 <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>
20862 <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>
20863 !! end
20864
20865 !! test
20866 4. I/B quote minimization: new content should be mimimized with adjacent old content
20867 !! options
20868 parsoid=html2wt
20869 !! wikitext
20870 ''AB''
20871
20872 '''AB'''
20873
20874 ''A'''B'''''
20875 !! html
20876 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20877 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20878 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20879 !! end
20880
20881 #------------------------------------
20882 # End of I/B quote minimization tests
20883 #------------------------------------
20884
20885 !!test
20886 Bug 54262: New entities
20887 !! options
20888 parsoid=html2wt
20889 !! wikitext
20890 &nbsp;
20891 !! html
20892 <span typeof="mw:Entity">&nbsp;</span>
20893 !! end
20894
20895 ## Note that there is no wikitext output for 'unknownproperty' ##
20896 ## Unknown magic words are silently dropped ##
20897
20898 !! test
20899 Magic words
20900 !! options
20901 parsoid=html2wt
20902 !! wikitext
20903 __TOC__
20904 __NOTOC__
20905 __FORCETOC__
20906 __INDEX__
20907 __NOINDEX__
20908 __NOGALLERY__
20909 __NOEDITSECTION__
20910 __NOTITLECONVERT__
20911 __NOCONTENTCONVERT__
20912 !! html
20913 <meta property='mw:PageProp/toc' />
20914 <meta property='mw:PageProp/notoc' />
20915 <meta property='mw:PageProp/forcetoc' />
20916 <meta property='mw:PageProp/index' />
20917 <meta property='mw:PageProp/noindex' />
20918 <meta property='mw:PageProp/nogallery' />
20919 <meta property='mw:PageProp/noeditsection' />
20920 <meta property='mw:PageProp/notitleconvert' />
20921 <meta property='mw:PageProp/nocontentconvert' />
20922 <meta property='mw:PageProp/unknownproperty' />
20923 !! end
20924
20925 !! test
20926 Consecutive <pre>s should not get merged
20927 !! options
20928 parsoid=html2wt,html2html
20929 !! wikitext
20930 a
20931
20932 b
20933
20934 c
20935
20936 d
20937
20938 e
20939
20940
20941
20942 f
20943 !! html
20944 <pre>a</pre><pre>b</pre>
20945
20946 <pre>c
20947 </pre><pre>
20948 d</pre>
20949
20950 <pre>e
20951
20952 </pre><pre>
20953
20954 f</pre>
20955 !! end
20956
20957 !! test
20958 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20959 !! options
20960 parsoid=html2wt
20961 !! wikitext
20962 [[Special:BookSources/1234567890|ISBN 1234567895]]
20963 !! html
20964 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20965 !! end
20966
20967 !! test
20968 Edited RFC links not serializable as RFC links should serialize as extlinks
20969 !! options
20970 parsoid=html2wt
20971 !! wikitext
20972 [//tools.ietf.org/html/rfc123 New RFC]
20973 !! html
20974 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20975 !! end
20976
20977 !! test
20978 Edited PMID links not serializable as PMID links should serialize as extlinks
20979 !! options
20980 parsoid=html2wt
20981 !! wikitext
20982 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20983 !! html
20984 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20985 !! end
20986
20987 !! test
20988 Edited Redirect link should emit a non-piped wikitext link
20989 !! options
20990 parsoid=html2wt
20991 !! wikitext
20992 #REDIRECT [[Bar]]
20993 !! html
20994 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20995 !! end
20996
20997 # -----------------------------------------------------------------
20998 # End of section for Parsoid-only html2wt tests for serialization
20999 # of new content
21000 # -----------------------------------------------------------------
21001
21002 TODO:
21003 more images
21004 more tables
21005 character entities
21006 and much more
21007 Try for 100% code coverage