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 !! test
1097 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1098 !! wikitext
1099 <b→> doesn't work! </b→>
1100
1101 <bä> doesn't work! </bä>
1102
1103 <boo> works fine </boo>
1104
1105 <s.foo>s.foo</s.foo>
1106
1107 <sub-ID#1>
1108 !! html
1109 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1110 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1111 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1112 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1113 </p><p>&lt;sub-ID#1&gt;
1114 </p>
1115 !! end
1116
1117 !! test
1118 Isolated close tags should be treated as literal text (bug 52760)
1119 !! wikitext
1120 </b>
1121
1122 <s.foo>s</s>
1123 !! html
1124 <p>&lt;/b&gt;
1125 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1126 </p>
1127 !! end
1128
1129 ###
1130 ### Special characters
1131 ###
1132
1133 !! test
1134 Bare pipe character (bug 52363)
1135 !! wikitext
1136 |
1137 !! html
1138 <p>|
1139 </p>
1140 !! end
1141
1142 !! test
1143 Bare pipe character from a template (bug 52363)
1144 !! wikitext
1145 {{pipe}}
1146 !! html
1147 <p>|
1148 </p>
1149 !! end
1150
1151 ###
1152 ### <nowiki> test cases
1153 ###
1154
1155 !! test
1156 <nowiki> unordered list
1157 !! wikitext
1158 <nowiki>* This is not an unordered list item.</nowiki>
1159 !! html
1160 <p>* This is not an unordered list item.
1161 </p>
1162 !! end
1163
1164 !! test
1165 <nowiki> spacing
1166 !! wikitext
1167 <nowiki>Lorem ipsum dolor
1168
1169 sed abit.
1170 sed nullum.
1171
1172 :and a colon
1173 </nowiki>
1174 !! html
1175 <p>Lorem ipsum dolor
1176
1177 sed abit.
1178 sed nullum.
1179
1180 :and a colon
1181
1182 </p>
1183 !! end
1184
1185 !! test
1186 nowiki 3
1187 !! wikitext
1188 :There is not nowiki.
1189 :There is <nowiki>nowiki</nowiki>.
1190
1191 #There is not nowiki.
1192 #There is <nowiki>nowiki</nowiki>.
1193
1194 *There is not nowiki.
1195 *There is <nowiki>nowiki</nowiki>.
1196 !! html
1197 <dl><dd>There is not nowiki.</dd>
1198 <dd>There is nowiki.</dd></dl>
1199 <ol><li>There is not nowiki.</li>
1200 <li>There is nowiki.</li></ol>
1201 <ul><li>There is not nowiki.</li>
1202 <li>There is nowiki.</li></ul>
1203
1204 !! end
1205
1206 !! test
1207 Entities inside <nowiki>
1208 !! wikitext
1209 <nowiki>&lt;</nowiki>
1210 !! html
1211 <p>&lt;
1212 </p>
1213 !! end
1214
1215 !! test
1216 Entities inside template parameters
1217 !! options
1218 parsoid
1219 !! wikitext
1220 {{echo|&ndash;}}
1221 !! html
1222 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span>
1223 </p>
1224 !! end
1225
1226 ###
1227 ### Comments
1228 ###
1229 !! test
1230 Comments and Indent-Pre
1231 !! wikitext
1232 <!-- comment 1 --> asdf
1233
1234 <!-- comment 1 --> asdf
1235 <!-- comment 2 -->
1236
1237 <!-- comment 1 --> asdf
1238 <!-- comment 2 -->xyz
1239
1240 <!-- comment 1 --> asdf
1241 <!-- comment 2 --> xyz
1242 !! html
1243 <pre>asdf
1244 </pre>
1245 <pre>asdf
1246 </pre>
1247 <pre>asdf
1248 </pre>
1249 <p>xyz
1250 </p>
1251 <pre>asdf
1252 xyz
1253 </pre>
1254 !! end
1255
1256 !! test
1257 Comment test 2a
1258 !! wikitext
1259 asdf
1260 <!-- comment 1 -->
1261 jkl
1262 !! html
1263 <p>asdf
1264 jkl
1265 </p>
1266 !! end
1267
1268 !! test
1269 Comment test 2b
1270 !! wikitext
1271 asdf
1272 <!-- comment 1 -->
1273
1274 jkl
1275 !! html
1276 <p>asdf
1277 </p><p>jkl
1278 </p>
1279 !! end
1280
1281 !! test
1282 Comment test 3
1283 !! wikitext
1284 asdf
1285 <!-- comment 1 -->
1286 <!-- comment 2 -->
1287 jkl
1288 !! html
1289 <p>asdf
1290 jkl
1291 </p>
1292 !! end
1293
1294 !! test
1295 Comment test 4
1296 !! wikitext
1297 asdf<!-- comment 1 -->jkl
1298 !! html
1299 <p>asdfjkl
1300 </p>
1301 !! end
1302
1303 !! test
1304 Comment spacing
1305 !! wikitext
1306 a
1307 <!-- foo --> b <!-- bar -->
1308 c
1309 !! html
1310 <p>a
1311 </p>
1312 <pre> b
1313 </pre>
1314 <p>c
1315 </p>
1316 !! end
1317
1318 !! test
1319 Comment whitespace
1320 !! wikitext
1321 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1322 !! html
1323
1324 !! end
1325
1326 !! test
1327 Comment semantics and delimiters
1328 !! wikitext
1329 <!-- --><!----><!-----><!------>
1330 !! html
1331
1332 !! end
1333
1334 !! test
1335 Comment semantics and delimiters, redux
1336 !! wikitext
1337 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1338 -- foo -- funky huh? ... -->
1339 !! html
1340
1341 !! end
1342
1343 !! test
1344 Comment semantics and delimiters: directors cut
1345 !! wikitext
1346 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1347 everything starting with < followed by !-- until the first -- and > we see,
1348 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1349 -->-->
1350 !! html
1351 <p>--&gt;
1352 </p>
1353 !! end
1354
1355 !! test
1356 Comment semantics: nesting
1357 !! wikitext
1358 <!--<!-- no, we're not going to do anything fancy here -->-->
1359 !! html
1360 <p>--&gt;
1361 </p>
1362 !! end
1363
1364 !! test
1365 Comment semantics: unclosed comment at end
1366 !! wikitext
1367 <!--This comment will run out to the end of the document
1368 !! html
1369
1370 !! end
1371
1372 !! test
1373 Comment in template title
1374 !! wikitext
1375 {{f<!---->oo}}
1376 !! html
1377 <p>FOO
1378 </p>
1379 !! end
1380
1381 !! test
1382 Comment on its own line post-expand
1383 !! wikitext
1384 a
1385 {{blank}}<!---->
1386 b
1387 !! html
1388 <p>a
1389 </p><p>b
1390 </p>
1391 !! end
1392
1393 !! test
1394 Comment on its own line post-expand with non-significant whitespace
1395 !! wikitext
1396 a
1397 {{blank}} <!---->
1398 b
1399 !! html
1400 <p>a
1401 </p><p>b
1402 </p>
1403 !! end
1404
1405 !! test
1406 Multiple comments should still parse as SOL-transparent
1407 !! options
1408 parsoid=wt2html,wt2wt
1409 !! wikitext
1410 <!--c1-->*a
1411 <!--c2--><!--c3--><!--c4-->*b
1412 !! html
1413 <ul>
1414 <li>a
1415 </li>
1416 <li>b
1417 </li>
1418 </ul>
1419 !! end
1420
1421 ###
1422 ### paragraph wrapping tests
1423 ###
1424 !! test
1425 No block tags
1426 !! wikitext
1427 a
1428
1429 b
1430 !! html
1431 <p>a
1432 </p><p>b
1433 </p>
1434 !! end
1435
1436 !! test
1437 Block tag on one line (<div>)
1438 !! wikitext
1439 a <div>foo</div>
1440
1441 b
1442 !! html
1443 a <div>foo</div>
1444 <p>b
1445 </p>
1446 !! end
1447
1448 !! test
1449 Block tag on one line (<blockquote>)
1450 !! wikitext
1451 a <blockquote>foo</blockquote>
1452
1453 b
1454 !! html
1455 a <blockquote>foo</blockquote>
1456 <p>b
1457 </p>
1458 !! end
1459
1460 !! test
1461 Block tag on both lines (<div>)
1462 !! wikitext
1463 a <div>foo</div>
1464
1465 b <div>foo</div>
1466 !! html
1467 a <div>foo</div>
1468 b <div>foo</div>
1469
1470 !! end
1471
1472 !! test
1473 Block tag on both lines (<blockquote>)
1474 !! wikitext
1475 a <blockquote>foo</blockquote>
1476
1477 b <blockquote>foo</blockquote>
1478 !! html
1479 a <blockquote>foo</blockquote>
1480 b <blockquote>foo</blockquote>
1481
1482 !! end
1483
1484 !! test
1485 Multiple lines without block tags
1486 !! wikitext
1487 <div>foo</div> a
1488 b
1489 c
1490 d<!--foo--> e
1491 x <div>foo</div> z
1492 !! html
1493 <div>foo</div> a
1494 <p>b
1495 c
1496 d e
1497 </p>
1498 x <div>foo</div> z
1499
1500 !! end
1501
1502 !! test
1503 Empty lines between lines with block tags
1504 !! wikitext
1505 <div></div>
1506
1507
1508 <div></div>a
1509
1510 b
1511 <div>a</div>b
1512
1513 <div>b</div>d
1514
1515
1516 <div>e</div>
1517 !! html
1518 <div></div>
1519 <p><br />
1520 </p>
1521 <div></div>a
1522 <p>b
1523 </p>
1524 <div>a</div>b
1525 <div>b</div>d
1526 <p><br />
1527 </p>
1528 <div>e</div>
1529
1530 !! end
1531
1532 ## PHP parser emits output which is broken
1533 !! test
1534 Unclosed HTML p-tags should be handled properly
1535 !! wikitext
1536 <div><p>foo</div>
1537 a
1538
1539 b
1540 !! html/parsoid
1541 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1542 <p>a</p>
1543 <p>b</p>
1544 !! end
1545
1546 ###
1547 ### Preformatted text
1548 ###
1549 !! test
1550 Preformatted text
1551 !! wikitext
1552 This is some
1553 Preformatted text
1554 With ''italic''
1555 And '''bold'''
1556 And a [[Main Page|link]]
1557 !! html
1558 <pre>This is some
1559 Preformatted text
1560 With <i>italic</i>
1561 And <b>bold</b>
1562 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1563 </pre>
1564 !! end
1565
1566 !! test
1567 Tabs don't trigger preformatted text
1568 !! wikitext
1569 This is not
1570 preformatted text.
1571 This is preformatted text.
1572 So is this.
1573 !! html
1574 <p> This is not
1575 preformatted text.
1576 </p>
1577 <pre>This is preformatted text.
1578 So is this.
1579 </pre>
1580 !! end
1581
1582 !! test
1583 Ident preformatting with inline content
1584 !! wikitext
1585 a
1586 ''b''
1587 !! html
1588 <pre>a
1589 <i>b</i>
1590 </pre>
1591 !! end
1592
1593 !! test
1594 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1595 !! wikitext
1596 <pre><nowiki>
1597 <b>
1598 <cite>
1599 <em>
1600 </nowiki></pre>
1601 !! html
1602 <pre>
1603 &lt;b&gt;
1604 &lt;cite&gt;
1605 &lt;em&gt;
1606 </pre>
1607
1608 !! end
1609
1610 !! test
1611 Regression with preformatted in <center>
1612 !! wikitext
1613 <center>
1614 Blah
1615 </center>
1616 !! html
1617 <center>
1618 <pre>Blah
1619 </pre>
1620 </center>
1621
1622 !! end
1623
1624 !! test
1625 Bug 52763: Preformatted in <blockquote>
1626 !! wikitext
1627 <blockquote>
1628 Blah
1629 {|
1630 |
1631 indented cell (no pre-wrapping!)
1632 |}
1633 </blockquote>
1634 !! html
1635 <blockquote>
1636 <p> Blah
1637 </p>
1638 <table>
1639 <tr>
1640 <td>
1641 <p> indented cell (no pre-wrapping!)
1642 </p>
1643 </td></tr></table>
1644 </blockquote>
1645
1646 !! end
1647
1648 !! test
1649 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1650 !! wikitext
1651 <blockquote>
1652 Foo
1653
1654 Bar
1655 </blockquote>
1656 !! html
1657 <blockquote>
1658 <p>Foo
1659 </p><p>Bar
1660 </p>
1661 </blockquote>
1662
1663 !! end
1664
1665 !! test
1666 Bug 15491: <ins>/<del> in blockquote
1667 !! wikitext
1668 <blockquote>
1669 Foo <del>bar</del> <ins>baz</ins> quux
1670 </blockquote>
1671 !! html
1672 <blockquote>
1673 <p>Foo <del>bar</del> <ins>baz</ins> quux
1674 </p>
1675 </blockquote>
1676
1677 !! end
1678
1679 # Note that the p-wrapping is newline sensitive, which could be
1680 # considered a bug: tidy will wrap only the 'Foo' in the example
1681 # below in a <p> tag. (see comment 23-25 of bug #6200)
1682 !! test
1683 Bug 15491: <ins>/<del> in blockquote (2)
1684 !! wikitext
1685 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1686 </blockquote>
1687 !! html
1688 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1689 </blockquote>
1690
1691 !! end
1692
1693 !! test
1694 <pre> with attributes (bug 3202)
1695 !! wikitext
1696 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1697 !! html
1698 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1699
1700 !! end
1701
1702 !! test
1703 <pre> with width attribute (bug 3202)
1704 !! wikitext
1705 <pre width="8">Narrow screen goodies</pre>
1706 !! html
1707 <pre width="8">Narrow screen goodies</pre>
1708
1709 !! end
1710
1711 !! test
1712 <pre> with forbidden attribute (bug 3202)
1713 !! wikitext
1714 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1715 !! html
1716 <pre width="8">Narrow screen goodies</pre>
1717
1718 !! end
1719
1720 !! test
1721 Entities inside <pre>
1722 !! wikitext
1723 <pre>&lt;</pre>
1724 !! html
1725 <pre>&lt;</pre>
1726
1727 !! end
1728
1729 !! test
1730 <pre> with forbidden attribute values (bug 3202)
1731 !! wikitext
1732 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1733 !! html
1734 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1735
1736 !! end
1737
1738 !! test
1739 <nowiki> inside <pre> (bug 13238)
1740 !! wikitext
1741 <pre>
1742 <nowiki>
1743 </pre>
1744 <pre>
1745 <nowiki></nowiki>
1746 </pre>
1747 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1748 !! html
1749 <pre>
1750 &lt;nowiki&gt;
1751 </pre>
1752 <pre>
1753
1754 </pre>
1755 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1756
1757 !! end
1758
1759 !! test
1760 <nowiki> and <pre> preference (first one wins)
1761 !! wikitext
1762 <pre>
1763 <nowiki>
1764 </pre>
1765 </nowiki>
1766 </pre>
1767
1768 <nowiki>
1769 <pre>
1770 <nowiki>
1771 </pre>
1772 </nowiki>
1773 </pre>
1774
1775 !! html
1776 <pre>
1777 &lt;nowiki&gt;
1778 </pre>
1779 <p>&lt;/nowiki&gt;
1780 &lt;/pre&gt;
1781 </p><p>
1782 &lt;pre&gt;
1783 &lt;nowiki&gt;
1784 &lt;/pre&gt;
1785
1786 &lt;/pre&gt;
1787 </p>
1788 !! end
1789
1790 !! test
1791 </pre> inside nowiki
1792 !! wikitext
1793 <nowiki></pre></nowiki>
1794 !! html
1795 <p>&lt;/pre&gt;
1796 </p>
1797 !! end
1798
1799 !! test
1800 Empty pre; pre inside other HTML tags (bug 54946)
1801 !! wikitext
1802 a
1803
1804 <div><pre>
1805 foo
1806 </pre></div>
1807 <pre></pre>
1808 !! html
1809 <p>a
1810 </p>
1811 <div><pre>
1812 foo
1813 </pre></div>
1814 <pre></pre>
1815
1816 !! end
1817
1818 !! test
1819 HTML pre followed by indent-pre
1820 !! wikitext
1821 <pre>foo</pre>
1822 bar
1823 !! html
1824 <pre>foo</pre>
1825 <pre>bar
1826 </pre>
1827 !! end
1828
1829 !!test
1830 Block tag pre
1831 !!options
1832 parsoid
1833 !! wikitext
1834 <p><pre>foo</pre></p>
1835 !! html
1836 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1837 !!end
1838
1839 !!test
1840 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1841 !! wikitext
1842 {{echo|}}
1843 !! html
1844
1845 !!end
1846
1847 !!test
1848 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1849 !! wikitext
1850 {{echo|
1851 foo}}
1852 !! html
1853 <p>foo
1854 </p>
1855 !!end
1856
1857 !! test
1858 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1859 !! wikitext
1860 {{echo|a
1861 b}}
1862 !! html
1863 <pre>a
1864 </pre>
1865 <p>b
1866 </p>
1867 !!end
1868
1869 !! test
1870 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1871 !! wikitext
1872 {{echo|a
1873 b
1874 c
1875 d
1876 e
1877 }}
1878 !! html
1879 <pre>a
1880 </pre>
1881 <p>b
1882 c
1883 </p>
1884 <pre>d
1885 </pre>
1886 <p>e
1887 </p>
1888 !!end
1889
1890 !!test
1891 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1892 !! wikitext
1893 {{echo| foo}}
1894
1895 {{echo| foo}}{{echo| bar}}
1896
1897 {{echo| foo}}
1898 {{echo| bar}}
1899
1900 {{echo|<!--cmt--> foo}}
1901
1902 <!--cmt-->{{echo| foo}}
1903
1904 {{echo|{{echo| }}bar}}
1905 !! html
1906 <pre>foo
1907 </pre>
1908 <pre>foo bar
1909 </pre>
1910 <pre>foo
1911 bar
1912 </pre>
1913 <pre>foo
1914 </pre>
1915 <pre>foo
1916 </pre>
1917 <pre>bar
1918 </pre>
1919 !!end
1920
1921 !! test
1922 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1923 !! wikitext
1924 {{echo| }}a
1925
1926 {{echo|
1927 }}a
1928
1929 {{echo|
1930 b}}
1931
1932 {{echo|a
1933 }}b
1934
1935 {{echo|a
1936 }} b
1937 !! html
1938 <pre>a
1939 </pre>
1940 <p><br />
1941 </p>
1942 <pre>a
1943 </pre>
1944 <p><br />
1945 </p>
1946 <pre>b
1947 </pre>
1948 <p>a
1949 </p>
1950 <pre>b
1951 </pre>
1952 <p>a
1953 </p>
1954 <pre>b
1955 </pre>
1956 !!end
1957
1958 !! test
1959 Things that look like <pre> tags aren't treated as such
1960 !! wikitext
1961 Barack Obama <President> of the United States
1962 <President></President>
1963 !! html
1964 <p>Barack Obama &lt;President&gt; of the United States
1965 &lt;President&gt;&lt;/President&gt;
1966 </p>
1967 !! end
1968
1969 ## PHP parser discards the "<pre " string
1970 !! test
1971 Handle broken pre-like tags (bug 64025)
1972 !! options
1973 parsoid=wt2html
1974 !! wikitext
1975 {{echo|<pre <pre>x</pre>}}
1976
1977 <table><pre </table>
1978 !! html/php
1979 <pre>x</pre>
1980 <table><pre></pre></table>
1981
1982 !! html/parsoid
1983 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
1984 <pre>x</pre>
1985
1986 <span>&lt;pre </span>
1987 <table></table>
1988 !! end
1989
1990 !! test
1991 Parsoid: handle pre with space after attribute
1992 !! options
1993 parsoid=wt2html
1994 !! wikitext
1995 <pre style="width:50%;" >{{echo|foo}}</pre>
1996 !! html
1997 <pre style="width:50%;">{{echo|foo}}</pre>
1998 !! end
1999
2000 # TODO / maybe: fix wt2wt for this
2001 !! test
2002 Parsoid: Don't paragraph-wrap fosterable content
2003 !! options
2004 parsoid=wt2html
2005 !! wikitext
2006 {|
2007 <td></td>
2008 <td></td>
2009
2010
2011
2012 |}
2013 !! html
2014 <table>
2015
2016 <tbody>
2017 <tr>
2018 <td></td>
2019
2020 <td></td></tr>
2021
2022
2023
2024 </tbody></table>
2025 !! end
2026
2027 !! test
2028 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 {|
2033 <td>
2034 <td>
2035 </td>
2036
2037
2038
2039 |}
2040 !! html
2041 <table>
2042
2043 <tbody>
2044 <tr>
2045 <td></td>
2046
2047 <td>
2048 </td></tr>
2049
2050
2051
2052 </tbody></table>
2053 !! end
2054
2055
2056 #--------------------------------------------------------------------
2057 # Transclusion parameter whitespace stripping tests
2058 # Behavior is different for positional and named parameters
2059 #--------------------------------------------------------------------
2060 !! test
2061 Templates: Strip leading and trailing whitespace from named-param values
2062 !! wikitext
2063 {{echo|1= a }}
2064
2065 {{echo|1= {{echo|b}} }}
2066
2067 {{echo| 1 =
2068 c }}
2069
2070 {{echo| 1 =
2071 * d
2072 }}
2073 !! html
2074 <p>a
2075 </p><p>b
2076 </p><p>c
2077 </p>
2078 <ul><li> d</li></ul>
2079
2080 !! end
2081
2082 !! test
2083 Templates: Don't strip whitespace from positional-param values
2084 !! wikitext
2085 {{echo|a }}
2086
2087 {{echo|{{echo|b}} }}
2088
2089 {{echo| c
2090 }}
2091
2092 {{echo| {{echo|d}}
2093 }}
2094
2095 {{echo|
2096 e}}
2097
2098 {{echo|
2099 * f}}
2100
2101 {{echo|
2102 }}g
2103 !! html
2104 <p>a
2105 </p><p>b
2106 </p>
2107 <pre>c
2108 </pre>
2109 <p><br />
2110 </p>
2111 <pre>d
2112 </pre>
2113 <p><br />
2114 </p>
2115 <pre>e
2116 </pre>
2117 <p><br />
2118 </p>
2119 <ul><li> f</li></ul>
2120 <p><br />
2121 </p>
2122 <pre>g
2123 </pre>
2124 !! end
2125
2126 !! test
2127 Templates: Handle empty comment-and-ws-only lines correctly
2128 !! wikitext
2129 {{echo|foo
2130 <!--should be ignored-->
2131 <!--should be ignored as well-->
2132 bar}}
2133 !! html
2134 <p>foo
2135 bar
2136 </p>
2137 !! end
2138
2139 !! test
2140 Templates: Handle comments in the target
2141 !! wikitext
2142 {{echo
2143 <!-- should be ignored -->
2144 |foo}}
2145
2146 {{echo<!-- should be ignored -->
2147 |foo}}
2148
2149 {{echo<!-- should be ignored -->|foo}}
2150
2151 {{<!-- should be ignored -->echo|foo}}
2152 !!html/parsoid
2153 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2154
2155 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2156
2157 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2158
2159 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2160 !!end
2161
2162 #--------------------------------------------------------------------
2163 # Transclusion parameter escaping tests
2164 #--------------------------------------------------------------------
2165 !! test
2166 Templates: Parsoid parameter escaping test 1
2167 !! options
2168 parsoid
2169 !! wikitext
2170 {{echo|[foo]|{{echo|[bar]}}}}
2171 !! html
2172 <p about="#mwt1" typeof="mw:Transclusion"
2173 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2174 !! end
2175
2176 !! test
2177 Parsoid: Pipes in external links in template parameter
2178 !! options
2179 parsoid
2180 !! wikitext
2181 {{echo|[{{echo|http://example.com}} link]}}
2182 !! html
2183 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2184 !! end
2185
2186 !! test
2187 Parsoid: pipe in transclusion parameter
2188 !! options
2189 parsoid
2190 !! wikitext
2191 {{echo|http://foo.com/a&#124;b}}
2192 !! html
2193 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2194 typeof="mw:Transclusion"
2195 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2196 !! end
2197
2198 !! test
2199 Parsoid: Pipe in external link target and content in template parameter
2200 !! options
2201 parsoid=html2wt,wt2wt
2202 !! wikitext
2203 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2204 !! html
2205 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2206 typeof="mw:Transclusion"
2207 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2208 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2209 !! end
2210
2211 !! test
2212 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2213 !! options
2214 parsoid
2215 !! wikitext
2216 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2217 !! html
2218 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2219 !! end
2220
2221 !! test
2222 Templates: Don't escape already nowiki-escaped text in template parameters
2223 !! options
2224 parsoid=html2wt,wt2wt
2225 !! wikitext
2226 {{echo|foo<nowiki>|</nowiki>bar}}
2227 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2228 {{echo|<nowiki></nowiki>}}
2229 !! html
2230 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2231 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2232 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2233 </p>
2234 !! end
2235
2236 ## Bug 52824
2237 !! test
2238 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2239 !! options
2240 parsoid=html2wt,wt2wt
2241 !! wikitext
2242 {{echo|{{echo|1=bar}}}}
2243 !! html
2244 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2245 !! end
2246
2247 ## Bug 56733
2248 !! test
2249 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2250 !! options
2251 parsoid
2252 !! wikitext
2253 {{echo|a : b}}
2254 !! html
2255 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2256 !! end
2257
2258 ###
2259 ### Parsoid-centric tests for testing RT edge cases for pre
2260 ###
2261
2262 !!test
2263 1a. Indent-Pre and Comments
2264 !! wikitext
2265 a
2266 <!--a-->
2267 c
2268 !! html
2269 <pre>a
2270 </pre>
2271 <p>c
2272 </p>
2273 !!end
2274
2275 !!test
2276 1b. Indent-Pre and Comments
2277 !! wikitext
2278 a
2279 <!--a-->
2280 c
2281 !! html
2282 <pre>a
2283 </pre>
2284 <p>c
2285 </p>
2286 !!end
2287
2288 !!test
2289 1c. Indent-Pre and Comments
2290 !! wikitext
2291 <!--a--> a
2292
2293 <!--a--> a
2294 !! html
2295 <pre> a
2296 </pre>
2297 <pre> a
2298 </pre>
2299 !!end
2300
2301 !!test
2302 1d. Indent-Pre and Comments
2303 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2304 !! wikitext
2305 <!--a--> a
2306
2307 <!--b-->b
2308 !! html
2309 <pre>a
2310 </pre>
2311 <pre>b
2312 </pre>
2313 !!end
2314
2315 !!test
2316 2a. Indent-Pre and tables
2317 !! wikitext
2318 {|
2319 |-
2320 !h1!!h2
2321 |foo||bar
2322 |}
2323 !! html
2324 <table>
2325
2326 <tr>
2327 <th>h1</th>
2328 <th>h2
2329 </th>
2330 <td>foo</td>
2331 <td>bar
2332 </td></tr></table>
2333
2334 !!end
2335
2336 !!test
2337 2b. Indent-Pre and tables
2338 !! wikitext
2339 {|
2340 |-
2341 |foo
2342 |}
2343 !! html
2344 <table>
2345
2346 <tr>
2347 <td>foo
2348 </td></tr></table>
2349
2350 !!end
2351
2352 !!test
2353 2c. Indent-Pre and tables (bug 42252)
2354 !! wikitext
2355 {|
2356 |+ foo
2357 ! | bar
2358 |}
2359 !! html
2360 <table>
2361 <caption> foo
2362 </caption>
2363 <tr>
2364 <th> bar
2365 </th></tr></table>
2366
2367 !!end
2368
2369 !!test
2370 2d. Indent-Pre and tables
2371 !! wikitext
2372 a
2373 {|
2374 | b
2375 |}
2376 !! html/php
2377 <pre>a
2378 </pre>
2379 <table>
2380 <tr>
2381 <td> b
2382 </td></tr></table>
2383
2384 !! html/parsoid
2385 <pre>a</pre>
2386
2387 <table>
2388
2389 <tbody>
2390 <tr>
2391 <td> b</td></tr>
2392 </tbody></table>
2393 !!end
2394
2395 !!test
2396 2e. Indent-Pre and table-line syntax
2397 !! wikitext
2398 a
2399 | b
2400 | c
2401 !! html/parsoid
2402 <pre>a
2403 | b
2404 | c</pre>
2405 !!end
2406
2407 !!test
2408 2f. Indent-pre started by table-line syntax
2409 !! wikitext
2410 a
2411 | b
2412 | c
2413 !! html/parsoid
2414 <p>a</p>
2415 <pre>
2416 | b
2417 | c</pre>
2418 !!end
2419
2420 !!test
2421 3a. Indent-Pre and block tags (single-line html)
2422 !! wikitext
2423 a <p> foo </p>
2424 b <div> foo </div>
2425 c <blockquote> foo </blockquote>
2426 <span> foo </span>
2427 !! html
2428 a <p> foo </p>
2429 b <div> foo </div>
2430 c <blockquote> foo </blockquote>
2431 <pre><span> foo </span>
2432 </pre>
2433 !!end
2434
2435 !!test
2436 3b. Indent-Pre and block tags (multi-line html)
2437 !! wikitext
2438 a <span>foo</span>
2439 b <div> foo </div>
2440 !! html
2441 <pre>a <span>foo</span>
2442 </pre>
2443 b <div> foo </div>
2444
2445 !!end
2446
2447 !!test
2448 3c. Indent-Pre and block tags (pre-content on separate line)
2449 !! wikitext
2450 <p>
2451 foo
2452 </p>
2453
2454 <div>
2455 foo
2456 </div>
2457
2458 <center>
2459 foo
2460 </center>
2461
2462 <blockquote>
2463 foo
2464 </blockquote>
2465
2466 <blockquote>
2467 <pre>
2468 foo
2469 </pre>
2470 </blockquote>
2471
2472 <table><tr><td>
2473 foo
2474 </td></tr></table>
2475
2476 <ul><li>
2477 foo
2478 </li></ul>
2479
2480 !! html
2481 <p>
2482 foo
2483 </p>
2484 <div>
2485 <pre>foo
2486 </pre>
2487 </div>
2488 <center>
2489 <pre>foo
2490 </pre>
2491 </center>
2492 <blockquote>
2493 <p> foo
2494 </p>
2495 </blockquote>
2496 <blockquote>
2497 <pre>
2498 foo
2499 </pre>
2500 </blockquote>
2501 <table><tr><td>
2502 <pre>foo
2503 </pre>
2504 </td></tr></table>
2505 <ul><li>
2506 foo
2507 </li></ul>
2508
2509 !!end
2510
2511 !!test
2512 4. Indent-Pre and extension tags
2513 !! wikitext
2514 a <gallery>
2515 File:foobar.jpg
2516 </gallery>
2517 !! html
2518 a <ul class="gallery mw-gallery-traditional">
2519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2520 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2521 <div class="gallerytext">
2522 </div>
2523 </div></li>
2524 </ul>
2525
2526 !!end
2527
2528 !! test
2529 Leading pipes outside of tables
2530 !! options
2531 parsoid
2532 !! wikitext
2533 | foo
2534 !! html
2535 <p>| foo</p>
2536 !! end
2537
2538 !! test
2539 Leading pipes outside of tables 2
2540 !! options
2541 parsoid
2542 !! wikitext
2543 a
2544 | foo
2545 b
2546 !! html
2547 <p>a
2548 | foo
2549 b</p>
2550 !! end
2551
2552 !! test
2553 Leading pipes outside of tables 3
2554 !! options
2555 parsoid
2556 !! wikitext
2557 a
2558 | class="foo bar" | baz
2559 b
2560 !! html
2561 <p>a
2562 | class="foo bar" | baz
2563 b</p>
2564 !! end
2565
2566 !!test
2567 Render paragraphs when indent-pre is suppressed in blocklevels
2568 !! wikitext
2569 <blockquote>
2570 foo
2571
2572 bar
2573 </blockquote>
2574 !! html
2575 <blockquote>
2576 <p> foo
2577 </p><p> bar
2578 </p>
2579 </blockquote>
2580
2581 !!end
2582
2583 !!test
2584 4. Multiple spaces at start-of-line
2585 !! wikitext
2586 <p> foo </p>
2587 foo
2588 {|
2589 |foo
2590 |}
2591 !! html
2592 <p> foo </p>
2593 <pre> foo
2594 </pre>
2595 <table>
2596 <tr>
2597 <td>foo
2598 </td></tr></table>
2599
2600 !!end
2601
2602 ## NOTE: the leading white-space chars on empty line are significant
2603 !! test
2604 5a. White-space in indent-pre
2605 !! wikitext
2606 a<br />
2607
2608 b
2609 !! html
2610 <pre>a<br />
2611
2612 b
2613 </pre>
2614 !! end
2615
2616 ## NOTE: the leading white-space chars on empty line are significant
2617 !! test
2618 5b. White-space in indent-pre
2619 !! wikitext
2620 a
2621
2622 b
2623
2624
2625 c
2626 !! html
2627 <pre>a
2628
2629 b
2630
2631
2632 c
2633 </pre>
2634 !! end
2635
2636 !! test
2637 5c. White-space in indent-pre
2638 !! wikitext
2639 ''a''
2640 ''b''
2641 ''c''
2642 !! html
2643 <pre><i>a</i>
2644 <i>b</i>
2645 <i>c</i>
2646 </pre>
2647 !! end
2648
2649 !! test
2650 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2651 !! wikitext
2652 a
2653
2654 <!-- continue -->
2655 b
2656
2657 c
2658
2659 d
2660 !! html
2661 <pre>a
2662
2663 b
2664 </pre>
2665 <pre>c
2666
2667 </pre>
2668 <p>d
2669 </p>
2670 !! end
2671
2672 !! test
2673 7a. Indent-pre and category links
2674 !! options
2675 parsoid=wt2html,wt2wt
2676 !! wikitext
2677 [[Category:foo]] <!-- No pre-wrapping -->
2678 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2679 !! html
2680 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2681 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2682 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2683 !! end
2684
2685 !! test
2686 7b. Indent-pre and category links
2687 !! options
2688 parsoid=wt2html,wt2wt
2689 !! wikitext
2690 [[Category:foo]] a
2691 [[Category:foo]] {{echo|b}}
2692 !! html
2693 <pre>
2694 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2695
2696 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
2697 !! end
2698
2699 ###
2700 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2701 ###
2702
2703 !!test
2704 HTML-pre: 1. embedded newlines
2705 !! wikitext
2706 <pre>foo</pre>
2707
2708 <pre>
2709 foo
2710 </pre>
2711
2712 <pre>
2713
2714 foo
2715 </pre>
2716
2717 <pre>
2718
2719
2720 foo
2721 </pre>
2722 !! html
2723 <pre>foo</pre>
2724 <pre>
2725 foo
2726 </pre>
2727 <pre>
2728
2729 foo
2730 </pre>
2731 <pre>
2732
2733
2734 foo
2735 </pre>
2736
2737 !! html/parsoid
2738 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2739
2740 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2741 foo
2742 </pre>
2743
2744 <pre data-parsoid='{"stx":"html"}'>
2745
2746 foo
2747 </pre>
2748
2749 <pre data-parsoid='{"stx":"html"}'>
2750
2751
2752 foo
2753 </pre>
2754 !!end
2755
2756 !! test
2757 HTML-pre: big spaces
2758 !! wikitext
2759 <pre>
2760
2761
2762
2763
2764 haha
2765
2766
2767
2768
2769 haha
2770
2771
2772
2773
2774 </pre>
2775 !! html
2776 <pre>
2777
2778
2779
2780
2781 haha
2782
2783
2784
2785
2786 haha
2787
2788
2789
2790
2791 </pre>
2792
2793 !! html/parsoid
2794 <pre data-parsoid='{"stx":"html"}'>
2795
2796
2797
2798
2799 haha
2800
2801
2802
2803
2804 haha
2805
2806
2807
2808
2809 </pre>
2810 !! end
2811
2812 !!test
2813 HTML-pre: 2: indented text
2814 !! wikitext
2815 <pre>
2816 foo
2817 </pre>
2818 !! html
2819 <pre>
2820 foo
2821 </pre>
2822
2823 !!end
2824
2825 !!test
2826 HTML-pre: 3: other wikitext
2827 !! wikitext
2828 <pre>
2829 * foo
2830 # bar
2831 = no-h =
2832 '' no-italic ''
2833 [[ NoLink ]]
2834 </pre>
2835 !! html
2836 <pre>
2837 * foo
2838 # bar
2839 = no-h =
2840 '' no-italic ''
2841 [[ NoLink ]]
2842 </pre>
2843
2844 !!end
2845
2846 ###
2847 ### Definition lists
2848 ###
2849 !! test
2850 Simple definition
2851 !! wikitext
2852 ; name : Definition
2853 !! html
2854 <dl><dt> name&#160;</dt>
2855 <dd> Definition</dd></dl>
2856
2857 !! end
2858
2859 !! test
2860 Definition list for indentation only
2861 !! wikitext
2862 : Indented text
2863 !! html
2864 <dl><dd> Indented text</dd></dl>
2865
2866 !! end
2867
2868 !! test
2869 Definition list with no space
2870 !! wikitext
2871 ;name:Definition
2872 !! html
2873 <dl><dt>name</dt>
2874 <dd>Definition</dd></dl>
2875
2876 !!end
2877
2878 !! test
2879 Definition list with URL link
2880 !! wikitext
2881 ; http://example.com/ : definition
2882 !! html
2883 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2884 <dd> definition</dd></dl>
2885
2886 !! end
2887
2888 !! test
2889 Definition list with bracketed URL link
2890 !! wikitext
2891 ;[http://www.example.com/ Example]:Something about it
2892 !! html
2893 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2894 <dd>Something about it</dd></dl>
2895
2896 !! end
2897
2898 !! test
2899 Definition list with wikilink containing colon
2900 !! wikitext
2901 ; [[Help:FAQ]]: The least-read page on Wikipedia
2902 !! html
2903 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
2904 <dd> The least-read page on Wikipedia</dd></dl>
2905
2906 !! end
2907
2908 # At Brion's and JeLuF's insistence... :)
2909 !! test
2910 Definition list with news link containing colon
2911 !! wikitext
2912 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2913 !! html
2914 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2915 <dd> This isn't even a real newsgroup!</dd></dl>
2916
2917 !! end
2918
2919 !! test
2920 Malformed definition list with colon
2921 !! wikitext
2922 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2923 !! html
2924 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
2925
2926 !! end
2927
2928 !! test
2929 Definition lists: colon in external link text
2930 !! wikitext
2931 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2932 !! html
2933 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2934 <dd> OK, I made that up</dd></dl>
2935
2936 !! end
2937
2938 !! test
2939 Definition lists: colon in HTML attribute
2940 !! wikitext
2941 ;<b style="display: inline">bold</b>
2942 !! html
2943 <dl><dt><b style="display: inline">bold</b></dt></dl>
2944
2945 !! end
2946
2947 !! test
2948 Definition lists: self-closed tag
2949 !! wikitext
2950 ;one<br/>two : two-line fun
2951 !! html
2952 <dl><dt>one<br />two&#160;</dt>
2953 <dd> two-line fun</dd></dl>
2954
2955 !! end
2956
2957 !! test
2958 Bug 11748: Literal closing tags
2959 !! wikitext
2960 <dl>
2961 <dt>test 1</dt>
2962 <dd>test test test test test</dd>
2963 <dt>test 2</dt>
2964 <dd>test test test test test</dd>
2965 </dl>
2966 !! html
2967 <dl>
2968 <dt>test 1</dt>
2969 <dd>test test test test test</dd>
2970 <dt>test 2</dt>
2971 <dd>test test test test test</dd>
2972 </dl>
2973
2974 !! end
2975
2976 !! test
2977 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2978 !! wikitext
2979 <ul><li>
2980 ; term : description
2981 * unordered
2982 </li></ul>
2983 !! html
2984 <ul><li>
2985 <dl><dt> term&#160;</dt>
2986 <dd> description</dd></dl>
2987 <ul><li> unordered</li></ul>
2988 </li></ul>
2989
2990 !! end
2991
2992 !! test
2993
2994 Definition list with empty definition and following paragraph
2995 !! wikitext
2996 ; term:
2997 Paragraph text
2998 !! html
2999 <dl><dt> term</dt>
3000 <dd></dd></dl>
3001 <p>Paragraph text
3002 </p>
3003 !! end
3004
3005 !! test
3006 Nested definition lists using html syntax
3007 !! wikitext
3008 <dl><dt>x</dt>
3009 <dd>a</dd>
3010 <dd>b</dd></dl>
3011
3012 !! end
3013
3014 !! test
3015 Definition Lists: No nesting: Multiple dd's
3016 !! wikitext
3017 ;x
3018 :a
3019 :b
3020 !! html
3021 <dl><dt>x</dt>
3022 <dd>a</dd>
3023 <dd>b</dd></dl>
3024
3025 !! end
3026
3027 !! test
3028 Definition Lists: Indentation: Regular
3029 !! wikitext
3030 :i1
3031 ::i2
3032 :::i3
3033 !! html
3034 <dl><dd>i1
3035 <dl><dd>i2
3036 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3037
3038 !! end
3039
3040 !! test
3041 Definition Lists: Indentation: Missing 1st level
3042 !! wikitext
3043 ::i2
3044 :::i3
3045 !! html
3046 <dl><dd><dl><dd>i2
3047 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3048
3049 !! end
3050
3051 !! test
3052 Definition Lists: Indentation: Multi-level indent
3053 !! wikitext
3054 :::i3
3055 !! html
3056 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3057
3058 !! end
3059
3060 !! test
3061 Definition Lists: Hacky use to indent tables
3062 !! wikitext
3063 ::{|
3064 |foo
3065 |bar
3066 |}
3067 this text
3068 should be left alone
3069 !! html
3070 <dl><dd><dl><dd><table>
3071 <tr>
3072 <td>foo
3073 </td>
3074 <td>bar
3075 </td></tr></table></dd></dl></dd></dl>
3076 <p>this text
3077 should be left alone
3078 </p>
3079 !! end
3080
3081 !! test
3082 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3083 !! wikitext
3084 <!-- foo -->
3085 ::{|
3086 |foo
3087 |bar
3088 |}<!-- bar -->
3089 this text
3090 should be left alone
3091 !! html/parsoid
3092 <!-- foo -->
3093 <dl><dd><dl><dd><table><tr>
3094 <td>foo</td>
3095 <td>bar</td>
3096 </tr></table><!-- bar --></dd></dl></dd></dl>
3097 <p>this text
3098 should be left alone</p>
3099 !! end
3100
3101 !! test
3102 Definition Lists: Hacky use to indent tables, with comment before table
3103 !! wikitext
3104 ::<!-- foo -->{|
3105 |foo
3106 |}
3107 !! html/parsoid
3108 <dl><dd><dl><dd><!-- foo --><table><tr>
3109 <td>foo</td>
3110 </tr></table></dd></dl></dd></dl>
3111 !! end
3112
3113 # Bug 52473
3114 !! test
3115 Definition Lists: Hacky use to indent tables (WS-insensitive)
3116 !! options
3117 parsoid
3118 !! wikitext
3119 : {|
3120 |a
3121 |}
3122 !! html
3123 <dl>
3124 <dd> <table><tr><td>a</td></tr></table> </dd>
3125 </dl>
3126 !! end
3127 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3128 ## as an empty dt item. It also ignores all but the last ";" when followed
3129 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3130 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3131 ## ";"s.
3132 ##
3133 ## Ex: ";;t2 ::d2" is transformed into:
3134 ##
3135 ## <dl>
3136 ## <dt>t2 </dt>
3137 ## <dd>
3138 ## <dl>
3139 ## <dt></dt>
3140 ## <dd>d2</dd>
3141 ## </dl>
3142 ## </dd>
3143 ## </dl>
3144 ##
3145 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3146 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3147 ##
3148 ## <dl>
3149 ## <dt>
3150 ## <dl>
3151 ## <dt>t2 </dt>
3152 ## <dd>:d2</dd>
3153 ## </dl>
3154 ## </dt>
3155 ## </dl>
3156 ##
3157 ## All Parsoid only definition list tests have this difference.
3158 ##
3159 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3160 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3161
3162 !! test
3163 Table / list interaction: indented table with lists in table contents
3164 !! wikitext
3165 :{|
3166 |-
3167 | a
3168 * b
3169 |-
3170 | c
3171 * d
3172 |}
3173 !! html
3174 <dl><dd><table>
3175
3176 <tr>
3177 <td> a
3178 <ul><li> b</li></ul>
3179 </td></tr>
3180 <tr>
3181 <td> c
3182 <ul><li> d</li></ul>
3183 </td></tr></table></dd></dl>
3184
3185 !! end
3186
3187 !!test
3188 Table / list interaction: lists nested in tables nested in indented lists
3189 !! wikitext
3190 :{|
3191 |
3192 :a
3193 :b
3194 |
3195 *c
3196 *d
3197 |}
3198
3199 *e
3200 *f
3201 !! html
3202 <dl><dd><table>
3203 <tr>
3204 <td>
3205 <dl><dd>a</dd>
3206 <dd>b</dd></dl>
3207 </td>
3208 <td>
3209 <ul><li>c</li>
3210 <li>d</li></ul>
3211 </td></tr></table></dd></dl>
3212 <ul><li>e</li>
3213 <li>f</li></ul>
3214
3215 !!end
3216
3217 !! test
3218 Definition Lists: Nesting: Multi-level (Parsoid only)
3219 !! options
3220 parsoid
3221 !! wikitext
3222 ;t1 :d1
3223 ;;t2 ::d2
3224 ;;;t3 :::d3
3225 !! html
3226 <dl>
3227 <dt>t1 </dt>
3228 <dd>d1</dd>
3229 <dt>
3230 <dl>
3231 <dt>t2 </dt>
3232 <dd>:d2</dd>
3233 <dt>
3234 <dl>
3235 <dt>t3 </dt>
3236 <dd>::d3</dd>
3237 </dl>
3238 </dt>
3239 </dl>
3240 </dt>
3241 </dl>
3242
3243
3244 !! end
3245
3246
3247 !! test
3248 Definition Lists: Nesting: Test 2 (Parsoid only)
3249 !! options
3250 parsoid
3251 !! wikitext
3252 ;t1
3253 ::d2
3254 !! html
3255 <dl>
3256 <dt>t1</dt>
3257 <dd>
3258 <dl>
3259 <dd>d2</dd>
3260 </dl>
3261 </dd>
3262 </dl>
3263
3264 !! end
3265
3266
3267 !! test
3268 Definition Lists: Nesting: Test 3 (Parsoid only)
3269 !! options
3270 parsoid
3271 !! wikitext
3272 :;t1
3273 ::::d2
3274 !! html
3275 <dl>
3276 <dd>
3277 <dl>
3278 <dt>t1</dt>
3279 <dd>
3280 <dl>
3281 <dd>
3282 <dl>
3283 <dd>d2</dd>
3284 </dl>
3285 </dd>
3286 </dl>
3287 </dd>
3288 </dl>
3289 </dd>
3290 </dl>
3291
3292 !! end
3293
3294
3295 !! test
3296 Definition Lists: Nesting: Test 4
3297 !! wikitext
3298 ::;t3
3299 :::d3
3300 !! html
3301 <dl><dd><dl><dd><dl><dt>t3</dt>
3302 <dd>d3</dd></dl></dd></dl></dd></dl>
3303
3304 !! end
3305
3306
3307 ## The Parsoid team believes the following three test exposes a
3308 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3309 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3310 !! test
3311 Definition Lists: Mixed Lists: Test 1
3312 !! wikitext
3313 :;* foo
3314 ::* bar
3315 :; baz
3316 !! html/php
3317 <dl><dd><dl><dt><ul><li> foo</li>
3318 <li> bar</li></ul></dt></dl>
3319 <dl><dt> baz</dt></dl></dd></dl>
3320
3321 !! html/parsoid
3322 <dl>
3323 <dd><dl>
3324 <dt><ul>
3325 <li> foo
3326 </li>
3327 </ul></dt>
3328 <dd><ul>
3329 <li> bar
3330 </li>
3331 </ul></dd>
3332 <dt> baz</dt>
3333 </dl></dd>
3334 </dl>
3335 !! end
3336
3337 !! test
3338 Definition Lists: Mixed Lists: Test 2
3339 !! wikitext
3340 *: d1
3341 *: d2
3342 !! html
3343 <ul><li><dl><dd> d1</dd>
3344 <dd> d2</dd></dl></li></ul>
3345
3346 !! end
3347
3348
3349 !! test
3350 Definition Lists: Mixed Lists: Test 3
3351 !! wikitext
3352 *::: d1
3353 *::: d2
3354 !! html
3355 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3356 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3357
3358 !! end
3359
3360
3361 !! test
3362 Definition Lists: Mixed Lists: Test 4
3363 !! wikitext
3364 *;d1 :d2
3365 *;d3 :d4
3366 !! html
3367 <ul><li><dl><dt>d1&#160;</dt>
3368 <dd>d2</dd>
3369 <dt>d3&#160;</dt>
3370 <dd>d4</dd></dl></li></ul>
3371
3372 !! end
3373
3374
3375 !! test
3376 Definition Lists: Mixed Lists: Test 5
3377 !! wikitext
3378 *:d1
3379 *:: d2
3380 !! html
3381 <ul><li><dl><dd>d1
3382 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3383
3384 !! end
3385
3386
3387 !! test
3388 Definition Lists: Mixed Lists: Test 6
3389 !! wikitext
3390 #*:d1
3391 #*::: d3
3392 !! html
3393 <ol><li><ul><li><dl><dd>d1
3394 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3395
3396 !! end
3397
3398
3399 !! test
3400 Definition Lists: Mixed Lists: Test 7
3401 !! wikitext
3402 :* d1
3403 :* d2
3404 !! html
3405 <dl><dd><ul><li> d1</li>
3406 <li> d2</li></ul></dd></dl>
3407
3408 !! end
3409
3410
3411 !! test
3412 Definition Lists: Mixed Lists: Test 8
3413 !! wikitext
3414 :* d1
3415 ::* d2
3416 !! html
3417 <dl><dd><ul><li> d1</li></ul>
3418 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3419
3420 !! end
3421
3422
3423 !! test
3424 Definition Lists: Mixed Lists: Test 9
3425 !! wikitext
3426 *;foo :bar
3427 !! html
3428 <ul><li><dl><dt>foo&#160;</dt>
3429 <dd>bar</dd></dl></li></ul>
3430
3431 !! end
3432
3433
3434 !! test
3435 Definition Lists: Mixed Lists: Test 10
3436 !! wikitext
3437 *#;foo :bar
3438 !! html
3439 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3440 <dd>bar</dd></dl></li></ol></li></ul>
3441
3442 !! end
3443
3444 # The Parsoid team disagrees with the PHP parser's seemingly-random
3445 # rules regarding dd/dt on the next two tests. Parsoid is more
3446 # consistent, and recognizes the shared nesting and keeps the
3447 # still-open tags around until the nesting is complete.
3448
3449 !! test
3450 Definition Lists: Mixed Lists: Test 11
3451 !! wikitext
3452 *#*#;*;;foo :bar
3453 *#*#;boo :baz
3454 !! html/php
3455 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3456 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3457 <dl><dt>boo&#160;</dt>
3458 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3459
3460 !! html/parsoid
3461 <ul>
3462 <li>
3463 <ol>
3464 <li>
3465 <ul>
3466 <li>
3467 <ol>
3468 <li>
3469 <dl>
3470 <dt>
3471 <ul>
3472 <li>
3473 <dl>
3474 <dt>
3475 <dl>
3476 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3477 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3478 </dl></dt>
3479 </dl></li>
3480 </ul></dt>
3481 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3482 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3483 </dl></li>
3484 </ol></li>
3485 </ul></li>
3486 </ol></li>
3487 </ul>
3488 !! end
3489
3490
3491 !! test
3492 Definition Lists: Weird Ones: Test 1
3493 !! wikitext
3494 *#;*::;; foo : bar (who uses this?)
3495 !! html/php
3496 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3497 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
3498
3499 !! html/parsoid
3500 <ul>
3501 <li>
3502 <ol>
3503 <li>
3504 <dl>
3505 <dt>
3506 <ul>
3507 <li>
3508 <dl>
3509 <dd>
3510 <dl>
3511 <dd>
3512 <dl>
3513 <dt>
3514 <dl>
3515 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3516 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3517 </dl></dt>
3518 </dl></dd>
3519 </dl></dd>
3520 </dl></li>
3521 </ul></dt>
3522 </dl></li>
3523 </ol></li>
3524 </ul>
3525 !! end
3526
3527 ###
3528 ### External links
3529 ###
3530 !! test
3531 External links: non-bracketed
3532 !! wikitext
3533 Non-bracketed: http://example.com
3534 !! html
3535 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3536 </p>
3537 !! end
3538
3539 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3540 !! test
3541 External links: numbered
3542 !! wikitext
3543 Numbered: [http://example.com]
3544 Numbered: [http://example.net]
3545 Numbered: [http://example.com]
3546 !! html/php
3547 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3548 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3549 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3550 </p>
3551 !! html/parsoid
3552 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3553 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3554 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3555 !!end
3556
3557 !! test
3558 External links: specified text
3559 !! wikitext
3560 Specified text: [http://example.com link]
3561 !! html
3562 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3563 </p>
3564 !!end
3565
3566 !! test
3567 External links: trail
3568 !! wikitext
3569 Linktrails should not work for external links: [http://example.com link]s
3570 !! html
3571 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3572 </p>
3573 !! end
3574
3575 !! test
3576 External links: dollar sign in URL
3577 !! wikitext
3578 http://example.com/1$2345
3579 !! html
3580 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3581 </p>
3582 !! end
3583
3584 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3585 !! test
3586 External links: dollar sign in URL (autonumber)
3587 !! wikitext
3588 [http://example.com/1$2345]
3589 !! html/php
3590 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3591 </p>
3592 !! html/parsoid
3593 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3594 !!end
3595
3596 !! test
3597 External links: open square bracket forbidden in URL (bug 4377)
3598 !! options
3599 parsoid=wt2html,wt2wt,html2html
3600 !! wikitext
3601 http://example.com/1[2345
3602 !! html/php
3603 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3604 </p>
3605 !! html/parsoid
3606 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3607 !! end
3608
3609 !! test
3610 External links: open square bracket forbidden in URL (named) (bug 4377)
3611 !! options
3612 parsoid=wt2html,html2html
3613 !! wikitext
3614 [http://example.com/1[2345]
3615 !! html/php
3616 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3617 </p>
3618 !! html/parsoid
3619 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3620 !!end
3621
3622 # parsoid adds a space before the link name
3623 !! test
3624 External links: open square bracket forbidden in URL (named) (bug 4377)
3625 Parsoid variant.
3626 !! wikitext
3627 [http://example.com/1 [2345]
3628 !! html
3629 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3630 </p>
3631 !!end
3632
3633 !! test
3634 External links: nowiki in URL link text (bug 6230)
3635 !! wikitext
3636 [http://example.com/ <nowiki>''example site''</nowiki>]
3637 !! html
3638 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3639 </p>
3640 !! end
3641
3642 !! test
3643 External links: newline forbidden in text (bug 6230 regression check)
3644 !! wikitext
3645 [http://example.com/ first
3646 second]
3647 !! html
3648 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3649 second]
3650 </p>
3651 !!end
3652
3653 !! test
3654 External links: Pipe char between url and text
3655 !! wikitext
3656 [http://example.com | link]
3657 !! html
3658 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3659 </p>
3660 !!end
3661
3662 !! test
3663 External links: protocol-relative URL in brackets
3664 !! wikitext
3665 [//example.com/ Test]
3666 !! html
3667 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3668 </p>
3669 !! end
3670
3671 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3672 !! test
3673 External links: protocol-relative URL in brackets without text
3674 !! wikitext
3675 [//example.com]
3676 !! html/php
3677 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3678 </p>
3679 !! html/parsoid
3680 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3681 !! end
3682
3683 !! test
3684 External links: protocol-relative URL in free text is left alone
3685 !! wikitext
3686 //example.com/Foo
3687 !! html
3688 <p>//example.com/Foo
3689 </p>
3690 !!end
3691
3692 !! test
3693 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3694 !! wikitext
3695 foo//example.com/Foo
3696 !! html
3697 <p>foo//example.com/Foo
3698 </p>
3699 !! end
3700
3701 !! test
3702 External links: with no contents
3703 !! wikitext
3704 [http://en.wikipedia.org/wiki/Foo]
3705
3706 [[wikipedia:Foo|Bar]]
3707
3708 [[wikipedia:Foo|<span>Bar</span>]]
3709 !! html/parsoid
3710 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3711 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3712 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3713 !! end
3714
3715 !! test
3716 External image
3717 !! wikitext
3718 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3719 !! html
3720 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3721 </p>
3722 !! end
3723
3724 !! test
3725 External image from https
3726 !! wikitext
3727 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3728 !! html
3729 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3730 </p>
3731 !! end
3732
3733 !! test
3734 External image (when not allowed)
3735 !! options
3736 wgAllowExternalImages=0
3737 !! wikitext
3738 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3739 !! html
3740 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
3741 </p>
3742 !! end
3743
3744 !! test
3745 Link to non-http image, no img tag
3746 !! wikitext
3747 Link to non-http image, no img tag: ftp://example.com/test.jpg
3748 !! html
3749 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
3750 </p>
3751 !! end
3752
3753 !! test
3754 External links: terminating separator
3755 !! wikitext
3756 Terminating separator: http://example.com/thing,
3757 !! html
3758 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3759 </p>
3760 !! end
3761
3762 !! test
3763 External links: intervening separator
3764 !! wikitext
3765 Intervening separator: http://example.com/1,2,3
3766 !! html
3767 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3768 </p>
3769 !! end
3770
3771 !! test
3772 External links: old bug with URL in query
3773 !! wikitext
3774 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3775 !! html
3776 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3777 </p>
3778 !! end
3779
3780 !! test
3781 External links: old URL-in-URL bug, mixed protocols
3782 !! wikitext
3783 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3784 !! html
3785 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3786 </p>
3787 !!end
3788
3789 !! test
3790 External links: URL in text
3791 !! wikitext
3792 URL in text: [http://example.com http://example.com]
3793 !! html
3794 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3795 </p>
3796 !! end
3797
3798 !! test
3799 External links: Clickable images
3800 !! wikitext
3801 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3802 !! html
3803 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
3804 </p>
3805 !!end
3806
3807 !! test
3808 External links: raw ampersand
3809 !! wikitext
3810 Old &amp; use: http://x&y
3811 !! html
3812 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3813 </p>
3814 !! end
3815
3816 !! test
3817 External links: encoded ampersand
3818 !! wikitext
3819 Old &amp; use: http://x&amp;y
3820 !! html/php
3821 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3822 </p>
3823 !! html/parsoid
3824 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3825 !! end
3826
3827 !! test
3828 External links: encoded equals (bug 6102)
3829 !! wikitext
3830 http://example.com/?foo&#61;bar
3831 !! html/php
3832 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3833 </p>
3834 !! html/parsoid
3835 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3836 !! end
3837
3838 ##
3839 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3840 ## does it number them. As discussed in bug 53505, we can identify
3841 ## autonumbered links via CSS.
3842 ##
3843
3844 !! test
3845 External links: [raw ampersand]
3846 !! wikitext
3847 Old &amp; use: [http://x&y]
3848 !! html/php
3849 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3850 </p>
3851 !! html/parsoid
3852 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3853 !! end
3854
3855 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3856 # mode will return the [raw ampersand] wikitext
3857 !! test
3858 External links: [encoded ampersand]
3859 !! options
3860 parsoid=wt2html,wt2wt,html2html
3861 !! wikitext
3862 Old &amp; use: [http://x&amp;y]
3863 !! html/php
3864 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3865 </p>
3866 !! html/parsoid
3867 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3868 !! end
3869
3870 !! test
3871 External links: [raw equals]
3872 !! wikitext
3873 [http://example.com/?foo=bar]
3874 !! html/php
3875 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3876 </p>
3877 !! html/parsoid
3878 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3879 !! end
3880
3881 # note that parsoid html is identical to [raw equals] case; so html2wt
3882 # mode will return the [raw equals] wikitext
3883 !! test
3884 External links: [encoded equals] (bug 6102)
3885 !! options
3886 parsoid=wt2html,wt2wt,html2html
3887 !! wikitext
3888 [http://example.com/?foo&#61;bar]
3889 !! html/php
3890 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3891 </p>
3892 !! html/parsoid
3893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3894 !! end
3895
3896 # xxx parsoid strips the IDN character, so the round-trip tests will
3897 # obviously fail and are disabled. --cscott
3898 !! test
3899 External links: [IDN ignored character reference in hostname; strip it right off]
3900 !! options
3901 parsoid=wt2html,wt2wt,html2html
3902 !! wikitext
3903 [http://e&zwnj;xample.com/]
3904 !! html/php
3905 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3906 </p>
3907 !! html/parsoid
3908 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3909 !! end
3910
3911 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3912 # Where an external link could easily circumvent the sanitization of the text of
3913 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3914 # test demands a higher standard. That's a bit strange.
3915 #
3916 # Example:
3917 #
3918 # http://e‌xample.com -> [http://example.com|http://example.com]
3919 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3920 #
3921 # The first example is sanitized, but the second is not. Any security benefits
3922 # from this production are trivial to circumvent. Either remove this test and
3923 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3924 # the test accordingly.
3925 #
3926 # All our love,
3927 # The Parsoid team.
3928 # xxx parsoid strips the IDN character, so the round-trip tests will
3929 # obviously fail and are disabled. --cscott
3930 !! test
3931 External links: IDN ignored character reference in hostname; strip it right off
3932 !! options
3933 parsoid=wt2html,html2html
3934 !! wikitext
3935 http://e&zwnj;xample.com/
3936 !! html/php
3937 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3938 </p>
3939 !! html/parsoid
3940 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
3941 !! end
3942
3943 !! test
3944 External links: www.jpeg.org (bug 554)
3945 !! wikitext
3946 http://www.jpeg.org
3947 !! html
3948 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3949 </p>
3950 !! end
3951
3952 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3953 !! test
3954 External links: URL within URL (original bug 2)
3955 !! wikitext
3956 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3957 !! html/php
3958 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3959 </p>
3960 !! html/parsoid
3961 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
3962 !! end
3963
3964 !! test
3965 BUG 361: URL inside bracketed URL
3966 !! wikitext
3967 [http://www.example.com/foo http://www.example.com/bar]
3968 !! html
3969 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3970 </p>
3971 !! end
3972
3973 !! test
3974 BUG 361: URL within URL, not bracketed
3975 !! wikitext
3976 http://www.example.com/foo?=http://www.example.com/bar
3977 !! html
3978 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
3979 </p>
3980 !! end
3981
3982 !! test
3983 BUG 289: ">"-token in URL-tail
3984 !! wikitext
3985 http://www.example.com/<hello>
3986 !! html
3987 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3988 </p>
3989 !!end
3990
3991 !! test
3992 BUG 289: literal ">"-token in URL-tail
3993 !! wikitext
3994 http://www.example.com/<b>html</b>
3995 !! html
3996 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3997 </p>
3998 !!end
3999
4000 !! test
4001 BUG 289: ">"-token in bracketed URL
4002 !! wikitext
4003 [http://www.example.com/<hello> stuff]
4004 !! html
4005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4006 </p>
4007 !!end
4008
4009 !! test
4010 BUG 289: literal ">"-token in bracketed URL
4011 !! wikitext
4012 [http://www.example.com/<b>html</b> stuff]
4013 !! html
4014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4015 </p>
4016 !!end
4017
4018 !! test
4019 BUG 289: literal double quote at end of URL
4020 !! wikitext
4021 http://www.example.com/"hello"
4022 !! html
4023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4024 </p>
4025 !!end
4026
4027 !! test
4028 BUG 289: literal double quote in bracketed URL
4029 !! wikitext
4030 [http://www.example.com/"hello" stuff]
4031 !! html
4032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4033 </p>
4034 !!end
4035
4036 !! test
4037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4038 !! wikitext
4039 [http://www.example.com test]
4040 !! html
4041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4042 </p>
4043 !! end
4044
4045 !! test
4046 External links: link text with spaces
4047 !! wikitext
4048 [http://www.example.com a b c]
4049 [http://www.example.com ''a'' ''b'']
4050 !! html
4051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4053 </p>
4054 !! end
4055
4056 !! test
4057 External links: wiki links within external link (Bug 3695)
4058 !! wikitext
4059 [http://example.com [[wikilink]] embedded in ext link]
4060 !! html/php
4061 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
4062 </p>
4063 !! html/parsoid
4064 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
4065 !! end
4066
4067 !! test
4068 BUG 787: Links with one slash after the url protocol are invalid
4069 !! wikitext
4070 http:/example.com
4071
4072 [http:/example.com title]
4073 !! html
4074 <p>http:/example.com
4075 </p><p>[http:/example.com title]
4076 </p>
4077 !! end
4078
4079 !! test
4080 Bracketed external links with template-generated invalid target
4081 !! wikitext
4082 [{{echo|http:/example.com}} title]
4083 !! html
4084 <p>[http:/example.com title]
4085 </p>
4086 !! end
4087
4088 !! test
4089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4090 !! wikitext
4091 ''[http://example.com text'']
4092 [http://example.com '''text]'''
4093 ''Something [http://example.com in italic'']
4094 ''Something [http://example.com mixed''''', even bold]'''
4095 '''''Now [http://example.com both''''']
4096 !! html
4097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4102 </p>
4103 !! end
4104
4105
4106 !! test
4107 Bug 4781: %26 in URL
4108 !! wikitext
4109 http://www.example.com/?title=AT%26T
4110 !! html/php
4111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4112 </p>
4113 !! html/parsoid
4114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4115 !! end
4116
4117 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4118 # % is actually legal in HTML5. Any change in output would need testing though.
4119 !! test
4120 Bug 4781, 5267: %25 in URL
4121 !! wikitext
4122 http://www.example.com/?title=100%25_Bran
4123 !! html/php
4124 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
4125 </p>
4126 !! html/parsoid
4127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4128 !! end
4129
4130 !! test
4131 Bug 4781, 5267: %28, %29 in URL
4132 !! wikitext
4133 http://www.example.com/?title=Ben-Hur_%281959_film%29
4134 !! html/php
4135 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
4136 </p>
4137 !! html/parsoid
4138 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
4139 !! end
4140
4141
4142 !! test
4143 Bug 4781: %26 in autonumber URL
4144 !! wikitext
4145 [http://www.example.com/?title=AT%26T]
4146 !! html/php
4147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4148 </p>
4149 !! html/parsoid
4150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4151 !! end
4152
4153 !! test
4154 Bug 4781, 5267: %26 in autonumber URL
4155 !! wikitext
4156 [http://www.example.com/?title=100%25_Bran]
4157 !! html/php
4158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4159 </p>
4160 !! html/parsoid
4161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4162 !! end
4163
4164 !! test
4165 Bug 4781, 5267: %28, %29 in autonumber URL
4166 !! wikitext
4167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4168 !! html/php
4169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4170 </p>
4171 !! html/parsoid
4172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4173 !! end
4174
4175
4176 !! test
4177 Bug 4781: %26 in bracketed URL
4178 !! wikitext
4179 [http://www.example.com/?title=AT%26T link]
4180 !! html/php
4181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4182 </p>
4183 !! html/parsoid
4184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4185 !! end
4186
4187 !! test
4188 Bug 4781, 5267: %25 in bracketed URL
4189 !! wikitext
4190 [http://www.example.com/?title=100%25_Bran link]
4191 !! html
4192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4193 </p>
4194 !! end
4195
4196 !! test
4197 Bug 4781, 5267: %28, %29 in bracketed URL
4198 !! wikitext
4199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4200 !! html/php
4201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4205 !! end
4206
4207 !! test
4208 External link containing a period in the anchor. (bug 63947)
4209 !! wikitext
4210 [//foo.org/bar#baz. bang]
4211
4212 [//foo.org/bar. bang]
4213 !! html/php
4214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4216 </p>
4217 !! html/parsoid
4218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4220 !! end
4221
4222 !! test
4223 External link containing a single quote. (bug 63947)
4224 !! wikitext
4225 [//foo.org/bar'baz]
4226
4227 [//foo.org/bar'baz bang]
4228 !! html/php
4229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4231 </p>
4232 !! html/parsoid
4233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4235 !! end
4236
4237
4238 !! test
4239 External link containing a period in the anchor. (bug 63947)
4240 !! wikitext
4241 [//foo.org/bar#baz. bang]
4242
4243 [//foo.org/bar. bang]
4244 !! html/php
4245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4247 </p>
4248 !! html/parsoid
4249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4251 !! end
4252
4253 !! test
4254 External link containing a single quote. (bug 63947)
4255 !! wikitext
4256 [//foo.org/bar'baz]
4257
4258 [//foo.org/bar'baz bang]
4259 !! html/php
4260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4262 </p>
4263 !! html/parsoid
4264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4266 !! end
4267
4268
4269 !! test
4270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4271 !! wikitext
4272 Some [http://example.com/ pretty ''italics'' and stuff]!
4273 !! html
4274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4275 </p>
4276 !! end
4277
4278 !! test
4279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4280 !! wikitext
4281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4282 !! html
4283 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
4284 </p>
4285 !! end
4286
4287 !! test
4288 External link containing double-single-quotes with no space separating the url from text in italics
4289 !! wikitext
4290 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
4291 !! html/php
4292 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
4293 </p>
4294 !! html/parsoid
4295 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)">Museo Picasso</a><span>.</span></p>
4296 !! end
4297
4298 !! test
4299 External link with comments in link text
4300 !! wikitext
4301 [http://www.google.com Google <!-- comment -->]
4302 !! html
4303 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4304 </p>
4305 !! end
4306
4307 !! test
4308 URL-encoding in URL functions (single parameter)
4309 !! wikitext
4310 {{localurl:Some page|amp=&}}
4311 !! html
4312 <p>/index.php?title=Some_page&amp;amp=&amp;
4313 </p>
4314 !! end
4315
4316 !! test
4317 URL-encoding in URL functions (multiple parameters)
4318 !! wikitext
4319 {{localurl:Some page|q=?&amp=&}}
4320 !! html
4321 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4322 </p>
4323 !! end
4324
4325 !! test
4326 Brackets in urls
4327 !! wikitext
4328 http://example.com/index.php?foozoid%5B%5D=bar
4329
4330 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4331 !! html/php
4332 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4333 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
4334 </p>
4335 !! html/parsoid
4336 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
4337
4338 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4339 !! end
4340
4341 !! test
4342 IPv6 urls (bug 21261)
4343 !! options
4344 disabled
4345 !! wikitext
4346 http://[2404:130:0:1000::187:2]/index.php
4347 !! html
4348 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
4349 </p>
4350 !! end
4351
4352 !! test
4353 Non-extlinks in brackets
4354 !! wikitext
4355 [foo]
4356 [foo bar]
4357 [foo ''bar'']
4358 [fool's] errand
4359 [fool's errand]
4360 [{{echo|foo}}]
4361 [{{echo|foo}} bar]
4362 [{{echo|foo}} ''bar'']
4363 [{{echo|foo}}l's] errand
4364 [{{echo|foo}}l's errand]
4365 [url={{echo|foo}}]
4366 [url=http://example.com]
4367 !! html
4368 <p>[foo]
4369 [foo bar]
4370 [foo <i>bar</i>]
4371 [fool's] errand
4372 [fool's errand]
4373 [foo]
4374 [foo bar]
4375 [foo <i>bar</i>]
4376 [fool's] errand
4377 [fool's errand]
4378 [url=foo]
4379 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4380 </p>
4381 !! end
4382
4383 !! test
4384 Percent encoding in external links
4385 !! wikitext
4386 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4387 !! html/php
4388 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4389 </p>
4390 !! html/parsoid
4391 <p><a rel="mw:ExtLink"
4392 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4393 !! end
4394
4395 !! test
4396 Use url link syntax for links where the content is equal the link target
4397 !! wikitext
4398 http://example.com
4399 !! html/php
4400 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4401 </p>
4402 !! html/parsoid
4403 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4404 !! end
4405
4406 !! test
4407 Parenthesis in external links, especially URL links
4408 !! wikitext
4409 http://example.com)
4410
4411 http://example.com/test)
4412
4413 http://example.com/(test)
4414
4415 http://example.com/((test)
4416
4417 (http://example.com/(test))
4418
4419 (http://example.com/(test)))))
4420
4421 http://example.com/a)b
4422
4423 [http://example.com) foo]
4424 !! html/php
4425 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4426 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4427 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4428 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4429 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4430 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4431 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4432 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4433 </p>
4434 !! html/parsoid
4435 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4436 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4437 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4438 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4439 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4440 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4441 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4442 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4443 !! end
4444
4445 !! test
4446 Parenthesis in external links, w/ transclusion or comment
4447 !! wikitext
4448 (http://example.com/{{echo|hi}})
4449
4450 (http://example.com<!-- hi -->)
4451 !! html/php
4452 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4453 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4454 </p>
4455 !! html/parsoid
4456 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4457
4458 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
4459 !! end
4460
4461 ###
4462 ### Quotes
4463 ###
4464
4465 !! test
4466 Quotes
4467 !! wikitext
4468 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4469
4470 Normal text. '''''Bold italic text.''''' Normal text.
4471 !! html
4472 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4473 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4474 </p>
4475 !! end
4476
4477
4478 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4479 # parser strips. The wikitext contains just the first half of the bold
4480 # quote pair.
4481 !! test
4482 Unclosed and unmatched quotes
4483 !! wikitext
4484 '''''Bold italic text '''with bold deactivated''' in between.'''''
4485
4486 '''''Bold italic text ''with italic deactivated'' in between.'''''
4487
4488 '''Bold text..
4489
4490 ..spanning two paragraphs (should not work).'''
4491
4492 '''Bold tag left open
4493
4494 ''Italic tag left open
4495
4496 Normal text.
4497
4498 <!-- Unmatching number of opening, closing tags: -->
4499 '''This year''''s election ''should'' beat '''last year''''s.
4500
4501 ''Tom'''s car is bigger than ''Susan'''s.
4502
4503 Plain ''italic'''s plain
4504 !! html/php
4505 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4506 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4507 </p><p><b>Bold text..</b>
4508 </p><p>..spanning two paragraphs (should not work).
4509 </p><p><b>Bold tag left open</b>
4510 </p><p><i>Italic tag left open</i>
4511 </p><p>Normal text.
4512 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4513 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4514 </p><p>Plain <i>italic'</i>s plain
4515 </p>
4516 !! html/parsoid
4517 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4518 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4519 </p><p><b>Bold text..</b>
4520 </p><p>..spanning two paragraphs (should not work).<b></b>
4521 </p><p><b>Bold tag left open</b>
4522 </p><p><i>Italic tag left open</i>
4523 </p><p>Normal text.
4524 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4525 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4526 </p><p>Plain <i>italic'</i>s plain
4527 </p>
4528 !! end
4529
4530 ###
4531 ### Tables
4532 ###
4533 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4534 ###
4535
4536 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4537 # is the bare minimum required by the spec, see:
4538 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4539 # Parsoid team replies: empty table tags are legal in HTML5
4540 !! test
4541 A table with no data.
4542 !! options
4543 parsoid=wt2html
4544 !! wikitext
4545 {||}
4546 !! html/php
4547
4548 !! html/parsoid
4549 <table></table>
4550
4551 !! end
4552
4553 !! test
4554 A table with stray table end tags on start tag line (wt2html)
4555 !! options
4556 parsoid=wt2html
4557 !! wikitext
4558 {|style="color: red;"|}
4559
4560 {|style="color: red;" |}
4561 |foo
4562 |}
4563
4564 {|style="color: red;"|} id="foo"
4565 |foo
4566 |}
4567
4568 {|style="color: red;" |} id="foo"
4569 |foo
4570 |}
4571 !! html
4572 <table style="color: red;"></table>
4573
4574 <table style="color: red;">
4575 <tbody><tr>
4576 <td>foo</td>
4577 </tr></tbody>
4578 </table>
4579
4580 <table style="color: red;" id="foo">
4581 <tbody><tr>
4582 <td>foo</td>
4583 </tr></tbody>
4584 </table>
4585
4586 <table style="color: red;" id="foo">
4587 <tbody><tr>
4588 <td>foo</td>
4589 </tr></tbody>
4590 </table>
4591
4592 !! end
4593
4594 !! test
4595 A table with no data (take 2)
4596 !! wikitext
4597 {|
4598 |}
4599 !! html/parsoid
4600 <table></table>
4601 !! end
4602
4603 # A table with nothing but a caption is invalid XHTML, we might want to render
4604 # this as <p>caption</p>
4605 # Parsoid team replies: table with only a caption is legal in HTML5
4606 !! test
4607 A table with nothing but a caption
4608 !! wikitext
4609 {|
4610 |+ caption
4611 |}
4612 !! html/php
4613 <table>
4614 <caption> caption
4615 </caption><tr><td></td></tr></table>
4616
4617 !! html/parsoid
4618 <table><caption> caption</caption></table>
4619 !! end
4620
4621 !! test
4622 A table with caption with default-spaced attributes and a table row
4623 !! wikitext
4624 {|
4625 |+ style="color: red;" | caption1
4626 |-
4627 | foo
4628 |}
4629 !! html
4630 <table>
4631 <caption style="color: red;"> caption1
4632 </caption>
4633 <tr>
4634 <td> foo
4635 </td></tr></table>
4636
4637 !! end
4638
4639 !! test
4640 A table with captions with non-default spaced attributes and a table row
4641 !! wikitext
4642 {|
4643 |+style="color: red;"|caption2
4644 |+ style="color: red;"| caption3
4645 |-
4646 | foo
4647 |}
4648 !! html
4649 <table>
4650 <caption style="color: red;">caption2
4651 </caption>
4652 <caption style="color: red;"> caption3
4653 </caption>
4654 <tr>
4655 <td> foo
4656 </td></tr></table>
4657
4658 !! end
4659
4660 !! test
4661 Table td-cell syntax variations
4662 !! wikitext
4663 {|
4664 | foo bar foo | baz
4665 | foo bar foo || baz
4666 | style='color:red;' | baz
4667 | style='color:red;' || baz
4668 |}
4669 !! html
4670 <table>
4671 <tr>
4672 <td> baz
4673 </td>
4674 <td> foo bar foo </td>
4675 <td> baz
4676 </td>
4677 <td style="color:red;"> baz
4678 </td>
4679 <td> style='color:red;' </td>
4680 <td> baz
4681 </td></tr></table>
4682
4683 !! end
4684
4685 !! test
4686 Simple table
4687 !! wikitext
4688 {|
4689 | 1 || 2
4690 |-
4691 | 3 || 4
4692 |}
4693 !! html
4694 <table>
4695 <tr>
4696 <td> 1 </td>
4697 <td> 2
4698 </td></tr>
4699 <tr>
4700 <td> 3 </td>
4701 <td> 4
4702 </td></tr></table>
4703
4704 !! end
4705
4706 !! test
4707 Simple table but with multiple dashes for row wikitext
4708 !! wikitext
4709 {|
4710 | foo
4711 |-----
4712 | bar
4713 |}
4714 !! html
4715 <table>
4716 <tr>
4717 <td> foo
4718 </td></tr>
4719 <tr>
4720 <td> bar
4721 </td></tr></table>
4722
4723 !! end
4724 !! test
4725 Multiplication table
4726 !! wikitext
4727 {| border="1" cellpadding="2"
4728 |+Multiplication table
4729 |-
4730 ! &times; !! 1 !! 2 !! 3
4731 |-
4732 ! 1
4733 | 1 || 2 || 3
4734 |-
4735 ! 2
4736 | 2 || 4 || 6
4737 |-
4738 ! 3
4739 | 3 || 6 || 9
4740 |-
4741 ! 4
4742 | 4 || 8 || 12
4743 |-
4744 ! 5
4745 | 5 || 10 || 15
4746 |}
4747 !! html
4748 <table border="1" cellpadding="2">
4749 <caption>Multiplication table
4750 </caption>
4751 <tr>
4752 <th> &#215; </th>
4753 <th> 1 </th>
4754 <th> 2 </th>
4755 <th> 3
4756 </th></tr>
4757 <tr>
4758 <th> 1
4759 </th>
4760 <td> 1 </td>
4761 <td> 2 </td>
4762 <td> 3
4763 </td></tr>
4764 <tr>
4765 <th> 2
4766 </th>
4767 <td> 2 </td>
4768 <td> 4 </td>
4769 <td> 6
4770 </td></tr>
4771 <tr>
4772 <th> 3
4773 </th>
4774 <td> 3 </td>
4775 <td> 6 </td>
4776 <td> 9
4777 </td></tr>
4778 <tr>
4779 <th> 4
4780 </th>
4781 <td> 4 </td>
4782 <td> 8 </td>
4783 <td> 12
4784 </td></tr>
4785 <tr>
4786 <th> 5
4787 </th>
4788 <td> 5 </td>
4789 <td> 10 </td>
4790 <td> 15
4791 </td></tr></table>
4792
4793 !! end
4794
4795 !! test
4796 Accept "||" in table headings
4797 !! wikitext
4798 {|
4799 !h1 || h2
4800 |}
4801 !! html
4802 <table>
4803 <tr>
4804 <th>h1 </th>
4805 <th> h2
4806 </th></tr></table>
4807
4808 !! end
4809
4810 !! test
4811 Accept "!!" in table data
4812 !! wikitext
4813 {|
4814 | Foo!! ||
4815 |}
4816 !! html/parsoid
4817 <table data-parsoid='{}'>
4818 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
4819 </tbody></table>
4820 !! end
4821
4822 !! test
4823 Accept "||" in indented table headings
4824 !! wikitext
4825 :{|
4826 !h1 || h2
4827 |}
4828 !! html
4829 <dl><dd><table>
4830 <tr>
4831 <th>h1 </th>
4832 <th> h2
4833 </th></tr></table></dd></dl>
4834
4835 !! end
4836
4837 !! test
4838 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4839 !! wikitext
4840 {|
4841 !| h1
4842 || a
4843 |}
4844 !! html
4845 <table>
4846 <tr>
4847 <th> h1
4848 </th>
4849 <td> a
4850 </td></tr></table>
4851
4852 !! end
4853
4854 !!test
4855 Accept "| !" at start of line in tables (ignore !-attribute)
4856 !! wikitext
4857 {|
4858 |-
4859 | !style="color:red" | bar
4860 |}
4861 !! html
4862 <table>
4863
4864 <tr>
4865 <td> bar
4866 </td></tr></table>
4867
4868 !!end
4869
4870 !!test
4871 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
4872 !! wikitext
4873 {|
4874 |-
4875 |style='color:red;'|+1
4876 |style='color:blue;'|-1
4877 |-
4878 | 1 || 2 || 3
4879 | 1 ||+2 ||-3
4880 |-
4881 | +1
4882 | -1
4883 |}
4884 !! html
4885 <table>
4886
4887 <tr>
4888 <td style="color:red;">+1
4889 </td>
4890 <td style="color:blue;">-1
4891 </td></tr>
4892 <tr>
4893 <td> 1 </td>
4894 <td> 2 </td>
4895 <td> 3
4896 </td>
4897 <td> 1 </td>
4898 <td>+2 </td>
4899 <td>-3
4900 </td></tr>
4901 <tr>
4902 <td> +1
4903 </td>
4904 <td> -1
4905 </td></tr></table>
4906
4907 !!end
4908
4909 !! test
4910 Table rowspan
4911 !! wikitext
4912 {| border=1
4913 | Cell 1, row 1
4914 |rowspan=2| Cell 2, row 1 (and 2)
4915 | Cell 3, row 1
4916 |-
4917 | Cell 1, row 2
4918 | Cell 3, row 2
4919 |}
4920 !! html
4921 <table border="1">
4922 <tr>
4923 <td> Cell 1, row 1
4924 </td>
4925 <td rowspan="2"> Cell 2, row 1 (and 2)
4926 </td>
4927 <td> Cell 3, row 1
4928 </td></tr>
4929 <tr>
4930 <td> Cell 1, row 2
4931 </td>
4932 <td> Cell 3, row 2
4933 </td></tr></table>
4934
4935 !! end
4936
4937 !! test
4938 Nested table
4939 !! wikitext
4940 {| border=1
4941 | &alpha;
4942 |
4943 {| bgcolor=#ABCDEF border=2
4944 |nested
4945 |-
4946 |table
4947 |}
4948 |the original table again
4949 |}
4950 !! html
4951 <table border="1">
4952 <tr>
4953 <td> &#945;
4954 </td>
4955 <td>
4956 <table bgcolor="#ABCDEF" border="2">
4957 <tr>
4958 <td>nested
4959 </td></tr>
4960 <tr>
4961 <td>table
4962 </td></tr></table>
4963 </td>
4964 <td>the original table again
4965 </td></tr></table>
4966
4967 !! end
4968
4969 !! test
4970 Invalid attributes in table cell (bug 1830)
4971 !! wikitext
4972 {|
4973 |Cell:|broken
4974 |}
4975 !! html
4976 <table>
4977 <tr>
4978 <td>broken
4979 </td></tr></table>
4980
4981 !! end
4982
4983
4984 # The "|}" to close the table is missing from the input, so parsoid's
4985 # *2wt modes will fail.
4986 !! test
4987 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4988 !! options
4989 parsoid=wt2html,html2html
4990 !! wikitext
4991 {|
4992 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4993 !! html/php
4994 <table>
4995 <tr>
4996 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4997 <td>]" onmouseover="alert(document.cookie)"&gt;test
4998 </td>
4999 </tr>
5000 </table>
5001
5002 !! html/parsoid
5003 <table><tbody>
5004 <tr>
5005 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5006 !! end
5007
5008
5009 !! test
5010 Indented table markup mixed with indented pre content (proposed in bug 6200)
5011 !! wikitext
5012 <table>
5013 <tr>
5014 <td>
5015 Text that should be rendered preformatted
5016 </td>
5017 </tr>
5018 </table>
5019 !! html
5020 <table>
5021 <tr>
5022 <td>
5023 <pre>Text that should be rendered preformatted
5024 </pre>
5025 </td>
5026 </tr>
5027 </table>
5028
5029 !! end
5030
5031 !! test
5032 Template-generated table cell attributes and cell content
5033 !! wikitext
5034 {|
5035 |{{table_attribs}}
5036 | {{table_attribs}}
5037 |}
5038 !! html
5039 <table>
5040 <tr>
5041 <td style="color: red"> Foo
5042 </td>
5043 <td style="color: red"> Foo
5044 </td></tr></table>
5045
5046 !! end
5047
5048 !! test
5049 Template-generated table cell attributes and cell content (2)
5050 !! wikitext
5051 {|
5052 |align=center {{table_attribs}}
5053 |}
5054 !! html
5055 <table>
5056 <tr>
5057 <td align="center" style="color: red"> Foo
5058 </td></tr></table>
5059
5060 !! end
5061
5062 !! test
5063 Template-generated table cell attributes and cell content (3)
5064 !! wikitext
5065 {|
5066 |align=center {{table_cells}}
5067 |}
5068 !! html
5069 <table>
5070 <tr>
5071 <td align="center" style="color: red"> Foo </td>
5072 <td> Bar </td>
5073 <td> Baz
5074 </td></tr></table>
5075
5076 !! end
5077
5078 !! test
5079 Table with row followed by newlines and table heading
5080 !! wikitext
5081 {|
5082 |-
5083
5084 ! foo
5085 |}
5086 !! html
5087 <table>
5088
5089
5090 <tr>
5091 <th> foo
5092 </th></tr></table>
5093
5094 !! end
5095
5096 !! test
5097 Table with empty line following the start tag
5098 !! wikitext
5099 {|
5100
5101 |-
5102 | foo
5103 |}
5104 !! html
5105 <table>
5106
5107
5108 <tr>
5109 <td> foo
5110 </td></tr></table>
5111
5112 !! end
5113
5114 # FIXME: Preserve the attribute properly (with an empty string as value) in
5115 # the PHP parser. Parsoid implements the behavior below.
5116 !! test
5117 Table attributes with empty value
5118 !! wikitext
5119 {|
5120 | style=| hello
5121 |}
5122 !! html/parsoid
5123 <table>
5124 <tbody>
5125 <tr>
5126 <td style=""> hello
5127 </td></tr></tbody></table>
5128
5129 !! end
5130
5131 !! test
5132 Wikitext table with a lot of comments
5133 !! wikitext
5134 {|
5135 <!-- c0 -->
5136 | foo
5137 <!-- c1 -->
5138 |- <!-- c2 -->
5139 <!-- c3 -->
5140 |<!-- c4 -->
5141 <!-- c5 -->
5142 |}
5143 !! html
5144 <table>
5145 <tr>
5146 <td> foo
5147 </td></tr>
5148 <tr>
5149 <td>
5150 </td></tr></table>
5151
5152 !! end
5153
5154 !! test
5155 Wikitext table with double-line table cell
5156 !! wikitext
5157 {|
5158 |a
5159 b
5160 |}
5161 !! html
5162 <table>
5163 <tr>
5164 <td>a
5165 <p>b
5166 </p>
5167 </td></tr></table>
5168
5169 !! end
5170
5171 !! test
5172 Table cell with a single comment
5173 !! wikitext
5174 {|
5175 | <!-- c1 -->
5176 | a
5177 |}
5178 !! html
5179 <table>
5180 <tr>
5181 <td>
5182 </td>
5183 <td> a
5184 </td></tr></table>
5185
5186 !! end
5187
5188 # The expected HTML structure in this test is debatable. The PHP parser does
5189 # not parse this kind of table at all. The main focus for Parsoid is on
5190 # round-tripping, so this output is ok for now. TODO: revisit!
5191 !! test
5192 Wikitext table with html-syntax row
5193 !! wikitext
5194 {|
5195 |-
5196 <td>foo</td>
5197 |}
5198 !! html/parsoid
5199 <table>
5200 <tbody>
5201 <tr>
5202 <td>foo</td></tr></tbody></table>
5203 !! end
5204
5205 !! test
5206 Implicit <td> after a |-
5207 (PHP parser relies on Tidy to add the missing <td> tags)
5208 !! options
5209 parsoid=wt2html,wt2wt
5210 !! wikitext
5211 {|
5212 |-
5213 a
5214 |}
5215 !! html
5216 <table>
5217 <tr><td>a</td></tr>
5218 </table>
5219 !! end
5220
5221 !! test
5222 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5223 (PHP parser relies on Tidy to add the missing <td> tags)
5224 !! options
5225 parsoid=wt2html,wt2wt
5226 !! wikitext
5227 {|
5228 |-
5229 |
5230 a
5231 |-
5232 b
5233 |}
5234 !! html
5235 <table>
5236 <tbody>
5237 <tr><td><pre>a</pre></td></tr>
5238 <tr><td> b</td></tr>
5239 </tbody>
5240 </table>
5241 !! end
5242
5243 !! test
5244 Lists should be recognized in an implicit <td> context
5245 (PHP parser relies on Tidy to add the missing <td> tags)
5246 !! options
5247 parsoid=wt2html,wt2wt
5248 !! wikitext
5249 {|
5250 |-
5251 *a
5252 |}
5253 !! html
5254 <table>
5255 <tr>
5256 <td><ul>
5257 <li>a</li>
5258 </ul></td>
5259 </tr>
5260 </table>
5261 !! end
5262
5263 !! test
5264 Parsoid: Round-trip tables directly followed by content (bug 51219)
5265 !! options
5266 parsoid=wt2html,wt2wt
5267 !! wikitext
5268 {|
5269 |foo
5270 |} bar
5271
5272 {|
5273 |baz
5274 |}<b>quux</b>
5275 !! html
5276 <table><tbody>
5277 <tr>
5278 <td>foo</td></tr></tbody></table> bar
5279 <table>
5280 <tbody>
5281 <tr>
5282 <td>baz</td></tr></tbody></table><b>quux</b>
5283 !! end
5284
5285 !! test
5286 Parsoid: Default to a newline after tables in new content (bug 51219)
5287 !! options
5288 parsoid=html2wt
5289 !! wikitext
5290 {|
5291 |foo
5292 |}
5293 <nowiki> </nowiki>bar
5294 {|
5295 |baz
5296 |}
5297 '''quux'''
5298 !! html
5299 <table><tbody>
5300 <tr><td>foo</td></tr></tbody></table> bar
5301 <table><tbody>
5302 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5303 !! end
5304
5305 !! test
5306 Parsoid: newline inducing block nodes don't suppress <nowiki>
5307 !! options
5308 parsoid=html2wt
5309 !! wikitext
5310 <nowiki> </nowiki>a
5311
5312 = foo =
5313 !! html
5314 a<h1>foo</h1>
5315 !! end
5316
5317 !! test
5318 Parsoid: Row-syntax table headings followed by comment & table cells
5319 !! options
5320 parsoid=wt2html,wt2wt
5321 !! wikitext
5322 {|
5323 ! foo || bar
5324 <!-- foo --> || baz || quux
5325 |}
5326 !! html/parsoid
5327 <table>
5328 <tbody>
5329 <tr><th>foo </th><th>bar </th>
5330 <td>baz </td>
5331 <td>quux</td></tr></tbody></table>
5332 !! end
5333
5334
5335 !!test
5336 Parsoid: Recover better from broken table attributes
5337 !!options
5338 parsoid=wt2html
5339 !!wikitext
5340 {| class="foo
5341 | class="bar" |
5342 foo
5343 |}
5344 !!html/parsoid
5345 <table class="foo">
5346 <tr>
5347 <td class="bar">
5348 <p>foo</p></td></tr>
5349 </tbody></table>
5350 !!end
5351
5352 ###
5353 ### Internal links
5354 ###
5355 !! test
5356 Plain link, capitalized
5357 !! wikitext
5358 [[Main Page]]
5359 !! html
5360 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5361 </p>
5362 !! end
5363
5364 !! test
5365 Plain link, uncapitalized
5366 !! wikitext
5367 [[main Page]]
5368 !! html
5369 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5370 </p>
5371 !! end
5372
5373 !! test
5374 Piped link
5375 !! wikitext
5376 [[Main Page|The Main Page]]
5377 !! html
5378 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5379 </p>
5380 !! end
5381
5382 !! test
5383 Piped link with comment in link text
5384 !! wikitext
5385 [[Main Page|The Main<!--front--> Page]]
5386 !! html
5387 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5388 </p>
5389 !! end
5390
5391 !! test
5392 Piped link with multiple pipe characters in link text
5393 !! wikitext
5394 [[Main Page||The|Main|Page|]]
5395 !! html/php
5396 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5397 </p>
5398 !! html/parsoid
5399 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5400 !! end
5401
5402 !! test
5403 Broken link
5404 !! wikitext
5405 [[Zigzagzogzagzig]]
5406 !! html
5407 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5408 </p>
5409 !! end
5410
5411 !! test
5412 Broken link with fragment
5413 !! wikitext
5414 [[Zigzagzogzagzig#zug]]
5415 !! html
5416 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5417 </p>
5418 !! end
5419
5420 !! test
5421 Special page link with fragment
5422 !! wikitext
5423 [[Special:Version#anchor]]
5424 !! html
5425 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5426 </p>
5427 !! end
5428
5429 !! test
5430 Nonexistent special page link with fragment
5431 !! wikitext
5432 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5433 !! html
5434 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5435 </p>
5436 !! end
5437
5438 !! test
5439 Link with prefix
5440 !! wikitext
5441 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5442 !! html
5443 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5444 </p>
5445 !! end
5446
5447 !! test
5448 Link with suffix
5449 !! wikitext
5450 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5451 !! html
5452 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
5453 </p>
5454 !! end
5455
5456 !! article
5457 prefixed article
5458 !! text
5459 Some text
5460 !! endarticle
5461
5462 !! test
5463 Bug 43661: Piped links with identical prefixes
5464 !! wikitext
5465 [[prefixed article|prefixed articles with spaces]]
5466
5467 [[prefixed article|prefixed articlesaoeu]]
5468
5469 [[Main Page|Main Page test]]
5470 !! html
5471 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5472 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5473 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5474 </p>
5475 !! end
5476
5477
5478 !! test
5479 Link with HTML entity in suffix / tail
5480 !! wikitext
5481 [[Main Page]]&quot;, [[Main Page]]&#97;
5482 !! html
5483 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
5484 </p>
5485 !! end
5486
5487 !! test
5488 Link with 3 brackets
5489 !! wikitext
5490 [[[Main Page]]]
5491 !! html
5492 <p>[[[Main Page]]]
5493 </p>
5494 !! end
5495
5496 !! test
5497 Link with 4 brackets
5498 !! wikitext
5499 [[[[Main Page]]]]
5500 !! html
5501 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5502 </p>
5503 !! end
5504
5505 !! test
5506 Piped link with 3 brackets
5507 !! wikitext
5508 [[[main page|the main page]]]
5509 !! html
5510 <p>[[[main page|the main page]]]
5511 </p>
5512 !! end
5513
5514 !! test
5515 Piped link with extlink-like text
5516 !! wikitext
5517 [[Main Page|[bar]]]
5518 [[Main Page|This is a [bar]]]
5519 !! html
5520 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5521 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5522 </p>
5523 !! end
5524
5525 !! test
5526 Link with multiple pipes
5527 !! wikitext
5528 [[Main Page|The|Main|Page]]
5529 !! html
5530 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5531 </p>
5532 !! end
5533
5534 # Note that parsoid does not munge anchor text; all non-space
5535 # characters are valid in HTML5 ids.
5536 !! test
5537 Anchor containing a #. (bug 63430)
5538 !! wikitext
5539 [[Main Page#And#Link]]
5540 !! html/php
5541 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5542 </p>
5543 !! html/parsoid
5544 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5545 !! end
5546
5547 !! test
5548 Link to namespaces
5549 !! wikitext
5550 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5551 !! html
5552 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
5553 </p>
5554 !! end
5555
5556 !! test
5557 Link with space in namespace
5558 !! wikitext
5559 [[User talk:Foo bar]]
5560 !! html
5561 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
5562 </p>
5563 !! end
5564
5565 !! article
5566 MemoryAlpha:AlphaTest
5567 !! text
5568 This is an article in the MemoryAlpha namespace
5569 (which shadows the memoryalpha interwiki link).
5570 !! endarticle
5571
5572 !! test
5573 Namespace takes precedence over interwiki link (bug 51680)
5574 !! wikitext
5575 [[MemoryAlpha:AlphaTest]]
5576 !! html
5577 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5578 </p>
5579 !! end
5580
5581 # The previous test doesn't work correctly in html2*, due to not recognizing the
5582 # link as an internal one. This one checks for the correct behavior.
5583 !! test
5584 Link to namespace preferred over interwiki with correct rel attribute
5585 !! options
5586 parsoid=html2wt,html2html
5587 !! wikitext
5588 [[MemoryAlpha:AlphaTest]]
5589 !! html
5590 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5591 </p>
5592 !! end
5593
5594 !! test
5595 Piped link to namespace
5596 !! wikitext
5597 [[Meta:Disclaimers|The disclaimers]]
5598 !! html
5599 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
5600 </p>
5601 !! end
5602
5603 !! test
5604 Link containing }
5605 !! wikitext
5606 [[Usually caused by a typo (oops}]]
5607 !! html
5608 <p>[[Usually caused by a typo (oops}]]
5609 </p>
5610 !! end
5611
5612 !! article
5613 7% Solution
5614 !! text
5615 Just a test of an article title containing a percent.
5616 !! endarticle
5617
5618 !! test
5619 Link containing % (not as a hex sequence)
5620 !! wikitext
5621 [[7% Solution]]
5622 !! html/php
5623 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5624 </p>
5625 !! html/parsoid
5626 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5627 !! end
5628
5629 # note that the parsoid HTML is identical to the previous test output,
5630 # so the previous test ensures that the html2wt mode will generate the
5631 # "not as a hex sequence" wikitext.
5632 !! test
5633 Link containing % as a single hex sequence interpreted to char
5634 !! options
5635 parsoid=wt2wt,wt2html,html2html
5636 !! wikitext
5637 [[7%25 Solution]]
5638 !! html/php
5639 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5640 </p>
5641 !! html/parsoid
5642 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5643 !!end
5644
5645 !! test
5646 Link containing % as a double hex sequence interpreted to hex sequence
5647 !! wikitext
5648 [[7%2525 Solution]]
5649 !! html
5650 <p>[[7%2525 Solution]]
5651 </p>
5652 !!end
5653
5654 # note that parsoid does not munge anchor text; all non-space
5655 # characters are valid in HTML5 anchors.
5656 !! test
5657 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5658 Example for such a section: == < ==
5659 !! wikitext
5660 [[%23%3c]][[%23%3e]]
5661 !! html/php
5662 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5663 </p>
5664 !! html/parsoid
5665 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5666 !! end
5667
5668 !! test
5669 Link containing "<#" and ">#" as a hex sequences
5670 !! wikitext
5671 [[%3c%23]][[%3e%23]]
5672 !! html
5673 <p>[[%3c%23]][[%3e%23]]
5674 </p>
5675 !! end
5676
5677 !! test
5678 Link containing an equals sign
5679 !! wikitext
5680 [[Special:BookSources/isbn=4-00-026157-6]]
5681 !! html/php
5682 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
5683 </p>
5684 !! html/parsoid
5685 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5686 !! end
5687
5688 !! article
5689 Foo~bar
5690 !! text
5691 Just a test of an article title containing a tilde.
5692 !! endarticle
5693
5694 # note that links containing signatures, like [[Foo~~~~]], are
5695 # massaged by the pre-save transform (PST) and so the tildes are never
5696 # seen by the parser.
5697 !! test
5698 Link containing a tilde
5699 !! wikitext
5700 [[Foo~bar]]
5701 !! html/php
5702 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5703 </p>
5704 !! html/parsoid
5705 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5706 !! end
5707
5708 !! test
5709 Link containing double-single-quotes '' (bug 4598)
5710 !! wikitext
5711 [[Lista d''e paise d''o munno]]
5712 !! html/php
5713 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
5714 </p>
5715 !! html/parsoid
5716 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5717 !! end
5718
5719 !! test
5720 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5721 !! wikitext
5722 Some [[Link|pretty ''italics'' and stuff]]!
5723 !! html/php
5724 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
5725 </p>
5726 !! html/parsoid
5727 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5728 !! end
5729
5730 !! test
5731 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5732 !! wikitext
5733 ''Some [[Link|pretty ''italics'' and stuff]]!''
5734 !! html
5735 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
5736 </p>
5737 !! end
5738
5739 !! test
5740 Link with double quotes in title part (literal) and alternate part (interpreted)
5741 !! wikitext
5742 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5743
5744 [[''Pentecoste'']]
5745
5746 [[''Pentecoste''|Pentecoste]]
5747
5748 [[''Pentecoste''|''Pentecoste'']]
5749 !! html/php
5750 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
5751 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
5752 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
5753 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
5754 </p>
5755 !! html/parsoid
5756 <meta typeof="mw:Placeholder"/>
5757 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5758 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5759 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5760 !! end
5761
5762 !! test
5763 Broken image links with HTML captions (bug 39700)
5764 !! wikitext
5765 [[File:Nonexistent|<script></script>]]
5766 [[File:Nonexistent|100px|<script></script>]]
5767 [[File:Nonexistent|&lt;]]
5768 [[File:Nonexistent|a<i>b</i>c]]
5769 !! html
5770 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5771 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5772 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5773 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5774 </p>
5775 !! end
5776
5777 !! test
5778 Plain link to URL
5779 !! wikitext
5780 [[http://www.example.com]]
5781 !! html/php
5782 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5783 </p>
5784 !! html/parsoid
5785 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5786 !! end
5787
5788 !! test
5789 Plain link to URL with link text
5790 !! wikitext
5791 [[http://www.example.com Link text]]
5792 !! html
5793 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5794 </p>
5795 !! end
5796
5797 !! test
5798 Plain link to protocol-relative URL
5799 !! wikitext
5800 [[//www.example.com]]
5801 !! html/php
5802 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5803 </p>
5804 !! html/parsoid
5805 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5806 !! end
5807
5808 !! test
5809 Plain link to protocol-relative URL with link text
5810 !! wikitext
5811 [[//www.example.com Link text]]
5812 !! html
5813 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5814 </p>
5815 !! end
5816
5817 !! test
5818 Plain link to page with question mark in title
5819 !! wikitext
5820 [[A?b]]
5821
5822 [[A?b|Baz]]
5823 !! html
5824 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5825 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5826 </p>
5827 !! end
5828
5829
5830 # I'm fairly sure the expected result here is wrong.
5831 # We want these to be URL links, not pseudo-pages with URLs for titles....
5832 # However the current output is also pretty screwy.
5833 #
5834 # ----
5835 # I'm changing it to match the current output--it arguably makes more
5836 # sense in the light of the test above. Old expected result was:
5837 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5838 #</p>
5839 # But I think this test is bordering on "garbage in, garbage out" anyway.
5840 # -- wtm
5841 !! test
5842 Piped link to URL
5843 !! wikitext
5844 Piped link to URL: [[http://www.example.com|an example URL]]
5845 !! html/php
5846 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5847 </p>
5848 !! html/parsoid
5849 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5850 !! end
5851
5852 !! test
5853 BUG 2: [[page|http://url/]] should link to page, not http://url/
5854 !! wikitext
5855 [[Main Page|http://url/]]
5856 !! html/php
5857 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5858 </p>
5859 !! html/parsoid
5860 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5861 !! end
5862
5863 # Parsoid does not mark self-links, by design.
5864 !! test
5865 BUG 337: Escaped self-links should be bold
5866 !! options
5867 title=[[Bug462]]
5868 !! wikitext
5869 [[Bu&#103;462]] [[Bug462]]
5870 !! html/php
5871 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5872 </p>
5873 !! html/parsoid
5874 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
5875 !! end
5876
5877 !! test
5878 Self-link to section should not be bold
5879 !! options
5880 title=[[Main Page]]
5881 !! wikitext
5882 [[Main Page#section]]
5883 !! html
5884 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5885 </p>
5886 !! end
5887
5888 !! article
5889 00
5890 !! text
5891 This is 00.
5892 !! endarticle
5893
5894 !!test
5895 Self-link to numeric title
5896 !!options
5897 title=[[0]]
5898 !! wikitext
5899 [[0]]
5900 !! html
5901 <p><strong class="selflink">0</strong>
5902 </p>
5903 !!end
5904
5905 !!test
5906 Link to numeric-equivalent title
5907 !!options
5908 title=[[0]]
5909 !! wikitext
5910 [[00]]
5911 !! html
5912 <p><a href="/wiki/00" title="00">00</a>
5913 </p>
5914 !!end
5915
5916 !! test
5917 <nowiki> inside a link
5918 !! wikitext
5919 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5920 !! html
5921 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5922 </p>
5923 !! end
5924
5925 !! test
5926 Non-breaking spaces in title
5927 !! wikitext
5928 [[&nbsp; Main &nbsp; Page &nbsp;]]
5929 !! html
5930 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5931 </p>
5932 !!end
5933
5934 !! test
5935 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5936 !! options
5937 language=ca
5938 !! wikitext
5939 '''[[Main Page]]'''
5940 !! html
5941 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5942 </p>
5943 !! end
5944
5945 !! test
5946 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5947 !! options
5948 language=ca
5949 !! wikitext
5950 ''[[Main Page]]''
5951 !! html
5952 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5953 </p>
5954 !! end
5955
5956 !! test
5957 Internal link with en linktrail: no apostrophes (bug 27473)
5958 !! options
5959 language=en
5960 !! wikitext
5961 [[Something]]'nice
5962 !! html
5963 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5964 </p>
5965 !! end
5966
5967 !! test
5968 Internal link with ca linktrail with apostrophes (bug 27473)
5969 !! options
5970 language=ca
5971 !! wikitext
5972 [[Something]]'nice
5973 !! html
5974 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5975 </p>
5976 !! end
5977
5978 !! test
5979 Internal link with kaa linktrail with apostrophes (bug 27473)
5980 !! options
5981 language=kaa
5982 !! wikitext
5983 [[Something]]'nice
5984 !! html
5985 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
5986 </p>
5987 !! end
5988
5989 !! test
5990 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
5991 !! wikitext
5992 [[User:Foo/Test/63636:Bar|Test]]
5993 !! html/php
5994 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
5995 </p>
5996 !! html/parsoid
5997 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
5998 !! end
5999
6000 !! test
6001 1. Interaction of linktrail and template encapsulation
6002 !! options
6003 parsoid
6004 !! wikitext
6005 {{echo|[[Foo]]}}l
6006 !! html
6007 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6008 !! end
6009
6010 !! test
6011 2. Interaction of linktrail and template encapsulation
6012 !! options
6013 parsoid
6014 !! wikitext
6015 {{echo|Some [[Fool]]}}s
6016 !! html
6017 <p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6018 !! end
6019
6020 !! test
6021 3. Interaction of linktrail and template encapsulation
6022 !! options
6023 parsoid
6024 !! wikitext
6025 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6026 !! html
6027 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
6028 !! end
6029
6030 !! article
6031 Söfnuður
6032 !! text
6033 Test.
6034 !! endarticle
6035
6036 !! test
6037 Internal link with is link prefix
6038 !! options
6039 language=is
6040 !! wikitext
6041 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6042 !! html
6043 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6044 </p>
6045 !! end
6046
6047 !! article
6048 Mótmælendatrú
6049 !! text
6050 Test.
6051 !! endarticle
6052
6053 !! test
6054 Internal link with is link trail and link prefix
6055 !! options
6056 language=is
6057 !! wikitext
6058 [[mótmælendatrú|xxx]]ar
6059 [[mótmælendatrú]]ar
6060 mótmælenda[[söfnuður]]
6061 mótmælenda[[söfnuður|söfnuðir]]
6062 mótmælenda[[söfnuður|söfnuðir]]xxx
6063 !! html
6064 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6065 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6066 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6067 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6068 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6069 </p>
6070 !! end
6071
6072 !! test
6073 Parsoid link trail escaping
6074 !! options
6075 parsoid=html2wt,html2html
6076 !! wikitext
6077 [[apple]]<nowiki/>s
6078 !! html
6079 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6080 !! end
6081
6082 !! test
6083 Parsoid link prefix escaping
6084 !! options
6085 language=is
6086 parsoid=html2wt,html2html
6087 !! wikitext
6088 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6089 !! html
6090 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6091 !! end
6092
6093 !! test
6094 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6095 !! wikitext
6096 [[Foo| bar]]
6097
6098 [[Foo| ''bar'']]
6099
6100 [http://wp.org foo]
6101
6102 [http://wp.org ''foo'']
6103 !! html
6104 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6105 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
6106 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6107 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6108 </p>
6109 !! end
6110
6111 !! test
6112 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6113 !! options
6114 parsoid
6115 !! wikitext
6116 [[Foo|{{echo|a}} b {{echo|c}}]]
6117 !! html
6118 <p><a rel="mw:WikiLink" href="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
6119 !! end
6120
6121 !! test
6122 Link with angle bracket after anchor
6123 !! wikitext
6124 [[Foo#<bar>]]
6125 !! html/parsoid
6126 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6127 !! end
6128
6129 ###
6130 ### Interwiki links (see maintenance/interwiki.sql)
6131 ###
6132
6133 !! test
6134 Inline interwiki link
6135 !! wikitext
6136 [[MeatBall:SoftSecurity]]
6137 !! html
6138 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6139 </p>
6140 !! end
6141
6142 !! test
6143 Inline interwiki link with empty title (bug 2372)
6144 !! wikitext
6145 [[MeatBall:]]
6146 !! html
6147 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6148 </p>
6149 !! end
6150
6151 !! test
6152 Interwiki link encoding conversion (bug 1636)
6153 !! wikitext
6154 *[[Wikipedia:ro:Olteni&#0355;a]]
6155 *[[Wikipedia:ro:Olteni&#355;a]]
6156 !! html
6157 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
6158 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
6159
6160 !! end
6161
6162 !! test
6163 Interwiki link with fragment (bug 2130)
6164 !! wikitext
6165 [[MeatBall:SoftSecurity#foo]]
6166 !! html
6167 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6168 </p>
6169 !! end
6170
6171 # Ideally the wikipedia: prefix here should be proto-relative too
6172 !! test
6173 Different interwiki prefixes mapping to the same URL
6174 !! wikitext
6175 [[:en:Foo]]
6176
6177 [[:en:Foo|Foo]]
6178
6179 [[wikipedia:Foo]]
6180
6181 [[:wikipedia:Foo|Foo]]
6182
6183 [[wikipedia:en:Foo]]
6184
6185 [[:wikipedia:en:Foo]]
6186 !! html/parsoid
6187 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>en:Foo</a></p>
6188
6189 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}'>Foo</a></p>
6190
6191 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}'>wikipedia:Foo</a></p>
6192
6193 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}'>Foo</a></p>
6194
6195 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}'>wikipedia:en:Foo</a></p>
6196
6197 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}'>wikipedia:en:Foo</a></p>
6198 !! end
6199
6200 !! test
6201 Interwiki links that cannot be represented in wiki syntax
6202 !! wikitext
6203 [[meatball:ok]]
6204 [[meatball:ok#foo|ok with fragment]]
6205 [[meatball:ok_as_well?|ok ending with ? mark]]
6206 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6207 [http://de.wikipedia.org/wiki/#foo is just fragment]
6208
6209 !! html/parsoid
6210 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6211 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6212 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6213 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6214 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6215 !! end
6216
6217 !! test
6218 Interwiki links: trail
6219 !! options
6220 parsoid
6221 !! wikitext
6222 [[wikipedia:Foo|Ba]]r
6223 !! html
6224 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}'>Bar</a></p>
6225 !! end
6226
6227 ###
6228 ### Interlanguage links
6229 ### Language links (so that searching for '### language' matches..)
6230 ###
6231
6232 !! test
6233 Interlanguage link
6234 !! wikitext
6235 Blah blah blah
6236 [[zh:Chinese]]
6237 !! html
6238 <p>Blah blah blah
6239 </p>
6240 !! end
6241
6242 !! test
6243 Double interlanguage link
6244 !! wikitext
6245 Blah blah blah
6246 [[es:Spanish]]
6247 [[zh:Chinese]]
6248 !! html
6249 <p>Blah blah blah
6250 </p>
6251 !! end
6252
6253 !! test
6254 Interlanguage link, with prefix links
6255 !! options
6256 language=ln
6257 !! wikitext
6258 Blah blah blah
6259 [[zh:Chinese]]
6260 !! html
6261 <p>Blah blah blah
6262 </p>
6263 !! end
6264
6265 !! test
6266 Double interlanguage link, with prefix links (bug 8897)
6267 !! options
6268 language=ln
6269 !! wikitext
6270 Blah blah blah
6271 [[es:Spanish]]
6272 [[zh:Chinese]]
6273 !! html
6274 <p>Blah blah blah
6275 </p>
6276 !! end
6277
6278 !! test
6279 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6280 !! options
6281 language=ln
6282 !! wikitext
6283 [[WW&nbsp;II]]
6284 !! html
6285 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
6286 </p>
6287 !! end
6288
6289 !! test
6290 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6291 !! options
6292 parsoid=html2wt
6293 !! wikitext
6294 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6295
6296 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6297 !! html
6298 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6299 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6300 !! end
6301
6302 !! test
6303 Parsoid: handle constructor well
6304 !! options
6305 parsoid
6306 !! wikitext
6307 [[constructor]]
6308
6309 [[constructor:foo]]
6310 !! html
6311 <p><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
6312
6313 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
6314 !! end
6315
6316 !! test
6317 Parsoid: recognize interlanguage links without a target page
6318 !! options
6319 parsoid
6320 !! wikitext
6321 [[ko:]]
6322 !! html
6323 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6324 !! end
6325
6326 !! test
6327 Parsoid: recognize interwiki links without a target page
6328 !! options
6329 parsoid
6330 !! wikitext
6331 [[:ko:]]
6332 !! html
6333 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6334 !! end
6335
6336 !! test
6337 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6338 !! options
6339 parsoid
6340 !! wikitext
6341 [[en:Foo]]
6342 !! html
6343 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6344 !! end
6345
6346 ###
6347 ### Redirects, Parsoid-only
6348 ###
6349 !! test
6350 1. Simple redirect to page
6351 !! options
6352 parsoid
6353 !! wikitext
6354 #REDIRECT [[Main Page]]
6355 !! html
6356 <link rel="mw:PageProp/redirect" href="./Main_Page">
6357 !! end
6358
6359 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6360 !! test
6361 2. Other redirect variants
6362 !! options
6363 parsoid=wt2html,wt2wt
6364 !! wikitext
6365 #REDIRECT [[Main_Page]]
6366 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6367 !! html
6368 <link rel="mw:PageProp/redirect" href="./Main_Page">
6369 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6370 !! end
6371
6372 !! test
6373 Empty redirect
6374 !! options
6375 parsoid=wt2html,wt2wt
6376 !! wikitext
6377 #REDIRECT [[]]
6378 !! html
6379 <ol>
6380 <li>REDIRECT [[]]</li></ol>
6381 !! end
6382
6383 !! test
6384 Optional colon in #REDIRECT
6385 !! options
6386 # the colon is archaic syntax. we support it for wt2html, but we
6387 # don't care that it roundtrips back to the modern syntax.
6388 parsoid=wt2html,html2html
6389 !! wikitext
6390 #REDIRECT:[[Main Page]]
6391 !! html
6392 <link rel="mw:PageProp/redirect" href="./Main_Page">
6393 !! end
6394
6395 !! test
6396 Whitespace in #REDIRECT with optional colon
6397 !! options
6398 # the colon and gratuitous whitespace is archaic syntax. we support
6399 # it for wt2html, but we don't care that it roundtrips back to the
6400 # modern syntax (without extra whitespace)
6401 parsoid=wt2html,html2html
6402 !! wikitext
6403
6404 #REDIRECT
6405 :
6406 [[Main Page]]
6407 !! html
6408 <link rel="mw:PageProp/redirect" href="./Main_Page">
6409 !! end
6410
6411 !! test
6412 Piped link in #REDIRECT
6413 !! options
6414 # content after piped link is ignored. we support this syntax,
6415 # but don't care that the piped link is lost when we roundtrip this.
6416 parsoid=wt2html
6417 !! wikitext
6418 #REDIRECT [[Main Page|bar]]
6419 !! html
6420 <link rel="mw:PageProp/redirect" href="./Main_Page">
6421 !! end
6422
6423 !! test
6424 Redirect to category
6425 !! options
6426 parsoid=wt2html
6427 !! wikitext
6428 #REDIRECT [[Category:Foo]]
6429 !! html
6430 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6431 !! end
6432
6433 !! test
6434 Redirect to category with URL encoding
6435 !! options
6436 parsoid=wt2html
6437 !! wikitext
6438 #REDIRECT [[Category%3AFoo]]
6439 !! html
6440 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6441 !! end
6442
6443 !! test
6444 Redirect to category page
6445 !! options
6446 parsoid=wt2html,html2html
6447 !! wikitext
6448 #REDIRECT [[:Category:Foo]]
6449 !! html
6450 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6451 !! end
6452
6453 !! test
6454 Redirect to image page (1)
6455 !! options
6456 parsoid
6457 !! wikitext
6458 #REDIRECT [[File:Wiki.png]]
6459 !! html
6460 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6461 !! end
6462
6463 !! test
6464 Redirect to image page (2)
6465 !! options
6466 parsoid
6467 !! wikitext
6468 #REDIRECT [[Image:Wiki.png]]
6469 !! html
6470 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6471 !! end
6472
6473 !! test
6474 Redirect to language
6475 !! options
6476 parsoid
6477 !! wikitext
6478 #REDIRECT [[en:File:Wiki.png]]
6479 !! html
6480 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6481 !! end
6482
6483 !! test
6484 Redirect to interwiki
6485 !! options
6486 parsoid
6487 !! wikitext
6488 #REDIRECT [[meatball:File:Wiki.png]]
6489 !! html
6490 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6491 !! end
6492
6493 !! test
6494 Non-English #REDIRECT
6495 !! options
6496 parsoid
6497 language=is
6498 !! wikitext
6499 #TILVÍSUN [[Main Page]]
6500 !! html
6501 <link rel="mw:PageProp/redirect" href="./Main_Page">
6502 !! end
6503
6504 !! test
6505 New redirect
6506 !! options
6507 parsoid=html2wt
6508 !! wikitext
6509 Foo
6510 #REDIRECT [[Foo]]
6511 !! html
6512 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6513 !! end
6514
6515 ##
6516 ## XHTML tidiness
6517 ###
6518
6519 !! test
6520 <br> to <br />
6521 !! wikitext
6522 1<br>2<br />3
6523 !! html
6524 <p>1<br />2<br />3
6525 </p>
6526 !! end
6527
6528 !! test
6529 Broken br tag sanitization
6530 !! wikitext
6531 </br>
6532 !! html/php
6533 <p>&lt;/br&gt;
6534 </p>
6535 !! end
6536
6537 # TODO: Fix html2html mode (bug 51055)!
6538 !! test
6539 Parsoid: Broken br tag recognition
6540 !! options
6541 parsoid=wt2html
6542 !! wikitext
6543 </br>
6544
6545 <br/ >
6546 !! html/parsoid
6547 <p><br></p>
6548 <p><br/></p>
6549 !! end
6550
6551 !! test
6552 Incorrecly removing closing slashes from correctly formed XHTML
6553 !! wikitext
6554 <br style="clear:both;" />
6555 !! html
6556 <p><br style="clear:both;" />
6557 </p>
6558 !! end
6559
6560 !! test
6561 Failing to transform badly formed HTML into correct XHTML
6562 !! wikitext
6563 <br style="clear: left;">
6564 <br style="clear: right;">
6565 <br style="clear: both;">
6566 !! html
6567 <p><br style="clear: left;" />
6568 <br style="clear: right;" />
6569 <br style="clear: both;" />
6570 </p>
6571 !!end
6572
6573 !! test
6574 Handling html with a div self-closing tag
6575 !! wikitext
6576 <div title />
6577 <div title/>
6578 <div title/ >
6579 <div title=bar />
6580 <div title=bar/>
6581 <div title=bar/ >
6582 !! html
6583 <p>&lt;div title /&gt;
6584 &lt;div title/&gt;
6585 </p>
6586 <div>
6587 <p>&lt;div title=bar /&gt;
6588 &lt;div title=bar/&gt;
6589 </p>
6590 <div title="bar/"></div>
6591 </div>
6592
6593 !! end
6594
6595 !! test
6596 Handling html with a br self-closing tag
6597 !! wikitext
6598 <br title />
6599 <br title/>
6600 <br title/ >
6601 <br title=bar />
6602 <br title=bar/>
6603 <br title=bar/ >
6604 !! html
6605 <p><br title="title" />
6606 <br title="title" />
6607 <br />
6608 <br title="bar" />
6609 <br title="bar" />
6610 <br title="bar/" />
6611 </p>
6612 !! end
6613
6614 !! test
6615 Horizontal ruler (should it add that extra space?)
6616 !! wikitext
6617 <hr>
6618 <hr >
6619 foo <hr
6620 > bar
6621 !! html
6622 <hr />
6623 <hr />
6624 foo <hr /> bar
6625
6626 !! end
6627
6628 !! test
6629 Horizontal ruler -- 4+ dashes render hr
6630 !! wikitext
6631 ----
6632 !! html
6633 <hr />
6634
6635 !! end
6636
6637 !! test
6638 Horizontal ruler -- eats additional dashes on the same line
6639 !! wikitext
6640 ---------
6641 !! html
6642 <hr />
6643
6644 !! end
6645
6646 !! test
6647 Horizontal ruler -- does not collapse dashes on consecutive lines
6648 !! wikitext
6649 ----
6650 ----
6651 !! html
6652 <hr />
6653 <hr />
6654
6655 !! end
6656
6657 !! test
6658 Horizontal ruler -- <4 dashes render as plain text
6659 !! wikitext
6660 ---
6661 !! html
6662 <p>---
6663 </p>
6664 !! end
6665
6666 !! test
6667 Horizontal ruler -- Supports content following dashes on same line
6668 !! wikitext
6669 ---- Foo
6670 !! html
6671 <hr /> Foo
6672
6673 !! end
6674
6675 ###
6676 ### Block-level elements
6677 ###
6678 !! test
6679 Common list
6680 !! wikitext
6681 *Common list
6682 * item 2
6683 *item 3
6684 !! html
6685 <ul><li>Common list</li>
6686 <li> item 2</li>
6687 <li>item 3</li></ul>
6688
6689 !! end
6690
6691 !! test
6692 Numbered list
6693 !! wikitext
6694 #Numbered list
6695 #item 2
6696 # item 3
6697 !! html
6698 <ol><li>Numbered list</li>
6699 <li>item 2</li>
6700 <li> item 3</li></ol>
6701
6702 !! end
6703
6704 !! test
6705 Mixed list
6706 !! wikitext
6707 *Mixed list
6708 *# with numbers
6709 ** and bullets
6710 *# and numbers
6711 *bullets again
6712 **bullet level 2
6713 ***bullet level 3
6714 ***#Number on level 4
6715 **bullet level 2
6716 **#Number on level 3
6717 **#Number on level 3
6718 *#number level 2
6719 *Level 1
6720 *** Level 3
6721 #** Level 3, but ordered
6722 !! html
6723 <ul><li>Mixed list
6724 <ol><li> with numbers</li></ol>
6725 <ul><li> and bullets</li></ul>
6726 <ol><li> and numbers</li></ol></li>
6727 <li>bullets again
6728 <ul><li>bullet level 2
6729 <ul><li>bullet level 3
6730 <ol><li>Number on level 4</li></ol></li></ul></li>
6731 <li>bullet level 2
6732 <ol><li>Number on level 3</li>
6733 <li>Number on level 3</li></ol></li></ul>
6734 <ol><li>number level 2</li></ol></li>
6735 <li>Level 1
6736 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6737 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6738
6739 !! end
6740
6741 !! test
6742 Nested lists 1
6743 !! wikitext
6744 *foo
6745 **bar
6746 !! html
6747 <ul><li>foo
6748 <ul><li>bar</li></ul></li></ul>
6749
6750 !! end
6751
6752 !! test
6753 Nested lists 2
6754 !! wikitext
6755 **foo
6756 *bar
6757 !! html
6758 <ul><li><ul><li>foo</li></ul></li>
6759 <li>bar</li></ul>
6760
6761 !! end
6762
6763 !! test
6764 Nested lists 3 (first element empty)
6765 !! wikitext
6766 *
6767 **bar
6768 !! html
6769 <ul><li>
6770 <ul><li>bar</li></ul></li></ul>
6771
6772 !! end
6773
6774 !! test
6775 Nested lists 4 (first element empty)
6776 !! wikitext
6777 **
6778 *bar
6779 !! html
6780 <ul><li><ul><li></li></ul></li>
6781 <li>bar</li></ul>
6782
6783 !! end
6784
6785 !! test
6786 Nested lists 5 (both elements empty)
6787 !! wikitext
6788 **
6789 *
6790 !! html
6791 <ul><li><ul><li></li></ul></li>
6792 <li></li></ul>
6793
6794 !! end
6795
6796 !! test
6797 Nested lists 6 (both elements empty)
6798 !! wikitext
6799 *
6800 **
6801 !! html
6802 <ul><li>
6803 <ul><li></li></ul></li></ul>
6804
6805 !! end
6806
6807 !! test
6808 Nested lists 7 (skip initial nesting levels)
6809 !! wikitext
6810 *** foo
6811 !! html
6812 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6813
6814 !! end
6815
6816 !! test
6817 Nested lists 8 (multiple nesting transitions)
6818 !! wikitext
6819 * foo
6820 *** bar
6821 ** baz
6822 * boo
6823 !! html
6824 <ul><li> foo
6825 <ul><li><ul><li> bar</li></ul></li>
6826 <li> baz</li></ul></li>
6827 <li> boo</li></ul>
6828
6829 !! end
6830
6831 !! test
6832 1. Lists with start-of-line-transparent tokens before bullets: Comments
6833 !! wikitext
6834 *foo
6835 *<!--cmt-->bar
6836 <!--cmt-->*baz
6837 !! html
6838 <ul><li>foo</li>
6839 <li>bar</li>
6840 <li>baz</li></ul>
6841
6842 !! end
6843
6844 !! test
6845 2. Lists with start-of-line-transparent tokens before bullets: Template close
6846 !! wikitext
6847 *foo {{echo|bar
6848 }}*baz
6849 !! html
6850 <ul><li>foo bar</li>
6851 <li>baz</li></ul>
6852
6853 !! end
6854
6855 !! test
6856 List items are not parsed correctly following a <pre> block (bug 785)
6857 !! wikitext
6858 * <pre>foo</pre>
6859 * <pre>bar</pre>
6860 * zar
6861 !! html
6862 <ul><li> <pre>foo</pre></li>
6863 <li> <pre>bar</pre></li>
6864 <li> zar</li></ul>
6865
6866 !! end
6867
6868 !! test
6869 List items from template
6870 !! wikitext
6871
6872 {{inner list}}
6873 * item 2
6874
6875 * item 0
6876 {{inner list}}
6877 * item 2
6878
6879 * item 0
6880 * notSOL{{inner list}}
6881 * item 2
6882 !! html
6883 <ul><li> item 1</li>
6884 <li> item 2</li></ul>
6885 <ul><li> item 0</li>
6886 <li> item 1</li>
6887 <li> item 2</li></ul>
6888 <ul><li> item 0</li>
6889 <li> notSOL</li>
6890 <li> item 1</li>
6891 <li> item 2</li></ul>
6892
6893 !! end
6894
6895 !! test
6896 List interrupted by empty line or heading
6897 !! wikitext
6898 * foo
6899
6900 ** bar
6901 == A heading ==
6902 * Another list item
6903 !! html
6904 <ul><li> foo</li></ul>
6905 <ul><li><ul><li> bar</li></ul></li></ul>
6906 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6907 <ul><li> Another list item</li></ul>
6908
6909 !!end
6910
6911 !!test
6912 Multiple list tags generated by templates
6913 !! wikitext
6914 {{echo|<li>}}a
6915 {{echo|<li>}}b
6916 {{echo|<li>}}c
6917 !! html
6918 <li>a
6919 <li>b
6920 <li>c</li>
6921 </li>
6922 </li>
6923
6924 !!end
6925
6926 !!test
6927 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6928 !! wikitext
6929 *a
6930 <!--This line will NOT split the list-->
6931 *b
6932 <!--This line will NOT split the list either-->
6933 *c
6934 <!--foo--> <!----> <!--This line NOT split the list either-->
6935 *d
6936 !! html
6937 <ul><li>a</li>
6938 <li>b</li>
6939 <li>c</li>
6940 <li>d</li></ul>
6941
6942 !!end
6943
6944 !!test
6945 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6946 !! wikitext
6947 *a
6948 <!--This line will NOT split the list-->
6949 *b
6950 <!--This line will NOT split the list either-->
6951 *c
6952 <!--foo--> <!----> <!--This line NOT split the list
6953 either-->
6954 *d
6955 !! html
6956 <ul><li>a</li>
6957 <li>b</li>
6958 <li>c</li>
6959 <li>d</li></ul>
6960
6961 !!end
6962
6963 !!test
6964 Test the li-hack
6965 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6966 !!options
6967 parsoid=wt2html,wt2wt
6968 !! wikitext
6969 * foo
6970 * <li>li-hack
6971 * {{echo|<li>templated li-hack}}
6972 * <!--foo--> <li> unsupported li-hack with preceding comments
6973
6974 <ul>
6975 <li><li>not a li-hack
6976 </li>
6977 </ul>
6978 !! html
6979 <ul>
6980 <li> foo</li>
6981 <li>li-hack</li>
6982 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6983 <li> <!--foo--> </li>
6984 <li> li-hack with preceding comments</li>
6985 </ul>
6986
6987 <ul>
6988 <li></li>
6989 <li>not a li-hack
6990 </li>
6991 </ul>
6992 !!end
6993
6994 !! test
6995 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6996 !! options
6997 parsoid
6998 !! wikitext
6999 # foo
7000 ## bar
7001 * foo
7002 ** bar
7003 : foo
7004 :: bar
7005 !! html
7006 <ol>
7007 <li> foo<ol>
7008 <li> bar</li>
7009 </ol></li>
7010 </ol><ul>
7011 <li> foo<ul>
7012 <li> bar</li>
7013 </ul></li>
7014 </ul><dl>
7015 <dd> foo<dl>
7016 <dd> bar</dd>
7017 </dl></dd>
7018 </dl>
7019 !! end
7020
7021 !! test
7022 Parsoid: Test of whitespace serialization with Templated bullets
7023 !! options
7024 parsoid
7025 !! wikitext
7026 * {{bullet}}
7027 !! html
7028 <ul>
7029 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7030 </ul>
7031 !! end
7032
7033 # ------------------------------------------------------------------------
7034 # The next set of tests are about Parsoid's ability to handle badly nested
7035 # tags (parse, minimize scope of fixup, and roundtrip back)
7036 # ------------------------------------------------------------------------
7037
7038 !! test
7039 Unbalanced closing block tags break a list
7040 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7041 !! wikitext
7042 <div>
7043 *a</div><div>
7044 *b</div>
7045 !! html/parsoid
7046 <div>
7047 <ul>
7048 <li>a
7049 </li>
7050 </ul></div><div>
7051 <ul>
7052 <li>b
7053 </li>
7054 </ul></div>
7055 !! end
7056
7057 !! test
7058 Unbalanced closing non-block tags don't break a list
7059 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7060 !! wikitext
7061 <span>
7062 *a</span><span>
7063 *b</span>
7064 !! html/parsoid
7065 <p><span></span>
7066 </p>
7067 <ul>
7068 <li>a<span></span>
7069 </li>
7070 <li>b
7071 </li>
7072 </ul>
7073 !! end
7074
7075 !! test
7076 Unclosed formatting tags that straddle lists are closed and reopened
7077 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7078 !! wikitext
7079 # <s> a
7080 # b </s>
7081 !! html/parsoid
7082 <ol>
7083 <li> <s> a </s>
7084 </li>
7085 <li> <s> b </s>
7086 </li>
7087 </ol>
7088 !! end
7089
7090 !!test
7091 List embedded in a non-block tag
7092 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7093 !! wikitext
7094 <small>
7095 * foo
7096 </small>
7097 !! html/parsoid
7098 <p><small></small></p>
7099 <small>
7100 <ul>
7101 <li> foo</li>
7102 </ul>
7103 </small>
7104 <p><small></small></p>
7105 !!end
7106
7107 !! test
7108 Table with missing opening <tr> tag
7109 !! options
7110 parsoid=wt2html,wt2wt
7111 !! wikitext
7112 <table>
7113 <td>foo</td>
7114 </tr>
7115 </table>
7116 !! html/parsoid
7117 <table>
7118 <tr>
7119 <td>foo</td>
7120 </tr>
7121 </table>
7122 !! end
7123
7124 ###
7125 ### Magic Words
7126 ###
7127
7128 # Note that the current date is hard-coded as
7129 # 1970-01-01T00:02:03Z (a Thursday)
7130 # when running parser tests. The timezone is also fixed to GMT, so
7131 # local date will be identical to current date.
7132
7133 !! test
7134 Magic Word: {{CURRENTDAY}}
7135 !! wikitext
7136 {{CURRENTDAY}}
7137 !! html
7138 <p>1
7139 </p>
7140 !! end
7141
7142 !! test
7143 Magic Word: {{CURRENTDAY2}}
7144 !! wikitext
7145 {{CURRENTDAY2}}
7146 !! html
7147 <p>01
7148 </p>
7149 !! end
7150
7151 !! test
7152 Magic Word: {{CURRENTDAYNAME}}
7153 !! wikitext
7154 {{CURRENTDAYNAME}}
7155 !! html
7156 <p>Thursday
7157 </p>
7158 !! end
7159
7160 !! test
7161 Magic Word: {{CURRENTDOW}}
7162 !! wikitext
7163 {{CURRENTDOW}}
7164 !! html
7165 <p>4
7166 </p>
7167 !! end
7168
7169 !! test
7170 Magic Word: {{CURRENTMONTH}}
7171 !! wikitext
7172 {{CURRENTMONTH}}
7173 !! html
7174 <p>01
7175 </p>
7176 !! end
7177
7178 !! test
7179 Magic Word: {{CURRENTMONTH1}}
7180 !! wikitext
7181 {{CURRENTMONTH1}}
7182 !! html
7183 <p>1
7184 </p>
7185 !! end
7186
7187 !! test
7188 Magic Word: {{CURRENTMONTHABBREV}}
7189 !! wikitext
7190 {{CURRENTMONTHABBREV}}
7191 !! html
7192 <p>Jan
7193 </p>
7194 !! end
7195
7196 !! test
7197 Magic Word: {{CURRENTMONTHNAME}}
7198 !! wikitext
7199 {{CURRENTMONTHNAME}}
7200 !! html
7201 <p>January
7202 </p>
7203 !! end
7204
7205 !! test
7206 Magic Word: {{CURRENTMONTHNAMEGEN}}
7207 !! wikitext
7208 {{CURRENTMONTHNAMEGEN}}
7209 !! html
7210 <p>January
7211 </p>
7212 !! end
7213
7214 !! test
7215 Magic Word: {{CURRENTTIME}}
7216 !! wikitext
7217 {{CURRENTTIME}}
7218 !! html
7219 <p>00:02
7220 </p>
7221 !! end
7222
7223 !! test
7224 Magic Word: {{CURRENTHOUR}}
7225 !! wikitext
7226 {{CURRENTHOUR}}
7227 !! html
7228 <p>00
7229 </p>
7230 !! end
7231
7232 !! test
7233 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7234 !! wikitext
7235 {{CURRENTWEEK}}
7236 !! html
7237 <p>1
7238 </p>
7239 !! end
7240
7241 !! test
7242 Magic Word: {{CURRENTYEAR}}
7243 !! wikitext
7244 {{CURRENTYEAR}}
7245 !! html
7246 <p>1970
7247 </p>
7248 !! end
7249
7250 !! test
7251 Magic Word: {{CURRENTTIMESTAMP}}
7252 !! wikitext
7253 {{CURRENTTIMESTAMP}}
7254 !! html
7255 <p>19700101000203
7256 </p>
7257 !! end
7258
7259 !! test
7260 Magic Words LOCAL (UTC)
7261 !! wikitext
7262 * {{LOCALMONTH}}
7263 * {{LOCALMONTH1}}
7264 * {{LOCALMONTHNAME}}
7265 * {{LOCALMONTHNAMEGEN}}
7266 * {{LOCALMONTHABBREV}}
7267 * {{LOCALDAY}}
7268 * {{LOCALDAY2}}
7269 * {{LOCALDAYNAME}}
7270 * {{LOCALYEAR}}
7271 * {{LOCALTIME}}
7272 * {{LOCALHOUR}}
7273 * {{LOCALWEEK}}
7274 * {{LOCALDOW}}
7275 * {{LOCALTIMESTAMP}}
7276 !! html
7277 <ul><li> 01</li>
7278 <li> 1</li>
7279 <li> January</li>
7280 <li> January</li>
7281 <li> Jan</li>
7282 <li> 1</li>
7283 <li> 01</li>
7284 <li> Thursday</li>
7285 <li> 1970</li>
7286 <li> 00:02</li>
7287 <li> 00</li>
7288 <li> 1</li>
7289 <li> 4</li>
7290 <li> 19700101000203</li></ul>
7291
7292 !! end
7293
7294 !! test
7295 Magic Word: {{FULLPAGENAME}}
7296 !! options
7297 title=[[User:Ævar Arnfjörð Bjarmason]]
7298 !! wikitext
7299 {{FULLPAGENAME}}
7300 !! html
7301 <p>User:Ævar Arnfjörð Bjarmason
7302 </p>
7303 !! end
7304
7305 !! test
7306 Magic Word: {{FULLPAGENAMEE}}
7307 !! options
7308 title=[[User:Ævar Arnfjörð Bjarmason]]
7309 !! wikitext
7310 {{FULLPAGENAMEE}}
7311 !! html
7312 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7313 </p>
7314 !! end
7315
7316 !! test
7317 Magic Word: {{TALKSPACE}}
7318 !! options
7319 title=[[User:Ævar Arnfjörð Bjarmason]]
7320 !! wikitext
7321 {{TALKSPACE}}
7322 !! html
7323 <p>User talk
7324 </p>
7325 !! end
7326
7327 !! test
7328 Magic Word: {{TALKSPACE}}, same namespace
7329 !! options
7330 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7331 !! wikitext
7332 {{TALKSPACE}}
7333 !! html
7334 <p>User talk
7335 </p>
7336 !! end
7337
7338 !! test
7339 Magic Word: {{TALKSPACE}}, main namespace
7340 !! options
7341 title=[[Parser Test]]
7342 !! wikitext
7343 {{TALKSPACE}}
7344 !! html
7345 <p>Talk
7346 </p>
7347 !! end
7348
7349 !! test
7350 Magic Word: {{TALKSPACEE}}
7351 !! options
7352 title=[[User:Ævar Arnfjörð Bjarmason]]
7353 !! wikitext
7354 {{TALKSPACEE}}
7355 !! html
7356 <p>User_talk
7357 </p>
7358 !! end
7359
7360 !! test
7361 Magic Word: {{SUBJECTSPACE}}
7362 !! options
7363 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7364 !! wikitext
7365 {{SUBJECTSPACE}}
7366 !! html
7367 <p>User
7368 </p>
7369 !! end
7370
7371 !! test
7372 Magic Word: {{SUBJECTSPACE}}, same namespace
7373 !! options
7374 title=[[User:Ævar Arnfjörð Bjarmason]]
7375 !! wikitext
7376 {{SUBJECTSPACE}}
7377 !! html
7378 <p>User
7379 </p>
7380 !! end
7381
7382 !! test
7383 Magic Word: {{SUBJECTSPACE}}, main namespace
7384 !! options
7385 title=[[Parser Test]]
7386 !! wikitext
7387 {{SUBJECTSPACE}}
7388 !! html
7389
7390 !! end
7391
7392 !! test
7393 Magic Word: {{SUBJECTSPACEE}}
7394 !! options
7395 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7396 !! wikitext
7397 {{SUBJECTSPACEE}}
7398 !! html
7399 <p>User
7400 </p>
7401 !! end
7402
7403 !! test
7404 Magic Word: {{NAMESPACE}}
7405 !! options
7406 title=[[User:Ævar Arnfjörð Bjarmason]]
7407 !! wikitext
7408 {{NAMESPACE}}
7409 !! html
7410 <p>User
7411 </p>
7412 !! end
7413
7414 !! test
7415 Magic Word: {{NAMESPACEE}}
7416 !! options
7417 title=[[User:Ævar Arnfjörð Bjarmason]]
7418 !! wikitext
7419 {{NAMESPACEE}}
7420 !! html
7421 <p>User
7422 </p>
7423 !! end
7424
7425 !! test
7426 Magic Word: {{NAMESPACENUMBER}}
7427 !! options
7428 title=[[User:Ævar Arnfjörð Bjarmason]]
7429 !! wikitext
7430 {{NAMESPACENUMBER}}
7431 !! html
7432 <p>2
7433 </p>
7434 !! end
7435
7436 !! test
7437 Magic Word: {{SUBPAGENAME}}
7438 !! options
7439 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7440 !! wikitext
7441 {{SUBPAGENAME}}
7442 !! html
7443 <p>sub ö
7444 </p>
7445 !! end
7446
7447 !! test
7448 Magic Word: {{SUBPAGENAMEE}}
7449 !! options
7450 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7451 !! wikitext
7452 {{SUBPAGENAMEE}}
7453 !! html
7454 <p>sub_%C3%B6
7455 </p>
7456 !! end
7457
7458 !! test
7459 Magic Word: {{ROOTPAGENAME}}
7460 !! options
7461 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7462 !! wikitext
7463 {{ROOTPAGENAME}}
7464 !! html
7465 <p>Ævar Arnfjörð Bjarmason
7466 </p>
7467 !! end
7468
7469 !! test
7470 Magic Word: {{ROOTPAGENAMEE}}
7471 !! options
7472 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7473 !! wikitext
7474 {{ROOTPAGENAMEE}}
7475 !! html
7476 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7477 </p>
7478 !! end
7479
7480 !! test
7481 Magic Word: {{BASEPAGENAME}}
7482 !! options
7483 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7484 !! wikitext
7485 {{BASEPAGENAME}}
7486 !! html
7487 <p>Ævar Arnfjörð Bjarmason
7488 </p>
7489 !! end
7490
7491 !! test
7492 Magic Word: {{BASEPAGENAMEE}}
7493 !! options
7494 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7495 !! wikitext
7496 {{BASEPAGENAMEE}}
7497 !! html
7498 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7499 </p>
7500 !! end
7501
7502 !! test
7503 Magic Word: {{TALKPAGENAME}}
7504 !! options
7505 title=[[User:Ævar Arnfjörð Bjarmason]]
7506 !! wikitext
7507 {{TALKPAGENAME}}
7508 !! html
7509 <p>User talk:Ævar Arnfjörð Bjarmason
7510 </p>
7511 !! end
7512
7513 !! test
7514 Magic Word: {{TALKPAGENAMEE}}
7515 !! options
7516 title=[[User:Ævar Arnfjörð Bjarmason]]
7517 !! wikitext
7518 {{TALKPAGENAMEE}}
7519 !! html
7520 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7521 </p>
7522 !! end
7523
7524 !! test
7525 Magic Word: {{SUBJECTPAGENAME}}
7526 !! options
7527 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7528 !! wikitext
7529 {{SUBJECTPAGENAME}}
7530 !! html
7531 <p>User:Ævar Arnfjörð Bjarmason
7532 </p>
7533 !! end
7534
7535 !! test
7536 Magic Word: {{SUBJECTPAGENAMEE}}
7537 !! options
7538 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7539 !! wikitext
7540 {{SUBJECTPAGENAMEE}}
7541 !! html
7542 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7543 </p>
7544 !! end
7545
7546 !! test
7547 Magic Word: {{NUMBEROFFILES}}
7548 !! wikitext
7549 {{NUMBEROFFILES}}
7550 !! html
7551 <p>5
7552 </p>
7553 !! end
7554
7555 !! test
7556 Magic Word: {{PAGENAME}}
7557 !! options
7558 title=[[User:Ævar Arnfjörð Bjarmason]]
7559 !! wikitext
7560 {{PAGENAME}}
7561 !! html
7562 <p>Ævar Arnfjörð Bjarmason
7563 </p>
7564 !! end
7565
7566 !! test
7567 Magic Word: {{PAGENAME}} with metacharacters
7568 !! options
7569 title=[['foo & bar = baz']]
7570 !! wikitext
7571 ''{{PAGENAME}}''
7572 !! html
7573 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7574 </p>
7575 !! end
7576
7577 !! test
7578 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7579 !! options
7580 title=[[*RFC 1234 http://example.com/]]
7581 !! wikitext
7582 {{PAGENAME}}
7583 !! html
7584 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7585 </p>
7586 !! end
7587
7588 !! test
7589 Magic Word: {{PAGENAMEE}}
7590 !! options
7591 title=[[User:Ævar Arnfjörð Bjarmason]]
7592 !! wikitext
7593 {{PAGENAMEE}}
7594 !! html
7595 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7596 </p>
7597 !! end
7598
7599 !! test
7600 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7601 !! options
7602 title=[[*RFC 1234 http://example.com/]]
7603 !! wikitext
7604 {{PAGENAMEE}}
7605 !! html
7606 <p>&#42;RFC_1234_http&#58;//example.com/
7607 </p>
7608 !! end
7609
7610 !! test
7611 Magic Word: {{REVISIONID}}
7612 !! wikitext
7613 {{REVISIONID}}
7614 !! html
7615 <p>1337
7616 </p>
7617 !! end
7618
7619 !! test
7620 Magic Word: {{SCRIPTPATH}}
7621 !! wikitext
7622 {{SCRIPTPATH}}
7623 !! html
7624 <p>/
7625 </p>
7626 !! end
7627
7628 !! test
7629 Magic Word: {{STYLEPATH}}
7630 !! wikitext
7631 {{STYLEPATH}}
7632 !! html
7633 <p>/skins
7634 </p>
7635 !! end
7636
7637 !! test
7638 Magic Word: {{SERVER}}
7639 !! wikitext
7640 {{SERVER}}
7641 !! html
7642 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7643 </p>
7644 !! end
7645
7646 !! test
7647 Magic Word: {{SERVERNAME}}
7648 !! wikitext
7649 {{SERVERNAME}}
7650 !! html
7651 <p>example.org
7652 </p>
7653 !! end
7654
7655 !! test
7656 Magic Word: {{SITENAME}}
7657 !! wikitext
7658 {{SITENAME}}
7659 !! html
7660 <p>MediaWiki
7661 </p>
7662 !! end
7663
7664 !! test
7665 Case-sensitive magic words, when cased differently, should just be template transclusions
7666 !! wikitext
7667 {{CurrentMonth}}
7668 {{currentday}}
7669 {{cURreNTweEK}}
7670 {{currentHour}}
7671 !! html
7672 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
7673 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
7674 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
7675 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
7676 </p>
7677 !! end
7678
7679 !! test
7680 Case-insensitive magic words should still work with weird casing.
7681 !! wikitext
7682 {{sErVeRNaMe}}
7683 {{LCFirst:AOEU}}
7684 {{ucFIRST:aoeu}}
7685 {{SERver}}
7686 !! html
7687 <p>example.org
7688 aOEU
7689 Aoeu
7690 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7691 </p>
7692 !! end
7693
7694 !! test
7695 Namespace 1 {{ns:1}}
7696 !! wikitext
7697 {{ns:1}}
7698 !! html
7699 <p>Talk
7700 </p>
7701 !! end
7702
7703 !! test
7704 Namespace 1 {{ns:01}}
7705 !! wikitext
7706 {{ns:01}}
7707 !! html
7708 <p>Talk
7709 </p>
7710 !! end
7711
7712 !! test
7713 Namespace 0 {{ns:0}} (bug 4783)
7714 !! wikitext
7715 {{ns:0}}
7716 !! html
7717
7718 !! end
7719
7720 !! test
7721 Namespace 0 {{ns:00}} (bug 4783)
7722 !! wikitext
7723 {{ns:00}}
7724 !! html
7725
7726 !! end
7727
7728 !! test
7729 Namespace -1 {{ns:-1}}
7730 !! wikitext
7731 {{ns:-1}}
7732 !! html
7733 <p>Special
7734 </p>
7735 !! end
7736
7737 !! test
7738 Namespace User {{ns:User}}
7739 !! wikitext
7740 {{ns:User}}
7741 !! html
7742 <p>User
7743 </p>
7744 !! end
7745
7746 !! test
7747 Namespace User talk {{ns:User_talk}}
7748 !! wikitext
7749 {{ns:User_talk}}
7750 !! html
7751 <p>User talk
7752 </p>
7753 !! end
7754
7755 !! test
7756 Namespace User talk {{ns:uSeR tAlK}}
7757 !! wikitext
7758 {{ns:uSeR tAlK}}
7759 !! html
7760 <p>User talk
7761 </p>
7762 !! end
7763
7764 !! test
7765 Namespace File {{ns:File}}
7766 !! wikitext
7767 {{ns:File}}
7768 !! html
7769 <p>File
7770 </p>
7771 !! end
7772
7773 !! test
7774 Namespace File {{ns:Image}}
7775 !! wikitext
7776 {{ns:Image}}
7777 !! html
7778 <p>File
7779 </p>
7780 !! end
7781
7782 !! test
7783 Namespace (lang=de) Benutzer {{ns:User}}
7784 !! options
7785 language=de
7786 !! wikitext
7787 {{ns:User}}
7788 !! html
7789 <p>Benutzer
7790 </p>
7791 !! end
7792
7793 !! test
7794 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7795 !! options
7796 language=de
7797 !! wikitext
7798 {{ns:3}}
7799 !! html
7800 <p>Benutzer Diskussion
7801 </p>
7802 !! end
7803
7804
7805 !! test
7806 Urlencode
7807 !! wikitext
7808 {{urlencode:hi world?!}}
7809 {{urlencode:hi world?!|WIKI}}
7810 {{urlencode:hi world?!|PATH}}
7811 {{urlencode:hi world?!|QUERY}}
7812 !! html
7813 <p>hi+world%3F%21
7814 hi_world%3F!
7815 hi%20world%3F%21
7816 hi+world%3F%21
7817 </p>
7818 !! end
7819
7820 !! test
7821 Magic Word: prioritize type info over data-parsoid
7822 !! options
7823 parsoid=html2wt
7824 !! wikitext
7825 __FORCETOC__
7826 !! html
7827 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7828 !! end
7829
7830 !! test
7831 Magic Word: serialize on separate line (parsoid)
7832 !! options
7833 parsoid=wt2wt,html2wt
7834 !! wikitext
7835 foo
7836 __NOTOC__
7837 bar
7838 !! html
7839 foo<meta property="mw:PageProp/notoc"/>bar
7840 !! end
7841
7842 !! test
7843 Magic Word: rt non-english wikis
7844 !! options
7845 parsoid=wt2wt
7846 language=de
7847 !! wikitext
7848 __NOEDITSECTION__
7849 !! html
7850 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7851 !! end
7852
7853 ###
7854 ### Magic links
7855 ###
7856 !! test
7857 Magic links: internal link to RFC (bug 479)
7858 !! wikitext
7859 [[RFC 123]]
7860 !! html
7861 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
7862 </p>
7863 !! end
7864
7865 !! test
7866 Magic links: RFC (bug 479)
7867 !! wikitext
7868 RFC 822
7869 !! html
7870 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7871 </p>
7872 !! end
7873
7874 !! test
7875 Magic links: ISBN (bug 1937)
7876 !! wikitext
7877 ISBN 0-306-40615-2
7878 !! html
7879 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7880 </p>
7881 !! end
7882
7883 !! test
7884 Magic links: PMID incorrectly converts space to underscore
7885 !! wikitext
7886 PMID 1234
7887 !! html
7888 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7889 </p>
7890 !! end
7891
7892 ###
7893 ### Templates
7894 ####
7895
7896 !! test
7897 Nonexistent template
7898 !! wikitext
7899 {{thistemplatedoesnotexist}}
7900 !! html
7901 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
7902 </p>
7903 !! end
7904
7905 !! test
7906 Template with invalid target containing tags
7907 !! wikitext
7908 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7909 !! html
7910 <p>{{a<b>b</b>|foo|a=b|a = b}}
7911 </p>
7912 !! end
7913
7914 !! test
7915 Template with invalid target containing unclosed tag
7916 !! wikitext
7917 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7918 !! html
7919 <p>{{a<b>|foo|a=b|a = b}}</b>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Template with invalid target containing wikilink
7925 !! wikitext
7926 {{[[Main Page]]}}
7927 !! html/php
7928 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7929 </p>
7930 !! html/parsoid
7931 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
7932 !! end
7933
7934 !! article
7935 Template:test
7936 !! text
7937 This is a test template
7938 !! endarticle
7939
7940 !! test
7941 Simple template
7942 !! wikitext
7943 {{test}}
7944 !! html
7945 <p>This is a test template
7946 </p>
7947 !! end
7948
7949 !! test
7950 Template with explicit namespace
7951 !! wikitext
7952 {{Template:test}}
7953 !! html
7954 <p>This is a test template
7955 </p>
7956 !! end
7957
7958
7959 !! article
7960 Template:paramtest
7961 !! text
7962 This is a test template with parameter {{{param}}}
7963 !! endarticle
7964
7965 !! test
7966 Template parameter
7967 !! wikitext
7968 {{paramtest|param=foo}}
7969 !! html
7970 <p>This is a test template with parameter foo
7971 </p>
7972 !! end
7973
7974 !! article
7975 Template:paramtestnum
7976 !! text
7977 [[{{{1}}}|{{{2}}}]]
7978 !! endarticle
7979
7980 !! test
7981 Template unnamed parameter
7982 !! wikitext
7983 {{paramtestnum|Main Page|the main page}}
7984 !! html
7985 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7986 </p>
7987 !! end
7988
7989 !! article
7990 Template:templatesimple
7991 !! text
7992 (test)
7993 !! endarticle
7994
7995 !! article
7996 Template:templateredirect
7997 !! text
7998 #redirect [[Template:templatesimple]]
7999 !! endarticle
8000
8001 !! article
8002 Template:templateasargtestnum
8003 !! text
8004 {{{{{1}}}}}
8005 !! endarticle
8006
8007 !! article
8008 Template:templateasargtest
8009 !! text
8010 {{template{{{templ}}}}}
8011 !! endarticle
8012
8013 !! article
8014 Template:templateasargtest2
8015 !! text
8016 {{{{{templ}}}}}
8017 !! endarticle
8018
8019 !! test
8020 Template with template name as unnamed argument
8021 !! wikitext
8022 {{templateasargtestnum|templatesimple}}
8023 !! html
8024 <p>(test)
8025 </p>
8026 !! end
8027
8028 !! test
8029 Template with template name as argument
8030 !! wikitext
8031 {{templateasargtest|templ=simple}}
8032 !! html
8033 <p>(test)
8034 </p>
8035 !! end
8036
8037 !! test
8038 Template with template name as argument (2)
8039 !! wikitext
8040 {{templateasargtest2|templ=templatesimple}}
8041 !! html
8042 <p>(test)
8043 </p>
8044 !! end
8045
8046 !! article
8047 Template:templateasargtestdefault
8048 !! text
8049 {{{{{templ|templatesimple}}}}}
8050 !! endarticle
8051
8052 !! article
8053 Template:templa
8054 !! text
8055 '''templ'''
8056 !! endarticle
8057
8058 !! test
8059 Template with default value
8060 !! wikitext
8061 {{templateasargtestdefault}}
8062 !! html
8063 <p>(test)
8064 </p>
8065 !! end
8066
8067 !! test
8068 Template with default value (value set)
8069 !! wikitext
8070 {{templateasargtestdefault|templ=templa}}
8071 !! html
8072 <p><b>templ</b>
8073 </p>
8074 !! end
8075
8076 !! test
8077 Template redirect
8078 !! wikitext
8079 {{templateredirect}}
8080 !! html
8081 <p>(test)
8082 </p>
8083 !! end
8084
8085 !! test
8086 Template with argument in separate line
8087 !! wikitext
8088 {{ templateasargtest |
8089 templ = simple }}
8090 !! html
8091 <p>(test)
8092 </p>
8093 !! end
8094
8095 !! test
8096 Template with complex template as argument
8097 !! wikitext
8098 {{paramtest|
8099 param ={{ templateasargtest |
8100 templ = simple }}}}
8101 !! html
8102 <p>This is a test template with parameter (test)
8103 </p>
8104 !! end
8105
8106 !! test
8107 Template with thumb image (with link in description)
8108 !! wikitext
8109 {{paramtest|
8110 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8111 !! html
8112 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
8113
8114 !! end
8115
8116 !! article
8117 Template:complextemplate
8118 !! text
8119 {{{1}}} {{paramtest|
8120 param ={{{param}}}}}
8121 !! endarticle
8122
8123 !! test
8124 Template with complex arguments
8125 !! wikitext
8126 {{complextemplate|
8127 param ={{ templateasargtest |
8128 templ = simple }}|[[Template:complextemplate|link]]}}
8129 !! html
8130 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8131 </p>
8132 !! end
8133
8134 !! test
8135 BUG 553: link with two variables in a piped link
8136 !! wikitext
8137 {|
8138 |[[{{{1}}}|{{{2}}}]]
8139 |}
8140 !! html
8141 <table>
8142 <tr>
8143 <td>[[{{{1}}}|{{{2}}}]]
8144 </td></tr></table>
8145
8146 !! end
8147
8148 !! test
8149 Magic variable as template parameter
8150 !! wikitext
8151 {{paramtest|param={{SITENAME}}}}
8152 !! html
8153 <p>This is a test template with parameter MediaWiki
8154 </p>
8155 !! end
8156
8157 !! article
8158 Template:linktest
8159 !! text
8160 [[{{{param}}}|link]]
8161 !! endarticle
8162
8163 !! test
8164 Template parameter as link source
8165 !! wikitext
8166 {{linktest|param=Main Page}}
8167 !! html
8168 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8169 </p>
8170 !! end
8171
8172 !!test
8173 Template-generated attribute string (k='v')
8174 !! wikitext
8175 <span {{attr_str|id|v1}}>bar</span>
8176 !! html
8177 <p><span id="v1">bar</span>
8178 </p>
8179 !!end
8180
8181 !!article
8182 Template:paramtest2
8183 !! text
8184 including another template, {{paramtest|param={{{arg}}}}}
8185 !! endarticle
8186
8187 !! test
8188 Template passing argument to another template
8189 !! wikitext
8190 {{paramtest2|arg='hmm'}}
8191 !! html
8192 <p>including another template, This is a test template with parameter 'hmm'
8193 </p>
8194 !! end
8195
8196 !! article
8197 Template:Linktest2
8198 !! text
8199 Main Page
8200 !! endarticle
8201
8202 !! test
8203 Template as link source
8204 !! wikitext
8205 [[{{linktest2}}]]
8206
8207 [[{{linktest2}}|Main Page]]
8208
8209 [[{{linktest2}}]]Page
8210 !! html
8211 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8212 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8213 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8214 </p>
8215 !! end
8216
8217
8218 !! article
8219 Template:loop1
8220 !! text
8221 {{loop2}}
8222 !! endarticle
8223
8224 !! article
8225 Template:loop2
8226 !! text
8227 {{loop1}}
8228 !! endarticle
8229
8230 !! test
8231 Template infinite loop
8232 !! wikitext
8233 {{loop1}}
8234 !! html
8235 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8236 </p>
8237 !! end
8238
8239 !! test
8240 Template from main namespace
8241 !! wikitext
8242 {{:Main Page}}
8243 !! html
8244 <p>blah blah
8245 </p>
8246 !! end
8247
8248 !! article
8249 Template:table
8250 !! text
8251 {|
8252 | 1 || 2
8253 |-
8254 | 3 || 4
8255 |}
8256 !! endarticle
8257
8258 !! test
8259 BUG 529: Template with table, not included at beginning of line
8260 !! wikitext
8261 foo {{table}}
8262 !! html
8263 <p>foo
8264 </p>
8265 <table>
8266 <tr>
8267 <td> 1 </td>
8268 <td> 2
8269 </td></tr>
8270 <tr>
8271 <td> 3 </td>
8272 <td> 4
8273 </td></tr></table>
8274
8275 !! end
8276
8277 !! test
8278 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8279 !! wikitext
8280 foo
8281 {{table}}
8282 !! html
8283 <p>foo
8284 </p>
8285 <table>
8286 <tr>
8287 <td> 1 </td>
8288 <td> 2
8289 </td></tr>
8290 <tr>
8291 <td> 3 </td>
8292 <td> 4
8293 </td></tr></table>
8294
8295 !! end
8296
8297 !! test
8298 BUG 41: Template parameters shown as broken links
8299 !! wikitext
8300 {{{parameter}}}
8301 !! html
8302 <p>{{{parameter}}}
8303 </p>
8304 !! end
8305
8306 !! test
8307 Template with targets containing wikilinks
8308 !! wikitext
8309 {{[[foo]]}}
8310
8311 {{[[{{echo|foo}}]]}}
8312
8313 {{{{echo|[[foo}}]]}}
8314 !! html
8315 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8316 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8317 </p><p>{{[[foo}}]]
8318 </p>
8319 !! end
8320
8321 !! article
8322 Template:MSGNW test
8323 !! text
8324 ''None'' of '''this''' should be
8325 * interpreted
8326 but rather passed unmodified
8327 {{test}}
8328 !! endarticle
8329
8330 # hmm, fix this or just deprecate msgnw and document its behavior?
8331 !! test
8332 msgnw keyword
8333 !! options
8334 disabled
8335 !! wikitext
8336 {{msgnw:MSGNW test}}
8337 !! html
8338 <p>''None'' of '''this''' should be
8339 * interpreted
8340 but rather passed unmodified
8341 {{test}}
8342 </p>
8343 !! end
8344
8345 !! test
8346 int keyword
8347 !! wikitext
8348 {{int:youhavenewmessages|lots of money|not!}}
8349 !! html
8350 <p>You have lots of money (not!).
8351 </p>
8352 !! end
8353
8354 !! article
8355 Template:Includes
8356 !! text
8357 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8358 !! endarticle
8359
8360 !! test
8361 <includeonly> and <noinclude> being included
8362 !! wikitext
8363 {{Includes}}
8364 !! html
8365 <p>Foobar
8366 </p>
8367 !! end
8368
8369 !! article
8370 Template:Includes2
8371 !! text
8372 <onlyinclude>Foo</onlyinclude>bar
8373 !! endarticle
8374
8375 !! test
8376 <onlyinclude> being included
8377 !! wikitext
8378 {{Includes2}}
8379 !! html
8380 <p>Foo
8381 </p>
8382 !! end
8383
8384
8385 !! article
8386 Template:Includes3
8387 !! text
8388 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8389 !! endarticle
8390
8391 !! test
8392 <onlyinclude> and <includeonly> being included
8393 !! wikitext
8394 {{Includes3}}
8395 !! html
8396 <p>Foo
8397 </p>
8398 !! end
8399
8400 !! test
8401 <includeonly> and <noinclude> on a page
8402 !! wikitext
8403 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8404 !! html
8405 <p>Foozar
8406 </p>
8407 !! end
8408
8409 !! test
8410 Un-closed <noinclude>
8411 !! wikitext
8412 <noinclude>
8413 !! html
8414 !! end
8415
8416 !! test
8417 <onlyinclude> on a page
8418 !! wikitext
8419 <onlyinclude>Foo</onlyinclude>bar
8420 !! html
8421 <p>Foobar
8422 </p>
8423 !! end
8424
8425 !! test
8426 Un-closed <onlyinclude>
8427 !! wikitext
8428 <onlyinclude>
8429 !! html
8430 !! end
8431
8432 !!test
8433 Self-closed noinclude, includeonly, onlyinclude tags
8434 !! wikitext
8435 <noinclude />
8436 <includeonly />
8437 <onlyinclude />
8438 !! html
8439 <p><br />
8440 </p>
8441 !!end
8442
8443 !!test
8444 Unbalanced includeonly and noinclude tags
8445 !! wikitext
8446 {|
8447 |a</noinclude>
8448 |b</noinclude></noinclude>
8449 |c</noinclude></includeonly>
8450 |d</includeonly></includeonly>
8451 |}
8452 !! html
8453 <table>
8454 <tr>
8455 <td>a
8456 </td>
8457 <td>b
8458 </td>
8459 <td>c&lt;/includeonly&gt;
8460 </td>
8461 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8462 </td></tr></table>
8463
8464 !!end
8465
8466 !! article
8467 Template:Includeonly section
8468 !! text
8469 <includeonly>
8470 ==Includeonly section==
8471 </includeonly>
8472 ==Section T-1==
8473 !!endarticle
8474
8475 !! test
8476 Bug 6563: Edit link generation for section shown by <includeonly>
8477 !! wikitext
8478 {{includeonly section}}
8479 !! html
8480 <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>
8481 <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>
8482
8483 !! end
8484
8485 # Uses same input as the contents of [[Template:Includeonly section]]
8486 !! test
8487 Bug 6563: Section extraction for section shown by <includeonly>
8488 !! options
8489 section=T-2
8490 !! wikitext
8491 <includeonly>
8492 ==Includeonly section==
8493 </includeonly>
8494 ==Section T-2==
8495 !! html
8496 ==Section T-2==
8497 !! end
8498
8499 !! test
8500 Bug 6563: Edit link generation for section suppressed by <includeonly>
8501 !! wikitext
8502 <includeonly>
8503 ==Includeonly section==
8504 </includeonly>
8505 ==Section 1==
8506 !! html
8507 <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>
8508
8509 !! end
8510
8511 !! test
8512 Bug 6563: Section extraction for section suppressed by <includeonly>
8513 !! options
8514 section=1
8515 !! wikitext
8516 <includeonly>
8517 ==Includeonly section==
8518 </includeonly>
8519 ==Section 1==
8520 !! html
8521 ==Section 1==
8522 !! end
8523
8524 !! test
8525 Un-closed <includeonly>
8526 !! wikitext
8527 <includeonly>
8528 !! html
8529 !! end
8530
8531 # TODO: test with DOM fragment reuse!
8532 !! test
8533 Parsoid: DOM fragment reuse
8534 !! options
8535 parsoid=wt2wt,wt2html
8536 !! wikitext
8537 a{{echo|b<table></table>c}}d
8538
8539 a{{echo|b
8540 <table></table>
8541 c}}d
8542
8543 {{echo|a
8544
8545 <table></table>
8546
8547 b}}
8548 !! html
8549 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8550 <table></table>c"}},"i":0}}]}'>b</span>
8551 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8552
8553
8554 <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">
8555 </span>
8556 <table about="#mwt2"></table><span about="#mwt2">
8557 </span>
8558 <p about="#mwt2">cd</p>
8559
8560
8561 <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">
8562
8563 </span>
8564 <table about="#mwt3"></table><span about="#mwt3">
8565
8566 </span>
8567 <p about="#mwt3">b</p>
8568 !! end
8569
8570 !! test
8571 Parsoid: Merge double tds (bug 50603)
8572 !! options
8573 parsoid
8574 !! wikitext
8575 {|
8576 |{{echo|{{!}} foo}}
8577 |}
8578 !! html
8579 <table><tbody>
8580 <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>
8581 </tbody></table>
8582 !! end
8583
8584 !! test
8585 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8586 !! options
8587 parsoid
8588 !! wikitext
8589 {{echo|<div>}}
8590 {|
8591 |{{echo|{{!}} foo}}
8592 |}
8593 {{echo|</div>}}
8594 !! html
8595 <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}}]}'>
8596 <table><tbody>
8597 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8598 </tbody></table>
8599 </div>
8600 !! end
8601
8602 ###
8603 ### <includeonly> and <noinclude> in attributes
8604 ###
8605 !!test
8606 0. includeonly around the entire attribute
8607 !! wikitext
8608 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8609 !! html
8610 <p><span id="v2">bar</span>
8611 </p>
8612 !!end
8613
8614 !!test
8615 1. includeonly in html attr key
8616 !! wikitext
8617 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8618 !! html
8619 <p><span id="foo">bar</span>
8620 </p>
8621 !!end
8622
8623 !!test
8624 2. includeonly in html attr value
8625 !! wikitext
8626 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8627 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8628 !! html
8629 <p><span id="v1">bar</span>
8630 <span id="v1">bar</span>
8631 </p>
8632 !!end
8633
8634 !!test
8635 3. includeonly in part of an attr value
8636 !! wikitext
8637 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8638 !! html
8639 <p><span style="color:red;">bar</span>
8640 </p>
8641 !!end
8642
8643 !!test
8644 4. includeonly in table attributes
8645 !! wikitext
8646 {|
8647 |- <noinclude>
8648 |-
8649 |a
8650 </noinclude>
8651 |- <includeonly>
8652 |-
8653 |b
8654 </includeonly>
8655 |}
8656 !! html
8657 <table>
8658
8659
8660 <tr>
8661 <td>a
8662 </td></tr>
8663 </table>
8664
8665 !!end
8666
8667 ###
8668 ### Token Stream Patcher tests
8669 ###
8670 ### These tests won't always pass wt2wt and other modes because
8671 ### on serialization, the table will be output on a new line.
8672 ### For now, we are blacklisting them, and using this to test selser.
8673 ###
8674
8675 !!test
8676 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8677 !!options
8678 parsoid=wt2html,wt2wt
8679 !!wikitext
8680 {{echo|}}{| width = '100%'
8681 |foo
8682 |}
8683 !!html/parsoid
8684 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8685 <table width="100%">
8686 <tbody>
8687 <tr>
8688 <td>foo</td></tr></tbody></table>
8689 !!end
8690
8691 !!test
8692 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8693 !!options
8694 parsoid=wt2html,wt2wt
8695 !!wikitext
8696 <includeonly>a</includeonly>{| {{{b}}}
8697 |c
8698 |}
8699 !!html/parsoid
8700 <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|}"}'>
8701 <tbody><tr><td>c</td></tr>
8702 </tbody></table>
8703 !!end
8704
8705 ###
8706 ### Testing parsing of templates where a template arg
8707 ### has the same name as the template itself.
8708 ###
8709
8710 !! article
8711 Template:quote
8712 !! text
8713 {{{quote|{{{1}}}}}}
8714 !! endarticle
8715
8716 !!test
8717 Templates: Template Name/Arg clash: 1. Use of positional param
8718 !! wikitext
8719 {{quote|foo}}
8720 !! html
8721 <p>foo
8722 </p>
8723 !!end
8724
8725 !!test
8726 Templates: Template Name/Arg clash: 2. Use of named param
8727 !! wikitext
8728 {{quote|quote=foo}}
8729 !! html
8730 <p>foo
8731 </p>
8732 !!end
8733
8734 !!test
8735 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8736 !! wikitext
8737 {{quote|quote}}
8738 !! html
8739 <p>quote
8740 </p>
8741 !!end
8742
8743 ###
8744 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8745 ###
8746
8747 !!test
8748 Templates: 1. Simple use
8749 !! wikitext
8750 {{echo|Foo}}
8751 !! html
8752 <p>Foo
8753 </p>
8754 !!end
8755
8756 !!test
8757 Templates: 2. Inside a block tag
8758 !! wikitext
8759 <div>{{echo|Foo}}</div>
8760 <blockquote>{{echo|Foo}}</blockquote>
8761 !! html
8762 <div>Foo</div>
8763 <blockquote>Foo</blockquote>
8764
8765 !!end
8766
8767 !!test
8768 Templates: P-wrapping: 1a. Templates on consecutive lines
8769 !! wikitext
8770 {{echo|Foo}}
8771 {{echo|bar}}
8772 !! html
8773 <p>Foo
8774 bar
8775 </p>
8776 !!end
8777
8778 !!test
8779 Templates: P-wrapping: 1b. Templates on consecutive lines
8780 !! wikitext
8781 Foo
8782
8783 {{echo|bar}}
8784 {{echo|baz}}
8785 !! html
8786 <p>Foo
8787 </p><p>bar
8788 baz
8789 </p>
8790 !!end
8791
8792 !!test
8793 Templates: P-wrapping: 1c. Templates on consecutive lines
8794 !! wikitext
8795 {{echo|Foo}}
8796 {{echo|bar}} <div>baz</div>
8797 !! html
8798 <p>Foo
8799 </p>
8800 bar <div>baz</div>
8801
8802 !!end
8803
8804 !!test
8805 Templates: P-wrapping: 1d. Template preceded by comment-only line
8806 !!options
8807 parsoid
8808 !! wikitext
8809 <!-- foo -->
8810 {{echo|Bar}}
8811 !! html
8812 <!-- foo -->
8813
8814 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8815 !!end
8816
8817 !!test
8818 Templates: Inline Text: 1. Multiple template uses
8819 !! wikitext
8820 {{echo|Foo}}bar{{echo|baz}}
8821 !! html
8822 <p>Foobarbaz
8823 </p>
8824 !!end
8825
8826 !!test
8827 Templates: Inline Text: 2. Back-to-back template uses
8828 !! wikitext
8829 {{echo|Foo}}{{echo|bar}}
8830 !! html
8831 <p>Foobar
8832 </p>
8833 !!end
8834
8835 !!test
8836 Templates: Block Tags: 1. Multiple template uses
8837 !! wikitext
8838 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8839 !! html
8840 <div>Foo</div><div>bar</div><div>baz</div>
8841
8842 !!end
8843
8844 !!test
8845 Templates: Block Tags: 2. Back-to-back template uses
8846 !! wikitext
8847 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8848 !! html
8849 <div>Foo</div><div>bar</div>
8850
8851 !!end
8852
8853 !!test
8854 Templates: Links: 1. Simple example
8855 !! wikitext
8856 {{echo|[[Foo|bar]]}}
8857 !! html
8858 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8859 </p>
8860 !!end
8861
8862 !!test
8863 Templates: Links: 2. Generation of link href
8864 !! wikitext
8865 [[{{echo|Foo}}|bar]]
8866 !! html
8867 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8868 </p>
8869 !!end
8870
8871 !!test
8872 Templates: Links: 3. Generation of part of a link href
8873 !! wikitext
8874 [[Fo{{echo|o}}|bar]]
8875
8876 [[Foo{{echo|bar}}]]
8877
8878 [[Foo{{echo|bar}}baz]]
8879
8880 [[Foo{{echo|bar}}|bar]]
8881
8882 [[:Foo{{echo|bar}}]]
8883
8884 [[:Foo{{echo|bar}}|bar]]
8885 !! html
8886 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8887 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8888 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8889 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8890 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8891 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8892 </p>
8893 !!end
8894
8895 !!test
8896 Templates: Links: 4. Multiple templates generating link href
8897 !! wikitext
8898 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8899 !! html
8900 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8901 </p>
8902 !!end
8903
8904 !!test
8905 Templates: Links: 5. Generation of link text
8906 !! wikitext
8907 [[Foo|{{echo|bar}}]]
8908 !! html
8909 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8910 </p>
8911 !!end
8912
8913 !!test
8914 Templates: Links: 5. Nested templates (only outermost template should be marked)
8915 !! wikitext
8916 {{echo|[[{{echo|Foo}}|bar]]}}
8917 !! html
8918 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8919 </p>
8920 !!end
8921
8922 !!test
8923 Templates: HTML Tag: 1. Generation of HTML attr. key
8924 !! wikitext
8925 <div {{echo|style}}="color:red;">foo</div>
8926 !! html
8927 <div style="color:red;">foo</div>
8928
8929 !!end
8930
8931 !!test
8932 Templates: HTML Tag: 2. Generation of HTML attr. value
8933 !! wikitext
8934 <div style={{echo|'color:red;'}}>foo</div>
8935 !! html
8936 <div style="color:red;">foo</div>
8937
8938 !!end
8939
8940 !!test
8941 Templates: HTML Tag: 3. Generation of HTML attr key and value
8942 !! wikitext
8943 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8944 !! html
8945 <div style="color:red;">foo</div>
8946
8947 !!end
8948
8949 !!test
8950 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8951 !! wikitext
8952 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8953 !! html
8954 <div title="This is a long title with just one piece templated">foo</div>
8955
8956 !!end
8957
8958 !!test
8959 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8960 !! wikitext
8961 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8962 !! html
8963 <div title="This is a long title with just one piece templated">foo</div>
8964
8965 !!end
8966
8967 !!test
8968 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8969 !! wikitext
8970 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8971 !! html
8972 <div title="This is a long title with just one piece templated">foo</div>
8973
8974 !!end
8975
8976 !!test
8977 Templates: HTML Tag: 7. Generation of partial attribute key string
8978 !! wikitext
8979 <div st{{echo|yle}}="color:red;">foo</div>
8980 !! html
8981 <div style="color:red;">foo</div>
8982
8983 !!end
8984
8985 !!test
8986 Templates: HTML Tables: 1. Generating start of a HTML table
8987 !! wikitext
8988 {{echo|<table><tr><td>foo</td>}}</tr></table>
8989 !! html
8990 <table><tr><td>foo</td></tr></table>
8991
8992 !!end
8993
8994 !!test
8995 Templates: HTML Tables: 2a. Generating middle of a HTML table
8996 !! wikitext
8997 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8998 !! html
8999 <table><tr><td>foo</td></tr></table>
9000
9001 !!end
9002
9003 !!test
9004 Templates: HTML Tables: 2b. Generating middle of a HTML table
9005 !! wikitext
9006 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9007 !! html
9008 <table><tr><td>foo</td></tr></table>
9009
9010 !!end
9011
9012 !!test
9013 Templates: HTML Tables: 3. Generating end of a HTML table
9014 !! wikitext
9015 <table><tr>{{echo|<td>foo</td></tr></table>}}
9016 !! html
9017 <table><tr><td>foo</td></tr></table>
9018
9019 !!end
9020
9021 !!test
9022 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9023 !! wikitext
9024 {{echo|<table>}}<tr><td>foo</td></tr></table>
9025 !! html
9026 <table><tr><td>foo</td></tr></table>
9027
9028 !!end
9029
9030 !!test
9031 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9032 !! wikitext
9033 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9034 !! html
9035 <table><tr><td>foo</td></tr></table>
9036
9037 !!end
9038
9039 !!test
9040 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9041 !! wikitext
9042 <table><tr>{{echo|<td>}}foo</td></tr></table>
9043 !! html
9044 <table><tr><td>foo</td></tr></table>
9045
9046 !!end
9047
9048 !!test
9049 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9050 !! wikitext
9051 <table><tr><td>foo{{echo|</td>}}</tr></table>
9052 !! html
9053 <table><tr><td>foo</td></tr></table>
9054
9055 !!end
9056
9057 !!test
9058 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9059 !! wikitext
9060 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9061 !! html
9062 <table><tr><td>foo</td></tr></table>
9063
9064 !!end
9065
9066 !!test
9067 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9068 !! wikitext
9069 <table><tr><td>foo</td></tr>{{echo|</table>}}
9070 !! html
9071 <table><tr><td>foo</td></tr></table>
9072
9073 !!end
9074
9075 !!test
9076 Templates: HTML Tables: 5. Proper fostering of categories from inside
9077 !!options
9078 parsoid=wt2html,wt2wt
9079 !! wikitext
9080 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9081 <!--Two categories (Bug 50330)-->
9082 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9083 !! html
9084 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9085 <!--Two categories (Bug 50330)-->
9086 <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>
9087 !!end
9088
9089 !!test
9090 Templates: Wiki Tables: 1a. Fostering of entire template content
9091 !! wikitext
9092 {|
9093 {{echo|a}}
9094 |}
9095 !! html
9096 <table>
9097 a
9098 <tr><td></td></tr></table>
9099
9100 !!end
9101
9102 !!test
9103 Templates: Wiki Tables: 1b. Fostering of entire template content
9104 !! wikitext
9105 {|
9106 {{echo|<div>}}
9107 foo
9108 {{echo|</div>}}
9109 |}
9110 !! html
9111 <table>
9112 <div>
9113 <p>foo
9114 </p>
9115 </div>
9116 <tr><td></td></tr></table>
9117
9118 !!end
9119
9120 !!test
9121 Templates: Wiki Tables: 2. Fostering of partial template content
9122 !! wikitext
9123 {|
9124 {{echo|a
9125 <div>b</div>}}
9126 |}
9127 !! html
9128 <table>
9129 a
9130 <div>b</div>
9131 <tr><td></td></tr></table>
9132
9133 !!end
9134
9135 !!test
9136 Templates: Wiki Tables: 3. td-content via multiple templates
9137 !! wikitext
9138 {|
9139 {{echo|{{pipe}}a}}{{echo|b}}
9140 |}
9141 !! html
9142 <table>
9143 <tr>
9144 <td>ab
9145 </td></tr></table>
9146
9147 !!end
9148
9149 !!test
9150 Templates: Wiki Tables: 4. Templated tags, no content
9151 !! wikitext
9152 {{tbl-start}}
9153 {{tbl-end}}
9154 !! html
9155 <table>
9156 <tr><td></td></tr></table>
9157
9158 !!end
9159
9160 !!test
9161 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9162 !! wikitext
9163 {{tbl-start}}
9164 |foo
9165 {{tbl-end}}
9166 !! html
9167 <table>
9168 <tr>
9169 <td>foo
9170 </td></tr></table>
9171
9172 !!end
9173
9174 !!test
9175 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9176 !! wikitext
9177 {{tbl-start}}
9178 {{!}}foo
9179 {{tbl-end}}
9180 !! html
9181 <table>
9182 <tr>
9183 <td>foo
9184 </td></tr></table>
9185
9186 !!end
9187
9188 !!test
9189 Templates: Lists: Multi-line list-items via templates
9190 !! wikitext
9191 *{{echo|a {{nonexistent|
9192 unused}}}}
9193 *{{echo|b {{nonexistent|
9194 unused}}}}
9195 !! html
9196 <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>
9197 <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>
9198
9199 !!end
9200
9201 !!test
9202 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9203 !! wikitext
9204 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9205 !! html
9206 <p><i>ab</i>c<i>d</i>e
9207 </p>
9208 !!end
9209
9210 !!test
9211 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9212 (PHP parser generates misnested html)
9213 !! wikitext
9214 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9215 !! html/parsoid
9216 <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>
9217 !!end
9218
9219 !!test
9220 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9221 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9222 !! options
9223 parsoid=wt2html,wt2wt
9224 !! wikitext
9225 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9226 !! html
9227 <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>
9228 <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>
9229 <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>
9230 !!end
9231
9232 !!test
9233 Templates: Ugly nesting: 4. Divs opened/closed across templates
9234 !! wikitext
9235 a<div>b{{echo|c</div>d}}e
9236 !! html
9237 a<div>bc</div>de
9238
9239 !!end
9240
9241 !!test
9242 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9243 (Parsoid-centric)
9244 !! options
9245 parsoid
9246 !! wikitext
9247 {|
9248 |{{echo|foo</table>}}
9249 |bar
9250 |}
9251 !! html
9252 <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|}"]}'>
9253
9254 <tbody>
9255 <tr>
9256 <td>foo</td></tr></tbody></table><span about="#mwt1">
9257 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9258 |}</span>
9259 !!end
9260
9261 !!test
9262 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9263 (Parsoid-centric)
9264 !! options
9265 parsoid
9266 !! wikitext
9267 <table>
9268 <tr>
9269 <td>
9270 <table>
9271 <tr>
9272 <td>1. {{echo|foo </table>}}</td>
9273 <td> bar </td>
9274 <td>2. {{echo|baz </table>}}</td>
9275 </tr>
9276 <tr>
9277 <td>abc</td>
9278 </tr>
9279 </table>
9280 </td>
9281 </tr>
9282 <tr>
9283 <td>xyz</td>
9284 </tr>
9285 </table>
9286 !! html
9287 <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>"]}'>
9288 <tbody><tr>
9289 <td>
9290 <table>
9291 <tbody><tr>
9292 <td>1. foo </td></tr></tbody></table></td>
9293 <td> bar </td>
9294 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9295 </span><span about="#mwt2">
9296 </span><span about="#mwt2">
9297 </span><span about="#mwt2">abc</span><span about="#mwt2">
9298 </span><span about="#mwt2">
9299 </span><span about="#mwt2">
9300 </span><span about="#mwt2">
9301 </span><span about="#mwt2">
9302 </span><span about="#mwt2">
9303 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9304 </span><span about="#mwt2">
9305 </span>
9306 !!end
9307
9308 !! test
9309 Templates: Ugly templates: 3. newline-only template parameter
9310 !! wikitext
9311 foo {{echo|
9312 }}
9313 !! html
9314 <p>foo
9315 </p>
9316 !! end
9317
9318 # This looks like a bug: a single newline triggers p/br for some reason.
9319 !! test
9320 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9321 !! wikitext
9322 {{echo|
9323 }}
9324 !! html
9325 <p><br />
9326 </p>
9327 !! end
9328
9329 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9330 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9331 !! test
9332 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9333 !! wikitext
9334 {{echo|<table>}}
9335 {{echo|<div>foo}}
9336 {{echo|</table>}}
9337 !! html/parsoid
9338 <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
9339 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9340 </table>
9341 !! end
9342
9343 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9344 # that are "identical" and generate nesting cycles in the algorithm
9345 !! test
9346 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9347 !! wikitext
9348 {{echo|<table><tr><td><table>}}
9349 {{echo|<div>}}
9350 {{echo|</div>}}
9351 !! html/parsoid
9352 <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"}'>
9353 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9354 </table></td></tr></tbody></table>
9355 !! end
9356
9357 !!test
9358 Parser Functions: 1. Simple example
9359 !! wikitext
9360 {{uc:foo}}
9361 !! html
9362 <p>FOO
9363 </p>
9364 !!end
9365
9366 !!test
9367 Parser Functions: 2. Nested use (only outermost should be marked up)
9368 !! wikitext
9369 {{uc:{{lc:FOO}}}}
9370 !! html
9371 <p>FOO
9372 </p>
9373 !!end
9374
9375 ###
9376 ### Pre-save transform tests
9377 ###
9378 !! test
9379 pre-save transform: subst:
9380 !! options
9381 PST
9382 !! wikitext
9383 {{subst:test}}
9384 !! html
9385 This is a test template
9386 !! end
9387
9388 !! test
9389 pre-save transform: normal template
9390 !! options
9391 PST
9392 !! wikitext
9393 {{test}}
9394 !! html
9395 {{test}}
9396 !! end
9397
9398 !! test
9399 pre-save transform: nonexistent template
9400 !! options
9401 PST
9402 !! wikitext
9403 {{thistemplatedoesnotexist}}
9404 !! html
9405 {{thistemplatedoesnotexist}}
9406 !! end
9407
9408
9409 !! test
9410 pre-save transform: subst magic variables
9411 !! options
9412 PST
9413 !! wikitext
9414 {{subst:SITENAME}}
9415 !! html
9416 MediaWiki
9417 !! end
9418
9419 # This is bug 89, which I fixed. -- wtm
9420 !! test
9421 pre-save transform: subst: templates with parameters
9422 !! options
9423 pst
9424 !! wikitext
9425 {{subst:paramtest|param="something else"}}
9426 !! html
9427 This is a test template with parameter "something else"
9428 !! end
9429
9430 !! article
9431 Template:nowikitest
9432 !! text
9433 <nowiki>'''not wiki'''</nowiki>
9434 !! endarticle
9435
9436 !! test
9437 pre-save transform: nowiki in subst (bug 1188)
9438 !! options
9439 pst
9440 !! wikitext
9441 {{subst:nowikitest}}
9442 !! html
9443 <nowiki>'''not wiki'''</nowiki>
9444 !! end
9445
9446
9447 !! article
9448 Template:commenttest
9449 !! text
9450 This template has <!-- a comment --> in it.
9451 !! endarticle
9452
9453 !! test
9454 pre-save transform: comment in subst (bug 1936)
9455 !! options
9456 pst
9457 !! wikitext
9458 {{subst:commenttest}}
9459 !! html
9460 This template has <!-- a comment --> in it.
9461 !! end
9462
9463 !! test
9464 pre-save transform: unclosed tag
9465 !! options
9466 pst noxml
9467 !! wikitext
9468 <nowiki>'''not wiki'''
9469 !! html
9470 <nowiki>'''not wiki'''
9471 !! end
9472
9473 !! test
9474 pre-save transform: mixed tag case
9475 !! options
9476 pst noxml
9477 !! wikitext
9478 <NOwiki>'''not wiki'''</noWIKI>
9479 !! html
9480 <NOwiki>'''not wiki'''</noWIKI>
9481 !! end
9482
9483 !! test
9484 pre-save transform: unclosed comment in <nowiki>
9485 !! options
9486 pst noxml
9487 !! wikitext
9488 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9489 !! html
9490 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9491 !!end
9492
9493 # Leading @ in this template definition works around a limitation
9494 # in parsoid's parserTests which otherwise strips the <span> from the
9495 # result (confusing it for a template wrapper)
9496 !! article
9497 Template:dangerous
9498 !!text
9499 @<span onmouseover="alert('crap')">Oh no</span>
9500 !!endarticle
9501
9502 !!test
9503 (confirming safety of fix for subst bug 1936)
9504 !! wikitext
9505 {{Template:dangerous}}
9506 !! html
9507 <p>@<span>Oh no</span>
9508 </p>
9509 !! end
9510
9511 !! test
9512 pre-save transform: comment containing gallery (bug 5024)
9513 !! options
9514 pst
9515 !! wikitext
9516 <!-- <gallery>data</gallery> -->
9517 !! html
9518 <!-- <gallery>data</gallery> -->
9519 !!end
9520
9521 !! test
9522 pre-save transform: comment containing extension
9523 !! options
9524 pst
9525 !! wikitext
9526 <!-- <tag>data</tag> -->
9527 !! html
9528 <!-- <tag>data</tag> -->
9529 !!end
9530
9531 !! test
9532 pre-save transform: comment containing nowiki
9533 !! options
9534 pst
9535 !! wikitext
9536 <!-- <nowiki>data</nowiki> -->
9537 !! html
9538 <!-- <nowiki>data</nowiki> -->
9539 !!end
9540
9541 !! test
9542 pre-save transform: <noinclude> in subst (bug 3298)
9543 !! options
9544 pst
9545 !! wikitext
9546 {{subst:Includes}}
9547 !! html
9548 Foobar
9549 !! end
9550
9551 !! test
9552 pre-save transform: <onlyinclude> in subst (bug 3298)
9553 !! options
9554 pst
9555 !! wikitext
9556 {{subst:Includes2}}
9557 !! html
9558 Foo
9559 !! end
9560
9561 !! article
9562 Template:SubstTest
9563 !!text
9564 {{<includeonly>subst:</includeonly>Includes}}
9565 !! endarticle
9566
9567 !! article
9568 Template:SafeSubstTest
9569 !! text
9570 {{<includeonly>safesubst:</includeonly>Includes}}
9571 !! endarticle
9572
9573 !! test
9574 bug 22297: safesubst: works during PST
9575 !! options
9576 pst
9577 !! wikitext
9578 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9579 !! html
9580 FoobarFoobar
9581 !! end
9582
9583 !! test
9584 bug 22297: safesubst: works during normal parse
9585 !! wikitext
9586 {{SafeSubstTest}}
9587 !! html
9588 <p>Foobar
9589 </p>
9590 !! end
9591
9592 !! test
9593 subst: does not work during normal parse
9594 !! wikitext
9595 {{SubstTest}}
9596 !! html
9597 <p>{{subst:Includes}}
9598 </p>
9599 !! end
9600
9601 !! test
9602 pre-save transform: context links ("pipe trick")
9603 !! options
9604 pst
9605 !! wikitext
9606 [[Article (context)|]]
9607 [[Bar:Article|]]
9608 [[:Bar:Article|]]
9609 [[Bar:Article (context)|]]
9610 [[:Bar:Article (context)|]]
9611 [[|Article]]
9612 [[|Article (context)]]
9613 [[Bar:X (Y) Z|]]
9614 [[:Bar:X (Y) Z|]]
9615 !! html
9616 [[Article (context)|Article]]
9617 [[Bar:Article|Article]]
9618 [[:Bar:Article|Article]]
9619 [[Bar:Article (context)|Article]]
9620 [[:Bar:Article (context)|Article]]
9621 [[Article]]
9622 [[Article (context)]]
9623 [[Bar:X (Y) Z|X (Y) Z]]
9624 [[:Bar:X (Y) Z|X (Y) Z]]
9625 !! end
9626
9627 !! test
9628 pre-save transform: context links ("pipe trick") with interwiki prefix
9629 !! options
9630 pst
9631 !! wikitext
9632 [[interwiki:Article|]]
9633 [[:interwiki:Article|]]
9634 [[interwiki:Bar:Article|]]
9635 [[:interwiki:Bar:Article|]]
9636 !! html
9637 [[interwiki:Article|Article]]
9638 [[:interwiki:Article|Article]]
9639 [[interwiki:Bar:Article|Bar:Article]]
9640 [[:interwiki:Bar:Article|Bar:Article]]
9641 !! end
9642
9643 !! test
9644 pre-save transform: context links ("pipe trick") with parens in title
9645 !! options
9646 pst title=[[Somearticle (context)]]
9647 !! wikitext
9648 [[|Article]]
9649 !! html
9650 [[Article (context)|Article]]
9651 !! end
9652
9653 !! test
9654 pre-save transform: context links ("pipe trick") with comma in title
9655 !! options
9656 pst title=[[Someplace, Somewhere]]
9657 !! wikitext
9658 [[|Otherplace]]
9659 [[Otherplace, Elsewhere|]]
9660 [[Otherplace, Elsewhere, Anywhere|]]
9661 !! html
9662 [[Otherplace, Somewhere|Otherplace]]
9663 [[Otherplace, Elsewhere|Otherplace]]
9664 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9665 !! end
9666
9667 !! test
9668 pre-save transform: context links ("pipe trick") with parens and comma
9669 !! options
9670 pst title=[[Someplace (IGNORED), Somewhere]]
9671 !! wikitext
9672 [[|Otherplace]]
9673 [[Otherplace (place), Elsewhere|]]
9674 !! html
9675 [[Otherplace, Somewhere|Otherplace]]
9676 [[Otherplace (place), Elsewhere|Otherplace]]
9677 !! end
9678
9679 !! test
9680 pre-save transform: context links ("pipe trick") with comma and parens
9681 !! options
9682 pst title=[[Who, me? (context)]]
9683 !! wikitext
9684 [[|Yes, you.]]
9685 [[Me, Myself, and I (1937 song)|]]
9686 !! html
9687 [[Yes, you. (context)|Yes, you.]]
9688 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9689 !! end
9690
9691 !! test
9692 pre-save transform: context links ("pipe trick") with namespace
9693 !! options
9694 pst title=[[Ns:Somearticle]]
9695 !! wikitext
9696 [[|Article]]
9697 !! html
9698 [[Ns:Article|Article]]
9699 !! end
9700
9701 !! test
9702 pre-save transform: context links ("pipe trick") with namespace and parens
9703 !! options
9704 pst title=[[Ns:Somearticle (context)]]
9705 !! wikitext
9706 [[|Article]]
9707 !! html
9708 [[Ns:Article (context)|Article]]
9709 !! end
9710
9711 !! test
9712 pre-save transform: context links ("pipe trick") with namespace and comma
9713 !! options
9714 pst title=[[Ns:Somearticle, Context, Whatever]]
9715 !! wikitext
9716 [[|Article]]
9717 !! html
9718 [[Ns:Article, Context, Whatever|Article]]
9719 !! end
9720
9721 !! test
9722 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9723 !! options
9724 pst title=[[Ns:Somearticle, Context (context)]]
9725 !! wikitext
9726 [[|Article]]
9727 !! html
9728 [[Ns:Article (context)|Article]]
9729 !! end
9730
9731 !! test
9732 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9733 !! options
9734 pst title=[[Ns:Somearticle (IGNORED), Context]]
9735 !! wikitext
9736 [[|Article]]
9737 !! html
9738 [[Ns:Article, Context|Article]]
9739 !! end
9740
9741 !! test
9742 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9743 !! options
9744 pst
9745 !! wikitext
9746 [[Article(context)|]]
9747 [[Bar:Article(context)|]]
9748 [[:Bar:Article(context)|]]
9749 [[|Article(context)]]
9750 [[Bar:X(Y)Z|]]
9751 [[:Bar:X(Y)Z|]]
9752 !! html
9753 [[Article(context)|Article]]
9754 [[Bar:Article(context)|Article]]
9755 [[:Bar:Article(context)|Article]]
9756 [[Article(context)]]
9757 [[Bar:X(Y)Z|X(Y)Z]]
9758 [[:Bar:X(Y)Z|X(Y)Z]]
9759 !! end
9760
9761 !! test
9762 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9763 !! options
9764 pst
9765 !! wikitext
9766 [[Article (context)|]]
9767 [[Bar:Article (context)|]]
9768 [[:Bar:Article (context)|]]
9769 [[|Article (context)]]
9770 [[Bar:X (Y) Z|]]
9771 [[:Bar:X (Y) Z|]]
9772 !! html
9773 [[Article (context)|Article]]
9774 [[Bar:Article (context)|Article]]
9775 [[:Bar:Article (context)|Article]]
9776 [[Article (context)]]
9777 [[Bar:X (Y) Z|X (Y) Z]]
9778 [[:Bar:X (Y) Z|X (Y) Z]]
9779 !! end
9780
9781 !! test
9782 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9783 !! options
9784 pst
9785 !! wikitext
9786 [[Article(context)|]]
9787 [[Bar:Article(context)|]]
9788 [[:Bar:Article(context)|]]
9789 [[|Article(context)]]
9790 [[Bar:X(Y)Z|]]
9791 [[:Bar:X(Y)Z|]]
9792 !! html
9793 [[Article(context)|Article]]
9794 [[Bar:Article(context)|Article]]
9795 [[:Bar:Article(context)|Article]]
9796 [[Article(context)]]
9797 [[Bar:X(Y)Z|X(Y)Z]]
9798 [[:Bar:X(Y)Z|X(Y)Z]]
9799 !! end
9800
9801 !! test
9802 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9803 !! options
9804 pst
9805 !! wikitext
9806 [[Article (context), context|]]
9807 [[Article (context),context|]]
9808 [[Bar:Article (context), context|]]
9809 [[Bar:Article (context),context|]]
9810 [[:Bar:Article (context), context|]]
9811 [[:Bar:Article (context),context|]]
9812 !! html
9813 [[Article (context), context|Article]]
9814 [[Article (context),context|Article]]
9815 [[Bar:Article (context), context|Article]]
9816 [[Bar:Article (context),context|Article]]
9817 [[:Bar:Article (context), context|Article]]
9818 [[:Bar:Article (context),context|Article]]
9819 !! end
9820
9821 !! test
9822 pre-save transform: trim trailing empty lines
9823 !! options
9824 pst
9825 !! wikitext
9826 Empty lines are trimmed
9827
9828
9829
9830
9831 !! html
9832 Empty lines are trimmed
9833 !! end
9834
9835 !! test
9836 pre-save transform: Signature expansion
9837 !! options
9838 pst
9839 !! wikitext
9840 * ~~~
9841 * <noinclude>~~~</noinclude>
9842 * <includeonly>~~~</includeonly>
9843 * <onlyinclude>~~~</onlyinclude>
9844 !! html
9845 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9846 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9847 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9848 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9849 !! end
9850
9851
9852 !! test
9853 pre-save transform: Signature expansion in nowiki tags (bug 93)
9854 !! options
9855 pst disabled
9856 !! wikitext
9857 Shall not expand:
9858
9859 <nowiki>~~~~</nowiki>
9860
9861 <includeonly><nowiki>~~~~</nowiki></includeonly>
9862
9863 <noinclude><nowiki>~~~~</nowiki></noinclude>
9864
9865 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9866
9867 {{subst:Foo}} shall be converted to FOO
9868
9869 As well as inside noinclude/onlyinclude
9870 <noinclude>{{subst:Foo}}</noinclude>
9871 <onlyinclude>{{subst:Foo}}</onlyinclude>
9872
9873 But not inside includeonly
9874 <includeonly>{{subst:Foo}}</includeonly>
9875 !! html
9876 Shall not expand:
9877
9878 <nowiki>~~~~</nowiki>
9879
9880 <includeonly><nowiki>~~~~</nowiki></includeonly>
9881
9882 <noinclude><nowiki>~~~~</nowiki></noinclude>
9883
9884 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9885
9886 FOO shall be converted to FOO
9887
9888 As well as inside noinclude/onlyinclude
9889 <noinclude>FOO</noinclude>
9890 <onlyinclude>FOO</onlyinclude>
9891
9892 But not inside includeonly
9893 <includeonly>{{subst:Foo}}</includeonly>
9894 !! end
9895
9896 !! test
9897 Parsoid: Recognize nowiki with trailing space in tags
9898 !! options
9899 parsoid=wt2html
9900 !! wikitext
9901 <nowiki ><div>[[foo]]</nowiki >
9902
9903 a<nowiki / >b
9904
9905 c<nowiki />d
9906
9907 e<nowiki/ >f
9908 !! html
9909 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9910 <p>ab</p>
9911 <p>cd</p>
9912 <p>ef</p>
9913 !! end
9914
9915 !! test
9916 Parsoid: Recognize nowiki with odd capitalization
9917 !! options
9918 parsoid=wt2html
9919 !! wikitext
9920 <noWikI ><div>[[foo]]</Nowiki >
9921 !! html
9922 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9923 !! end
9924
9925
9926 !! test
9927 Parsoid: Escape nowiki with trailing space in tags
9928 !! options
9929 parsoid=html2wt
9930 !! wikitext
9931 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9932
9933 a&lt;nowiki /&gt;b
9934
9935 c&lt;nowiki/ &gt;d
9936 !! html
9937 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9938 <p>a&lt;nowiki /&gt;b</p>
9939 <p>c&lt;nowiki/ &gt;d</p>
9940 !! end
9941
9942 !! test
9943 Parsoid: Escape weird noWikI capitalizations
9944 !! options
9945 parsoid=html2wt
9946 !! wikitext
9947 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9948 !! html
9949 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9950 !! end
9951
9952 ###
9953 ### Message transform tests
9954 ###
9955 !! test
9956 message transform: magic variables
9957 !! options
9958 msg
9959 !! wikitext
9960 {{SITENAME}}
9961 !! html
9962 MediaWiki
9963 !! end
9964
9965 !! test
9966 message transform: should not transform wiki markup
9967 !! options
9968 msg
9969 !! wikitext
9970 ''test''
9971 !! html
9972 ''test''
9973 !! end
9974
9975 !! test
9976 message transform: <noinclude> in transcluded template (bug 4926)
9977 !! options
9978 msg
9979 !! wikitext
9980 {{Includes}}
9981 !! html
9982 Foobar
9983 !! end
9984
9985 !! test
9986 message transform: <onlyinclude> in transcluded template (bug 4926)
9987 !! options
9988 msg
9989 !! wikitext
9990 {{Includes2}}
9991 !! html
9992 Foo
9993 !! end
9994
9995 !! test
9996 {{#special:}} page name, known
9997 !! options
9998 msg
9999 !! wikitext
10000 {{#special:Recentchanges}}
10001 !! html
10002 Special:RecentChanges
10003 !! end
10004
10005 !! test
10006 {{#special:}} page name with subpage, known
10007 !! options
10008 msg
10009 !! wikitext
10010 {{#special:Recentchanges/param}}
10011 !! html
10012 Special:RecentChanges/param
10013 !! end
10014
10015 !! test
10016 {{#special:}} page name, unknown
10017 !! options
10018 msg
10019 !! wikitext
10020 {{#special:foobar nonexistent}}
10021 !! html
10022 Special:Foobar nonexistent
10023 !! end
10024
10025 !! test
10026 {{#speciale:}} page name, known
10027 !! options
10028 msg
10029 !! wikitext
10030 {{#speciale:Recentchanges}}
10031 !! html
10032 Special:RecentChanges
10033 !! end
10034
10035 !! test
10036 {{#speciale:}} page name with subpage, known
10037 !! options
10038 msg
10039 !! wikitext
10040 {{#speciale:Recentchanges/param}}
10041 !! html
10042 Special:RecentChanges/param
10043 !! end
10044
10045 !! test
10046 {{#speciale:}} page name, unknown
10047 !! options
10048 msg
10049 !! wikitext
10050 {{#speciale:foobar nonexistent}}
10051 !! html
10052 Special:Foobar_nonexistent
10053 !! end
10054
10055 ###
10056 ### Images
10057 ###
10058 ### For Parsoid-specific tests, see
10059 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10060
10061 !! test
10062 Simple image
10063 !! options
10064 parsoid=wt2html,wt2wt,html2html
10065 !! wikitext
10066 [[Image:foobar.jpg]]
10067 !! html/php
10068 <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>
10069 </p>
10070 !! html/parsoid
10071 <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>
10072 </p>
10073 !! end
10074
10075 !! test
10076 Simple image (using File: namespace, now canonical)
10077 !! wikitext
10078 [[File:Foobar.jpg]]
10079 !! html/php
10080 <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>
10081 </p>
10082 !! html/parsoid
10083 <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>
10084 </p>
10085 !! end
10086
10087 !! test
10088 Right-aligned image
10089 !! wikitext
10090 [[File:Foobar.jpg|right]]
10091 !! html/php
10092 <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>
10093
10094 !! html/parsoid
10095 <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>
10096 !! end
10097
10098 !! test
10099 Image with caption
10100 !! wikitext
10101 [[File:Foobar.jpg|right|Caption text]]
10102 !! html/php
10103 <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>
10104
10105 !! html/parsoid
10106 <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>
10107 !! end
10108
10109 !! test
10110 Image with caption, bug 53312 #1
10111 !! wikitext
10112 [[File:Foobar.jpg|right|Caption page stuff]]
10113 !! html/php
10114 <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>
10115
10116 !! html/parsoid
10117 <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>
10118 !! end
10119
10120 !! test
10121 Image with caption, bug 53312 #2
10122 !! wikitext
10123 [[File:Foobar.jpg|right|Caption page=]]
10124 !! html/php
10125 <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>
10126
10127 !! html/parsoid
10128 <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>
10129 !! end
10130
10131 !! test
10132 Image with caption, bug 53312 #3
10133 !! wikitext
10134 [[File:Foobar.jpg|right|Caption page=stuff]]
10135 !! html/php
10136 <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>
10137
10138 !! html/parsoid
10139 <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>
10140 !! end
10141
10142 !! test
10143 Allow empty links in image captions (Bug 60753)
10144 !! options
10145 thumbsize=220
10146 !! wikitext
10147 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10148 [[]]
10149 [[Link2]]
10150 ]]
10151 !! html/php
10152 <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>
10153
10154 !! html/parsoid
10155 <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>
10156 [[]]
10157 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10158 </figcaption></figure>
10159 !! end
10160
10161 !! test
10162 Link with empty target
10163 !! wikitext
10164 [[]]
10165 !! html
10166 <p>[[]]
10167 </p>
10168 !! end
10169
10170 !! test
10171 Image with empty attribute
10172 !! options
10173 parsoid=wt2html,wt2wt,html2html
10174 !! wikitext
10175 [[File:Foobar.jpg|right||Caption text]]
10176 !! html/php
10177 <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>
10178
10179 !! html/parsoid
10180 <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>
10181 !! end
10182
10183 !! test
10184 1. Block image with individual attributes from templates
10185 !! wikitext
10186 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10187 !! html/php
10188 <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>
10189
10190 !! html/parsoid
10191 <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>
10192 !! end
10193
10194 !! test
10195 2. Block Image with individual attributes from templates
10196 !! wikitext
10197 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10198 !! html/php
10199 <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>
10200
10201 !! html/parsoid
10202 <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>
10203 !! end
10204
10205 !! test
10206 3. Inline image with individual attributes from templates
10207 !! wikitext
10208 [[File:Foobar.jpg|{{echo|50px}}]]
10209 !! html/php
10210 <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>
10211 </p>
10212 !! html/parsoid
10213 <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>
10214 !! end
10215
10216 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10217 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10218 !! test
10219 Image with multiple attributes from the same template
10220 !! wikitext
10221 [[File:Foobar.jpg|{{image_attribs}}]]
10222 !! html/php
10223 <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>
10224
10225 !! html/parsoid
10226 <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>
10227 !! end
10228
10229 !! test
10230 Image with link tails
10231 !! options
10232 thumbsize=220
10233 !! wikitext
10234 123[[File:Foobar.jpg]]456
10235 123[[File:Foobar.jpg|right]]456
10236 123[[File:Foobar.jpg|thumb]]456
10237 !! html/php
10238 <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
10239 </p>
10240 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
10241 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
10242
10243 !! html/parsoid
10244 <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>
10245 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
10246 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
10247 !! end
10248
10249 !! test
10250 Image with multiple captions -- only last one is accepted
10251 !! wikitext
10252 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10253 !! html/php
10254 <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>
10255
10256 !! html/parsoid
10257 <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>
10258 !! end
10259
10260 !! test
10261 Image with multiple widths -- use last
10262 !! wikitext
10263 [[File:Foobar.jpg|200px|300px|caption]]
10264 !! html/php
10265 <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>
10266 </p>
10267 !! html/parsoid
10268 <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>
10269 !! end
10270
10271 !! test
10272 Image with multiple alignments -- use first (bug 48664)
10273 !! options
10274 thumbsize=220
10275 !! wikitext
10276 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10277
10278 [[File:Foobar.jpg|middle|text-top|caption]]
10279 !! html/php
10280 <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>
10281 <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>
10282 </p>
10283 !! html/parsoid
10284 <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>
10285 <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>
10286 !! end
10287
10288 !! test
10289 Image with width attribute at different positions
10290 !! wikitext
10291 [[File:Foobar.jpg|200px|right|Caption]]
10292 [[File:Foobar.jpg|right|200px|Caption]]
10293 [[File:Foobar.jpg|right|Caption|200px]]
10294 !! html/php
10295 <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>
10296 <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>
10297 <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>
10298
10299 !! html/parsoid
10300 <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>
10301 <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>
10302 <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>
10303 !! end
10304
10305 # a sad bit of backward-compatibility
10306 !! test
10307 Image with size specified with pxpx (bug 13500, 51628)
10308 !! options
10309 parsoid=wt2html,wt2wt,html2html
10310 !! wikitext
10311 [[File:Foobar.jpg|20pxpx]]
10312 [[File:Foobar.jpg|200x20pxpx]]
10313 !! html/php
10314 <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>
10315 <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>
10316 </p>
10317 !! html/parsoid
10318 <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>
10319 !! end
10320
10321 !! test
10322 Image with link parameter, wiki target
10323 !! wikitext
10324 [[File:Foobar.jpg|link=Main Page]]
10325 !! html/php
10326 <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>
10327 </p>
10328 !! html/parsoid
10329 <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>
10330 !! end
10331
10332 # parsoid bug 49293 (part 1)
10333 !! test
10334 Image with link parameter, URL target
10335 !! wikitext
10336 [[File:Foobar.jpg|link=http://example.com/]]
10337 !! html/php
10338 <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>
10339 </p>
10340 !! html/parsoid
10341 <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>
10342 !! end
10343
10344 # parsoid bug 49293 (part 2)
10345 !! test
10346 Image with link parameter, protocol-less URL target
10347 !! wikitext
10348 [[File:Foobar.jpg|link=//example.com/]]
10349 !! html/php
10350 <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>
10351 </p>
10352 !! html/parsoid
10353 <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>
10354 !! end
10355
10356 !! test
10357 Image with link parameter, wgExternalLinkTarget
10358 !! wikitext
10359 [[Image:foobar.jpg|link=http://example.com/]]
10360 !! config
10361 wgExternalLinkTarget='foobar'
10362 !! html
10363 <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>
10364 </p>
10365 !! end
10366
10367 !! test
10368 Image with link parameter, wgNoFollowLinks set to false
10369 !! wikitext
10370 [[Image:foobar.jpg|link=http://example.com/]]
10371 !! config
10372 wgNoFollowLinks=false
10373 !! html
10374 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10375 </p>
10376 !! end
10377
10378 !! test
10379 Image with link parameter, wgNoFollowDomainExceptions
10380 !! wikitext
10381 [[Image:foobar.jpg|link=http://example.com/]]
10382 !! config
10383 wgNoFollowDomainExceptions='example.com'
10384 !! html
10385 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10386 </p>
10387 !! end
10388
10389 !! test
10390 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10391 !! wikitext
10392 [[Image:foobar.jpg|link=http://example.com/|Title]]
10393 !! config
10394 wgExternalLinkTarget='foobar'
10395 !! html
10396 <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>
10397 </p>
10398 !! end
10399
10400 !! test
10401 Image with empty link parameter
10402 !! wikitext
10403 [[File:Foobar.jpg|link=]]
10404 !! html/php
10405 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10406 </p>
10407 !! html/parsoid
10408 <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>
10409 !! end
10410
10411 !! test
10412 Image with link parameter (wiki target) and unnamed parameter
10413 !! wikitext
10414 [[File:Foobar.jpg|link=Main_Page|Title]]
10415 !! html/php
10416 <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>
10417 </p>
10418 !! html/parsoid
10419 <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>
10420 !! end
10421
10422 !! test
10423 Image with link parameter (URL target) and unnamed parameter
10424 !! wikitext
10425 [[File:Foobar.jpg|link=http://example.com/|Title]]
10426 !! html/php
10427 <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>
10428 </p>
10429 !! html/parsoid
10430 <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>
10431 !! end
10432
10433 !! test
10434 Thumbnail image with link parameter
10435 !! options
10436 thumbsize=220
10437 parsoid=wt2html,wt2wt,html2html
10438 !! wikitext
10439 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10440 !! html/php
10441 <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>
10442
10443 !! html/parsoid
10444 <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>
10445 !! end
10446
10447 !! test
10448 Manually-specified thumbnail image
10449 !! options
10450 thumbsize=220
10451 !! wikitext
10452 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10453 !! html/php
10454 <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>
10455
10456 !! html/parsoid
10457 <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>
10458 !! end
10459
10460 !! test
10461 Manually-specified thumbnail image with explicit link to wiki page
10462 !! options
10463 thumbsize=220
10464 parsoid=wt2html,wt2wt,html2html
10465 !! wikitext
10466 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10467 !! html/php
10468 <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>
10469
10470 !! html/parsoid
10471 <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>
10472 !! end
10473
10474 !! test
10475 Manually-specified thumbnail image with explicit link to url
10476 !! options
10477 thumbsize=220
10478 parsoid=wt2html,wt2wt,html2html
10479 !! wikitext
10480 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10481 !! html/php
10482 <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>
10483
10484 !! html/parsoid
10485 <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>
10486 !! end
10487
10488 !! test
10489 Manually-specified thumbnail image with explicit no link
10490 !! options
10491 thumbsize=220
10492 parsoid=wt2html,wt2wt,html2html
10493 !! wikitext
10494 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10495 !! html/php
10496 <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>
10497
10498 !! html/parsoid
10499 <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>
10500 !! end
10501
10502 !! test
10503 Manually-specified thumbnail image with explicit link and alt text
10504 !! options
10505 thumbsize=220
10506 parsoid=wt2html,wt2wt,html2html
10507 !! wikitext
10508 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10509 !! html/php
10510 <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>
10511
10512 !! html/parsoid
10513 <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>
10514 !! end
10515
10516 !! test
10517 Image with frame and link
10518 !! options
10519 parsoid=wt2html,wt2wt,html2html
10520 !! wikitext
10521 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10522 !! html/php
10523 <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>
10524
10525 !! html/parsoid
10526 <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>
10527 !! end
10528
10529 !! test
10530 Image with frame and link and explicit alt
10531 !! options
10532 parsoid=wt2html,wt2wt,html2html
10533 !! wikitext
10534 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10535 !! html/php
10536 <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>
10537
10538 !! html/parsoid
10539 <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>
10540 !! end
10541
10542 !! test
10543 Image with wiki markup in implicit alt
10544 !! options
10545 parsoid=wt2html,wt2wt,html2html
10546 !! wikitext
10547 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10548
10549 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10550 !! html/php
10551 <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>
10552 </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>
10553 </p>
10554 !! html/parsoid
10555 <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>
10556 <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>
10557 !! end
10558
10559 ###################
10560 # Conflicting image format options.
10561 # First option specified should 'win'.
10562 # All three cases in each test should be identical.
10563
10564 !! test
10565 Image with 'frameless' first.
10566 !! options
10567 parsoid=wt2html,wt2wt,html2html
10568 !! wikitext
10569 [[File:Foobar.jpg|frameless|caption]]
10570
10571 [[File:Foobar.jpg|frameless|frame|caption]]
10572
10573 [[File:Foobar.jpg|frameless|thumb|caption]]
10574 !! html/php
10575 <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>
10576 </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>
10577 </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>
10578 </p>
10579 !! html/parsoid
10580 <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>
10581 <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>
10582 <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>
10583 !! end
10584
10585 !! test
10586 Image with 'frame' first.
10587 !! options
10588 parsoid=wt2html,wt2wt,html2html
10589 !! wikitext
10590 [[File:Foobar.jpg|frame|caption]]
10591 [[File:Foobar.jpg|frame|frameless|caption]]
10592 [[File:Foobar.jpg|frame|thumb|caption]]
10593 !! html/php
10594 <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>
10595 <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>
10596 <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>
10597
10598 !! html/parsoid
10599 <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>
10600 !! end
10601
10602 !! test
10603 Image with 'thumb' first.
10604 !! options
10605 parsoid=wt2html,wt2wt,html2html
10606 !! wikitext
10607 [[File:Foobar.jpg|thumb|caption]]
10608 [[File:Foobar.jpg|thumb|frameless|caption]]
10609 [[File:Foobar.jpg|thumb|frame|caption]]
10610 !! html/php
10611 <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>
10612 <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>
10613 <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>
10614
10615 !! html/parsoid
10616 <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>
10617 !! end
10618
10619 ###################
10620 # Image sizing.
10621 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10622 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10623 # Foobar has actual size of 1941x220
10624 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10625 # a scalable format.
10626 # 2. Framed images always ignore size options; always render at default size.
10627 # 3. "Unspecified format" and border are the only types which can be
10628 # enlarged.
10629
10630 !! test
10631 Image: "unspecified format" and border enlarge
10632 !! options
10633 parsoid=wt2html,wt2wt,html2html
10634 !! wikitext
10635 [[File:Foobar.jpg|2000px]]
10636
10637 [[File:Foobar.jpg|border|2000px]]
10638 !! html/php
10639 <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>
10640 </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>
10641 </p>
10642 !! html/parsoid
10643 <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>
10644 <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>
10645 !! end
10646
10647 !! test
10648 Image: "unspecified format" and border reduce
10649 !! options
10650 parsoid=wt2html,wt2wt,html2html
10651 !! wikitext
10652 [[File:Foobar.jpg|1000px]]
10653
10654 [[File:Foobar.jpg|border|1000px]]
10655 !! html/php
10656 <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>
10657 </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>
10658 </p>
10659 !! html/parsoid
10660 <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>
10661 <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>
10662 !! end
10663
10664 !! test
10665 Image: thumbs reduce
10666 !! options
10667 parsoid=wt2html,wt2wt,html2html
10668 !! wikitext
10669 [[File:Foobar.jpg|thumb|50px]]
10670 !! html/php
10671 <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>
10672
10673 !! html/parsoid
10674 <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>
10675 !! end
10676
10677 !! test
10678 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10679 !! options
10680 parsoid=wt2html,wt2wt,html2html
10681 !! wikitext
10682 [[File:Foobar.jpg|thumb|2000px]]
10683
10684 [[File:Foobar.svg|thumb|2000px]]
10685 !! html/php
10686 <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>
10687 <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>
10688
10689 !! html/parsoid
10690 <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>
10691 <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>
10692 !! end
10693
10694 !! test
10695 Image: frameless can reduce in size
10696 !! options
10697 parsoid=wt2html,wt2wt,html2html
10698 !! wikitext
10699 [[File:Foobar.jpg|frameless|50px]]
10700 !! html/php
10701 <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>
10702 </p>
10703 !! html/parsoid
10704 <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>
10705 !! end
10706
10707 !! test
10708 Image: bitmap frameless can't be enlarged past original size, but vector can
10709 !! options
10710 parsoid=wt2html,wt2wt,html2html
10711 !! wikitext
10712 [[File:Foobar.jpg|frameless|2000px]]
10713
10714 [[File:Foobar.svg|frameless|2000px]]
10715 !! html/php
10716 <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>
10717 </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>
10718 </p>
10719 !! html/parsoid
10720 <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>
10721 <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>
10722 !! end
10723
10724 !! test
10725 Image: framed images are always unscaled.
10726 !! options
10727 parsoid=wt2html,wt2wt,html2html
10728 !! wikitext
10729 [[File:Foobar.jpg|frame]]
10730
10731 [[File:Foobar.jpg|frame|50px]]
10732
10733 [[File:Foobar.jpg|frame|50x50px]]
10734
10735 [[File:Foobar.jpg|frame|2000px]]
10736 !! html/php
10737 <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>
10738 <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>
10739 <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>
10740 <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>
10741
10742 !! html/parsoid
10743 <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>
10744 !! end
10745
10746 ###################
10747
10748 !! test
10749 Link to image page- image page normally doesn't exists, hence edit link
10750 Add test with existing image page
10751 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10752 !! wikitext
10753 [[:Image:test]]
10754 !! html
10755 <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>
10756 </p>
10757 !! end
10758
10759 !! test
10760 bug 18784 Link to non-existent image page with caption should use caption as link text
10761 !! wikitext
10762 [[:Image:test|caption]]
10763 !! html
10764 <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>
10765 </p>
10766 !! end
10767
10768 !! test
10769 Frameless image caption with a free URL
10770 !! wikitext
10771 [[File:Foobar.jpg|http://example.com]]
10772 !! html/php
10773 <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>
10774 </p>
10775 !! html/parsoid
10776 <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>
10777 !! end
10778
10779 !! test
10780 Thumbnail image caption with a free URL
10781 !! options
10782 thumbsize=220
10783 !! wikitext
10784 [[File:Foobar.jpg|thumb|http://example.com]]
10785 !! html/php
10786 <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>
10787
10788 !! html/parsoid
10789 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
10790 !! end
10791
10792 !! test
10793 Thumbnail image caption with a free URL and explicit alt
10794 !! options
10795 thumbsize=220
10796 parsoid=wt2html,wt2wt,html2html
10797 !! wikitext
10798 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10799 !! html/php
10800 <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>
10801
10802 !! html/parsoid
10803 <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>
10804 !! end
10805
10806 !! test
10807 SVG thumbnails with no language set
10808 !! options
10809 !! wikitext
10810 [[File:Foobar.svg|thumb|caption]]
10811 !! html/php
10812 <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>
10813
10814 !! html/parsoid
10815 <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>
10816 !! end
10817
10818 !! test
10819 SVG thumbnails with language de
10820 !! options
10821 parsoid=wt2html,wt2wt,html2html
10822 !! wikitext
10823 [[File:Foobar.svg|thumb|caption|lang=de]]
10824 !! html/php
10825 <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>
10826
10827 !! html/parsoid
10828 <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>
10829 !! end
10830
10831 !! test
10832 SVG thumbnails with invalid language code
10833 !! options
10834 parsoid=wt2html,wt2wt,html2html
10835 !! wikitext
10836 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10837 !! html/php
10838 <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>
10839
10840 !! html/parsoid
10841 <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>
10842 !! end
10843
10844 !! test
10845 BUG 1887: A ISBN with a thumbnail
10846 !! wikitext
10847 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10848 !! html/php
10849 <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>
10850
10851 !! html/parsoid
10852 <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>
10853 !! end
10854
10855 !! test
10856 BUG 1887: A RFC with a thumbnail
10857 !! wikitext
10858 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10859 !! html/php
10860 <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>
10861
10862 !! html/parsoid
10863 <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>
10864 !! end
10865
10866 !! test
10867 BUG 1887: A mailto link with a thumbnail
10868 !! wikitext
10869 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10870 !! html/php
10871 <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>
10872
10873 !! html/parsoid
10874 <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>
10875 !! end
10876
10877 # Pending resolution to bug 368
10878 !! test
10879 BUG 648: Frameless image caption with a link
10880 !! wikitext
10881 [[File:Foobar.jpg|text with a [[link]] in it]]
10882 !! html/php
10883 <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>
10884 </p>
10885 !! html/parsoid
10886 <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>
10887 !! end
10888
10889 !! test
10890 BUG 648: Frameless image caption with a link (suffix)
10891 !! wikitext
10892 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10893 !! html/php
10894 <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>
10895 </p>
10896 !! html/parsoid
10897 <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>
10898 !! end
10899
10900 !! test
10901 BUG 648: Frameless image caption with an interwiki link
10902 !! wikitext
10903 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10904 !! html/php
10905 <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>
10906 </p>
10907 !! html/parsoid
10908 <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>
10909 !! end
10910
10911 !! test
10912 BUG 648: Frameless image caption with a piped interwiki link
10913 !! wikitext
10914 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10915 !! html/php
10916 <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>
10917 </p>
10918 !! html/parsoid
10919 <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>
10920 !! end
10921
10922 !! test
10923 Escape HTML special chars in image alt text
10924 !! wikitext
10925 [[File:Foobar.jpg|& < > "]]
10926 !! html/php
10927 <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>
10928 </p>
10929 !! html/parsoid
10930 <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>
10931 !! end
10932
10933 !! test
10934 BUG 499: Alt text should have &#1234;, not &amp;1234;
10935 !! wikitext
10936 [[File:Foobar.jpg|&#9792;]]
10937 !! html/php
10938 <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>
10939 </p>
10940 !! html/parsoid
10941 <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>
10942 !! end
10943
10944 !! test
10945 Broken image caption with link
10946 !! options
10947 parsoid=wt2html,wt2wt,html2html
10948 !! wikitext
10949 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10950 !! html/php
10951 <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.
10952 </p>
10953 !! html/parsoid
10954 <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>
10955 !! end
10956
10957 !! test
10958 Image caption containing another image
10959 !! wikitext
10960 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10961 !! html/php
10962 <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>
10963
10964 !! html/parsoid
10965 <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>
10966 !! end
10967
10968 !! test
10969 Image: caption containing a newline
10970 !! wikitext
10971 [[File:Foobar.jpg|This
10972 *is some text]]
10973 !! html/php
10974 <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>
10975 </p>
10976 !! html/parsoid
10977 <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>
10978 !!end
10979
10980 !!test
10981 Image: caption containing leading space
10982 (The leading space should not trigger nowiki escaping in wt2wt mode)
10983 !! wikitext
10984 [[File:Foobar.jpg|thumb| bar]]
10985 !! html/php
10986 <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>
10987
10988 !! html/parsoid
10989 <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>
10990 !!end
10991
10992 !! test
10993 Image: caption containing a table
10994 !! options
10995 parsoid=wt2html,wt2wt,html2html
10996 !! wikitext
10997 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10998 {|
10999 ! Foo !! Bar
11000 |-
11001 | Foo1 || Bar1
11002 |}
11003 and some more text.]]
11004 !! html/php
11005 <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>
11006
11007 !! html/parsoid
11008 <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
11009 <table>
11010 <tbody>
11011 <tr><th>Foo </th><th>Bar</th></tr>
11012 <tr>
11013 <td>Foo1 </td>
11014 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11015 !! end
11016
11017 !! test
11018 Bug 3090: External links other than http: in image captions
11019 !! wikitext
11020 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11021 !! html/php
11022 <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>
11023
11024 !! html/parsoid
11025 <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>
11026 !! end
11027
11028 !! test
11029 Custom class
11030 !! options
11031 parsoid=wt2html,wt2wt,html2html
11032 !! wikitext
11033 [[Image:foobar.jpg|a|class=b]]
11034 !! html/php
11035 <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>
11036 </p>
11037 !! html/parsoid
11038 <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>
11039 !! end
11040
11041 !! test
11042 Localized image handling (1).
11043 !! options
11044 parsoid=wt2html,wt2wt,html2html
11045 language=es
11046 !! wikitext
11047 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11048 !! html/php
11049 <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>
11050
11051 !! html/parsoid
11052 <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>
11053 !! end
11054
11055 !! test
11056 Localized image handling (2).
11057 !! options
11058 thumbsize=220
11059 parsoid=wt2html,wt2wt,html2html
11060 language=es
11061 !! wikitext
11062 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11063 !! html/php
11064 <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>
11065
11066 !! html/parsoid
11067 <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>
11068 !! end
11069
11070 !! test
11071 "border", "frameless" and "class" attributes on an image.
11072 !! options
11073 thumbsize=220
11074 parsoid=wt2html,wt2wt,html2html
11075 !! wikitext
11076 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11077 !! html/php
11078 <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>
11079 </p>
11080 !! html/parsoid
11081 <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>
11082 !! end
11083
11084 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11085 !! test
11086 Invalid image attributes (bug 62500)
11087 !! options
11088 thumbsize=220
11089 parsoid=wt2html,wt2wt,html2html
11090 !! wikitext
11091 [[File:Foobar.jpg|thumb|float|left|caption]]
11092
11093 [[File:Foobar.jpg|thumb|righ|caption]]
11094
11095 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11096 !! html/php
11097 <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>
11098 <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>
11099 <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>
11100
11101 !! html/parsoid
11102 <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>
11103 !! end
11104
11105 !! article
11106 File:Barfoo.jpg
11107 !! text
11108 #REDIRECT [[File:Barfoo.jpg]]
11109 !! endarticle
11110
11111 !! test
11112 Redirected image
11113 !! wikitext
11114 [[Image:Barfoo.jpg]]
11115 !! html
11116 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11117 </p>
11118 !! end
11119
11120 !! test
11121 Missing image with uploads disabled
11122 !! options
11123 wgEnableUploads=0
11124 !! wikitext
11125 [[Image:Foobaz.jpg]]
11126 !! html
11127 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11128 </p>
11129 !! end
11130
11131 # Parsoid-specific testing for images
11132 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11133 # Currently imperfect due to a flaw in the Parsoid testrunner
11134 # Work in progress
11135 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11136 # image tests.
11137
11138 !! test
11139 Parsoid-specific image handling - simple image with size and middle alignment
11140 !! wikitext
11141 [[File:Foobar.jpg|middle|50px]]
11142 !! html/parsoid
11143 <p><span class="mw-valign-middle" typeof="mw:Image">
11144 <a href="File:Foobar.jpg">
11145 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11146 </a>
11147 </span>
11148 </p>
11149 !! end
11150
11151 !! test
11152 Parsoid-specific image handling - simple image with size, middle alignment,
11153 non-standard namespace alias
11154 !! options
11155 parsoid=wt2wt,wt2html,html2html
11156 !! wikitext
11157 [[Image:Foobar.jpg|middle|50px]]
11158 !! html/parsoid
11159 <p><span class="mw-valign-middle" typeof="mw:Image">
11160 <a href="File:Foobar.jpg">
11161 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11162 </a>
11163 </span>
11164 </p>
11165 !! end
11166
11167 !! test
11168 Parsoid-specific image handling - simple image with size and middle alignment
11169 (existing content)
11170 !! wikitext
11171 [[File:Foobar.jpg|50px|middle]]
11172 !! html/parsoid
11173 <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>
11174 !! end
11175
11176 !! test
11177 Parsoid-specific image handling - simple image with size and middle alignment
11178 and non-standard namespace name
11179 !! options
11180 parsoid=wt2html,wt2wt,html2html
11181 !! wikitext
11182 [[Image:Foobar.jpg|50px|middle]]
11183 !! html/parsoid
11184 <p><span class="mw-valign-middle" typeof="mw:Image">
11185 <a href="File:Foobar.jpg">
11186 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11187 </a>
11188 </span>
11189 </p>
11190 !! end
11191
11192 !! test
11193 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11194 !! wikitext
11195 [[File:Foobar.jpg|500x10px|baseline|caption]]
11196 !! html/parsoid
11197 <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>
11198 !! end
11199
11200 !! test
11201 Parsoid-specific image handling - simple image with border and size spec
11202 !! wikitext
11203 [[File:Foobar.jpg|50px|border|caption]]
11204 !! html/parsoid
11205 <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>
11206 !! end
11207
11208 !! test
11209 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11210 !! wikitext
11211 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11212 !! html/parsoid
11213 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11214 <a href="File:Foobar.jpg">
11215 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11216 </a>
11217 <figcaption>caption content</figcaption>
11218 </figure>
11219 !! end
11220
11221 !! test
11222 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11223 (existing content)
11224 !! wikitext
11225 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11226 !! html/parsoid
11227 <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>
11228 !! end
11229
11230 !! test
11231 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11232 !! wikitext
11233 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11234 !! html/parsoid
11235 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11236 <a href="File:Foobar.jpg">
11237 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11238 </a>
11239 <figcaption>caption</figcaption>
11240 </figure>
11241 !! end
11242
11243 !! test
11244 Parsoid-specific image handling - thumbnail with specific size, halign,
11245 valign, and caption (existing content)
11246 !! wikitext
11247 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11248 !! html/parsoid
11249 <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>
11250 !! end
11251
11252 !! test
11253 Parsoid-specific image handling - framed image with specific size and caption
11254 (size is ignored)
11255 !! options
11256 parsoid=wt2html,wt2wt,html2html
11257 !! wikitext
11258 [[File:Foobar.jpg|frame|500x50px|caption]]
11259 !! html/parsoid
11260 <figure typeof="mw:Image/Frame">
11261 <a href="File:Foobar.jpg">
11262 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11263 </a>
11264 <figcaption>caption</figcaption>
11265 </figure>
11266 !! end
11267
11268 !! test
11269 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11270 (size is ignored)
11271 !! options
11272 parsoid=wt2html,wt2wt,html2html
11273 !! wikitext
11274 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11275 !! html/parsoid
11276 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11277 <a href="File:Foobar.jpg">
11278 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11279 </a>
11280 <figcaption>caption</figcaption>
11281 </figure>
11282 !! end
11283
11284 !! test
11285 Parsoid-specific image handling - frameless image with specific size, border, and caption
11286 !! wikitext
11287 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11288 !! html/parsoid
11289 <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>
11290 !! end
11291
11292 !! test
11293 Parsoid-specific image handling - simple image with a formatted caption
11294 !! wikitext
11295 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11296 !! html/parsoid
11297 <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>"}'>
11298 <a href="File:Foobar.jpg">
11299 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11300 </a></span></p>
11301 !! end
11302
11303 !! test
11304 Parsoid-specific image handling - caption with a template in it
11305 !! wikitext
11306 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11307 !! html/parsoid
11308 <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>
11309 !! end
11310
11311 !! test
11312 Parsoid-specific image handling - caption with unbalanced tags in it
11313 !! options
11314 parsoid=wt2html,wt2wt,html2html
11315 !! wikitext
11316 foo
11317 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11318 bar
11319 !! html/parsoid
11320 <p>foo</p>
11321 <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>
11322 <p>bar</p>
11323 !! end
11324
11325 !! test
11326 Parsoid-specific image handling - empty caption (1)
11327 !! options
11328 parsoid=wt2html,wt2wt
11329 !! wikitext
11330 [[File:Foobar.jpg|thumb|]]
11331 !! html/parsoid
11332 <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>
11333 !! end
11334
11335 # empty captions don't get serialized unless we're in the "round trip" case
11336 !! test
11337 Parsoid-specific image handling - empty caption (2)
11338 !! options
11339 parsoid=html2wt
11340 !! html/parsoid
11341 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11342 <a href="File:Foobar.jpg">
11343 <img resource="./File:Foobar.jpg"
11344 src="//example.com/images/3/3a/Foobar.jpg"
11345 height="25" width="220"/>
11346 </a>
11347 <figcaption></figcaption>
11348 </figure>
11349 !! wikitext
11350 [[File:Foobar.jpg|thumb]]
11351 !! end
11352
11353 !! test
11354 Parsoid-specific image handling - whitespace caption
11355 !! wikitext
11356 [[File:Foobar.jpg|thumb| ]]
11357 !! html/parsoid
11358 <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>
11359 !! end
11360
11361 !! test
11362 Parsoid-specific image handling - lang option
11363 !! wikitext
11364 foo
11365 [[File:Foobar.svg|lang=de|caption]]
11366 bar
11367 !! html/parsoid
11368 <p>foo
11369 <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>
11370 bar</p>
11371 !! end
11372
11373
11374 ###
11375 ### Subpages
11376 ###
11377 !! article
11378 Subpage test/subpage
11379 !! text
11380 foo
11381 !! endarticle
11382
11383 !! test
11384 Subpage link
11385 !! options
11386 subpage title=[[Subpage test]]
11387 !! wikitext
11388 [[/subpage]]
11389 !! html
11390 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11391 </p>
11392 !! end
11393
11394 !! test
11395 Subpage noslash link
11396 !! options
11397 subpage title=[[Subpage test]]
11398 !! wikitext
11399 [[/subpage/]]
11400 !! html
11401 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11402 </p>
11403 !! end
11404
11405 # TODO: make this PHP-parser compatible!
11406 !! test
11407 Relative subpage noslash link
11408 !! options
11409 parsoid=wt2wt,wt2html,html2html
11410 subpage title=[[Subpage test/1/2/3/4]]
11411 !! wikitext
11412 [[../../subpage/]]
11413
11414 [[../../subpage]]
11415 !! html
11416 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11417 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11418 !! end
11419
11420 !! test
11421 Parsoid: dot-slash prefixed wikilinks
11422 !! wikitext
11423 [[./foo]]
11424
11425 [[././bar]]
11426
11427 [[././baz/]]
11428 !! html/php
11429 <p>[[./foo]]
11430 </p><p>[[././bar]]
11431 </p><p>[[././baz/]]
11432 </p>
11433 !! html/parsoid
11434 <p>[[./foo]]
11435 </p><p>[[././bar]]
11436 </p><p>[[././baz/]]
11437 </p>
11438 !! end
11439
11440 !! test
11441 Render invalid page names as plain text (bug 51090)
11442 !! wikitext
11443 [[./../foo|bar]]
11444 [[foo�|bar]]
11445 [[foo/.|bar]]
11446 [[foo/..|bar]]
11447 [[foo~~~bar]]
11448 [[foo>bar]]
11449 [[foo[bar]]
11450 [[.]]
11451 [[..]]
11452 [[foo././bar]]
11453
11454 [[{{echo|./../foo}}|bar]]
11455 [[{{echo|foo/.}}|bar]]
11456 [[{{echo|foo/..}}|bar]]
11457 [[{{echo|foo~~~~bar}}]]
11458 [[{{echo|foo>bar}}]]
11459 [[{{echo|foo././bar}}]]
11460 [[{{echo|foo{bar}}]]
11461 [[{{echo|foo}bar}}]]
11462 [[{{echo|foo[bar}}]]
11463 [[{{echo|foo]bar}}]]
11464 [[{{echo|foo<bar}}]]
11465 !!html/php
11466 <p>[[./../foo|bar]]
11467 [[foo�|bar]]
11468 [[foo/.|bar]]
11469 [[foo/..|bar]]
11470 [[foo~~~bar]]
11471 [[foo&gt;bar]]
11472 [[foo[bar]]
11473 [[.]]
11474 [[..]]
11475 [[foo././bar]]
11476 </p><p>[[./../foo|bar]]
11477 [[foo/.|bar]]
11478 [[foo/..|bar]]
11479 [[foo~~~~bar]]
11480 [[foo&gt;bar]]
11481 [[foo././bar]]
11482 [[foo{bar]]
11483 [[foo}bar]]
11484 [[foo[bar]]
11485 [[foo]bar]]
11486 [[foo&lt;bar]]
11487 </p>
11488 !!html/parsoid
11489 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11490 <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>
11491 !!end
11492
11493 !! test
11494 Disabled subpages
11495 !! wikitext
11496 [[/subpage]]
11497 !! html
11498 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11499 </p>
11500 !! end
11501
11502 !! test
11503 BUG 561: {{/Subpage}}
11504 !! options
11505 subpage title=[[Page]]
11506 !! wikitext
11507 {{/Subpage}}
11508 !! html
11509 <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>
11510 </p>
11511 !! end
11512
11513 ###
11514 ### Categories
11515 ###
11516 !! article
11517 Category:MediaWiki User's Guide
11518 !! text
11519 blah
11520 !! endarticle
11521
11522 !! test
11523 Link to category
11524 !! wikitext
11525 [[:Category:MediaWiki User's Guide]]
11526 !! html
11527 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11528 </p>
11529 !! end
11530
11531 !! test
11532 Simple category
11533 !! options
11534 cat
11535 !! wikitext
11536 [[Category:MediaWiki User's Guide]]
11537 !! html
11538 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11539 !! end
11540
11541 !! test
11542 PAGESINCATEGORY invalid title fatal (r33546 fix)
11543 !! wikitext
11544 {{PAGESINCATEGORY:<bogus>}}
11545 !! html
11546 <p>0
11547 </p>
11548 !! end
11549
11550 !! test
11551 Category with different sort key
11552 !! options
11553 cat
11554 !! wikitext
11555 [[Category:MediaWiki User's Guide|Foo]]
11556 !! html
11557 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11558 !! end
11559
11560 !! test
11561 Category with identical sort key
11562 !! options
11563 cat
11564 !! wikitext
11565 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11566 !! html
11567 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11568 !! end
11569
11570 !! test
11571 Category with empty sort key
11572 !! options
11573 cat
11574 pst
11575 !! wikitext
11576 [[Category:MediaWiki User's Guide|]]
11577 !! html
11578 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11579 !! end
11580
11581 !! test
11582 Category with empty sort key and parentheses
11583 !! options
11584 cat
11585 pst
11586 !! wikitext
11587 [[Category:Foo (bar)|]]
11588 !! html
11589 [[Category:Foo (bar)|Foo]]
11590 !! end
11591
11592 !! test
11593 Category with link tail
11594 !! options
11595 cat
11596 pst
11597 !! wikitext
11598 123[[Category:Foo]]456
11599 !! html
11600 123[[Category:Foo]]456
11601 !! end
11602
11603 !! test
11604 Category with template
11605 !! options
11606 cat
11607 pst
11608 !! wikitext
11609 [[Category:{{echo|Foo}}]]
11610 !! html
11611 [[Category:{{echo|Foo}}]]
11612 !! end
11613
11614 !! test
11615 Category with template in sort key
11616 !! options
11617 cat
11618 pst
11619 !! wikitext
11620 [[Category:Foo|{{echo|Bar}}]]
11621 !! html
11622 [[Category:Foo|{{echo|Bar}}]]
11623 !! end
11624
11625 !! test
11626 Category with template in sort key and title
11627 !! options
11628 cat
11629 pst
11630 !! wikitext
11631 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11632 !! html
11633 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11634 !! end
11635
11636 !! test
11637 Category / paragraph interactions
11638 !! wikitext
11639 Foo [[Category:Baz]] Bar
11640
11641 Foo [[Category:Baz]]
11642 Bar
11643
11644 Foo
11645 [[Category:Baz]]
11646 Bar
11647
11648 Foo
11649 [[Category:Baz]] Bar
11650
11651 Foo
11652 [[Category:Baz]]
11653 [[Category:Baz]]
11654 [[Category:Baz]]
11655 Bar
11656
11657 [[Category:Baz]]
11658 [[Category:Baz]]
11659 [[Category:Baz]]
11660
11661 [[Category:Baz]]
11662 {{echo|[[Category:Baz]]}}
11663 [[Category:Baz]]
11664 !! html
11665 <p>Foo Bar
11666 </p><p>Foo
11667 Bar
11668 </p><p>Foo
11669 Bar
11670 </p><p>Foo Bar
11671 </p><p>Foo
11672 Bar
11673 </p>
11674 !! end
11675
11676 !! test
11677 Parsoid: Serialize link to category page with colon escape
11678 !! options
11679 parsoid
11680 !! wikitext
11681
11682 [[:Category:Foo]]
11683 [[:Category:Foo|Bar]]
11684 !! html
11685 <p>
11686 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11687 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11688 </p>
11689 !! end
11690
11691 !! test
11692 Parsoid: Link prefix/suffixes aren't applied to category links
11693 !! options
11694 parsoid=wt2html,wt2wt,html2html
11695 language=is
11696 !! wikitext
11697 x[[Category:Foo]]y
11698 !! html
11699 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11700 !! end
11701
11702 !! test
11703 Parsoid: Serialize link to file page with colon escape
11704 !! options
11705 parsoid
11706 !! wikitext
11707
11708 [[:File:Foo.png]]
11709 [[:File:Foo.png|Bar]]
11710 !! html
11711 <p>
11712 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11713 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11714 </p>
11715 !! end
11716
11717 !! test
11718 Parsoid: Serialize a genuine category link without colon escape
11719 !! options
11720 parsoid
11721 !! wikitext
11722 [[Category:Foo]]
11723 [[Category:Foo|Bar]]
11724 !! html
11725 <link rel="mw:PageProp/Category" href="Category:Foo">
11726 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11727 !! end
11728
11729 !! test
11730 Parsoid: Defaultsort
11731 !! options
11732 parsoid
11733 !! wikitext
11734 {{DEFAULTSORT:Foo}}
11735 !! html
11736 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11737 !! end
11738
11739 ###
11740 ### Inter-language links
11741 ###
11742 !! test
11743 Inter-language links
11744 !! options
11745 ill
11746 !! wikitext
11747 [[es:Alimento]]
11748 [[fr:Nourriture]]
11749 [[zh:&#39135;&#21697;]]
11750 !! html
11751 es:Alimento fr:Nourriture zh:食品
11752 !! end
11753
11754 !! test
11755 Duplicate interlanguage links (bug 24502)
11756 !! options
11757 ill
11758 !! wikitext
11759 [[es:1]]
11760 [[es:2]]
11761 [[fr:1]]
11762 [[fr:2]]
11763 !! html
11764 es:1 fr:1
11765 !! end
11766
11767 ###
11768 ### Sections
11769 ###
11770 !! test
11771 Basic section headings
11772 !! wikitext
11773 == Headline 1 ==
11774 Some text
11775
11776 ==Headline 2==
11777 More
11778 ===Smaller headline===
11779 Blah blah
11780 !! html
11781 <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>
11782 <p>Some text
11783 </p>
11784 <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>
11785 <p>More
11786 </p>
11787 <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>
11788 <p>Blah blah
11789 </p>
11790 !! end
11791
11792 !! test
11793 Section headings with TOC
11794 !! wikitext
11795 == Headline 1 ==
11796 === Subheadline 1 ===
11797 ===== Skipping a level =====
11798 ====== Skipping a level ======
11799
11800 == Headline 2 ==
11801 Some text
11802 ===Another headline===
11803 !! html
11804 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11805 <ul>
11806 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11807 <ul>
11808 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11809 <ul>
11810 <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>
11811 <ul>
11812 <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>
11813 </ul>
11814 </li>
11815 </ul>
11816 </li>
11817 </ul>
11818 </li>
11819 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11820 <ul>
11821 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11822 </ul>
11823 </li>
11824 </ul>
11825 </div>
11826
11827 <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>
11828 <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>
11829 <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>
11830 <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>
11831 <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>
11832 <p>Some text
11833 </p>
11834 <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>
11835
11836 !! end
11837
11838 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11839 !! test
11840 Handling of sections up to level 6 and beyond
11841 !! wikitext
11842 = Level 1 Heading=
11843 == Level 2 Heading==
11844 === Level 3 Heading===
11845 ==== Level 4 Heading====
11846 ===== Level 5 Heading=====
11847 ====== Level 6 Heading======
11848 ======= Level 7 Heading=======
11849 ======== Level 8 Heading========
11850 ========= Level 9 Heading=========
11851 ========== Level 10 Heading==========
11852 !! html
11853 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11854 <ul>
11855 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11856 <ul>
11857 <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>
11858 <ul>
11859 <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>
11860 <ul>
11861 <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>
11862 <ul>
11863 <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>
11864 <ul>
11865 <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>
11866 <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>
11867 <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>
11868 <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>
11869 <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>
11870 </ul>
11871 </li>
11872 </ul>
11873 </li>
11874 </ul>
11875 </li>
11876 </ul>
11877 </li>
11878 </ul>
11879 </li>
11880 </ul>
11881 </div>
11882
11883 <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>
11884 <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>
11885 <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>
11886 <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>
11887 <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>
11888 <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>
11889 <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>
11890 <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>
11891 <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>
11892 <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>
11893
11894 !! end
11895
11896 !! test
11897 TOC regression (bug 9764)
11898 !! wikitext
11899 == title 1 ==
11900 === title 1.1 ===
11901 ==== title 1.1.1 ====
11902 === title 1.2 ===
11903 == title 2 ==
11904 === title 2.1 ===
11905 !! html
11906 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11907 <ul>
11908 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11909 <ul>
11910 <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>
11911 <ul>
11912 <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>
11913 </ul>
11914 </li>
11915 <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>
11916 </ul>
11917 </li>
11918 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11919 <ul>
11920 <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>
11921 </ul>
11922 </li>
11923 </ul>
11924 </div>
11925
11926 <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>
11927 <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>
11928 <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>
11929 <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>
11930 <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>
11931 <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>
11932
11933 !! end
11934
11935 !! test
11936 TOC with wgMaxTocLevel=3 (bug 6204)
11937 !! options
11938 wgMaxTocLevel=3
11939 !! wikitext
11940 == title 1 ==
11941 === title 1.1 ===
11942 ==== title 1.1.1 ====
11943 === title 1.2 ===
11944 == title 2 ==
11945 === title 2.1 ===
11946 !! html
11947 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11948 <ul>
11949 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11950 <ul>
11951 <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>
11952 <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>
11953 </ul>
11954 </li>
11955 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11956 <ul>
11957 <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>
11958 </ul>
11959 </li>
11960 </ul>
11961 </div>
11962
11963 <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>
11964 <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>
11965 <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>
11966 <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>
11967 <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>
11968 <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>
11969
11970 !! end
11971
11972 !! test
11973 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11974 !! options
11975 wgMaxTocLevel=3
11976 !! wikitext
11977 ==Section 1==
11978 ===Section 1.1===
11979 ====Section 1.1.1====
11980 ====Section 1.1.1.1====
11981 ==Section 2==
11982 !! html
11983 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11984 <ul>
11985 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11986 <ul>
11987 <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>
11988 </ul>
11989 </li>
11990 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11991 </ul>
11992 </div>
11993
11994 <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>
11995 <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>
11996 <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>
11997 <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>
11998 <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>
11999
12000 !! end
12001
12002
12003 !! test
12004 Resolving duplicate section names
12005 !! wikitext
12006 == Foo bar ==
12007 == Foo bar ==
12008 !! html
12009 <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>
12010 <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>
12011
12012 !! end
12013
12014 !! test
12015 Resolving duplicate section names with differing case (bug 10721)
12016 !! wikitext
12017 == Foo bar ==
12018 == Foo Bar ==
12019 !! html
12020 <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>
12021 <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>
12022
12023 !! end
12024
12025 !! article
12026 Template:sections
12027 !! text
12028 ===Section 1===
12029 ==Section 2==
12030 !! endarticle
12031
12032 !! test
12033 Template with sections, __NOTOC__
12034 !! wikitext
12035 __NOTOC__
12036 ==Section 0==
12037 {{sections}}
12038 ==Section 4==
12039 !! html
12040 <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>
12041 <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>
12042 <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>
12043 <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>
12044
12045 !! end
12046
12047 !! test
12048 __NOEDITSECTION__ keyword
12049 !! wikitext
12050 __NOEDITSECTION__
12051 ==Section 1==
12052 ==Section 2==
12053 !! html
12054 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12055 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12056
12057 !! end
12058
12059 !! test
12060 Link inside a section heading
12061 !! wikitext
12062 ==Section with a [[Main Page|link]] in it==
12063 !! html
12064 <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>
12065
12066 !! end
12067
12068 !! test
12069 TOC regression (bug 12077)
12070 !! wikitext
12071 __TOC__
12072 == title 1 ==
12073 === title 1.1 ===
12074 == title 2 ==
12075 !! html
12076 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12077 <ul>
12078 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12079 <ul>
12080 <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>
12081 </ul>
12082 </li>
12083 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12084 </ul>
12085 </div>
12086
12087 <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>
12088 <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>
12089 <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>
12090
12091 !! end
12092
12093 !! test
12094 BUG 1219 URL next to image (good)
12095 !! wikitext
12096 http://example.com [[Image:foobar.jpg]]
12097 !! html
12098 <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>
12099 </p>
12100 !!end
12101
12102 !! test
12103 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12104 !! wikitext
12105 ===
12106 The line above must have a trailing space!
12107 === <!--
12108 --> <!-- -->
12109 But just in case it doesn't...
12110 !! html
12111 <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>
12112 <p>The line above must have a trailing space!
12113 </p>
12114 <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>
12115 <p>But just in case it doesn't...
12116 </p>
12117 !! end
12118
12119 !! test
12120 Header with special characters (bug 25462)
12121 !! wikitext
12122 The tooltips shall not show entities to the user (ie. be double escaped)
12123
12124 == text > text ==
12125 section 1
12126
12127 == text < text ==
12128 section 2
12129
12130 == text & text ==
12131 section 3
12132
12133 == text ' text ==
12134 section 4
12135
12136 == text " text ==
12137 section 5
12138 !! html
12139 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12140 </p>
12141 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12142 <ul>
12143 <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>
12144 <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>
12145 <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>
12146 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12147 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12148 </ul>
12149 </div>
12150
12151 <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>
12152 <p>section 1
12153 </p>
12154 <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>
12155 <p>section 2
12156 </p>
12157 <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>
12158 <p>section 3
12159 </p>
12160 <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>
12161 <p>section 4
12162 </p>
12163 <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>
12164 <p>section 5
12165 </p>
12166 !! end
12167
12168 !! test
12169 Headers with excess '=' characters
12170 (Are similar tests necessary beyond the 1st level?)
12171 !! wikitext
12172 =foo==
12173 ==foo=
12174 =''italic'' heading==
12175 ==''italic'' heading=
12176 !! html
12177 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12178 <ul>
12179 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12180 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12181 <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>
12182 <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>
12183 </ul>
12184 </div>
12185
12186 <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>
12187 <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>
12188 <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>
12189 <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>
12190
12191 !! end
12192
12193 !! test
12194 HTML headers vs TOC (bug 23393)
12195 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12196 !! wikitext
12197 <h1>Header 1</h1>
12198 == Header 1.1 ==
12199 == Header 1.2 ==
12200
12201 <h1>Header 2
12202 </h1>
12203 == Header 2.1 ==
12204 == Header 2.2 ==
12205 __NOEDITSECTION__
12206 !! html
12207 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12208 <ul>
12209 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12210 <ul>
12211 <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>
12212 <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>
12213 </ul>
12214 </li>
12215 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12216 <ul>
12217 <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>
12218 <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>
12219 </ul>
12220 </li>
12221 </ul>
12222 </div>
12223
12224 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12225 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12226 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12227 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12228 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12229 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12230
12231 !! end
12232
12233 !! test
12234 Single-line or multiline-comments can follow headings
12235 !! options
12236 parsoid=wt2html,wt2wt
12237 !! wikitext
12238 ==foo==<!---->
12239 ==bar==<!--c1-->
12240 ==baz==<!--
12241 c2
12242 c3-->
12243 !! html
12244 <h2><span class="mw-headline" id="foo">foo</span></h2>
12245 <h2><span class="mw-headline" id="bar">bar</span></h2>
12246 <h2><span class="mw-headline" id="baz">baz</span></h2>
12247
12248 !! end
12249
12250 !! test
12251 BUG 1219 URL next to image (broken)
12252 !! wikitext
12253 http://example.com[[Image:foobar.jpg]]
12254 !! html
12255 <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>
12256 </p>
12257 !!end
12258
12259 !! test
12260 Bug 1186 news: in the middle of text
12261 !! wikitext
12262 http://en.wikinews.org/wiki/Wikinews:Workplace
12263 !! html
12264 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12265 </p>
12266 !!end
12267
12268
12269 !! test
12270 Namespaced link must have a title
12271 !! wikitext
12272 [[Project:]]
12273 !! html
12274 <p>[[Project:]]
12275 </p>
12276 !!end
12277
12278 !! test
12279 Namespaced link must have a title (bad fragment version)
12280 !! wikitext
12281 [[Project:#fragment]]
12282 !! html
12283 <p>[[Project:#fragment]]
12284 </p>
12285 !!end
12286
12287
12288 ###
12289 ### HTML tags and HTML attributes
12290 ###
12291
12292 !! test
12293 div with no attributes
12294 !! wikitext
12295 <div>HTML rocks</div>
12296 !! html
12297 <div>HTML rocks</div>
12298
12299 !! end
12300
12301 !! test
12302 div with double-quoted attribute
12303 !! wikitext
12304 <div id="rock">HTML rocks</div>
12305 !! html
12306 <div id="rock">HTML rocks</div>
12307
12308 !! end
12309
12310 !! test
12311 div with single-quoted attribute
12312 !! wikitext
12313 <div id='rock'>HTML rocks</div>
12314 !! html
12315 <div id="rock">HTML rocks</div>
12316
12317 !! end
12318
12319 !! test
12320 div with unquoted attribute
12321 !! wikitext
12322 <div id=rock>HTML rocks</div>
12323 !! html
12324 <div id="rock">HTML rocks</div>
12325
12326 !! end
12327
12328 !! test
12329 div with illegal double attributes
12330 !! wikitext
12331 <div id="a" id="b">HTML rocks</div>
12332 !! html
12333 <div id="b">HTML rocks</div>
12334
12335 !!end
12336
12337 # FIXME: produce empty string instead of "class" in the PHP parser, following
12338 # the HTML5 spec.
12339 !! test
12340 div with empty attribute value, space before equals
12341 !! options
12342 parsoid
12343 !! wikitext
12344 <div class =>HTML rocks</div>
12345 !! html
12346 <div class="">HTML rocks</div>
12347
12348 !! end
12349
12350 # The PHP parser escapes the opening brace to &#123; for some reason, so
12351 # disabled this test for it.
12352 !! test
12353 div with braces in attribute value
12354 !! options
12355 parsoid
12356 !! wikitext
12357 <div title="{}">Foo</div>
12358 !! html
12359 <div title="{}">Foo</div>
12360 !! end
12361
12362 # This it very inconsistent in the PHP parser: it returns
12363 # class="class" if there is a space between the name and the equal sign (see
12364 # 'div with empty attribute value, space before equals'), but strips the
12365 # attribute completely if the space is missing. We hope that not much content
12366 # depends on this, so are implementing the behavior below in Parsoid for
12367 # consistencies' sake. Disabled for the PHP parser.
12368 # FIXME: fix this behavior in the PHP parser?
12369 !! test
12370 div with empty attribute value, no space before equals
12371 !! options
12372 parsoid
12373 !! wikitext
12374 <div class=>HTML rocks</div>
12375 !! html
12376 <div class="">HTML rocks</div>
12377
12378 !! end
12379
12380 !! test
12381 HTML multiple attributes correction
12382 !! wikitext
12383 <p class="error" class="awesome">Awesome!</p>
12384 !! html
12385 <p class="awesome">Awesome!</p>
12386
12387 !!end
12388
12389 !! test
12390 Table multiple attributes correction
12391 !! wikitext
12392 {|
12393 !+ class="error" class="awesome"| status
12394 |}
12395 !! html
12396 <table>
12397 <tr>
12398 <th class="awesome"> status
12399 </th></tr></table>
12400
12401 !!end
12402
12403 !! test
12404 DIV IN UPPERCASE
12405 !! wikitext
12406 <DIV ID="x">HTML ROCKS</DIV>
12407 !! html
12408 <div id="x">HTML ROCKS</div>
12409
12410 !!end
12411
12412 !! test
12413 Non-ASCII pseudo-tags are rendered as text
12414 !! wikitext
12415 <khyô>
12416 !! html
12417 <p>&lt;khyô&gt;
12418 </p>
12419 !! end
12420
12421 !! test
12422 Pseudo-tag with URL 'name' renders as url link
12423 !! wikitext
12424 <http://example.com/>
12425 !! html
12426 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12427 </p>
12428 !! end
12429
12430 !! test
12431 text with amp in the middle of nowhere
12432 !! wikitext
12433 Remember AT&T?
12434 !! html
12435 <p>Remember AT&amp;T?
12436 </p>
12437 !! end
12438
12439 !! test
12440 text with character entity: eacute
12441 !! wikitext
12442 I always thought &eacute; was a cute letter.
12443 !! html
12444 <p>I always thought &#233; was a cute letter.
12445 </p>
12446 !! end
12447
12448 !! test
12449 text with entity-escaped character entity-like string: eacute
12450 !! wikitext
12451 I always thought &amp;eacute; was a cute letter.
12452 !! html
12453 <p>I always thought &amp;eacute; was a cute letter.
12454 </p>
12455 !! end
12456
12457 !! test
12458 text with undefined character entity: xacute
12459 !! wikitext
12460 I always thought &xacute; was a cute letter.
12461 !! html
12462 <p>I always thought &amp;xacute; was a cute letter.
12463 </p>
12464 !! end
12465
12466 # TODO: generalize to PHP parser?
12467 !! test
12468 HTML5 tags
12469 !! options
12470 parsoid
12471 !! wikitext
12472 <data value="5">five</data>
12473 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12474 <mark>This highlighted text</mark>
12475 !! html
12476 <p><data value="5">five</data>
12477 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12478 <mark>This highlighted text</mark></p>
12479 !! end
12480
12481 !! test
12482 HTML tag with leading space is parsed as text
12483 !! wikitext
12484 < div>foo< /div>
12485 !! html
12486 <p>&lt; div&gt;foo&lt; /div&gt;
12487 </p>
12488 !! end
12489
12490 ###
12491 ### Nesting tests (see bug 41545, 50604, 51081)
12492 ###
12493
12494 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12495 # Note that html2wt is considerably more difficult if we use <b> in
12496 # the test case, instead of <big>
12497 !! test
12498 Ensure that HTML adoption agency algorithm is properly implemented.
12499 !! wikitext
12500 <big>X<big>Y</big>Z</big>
12501 !! html
12502 <p><big>X<big>Y</big>Z</big>
12503 </p>
12504 !! end
12505
12506 # This was bug 41545 in the PHP parser.
12507 !! test
12508 Nesting of <kbd>
12509 !! wikitext
12510 <kbd>X<kbd>Y</kbd>Z</kbd>
12511 !! html
12512 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12513 </p>
12514 !! end
12515
12516 # The following cases were bug 51081 in the PHP parser.
12517 # Note that there are some other nestable tags (b, i, etc) which are
12518 # not covered; see bug 51081 for discussion.
12519 !! test
12520 Nesting of <em>
12521 !! wikitext
12522 <em>X<em>Y</em>Z</em>
12523 !! html
12524 <p><em>X<em>Y</em>Z</em>
12525 </p>
12526 !! end
12527
12528 !! test
12529 Nesting of <strong>
12530 !! wikitext
12531 <strong>X<strong>Y</strong>Z</strong>
12532 !! html
12533 <p><strong>X<strong>Y</strong>Z</strong>
12534 </p>
12535 !! end
12536
12537 !! test
12538 Nesting of <q>
12539 !! wikitext
12540 <q>X<q>Y</q>Z</q>
12541 !! html
12542 <p><q>X<q>Y</q>Z</q>
12543 </p>
12544 !! end
12545
12546 !! test
12547 Nesting of <ruby>
12548 !! wikitext
12549 <ruby>X<ruby>Y</ruby>Z</ruby>
12550 !! html
12551 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12552 </p>
12553 !! end
12554
12555 !! test
12556 Nesting of <bdo>
12557 !! wikitext
12558 <bdo>X<bdo>Y</bdo>Z</bdo>
12559 !! html
12560 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12561 </p>
12562 !! end
12563
12564
12565 ###
12566 ### Media links
12567 ###
12568
12569 !! test
12570 Media link
12571 !! wikitext
12572 [[Media:Foobar.jpg]]
12573 !! html
12574 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12575 </p>
12576 !! end
12577
12578 !! test
12579 Media link with text
12580 !! wikitext
12581 [[Media:Foobar.jpg|A neat file to look at]]
12582 !! html
12583 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12584 </p>
12585 !! end
12586
12587 # FIXME: this is still bad HTML tag nesting
12588 !! test
12589 Media link with nasty text
12590 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12591 !! wikitext
12592 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12593 !! html
12594 <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>
12595
12596 !! end
12597
12598 !! test
12599 Media link to nonexistent file (bug 1702)
12600 !! wikitext
12601 [[Media:No such.jpg]]
12602 !! html
12603 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12604 </p>
12605 !! end
12606
12607 !! test
12608 Image link to nonexistent file (bug 1850 - good)
12609 !! wikitext
12610 [[Image:No such.jpg]]
12611 !! html
12612 <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>
12613 </p>
12614 !! end
12615
12616 !! test
12617 :Image link to nonexistent file (bug 1850 - bad)
12618 !! wikitext
12619 [[:Image:No such.jpg]]
12620 !! html
12621 <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>
12622 </p>
12623 !! end
12624
12625
12626
12627 !! test
12628 Character reference normalization in link text (bug 1938)
12629 !! wikitext
12630 [[Main Page|this&that]]
12631 !! html
12632 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12633 </p>
12634 !!end
12635
12636 !! article
12637 אַ
12638 !! text
12639 Test for unicode normalization
12640
12641 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12642 !! endarticle
12643
12644 !! test
12645 (bug 19451) Links should refer to the normalized form.
12646 !! wikitext
12647 [[&#xFB2E;]]
12648 [[&#x5d0;&#x5b7;]]
12649 [[&#x5d0;ַ]]
12650 [[א&#x5b7;]]
12651 [[אַ]]
12652 !! html
12653 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12654 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12655 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12656 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12657 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12658 </p>
12659 !! end
12660
12661 !! test
12662 Empty attribute crash test (bug 2067)
12663 !! wikitext
12664 <font color="">foo</font>
12665 !! html
12666 <p><font color="">foo</font>
12667 </p>
12668 !! end
12669
12670 !! test
12671 Empty attribute crash test single-quotes (bug 2067)
12672 !! wikitext
12673 <font color=''>foo</font>
12674 !! html
12675 <p><font color="">foo</font>
12676 </p>
12677 !! end
12678
12679 !! test
12680 Attribute test: equals, then nothing
12681 !! wikitext
12682 <font color=>foo</font>
12683 !! html
12684 <p><font>foo</font>
12685 </p>
12686 !! end
12687
12688 !! test
12689 Attribute test: unquoted value
12690 !! wikitext
12691 <font color=x>foo</font>
12692 !! html
12693 <p><font color="x">foo</font>
12694 </p>
12695 !! end
12696
12697 !! test
12698 Attribute test: unquoted but illegal value (hash)
12699 !! wikitext
12700 <font color=#x>foo</font>
12701 !! html
12702 <p><font color="#x">foo</font>
12703 </p>
12704 !! end
12705
12706 !! test
12707 Attribute test: no value
12708 !! wikitext
12709 <font color>foo</font>
12710 !! html
12711 <p><font color="color">foo</font>
12712 </p>
12713 !! end
12714
12715 !! test
12716 Bug 2095: link with three closing brackets
12717 !! wikitext
12718 [[Main Page]]]
12719 !! html/php
12720 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12721 </p>
12722 !! html/parsoid
12723 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12724 !! end
12725
12726 !! test
12727 Bug 2095: link with pipe and three closing brackets
12728 !! wikitext
12729 [[Main Page|link]]]
12730 !! html/php
12731 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12732 </p>
12733 !! html/parsoid
12734 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12735 !! end
12736
12737 !! test
12738 Bug 2095: link with pipe and three closing brackets, version 2
12739 !! wikitext
12740 [[Main Page|[http://example.com/]]]
12741 !! html/php
12742 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12743 </p>
12744 !! html/parsoid
12745 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12746 !! end
12747
12748
12749 ###
12750 ### Safety
12751 ###
12752
12753 !! article
12754 Template:Dangerous attribute
12755 !! text
12756 " onmouseover="alert(document.cookie)
12757 !! endarticle
12758
12759 !! article
12760 Template:Dangerous style attribute
12761 !! text
12762 border-size: expression(alert(document.cookie))
12763 !! endarticle
12764
12765 !! article
12766 Template:Div style
12767 !! text
12768 <div style="float: right; {{{1}}}">Magic div</div>
12769 !! endarticle
12770
12771 !! test
12772 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12773 !! wikitext
12774 <div title="{{test}}"></div>
12775 !! html
12776 <div title="This is a test template"></div>
12777
12778 !! end
12779
12780 !! test
12781 Bug 2304: HTML attribute safety (dangerous template; 2309)
12782 !! wikitext
12783 <div title="{{dangerous attribute}}"></div>
12784 !! html
12785 <div title=""></div>
12786
12787 !! end
12788
12789 !! test
12790 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12791 !! wikitext
12792 <div style="{{dangerous style attribute}}"></div>
12793 !! html
12794 <div style="/* insecure input */"></div>
12795
12796 !! end
12797
12798 !! test
12799 Bug 2304: HTML attribute safety (safe parameter; 2309)
12800 !! wikitext
12801 {{div style|width: 200px}}
12802 !! html
12803 <div style="float: right; width: 200px">Magic div</div>
12804
12805 !! end
12806
12807 !! test
12808 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12809 !! wikitext
12810 {{div style|width: expression(alert(document.cookie))}}
12811 !! html
12812 <div style="/* insecure input */">Magic div</div>
12813
12814 !! end
12815
12816 !! test
12817 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12818 !! wikitext
12819 {{div style|"><script>alert(document.cookie)</script>}}
12820 !! html
12821 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12822
12823 !! end
12824
12825 !! test
12826 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12827 !! wikitext
12828 {{div style|" ><script>alert(document.cookie)</script>}}
12829 !! html
12830 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12831
12832 !! end
12833
12834 !! test
12835 Bug 2304: HTML attribute safety (link)
12836 !! wikitext
12837 <div title="[[Main Page]]"></div>
12838 !! html
12839 <div title="&#91;&#91;Main Page]]"></div>
12840
12841 !! end
12842
12843 !! test
12844 Bug 2304: HTML attribute safety (italics)
12845 !! wikitext
12846 <div title="''foobar''"></div>
12847 !! html
12848 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12849
12850 !! end
12851
12852 !! test
12853 Bug 2304: HTML attribute safety (bold)
12854 !! wikitext
12855 <div title="'''foobar'''"></div>
12856 !! html
12857 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12858
12859 !! end
12860
12861
12862 !! test
12863 Bug 2304: HTML attribute safety (ISBN)
12864 !! wikitext
12865 <div title="ISBN 1234567890"></div>
12866 !! html
12867 <div title="&#73;SBN 1234567890"></div>
12868
12869 !! end
12870
12871 !! test
12872 Bug 2304: HTML attribute safety (RFC)
12873 !! wikitext
12874 <div title="RFC 1234"></div>
12875 !! html
12876 <div title="&#82;FC 1234"></div>
12877
12878 !! end
12879
12880 !! test
12881 Bug 2304: HTML attribute safety (PMID)
12882 !! wikitext
12883 <div title="PMID 1234567890"></div>
12884 !! html
12885 <div title="&#80;MID 1234567890"></div>
12886
12887 !! end
12888
12889 !! test
12890 Bug 2304: HTML attribute safety (web link)
12891 !! wikitext
12892 <div title="http://example.com/"></div>
12893 !! html
12894 <div title="http&#58;//example.com/"></div>
12895
12896 !! end
12897
12898 !! test
12899 Bug 2304: HTML attribute safety (named web link)
12900 !! wikitext
12901 <div title="[http://example.com/ link]"></div>
12902 !! html
12903 <div title="&#91;http&#58;//example.com/ link]"></div>
12904
12905 !! end
12906
12907 !! test
12908 Bug 3244: HTML attribute safety (extension; safe)
12909 !! wikitext
12910 <div style="<nowiki>background:blue</nowiki>"></div>
12911 !! html
12912 <div style="background:blue"></div>
12913
12914 !! end
12915
12916 !! test
12917 Bug 3244: HTML attribute safety (extension; unsafe)
12918 !! wikitext
12919 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12920 !! html
12921 <div style="/* insecure input */"></div>
12922
12923 !! end
12924
12925 # More MSIE fun discovered by Tom Gilder
12926
12927 !! test
12928 MSIE CSS safety test: spurious slash
12929 !! wikitext
12930 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12931 !! html
12932 <div style="/* insecure input */">evil</div>
12933
12934 !! end
12935
12936 !! test
12937 MSIE CSS safety test: hex code
12938 !! wikitext
12939 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12940 !! html
12941 <div style="/* insecure input */">evil</div>
12942
12943 !! end
12944
12945 !! test
12946 MSIE CSS safety test: comment in url
12947 !! wikitext
12948 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12949 !! html
12950 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12951
12952 !! end
12953
12954 !! test
12955 MSIE CSS safety test: comment in expression
12956 !! wikitext
12957 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12958 !! html
12959 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12960
12961 !! end
12962
12963 !! test
12964 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12965 !! wikitext
12966 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12967 !! html
12968 <p style="/* invalid control char */">A</p>
12969
12970 !! end
12971
12972 !! test
12973 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12974 !! wikitext
12975 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12976 <div style="top:EXPRESSION(alert())">B</div>
12977 !! html
12978 <p style="/* insecure input */">A</p>
12979 <div style="/* insecure input */">B</div>
12980
12981 !! end
12982
12983 !! test
12984 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12985 !! wikitext
12986 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12987 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12988 !! html
12989 <div style="/* insecure input */">A</div>
12990 <p style="/* insecure input */">B</p>
12991
12992 !! end
12993
12994 !! test
12995 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12996 !! wikitext
12997 <div style="background-image:url⁽javascript:alert())">A</div>
12998 <div style="background-image:url₍javascript:alert())">B</div>
12999 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13000 !! html
13001 <div style="/* insecure input */">A</div>
13002 <div style="/* insecure input */">B</div>
13003 <p style="/* insecure input */">C</p>
13004
13005 !! end
13006
13007 !! test
13008 Opera -o-link CSS
13009 !! wikitext
13010 <div
13011 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;"
13012 style="-o-link:attr(title);-o-link-source:current">X</div>
13013 !! html
13014 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13015
13016 !! end
13017
13018 !! test
13019 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13020 !! wikitext
13021 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13022 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13023 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13024 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13025 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13026 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13027 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13028 !! html
13029 <p style="/* insecure input */">A</p>
13030 <p style="/* insecure input */">B</p>
13031 <p style="/* insecure input */">C</p>
13032 <p style="/* insecure input */">D</p>
13033 <p style="/* insecure input */">E</p>
13034 <p style="/* insecure input */">F</p>
13035 <p style="/* insecure input */">G</p>
13036
13037 !! end
13038
13039 !! test
13040 Table attribute legitimate extension
13041 !! wikitext
13042 {|
13043 !+ style="<nowiki>color:blue</nowiki>"| status
13044 |}
13045 !! html
13046 <table>
13047 <tr>
13048 <th style="color:blue"> status
13049 </th></tr></table>
13050
13051 !!end
13052
13053 !! test
13054 Table attribute safety
13055 !! wikitext
13056 {|
13057 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13058 |}
13059 !! html
13060 <table>
13061 <tr>
13062 <th style="/* insecure input */"> status
13063 </th></tr></table>
13064
13065 !! end
13066
13067 !! test
13068 CSS line continuation 1
13069 !! wikitext
13070 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13071 !! html
13072 <div style="/* insecure input */"></div>
13073
13074 !! end
13075
13076 !! test
13077 CSS line continuation 2
13078 !! wikitext
13079 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13080 !! html
13081 <div style="/* insecure input */"></div>
13082
13083 !! end
13084
13085 !! article
13086 Template:Identity
13087 !! text
13088 {{{1}}}
13089 !! endarticle
13090
13091 !! test
13092 Expansion of multi-line templates in attribute values (bug 6255)
13093 !! wikitext
13094 <div style="background: {{identity|#00FF00}}">-</div>
13095 !! html
13096 <div style="background: #00FF00">-</div>
13097
13098 !! end
13099
13100
13101 !! test
13102 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13103 !! wikitext
13104 <div style="background:
13105 #00FF00">-</div>
13106 !! html
13107 <div style="background: #00FF00">-</div>
13108
13109 !! end
13110
13111 !! test
13112 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13113 !! wikitext
13114 <div style="background: &#10;#00FF00">-</div>
13115 !! html
13116 <div style="background: &#10;#00FF00">-</div>
13117
13118 !! end
13119
13120 ###
13121 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13122 ###
13123 !! test
13124 Parser hook: empty input
13125 !! wikitext
13126 <tag></tag>
13127 !! html
13128 <pre>
13129 ''
13130 array (
13131 )
13132 </pre>
13133
13134 !! end
13135
13136 !! test
13137 Parser hook: empty input using terminated empty elements
13138 !! wikitext
13139 <tag/>
13140 !! html
13141 <pre>
13142 NULL
13143 array (
13144 )
13145 </pre>
13146
13147 !! end
13148
13149 !! test
13150 Parser hook: empty input using terminated empty elements (space before)
13151 !! wikitext
13152 <tag />
13153 !! html
13154 <pre>
13155 NULL
13156 array (
13157 )
13158 </pre>
13159
13160 !! end
13161
13162 !! test
13163 Parser hook: basic input
13164 !! wikitext
13165 <tag>input</tag>
13166 !! html
13167 <pre>
13168 'input'
13169 array (
13170 )
13171 </pre>
13172
13173 !! end
13174
13175
13176 !! test
13177 Parser hook: case insensitive
13178 !! wikitext
13179 <TAG>input</TAG>
13180 !! html
13181 <pre>
13182 'input'
13183 array (
13184 )
13185 </pre>
13186
13187 !! end
13188
13189
13190 !! test
13191 Parser hook: case insensitive, redux
13192 !! wikitext
13193 <TaG>input</TAg>
13194 !! html
13195 <pre>
13196 'input'
13197 array (
13198 )
13199 </pre>
13200
13201 !! end
13202
13203 !! test
13204 Parser hook: nested tags
13205 !! options
13206 noxml
13207 !! wikitext
13208 <tag><tag></tag></tag>
13209 !! html
13210 <pre>
13211 '<tag>'
13212 array (
13213 )
13214 </pre>&lt;/tag&gt;
13215
13216 !! end
13217
13218 !! test
13219 Parser hook: basic arguments
13220 !! wikitext
13221 <tag width=200 height = "100" depth = '50' square></tag>
13222 !! html
13223 <pre>
13224 ''
13225 array (
13226 'width' => '200',
13227 'height' => '100',
13228 'depth' => '50',
13229 'square' => 'square',
13230 )
13231 </pre>
13232
13233 !! end
13234
13235 !! test
13236 Parser hook: argument containing a forward slash (bug 5344)
13237 !! wikitext
13238 <tag filename='/tmp/bla'></tag>
13239 !! html
13240 <pre>
13241 ''
13242 array (
13243 'filename' => '/tmp/bla',
13244 )
13245 </pre>
13246
13247 !! end
13248
13249 !! test
13250 Parser hook: empty input using terminated empty elements (bug 2374)
13251 !! wikitext
13252 <tag foo=bar/>text
13253 !! html
13254 <pre>
13255 NULL
13256 array (
13257 'foo' => 'bar',
13258 )
13259 </pre>text
13260
13261 !! end
13262
13263 # </tag> should be output literally since there is no matching tag that begins it
13264 !! test
13265 Parser hook: basic arguments using terminated empty elements (bug 2374)
13266 !! wikitext
13267 <tag width=200 height = "100" depth = '50' square/>
13268 other stuff
13269 </tag>
13270 !! html
13271 <pre>
13272 NULL
13273 array (
13274 'width' => '200',
13275 'height' => '100',
13276 'depth' => '50',
13277 'square' => 'square',
13278 )
13279 </pre>
13280 <p>other stuff
13281 &lt;/tag&gt;
13282 </p>
13283 !! end
13284
13285 ###
13286 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13287 ###
13288
13289 !! test
13290 Parser hook: static parser hook not inside a comment
13291 !! wikitext
13292 <statictag>hello, world</statictag>
13293 <statictag action=flush/>
13294 !! html
13295 <p>hello, world
13296 </p>
13297 !! end
13298
13299
13300 !! test
13301 Parser hook: static parser hook inside a comment
13302 !! wikitext
13303 <!-- <statictag>hello, world</statictag> -->
13304 <statictag action=flush/>
13305 !! html
13306 <p><br />
13307 </p>
13308 !! end
13309
13310 # Nested template calls; this case was broken by Parser.php rev 1.506,
13311 # since reverted.
13312
13313 !! article
13314 Template:One-parameter
13315 !! text
13316 (My parameter is: {{{1}}})
13317 !! endarticle
13318
13319 !! article
13320 Template:Map-one-parameter
13321 !! text
13322 {{{{{1}}}|{{{2}}}}}
13323 !! endarticle
13324
13325 !! test
13326 Nested template calls
13327 !! wikitext
13328 {{Map-one-parameter|One-parameter|param}}
13329 !! html
13330 <p>(My parameter is: param)
13331 </p>
13332 !! end
13333
13334
13335 ###
13336 ### Sanitizer
13337 ###
13338 !! test
13339 Sanitizer: Closing of open tags
13340 !! wikitext
13341 <s></s><table></table>
13342 !! html
13343 <s></s><table></table>
13344
13345 !! end
13346
13347 !! test
13348 Sanitizer: Closing of open but not closed tags
13349 !! wikitext
13350 <s>foo
13351 !! html
13352 <p><s>foo</s>
13353 </p>
13354 !! end
13355
13356 !! test
13357 Sanitizer: Closing of closed but not open tags
13358 !! wikitext
13359 </s>
13360 !! html
13361 <p>&lt;/s&gt;
13362 </p>
13363 !! end
13364
13365 !! test
13366 Sanitizer: Closing of closed but not open table tags
13367 !! wikitext
13368 Table not started</td></tr></table>
13369 !! html
13370 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13371 </p>
13372 !! end
13373
13374 !! test
13375 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13376 !! wikitext
13377 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13378 !! html
13379 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13380 </p>
13381 !! end
13382
13383 !! test
13384 Sanitizer: Validating the contents of the id attribute (bug 4515)
13385 !! options
13386 disabled
13387 !! wikitext
13388 <br id=9 />
13389 !! html
13390 Something, but definitely not <br id="9" />...
13391 !! end
13392
13393 !! test
13394 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13395 !! options
13396 disabled
13397 !! wikitext
13398 <br id="foo" /><br id="foo" />
13399 !! html
13400 Something need to be done. foo-2 ?
13401 !! end
13402
13403 !! test
13404 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13405 !! wikitext
13406 <div itemscope>
13407 <meta itemprop="hello" content="world">
13408 <meta http-equiv="refresh" content="5">
13409 <meta itemprop="hello" http-equiv="refresh" content="5">
13410 <link itemprop="hello" href="{{SERVER}}">
13411 <link rel="stylesheet" href="{{SERVER}}">
13412 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13413 </div>
13414 !! html
13415 <div itemscope="itemscope">
13416 <p> <meta itemprop="hello" content="world" />
13417 &lt;meta http-equiv="refresh" content="5"&gt;
13418 <meta itemprop="hello" content="5" />
13419 </p>
13420 <link itemprop="hello" href="http&#58;//example.org" />
13421 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13422 <link itemprop="hello" href="http&#58;//example.org" />
13423 </div>
13424
13425 !! end
13426
13427 !! test
13428 Language converter: output gets cut off unexpectedly (bug 5757)
13429 !! options
13430 language=zh
13431 !! wikitext
13432 this bit is safe: }-
13433
13434 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13435
13436 then we get cut off here: }-
13437
13438 all additional text is vanished
13439 !! html
13440 <p>this bit is safe: }-
13441 </p><p>but if we add a conversion instance: xxx
13442 </p><p>then we get cut off here: }-
13443 </p><p>all additional text is vanished
13444 </p>
13445 !! end
13446
13447 !! test
13448 Self closed html pairs (bug 5487)
13449 !! options
13450 !! wikitext
13451 <center><font id="bug" />Centered text</center>
13452 <div><font id="bug2" />In div text</div>
13453 !! html
13454 <center>&lt;font id="bug" /&gt;Centered text</center>
13455 <div>&lt;font id="bug2" /&gt;In div text</div>
13456
13457 !! end
13458
13459 #
13460 #
13461 #
13462
13463 !! test
13464 Punctuation: nbsp before exclamation
13465 !! wikitext
13466 C'est grave !
13467 !! html
13468 <p>C'est grave&#160;!
13469 </p>
13470 !! end
13471
13472 !! test
13473 Punctuation: CSS !important (bug 11874)
13474 !! wikitext
13475 <div style="width:50% !important">important</div>
13476 !! html
13477 <div style="width:50% !important">important</div>
13478
13479 !!end
13480
13481 !! test
13482 Punctuation: CSS ! important (bug 11874; with space after)
13483 !! wikitext
13484 <div style="width:50% ! important">important</div>
13485 !! html
13486 <div style="width:50% ! important">important</div>
13487
13488 !!end
13489
13490
13491 !! test
13492 HTML bullet list, closed tags (bug 5497)
13493 !! wikitext
13494 <ul>
13495 <li>One</li>
13496 <li>Two</li>
13497 </ul>
13498 !! html
13499 <ul>
13500 <li>One</li>
13501 <li>Two</li>
13502 </ul>
13503
13504 !! end
13505
13506 !! test
13507 HTML bullet list, unclosed tags (bug 5497)
13508 !! options
13509 disabled
13510 !! wikitext
13511 <ul>
13512 <li>One
13513 <li>Two
13514 </ul>
13515 !! html
13516 <ul>
13517 <li>One
13518 </li>
13519 <li>Two
13520 </li>
13521 </ul>
13522
13523 !! end
13524
13525 !! test
13526 HTML ordered list, closed tags (bug 5497)
13527 !! wikitext
13528 <ol>
13529 <li>One</li>
13530 <li>Two</li>
13531 </ol>
13532 !! html
13533 <ol>
13534 <li>One</li>
13535 <li>Two</li>
13536 </ol>
13537
13538 !! end
13539
13540 !! test
13541 HTML ordered list, unclosed tags (bug 5497)
13542 !! options
13543 disabled
13544 !! wikitext
13545 <ol>
13546 <li>One
13547 <li>Two
13548 </ol>
13549 !! html
13550 <ol>
13551 <li>One
13552 </li>
13553 <li>Two
13554 </li>
13555 </ol>
13556
13557 !! end
13558
13559 !! test
13560 HTML nested bullet list, closed tags (bug 5497)
13561 !! wikitext
13562 <ul>
13563 <li>One</li>
13564 <li>Two:
13565 <ul>
13566 <li>Sub-one</li>
13567 <li>Sub-two</li>
13568 </ul>
13569 </li>
13570 </ul>
13571 !! html
13572 <ul>
13573 <li>One</li>
13574 <li>Two:
13575 <ul>
13576 <li>Sub-one</li>
13577 <li>Sub-two</li>
13578 </ul>
13579 </li>
13580 </ul>
13581
13582 !! end
13583
13584 !! test
13585 HTML nested bullet list, open tags (bug 5497)
13586 !! options
13587 disabled
13588 !! wikitext
13589 <ul>
13590 <li>One
13591 <li>Two:
13592 <ul>
13593 <li>Sub-one
13594 <li>Sub-two
13595 </ul>
13596 </ul>
13597 !! html
13598 <ul>
13599 <li>One
13600 </li>
13601 <li>Two:
13602 <ul>
13603 <li>Sub-one
13604 </li>
13605 <li>Sub-two
13606 </li>
13607 </ul>
13608 </li>
13609 </ul>
13610
13611 !! end
13612
13613 !! test
13614 HTML nested ordered list, closed tags (bug 5497)
13615 !! wikitext
13616 <ol>
13617 <li>One</li>
13618 <li>Two:
13619 <ol>
13620 <li>Sub-one</li>
13621 <li>Sub-two</li>
13622 </ol>
13623 </li>
13624 </ol>
13625 !! html
13626 <ol>
13627 <li>One</li>
13628 <li>Two:
13629 <ol>
13630 <li>Sub-one</li>
13631 <li>Sub-two</li>
13632 </ol>
13633 </li>
13634 </ol>
13635
13636 !! end
13637
13638 !! test
13639 HTML nested ordered list, open tags (bug 5497)
13640 !! options
13641 disabled
13642 !! wikitext
13643 <ol>
13644 <li>One
13645 <li>Two:
13646 <ol>
13647 <li>Sub-one
13648 <li>Sub-two
13649 </ol>
13650 </ol>
13651 !! html
13652 <ol>
13653 <li>One
13654 </li>
13655 <li>Two:
13656 <ol>
13657 <li>Sub-one
13658 </li>
13659 <li>Sub-two
13660 </li>
13661 </ol>
13662 </li>
13663 </ol>
13664
13665 !! end
13666
13667 !! test
13668 HTML ordered list item with parameters oddity
13669 !! wikitext
13670 <ol><li id="fragment">One</li>
13671 </ol>
13672 !! html
13673 <ol><li id="fragment">One</li>
13674 </ol>
13675
13676 !! end
13677
13678 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13679 !!test
13680 bug 5918: autonumbering
13681 !! wikitext
13682 [http://first/] [http://second] [ftp://ftp]
13683
13684 ftp://inlineftp
13685
13686 [mailto:enclosed@mail.tld With target]
13687
13688 [mailto:enclosed@mail.tld]
13689
13690 mailto:inline@mail.tld
13691 !! html/php
13692 <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>
13693 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13694 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13695 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13696 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13697 </p>
13698 !! html/parsoid
13699 <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>
13700 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13701 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13702 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13703 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13704 !! end
13705
13706
13707 #
13708 # Security and HTML correctness
13709 # From Nick Jenkins' fuzz testing
13710 #
13711
13712 !! test
13713 Fuzz testing: Parser13
13714 !! wikitext
13715 {|
13716 | http://a|
13717 !! html
13718 <table>
13719 <tr>
13720 <td>
13721 </td>
13722 </tr>
13723 </table>
13724
13725 !! end
13726
13727 !! test
13728 Fuzz testing: Parser14
13729 !! wikitext
13730 == onmouseover= ==
13731 http://__TOC__
13732 !! html
13733 <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>
13734 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13735 <ul>
13736 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13737 </ul>
13738 </div>
13739
13740
13741 !! end
13742
13743 !! test
13744 Fuzz testing: Parser14-table
13745 !! wikitext
13746 ==a==
13747 {| STYLE=__TOC__
13748 !! html
13749 <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>
13750 <table style="&#95;_TOC&#95;_">
13751 <tr><td></td></tr>
13752 </table>
13753
13754 !! end
13755
13756 # Known to produce bogus xml (extra </td>)
13757 !! test
13758 Fuzz testing: Parser16
13759 !! options
13760 noxml
13761 !! wikitext
13762 {|
13763 !https://||||||
13764 !! html
13765 <table>
13766 <tr>
13767 <th>https://</th>
13768 <th></th>
13769 <th></th>
13770 <th>
13771 </td>
13772 </tr>
13773 </table>
13774
13775 !! end
13776
13777 !! test
13778 Fuzz testing: Parser21
13779 !! wikitext
13780 {|
13781 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13782 |
13783 !! html
13784 <table>
13785 <tr>
13786 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13787 </th>
13788 <td>
13789 </td>
13790 </tr>
13791 </table>
13792
13793 !! end
13794
13795 !! test
13796 Fuzz testing: Parser22
13797 !! wikitext
13798 http://===r:::https://b
13799
13800 {|
13801 !! html
13802 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13803 </p>
13804 <table>
13805 <tr><td></td></tr>
13806 </table>
13807
13808 !! end
13809
13810 # Known to produce bad XML for now
13811 !! test
13812 Fuzz testing: Parser24
13813 !! options
13814 noxml
13815 !! wikitext
13816 {|
13817 {{{|
13818 <u CLASS=
13819 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13820 <br style="onmouseover='alert(document.cookie);' " />
13821
13822 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13823 |
13824 !! html
13825 <table>
13826 {{{|
13827 <u class="&#124;">}}}} &gt;
13828 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13829
13830 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13831 <tr>
13832 <td></u>
13833 </td>
13834 </tr>
13835 </table>
13836
13837 !! end
13838
13839 # Note: the current result listed for this is not what the original one was,
13840 # but the original bug was JavaScript injection, which is fixed in any case.
13841 # It's not clear that the original result listed was any more correct than the
13842 # current one. Original result:
13843 # <p>{{{|
13844 # </p>
13845 # <li class="&#124;&#124;">
13846 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13847 !!test
13848 Fuzz testing: Parser25 (bug 6055)
13849 !! wikitext
13850 {{{
13851 |
13852 <LI CLASS=||
13853 >
13854 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13855 !! html
13856 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13857 </p>
13858 !! end
13859
13860 !!test
13861 Fuzz testing: URL adjacent extension (with space, clean)
13862 !! options
13863 !! wikitext
13864 http://example.com <nowiki>junk</nowiki>
13865 !! html
13866 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13867 </p>
13868 !!end
13869
13870 !!test
13871 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13872 !! options
13873 !! wikitext
13874 http://example.com<nowiki>junk</nowiki>
13875 !! html
13876 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13877 </p>
13878 !!end
13879
13880 !!test
13881 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13882 !! options
13883 !! wikitext
13884 http://example.com<pre>junk</pre>
13885 !! html
13886 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13887
13888 !!end
13889
13890 !!test
13891 Fuzz testing: image with bogus manual thumbnail
13892 !! wikitext
13893 [[Image:foobar.jpg|thumbnail= ]]
13894 !! html/php
13895 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13896
13897 !! html/parsoid
13898 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13899 !!end
13900
13901 !! test
13902 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13903 !! wikitext
13904 <pre dir="&#10;"></pre>
13905 !! html
13906 <pre dir="&#10;"></pre>
13907
13908 !! end
13909
13910 !! test
13911 Parsing optional HTML elements (Bug 6171)
13912 !! options
13913 !! wikitext
13914 <table>
13915 <tr>
13916 <td> Some tabular data</td>
13917 <td> More tabular data ...
13918 <td> And yet som tabular data</td>
13919 </tr>
13920 </table>
13921 !! html
13922 <table>
13923 <tr>
13924 <td> Some tabular data</td>
13925 <td> More tabular data ...
13926 </td><td> And yet som tabular data</td>
13927 </tr>
13928 </table>
13929
13930 !! end
13931
13932 !! test
13933 Correct handling of <td>, <tr> (Bug 6171)
13934 !! options
13935 !! wikitext
13936 <table>
13937 <tr>
13938 <td> Some tabular data</td>
13939 <td> More tabular data ...</td>
13940 <td> And yet som tabular data</td>
13941 </tr>
13942 </table>
13943 !! html
13944 <table>
13945 <tr>
13946 <td> Some tabular data</td>
13947 <td> More tabular data ...</td>
13948 <td> And yet som tabular data</td>
13949 </tr>
13950 </table>
13951
13952 !! end
13953
13954
13955 !! test
13956 Parsing crashing regression (fr:JavaScript)
13957 !! wikitext
13958 </body></x>
13959 !! html
13960 <p>&lt;/body&gt;&lt;/x&gt;
13961 </p>
13962 !! end
13963
13964 !! test
13965 Inline wiki vs wiki block nesting
13966 !! wikitext
13967 '''Bold paragraph
13968
13969 New wiki paragraph
13970 !! html
13971 <p><b>Bold paragraph</b>
13972 </p><p>New wiki paragraph
13973 </p>
13974 !! end
13975
13976 !! test
13977 Inline HTML vs wiki block nesting
13978 !! options
13979 disabled
13980 !! wikitext
13981 <b>Bold paragraph
13982
13983 New wiki paragraph
13984 !! html
13985 <p><b>Bold paragraph</b>
13986 </p><p>New wiki paragraph
13987 </p>
13988 !! end
13989
13990 # Original result was this:
13991 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13992 # </p>
13993 # While that might be marginally more intuitive, maybe, the six-apostrophe
13994 # construct is clearly pathological and the result stated here (which is what
13995 # the parser actually does) is about as reasonable as anything.
13996 !!test
13997 Mixing markup for italics and bold
13998 !! options
13999 !! wikitext
14000 '''bold''''''bold''bolditalics'''''
14001 !! html
14002 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14003 </p>
14004 !! end
14005
14006
14007 !! article
14008 Xyzzyx
14009 !! text
14010 Article for special page transclusion test
14011 !! endarticle
14012
14013 !! test
14014 Special page transclusion
14015 !! options
14016 !! wikitext
14017 {{Special:Prefixindex/Xyzzyx}}
14018 !! html
14019 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14020
14021 !! end
14022
14023 !! test
14024 Special page transclusion twice (bug 5021)
14025 !! options
14026 !! wikitext
14027 {{Special:Prefixindex/Xyzzyx}}
14028 {{Special:Prefixindex/Xyzzyx}}
14029 !! html
14030 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14031 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14032
14033 !! end
14034
14035 !! test
14036 Transclusion of default MediaWiki message
14037 !! wikitext
14038 {{MediaWiki:Mainpage}}
14039 !! html
14040 <p>Main Page
14041 </p>
14042 !! end
14043
14044 !! test
14045 Transclusion of nonexistent MediaWiki message
14046 !! wikitext
14047 {{MediaWiki:Mainpagexxx}}
14048 !! html
14049 <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>
14050 </p>
14051 !! end
14052
14053 !! test
14054 Transclusion of MediaWiki message with underscore
14055 !! wikitext
14056 {{MediaWiki:history_short}}
14057 !! html
14058 <p>History
14059 </p>
14060 !! end
14061
14062 !! test
14063 Transclusion of MediaWiki message with space
14064 !! wikitext
14065 {{MediaWiki:history short}}
14066 !! html
14067 <p>History
14068 </p>
14069 !! end
14070
14071 !! test
14072 Invalid header with following text
14073 !! wikitext
14074 = x = y
14075 !! html
14076 <p>= x = y
14077 </p>
14078 !! end
14079
14080
14081 !! test
14082 Section extraction test (section 0)
14083 !! options
14084 section=0
14085 !! wikitext
14086 start
14087 ==a==
14088 ===aa===
14089 ====aaa====
14090 ==b==
14091 ===ba===
14092 ===bb===
14093 ====bba====
14094 ===bc===
14095 ==c==
14096 ===ca===
14097 !! html
14098 start
14099 !! end
14100
14101 !! test
14102 Section extraction test (section 1)
14103 !! options
14104 section=1
14105 !! wikitext
14106 start
14107 ==a==
14108 ===aa===
14109 ====aaa====
14110 ==b==
14111 ===ba===
14112 ===bb===
14113 ====bba====
14114 ===bc===
14115 ==c==
14116 ===ca===
14117 !! html
14118 ==a==
14119 ===aa===
14120 ====aaa====
14121 !! end
14122
14123 !! test
14124 Section extraction test (section 2)
14125 !! options
14126 section=2
14127 !! wikitext
14128 start
14129 ==a==
14130 ===aa===
14131 ====aaa====
14132 ==b==
14133 ===ba===
14134 ===bb===
14135 ====bba====
14136 ===bc===
14137 ==c==
14138 ===ca===
14139 !! html
14140 ===aa===
14141 ====aaa====
14142 !! end
14143
14144 !! test
14145 Section extraction test (section 3)
14146 !! options
14147 section=3
14148 !! wikitext
14149 start
14150 ==a==
14151 ===aa===
14152 ====aaa====
14153 ==b==
14154 ===ba===
14155 ===bb===
14156 ====bba====
14157 ===bc===
14158 ==c==
14159 ===ca===
14160 !! html
14161 ====aaa====
14162 !! end
14163
14164 !! test
14165 Section extraction test (section 4)
14166 !! options
14167 section=4
14168 !! wikitext
14169 start
14170 ==a==
14171 ===aa===
14172 ====aaa====
14173 ==b==
14174 ===ba===
14175 ===bb===
14176 ====bba====
14177 ===bc===
14178 ==c==
14179 ===ca===
14180 !! html
14181 ==b==
14182 ===ba===
14183 ===bb===
14184 ====bba====
14185 ===bc===
14186 !! end
14187
14188 !! test
14189 Section extraction test (section 5)
14190 !! options
14191 section=5
14192 !! wikitext
14193 start
14194 ==a==
14195 ===aa===
14196 ====aaa====
14197 ==b==
14198 ===ba===
14199 ===bb===
14200 ====bba====
14201 ===bc===
14202 ==c==
14203 ===ca===
14204 !! html
14205 ===ba===
14206 !! end
14207
14208 !! test
14209 Section extraction test (section 6)
14210 !! options
14211 section=6
14212 !! wikitext
14213 start
14214 ==a==
14215 ===aa===
14216 ====aaa====
14217 ==b==
14218 ===ba===
14219 ===bb===
14220 ====bba====
14221 ===bc===
14222 ==c==
14223 ===ca===
14224 !! html
14225 ===bb===
14226 ====bba====
14227 !! end
14228
14229 !! test
14230 Section extraction test (section 7)
14231 !! options
14232 section=7
14233 !! wikitext
14234 start
14235 ==a==
14236 ===aa===
14237 ====aaa====
14238 ==b==
14239 ===ba===
14240 ===bb===
14241 ====bba====
14242 ===bc===
14243 ==c==
14244 ===ca===
14245 !! html
14246 ====bba====
14247 !! end
14248
14249 !! test
14250 Section extraction test (section 8)
14251 !! options
14252 section=8
14253 !! wikitext
14254 start
14255 ==a==
14256 ===aa===
14257 ====aaa====
14258 ==b==
14259 ===ba===
14260 ===bb===
14261 ====bba====
14262 ===bc===
14263 ==c==
14264 ===ca===
14265 !! html
14266 ===bc===
14267 !! end
14268
14269 !! test
14270 Section extraction test (section 9)
14271 !! options
14272 section=9
14273 !! wikitext
14274 start
14275 ==a==
14276 ===aa===
14277 ====aaa====
14278 ==b==
14279 ===ba===
14280 ===bb===
14281 ====bba====
14282 ===bc===
14283 ==c==
14284 ===ca===
14285 !! html
14286 ==c==
14287 ===ca===
14288 !! end
14289
14290 !! test
14291 Section extraction test (section 10)
14292 !! options
14293 section=10
14294 !! wikitext
14295 start
14296 ==a==
14297 ===aa===
14298 ====aaa====
14299 ==b==
14300 ===ba===
14301 ===bb===
14302 ====bba====
14303 ===bc===
14304 ==c==
14305 ===ca===
14306 !! html
14307 ===ca===
14308 !! end
14309
14310 !! test
14311 Section extraction test (nonexistent section 11)
14312 !! options
14313 section=11
14314 !! wikitext
14315 start
14316 ==a==
14317 ===aa===
14318 ====aaa====
14319 ==b==
14320 ===ba===
14321 ===bb===
14322 ====bba====
14323 ===bc===
14324 ==c==
14325 ===ca===
14326 !! html
14327 !! end
14328
14329 !! test
14330 Section extraction test with bogus heading (section 1)
14331 !! options
14332 section=1
14333 !! wikitext
14334 ==a==
14335 ==bogus== not a legal section
14336 ==b==
14337 !! html
14338 ==a==
14339 ==bogus== not a legal section
14340 !! end
14341
14342 !! test
14343 Section extraction test with bogus heading (section 2)
14344 !! options
14345 section=2
14346 !! wikitext
14347 ==a==
14348 ==bogus== not a legal section
14349 ==b==
14350 !! html
14351 ==b==
14352 !! end
14353
14354 !! test
14355 Section extraction test with comment after heading (section 1)
14356 !! options
14357 section=1
14358 !! wikitext
14359 ==a==
14360 ==b== <!-- -->
14361 ==c==
14362 !! html
14363 ==a==
14364 !! end
14365
14366 !! test
14367 Section extraction test with comment after heading (section 2)
14368 !! options
14369 section=2
14370 !! wikitext
14371 ==a==
14372 ==b== <!-- -->
14373 ==c==
14374 !! html
14375 ==b== <!-- -->
14376 !! end
14377
14378 !! test
14379 Section extraction test with bogus <nowiki> heading (section 1)
14380 !! options
14381 section=1
14382 !! wikitext
14383 ==a==
14384 ==bogus== <nowiki>not a legal section</nowiki>
14385 ==b==
14386 !! html
14387 ==a==
14388 ==bogus== <nowiki>not a legal section</nowiki>
14389 !! end
14390
14391 !! test
14392 Section extraction test with bogus <nowiki> heading (section 2)
14393 !! options
14394 section=2
14395 !! wikitext
14396 ==a==
14397 ==bogus== <nowiki>not a legal section</nowiki>
14398 ==b==
14399 !! html
14400 ==b==
14401 !! end
14402
14403
14404 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14405 # instead of respecting commented sections
14406 !! test
14407 Section extraction prefixed by comment (section 1)
14408 !! options
14409 section=1
14410 !! wikitext
14411 <!-- -->==sec1==
14412 ==sec2==
14413 !! html
14414 ==sec2==
14415 !!end
14416
14417 !! test
14418 Section extraction prefixed by comment (section 2)
14419 !! options
14420 section=2
14421 !! wikitext
14422 <!-- -->==sec1==
14423 ==sec2==
14424 !! html
14425
14426 !!end
14427
14428
14429 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14430 # instead of respecting HTML-style headings
14431 !! test
14432 Section extraction, mixed wiki and html (section 1)
14433 !! options
14434 section=1
14435 !! wikitext
14436 <h2>unmarked</h2>
14437 unmarked
14438 ==1==
14439 one
14440 ==2==
14441 two
14442 !! html
14443 ==1==
14444 one
14445 !! end
14446
14447 !! test
14448 Section extraction, mixed wiki and html (section 2)
14449 !! options
14450 section=2
14451 !! wikitext
14452 <h2>unmarked</h2>
14453 unmarked
14454 ==1==
14455 one
14456 ==2==
14457 two
14458 !! html
14459 ==2==
14460 two
14461 !! end
14462
14463
14464 # Formerly testing for bug 3342
14465 !! test
14466 Section extraction, heading surrounded by <noinclude>
14467 !! options
14468 section=1
14469 !! wikitext
14470 <noinclude>==unmarked==</noinclude>
14471 ==marked==
14472 !! html
14473 ==marked==
14474 !!end
14475
14476 # Test behavior of bug 19910
14477 !! test
14478 Sectiion with all-equals
14479 !! options
14480 section=2
14481 !! wikitext
14482 ===
14483 The line above must have a trailing space
14484 === <!--
14485 --> <!-- -->
14486 But just in case it doesn't...
14487 !! html
14488 === <!--
14489 --> <!-- -->
14490 But just in case it doesn't...
14491 !! end
14492
14493 !! test
14494 Section replacement test (section 0)
14495 !! options
14496 replace=0,"xxx"
14497 !! wikitext
14498 start
14499 ==a==
14500 ===aa===
14501 ====aaa====
14502 ==b==
14503 ===ba===
14504 ===bb===
14505 ====bba====
14506 ===bc===
14507 ==c==
14508 ===ca===
14509 !! html
14510 xxx
14511
14512 ==a==
14513 ===aa===
14514 ====aaa====
14515 ==b==
14516 ===ba===
14517 ===bb===
14518 ====bba====
14519 ===bc===
14520 ==c==
14521 ===ca===
14522 !! end
14523
14524 !! test
14525 Section replacement test (section 1)
14526 !! options
14527 replace=1,"xxx"
14528 !! wikitext
14529 start
14530 ==a==
14531 ===aa===
14532 ====aaa====
14533 ==b==
14534 ===ba===
14535 ===bb===
14536 ====bba====
14537 ===bc===
14538 ==c==
14539 ===ca===
14540 !! html
14541 start
14542 xxx
14543
14544 ==b==
14545 ===ba===
14546 ===bb===
14547 ====bba====
14548 ===bc===
14549 ==c==
14550 ===ca===
14551 !! end
14552
14553 !! test
14554 Section replacement test (section 2)
14555 !! options
14556 replace=2,"xxx"
14557 !! wikitext
14558 start
14559 ==a==
14560 ===aa===
14561 ====aaa====
14562 ==b==
14563 ===ba===
14564 ===bb===
14565 ====bba====
14566 ===bc===
14567 ==c==
14568 ===ca===
14569 !! html
14570 start
14571 ==a==
14572 xxx
14573
14574 ==b==
14575 ===ba===
14576 ===bb===
14577 ====bba====
14578 ===bc===
14579 ==c==
14580 ===ca===
14581 !! end
14582
14583 !! test
14584 Section replacement test (section 3)
14585 !! options
14586 replace=3,"xxx"
14587 !! wikitext
14588 start
14589 ==a==
14590 ===aa===
14591 ====aaa====
14592 ==b==
14593 ===ba===
14594 ===bb===
14595 ====bba====
14596 ===bc===
14597 ==c==
14598 ===ca===
14599 !! html
14600 start
14601 ==a==
14602 ===aa===
14603 xxx
14604
14605 ==b==
14606 ===ba===
14607 ===bb===
14608 ====bba====
14609 ===bc===
14610 ==c==
14611 ===ca===
14612 !! end
14613
14614 !! test
14615 Section replacement test (section 4)
14616 !! options
14617 replace=4,"xxx"
14618 !! wikitext
14619 start
14620 ==a==
14621 ===aa===
14622 ====aaa====
14623 ==b==
14624 ===ba===
14625 ===bb===
14626 ====bba====
14627 ===bc===
14628 ==c==
14629 ===ca===
14630 !! html
14631 start
14632 ==a==
14633 ===aa===
14634 ====aaa====
14635 xxx
14636
14637 ==c==
14638 ===ca===
14639 !! end
14640
14641 !! test
14642 Section replacement test (section 5)
14643 !! options
14644 replace=5,"xxx"
14645 !! wikitext
14646 start
14647 ==a==
14648 ===aa===
14649 ====aaa====
14650 ==b==
14651 ===ba===
14652 ===bb===
14653 ====bba====
14654 ===bc===
14655 ==c==
14656 ===ca===
14657 !! html
14658 start
14659 ==a==
14660 ===aa===
14661 ====aaa====
14662 ==b==
14663 xxx
14664
14665 ===bb===
14666 ====bba====
14667 ===bc===
14668 ==c==
14669 ===ca===
14670 !! end
14671
14672 !! test
14673 Section replacement test (section 6)
14674 !! options
14675 replace=6,"xxx"
14676 !! wikitext
14677 start
14678 ==a==
14679 ===aa===
14680 ====aaa====
14681 ==b==
14682 ===ba===
14683 ===bb===
14684 ====bba====
14685 ===bc===
14686 ==c==
14687 ===ca===
14688 !! html
14689 start
14690 ==a==
14691 ===aa===
14692 ====aaa====
14693 ==b==
14694 ===ba===
14695 xxx
14696
14697 ===bc===
14698 ==c==
14699 ===ca===
14700 !! end
14701
14702 !! test
14703 Section replacement test (section 7)
14704 !! options
14705 replace=7,"xxx"
14706 !! wikitext
14707 start
14708 ==a==
14709 ===aa===
14710 ====aaa====
14711 ==b==
14712 ===ba===
14713 ===bb===
14714 ====bba====
14715 ===bc===
14716 ==c==
14717 ===ca===
14718 !! html
14719 start
14720 ==a==
14721 ===aa===
14722 ====aaa====
14723 ==b==
14724 ===ba===
14725 ===bb===
14726 xxx
14727
14728 ===bc===
14729 ==c==
14730 ===ca===
14731 !! end
14732
14733 !! test
14734 Section replacement test (section 8)
14735 !! options
14736 replace=8,"xxx"
14737 !! wikitext
14738 start
14739 ==a==
14740 ===aa===
14741 ====aaa====
14742 ==b==
14743 ===ba===
14744 ===bb===
14745 ====bba====
14746 ===bc===
14747 ==c==
14748 ===ca===
14749 !! html
14750 start
14751 ==a==
14752 ===aa===
14753 ====aaa====
14754 ==b==
14755 ===ba===
14756 ===bb===
14757 ====bba====
14758 xxx
14759
14760 ==c==
14761 ===ca===
14762 !!end
14763
14764 !! test
14765 Section replacement test (section 9)
14766 !! options
14767 replace=9,"xxx"
14768 !! wikitext
14769 start
14770 ==a==
14771 ===aa===
14772 ====aaa====
14773 ==b==
14774 ===ba===
14775 ===bb===
14776 ====bba====
14777 ===bc===
14778 ==c==
14779 ===ca===
14780 !! html
14781 start
14782 ==a==
14783 ===aa===
14784 ====aaa====
14785 ==b==
14786 ===ba===
14787 ===bb===
14788 ====bba====
14789 ===bc===
14790 xxx
14791 !! end
14792
14793 !! test
14794 Section replacement test (section 10)
14795 !! options
14796 replace=10,"xxx"
14797 !! wikitext
14798 start
14799 ==a==
14800 ===aa===
14801 ====aaa====
14802 ==b==
14803 ===ba===
14804 ===bb===
14805 ====bba====
14806 ===bc===
14807 ==c==
14808 ===ca===
14809 !! html
14810 start
14811 ==a==
14812 ===aa===
14813 ====aaa====
14814 ==b==
14815 ===ba===
14816 ===bb===
14817 ====bba====
14818 ===bc===
14819 ==c==
14820 xxx
14821 !! end
14822
14823 !! test
14824 Section replacement test with initial whitespace (bug 13728)
14825 !! options
14826 replace=2,"xxx"
14827 !! wikitext
14828 Preformatted initial line
14829 ==a==
14830 ===a===
14831 !! html
14832 Preformatted initial line
14833 ==a==
14834 xxx
14835 !! end
14836
14837
14838 !! test
14839 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14840 !! options
14841 section=1
14842 !! wikitext
14843 ==a==
14844 a
14845 !! html
14846 ==a==
14847 a
14848 !! end
14849
14850 !! test
14851 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14852 !! options
14853 section=1
14854 !! wikitext
14855 ==a==
14856 a
14857 !! html
14858 ==a==
14859 a
14860 !! end
14861
14862
14863 !! test
14864 Section extraction, <pre> around bogus header (bug 10309)
14865 !! options
14866 noxml section=2
14867 !! wikitext
14868 == Section One ==
14869 <pre>
14870 =======
14871 </pre>
14872
14873 == Section Two ==
14874 stuff
14875 !! html
14876 == Section Two ==
14877 stuff
14878 !! end
14879
14880 !! test
14881 Section replacement, <pre> around bogus header (bug 10309)
14882 !! options
14883 noxml replace=2,"xxx"
14884 !! wikitext
14885 == Section One ==
14886 <pre>
14887 =======
14888 </pre>
14889
14890 == Section Two ==
14891 stuff
14892 !! html
14893 == Section One ==
14894 <pre>
14895 =======
14896 </pre>
14897
14898 xxx
14899 !! end
14900
14901
14902
14903 !! test
14904 Handling of &#x0A; in URLs
14905 !! wikitext
14906 ** irc://&#x0A;a
14907 !! html/php
14908 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14909
14910 !! html/parsoid
14911 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
14912 a">irc://
14913 a</a></li></ul></li></ul>
14914 !! end
14915
14916 !! test
14917 Handling of %0A in URLs
14918 !! wikitext
14919 ** irc://%0Aa
14920 !! html/php
14921 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14922
14923 !! html/parsoid
14924 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14925 !! end
14926
14927
14928 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14929 !! test
14930 5 quotes, code coverage +1 line
14931 !! options
14932 parsoid=wt2html
14933 !! wikitext
14934 '''''
14935 !! html/php
14936 !! html/parsoid
14937 <p><b><i></i></b></p>
14938 !! end
14939
14940 # same html as previous, but wikitext adjusted to match parsoid html2wt
14941 # note that wt2html and html2html will put the <i> before the <b>
14942 !! test
14943 5 quotes, code coverage +1 line w/ nowiki (1)
14944 !! options
14945 parsoid=wt2wt,html2wt
14946 !! wikitext
14947 '''''<nowiki/>'''''
14948 !! html/php
14949 <p><i></i>
14950 </p>
14951 !! html/parsoid
14952 <p><b><i></i></b></p>
14953 !! end
14954
14955 # same as previous, just swapping the <i> and <b>
14956 !! test
14957 5 quotes, code coverage +1 line w/ nowiki (2)
14958 !! wikitext
14959 '''''<nowiki/>'''''
14960 !! html/php
14961 <p><i></i>
14962 </p>
14963 !! html/parsoid
14964 <p><i><b></b></i></p>
14965 !! end
14966
14967 !! test
14968 Special:Search page linking.
14969 !! wikitext
14970 {{Special:search}}
14971 !! html
14972 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14973 </p>
14974 !! end
14975
14976 !! test
14977 Say the magic word
14978 !! options
14979 title=[[Parser test]]
14980 !! wikitext
14981 * {{PAGENAME}}
14982 * {{PAGENAMEE}}
14983 * {{FULLPAGENAME}}
14984 * {{FULLPAGENAMEE}}
14985 * {{BASEPAGENAME}}
14986 * {{BASEPAGENAMEE}}
14987 * {{SUBPAGENAME}}
14988 * {{SUBPAGENAMEE}}
14989 * {{ROOTPAGENAME}}
14990 * {{ROOTPAGENAMEE}}
14991 * {{TALKPAGENAME}}
14992 * {{TALKPAGENAMEE}}
14993 * {{SUBJECTPAGENAME}}
14994 * {{SUBJECTPAGENAMEE}}
14995 * {{NAMESPACEE}}
14996 * {{NAMESPACE}}
14997 * {{NAMESPACENUMBER}}
14998 * {{TALKSPACE}}
14999 * {{TALKSPACEE}}
15000 * {{SUBJECTSPACE}}
15001 * {{SUBJECTSPACEE}}
15002 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15003 !! html
15004 <ul><li> Parser test</li>
15005 <li> Parser_test</li>
15006 <li> Parser test</li>
15007 <li> Parser_test</li>
15008 <li> Parser test</li>
15009 <li> Parser_test</li>
15010 <li> Parser test</li>
15011 <li> Parser_test</li>
15012 <li> Parser test</li>
15013 <li> Parser_test</li>
15014 <li> Talk:Parser test</li>
15015 <li> Talk:Parser_test</li>
15016 <li> Parser test</li>
15017 <li> Parser_test</li>
15018 <li> </li>
15019 <li> </li>
15020 <li> 0</li>
15021 <li> Talk</li>
15022 <li> Talk</li>
15023 <li> </li>
15024 <li> </li>
15025 <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>
15026
15027 !! end
15028 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15029
15030 !! test
15031 Gallery
15032 !! wikitext
15033 <gallery>
15034 image1.png |
15035 image2.gif|||||
15036
15037 image3|
15038 image4 |300px| centre
15039 image5.svg| http://///////
15040 [[x|xx]]]]
15041 * image6
15042 </gallery>
15043 !! html
15044 <ul class="gallery mw-gallery-traditional">
15045 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15046 <div class="thumb" style="height: 150px;">Image1.png</div>
15047 <div class="gallerytext">
15048 </div>
15049 </div></li>
15050 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15051 <div class="thumb" style="height: 150px;">Image2.gif</div>
15052 <div class="gallerytext">
15053 <p>||||
15054 </p>
15055 </div>
15056 </div></li>
15057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15058 <div class="thumb" style="height: 150px;">Image3</div>
15059 <div class="gallerytext">
15060 </div>
15061 </div></li>
15062 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15063 <div class="thumb" style="height: 150px;">Image4</div>
15064 <div class="gallerytext">
15065 <p>300px| centre
15066 </p>
15067 </div>
15068 </div></li>
15069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15070 <div class="thumb" style="height: 150px;">Image5.svg</div>
15071 <div class="gallerytext">
15072 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15073 </p>
15074 </div>
15075 </div></li>
15076 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15077 <div class="thumb" style="height: 150px;">* image6</div>
15078 <div class="gallerytext">
15079 </div>
15080 </div></li>
15081 </ul>
15082
15083 !! end
15084
15085 !! test
15086 Gallery (with options)
15087 !! wikitext
15088 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15089 File:Nonexistant.jpg|caption
15090 File:Nonexistant.jpg
15091 image:foobar.jpg|some '''caption''' [[Main Page]]
15092 image:foobar.jpg
15093 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15094 </gallery>
15095 !! html
15096 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15097 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15098 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15099 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15100 <div class="gallerytext">
15101 <p>caption
15102 </p>
15103 </div>
15104 </div></li>
15105 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15106 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15107 <div class="gallerytext">
15108 </div>
15109 </div></li>
15110 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15111 <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>
15112 <div class="gallerytext">
15113 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15114 </p>
15115 </div>
15116 </div></li>
15117 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15118 <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>
15119 <div class="gallerytext">
15120 </div>
15121 </div></li>
15122 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15123 <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>
15124 <div class="gallerytext">
15125 <p>Blabla|blabla.
15126 </p>
15127 </div>
15128 </div></li>
15129 </ul>
15130
15131 !! end
15132
15133 !! test
15134 Gallery with wikitext inside caption
15135 !! wikitext
15136 <gallery>
15137 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15138 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15139 </gallery>
15140 !! html
15141 <ul class="gallery mw-gallery-traditional">
15142 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15143 <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>
15144 <div class="gallerytext">
15145 <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>
15146 </p>
15147 </div>
15148 </div></li>
15149 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15150 <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>
15151 <div class="gallerytext">
15152 <p>This is a test template
15153 </p>
15154 </div>
15155 </div></li>
15156 </ul>
15157
15158 !! end
15159
15160 !! test
15161 gallery (with showfilename option)
15162 !! wikitext
15163 <gallery showfilename>
15164 File:Nonexistant.jpg|caption
15165 File:Nonexistant.jpg
15166 image:foobar.jpg|some '''caption''' [[Main Page]]
15167 File:Foobar.jpg
15168 </gallery>
15169 !! html
15170 <ul class="gallery mw-gallery-traditional">
15171 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15172 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15173 <div class="gallerytext">
15174 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15175 caption
15176 </p>
15177 </div>
15178 </div></li>
15179 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15180 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15181 <div class="gallerytext">
15182 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15183 </p>
15184 </div>
15185 </div></li>
15186 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15187 <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>
15188 <div class="gallerytext">
15189 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15190 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15191 </p>
15192 </div>
15193 </div></li>
15194 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15195 <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>
15196 <div class="gallerytext">
15197 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15198 </p>
15199 </div>
15200 </div></li>
15201 </ul>
15202
15203 !! end
15204
15205 !! test
15206 Gallery (with namespace-less filenames)
15207 !! wikitext
15208 <gallery>
15209 File:Nonexistant.jpg
15210 Nonexistant.jpg
15211 image:foobar.jpg
15212 foobar.jpg
15213 </gallery>
15214 !! html
15215 <ul class="gallery mw-gallery-traditional">
15216 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15217 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15218 <div class="gallerytext">
15219 </div>
15220 </div></li>
15221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15222 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15223 <div class="gallerytext">
15224 </div>
15225 </div></li>
15226 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15227 <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>
15228 <div class="gallerytext">
15229 </div>
15230 </div></li>
15231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15232 <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>
15233 <div class="gallerytext">
15234 </div>
15235 </div></li>
15236 </ul>
15237
15238 !! end
15239
15240 !! test
15241 HTML Hex character encoding (spells the word "JavaScript")
15242 !! options
15243 parsoid=wt2html,wt2wt,html2html
15244 !! wikitext
15245 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15246 !! html/php
15247 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15248 </p>
15249 !! html/parsoid
15250 <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>
15251 !! end
15252
15253 !! test
15254 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15255 !! wikitext
15256 &#xsee;&#XSEE;
15257 !! html/php
15258 <p>&amp;#xsee;&amp;#XSEE;
15259 </p>
15260 !! html/parsoid
15261 <p>&amp;#xsee;&amp;#XSEE;</p>
15262 !! end
15263
15264 !! test
15265 HTML Hex character encoding mixed case
15266 !! options
15267 parsoid=wt2html,wt2wt,html2html
15268 !! wikitext
15269 &#xEE;&#Xee;
15270 !! html/php
15271 <p>&#xee;&#xee;
15272 </p>
15273 !! html/parsoid
15274 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15275 !! end
15276
15277 !! test
15278 __FORCETOC__ override
15279 !! wikitext
15280 __NEWSECTIONLINK__
15281 __FORCETOC__
15282 !! html
15283 <p><br />
15284 </p>
15285 !! end
15286
15287 !! test
15288 ISBN code coverage
15289 !! wikitext
15290 ISBN 978-0-1234-56&#x20;789
15291 !! html
15292 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15293 </p>
15294 !! end
15295
15296 !! test
15297 ISBN followed by 5 spaces
15298 !! wikitext
15299 ISBN
15300 !! html
15301 <p>ISBN
15302 </p>
15303 !! end
15304
15305 !! test
15306 Double ISBN
15307 !! wikitext
15308 ISBN ISBN 1234567890
15309 !! html
15310 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15311 </p>
15312 !! end
15313
15314 !! test
15315 ISBN with an X
15316 !! wikitext
15317 ISBN 3-462-04561-X
15318 !! html
15319 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15320 </p>
15321 !! end
15322
15323 !! test
15324 ISBN with empty prefix (parsoid test)
15325 !! wikitext
15326 ISBN 1234567890
15327 !! html/parsoid
15328 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15329 !! end
15330
15331 !! test
15332 Bug 22905: <abbr> followed by ISBN followed by </a>
15333 !! wikitext
15334 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15335 !! html
15336 <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>
15337 </p>
15338 !! end
15339
15340 !! test
15341 Double RFC
15342 !! wikitext
15343 RFC RFC 1234
15344 !! html
15345 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15346 </p>
15347 !! end
15348
15349 !! test
15350 Double RFC with a wiki link
15351 !! wikitext
15352 RFC [[RFC 1234]]
15353 !! html
15354 <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>
15355 </p>
15356 !! end
15357
15358 !! test
15359 RFC code coverage
15360 !! wikitext
15361 RFC 983&#x20;987
15362 !! html
15363 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15364 </p>
15365 !! end
15366
15367 !! test
15368 Centre-aligned image
15369 !! wikitext
15370 [[Image:foobar.jpg|centre]]
15371 !! html
15372 <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>
15373
15374 !!end
15375
15376 !! test
15377 None-aligned image
15378 !! wikitext
15379 [[Image:foobar.jpg|none]]
15380 !! html
15381 <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>
15382
15383 !!end
15384
15385 !! test
15386 Width + Height sized image (using px) (height is ignored)
15387 !! wikitext
15388 [[Image:foobar.jpg|640x480px]]
15389 !! html
15390 <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>
15391 </p>
15392 !!end
15393
15394 !! test
15395 Width-sized image (using px, no following whitespace)
15396 !! wikitext
15397 [[Image:foobar.jpg|640px]]
15398 !! html
15399 <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>
15400 </p>
15401 !!end
15402
15403 !! test
15404 Width-sized image (using px, with following whitespace - test regression from r39467)
15405 !! wikitext
15406 [[Image:foobar.jpg|640px ]]
15407 !! html
15408 <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>
15409 </p>
15410 !!end
15411
15412 !! test
15413 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15414 !! wikitext
15415 [[Image:foobar.jpg| 640px]]
15416 !! html
15417 <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>
15418 </p>
15419 !!end
15420
15421 !! test
15422 Image with page parameter
15423 !! options
15424 djvu
15425 !! wikitext
15426 [[File:LoremIpsum.djvu|page=2]]
15427 !! html
15428 <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>
15429 </p>
15430 !! end
15431
15432 !! test
15433 Another italics / bold test
15434 !! wikitext
15435 ''' ''x'
15436 !! html
15437 <pre>'<i> </i>x'
15438 </pre>
15439 !!end
15440
15441 # Note the results may be incorrect, as parserTest output included this:
15442 # XML error: Mismatched tag at byte 6120:
15443 # ...<dd> </dt></dl> </dd...
15444 !! test
15445 dt/dd/dl test
15446 !! options
15447 disabled
15448 !! wikitext
15449 :;;;::
15450 !! html
15451 <dl>
15452 <dd><dl>
15453 <dt><dl>
15454 <dt><dl>
15455 <dt><dl>
15456 <dd><dl>
15457 <dd>
15458 </dd>
15459 </dl>
15460 </dd>
15461 </dl>
15462 </dt>
15463 </dl>
15464 </dt>
15465 </dl>
15466 </dt>
15467 </dl>
15468 </dd>
15469 </dl>
15470
15471 !!end
15472
15473
15474 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15475 !! test
15476 Images with the "|" character in the comment
15477 !! wikitext
15478 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15479 !! html/php
15480 <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>
15481
15482 !! html/parsoid
15483 <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>
15484 !! end
15485
15486 !! test
15487 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15488 !! wikitext
15489 <html><script>alert(1);</script></html>
15490 !! html
15491 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15492 </p>
15493 !! end
15494
15495 !! test
15496 HTML with raw HTML ($wgRawHtml==true)
15497 !! options
15498 wgRawHtml=1
15499 !! wikitext
15500 <html><script>alert(1);</script></html>
15501 !! html
15502 <p><script>alert(1);</script>
15503 </p>
15504 !! end
15505
15506 !! test
15507 Parents of subpages, one level up
15508 !! options
15509 subpage title=[[Subpage test/L1/L2/L3]]
15510 !! wikitext
15511 [[../|L2]]
15512 !! html
15513 <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>
15514 </p>
15515 !! end
15516
15517
15518 !! test
15519 Parents of subpages, one level up, not named
15520 !! options
15521 subpage title=[[Subpage test/L1/L2/L3]]
15522 !! wikitext
15523 [[../]]
15524 !! html
15525 <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>
15526 </p>
15527 !! end
15528
15529
15530
15531 !! test
15532 Parents of subpages, two levels up
15533 !! options
15534 subpage title=[[Subpage test/L1/L2/L3]]
15535 !! wikitext
15536 [[../../|L1]]2
15537
15538 [[../../|L1]]l
15539 !! html
15540 <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
15541 </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>
15542 </p>
15543 !! end
15544
15545 !! test
15546 Parents of subpages, two levels up, without trailing slash or name.
15547 !! options
15548 subpage title=[[Subpage test/L1/L2/L3]]
15549 !! wikitext
15550 [[../..]]
15551 !! html
15552 <p>[[../..]]
15553 </p>
15554 !! end
15555
15556 !! test
15557 Parents of subpages, two levels up, with lots of extra trailing slashes.
15558 !! options
15559 subpage title=[[Subpage test/L1/L2/L3]]
15560 !! wikitext
15561 [[../../////]]
15562 !! html
15563 <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>
15564 </p>
15565 !! end
15566
15567 !! article
15568 Subpage test/L1/L2/L3Sibling
15569 !! text
15570 Sibling article
15571 !! endarticle
15572
15573 !! test
15574 Transclusion of a sibling page (one level up)
15575 !! options
15576 subpage title=[[Subpage test/L1/L2/L3]]
15577 !! wikitext
15578 {{../L3Sibling}}
15579 !! html
15580 <p>Sibling article
15581 </p>
15582 !! end
15583
15584 !! test
15585 Transclusion of a child page
15586 !! options
15587 subpage title=[[Subpage test/L1/L2]]
15588 !! wikitext
15589 {{/L3Sibling}}
15590 !! html
15591 <p>Sibling article
15592 </p>
15593 !! end
15594
15595 !! test
15596 Non-transclusion because of too many up levels
15597 !! options
15598 subpage title=[[Subpage test/L1/L2/L3]]
15599 !! wikitext
15600 {{../../../../More than parent}}
15601 !! html
15602 <p>{{../../../../More than parent}}
15603 </p>
15604 !! end
15605
15606 !! test
15607 Definition list code coverage
15608 !! wikitext
15609 ; title : def
15610 ; title : def
15611 ;title: def
15612 !! html
15613 <dl><dt> title &#160;</dt>
15614 <dd> def</dd>
15615 <dt> title&#160;</dt>
15616 <dd> def</dd>
15617 <dt>title</dt>
15618 <dd> def</dd></dl>
15619
15620 !! end
15621
15622 !! test
15623 Don't fall for the self-closing div
15624 !! wikitext
15625 <div>hello world</div/>
15626 !! html
15627 <div>hello world</div>
15628
15629 !! end
15630
15631 !! test
15632 MSGNW magic word
15633 !! wikitext
15634 {{MSGNW:msg}}
15635 !! html
15636 <p>&#91;&#91;:Template:Msg&#93;&#93;
15637 </p>
15638 !! end
15639
15640 !! test
15641 RAW magic word
15642 !! wikitext
15643 {{RAW:QUERTY}}
15644 !! html
15645 <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>
15646 </p>
15647 !! end
15648
15649 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15650 !! test
15651 Always escape literal '>' in output, not just after '<'
15652 !! wikitext
15653 ><>
15654 !! html
15655 <p>&gt;&lt;&gt;
15656 </p>
15657 !! end
15658
15659 !! test
15660 Template caching
15661 !! wikitext
15662 {{Test}}
15663 {{Test}}
15664 !! html
15665 <p>This is a test template
15666 This is a test template
15667 </p>
15668 !! end
15669
15670
15671 !! article
15672 MediaWiki:Fake
15673 !! text
15674 ==header==
15675 !! endarticle
15676
15677 !! test
15678 Inclusion of !userCanEdit() content
15679 !! wikitext
15680 {{MediaWiki:Fake}}
15681 !! html
15682 <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>
15683
15684 !! end
15685
15686
15687 !! test
15688 Out-of-order TOC heading levels
15689 !! wikitext
15690 ==2==
15691 ======6======
15692 ===3===
15693 =1=
15694 =====5=====
15695 ==2==
15696 !! html
15697 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15698 <ul>
15699 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15700 <ul>
15701 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15702 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15703 </ul>
15704 </li>
15705 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15706 <ul>
15707 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15708 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15709 </ul>
15710 </li>
15711 </ul>
15712 </div>
15713
15714 <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>
15715 <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>
15716 <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>
15717 <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>
15718 <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>
15719 <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>
15720
15721 !! end
15722
15723
15724 !! test
15725 ISBN with a dummy number
15726 !! wikitext
15727 ISBN ---
15728 !! html
15729 <p>ISBN ---
15730 </p>
15731 !! end
15732
15733
15734 !! test
15735 ISBN with space-delimited number
15736 !! wikitext
15737 ISBN 92 9017 032 8
15738 !! html
15739 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15740 </p>
15741 !! end
15742
15743
15744 !! test
15745 ISBN with multiple spaces, no number
15746 !! wikitext
15747 ISBN foo
15748 !! html
15749 <p>ISBN foo
15750 </p>
15751 !! end
15752
15753
15754 !! test
15755 ISBN length
15756 !! wikitext
15757 ISBN 123456789
15758
15759 ISBN 1234567890
15760
15761 ISBN 12345678901
15762 !! html
15763 <p>ISBN 123456789
15764 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15765 </p><p>ISBN 12345678901
15766 </p>
15767 !! end
15768
15769
15770 !! test
15771 ISBN with trailing year (bug 8110)
15772 !! wikitext
15773 ISBN 1-234-56789-0 - 2006
15774
15775 ISBN 1 234 56789 0 - 2006
15776 !! html
15777 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15778 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15779 </p>
15780 !! end
15781
15782
15783 !! test
15784 anchorencode
15785 !! wikitext
15786 {{anchorencode:foo bar©#%n}}
15787 !! html
15788 <p>foo_bar.C2.A9.23.25n
15789 </p>
15790 !! end
15791
15792 !! test
15793 anchorencode trims spaces
15794 !! wikitext
15795 {{anchorencode: __pretty__please__}}
15796 !! html
15797 <p>pretty_please
15798 </p>
15799 !! end
15800
15801 !! test
15802 anchorencode deals with links
15803 !! wikitext
15804 {{anchorencode: [[hello|world]] [[hi]]}}
15805 !! html
15806 <p>world_hi
15807 </p>
15808 !! end
15809
15810 !! test
15811 anchorencode deals with templates
15812 !! wikitext
15813 {{anchorencode: {{Foo}} }}
15814 !! html
15815 <p>FOO
15816 </p>
15817 !! end
15818
15819 !! test
15820 anchorencode encodes like the TOC generator: (bug 18431)
15821 !! wikitext
15822 === _ +:.3A%3A&&amp;]] ===
15823 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15824 __NOEDITSECTION__
15825 !! html
15826 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15827 <p>.2B:.3A.253A.26.26.5D.5D
15828 </p>
15829 !! end
15830
15831 !! test
15832 Bug 6200: blockquotes and paragraph formatting
15833 !! wikitext
15834 <blockquote>
15835 foo
15836 </blockquote>
15837
15838 bar
15839
15840 baz
15841 !! html
15842 <blockquote>
15843 <p>foo
15844 </p>
15845 </blockquote>
15846 <p>bar
15847 </p>
15848 <pre>baz
15849 </pre>
15850 !! end
15851
15852 !! test
15853 Bug 8293: Use of center tag ruins paragraph formatting
15854 !! wikitext
15855 <center>
15856 foo
15857 </center>
15858
15859 bar
15860
15861 baz
15862 !! html
15863 <center>
15864 <p>foo
15865 </p>
15866 </center>
15867 <p>bar
15868 </p>
15869 <pre>baz
15870 </pre>
15871 !! end
15872
15873 !!test
15874 Parsing of overlapping (improperly nested) inline html tags
15875 !! wikitext
15876 <span><s>x</span></s>
15877 !! html/php
15878 <p><span><s>x&lt;/span&gt;</s></span>
15879 </p>
15880 !! html/parsoid
15881 <p><span><s>x</s></span>
15882 </p>
15883 !!end
15884
15885 ###
15886 ### Language variants related tests
15887 ###
15888 !! test
15889 Self-link in language variants
15890 !! options
15891 title=[[Dunav]] language=sr
15892 !! wikitext
15893 Both [[Dunav]] and [[Дунав]] are names for this river.
15894 !! html
15895 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15896 </p>
15897 !!end
15898
15899 !! article
15900 Дуна
15901 !! text
15902 content
15903 !! endarticle
15904
15905 !! test
15906 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15907 !! options
15908 title=[[Duna]] language=sr
15909 !! wikitext
15910 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15911 !! html
15912 <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.
15913 </p>
15914 !! end
15915
15916 !! test
15917 Link to a section of a variant of this title shouldn't be parsed as self-link
15918 !! options
15919 title=[[Duna]] language=sr
15920 !! wikitext
15921 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15922 !! html
15923 <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.
15924 </p>
15925 !! end
15926
15927 !! test
15928 Link to pages in language variants
15929 !! options
15930 language=sr
15931 !! wikitext
15932 Main Page can be written as [[Маин Паге]]
15933 !! html
15934 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15935 </p>
15936 !!end
15937
15938
15939 !! test
15940 Multiple links to pages in language variants
15941 !! options
15942 language=sr
15943 !! wikitext
15944 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15945 !! html
15946 <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>.
15947 </p>
15948 !!end
15949
15950
15951 !! test
15952 Simple template in language variants
15953 !! options
15954 language=sr
15955 !! wikitext
15956 {{тест}}
15957 !! html
15958 <p>This is a test template
15959 </p>
15960 !! end
15961
15962
15963 !! test
15964 Template with explicit namespace in language variants
15965 !! options
15966 language=sr
15967 !! wikitext
15968 {{Template:тест}}
15969 !! html
15970 <p>This is a test template
15971 </p>
15972 !! end
15973
15974
15975 !! test
15976 Basic test for template parameter in language variants
15977 !! options
15978 language=sr
15979 !! wikitext
15980 {{парамтест|param=foo}}
15981 !! html
15982 <p>This is a test template with parameter foo
15983 </p>
15984 !! end
15985
15986
15987 !! test
15988 Simple category in language variants
15989 !! options
15990 language=sr cat
15991 !! wikitext
15992 [[Category:МедиаWики Усер'с Гуиде]]
15993 !! html
15994 <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>
15995 !! end
15996
15997
15998 !! article
15999 Category:分类
16000 !! text
16001 blah
16002 !! endarticle
16003
16004 !! article
16005 Category:分類
16006 !! text
16007 blah
16008 !! endarticle
16009
16010 !! test
16011 Don't convert blue categorylinks to another variant (bug 33210)
16012 !! options
16013 language=zh cat
16014 !! wikitext
16015 [[A]][[Category:分类]]
16016 !! html
16017 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16018 !! end
16019
16020
16021 !! test
16022 Stripping -{}- tags (language variants)
16023 !! options
16024 language=sr
16025 !! wikitext
16026 Latin proverb: -{Ne nuntium necare}-
16027 !! html
16028 <p>Latin proverb: Ne nuntium necare
16029 </p>
16030 !! end
16031
16032
16033 !! test
16034 Prevent conversion with -{}- tags (language variants)
16035 !! options
16036 language=sr variant=sr-ec
16037 !! wikitext
16038 Latinski: -{Ne nuntium necare}-
16039 !! html
16040 <p>Латински: Ne nuntium necare
16041 </p>
16042 !! end
16043
16044
16045 !! test
16046 Prevent conversion of text with -{}- tags (language variants)
16047 !! options
16048 language=sr variant=sr-ec
16049 !! wikitext
16050 Latinski: -{Ne nuntium necare}-
16051 !! html
16052 <p>Латински: Ne nuntium necare
16053 </p>
16054 !! end
16055
16056
16057 !! test
16058 Prevent conversion of links with -{}- tags (language variants)
16059 !! options
16060 language=sr variant=sr-ec
16061 !! wikitext
16062 -{[[Main Page]]}-
16063 !! html
16064 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16065 </p>
16066 !! end
16067
16068
16069 !! test
16070 -{}- tags within headlines (within html for parserConvert())
16071 !! options
16072 language=sr variant=sr-ec
16073 !! wikitext
16074 == -{Naslov}- ==
16075 !! html
16076 <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>
16077
16078 !! end
16079
16080
16081 !! test
16082 Explicit definition of language variant alternatives
16083 !! options
16084 language=zh variant=zh-tw
16085 !! wikitext
16086 -{zh:China;zh-tw:Taiwan}-, not China
16087 !! html
16088 <p>Taiwan, not China
16089 </p>
16090 !! end
16091
16092
16093 !! test
16094 Conversion around HTML tags
16095 !! options
16096 language=sr variant=sr-ec
16097 !! wikitext
16098 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16099 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16100 !! html
16101 <p>
16102 <span title="ЛаCтин">ски</span>
16103 </p>
16104 !! end
16105
16106
16107 !! test
16108 Explicit session-wise language variant mapping (A flag and - flag)
16109 !! options
16110 language=zh variant=zh-tw
16111 !! wikitext
16112 Taiwan is not China.
16113 But -{A|zh:China;zh-tw:Taiwan}- is China,
16114 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16115 and -{China}- is China.
16116 !! html
16117 <p>Taiwan is not China.
16118 But Taiwan is Taiwan,
16119 (This should be stripped!)
16120 and China is China.
16121 </p>
16122 !! end
16123
16124 !! test
16125 Explicit session-wise language variant mapping (H flag for hide)
16126 !! options
16127 language=zh variant=zh-tw
16128 !! wikitext
16129 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16130 Taiwan is China.
16131 !! html
16132 <p>(This should be stripped!)
16133 Taiwan is Taiwan.
16134 </p>
16135 !! end
16136
16137 !! test
16138 Adding explicit conversion rule for title (T flag)
16139 !! options
16140 language=zh variant=zh-tw showtitle
16141 !! wikitext
16142 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16143 !! html
16144 Taiwan
16145 <p>Should be stripped!
16146 </p>
16147 !! end
16148
16149 !! test
16150 Testing that changing the language variant here in the tests actually works
16151 !! options
16152 language=zh variant=zh showtitle
16153 !! wikitext
16154 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16155 !! html
16156 China
16157 <p>Should be stripped!
16158 </p>
16159 !! end
16160
16161 !! test
16162 Recursive conversion of alt and title attrs shouldn't clear converter state
16163 !! options
16164 language=zh variant=zh-cn showtitle
16165 !! wikitext
16166 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16167 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16168 !! html
16169 China
16170 <p>
16171 Should be stripped<span title="Exclamation">!</span>
16172 </p>
16173 !! end
16174
16175 !! test
16176 Bug 24072: more test on conversion rule for title
16177 !! options
16178 language=zh variant=zh-tw showtitle
16179 !! wikitext
16180 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16181 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16182 !! html
16183 Taiwan
16184 <p>This should be stripped!
16185 This won't take interferes with the title rule.
16186 </p>
16187 !! end
16188
16189 !! test
16190 Partly disable title conversion if variant == main language code
16191 !! options
16192 language=zh variant=zh title=[[ZH]] showtitle
16193 !! wikitext
16194 -{T|zh-cn:CN;zh-tw:TW}-
16195 !! html
16196 ZH
16197 <p>
16198 </p>
16199 !! end
16200
16201 !! test
16202 Partly disable title conversion if variant == main language code, more
16203 !! options
16204 language=zh variant=zh title=[[ZH]] showtitle
16205 !! wikitext
16206 -{T|TW}-
16207 !! html
16208 ZH
16209 <p>
16210 </p>
16211 !! end
16212
16213 !! test
16214 Raw output of variant escape tags (R flag)
16215 !! options
16216 language=zh variant=zh-tw
16217 !! wikitext
16218 Raw: -{R|zh:China;zh-tw:Taiwan}-
16219 !! html
16220 <p>Raw: zh:China;zh-tw:Taiwan
16221 </p>
16222 !! end
16223
16224 !! test
16225 Nested using of manual convert syntax
16226 !! options
16227 language=zh variant=zh-hk
16228 !! wikitext
16229 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16230 !! html
16231 <p>Nested: Hello Hong Kong!
16232 </p>
16233 !! end
16234
16235 !! test
16236 Proper conversion of text in external links
16237 !! options
16238 language=sr variant=sr-ec
16239 !! wikitext
16240 http://www.google.com
16241 gopher://www.google.com
16242 [http://www.google.com http://www.google.com]
16243 [gopher://www.google.com gopher://www.google.com]
16244 [https://www.google.com irc://www.google.com]
16245 [ftp://www.google.com www.google.com/ftp://dir]
16246 [//www.google.com www.google.com]
16247 !! html
16248 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16249 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16250 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16251 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16252 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16253 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16254 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16255 </p>
16256 !! end
16257
16258 !! test
16259 Do not convert roman numbers to language variants
16260 !! options
16261 language=sr variant=sr-ec
16262 !! wikitext
16263 Fridrih IV je car.
16264 !! html
16265 <p>Фридрих IV је цар.
16266 </p>
16267 !! end
16268
16269 !! test
16270 Unclosed language converter markup "-{"
16271 !! options
16272 language=sr
16273 !! wikitext
16274 -{T|hello
16275 !! html
16276 <p>-{T|hello
16277 </p>
16278 !! end
16279
16280 !! test
16281 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16282 !! options
16283 language=sr
16284 !! wikitext
16285 -{R|=&gt;}-
16286 !! html
16287 <p>=&gt;
16288 </p>
16289 !!end
16290
16291 !! test
16292 Don't break link parsing if language converter markup is in the caption.
16293 !! options
16294 language=sr variant=sr-ec
16295 !! wikitext
16296 [[Main Page|-{R|main page}-]]
16297 !! html
16298 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16299 </p>
16300 !! end
16301
16302 # This test is currently broken in the PHP parser (bug 52661)
16303 !! test
16304 Don't break image parsing if language converter markup is in the caption.
16305 !! options
16306 language=sr
16307 disabled
16308 !! wikitext
16309 [[File:Foobar.jpg|-{R|caption}-]]
16310 !! html
16311 <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>
16312 </p>
16313 !! end
16314
16315 # This test is currently broken in the PHP parser (bug 52661)
16316 !! test
16317 Don't break list handling if language converter markup is in the item.
16318 !! options
16319 language=zh variant=zh-cn
16320 disabled
16321 !! wikitext
16322 ;-{zh-cn:AAA;zh-tw:BBB}-
16323 !! html
16324 <dl><dt>AAA
16325 </dt></dl>
16326
16327 !! end
16328
16329 # This test is currently broken in the PHP parser (bug 52661)
16330 !! test
16331 Don't break table handling if language converter markup is in the cell.
16332 !! options
16333 language=sr variant=sr-ec
16334 disabled
16335 !! wikitext
16336 {|
16337 |-
16338 | -{R|B}-
16339 |}
16340 !! html
16341 <table>
16342
16343 <tr>
16344 <td> B
16345 </td></tr></table>
16346
16347 !! end
16348
16349 !! test
16350 Bug 529: Uncovered bullet
16351 !! wikitext
16352 * Foo {{bullet}}
16353 !! html
16354 <ul><li> Foo </li>
16355 <li> Bar</li></ul>
16356
16357 !! end
16358
16359 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16360 # Templates in Wikipedia rely on this behavior, as tidy has always been
16361 # enabled there. These tests are normally run *without* tidy, so specify the
16362 # full output here.
16363 # To test realistic parsing behavior, apply a tidy-like transformation to both
16364 # the expected output and your parser's output.
16365 !! test
16366 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16367 !! wikitext
16368 ******* Foo {{bullet}}
16369 !! html
16370 <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>
16371 <li> Bar</li></ul>
16372
16373 !! end
16374
16375 !! test
16376 Bug 529: Uncovered table already at line-start
16377 !! wikitext
16378 x
16379
16380 {{table}}
16381 y
16382 !! html
16383 <p>x
16384 </p>
16385 <table>
16386 <tr>
16387 <td> 1 </td>
16388 <td> 2
16389 </td></tr>
16390 <tr>
16391 <td> 3 </td>
16392 <td> 4
16393 </td></tr></table>
16394 <p>y
16395 </p>
16396 !! end
16397
16398 !! test
16399 Bug 529: Uncovered bullet in parser function result
16400 !! wikitext
16401 * Foo {{lc:{{bullet}} }}
16402 !! html
16403 <ul><li> Foo </li>
16404 <li> bar</li></ul>
16405
16406 !! end
16407
16408 !! test
16409 Bug 5678: Double-parsed template argument
16410 !! wikitext
16411 {{lc:{{{1}}}|hello}}
16412 !! html
16413 <p>{{{1}}}
16414 </p>
16415 !! end
16416
16417 !! test
16418 Bug 5678: Double-parsed template invocation
16419 !! wikitext
16420 {{lc:{{paramtest {{!}} param = hello }} }}
16421 !! html
16422 <p>{{paramtest | param = hello }}
16423 </p>
16424 !! end
16425
16426 !! test
16427 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16428 !! options
16429 language=cs
16430 title=[[Main Page]]
16431 !! wikitext
16432 {{PRVNÍVELKÉ:ěščř}}
16433 {{prvnívelké:ěščř}}
16434 {{PRVNÍMALÉ:ěščř}}
16435 {{prvnímalé:ěščř}}
16436 {{MALÁ:ěščř}}
16437 {{malá:ěščř}}
16438 {{VELKÁ:ěščř}}
16439 {{velká:ěščř}}
16440 !! html
16441 <p>Ěščř
16442 Ěščř
16443 ěščř
16444 ěščř
16445 ěščř
16446 ěščř
16447 ĚŠČŘ
16448 ĚŠČŘ
16449 </p>
16450 !! end
16451
16452 !! test
16453 Morwen/13: Unclosed link followed by heading
16454 !! wikitext
16455 [[link
16456 ==heading==
16457 !! html
16458 <p>[[link
16459 </p>
16460 <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>
16461
16462 !! end
16463
16464 !! test
16465 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16466 !! wikitext
16467 {{foo|
16468 =heading=
16469 !! html
16470 <p>{{foo|
16471 </p>
16472 <h1><span class="mw-headline" id="heading">heading</span></h1>
16473
16474 !! end
16475
16476 !! test
16477 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16478 !! wikitext
16479 {{foo|
16480 ==heading==
16481 !! html
16482 <p>{{foo|
16483 </p>
16484 <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>
16485
16486 !! end
16487
16488 !! test
16489 Tildes in comments
16490 !! options
16491 pst
16492 !! wikitext
16493 <!-- ~~~~ -->
16494 !! html
16495 <!-- ~~~~ -->
16496 !! end
16497
16498 !! test
16499 Paragraphs inside divs (no extra line breaks)
16500 !! wikitext
16501 <div>Line one
16502
16503 Line two</div>
16504 !! html
16505 <div>Line one
16506 Line two</div>
16507
16508 !! end
16509
16510 !! test
16511 Paragraphs inside divs (extra line break on open)
16512 !! wikitext
16513 <div>
16514 Line one
16515
16516 Line two</div>
16517 !! html
16518 <div>
16519 <p>Line one
16520 </p>
16521 Line two</div>
16522
16523 !! end
16524
16525 !! test
16526 Paragraphs inside divs (extra line break on close)
16527 !! wikitext
16528 <div>Line one
16529
16530 Line two
16531 </div>
16532 !! html
16533 <div>Line one
16534 <p>Line two
16535 </p>
16536 </div>
16537
16538 !! end
16539
16540 !! test
16541 Paragraphs inside divs (extra line break on open and close)
16542 !! wikitext
16543 <div>
16544 Line one
16545
16546 Line two
16547 </div>
16548 !! html
16549 <div>
16550 <p>Line one
16551 </p><p>Line two
16552 </p>
16553 </div>
16554
16555 !! end
16556
16557 !! test
16558 Nesting tags, paragraphs on lines which begin with <div>
16559 !! options
16560 disabled
16561 !! wikitext
16562 <div></div><strong>A
16563 B</strong>
16564 !! html
16565 <div></div>
16566 <p><strong>A
16567 B</strong>
16568 </p>
16569 !! end
16570
16571 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16572 !! test
16573 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16574 !! wikitext
16575 <blockquote>Line one
16576
16577 Line two</blockquote>
16578 !! html
16579 <blockquote>Line one
16580 Line two</blockquote>
16581
16582 !! end
16583
16584 !! test
16585 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16586 !! wikitext
16587 <blockquote>
16588 Line one
16589
16590 Line two</blockquote>
16591 !! html
16592 <blockquote>
16593 <p>Line one
16594 </p>
16595 Line two</blockquote>
16596
16597 !! end
16598
16599 !! test
16600 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16601 !! wikitext
16602 <blockquote>Line one
16603
16604 Line two
16605 </blockquote>
16606 !! html
16607 <blockquote>Line one
16608 <p>Line two
16609 </p>
16610 </blockquote>
16611
16612 !! end
16613
16614 !! test
16615 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16616 !! wikitext
16617 <blockquote>
16618 Line one
16619
16620 Line two
16621 </blockquote>
16622 !! html
16623 <blockquote>
16624 <p>Line one
16625 </p><p>Line two
16626 </p>
16627 </blockquote>
16628
16629 !! end
16630
16631 !! test
16632 Paragraphs inside blockquotes/divs (no extra line breaks)
16633 !! wikitext
16634 <blockquote><div>Line one
16635
16636 Line two</div></blockquote>
16637 !! html
16638 <blockquote><div>Line one
16639 Line two</div></blockquote>
16640
16641 !! end
16642
16643 !! test
16644 Paragraphs inside blockquotes/divs (extra line break on open)
16645 !! wikitext
16646 <blockquote><div>
16647 Line one
16648
16649 Line two</div></blockquote>
16650 !! html
16651 <blockquote><div>
16652 <p>Line one
16653 </p>
16654 Line two</div></blockquote>
16655
16656 !! end
16657
16658 !! test
16659 Paragraphs inside blockquotes/divs (extra line break on close)
16660 !! wikitext
16661 <blockquote><div>Line one
16662
16663 Line two
16664 </div></blockquote>
16665 !! html
16666 <blockquote><div>Line one
16667 <p>Line two
16668 </p>
16669 </div></blockquote>
16670
16671 !! end
16672
16673 !! test
16674 Paragraphs inside blockquotes/divs (extra line break on open and close)
16675 !! wikitext
16676 <blockquote><div>
16677 Line one
16678
16679 Line two
16680 </div></blockquote>
16681 !! html
16682 <blockquote><div>
16683 <p>Line one
16684 </p><p>Line two
16685 </p>
16686 </div></blockquote>
16687
16688 !! end
16689
16690 !! test
16691 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16692 !! options
16693 wgLinkHolderBatchSize=0
16694 !! wikitext
16695 [[meatball:1]]
16696 [[meatball:2]]
16697 [[meatball:3]]
16698 !! html
16699 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16700 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16701 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16702 </p>
16703 !! end
16704
16705 !! test
16706 Free external link invading image caption
16707 !! wikitext
16708 [[Image:Foobar.jpg|thumb|http://x|hello]]
16709 !! html
16710 <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>
16711
16712 !! end
16713
16714 !! test
16715 Bug 15196: localised external link numbers
16716 !! options
16717 language=fa
16718 !! wikitext
16719 [http://en.wikipedia.org/]
16720 !! html/php
16721 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16722 </p>
16723 !! html/parsoid
16724 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16725 !! end
16726
16727 !! test
16728 Multibyte character in padleft
16729 !! wikitext
16730 {{padleft:-Hello|7|Æ}}
16731 !! html
16732 <p>Æ-Hello
16733 </p>
16734 !! end
16735
16736 !! test
16737 Multibyte character in padright
16738 !! wikitext
16739 {{padright:Hello-|7|Æ}}
16740 !! html
16741 <p>Hello-Æ
16742 </p>
16743 !! end
16744
16745 !!test
16746 formatdate parser function
16747 !! wikitext
16748 {{#formatdate:2009-03-24}}
16749 !! html
16750 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16751 </p>
16752 !! end
16753
16754 !!test
16755 formatdate parser function, with default format
16756 !! wikitext
16757 {{#formatdate:2009-03-24|mdy}}
16758 !! html
16759 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16760 </p>
16761 !! end
16762
16763 !! test
16764 Spacing of numbers in formatted dates
16765 !! wikitext
16766 {{#formatdate:January 15}}
16767 !! html
16768 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16769 </p>
16770 !! end
16771
16772 !! test
16773 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
16774 !! options
16775 language=nl title=[[MediaWiki:Common.css]]
16776 !! wikitext
16777 {{#formatdate:2009-03-24|dmy}}
16778 !! html
16779 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16780 </p>
16781 !! end
16782
16783 #
16784 #
16785 #
16786
16787 #
16788 # Edit comments
16789 #
16790
16791 !! test
16792 Edit comment with link
16793 !! options
16794 comment
16795 !! wikitext
16796 I like the [[Main Page]] a lot
16797 !! html
16798 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16799 !!end
16800
16801 !! test
16802 Edit comment with link and link text
16803 !! options
16804 comment
16805 !! wikitext
16806 I like the [[Main Page|best pages]] a lot
16807 !! html
16808 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16809 !!end
16810
16811 !! test
16812 Edit comment with link and link text with suffix
16813 !! options
16814 comment
16815 !! wikitext
16816 I like the [[Main Page|best page]]s a lot
16817 !! html
16818 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16819 !!end
16820
16821 !! test
16822 Edit comment with section link (non-local, eg in history list)
16823 !! options
16824 comment title=[[Main Page]]
16825 !! wikitext
16826 /* External links */ removed bogus entries
16827 !! html
16828 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16829 !!end
16830
16831 !! test
16832 Edit comment with section link and text before it (non-local, eg in history list)
16833 !! options
16834 comment title=[[Main Page]]
16835 !! wikitext
16836 pre-comment text /* External links */ removed bogus entries
16837 !! html
16838 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>
16839 !!end
16840
16841 !! test
16842 Edit comment with section link (local, eg in diff view)
16843 !! options
16844 comment local title=[[Main Page]]
16845 !! wikitext
16846 /* External links */ removed bogus entries
16847 !! html
16848 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16849 !!end
16850
16851 !! test
16852 Edit comment with subpage link (bug 14080)
16853 !! options
16854 comment
16855 subpage
16856 title=[[Subpage test]]
16857 !! wikitext
16858 Poked at a [[/subpage]] here...
16859 !! html
16860 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16861 !!end
16862
16863 !! test
16864 Edit comment with subpage link and link text (bug 14080)
16865 !! options
16866 comment
16867 subpage
16868 title=[[Subpage test]]
16869 !! wikitext
16870 Poked at a [[/subpage|neat little page]] here...
16871 !! html
16872 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16873 !!end
16874
16875 !! test
16876 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16877 !! options
16878 comment
16879 title=[[Subpage test]]
16880 !! wikitext
16881 Poked at a [[/subpage]] here...
16882 !! html
16883 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...
16884 !!end
16885
16886 !! test
16887 Edit comment with bare anchor link (local, as on diff)
16888 !! options
16889 comment
16890 local
16891 title=[[Main Page]]
16892 !! wikitext
16893 [[#section]]
16894 !! html
16895 <a href="#section">#section</a>
16896 !! end
16897
16898 !! test
16899 Edit comment with bare anchor link (non-local, as on history)
16900 !! options
16901 comment
16902 title=[[Main Page]]
16903 !! wikitext
16904 [[#section]]
16905 !! html
16906 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16907 !! end
16908
16909 !! test
16910 Anchor starting with underscore
16911 !! wikitext
16912 [[#_ref|One]]
16913 !! html
16914 <p><a href="#_ref">One</a>
16915 </p>
16916 !! end
16917
16918 !! test
16919 Id starting with underscore
16920 !! wikitext
16921 <div id="_ref"></div>
16922 !! html
16923 <div id="_ref"></div>
16924
16925 !! end
16926
16927 !! test
16928 Space normalisation on autocomment (bug 22784)
16929 !! options
16930 comment
16931 title=[[Main Page]]
16932 !! wikitext
16933 /* __hello__world__ */
16934 !! html
16935 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16936 !! end
16937
16938 !! test
16939 percent-encoding and + signs in comments (Bug 26410)
16940 !! options
16941 comment
16942 !! wikitext
16943 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16944 !! html
16945 <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>
16946 !! end
16947
16948 !! test
16949 Bad images - basic functionality
16950 !! options
16951 disabled
16952 !! wikitext
16953 [[File:Bad.jpg]]
16954 !! html
16955 !! end
16956
16957 !! test
16958 Bad images - bug 16039: text after bad image disappears
16959 !! options
16960 disabled
16961 !! wikitext
16962 Foo bar
16963 [[File:Bad.jpg]]
16964 Bar foo
16965 !! html
16966 <p>Foo bar
16967 </p><p>Bar foo
16968 </p>
16969 !! end
16970
16971 !! test
16972 Verify that displaytitle works (bug #22501) no displaytitle
16973 !! options
16974 showtitle
16975 !! config
16976 wgAllowDisplayTitle=true
16977 wgRestrictDisplayTitle=false
16978 !! wikitext
16979 this is not the the title
16980 !! html
16981 Parser test
16982 <p>this is not the the title
16983 </p>
16984 !! end
16985
16986 !! test
16987 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16988 !! options
16989 showtitle
16990 title=[[Screen]]
16991 !! config
16992 wgAllowDisplayTitle=true
16993 wgRestrictDisplayTitle=false
16994 !! wikitext
16995 this is not the the title
16996 {{DISPLAYTITLE:whatever}}
16997 !! html
16998 whatever
16999 <p>this is not the the title
17000 </p>
17001 !! end
17002
17003 !! test
17004 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17005 !! options
17006 showtitle
17007 title=[[Screen]]
17008 !! config
17009 wgAllowDisplayTitle=true
17010 wgRestrictDisplayTitle=true
17011 !! wikitext
17012 this is not the the title
17013 {{DISPLAYTITLE:whatever}}
17014 !! html
17015 Screen
17016 <p>this is not the the title
17017 </p>
17018 !! end
17019
17020 !! test
17021 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17022 !! options
17023 showtitle
17024 title=[[Screen]]
17025 !! config
17026 wgAllowDisplayTitle=true
17027 wgRestrictDisplayTitle=true
17028 !! wikitext
17029 this is not the the title
17030 {{DISPLAYTITLE:screen}}
17031 !! html
17032 screen
17033 <p>this is not the the title
17034 </p>
17035 !! end
17036
17037 !! test
17038 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17039 !! options
17040 showtitle
17041 title=[[Screen]]
17042 !! config
17043 wgAllowDisplayTitle=false
17044 !! wikitext
17045 this is not the the title
17046 {{DISPLAYTITLE:screen}}
17047 !! html
17048 Screen
17049 <p>this is not the the title
17050 <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>
17051 </p>
17052 !! end
17053
17054 !! test
17055 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17056 !! options
17057 showtitle
17058 title=[[Screen]]
17059 !! config
17060 wgAllowDisplayTitle=false
17061 !! wikitext
17062 this is not the the title
17063 !! html
17064 Screen
17065 <p>this is not the the title
17066 </p>
17067 !! end
17068
17069 !! test
17070 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17071 !! options
17072 showtitle
17073 title=[[Screen]]
17074 !! config
17075 wgAllowDisplayTitle=true
17076 wgRestrictDisplayTitle=true
17077 !! wikitext
17078 this is not the the title
17079 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17080 !! html
17081 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17082 <p>this is not the the title
17083 </p>
17084 !! end
17085
17086 !! test
17087 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17088 !! options
17089 showtitle
17090 title=[[Screen]]
17091 !! config
17092 wgAllowDisplayTitle=true
17093 wgRestrictDisplayTitle=true
17094 !! wikitext
17095 this is not the the title
17096 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17097 !! html
17098 <span style="color: red;">s</span>creen
17099 <p>this is not the the title
17100 </p>
17101 !! end
17102
17103 !! test
17104 preload: check <noinclude> and <includeonly>
17105 !! options
17106 preload
17107 !! wikitext
17108 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17109 !! html
17110 Hello kind world.
17111 !! end
17112
17113 !! test
17114 preload: check <onlyinclude>
17115 !! options
17116 preload
17117 !! wikitext
17118 Goodbye <onlyinclude>Hello world</onlyinclude>
17119 !! html
17120 Hello world
17121 !! end
17122
17123 !! test
17124 preload: can pass tags through if we want to
17125 !! options
17126 preload
17127 !! wikitext
17128 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17129 !! html
17130 <includeonly>Hello world</includeonly>
17131 !! end
17132
17133 !! test
17134 preload: check that it doesn't try to do tricks
17135 !! options
17136 preload
17137 !! wikitext
17138 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17139 !! html
17140 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17141 !! end
17142
17143 !! test
17144 Play a bit with r67090 and bug 3158
17145 !! options
17146 disabled
17147 !! wikitext
17148 <div style="width:50% !important">&nbsp;</div>
17149 <div style="width:50%&nbsp;!important">&nbsp;</div>
17150 <div style="width:50%&#160;!important">&nbsp;</div>
17151 <div style="border : solid;">&nbsp;</div>
17152 !! html
17153 <div style="width:50% !important">&nbsp;</div>
17154 <div style="width:50% !important">&nbsp;</div>
17155 <div style="width:50% !important">&nbsp;</div>
17156 <div style="border&#160;: solid;">&nbsp;</div>
17157
17158 !! end
17159
17160 !! test
17161 HTML5 data attributes
17162 !! wikitext
17163 <span data-foo="bar">Baz</span>
17164 <p data-abc-def_hij="">Quuz</p>
17165 !! html
17166 <p><span data-foo="bar">Baz</span>
17167 </p>
17168 <p data-abc-def_hij="">Quuz</p>
17169
17170 !! end
17171
17172 !! test
17173 percent-encoding and + signs in internal links (Bug 26410)
17174 !! wikitext
17175 [[User:+%]] [[Page+title%]]
17176 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17177 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17178 [[%33%45]] [[%33%45+]]
17179 !! html
17180 <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>
17181 <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>
17182 <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>
17183 <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>
17184 </p>
17185 !! end
17186
17187 !! test
17188 Special characters in embedded file links (bug 27679)
17189 !! wikitext
17190 [[File:Contains & ampersand.jpg]]
17191 [[File:Does not exist.jpg|Title with & ampersand]]
17192 !! html
17193 <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>
17194 <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>
17195 </p>
17196 !! end
17197
17198
17199 !! test
17200 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17201 !! wikitext
17202 Text&apos;s been normalized?
17203 !! html
17204 <p>Text&#39;s been normalized?
17205 </p>
17206 !! end
17207
17208 !! test
17209 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17210 !! wikitext
17211 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17212 !! html
17213 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17214 </p>
17215 !! end
17216
17217 !! test
17218 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17219 !! wikitext
17220 [http://www.example.org/ ideograms]
17221 !! html
17222 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17223 </p>
17224 !! end
17225
17226 !! test
17227 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17228 !! wikitext
17229 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17230 !! html
17231 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17232 </p>
17233 !! end
17234
17235 !! article
17236 Mediawiki:loop1
17237 !! text
17238 {{Identical|A}}
17239 !! endarticle
17240
17241 !! article
17242 Mediawiki:loop2
17243 !! text
17244 {{Identical|B}}
17245 !! endarticle
17246
17247 !! article
17248 Template:Identical
17249 !! text
17250 {{int:loop1}}
17251 {{int:loop2}}
17252 !! endarticle
17253
17254 !! test
17255 Bug 31098 Template which includes system messages which includes the template
17256 !! wikitext
17257 {{Identical}}
17258 !! html
17259 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17260 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17261 </p>
17262 !! end
17263
17264 !! test
17265 Bug31490 Turkish: ucfirst 'blah'
17266 !! options
17267 language=tr
17268 !! wikitext
17269 {{ucfirst:blah}}
17270 !! html
17271 <p>Blah
17272 </p>
17273 !! end
17274
17275 !! test
17276 Bug31490 Turkish: ucfirst 'ix'
17277 !! options
17278 language=tr
17279 !! wikitext
17280 {{ucfirst:ix}}
17281 !! html
17282 <p>İx
17283 </p>
17284 !! end
17285
17286 !! test
17287 Bug31490 Turkish: lcfirst 'BLAH'
17288 !! options
17289 language=tr
17290 !! wikitext
17291 {{lcfirst:BLAH}}
17292 !! html
17293 <p>bLAH
17294 </p>
17295 !! end
17296
17297 !! test
17298 Bug31490 Turkish: ucfırst (with a dotless i)
17299 !! options
17300 language=tr
17301 !! wikitext
17302 {{ucfırst:blah}}
17303 !! html
17304 <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>
17305 </p>
17306 !! end
17307
17308 !! test
17309 Bug31490 ucfırst (with a dotless i) with English language
17310 !! options
17311 language=en
17312 !! wikitext
17313 {{ucfırst:blah}}
17314 !! html
17315 <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>
17316 </p>
17317 !! end
17318
17319 !! test
17320 Bug 26375: TOC with italics
17321 !! options
17322 title=[[Main Page]]
17323 !! wikitext
17324 __TOC__
17325 == ''Lost'' episodes ==
17326 !! html
17327 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17328 <ul>
17329 <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>
17330 </ul>
17331 </div>
17332
17333 <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>
17334
17335 !! end
17336
17337 !! test
17338 Bug 26375: TOC with bold
17339 !! options
17340 title=[[Main Page]]
17341 !! wikitext
17342 __TOC__
17343 == '''should be bold''' then normal text ==
17344 !! html
17345 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17346 <ul>
17347 <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>
17348 </ul>
17349 </div>
17350
17351 <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>
17352
17353 !! end
17354
17355 !! test
17356 Bug 33845: Headings become cursive in TOC when they contain an image
17357 !! options
17358 title=[[Main Page]]
17359 !! wikitext
17360 __TOC__
17361 == Image [[Image:foobar.jpg]] ==
17362 !! html
17363 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17364 <ul>
17365 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17366 </ul>
17367 </div>
17368
17369 <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>
17370
17371 !! end
17372
17373 !! test
17374 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17375 !! options
17376 title=[[Main Page]]
17377 !! wikitext
17378 __TOC__
17379 == <blockquote>Quote</blockquote> ==
17380 !! html
17381 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17382 <ul>
17383 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17384 </ul>
17385 </div>
17386
17387 <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>
17388
17389 !! end
17390
17391 !! test
17392 Unclosed tags in TOC
17393 !! options
17394 title=[[Main Page]]
17395 !! wikitext
17396 __TOC__
17397 == Proof: 2 < 3 ==
17398 <small>Hanc marginis exiguitas non caperet.</small>
17399 QED
17400 !! html
17401 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17402 <ul>
17403 <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>
17404 </ul>
17405 </div>
17406
17407 <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>
17408 <p><small>Hanc marginis exiguitas non caperet.</small>
17409 QED
17410 </p>
17411 !! end
17412
17413 !! test
17414 Multiple tags in TOC
17415 !! wikitext
17416 __TOC__
17417 == <i>Foo</i> <b>Bar</b> ==
17418
17419 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17420 !! html
17421 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17422 <ul>
17423 <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>
17424 <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>
17425 </ul>
17426 </div>
17427
17428 <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>
17429 <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>
17430
17431 !! end
17432
17433 !! test
17434 Tags with parameters in TOC
17435 !! wikitext
17436 __TOC__
17437 == <sup class="in-h2">Hello</sup> ==
17438
17439 == <sup class="a > b">Evilbye</sup> ==
17440 !! html
17441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17442 <ul>
17443 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17444 <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>
17445 </ul>
17446 </div>
17447
17448 <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>
17449 <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>
17450
17451 !! end
17452
17453 !! test
17454 span tags with directionality in TOC
17455 !! wikitext
17456 __TOC__
17457 == <span dir="ltr">C++</span> ==
17458
17459 == <span dir="rtl">זבנג!</span> ==
17460
17461 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17462
17463 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17464
17465 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17466 !! html
17467 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17468 <ul>
17469 <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>
17470 <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>
17471 <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>
17472 <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>
17473 <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>
17474 </ul>
17475 </div>
17476
17477 <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>
17478 <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>
17479 <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>
17480 <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>
17481 <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>
17482
17483 !! end
17484
17485 !! article
17486 MediaWiki:Bug32057
17487 !! text
17488 == {{int:headline_sample}} ==
17489 !! endarticle
17490
17491 !! test
17492 Bug 32057: Title needed when expanding <h> nodes.
17493 !! options
17494 title=[[Main Page]]
17495 !! wikitext
17496 {{int:Bug32057}}
17497 !! html
17498 <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>
17499
17500 !! end
17501
17502 !! test
17503 Strip marker in urlencode
17504 !! wikitext
17505 {{urlencode:x<nowiki/>y}}
17506 {{urlencode:x<nowiki/>y|wiki}}
17507 {{urlencode:x<nowiki/>y|path}}
17508 !! html
17509 <p>xy
17510 xy
17511 xy
17512 </p>
17513 !! end
17514
17515 !! test
17516 Strip marker in lc
17517 !! wikitext
17518 {{lc:x<nowiki/>y}}
17519 !! html
17520 <p>xy
17521 </p>
17522 !! end
17523
17524 !! test
17525 Strip marker in uc
17526 !! wikitext
17527 {{uc:x<nowiki/>y}}
17528 !! html
17529 <p>XY
17530 </p>
17531 !! end
17532
17533 !! test
17534 Strip marker in formatNum
17535 !! wikitext
17536 {{formatnum:1<nowiki/>2}}
17537 {{formatnum:1<nowiki/>2|R}}
17538 !! html
17539 <p>12
17540 12
17541 </p>
17542 !! end
17543
17544 !! test
17545 Check noCommafy in formatNum
17546 !! options
17547 language=be-tarask
17548 !! wikitext
17549 {{formatnum:123456.78}}
17550 {{formatnum:123456.78|NOSEP}}
17551 !! html
17552 <p>123 456,78
17553 123456.78
17554 </p>
17555 !! end
17556
17557 !! test
17558 Wrong option for formatNum (bug 56199)
17559 !! wikitext
17560 {{formatnum:1,234.56|Random}}
17561 {{formatnum:1,234.56|EVERYTHING}}
17562 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17563 !! html
17564 <p>1,234.56
17565 1,234.56
17566 1,234.56
17567 </p>
17568 !! end
17569
17570 !! test
17571 Strip marker in grammar
17572 !! options
17573 language=fi
17574 !! wikitext
17575 {{grammar:elative|foo<nowiki/>bar}}
17576 !! html
17577 <p>foobarista
17578 </p>
17579 !! end
17580
17581 !! test
17582 Strip marker in padleft
17583 !! wikitext
17584 {{padleft:|2|x<nowiki/>y}}
17585 !! html
17586 <p>xy
17587 </p>
17588 !! end
17589
17590 !! test
17591 Strip marker in padright
17592 !! wikitext
17593 {{padright:|2|x<nowiki/>y}}
17594 !! html
17595 <p>xy
17596 </p>
17597 !! end
17598
17599 !! test
17600 Strip marker in anchorencode
17601 !! wikitext
17602 {{anchorencode:x<nowiki/>y}}
17603 !! html
17604 <p>xy
17605 </p>
17606 !! end
17607
17608 !! test
17609 nowiki inside link inside heading (bug 18295)
17610 !! wikitext
17611 ==[[foo|x<nowiki>y</nowiki>z]]==
17612 !! html
17613 <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>
17614
17615 !! end
17616
17617 !! test
17618 new support for bdi element (bug 31817)
17619 !! wikitext
17620 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17621 !! html
17622 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17623
17624 !!end
17625
17626 !! test
17627 Ignore pipe between table row attributes
17628 !! wikitext
17629 {|
17630 | quux
17631 |- id=foo | style='color: red'
17632 | bar
17633 |}
17634 !! html
17635 <table>
17636 <tr>
17637 <td> quux
17638 </td></tr>
17639 <tr id="foo" style="color: red">
17640 <td> bar
17641 </td></tr></table>
17642
17643 !! end
17644
17645 !!test
17646 Gallery override link with WikiLink (bug 34852)
17647 !! wikitext
17648 <gallery>
17649 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17650 </gallery>
17651 !! html
17652 <ul class="gallery mw-gallery-traditional">
17653 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17654 <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>
17655 <div class="gallerytext">
17656 <p>caption
17657 </p>
17658 </div>
17659 </div></li>
17660 </ul>
17661
17662 !! end
17663
17664 !!test
17665 Gallery override link with absolute external link (bug 34852)
17666 !! wikitext
17667 <gallery>
17668 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17669 </gallery>
17670 !! html
17671 <ul class="gallery mw-gallery-traditional">
17672 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17673 <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>
17674 <div class="gallerytext">
17675 <p>caption
17676 </p>
17677 </div>
17678 </div></li>
17679 </ul>
17680
17681 !! end
17682
17683 !!test
17684 Gallery override link with malicious javascript (bug 34852)
17685 !! wikitext
17686 <gallery>
17687 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17688 </gallery>
17689 !! html
17690 <ul class="gallery mw-gallery-traditional">
17691 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17692 <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>
17693 <div class="gallerytext">
17694 <p>caption
17695 </p>
17696 </div>
17697 </div></li>
17698 </ul>
17699
17700 !! end
17701
17702 !!test
17703 Gallery with invalid title as link (bug 43964)
17704 !! wikitext
17705 <gallery>
17706 File:foobar.jpg|link=<
17707 </gallery>
17708 !! html
17709 <ul class="gallery mw-gallery-traditional">
17710 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17711 <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>
17712 <div class="gallerytext">
17713 </div>
17714 </div></li>
17715 </ul>
17716
17717 !! end
17718
17719 !!test
17720 Language parser function
17721 !! wikitext
17722 {{#language:ar}}
17723 !! html
17724 <p>العربية
17725 </p>
17726 !! end
17727
17728 !!test
17729 Padleft and padright as substr
17730 !! wikitext
17731 {{padleft:|3|abcde}}
17732 {{padright:|3|abcde}}
17733 !! html
17734 <p>abc
17735 abc
17736 </p>
17737 !! end
17738
17739 !!test
17740 Special parser function
17741 !! wikitext
17742 {{#special:RandomPage}}
17743 {{#special:BaDtItLe}}
17744 {{#special:Foobar}}
17745 !! html
17746 <p>Special:Random
17747 Special:Badtitle
17748 Special:Foobar
17749 </p>
17750 !! end
17751
17752 !!test
17753 Bug 34939 - Case insensitive link parsing ([HttP://])
17754 !! wikitext
17755 [HttP://MediaWiki.Org/]
17756 !! html/php
17757 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17758 </p>
17759 !! html/parsoid
17760 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17761 !! end
17762
17763 !!test
17764 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17765 !! wikitext
17766 [HttP://MediaWiki.Org/ MediaWiki]
17767 !! html
17768 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17769 </p>
17770 !! end
17771
17772 !!test
17773 Bug 34939 - Case insensitive link parsing (HttP://)
17774 !! wikitext
17775 HttP://MediaWiki.Org/
17776 !! html/php
17777 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17778 </p>
17779 !! html/parsoid
17780 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17781 !! end
17782
17783 !!test
17784 Disable TOC
17785 !! options
17786 notoc
17787 !! wikitext
17788 Lead
17789 == Section 1 ==
17790 == Section 2 ==
17791 == Section 3 ==
17792 == Section 4 ==
17793 == Section 5 ==
17794 !! html
17795 <p>Lead
17796 </p>
17797
17798 <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>
17799 <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>
17800 <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>
17801 <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>
17802 <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>
17803
17804 !! end
17805
17806
17807 ###
17808 ### Parsoid-specific tests
17809 ### Parsoid-PHP parser incompatibilities
17810 ###
17811 !!test
17812 1. SOL-sensitive wikitext tokens as template-args
17813 !!options
17814 parsoid=wt2html,wt2wt
17815 !! wikitext
17816 {{echo|*a}}
17817 {{echo|#a}}
17818 {{echo|:a}}
17819 !! html
17820 <span about="#mwt1" typeof="mw:Transclusion">
17821 </span><ul about="#mwt1"><li>a</li>
17822 </ul>
17823 <span about="#mwt2" typeof="mw:Transclusion">
17824 </span><ol about="#mwt2"><li>a</li>
17825 </ol>
17826 <span about="#mwt3" typeof="mw:Transclusion">
17827 </span><dl about="#mwt3"><dd>a</dd>
17828 </dl>
17829 !!end
17830
17831 #### -----------------------------------------------------------------
17832 #### Parsoid-specific functionality tests
17833 #### -----------------------------------------------------------------
17834
17835 # Bug 63642: Formatting elt fixup is cleaned up.
17836 # We know wt2wt will fail, but we expect selser to pass.
17837 # Due to the nature of our testing, wt2wt and selser tests will enter the
17838 # blacklist and we'll catch selser regressions based on changes to the
17839 # blacklist entries for selser tests.
17840 !! test
17841 Bad treebuilder fixup of formatting elt is cleaned up
17842 !! options
17843 parsoid=wt2html,wt2wt
17844 !! wikitext
17845 {|
17846 |
17847 <small>
17848 [[Image:Foobar.jpg|right|Test]]
17849 </small>
17850 |}
17851 !! html/parsoid
17852 <table>
17853 <tbody><tr><td>
17854 <p><small></small></p>
17855 <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>
17856 <p></p></td></tr>
17857 </tbody></table>
17858 !! end
17859
17860 #### ----------------------------------------------------------------
17861 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17862 #### tags. Parsoid's output for these tags differs from that of the
17863 #### PHP parser.
17864 #### ----------------------------------------------------------------
17865
17866 !!test
17867 Ref: 1. ref-location should be replaced with an index span
17868 !!options
17869 parsoid
17870 !! wikitext
17871 A <ref>foo</ref>
17872 B <ref name="x">foo</ref>
17873 C <ref name="y" />
17874 !! html
17875 <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>
17876 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>
17877 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>
17878 !!end
17879
17880 !!test
17881 Ref: 2. ref-tags with identical names should all get the same index
17882 !!options
17883 parsoid
17884 !! wikitext
17885 A <ref name="x">foo</ref>
17886 B <ref name="x" />
17887 !! html
17888 <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>
17889 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>
17890 !!end
17891
17892 !!test
17893 Ref: 3. spaces in ref-names should be ignored
17894 !!options
17895 parsoid
17896 !! wikitext
17897 A <ref name="x">foo</ref>
17898 B <ref name=" x " />
17899 C <ref name= x />
17900 !! html
17901 <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>
17902 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>
17903 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>
17904 !!end
17905
17906 !!test
17907 Ref: 4. 'constructor' should be accepted as a valid ref-name
17908 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17909 !!options
17910 parsoid
17911 !! wikitext
17912 A <ref name="constructor">foo</ref>
17913 !! html
17914 <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>
17915 !!end
17916
17917 !!test
17918 Ref: 5. body should accept generic wikitext
17919 !!options
17920 parsoid
17921 !! wikitext
17922 A <ref>
17923 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17924 </ref>
17925
17926 <references />
17927 !! html
17928 <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>
17929
17930 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17931 <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>
17932 </li>
17933 </ol>
17934 !!end
17935
17936 !!test
17937 Ref: 6. indent-pres should not be output in ref-body
17938 !!options
17939 parsoid
17940 !! wikitext
17941 A <ref>
17942 foo
17943 bar
17944 baz
17945 </ref>
17946
17947 <references />
17948 !! html
17949 <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>
17950
17951 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17952 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17953 bar
17954 baz
17955 </li>
17956 </ol>
17957 !!end
17958
17959 !!test
17960 Ref: 7. No p-wrapping in ref-body
17961 !!options
17962 parsoid
17963 !! wikitext
17964 A <ref>
17965 foo
17966
17967 bar
17968
17969
17970 baz
17971
17972
17973
17974 booz
17975 </ref>
17976
17977 <references />
17978 !! html
17979 <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>
17980
17981 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17982 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17983
17984 bar
17985
17986
17987 baz
17988
17989
17990
17991 booz
17992 </li>
17993 </ol>
17994 !!end
17995
17996 !!test
17997 Ref: 8. transclusion wikitext has lower precedence
17998 !!options
17999 parsoid
18000 !! wikitext
18001 A <ref> foo {{echo|</ref> B C}}
18002
18003 <references />
18004 !! html
18005 <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>
18006 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18007 <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>
18008 </ol>
18009 !!end
18010
18011 !!test
18012 Ref: 9. unclosed comments should not leak out of ref-body
18013 !!options
18014 parsoid
18015 !! wikitext
18016 A <ref> foo <!--</ref> B C
18017 <references />
18018 !! html
18019 <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>
18020 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18021 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18022 </ol>
18023 !!end
18024
18025 !!test
18026 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18027 !!options
18028 parsoid
18029 !! wikitext
18030 A <ref> <b> foo </ref> B C
18031
18032 <references />
18033 !! html
18034 <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>
18035
18036
18037 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18038 <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>
18039 </ol>
18040 !!end
18041
18042 !!test
18043 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18044 !!options
18045 parsoid
18046 !! wikitext
18047 A <ref>foo</ref> B
18048 C <ref>bar</ref> D
18049 !! html
18050 <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
18051 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>
18052 !!end
18053
18054 !!test
18055 Ref: 12. ref-tags act as trailing newline migration barrier
18056 !!options
18057 parsoid
18058 !! wikitext
18059 <!--the newline at the end of this line moves out of the p-tag-->a
18060
18061 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18062 <ref />
18063
18064 c
18065 !! html
18066 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18067
18068
18069 <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>
18070 <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>
18071
18072
18073 <p>c</p>
18074 !!end
18075
18076 !!test
18077 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18078 !!options
18079 parsoid
18080 !! wikitext
18081 <ref>foo</ref> A
18082 <ref>bar
18083 </ref> B
18084 !! html
18085 <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
18086 <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>
18087 !!end
18088
18089 !!test
18090 Ref: 14. A nested ref-tag should be emitted as plain text
18091 !!options
18092 parsoid
18093 !! wikitext
18094 <ref>foo <ref>bar</ref> baz</ref>
18095
18096 <references />
18097 !! html
18098 <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>
18099
18100 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18101 <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>
18102 </ol>
18103 !!end
18104
18105 !!test
18106 Ref: 15. ref-tags with identical names should get identical indexes
18107 !!options
18108 parsoid
18109 !! wikitext
18110 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18111 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18112
18113 <references />
18114 !! html
18115 <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>
18116 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>
18117
18118 <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>
18119 </ol>
18120 !!end
18121
18122 ## We don't bother wt2wt-ing non-standard whitespace
18123 !!test
18124 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18125 !!options
18126 parsoid=wt2html
18127 !! wikitext
18128 A <ref >foo</ref >
18129
18130 <references />
18131 !! html
18132 <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>
18133
18134 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18135 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18136 !!end
18137
18138 !!test
18139 References: 1. references tag without any refs should be handled properly
18140 !!options
18141 parsoid
18142 !! wikitext
18143 <references />
18144 !! html
18145 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18146 !!end
18147
18148 !!test
18149 References: 2. references tag with group only outputs references from that group
18150 !!options
18151 parsoid
18152 !! wikitext
18153 A <ref group="a">foo</ref>
18154 B <ref group="b">bar</ref>
18155
18156 <references group="a" />
18157 !! html
18158 <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>
18159 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>
18160
18161 <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>
18162 </ol>
18163 !!end
18164
18165 !!test
18166 References: 3. ref list should be cleared after processing references
18167 !!options
18168 parsoid
18169 !! wikitext
18170 A <ref>foo</ref>
18171
18172 <references />
18173
18174 B <ref>bar</ref>
18175
18176 <references />
18177 !! html
18178 <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>
18179
18180 <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>
18181 </ol>
18182
18183 <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>
18184
18185 <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>
18186 </ol>
18187 !!end
18188
18189 !!test
18190 References: 4. only referenced group should be cleared after processing references
18191 !!options
18192 parsoid
18193 !! wikitext
18194 A <ref group="a">afoo</ref>
18195 B <ref>bfoo</ref>
18196
18197 <references group="a" />
18198
18199 C <ref>cfoo</ref>
18200
18201 <references />
18202 !! html
18203 <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>
18204 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>
18205
18206 <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>
18207 </ol>
18208
18209 <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>
18210
18211 <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>
18212 </ol>
18213 !!end
18214
18215 !!test
18216 References: 5. ref tags in references should be processed while ignoring all other content
18217 !!options
18218 parsoid
18219 !! wikitext
18220 A <ref name="a" />
18221 B <ref name="b">bar</ref>
18222
18223 <references>
18224 <ref name="a">foo</ref>
18225 This should just get lost.
18226 </references>
18227 !! html
18228 <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>
18229 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>
18230
18231
18232 <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":{}}'>
18233 <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>
18234 <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>
18235 </ol>
18236 !!end
18237
18238 !!test
18239 References: 6. <references /> from a transclusion
18240 !!options
18241 parsoid
18242 !! wikitext
18243 <ref>Foo</ref> {{echo|<references />}}
18244 !! html
18245 <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>
18246 !!end
18247
18248 !! test
18249 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18250 !! options
18251 parsoid
18252 !! wikitext
18253 A <ref>foo bar for a</ref>
18254 B <ref group="X" name="b" />
18255
18256 <references />
18257
18258 <references group="X">
18259 <ref name="b">foo</ref>
18260 </references>
18261 !! html
18262 <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>
18263 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>
18264
18265 <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>
18266
18267 <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>
18268 !! end
18269
18270 !! test
18271 Entities in ref name
18272 !! options
18273 parsoid
18274 !! wikitext
18275 <ref name="test &amp; me">hi</ref>
18276 !! html
18277 <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>
18278 !! end
18279
18280 # This test is wt2html only because we're permitting the serializer to produce
18281 # dirty diffs, normalizing the unclosed references to the self-closed version.
18282 !! test
18283 Generate references for unclosed references tag
18284 !! options
18285 parsoid=wt2html
18286 !! wikitext
18287 a<ref>foo</ref>
18288
18289 <references>
18290 !! html
18291 <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>
18292
18293
18294 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18295 <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>
18296 !! end
18297
18298 !! test
18299 New reference serializes on its own line
18300 !! options
18301 parsoid=wt2wt,html2wt
18302 !! wikitext
18303 foo
18304 <references />
18305 !! html
18306 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18307 !! end
18308
18309 #### ----------------------------------------------------------------
18310 #### The following section of tests are primarily to test
18311 #### wikitext escaping capabilities of Parsoid. Given that
18312 #### escaping can be done any number of ways, the wikitext (input)
18313 #### is always adjusted to reflect how Parsoid adds nowiki
18314 #### escape tags.
18315 ####
18316 #### We are marking several tests as parsoid-only since the
18317 #### HTML in the result section is different from what the
18318 #### PHP parser generates for it.
18319 #### ----------------------------------------------------------------
18320
18321
18322 #### --------------- Headings ---------------
18323 #### 0. Unnested
18324 #### 1. Nested inside html <h1>=foo=</h1>
18325 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18326 #### 3. Nested inside html with wikitext split by html tags
18327 #### 4. No escape needed
18328 #### 5. Empty headings <h1></h1>
18329 #### 6. Heading chars in SOL context
18330 #### ----------------------------------------
18331 !! test
18332 Headings: 0. Unnested
18333 !! options
18334 parsoid
18335 !! wikitext
18336 <nowiki>=foo=</nowiki>
18337
18338 <nowiki> =foo= </nowiki>
18339 <!--cmt-->
18340 <nowiki>=foo=</nowiki>
18341
18342 =foo''a''<nowiki>=</nowiki>
18343 !! html
18344 <p><span typeof="mw:Nowiki">=foo=</span></p>
18345
18346 <p><span typeof="mw:Nowiki"> =foo= </span>
18347 <!--cmt-->
18348 <span typeof="mw:Nowiki">=foo=</span></p>
18349
18350 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18351 !!end
18352
18353 !! test
18354 Headings: 1. Nested inside html
18355 (New headings and existing headings are handled differently)
18356 !! options
18357 parsoid=html2wt
18358 !! wikitext
18359 = =foo= =
18360
18361 == =foo= ==
18362
18363 === =foo= ===
18364
18365 =<nowiki>=foo=</nowiki>=
18366 ==<nowiki>=foo=</nowiki>==
18367 ===<nowiki>=foo=</nowiki>===
18368 ====<nowiki>=foo=</nowiki>====
18369 =====<nowiki>=foo=</nowiki>=====
18370 ======<nowiki>=foo=</nowiki>======
18371
18372 !! html
18373 <h1>=foo=</h1>
18374 <h2>=foo=</h2>
18375 <h3>=foo=</h3>
18376
18377 <h1 data-parsoid='{}'>=foo=</h1>
18378 <h2 data-parsoid='{}'>=foo=</h2>
18379 <h3 data-parsoid='{}'>=foo=</h3>
18380 <h4 data-parsoid='{}'>=foo=</h4>
18381 <h5 data-parsoid='{}'>=foo=</h5>
18382 <h6 data-parsoid='{}'>=foo=</h6>
18383 !!end
18384
18385 !! test
18386 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18387 !! options
18388 parsoid=html2wt
18389 !! wikitext
18390 = foo =
18391 <nowiki>*</nowiki>bar
18392
18393 = foo =
18394 =bar
18395
18396 = foo =
18397 <nowiki>=bar=</nowiki>
18398 !! html
18399 <h1>foo</h1>*bar
18400 <h1>foo</h1>=bar
18401 <h1>foo</h1>=bar=
18402 !!end
18403
18404 !! test
18405 Headings: 3. Nested inside html with wikitext split by html tags
18406 !! options
18407 parsoid=html2wt
18408 !! wikitext
18409 = ='''bold'''<nowiki>foo=</nowiki> =
18410 !! html
18411 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18412 !!end
18413
18414 !! test
18415 Headings: 4a. No escaping needed (testing just h1 and h2)
18416 !! options
18417 parsoid=html2wt
18418 !! wikitext
18419 = =foo =
18420
18421 = foo= =
18422
18423 = =foo= =
18424
18425 = =foo= bar =
18426
18427 == =foo ==
18428
18429 == foo= ==
18430
18431 = ''=''foo= =
18432
18433 = <nowiki>=</nowiki> =
18434 !! html
18435 <h1>=foo</h1>
18436 <h1>foo=</h1>
18437 <h1> =foo= </h1>
18438 <h1>=foo= bar</h1>
18439 <h2>=foo</h2>
18440 <h2>foo=</h2>
18441 <h1><i>=</i>foo=</h1>
18442 <h1><span typeof="mw:Nowiki">=</span></h1>
18443 !!end
18444
18445 !! test
18446 Headings: 4b. No escaping needed (inside p-tags)
18447 !! options
18448 parsoid=html2wt
18449 !! wikitext
18450 ===
18451 =foo= x
18452 =foo= <s></s>
18453 !! html
18454 <p>===
18455 =foo= x
18456 =foo= <s></s>
18457 </p>
18458 !!end
18459
18460 !! test
18461 Headings: 5. Empty headings
18462 !! options
18463 parsoid
18464 !! wikitext
18465 =<nowiki/>=
18466
18467 ==<nowiki/>==
18468
18469 ===<nowiki/>===
18470
18471 ====<nowiki/>====
18472
18473 =====<nowiki/>=====
18474
18475 ======<nowiki/>======
18476 !! html
18477 <h1></h1>
18478 <h2></h2>
18479 <h3></h3>
18480 <h4></h4>
18481 <h5></h5>
18482 <h6></h6>
18483 !!end
18484
18485 !! test
18486 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18487 !! options
18488 parsoid
18489 !! wikitext
18490 <nowiki>=a=</nowiki>
18491
18492 <nowiki>=a=</nowiki>
18493
18494 <nowiki>=a=</nowiki>
18495
18496 <nowiki>=a=</nowiki>
18497 !! html
18498 <p>=a=</p>
18499 <p>=a= </p>
18500 <p>=a= </p>
18501 <p>=a= </p>
18502 !!end
18503
18504 !! test
18505 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18506 !! options
18507 parsoid
18508 !! wikitext
18509 <nowiki>=a=
18510 b</nowiki>
18511
18512 <nowiki>=a=
18513 b</nowiki>
18514
18515 <nowiki>=a=
18516 b</nowiki>
18517
18518 <nowiki>=a=
18519 b</nowiki>
18520 !! html
18521 <p>=a=
18522 b</p>
18523 <p>=a=
18524 b</p>
18525 <p>=a=
18526 b</p>
18527 <p>=a=
18528 b</p>
18529 </p>
18530 !!end
18531
18532 !! test
18533 Headings: 6c. Heading chars in SOL context (leading newline break)
18534 !! options
18535 parsoid
18536 !! wikitext
18537 a
18538 <nowiki>=b=</nowiki>
18539 !! html
18540 <p>a
18541 =b=</p>
18542 !!end
18543
18544 !! test
18545 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18546 !! options
18547 parsoid
18548 !! wikitext
18549 <!--c0--><nowiki>=a=</nowiki>
18550
18551 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18552 !! html
18553 <p><!--c0-->=a=</p>
18554 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18555 !!end
18556
18557 !! test
18558 Headings: 6d. Heading chars in SOL context (No escaping needed)
18559 !! options
18560 parsoid=html2wt
18561 !! wikitext
18562 =a=<div>b</div>
18563 !! html
18564 =a=<div>b</div>
18565 !!end
18566
18567 #### --------------- Lists ---------------
18568 #### 0. Outside nests (*foo, etc.)
18569 #### 1. Nested inside html <ul><li>*foo</li></ul>
18570 #### 2. Inside definition lists
18571 #### 3. Only bullets at start should be escaped
18572 #### 4. No escapes needed
18573 #### 5. No unnecessary escapes
18574 #### 6. Escape bullets in SOL position
18575 #### 7. Escape bullets in a multi-line context
18576 #### ----------------------------------------
18577
18578 !! test
18579 Lists: 0. Outside nests
18580 !! wikitext
18581 <nowiki>*</nowiki>foo
18582
18583 <nowiki>#</nowiki>foo
18584
18585 <nowiki>;Foo:</nowiki>bar
18586 !! html
18587 <p>*foo
18588 </p><p>#foo
18589 </p><p>;Foo:bar
18590 </p>
18591 !!end
18592
18593 !! test
18594 Lists: 1. Nested inside html
18595 !! wikitext
18596 *<nowiki>*foo</nowiki>
18597
18598 *<nowiki>#foo</nowiki>
18599
18600 *<nowiki>:foo</nowiki>
18601
18602 *<nowiki>;foo</nowiki>
18603
18604 #<nowiki>*foo</nowiki>
18605
18606 #<nowiki>#foo</nowiki>
18607
18608 #<nowiki>:foo</nowiki>
18609
18610 #<nowiki>;foo</nowiki>
18611 !! html
18612 <ul><li>*foo</li></ul>
18613 <ul><li>#foo</li></ul>
18614 <ul><li>:foo</li></ul>
18615 <ul><li>;foo</li></ul>
18616 <ol><li>*foo</li></ol>
18617 <ol><li>#foo</li></ol>
18618 <ol><li>:foo</li></ol>
18619 <ol><li>;foo</li></ol>
18620
18621 !!end
18622
18623 !! test
18624 Lists: 2. Inside definition lists
18625 !! wikitext
18626 ;<nowiki>;foo</nowiki>
18627
18628 ;<nowiki>:foo</nowiki>
18629
18630 ;<nowiki>:foo</nowiki>
18631 :bar
18632
18633 :<nowiki>:foo</nowiki>
18634 !! html
18635 <dl><dt>;foo</dt></dl>
18636 <dl><dt>:foo</dt></dl>
18637 <dl><dt>:foo</dt>
18638 <dd>bar</dd></dl>
18639 <dl><dd>:foo</dd></dl>
18640
18641 !!end
18642
18643 !! test
18644 Lists: 3. Only bullets at start of text should be escaped
18645 !! wikitext
18646 *<nowiki>*foo*bar</nowiki>
18647
18648 *<nowiki>*foo</nowiki>''it''*bar
18649 !! html
18650 <ul><li>*foo*bar</li></ul>
18651 <ul><li>*foo<i>it</i>*bar</li></ul>
18652
18653 !!end
18654
18655 !! test
18656 Lists: 4. No escapes needed
18657 !! options
18658 parsoid
18659 !! wikitext
18660 *foo*bar
18661
18662 *''foo''*bar
18663
18664 *[[Foo]]: bar
18665
18666 *[[Foo]]*bar
18667 !! html
18668 <ul>
18669 <li>foo*bar
18670 </li>
18671 </ul>
18672 <ul>
18673 <li><i>foo</i>*bar
18674 </li>
18675 </ul>
18676 <ul>
18677 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18678 </li>
18679 </ul>
18680 <ul>
18681 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18682 </li>
18683 </ul>
18684 !!end
18685
18686 !! test
18687 Lists: 5. No unnecessary escapes
18688 !! wikitext
18689 * bar <span><nowiki>[[foo]]</nowiki></span>
18690
18691 *=bar <span><nowiki>[[foo]]</nowiki></span>
18692
18693 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18694
18695 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18696
18697 *=bar <span>foo]]</span>=
18698
18699 * <s></s>: a
18700 !! html
18701 <ul><li> bar <span>[[foo]]</span></li></ul>
18702 <ul><li>=bar <span>[[foo]]</span></li></ul>
18703 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18704 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18705 <ul><li>=bar <span>foo]]</span>=</li></ul>
18706 <ul><li> <s></s>: a</li></ul>
18707
18708 !!end
18709
18710 !! test
18711 Lists: 6. Escape bullets in SOL position
18712 !! options
18713 parsoid
18714 !! wikitext
18715 <!--cmt--><nowiki>*foo</nowiki>
18716 !! html
18717 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18718 !!end
18719
18720 !! test
18721 Lists: 7. Escape bullets in a multi-line context
18722 !! wikitext
18723 a
18724 <nowiki>*</nowiki>b
18725 !! html
18726 <p>a
18727 *b
18728 </p>
18729 !!end
18730
18731 #### --------------- HRs ---------------
18732 #### 1. Single line
18733 #### -----------------------------------
18734
18735 !! test
18736 HRs: 1. Single line
18737 !! options
18738 parsoid
18739 !! wikitext
18740 ----<nowiki>----</nowiki>
18741 ----=foo=
18742 ----*foo
18743 !! html
18744 <hr><span typeof="mw:Nowiki">----</span>
18745 <hr>=foo=
18746 <hr>*foo
18747 !! end
18748
18749 #### --------------- Tables ---------------
18750 #### 1a. Simple example
18751 #### 1b. No escaping needed (!foo)
18752 #### 1c. No escaping needed (|foo)
18753 #### 1d. No escaping needed (|}foo)
18754 ####
18755 #### 2a. Nested in td (<td>foo|bar</td>)
18756 #### 2b. Nested in td (<td>foo||bar</td>)
18757 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18758 ####
18759 #### 3a. Nested in th (<th>foo!bar</th>)
18760 #### 3b. Nested in th (<th>foo!!bar</th>)
18761 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18762 ####
18763 #### 4a. Escape -
18764 #### 4b. Escape +
18765 #### 4c. No escaping needed
18766 #### --------------------------------------
18767
18768 !! test
18769 Tables: 1a. Simple example
18770 !! wikitext
18771 <nowiki>{|
18772 |}</nowiki>
18773 !! html
18774 <p>{|
18775 |}
18776 </p>
18777 !! end
18778
18779 !! test
18780 Tables: 1b. No escaping needed
18781 !! wikitext
18782 !foo
18783 !! html
18784 <p>!foo
18785 </p>
18786 !! end
18787
18788 !! test
18789 Tables: 1c. No escaping needed
18790 !! wikitext
18791 |foo
18792 !! html
18793 <p>|foo
18794 </p>
18795 !! end
18796
18797 !! test
18798 Tables: 1d. No escaping needed
18799 !! wikitext
18800 |}foo
18801 !! html
18802 <p>|}foo
18803 </p>
18804 !! end
18805
18806 !! test
18807 Tables: 2a. Nested in td
18808 !! options
18809 parsoid=html2wt
18810 !! wikitext
18811 {|
18812 |<nowiki>foo|bar</nowiki>
18813 |-
18814 |x<div><nowiki>a|b</nowiki></div>
18815 |}
18816 !! html
18817 <table><tbody><tr>
18818 <td>foo|bar</td></tr>
18819 <tr><td>x<div>a|b</div></td>
18820 </tbody></table>
18821 !! end
18822
18823 !! test
18824 Tables: 2b. Nested in td
18825 !! options
18826 parsoid
18827 !! wikitext
18828 {|
18829 |<nowiki>foo||bar</nowiki>
18830 |''it''<nowiki>foo||bar</nowiki>
18831 |}
18832 !! html
18833 <table><tbody><tr>
18834 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18835 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18836 !! end
18837
18838 !! test
18839 Tables: 2c. Nested in td -- no escaping needed
18840 !! options
18841 parsoid
18842 !! wikitext
18843 {|
18844 |foo!!bar
18845 |}
18846 !! html
18847 <table><tbody><tr><td>foo!!bar
18848 </td></tr></tbody></table>
18849
18850 !! end
18851
18852 !! test
18853 Tables: 3a. Nested in th
18854 !! options
18855 parsoid
18856 !! wikitext
18857 {|
18858 !foo!bar
18859 |}
18860 !! html
18861 <table><tbody><tr><th>foo!bar
18862 </th></tr></tbody></table>
18863
18864 !! end
18865
18866 !! test
18867 Tables: 3b. Nested in th
18868 !! options
18869 parsoid
18870 !! wikitext
18871 {|
18872 !<nowiki>foo!!bar</nowiki>
18873 |}
18874 !! html
18875 <table>
18876 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18877 </tbody></table>
18878 !! end
18879
18880 !! test
18881 Tables: 3c. Nested in th -- no escaping needed
18882 !! options
18883 parsoid
18884 !! wikitext
18885 {|
18886 !<nowiki>foo||bar</nowiki>
18887 |}
18888 !! html
18889 <table><tbody><tr>
18890 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18891 !! end
18892
18893 !! test
18894 Tables: 4a. Escape -
18895 !! options
18896 parsoid
18897 !! wikitext
18898 {|
18899 !-bar
18900 |-
18901 |<nowiki>-bar</nowiki>
18902 |}
18903 !! html
18904 <table><tbody>
18905 <tr><th>-bar</th></tr>
18906 <tr>
18907 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18908 !! end
18909
18910 !! test
18911 Tables: 4b. Escape +
18912 !! options
18913 parsoid
18914 !! wikitext
18915 {|
18916 !+bar
18917 |-
18918 |<nowiki>+bar</nowiki>
18919 |}
18920 !! html
18921 <table><tbody>
18922 <tr><th>+bar</th></tr>
18923 <tr>
18924 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18925 !! end
18926
18927 !! test
18928 Tables: 4c. No escaping needed
18929 !! options
18930 parsoid
18931 !! wikitext
18932 {|
18933 |foo-bar
18934 |foo+bar
18935 |-
18936 |''foo''-bar
18937 |''foo''+bar
18938 |-
18939 |foo
18940 bar|baz
18941 +bar
18942 -bar
18943 |-
18944 |x
18945 <div>a|b</div>
18946 |}
18947 !! html
18948 <table><tbody>
18949 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18950 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18951 <tr><td>foo
18952 <p>bar|baz
18953 +bar
18954 -bar</p></td></tr>
18955 <tr><td>x
18956 <div>a|b</div></td>
18957 </tbody></table>
18958 !! end
18959
18960 !! test
18961 Tables: 4d. No escaping needed
18962 !! options
18963 parsoid
18964 !! wikitext
18965 {|
18966 |[[Foo]]-bar
18967 ||+1
18968 ||-2
18969 |}
18970 !! html
18971 <table>
18972 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18973 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18974 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18975 </tbody></table>
18976 !! end
18977
18978 !! test
18979 Tables: Digest broken attributes on table and tr tag
18980 !! options
18981 parsoid=wt2html
18982 !! wikitext
18983 {| || |} ++
18984 |- || || ++ --
18985 |- > [
18986 |}
18987 !! html
18988 <table>
18989 <tbody>
18990 <tr></tr>
18991 <tr></tr>
18992 </tbody></table>
18993 !! end
18994
18995 #### --------------- Links ----------------
18996 #### 1. Quote marks in link text
18997 #### 2. Wikilinks: Escapes needed
18998 #### 3. Wikilinks: No escapes needed
18999 #### 4. Extlinks: Escapes needed
19000 #### 5. Extlinks: No escapes needed
19001 #### --------------------------------------
19002 !! test
19003 Links 1. Quote marks in link text
19004 !! options
19005 parsoid
19006 !! wikitext
19007 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19008 !! html
19009 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19010 !! end
19011
19012 !! test
19013 Links 2. WikiLinks: Escapes needed
19014 !! options
19015 parsoid
19016 !! wikitext
19017 [[Foo|[Foobar]]]
19018 [[Foo|<nowiki>Foobar]</nowiki>]]
19019 [[Foo|x [Foobar] x]]
19020 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19021 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19022 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19023 [[Foo|<nowiki>|Bar</nowiki>]]
19024 [[Foo|<nowiki>]]bar</nowiki>]]
19025 [[Foo|<nowiki>[[bar</nowiki>]]
19026 [[Foo|<nowiki>x [[ y</nowiki>]]
19027 [[Foo|<nowiki>x ]] y</nowiki>]]
19028 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19029 !! html
19030 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19031 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19032 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19033 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19034 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19035 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19036 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19037 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19038 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19039 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19040 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19041 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19042 !! end
19043
19044 !! test
19045 Links 3. WikiLinks: No escapes needed
19046 !! options
19047 parsoid
19048 !! wikitext
19049 [[Foo|[Foobar]]
19050 [[Foo|foo|bar]]
19051 !! html
19052 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19053 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19054 !! end
19055
19056 !! test
19057 Links 4. ExtLinks: Escapes needed
19058 !! options
19059 parsoid
19060 !! wikitext
19061 [http://google.com <nowiki>[google]</nowiki>]
19062 [http://google.com <nowiki>google]</nowiki>]
19063
19064 <nowiki>[http://google.com]</nowiki>
19065
19066 <nowiki>[http://google.com google]</nowiki>
19067
19068 !! html
19069 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19070 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19071 <p>[http://google.com]</p>
19072 <p>[http://google.com google]</p>
19073 !! end
19074
19075 !! test
19076 Links 5. ExtLinks: No escapes needed
19077 !! options
19078 parsoid
19079 !! wikitext
19080 [http://google.com [google]
19081 !! html
19082 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19083 !! end
19084
19085 !! test
19086 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19087 !! html/parsoid
19088 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19089 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19090 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19091 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19092 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19093 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19094 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19095 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19096 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19097 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19098 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19099 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19100 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19101 </p>
19102 !! wikitext
19103 x<nowiki/>http://example.com<nowiki/>y
19104 http://example.com<nowiki/>?x
19105 http://example.com<nowiki/>&x
19106 http://example.com<nowiki/>'x
19107 http://example.com<nowiki/>,x
19108 http://example.com<nowiki/>.x
19109 http://example.com<nowiki/>;x
19110 http://example.com<nowiki/>:x
19111 http://example.com<nowiki/>;x
19112 http://example.com<nowiki/>!x
19113 http://example.com<nowiki/>=x
19114 http://example.com<nowiki/>(x)
19115 http://example.com(x<nowiki/>)
19116 !! end
19117
19118 !! test
19119 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19120 !! html/parsoid
19121 <p>x
19122 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19123 y
19124 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19125 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19126 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19127 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19128 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19129 </p>
19130 !! wikitext
19131 x
19132 http://example.com
19133 y
19134 "http://example.com"
19135 (http://example.com)
19136 (http://example.com) foo
19137 http://example.com,
19138 http://example.com, foo
19139 !! end
19140
19141 ## Parsoid currently fails wt2html on this one!
19142 !! test
19143 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19144 !! html/parsoid
19145 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19146 !! wikitext
19147 http://example.com.,;:!?
19148 !! end
19149
19150 !! test
19151 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19152 !! html/parsoid
19153 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19154 !! wikitext
19155 RFC 123<nowiki/>4
19156 !! end
19157
19158 !! test
19159 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19160 !! html/parsoid
19161 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19162 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19163 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19164 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19165 </p>
19166 !! wikitext
19167 xRFC 123y
19168 XRFC 123y
19169 RFC 123?foo
19170 RFC 123&foo
19171 !! end
19172
19173 !! test
19174 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19175 !! html/parsoid
19176 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19177 !! wikitext
19178 PMID 123<nowiki/>4
19179 !! end
19180
19181 !! test
19182 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19183 !! html/parsoid
19184 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19185 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19186 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19187 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19188 </p>
19189 !! wikitext
19190 xPMID 123y
19191 XPMID 123y
19192 PMID 123?foo
19193 PMID 123&foo
19194 !! end
19195
19196 !! test
19197 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19198 !! html/parsoid
19199 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19200 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19201 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19202 </p>
19203 !! wikitext
19204 ISBN 1234567890<nowiki/>1
19205 ISBN 1234567890<nowiki/>x
19206 ISBN 1234567890<nowiki/>b
19207 !! end
19208
19209 !! test
19210 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19211 !! html/parsoid
19212 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19213 !! wikitext
19214 ISBN 1234567890's
19215 !! end
19216
19217 #### --------------- Quotes ---------------
19218 #### 1. Quotes inside <b> and <i>
19219 #### 2. Link fragments separated by <i> and <b> tags
19220 #### 3. Link fragments inside <i> and <b>
19221 #### 4. No escaping needed
19222 #### --------------------------------------
19223 !! test
19224 1. Quotes inside <b> and <i>
19225 !! options
19226 parsoid=html2wt,wt2wt
19227 !! wikitext
19228 ''<nowiki>'foo'</nowiki>''
19229 ''<nowiki>''foo''</nowiki>''
19230 ''<nowiki>'''foo'''</nowiki>''
19231 ''foo''<nowiki/>'s
19232 '''<nowiki>'foo'</nowiki>'''
19233 '''<nowiki>''foo''</nowiki>'''
19234 '''<nowiki>'''foo'''</nowiki>'''
19235 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19236 '''foo'''<nowiki/>'s
19237 '''foo''
19238 ''foo''<nowiki/>'
19239 '<nowiki/>''foo''<nowiki/>'
19240 ''''foo'''
19241 '''foo'''<nowiki/>'
19242 '<nowiki/>'''foo'''<nowiki/>'
19243 ''fools'<span> errand</span>''
19244 ''<span>fool</span>'s errand''
19245 !! html
19246 <p><i>'foo'</i>
19247 <i>''foo''</i>
19248 <i>'''foo'''</i>
19249 <i>foo</i>'s
19250 <b>'foo'</b>
19251 <b>''foo''</b>
19252 <b>'''foo'''</b>
19253 <b>foo'<i>bar'</i>baz</b>
19254 <b>foo</b>'s
19255 '<i>foo</i>
19256 <i>foo</i>'
19257 '<i>foo</i>'
19258 '<b>foo</b>
19259 <b>foo</b>'
19260 '<b>foo</b>'</p>
19261 <i>fools'<span> errand</span></i>
19262 <i><span>fool</span>'s errand</i>
19263 !! end
19264
19265 !! test
19266 2. Link fragments separated by <i> and <b> tags
19267 !! wikitext
19268 [[''foo''<nowiki>hello]]</nowiki>
19269
19270 [['''foo'''<nowiki>hello]]</nowiki>
19271 !! html
19272 <p>[[<i>foo</i>hello]]
19273 </p><p>[[<b>foo</b>hello]]
19274 </p>
19275 !! end
19276
19277 !! test
19278 3. Link fragments inside <i> and <b>
19279 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19280 this is one of the shortcomings of this format)
19281 !! wikitext
19282 ''[[foo''<nowiki>]]</nowiki>
19283
19284 '''[[foo'''<nowiki>]]</nowiki>
19285 !! html
19286 <p><i>[[foo</i>]]
19287 </p><p><b>[[foo</b>]]
19288 </p>
19289 !! end
19290
19291 !! test
19292 4. No escaping needed
19293 !! wikitext
19294 '<span>''bar''</span>'
19295 '<span>'''bar'''</span>'
19296 !! html
19297 <p>'<span><i>bar</i></span>'
19298 '<span><b>bar</b></span>'
19299 </p>
19300 !! end
19301
19302 #### ----------- Paragraphs ---------------
19303 #### 1. No unnecessary escapes
19304 #### --------------------------------------
19305
19306 !! test
19307 1. No unnecessary escapes
19308 !! wikitext
19309 bar <span><nowiki>[[foo]]</nowiki></span>
19310
19311 =bar <span><nowiki>[[foo]]</nowiki></span>
19312
19313 [[bar <span><nowiki>[[foo]]</nowiki></span>
19314
19315 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19316
19317 =bar <span>foo]]</span><nowiki>=</nowiki>
19318 !! html
19319 <p>bar <span>[[foo]]</span>
19320 </p><p>=bar <span>[[foo]]</span>
19321 </p><p>[[bar <span>[[foo]]</span>
19322 </p><p>]]bar <span>[[foo]]</span>
19323 </p><p>=bar <span>foo]]</span>=
19324 </p>
19325 !!end
19326
19327 #### ----------------------- PRE --------------------------
19328 #### 1. Leading whitespace in SOL context should be escaped
19329 #### ------------------------------------------------------
19330 !! test
19331 1. Leading whitespace in SOL context should be escaped
19332 !! options
19333 parsoid
19334 !! wikitext
19335 <nowiki> </nowiki>a
19336
19337 <nowiki> </nowiki> a
19338
19339 <nowiki> </nowiki>a(tab)
19340
19341 <nowiki> </nowiki> a
19342 <!--cmt-->
19343 <nowiki> </nowiki> a
19344
19345 a
19346 <nowiki> </nowiki>b
19347
19348 a
19349 <nowiki> </nowiki>b
19350
19351 a
19352 <nowiki> </nowiki> b
19353 !! html
19354 <p> a</p>
19355 <p> a</p>
19356 <p> a(tab)</p>
19357 <p> a</p>
19358 <p><!--cmt--> a</p>
19359 <p>a
19360 b</p>
19361 <p>a
19362 b</p>
19363 <p>a
19364 b</p>
19365 !! end
19366
19367 #### --------------- Behavior Switches --------------------
19368 !! test
19369 1. Valid behavior switches should be escaped
19370 !! options
19371 parsoid=html2wt
19372 !! wikitext
19373 <nowiki>__TOC__</nowiki>
19374 !! html
19375 __TOC__
19376 !! end
19377
19378 !! test
19379 2. Invalid behavior switches should not be escaped
19380 !! options
19381 parsoid=html2wt
19382 !! wikitext
19383 __TOO__
19384 __|__
19385 !! html
19386 __TOO__
19387 __|__
19388 !! end
19389
19390 #### --------------- HTML tags ---------------
19391 #### 1. a tags
19392 #### 2. other tags
19393 #### 3. multi-line html tag
19394 #### 4. extension tags
19395 #### -----------------------------------------
19396 !! test
19397 1. a tags
19398 !! options
19399 parsoid
19400 !! wikitext
19401 <a href="http://google.com">google</a>
19402 !! html
19403 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19404 !! end
19405
19406 !! test
19407 2. other tags
19408 !! wikitext
19409 <nowiki><div>foo</div>
19410 <div style="color:red">foo</div></nowiki>
19411 !! html
19412 <p>&lt;div&gt;foo&lt;/div&gt;
19413 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19414 </p>
19415 !! end
19416
19417 !! test
19418 3. multi-line html tag
19419 !! wikitext
19420 <nowiki><div
19421 >foo</div
19422 ></nowiki>
19423 !! html
19424 <p>&lt;div
19425 &gt;foo&lt;/div
19426 &gt;
19427 </p>
19428 !! end
19429
19430 !! test
19431 4. extension tags
19432 !! wikitext
19433 <nowiki><ref>foo</ref></nowiki>
19434
19435 <nowiki><ref>bar</nowiki>
19436
19437 baz<nowiki></ref></nowiki>
19438 !! html
19439 <p>&lt;ref&gt;foo&lt;/ref&gt;
19440 </p><p>&lt;ref&gt;bar
19441 </p><p>baz&lt;/ref&gt;
19442 </p>
19443 !! end
19444
19445 #### --------------- Others ---------------
19446 !! test
19447 Escaping nowikis
19448 !! wikitext
19449 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19450 !! html
19451 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19452 </p>
19453 !! end
19454
19455 ## The quote-char in the input is necessary for triggering the bug
19456 !! test
19457 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19458 !! options
19459 parsoid=wt2wt,html2wt
19460 !! wikitext
19461 foo's bar :
19462 !! html
19463 <p>foo's bar :</p>
19464 !! end
19465
19466 !! test
19467
19468 Tag-like HTML structures are passed through as text
19469 !! wikitext
19470 <x y>
19471
19472 <x.y>
19473
19474 <x-y>
19475
19476 1>2
19477
19478 x<y
19479
19480 a>b
19481
19482 1<d e>f
19483 !! html
19484 <p>&lt;x y&gt;
19485 </p><p>&lt;x.y&gt;
19486 </p><p>&lt;x-y&gt;
19487 </p><p>1&gt;2
19488 </p><p>x&lt;y
19489 </p><p>a&gt;b
19490 </p><p>1&lt;d e&gt;f
19491 </p>
19492 !! end
19493
19494
19495 # This was a bug in the PHP parser (see bug 17663 and its dups,
19496 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19497 !! test
19498 Tag names followed by punctuation should not be recognized as tags
19499 !! wikitext
19500 <s.ome> text
19501 !! html
19502 <p>&lt;s.ome&gt; text
19503 </p>
19504 !! end
19505
19506 !! test
19507 HTML tag with necessary entities in attributes
19508 !! wikitext
19509 <span title="&amp;amp;">foo</span>
19510 !! html
19511 <p><span title="&amp;amp;">foo</span>
19512 </p>
19513 !! end
19514
19515 !! test
19516 HTML tag with 'unnecessary' entity encoding in attributes
19517 !! wikitext
19518 <span title="&amp;">foo</span>
19519 !! html
19520 <p><span title="&amp;">foo</span>
19521 </p>
19522 !! end
19523
19524 !! test
19525 HTML tag with broken attribute value quoting
19526 !! wikitext
19527 <span title="Hello world>Foo</span>
19528 !! html
19529 <p><span>Foo</span>
19530 </p>
19531 !! end
19532
19533 !! test
19534 Parsoid-only: HTML tag with broken attribute value quoting
19535 !! options
19536 parsoid
19537 !! wikitext
19538 <span title="Hello world>Foo</span>
19539 !! html
19540 <p><span title="Hello world">Foo</span>
19541 </p>
19542 !! end
19543
19544 !! test
19545 Table with broken attribute value quoting
19546 !! wikitext
19547 {|
19548 | title="Hello world|Foo
19549 |}
19550 !! html
19551 <table>
19552 <tr>
19553 <td>Foo
19554 </td></tr></table>
19555
19556 !! end
19557
19558 !! test
19559 Table with broken attribute value quoting on consecutive lines
19560 !! wikitext
19561 {|
19562 | title="Hello world|Foo
19563 | style="color:red|Bar
19564 |}
19565 !! html
19566 <table>
19567 <tr>
19568 <td>Foo
19569 </td>
19570 <td>Bar
19571 </td></tr></table>
19572
19573 !! end
19574
19575 !! test
19576 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19577 !! options
19578 parsoid
19579 !! wikitext
19580 {|
19581 | title="Hello world|Foo
19582 | style="color:red|Bar
19583 |}
19584 !! html
19585 <table><tbody>
19586 <tr>
19587 <td title="Hello world">Foo
19588 </td><td style="color: red">Bar
19589 </td></tr></tbody></table>
19590
19591 !! end
19592
19593 !! test
19594 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19595 !! options
19596 parsoid
19597 !! wikitext
19598 {{}}
19599 !! html
19600 {{}}
19601 !! end
19602
19603 !! test
19604 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19605 !! options
19606 parsoid
19607 !! wikitext
19608 }}{{
19609 !! html
19610 }}{{
19611 !! end
19612
19613 !!test
19614 Accept empty td cell attribute
19615 !! wikitext
19616 {|
19617 | align="center" | foo || |
19618 |}
19619 !! html
19620 <table>
19621 <tr>
19622 <td align="center"> foo </td>
19623 <td>
19624 </td></tr></table>
19625
19626 !!end
19627
19628 !!test
19629 Non-empty attributes in th-cells
19630 !! wikitext
19631 {|
19632 ! Foo !! style="color: red" | Bar
19633 |}
19634 !! html
19635 <table>
19636 <tr>
19637 <th> Foo </th>
19638 <th style="color: red"> Bar
19639 </th></tr></table>
19640
19641 !!end
19642
19643 !!test
19644 Accept empty attributes in th-cells
19645 !! wikitext
19646 {|
19647 !| foo !!| bar
19648 |}
19649 !! html
19650 <table>
19651 <tr>
19652 <th> foo </th>
19653 <th> bar
19654 </th></tr></table>
19655
19656 !!end
19657
19658 !!test
19659 Empty table rows go away
19660 !! wikitext
19661 {|
19662 | Hello
19663 | there
19664 |- class="foo"
19665 |-
19666 |}
19667 !! html
19668 <table>
19669 <tr>
19670 <td> Hello
19671 </td>
19672 <td> there
19673 </td></tr>
19674
19675 </table>
19676
19677 !! end
19678
19679 ###
19680 ### Parsoid-centric tests for testing RTing of inter-element separators
19681 ### Edge cases not tested by existing parser tests and specific to
19682 ### Parsoid-specific serialization strategies.
19683 ###
19684
19685 !!test
19686 RT-ed inter-element separators should be valid separators
19687 !! wikitext
19688 {|
19689 |- [[foo]]
19690 |}
19691 !! html
19692 <table>
19693
19694 </table>
19695
19696 !!end
19697
19698 !!test
19699 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19700 (Parsoid-only since PHP parser relies on Tidy for correct output)
19701 !!options
19702 parsoid
19703 !! wikitext
19704 {|
19705 |<small>foo
19706 bar
19707 |}
19708
19709 {|
19710 |<small>foo<small>
19711 |}
19712 !! html
19713 !!end
19714
19715 !!test
19716 Empty TD followed by TD with tpl-generated attribute
19717 !! wikitext
19718 {|
19719 |-
19720 |
19721 |{{echo|style='color:red'}}|foo
19722 |}
19723 !! html
19724 <table>
19725
19726 <tr>
19727 <td>
19728 </td>
19729 <td>foo
19730 </td></tr></table>
19731
19732 !!end
19733
19734 !!test
19735 Indented table with an empty td
19736 !! wikitext
19737 {|
19738 |-
19739 |
19740 |foo
19741 |}
19742 !! html
19743 <table>
19744
19745 <tr>
19746 <td>
19747 </td>
19748 <td>foo
19749 </td></tr></table>
19750
19751 !!end
19752
19753 !!test
19754 Indented block & table
19755 !! wikitext
19756 <div>foo</div>
19757 {|
19758 |foo
19759 |}
19760 !! html/parsoid
19761 <div data-parsoid='{"stx":"html"}'>foo</div>
19762 <table><tbody>
19763 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19764 </tbody></table>
19765 !!end
19766
19767 !!test
19768 Empty TR followed by a template-generated TR
19769 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19770 !!options
19771 parsoid
19772 !! wikitext
19773 {|
19774 |-
19775 {{echo|<tr><td>foo</td></tr>}}
19776 |}
19777 !! html
19778 <table>
19779 <tbody>
19780 <tr></tr>
19781 <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}}]}'>
19782 <td>foo</td></tr>
19783 </tbody></table>
19784 !!end
19785
19786 ## PHP and parsoid output differ for this, and since this is primarily
19787 ## for testing Parsoid's serializer, marking this Parsoid only
19788 !!test
19789 Empty TR followed by mixed-ws-comment line should RT correctly
19790 !!options
19791 parsoid
19792 !! wikitext
19793 {|
19794 |-
19795 <!--c-->
19796 |-
19797 <!--c--> <!--d-->
19798 |}
19799 !! html
19800 <table>
19801 <tbody>
19802 <tr></tr>
19803 <!--c-->
19804 <tr>
19805 <!--c--> </tr><!--d-->
19806 </tbody></table>
19807
19808 !!end
19809
19810 !!test
19811 Multi-line image caption generated by templates with/without trailing newlines
19812 !!options
19813 parsoid
19814 !! wikitext
19815 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19816 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19817 !! html
19818 <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>
19819 <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>
19820
19821 !!end
19822
19823 !! test
19824 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19825 !! options
19826 parsoid=html2wt
19827 !! wikitext
19828 <includeonly>foo</includeonly>
19829 new para
19830
19831 [[./Category:Foo]]
19832
19833 = new heading =
19834 !! html
19835 <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>
19836
19837 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19838 !! end
19839
19840 ## PHP emits broken html for this, and since this is primarily
19841 ## a Parsoid serializer test, marking this Parsoid only
19842 !!test
19843 Improperly nested inline or quotes tags with whitespace in between
19844 !!options
19845 parsoid
19846 !! wikitext
19847 <span> <s>x</span> </s>
19848 ''' ''x''' ''
19849 !! html
19850 <p><span> <s>x</s></span><s> </s>
19851 <b> <i>x</i></b><i> </i>
19852 </p>
19853 !!end
19854
19855 !!test
19856 Encapsulate protected attributes from wt
19857 !!options
19858 parsoid
19859 !! wikitext
19860 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19861 !! html
19862 <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>
19863 </body>
19864 !!end
19865
19866 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19867 ## Having nested or stray pre tags results in the attempt to add duplicates,
19868 ## causing an assertion fail. This test tries to prevent that situation.
19869 !!test
19870 Ensure ParagraphWrapper can deal with stray closing pre tags
19871 !!options
19872 parsoid=wt2html
19873 !! wikitext
19874 plain text</pre>
19875 !! html
19876 plain text
19877 !!end
19878
19879 !!test
19880 1. Ensure fostered text content is wrapped in spans
19881 !!options
19882 parsoid=wt2html
19883 !! wikitext
19884 <table>hi</table><table>ho</table>
19885 !! html
19886 <span>hi</span>
19887 <table></table>
19888 <span>ho</span>
19889 <table></table>
19890 !!end
19891
19892 !!test
19893 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19894 !!options
19895 parsoid=wt2html,wt2wt
19896 !! wikitext
19897 <table>
19898 <tr> || ||
19899 <td> a
19900 </table>
19901 !! html
19902 <span> || ||</span>
19903 <table>
19904 <tbody>
19905 <tr>
19906 <td> a</td></tr>
19907 </tbody></table>
19908 !!end
19909
19910 !!test
19911 Encapsulation properly handles null DSR information from foster box
19912 !!options
19913 parsoid=wt2html,wt2wt
19914 !! wikitext
19915 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19916 !! html
19917 <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;
19918 <table>foo
19919 <tr>
19920 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19921 <table>
19922 <tbody>
19923 <tr>
19924 <td>bar</td></tr></tbody></table>
19925 !!end
19926
19927 !!test
19928 1. Encapsulate foster-parented transclusion content
19929 !!options
19930 parsoid=wt2wt,wt2html
19931 !! wikitext
19932 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19933 !! html
19934 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19935 <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
19936 <tr>
19937 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19938 <table>
19939 <tbody>
19940 <tr>
19941 <td>bar</td></tr></tbody></table>
19942 !!end
19943
19944 !!test
19945 2. Encapsulate foster-parented transclusion content
19946 !!options
19947 parsoid=wt2wt,wt2html
19948 !! wikitext
19949 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19950 !! html
19951 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19952 <table>
19953 <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>
19954 <tr>
19955 <td>bar</td></tr></table>&quot;]}">foo</div>
19956 <table>
19957 <tbody>
19958 <tr>
19959 <td>bar</td></tr></tbody></table>
19960 !!end
19961
19962 !!test
19963 3. Encapsulate foster-parented transclusion content
19964 !!options
19965 parsoid=wt2wt,wt2html
19966 !! wikitext
19967 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19968 !! html
19969 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19970 <table>
19971 <div>
19972 <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>
19973 <tr>
19974 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19975 <p>foo</p></div>
19976 <table>
19977 <tbody>
19978 <tr>
19979 <td>bar</td></tr></tbody></table>
19980 !!end
19981
19982 !!test
19983 4. Encapsulate foster-parented transclusion content
19984 !!options
19985 parsoid=wt2wt,wt2html
19986 !! wikitext
19987 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19988 !! html
19989 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19990 <table>
19991 <div>
19992 <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>
19993 <tr>
19994 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19995 <p>foo</p></div>
19996 <table>
19997 <tbody>
19998 <tr>
19999 <td>bar</td></tr></tbody></table>
20000 !!end
20001
20002 !!test
20003 5. Encapsulate foster-parented transclusion content
20004 !!options
20005 parsoid=wt2wt,wt2html
20006 !! wikitext
20007 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20008 !! html
20009 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20010 <table>
20011 <tr>
20012 <td>
20013 <div>
20014 <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>
20015 <table>
20016 <tbody>
20017 <tr>
20018 <td>
20019 <div>
20020 <p>foo</p></div></td></tr></tbody></table>
20021 !!end
20022
20023 !!test
20024 6. Encapsulate foster-parented transclusion content
20025 !!options
20026 parsoid=wt2wt,wt2html
20027 !! wikitext
20028 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20029 !! html
20030 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20031 <table>
20032 <tr>
20033 <td>
20034 <div>
20035 <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>
20036 <table>
20037 <tbody>
20038 <tr>
20039 <td>
20040 <div>
20041 <p>foo</p></div></td></tr></tbody></table>
20042 <p>ok</p>
20043 !!end
20044
20045 !!test
20046 7. Encapsulate foster-parented transclusion content
20047 !!options
20048 parsoid=wt2wt,wt2html
20049 !! wikitext
20050 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20051 !! html
20052 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20053 <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;
20054 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20055 <td>bar</td></table>&quot;]}">foo</p>
20056 <table>
20057 <tbody>
20058 <tr>
20059 <td>bar</td></tr></tbody></table>
20060 !!end
20061
20062 !!test
20063 8. Encapsulate foster-parented transclusion content
20064 !!options
20065 parsoid=wt2wt,wt2html
20066 !! wikitext
20067 {{echo|a
20068 }}{|{{echo|style='color:red'}}
20069 |-
20070 |b
20071 |}
20072 !! html
20073 <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>
20074 <table>
20075 <tbody>
20076 <tr>
20077 <td>b</td></tr></tbody></table>
20078 !!end
20079
20080 !!test
20081 9. Encapsulate foster-parented transclusion content
20082 !!options
20083 parsoid=wt2wt,wt2html
20084 !! wikitext
20085 <table>{{echo|hi</table>hello}}
20086 !! html
20087 <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>
20088 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20089 !!end
20090
20091 !!test
20092 Table in fosterable position
20093 !!options
20094 parsoid=wt2html,wt2wt
20095 !! wikitext
20096 {{OpenTable}}
20097 <div>
20098 {|
20099 |}
20100 </div>
20101 |}
20102 !! html
20103 <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="{}">
20104 </span>
20105 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20106
20107 <table>
20108 </table>
20109 !!end
20110
20111 # Parsoid only for bug 64747
20112 !! test
20113 Properly encapsulate empty-content transclusions in fosterable positions
20114 !! wikitext
20115 <table>
20116 {{#if:|
20117 <td>foo</td>
20118 }}
20119 </table>
20120 !! html/parsoid
20121 <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>"}'>
20122
20123 </table>
20124 !! end
20125
20126 !!test
20127 Support <object> element with .data attribute
20128 !!options
20129 parsoid=html2wt
20130 !! wikitext
20131 <object data="test.swf"></object>
20132 !! html
20133 <object data="test.swf"></object>
20134 !!end
20135
20136 # -----------------------------------------------------------------
20137 # The following section of tests are primarily to spec requirements
20138 # around serialization of new/edited content.
20139 #
20140 # All these tests are marked Parsoid html2wt and html2html only
20141 # ----------------------------------------------------------------
20142
20143 !! test
20144 Image: Modifying size of an image (1)
20145 !! options
20146 parsoid={
20147 "modes": ["wt2wt"],
20148 "changes": [
20149 ["img[height]", "attr", "height", "22"],
20150 ["img[width]", "attr", "width", "200"]
20151 ]
20152 }
20153 !! wikitext
20154 [[Image:Foobar.jpg|230x230px]]
20155 !! wikitext/edited
20156 [[Image:Foobar.jpg|200x200px]]
20157 !!end
20158
20159 !! test
20160 Image: Modifying size of an image (2)
20161 !! options
20162 parsoid={
20163 "modes": ["wt2wt"],
20164 "changes": [
20165 ["img[height]", "attr", "height", "100"],
20166 ["img[width]", "attr", "width", "500"]
20167 ]
20168 }
20169 !! wikitext
20170 [[Image:Foobar.jpg|230x230px]]
20171 !! wikitext/edited
20172 [[Image:Foobar.jpg|500x500px]]
20173 !!end
20174
20175 # Change in size is ignored so long as class='mw-default-size'
20176 !! test
20177 Image: Modifying size of an image (3)
20178 !! options
20179 parsoid={
20180 "modes": ["wt2wt"],
20181 "changes": [
20182 ["figure[class]", "removeClass", "mw-default-size"],
20183 ["figure img", "attr", "height", "19"],
20184 ["figure img", "attr", "width", "170"]
20185 ]
20186 }
20187 !! wikitext
20188 [[Image:Foobar.jpg|thumb]]
20189 !! wikitext/edited
20190 [[Image:Foobar.jpg|thumb|170x170px]]
20191 !!end
20192
20193 !! test
20194 Image: Modifying alignment of an image (bug 48665)
20195 !! options
20196 parsoid={
20197 "modes": ["wt2wt"],
20198 "changes": [
20199 ["figure[class]", "removeClass", "mw-halign-right"],
20200 ["figure[class]", "addClass", "mw-halign-left"]
20201 ]
20202 }
20203 !! wikitext
20204 [[Image:Foobar.jpg|thumb|caption|right]]
20205 !! wikitext/edited
20206 [[Image:Foobar.jpg|thumb|caption|left]]
20207 !! end
20208
20209 !! test
20210 Image: Modifying mw-default-size of an frameless image (bug 62805)
20211 !! options
20212 parsoid={
20213 "modes": ["wt2wt"],
20214 "changes": [
20215 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20216 ]
20217 }
20218 !! wikitext
20219 [[Image:Foobar.jpg|frameless|right]]
20220 !! wikitext/edited
20221 [[Image:Foobar.jpg|frameless|right|220x220px]]
20222 !! end
20223
20224 !! test
20225 Image: Modifying valign of an image (bug 49221)
20226 !! options
20227 parsoid={
20228 "modes": ["wt2wt"],
20229 "changes": [
20230 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20231 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20232 ]
20233 }
20234 !! wikitext
20235 [[File:Foobar.jpg|20px|middle]]
20236 !! wikitext/edited
20237 [[File:Foobar.jpg|20px|text-top]]
20238 !! end
20239
20240 !! test
20241 Image: Modifying alt attribute of an image (bug 56400)
20242 !! options
20243 parsoid={
20244 "modes": ["wt2wt"],
20245 "changes": [
20246 ["img[alt]", "attr", "alt", "some alternate edited text"]
20247 ]
20248 }
20249 !! wikitext
20250 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20251 !! wikitext/edited
20252 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20253 !!end
20254
20255 !! test
20256 Image: Modifying caption of an image
20257 !! options
20258 parsoid={
20259 "modes": ["wt2wt"],
20260 "changes": [
20261 ["figcaption", "text", "new caption"]
20262 ]
20263 }
20264 !! wikitext
20265 [[Image:Foobar.jpg|thumb|original caption]]
20266 !! wikitext/edited
20267 [[Image:Foobar.jpg|thumb|new caption]]
20268 !!end
20269
20270 !! test
20271 Image: empty alt attribute (bug 48924)
20272 !! options
20273 parsoid
20274 !! wikitext
20275 [[File:Foobar.jpg|thumb|alt=|bar]]
20276 !! html
20277 <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>
20278 !! end
20279
20280 #!! test
20281 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20282 #!! options
20283 #parsoid=html2wt
20284 #language=ar
20285 #!! input
20286 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20287 #!! result
20288 #<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>
20289 #!! end
20290
20291 !! test
20292 Image: Block level image should have \n before and after
20293 !! options
20294 parsoid
20295 !! wikitext
20296 123
20297 [[File:Foobar.jpg|right|thumb|150x150px]]
20298 456
20299 !! html
20300 <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>
20301 !!end
20302
20303 !! test
20304 Image: New block level image should have \n before and after (existing
20305 content)
20306 !! options
20307 parsoid
20308 !! wikitext
20309 123
20310 [[File:Foobar.jpg|right|thumb|150x150px]]
20311 456
20312 !! html
20313 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20314 <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>
20315 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20316 !!end
20317
20318 !! test
20319 Image: upright option (parsoid)
20320 !! options
20321 parsoid
20322 !! wikitext
20323 [[File:Foobar.jpg|thumb|upright|caption]]
20324 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20325 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20326 !! html
20327 <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>
20328 !!end
20329
20330 !! test
20331 Image: upright option is ignored on inline and frame images (parsoid)
20332 !! options
20333 parsoid
20334 !! wikitext
20335 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20336 !! html
20337 <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>
20338 !!end
20339
20340 !! test
20341 Image: from basic HTML (1)
20342 !! options
20343 parsoid=html2wt
20344 !! html/parsoid
20345 <span typeof="mw:Image">
20346 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20347 </span>
20348 !! wikitext
20349 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20350 !! end
20351
20352 !! test
20353 Image: from basic HTML (2)
20354 !! options
20355 parsoid=html2wt
20356 !! html/parsoid
20357 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20358 !! wikitext
20359 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20360 !! end
20361
20362 !! test
20363 Image: from basic HTML (3)
20364 !! options
20365 parsoid=html2wt
20366 !! html/parsoid
20367 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20368 !! wikitext
20369 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20370 !! end
20371
20372 !! test
20373 Image: from basic HTML (4)
20374 !! options
20375 parsoid=html2wt
20376 !! html/parsoid
20377 <img src="File:Foobar.jpg">
20378 !! wikitext
20379 [[File:Foobar.jpg|link=]]
20380 !! end
20381
20382 !! test
20383 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20384 !! options
20385 parsoid=html2wt
20386 !! wikitext
20387 * foo
20388 !! html
20389 <ul>
20390 <li><p>foo</p></li>
20391 </ul>
20392 !! end
20393
20394 !! test
20395 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20396 !! options
20397 parsoid=html2wt
20398 !! wikitext
20399 * foo
20400 !! html
20401 <ul> <li>foo</li></ul>
20402 !! end
20403
20404 !! test
20405 Don't strip leading whitespace when handling indent-pre suppressing tags
20406 !! options
20407 parsoid=html2wt
20408 !! wikitext
20409 {|
20410 | indented row
20411 |}
20412 <blockquote>
20413 '''This is very bold of you!'''
20414
20415 {|
20416 |
20417 indented cell (no pre-wrapping!)
20418 |}
20419 </blockquote>
20420 foo
20421 <div>bar</div>
20422 !! html
20423 <table>
20424 <tr><td> indented row</td></tr>
20425 </table>
20426 <blockquote><p>
20427 <b>This is very bold of you!</b>
20428 </p>
20429 <table><tr><td>
20430 indented cell (no pre-wrapping!)
20431 </td></tr></table>
20432 </blockquote>
20433 <p>foo</p>
20434 <div>bar</div>
20435 !! end
20436
20437 !! test
20438 Strip leading whitespace when handling indent-pre inducing tags
20439 !! options
20440 parsoid=html2wt
20441 !! wikitext
20442 foo
20443 <span>bar</span>
20444
20445 <span>foo2
20446 </span>bar2
20447
20448 <div>foo</div>
20449 <span>bar</span>
20450
20451 <div>
20452 <span>foo</span>
20453 </div>
20454 !! html
20455 <p>foo</p>
20456 <span>bar</span>
20457
20458 <span>foo2
20459 </span>bar2
20460
20461 <div>foo</div>
20462 <span>bar</span>
20463
20464 <div>
20465 <span>foo</span>
20466 </div>
20467 !! end
20468
20469 !! test
20470 Lists: Add space after bullets
20471 !! options
20472 parsoid=html2wt
20473 !! wikitext
20474 * foo
20475 * bar
20476 * <span> baz</span>
20477 !! html
20478 <ul>
20479 <li>foo</li>
20480 <li> bar</li>
20481 <li><span> baz</span></li>
20482 </ul>
20483 !! end
20484
20485 !! test
20486 Lists: Dont insert newlines in a serialized list item.
20487 !! options
20488 parsoid=html2wt
20489 !! wikitext
20490 * a<br>b
20491 * c
20492 !! html
20493 <ul><li>a<br>b</li><li>c</li></ul>
20494 !! end
20495
20496 !! test
20497 Headings: Add space before/after == (Bug 51744)
20498 !! options
20499 parsoid=html2wt
20500 !! wikitext
20501 == foo ==
20502
20503 == bar ==
20504
20505 == baz ==
20506
20507 == <span> baz</span> ==
20508 !! html
20509 <h2>foo</h2>
20510 <h2> bar</h2>
20511 <h2>baz </h2>
20512 <h2><span> baz</span></h2>
20513 !! end
20514
20515 !! test
20516 Parsoid: Serialize positional parameters with = in them as named parameter
20517 !! options
20518 parsoid=html2wt
20519 !! wikitext
20520 {{echo|1 = f=oo}}
20521
20522 {{echo|1 = f=oo|2 = bar}}
20523
20524 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20525 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20526 {{echo|<nowiki>f=oo</nowiki>|bar}}
20527 !! html
20528 <p about="#mwt1" typeof="mw:Transclusion"
20529 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20530
20531 <p about="#mwt1" typeof="mw:Transclusion"
20532 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20533
20534 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20535 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20536 <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>
20537 !! end
20538
20539 !! test
20540 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20541 !! options
20542 parsoid=html2wt
20543 !! wikitext
20544 <div>a
20545 b
20546 </div>
20547 <div>a
20548 b
20549 </div>
20550 <div>
20551 a
20552
20553 b
20554 </div>
20555 !! html
20556 <div>a<p>b</p></div>
20557 <div>a
20558 <p>b</p></div>
20559 <div>
20560 a
20561 <p>b</p></div>
20562 !! end
20563
20564 !! test
20565 Substrings resembling wikitext in hrefs should not get nowiki escapes
20566 !! options
20567 parsoid=html2wt
20568 !! wikitext
20569 [[Foo''bar''baz]]
20570 !! html
20571 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20572 !! end
20573
20574 #-----------------------------
20575 # I/B quote minimization tests
20576 #-----------------------------
20577
20578 !! test
20579 1. I/B quote minimization: wikitext-only tags should be combined
20580 !! options
20581 parsoid=html2wt
20582 !! wikitext
20583 ''AB''
20584
20585 '''AB'''
20586
20587 ''A'''B'''''
20588
20589 '''A''B'''''
20590
20591 '''A''BC''D'''
20592
20593 '''''AB'''''
20594
20595 '''''AB'''''
20596
20597 '''''AB'''''
20598 !! html
20599 <p><i>A</i><i>B</i></p>
20600 <p><b>A</b><b>B</b></p>
20601 <p><i>A</i><b><i>B</i></b></p>
20602 <p><b>A</b><i><b>B</b></i></p>
20603 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20604 <p><i><b>A</b></i><i><b>B</b></i></p>
20605 <p><i><b>A</b></i><b><i>B</i></b></p>
20606 <p><b><i>A</i></b><i><b>B</b></i></p>
20607 !! end
20608
20609 !! test
20610 2. I/B quote minimization: wikitext and html tags should not be combined
20611 !! options
20612 parsoid=html2wt
20613 !! wikitext
20614 ''A''<i>B</i>
20615
20616 ''A'''''<i>B</i>'''
20617 !! html
20618 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20619 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20620 !! end
20621
20622 !! test
20623 3. I/B quote minimization: templated content stops minimization
20624 !! options
20625 parsoid=html2wt
20626 !! wikitext
20627 ''A''{{echo|''B''}}
20628
20629 ''A''{{echo|'''''B'''''}}
20630 !! html
20631 <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>
20632 <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>
20633 !! end
20634
20635 !! test
20636 4. I/B quote minimization: new content should be mimimized with adjacent old content
20637 !! options
20638 parsoid=html2wt
20639 !! wikitext
20640 ''AB''
20641
20642 '''AB'''
20643
20644 ''A'''B'''''
20645 !! html
20646 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20647 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20648 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20649 !! end
20650
20651 #------------------------------------
20652 # End of I/B quote minimization tests
20653 #------------------------------------
20654
20655 !!test
20656 Bug 54262: New entities
20657 !! options
20658 parsoid=html2wt
20659 !! wikitext
20660 &nbsp;
20661 !! html
20662 <span typeof="mw:Entity">&nbsp;</span>
20663 !! end
20664
20665 ## Note that there is no wikitext output for 'unknownproperty' ##
20666 ## Unknown magic words are silently dropped ##
20667
20668 !! test
20669 Magic words
20670 !! options
20671 parsoid=html2wt
20672 !! wikitext
20673 __TOC__
20674 __NOTOC__
20675 __FORCETOC__
20676 __INDEX__
20677 __NOINDEX__
20678 __NOGALLERY__
20679 __NOEDITSECTION__
20680 __NOTITLECONVERT__
20681 __NOCONTENTCONVERT__
20682 !! html
20683 <meta property='mw:PageProp/toc' />
20684 <meta property='mw:PageProp/notoc' />
20685 <meta property='mw:PageProp/forcetoc' />
20686 <meta property='mw:PageProp/index' />
20687 <meta property='mw:PageProp/noindex' />
20688 <meta property='mw:PageProp/nogallery' />
20689 <meta property='mw:PageProp/noeditsection' />
20690 <meta property='mw:PageProp/notitleconvert' />
20691 <meta property='mw:PageProp/nocontentconvert' />
20692 <meta property='mw:PageProp/unknownproperty' />
20693 !! end
20694
20695 !! test
20696 Consecutive <pre>s should not get merged
20697 !! options
20698 parsoid=html2wt,html2html
20699 !! wikitext
20700 a
20701
20702 b
20703
20704 c
20705
20706 d
20707
20708 e
20709
20710
20711
20712 f
20713 !! html
20714 <pre>a</pre><pre>b</pre>
20715
20716 <pre>c
20717 </pre><pre>
20718 d</pre>
20719
20720 <pre>e
20721
20722 </pre><pre>
20723
20724 f</pre>
20725 !! end
20726
20727 !! test
20728 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20729 !! options
20730 parsoid=html2wt
20731 !! wikitext
20732 [[Special:BookSources/1234567890|ISBN 1234567895]]
20733 !! html
20734 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20735 !! end
20736
20737 !! test
20738 Edited RFC links not serializable as RFC links should serialize as extlinks
20739 !! options
20740 parsoid=html2wt
20741 !! wikitext
20742 [//tools.ietf.org/html/rfc123 New RFC]
20743 !! html
20744 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20745 !! end
20746
20747 !! test
20748 Edited PMID links not serializable as PMID links should serialize as extlinks
20749 !! options
20750 parsoid=html2wt
20751 !! wikitext
20752 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20753 !! html
20754 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20755 !! end
20756
20757 !! test
20758 Edited Redirect link should emit a non-piped wikitext link
20759 !! options
20760 parsoid=html2wt
20761 !! wikitext
20762 #REDIRECT [[Bar]]
20763 !! html
20764 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20765 !! end
20766
20767 # -----------------------------------------------------------------
20768 # End of section for Parsoid-only html2wt tests for serialization
20769 # of new content
20770 # -----------------------------------------------------------------
20771
20772 TODO:
20773 more images
20774 more tables
20775 character entities
20776 and much more
20777 Try for 100% code coverage