6097370612bfd783fa9a02f70c780411d99b8220
[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:echo
92 !! text
93 {{{1}}}
94 !! endarticle
95
96 !! article
97 Template:echo_with_span
98 !! text
99 <span>{{{1}}}</span>
100 !! endarticle
101
102 !! article
103 Template:echo_with_div
104 !! text
105 <div>{{{1}}}</div>
106 !! endarticle
107
108 !! article
109 Template:attr_str
110 !! text
111 {{{1}}}="{{{2}}}"
112 !! endarticle
113
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color: red"| Foo
119 !! endarticle
120
121 !! article
122 Template:table_cells
123 !! text
124 {{table_attribs}} || Bar || Baz
125 !! endarticle
126
127 !! article
128 Template:image_attribs
129 !! text
130 <noinclude>
131 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
132 !! endarticle
133
134 !! article
135 A?b
136 !! text
137 Weirdo titles!
138 !! endarticle
139
140 !!article
141 Template:Bullet
142 !!text
143 * Bar
144 !!endarticle
145
146 !!article
147 Template:OpenTable
148 !!text
149 {|
150 !!endarticle
151
152 ###
153 ### Basic tests
154 ###
155 !! test
156 Blank input
157 !! wikitext
158 !! html
159 !! end
160
161
162 !! test
163 Simple paragraph
164 !! wikitext
165 This is a simple paragraph.
166 !! html
167 <p>This is a simple paragraph.
168 </p>
169 !! end
170
171 !! test
172 Paragraphs with extra newline spacing
173 !! wikitext
174 foo
175
176 bar
177
178
179 baz
180
181
182
183 booz
184 !! html
185 <p>foo
186 </p><p>bar
187 </p><p><br />
188 baz
189 </p><p><br />
190 </p><p>booz
191 </p>
192 !! end
193
194 !! test
195 Paragraphs with newline spacing with comment lines in between
196 !! wikitext
197 ----
198 a
199 <!--foo-->
200 b
201 ----
202 a
203 <!--foo--><!--More than 1 comment, still stripped-->
204 b
205 ----
206 a
207 <!--foo--> <!----> <!-- bar -->
208 b
209 ----
210 a
211 <!--foo-->
212
213 b
214 ----
215 a
216
217 <!--foo-->
218 b
219 ----
220 a
221 <!--foo-->
222
223
224 b
225 ----
226 a
227
228
229 <!--foo-->
230 b
231 ----
232 !! html
233 <hr />
234 <p>a
235 b
236 </p>
237 <hr />
238 <p>a
239 b
240 </p>
241 <hr />
242 <p>a
243 b
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p>b
252 </p>
253 <hr />
254 <p>a
255 </p><p><br />
256 b
257 </p>
258 <hr />
259 <p>a
260 </p><p><br />
261 b
262 </p>
263 <hr />
264
265 !! end
266
267 !! test
268 Paragraphs with newline spacing with non-empty white-space lines in between
269 !! wikitext
270 ----
271 a
272
273 b
274 ----
275 a
276
277
278 b
279 ----
280 !! html
281 <hr />
282 <p>a
283 </p><p>b
284 </p>
285 <hr />
286 <p>a
287 </p><p><br />
288 b
289 </p>
290 <hr />
291
292 !! end
293
294 !! test
295 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
296 !! wikitext
297 ----
298 a
299 <!--foo-->
300 b
301 ----
302 a
303 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
304 b
305 ----
306 a
307
308 <!--foo-->
309 <!--bar-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316
317 b
318 ----
319 !! html
320 <hr />
321 <p>a
322 b
323 </p>
324 <hr />
325 <p>a
326 b
327 </p>
328 <hr />
329 <p>a
330 </p><p>b
331 </p>
332 <hr />
333 <p>a
334 </p><p><br />
335 b
336 </p>
337 <hr />
338
339 !! end
340
341 !! test
342 Extra newlines: More paragraphs with indented comment
343 !! wikitext
344 a
345
346 <!--boo-->
347
348 b
349 !! html
350 <p>a
351 </p><p><br />
352 b
353 </p>
354 !!end
355
356 !! test
357 Extra newlines followed by heading
358 !! wikitext
359 a
360
361
362
363 =b=
364 [[a]]
365
366
367 =b=
368 !! html
369 <p>a
370 </p><p><br />
371 </p>
372 <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>
373 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
374 </p><p><br />
375 </p>
376 <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>
377
378 !! end
379
380 !! test
381 Extra newlines between heading and content are swallowed
382 !! wikitext
383 =b=
384
385
386
387 [[a]]
388 !! html
389 <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>
390 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
391 </p>
392 !! end
393
394 !! test
395 Parsing an URL
396 !! wikitext
397 http://fr.wikipedia.org/wiki/🍺
398 <!-- EasterEgg we love beer, better be able be able to link to it -->
399 !! html
400 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
401 </p>
402 !! end
403
404 !! test
405 Simple list
406 !! wikitext
407 * Item 1
408 * Item 2
409 !! html
410 <ul><li> Item 1</li>
411 <li> Item 2</li></ul>
412
413 !! end
414
415 !! test
416 Italics and bold
417 !! wikitext
418 * plain
419 * plain''italic''plain
420 * plain''italic''plain''italic''plain
421 * plain'''bold'''plain
422 * plain'''bold'''plain'''bold'''plain
423 * plain''italic''plain'''bold'''plain
424 * plain'''bold'''plain''italic''plain
425 * plain''italic'''bold-italic'''italic''plain
426 * plain'''bold''bold-italic''bold'''plain
427 * plain'''''bold-italic'''italic''plain
428 * plain'''''bold-italic''bold'''plain
429 * plain''italic'''bold-italic'''''plain
430 * plain'''bold''bold-italic'''''plain
431 * plain l'''italic''plain
432 * plain l''''bold''' plain
433 !! html
434 <ul><li> plain</li>
435 <li> plain<i>italic</i>plain</li>
436 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
437 <li> plain<b>bold</b>plain</li>
438 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
439 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
440 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
441 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
442 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
443 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
444 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
445 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
446 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
447 <li> plain l'<i>italic</i>plain</li>
448 <li> plain l'<b>bold</b> plain</li></ul>
449
450 !! end
451
452 # this example taken from the [[simple:Moon]] article (bug 47326)
453 !! test
454 Italics and possessives (1)
455 !! wikitext
456 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
457 !! html
458 <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
459 </p>
460 !! end
461
462 # this example taken from [[en:Flaming Pie]] (bug 49926)
463 !! test
464 Italics and possessives (2)
465 !! wikitext
466 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
467 !! html
468 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
469 </p>
470 !! end
471
472 # this example taken from [[en:Dictionary]] (bug 49926)
473 !! test
474 Italics and possessives (3)
475 !! wikitext
476 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''.
477 !! html
478 <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>.
479 </p>
480 !! end
481
482
483 ###
484 ### 2-quote opening sequence tests
485 ###
486 !! test
487 Italics and bold: 2-quote opening sequence: (2,2)
488 !! wikitext
489 ''foo''
490 !! html
491 <p><i>foo</i>
492 </p>
493 !!end
494
495
496 !! test
497 Italics and bold: 2-quote opening sequence: (2,3)
498 !! options
499 parsoid=wt2html
500 !! wikitext
501 ''foo'''
502 !! html/*
503 <p><i>foo'</i>
504 </p>
505 !!end
506
507
508 # same html as previous, but wikitext adjusted to match parsoid html2wt
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
511 !! wikitext
512 ''<nowiki>foo'</nowiki>''
513 !! html
514 <p><i>foo'</i>
515 </p>
516 !! end
517
518
519 !! test
520 Italics and bold: 2-quote opening sequence: (2,4)
521 !! options
522 parsoid=wt2html
523 !! wikitext
524 ''foo''''
525 !! html/*
526 <p><i>foo''</i>
527 </p>
528 !!end
529
530
531 # same html as previous, but wikitext adjusted to match parsoid html2wt
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
534 !! wikitext
535 ''<nowiki>foo''</nowiki>''
536 !! html
537 <p><i>foo''</i>
538 </p>
539 !! end
540
541
542 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
543 !! test
544 Italics and bold: 2-quote opening sequence: (2,5)
545 !! options
546 parsoid=wt2html
547 !! wikitext
548 ''foo'''''
549 !! html/php
550 <p><i>foo</i>
551 </p>
552 !! html/parsoid
553 <p><i>foo</i><b></b>
554 </p>
555 !!end
556
557 # same html as previous, but wikitext adjusted to match parsoid html2wt
558 !! test
559 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
560 !! wikitext
561 ''foo'''''<nowiki/>'''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !! end
569
570
571 ###
572 ### 3-quote opening sequence tests
573 ###
574
575 !! test
576 Italics and bold: 3-quote opening sequence: (3,2)
577 !! wikitext
578 '''foo''
579 !! html
580 <p>'<i>foo</i>
581 </p>
582 !!end
583
584
585 !! test
586 Italics and bold: 3-quote opening sequence: (3,3)
587 !! wikitext
588 '''foo'''
589 !! html
590 <p><b>foo</b>
591 </p>
592 !!end
593
594
595 !! test
596 Italics and bold: 3-quote opening sequence: (3,4)
597 !! options
598 parsoid=wt2html
599 !! wikitext
600 '''foo''''
601 !! html/*
602 <p><b>foo'</b>
603 </p>
604 !!end
605
606
607 # same html as previous, but wikitext adjusted to match parsoid html2wt
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
610 !! wikitext
611 '''<nowiki>foo'</nowiki>'''
612 !! html
613 <p><b>foo'</b>
614 </p>
615 !! end
616
617
618 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
619 !! test
620 Italics and bold: 3-quote opening sequence: (3,5)
621 !! options
622 parsoid=wt2html
623 !! wikitext
624 '''foo'''''
625 !! html/php
626 <p><b>foo</b>
627 </p>
628 !! html/parsoid
629 <p><b>foo</b><i></i>
630 </p>
631 !!end
632
633 # same html as previous, but wikitext adjusted to match parsoid html2wt
634 !! test
635 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
636 !! wikitext
637 '''foo'''''<nowiki/>''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !! end
645
646
647 ###
648 ### 4-quote opening sequence tests
649 ###
650
651 !! test
652 Italics and bold: 4-quote opening sequence: (4,2)
653 !! options
654 parsoid=wt2html
655 !! wikitext
656 ''''foo''
657 !! html/*
658 <p>''<i>foo</i>
659 </p>
660 !!end
661
662
663 # same html as previous, but wikitext adjusted to match parsoid html2wt
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
666 !! wikitext
667 <nowiki>''</nowiki>''foo''
668 !! html
669 <p>''<i>foo</i>
670 </p>
671 !! end
672
673
674 !! test
675 Italics and bold: 4-quote opening sequence: (4,3)
676 !! wikitext
677 ''''foo'''
678 !! html
679 <p>'<b>foo</b>
680 </p>
681 !!end
682
683
684 !! test
685 Italics and bold: 4-quote opening sequence: (4,4)
686 !! options
687 parsoid=wt2html
688 !! wikitext
689 ''''foo''''
690 !! html/*
691 <p>'<b>foo'</b>
692 </p>
693 !!end
694
695
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
699 !! wikitext
700 ''''<nowiki>foo'</nowiki>'''
701 !! html
702 <p>'<b>foo'</b>
703 </p>
704 !! end
705
706
707 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
708 !! test
709 Italics and bold: 4-quote opening sequence: (4,5)
710 !! options
711 parsoid=wt2html
712 !! wikitext
713 ''''foo'''''
714 !! html/php
715 <p>'<b>foo</b>
716 </p>
717 !! html/parsoid
718 <p>'<b>foo</b><i></i>
719 </p>
720 !!end
721
722 # same html as previous, but wikitext adjusted to match parsoid html2wt
723 !! test
724 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
725 !! wikitext
726 ''''foo'''''<nowiki/>''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !! end
734
735
736 ###
737 ### 5-quote opening sequence tests
738 ###
739
740 !! test
741 Italics and bold: 5-quote opening sequence: (5,2)
742 !! options
743 parsoid=wt2html
744 !! wikitext
745 '''''foo''
746 !! html/*
747 <p><b><i>foo</i></b>
748 </p>
749 !!end
750
751
752 # same html as previous, but wikitext adjusted to match parsoid html2wt
753 # skipping wt2html and html2html because it wants to put <i> before <b>
754 !! test
755 Italics and bold: 5-quote opening sequence: (5,2+3)
756 !! options
757 parsoid=wt2wt,html2wt
758 !! wikitext
759 '''''foo'''''
760 !! html/*
761 <p><b><i>foo</i></b>
762 </p>
763 !! end
764
765 !! test
766 Italics and bold: 5-quote opening sequence: (5,3)
767 !! options
768 parsoid=wt2html
769 !! wikitext
770 '''''foo'''
771 !! html/*
772 <p><i><b>foo</b></i>
773 </p>
774 !!end
775
776
777 # same html as previous, but wikitext adjusted to match parsoid html2wt
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3+2)
780 !! wikitext
781 '''''foo'''''
782 !! html
783 <p><i><b>foo</b></i>
784 </p>
785 !! end
786
787
788 !! test
789 Italics and bold: 5-quote opening sequence: (5,4)
790 !! options
791 parsoid=wt2html
792 !! wikitext
793 '''''foo''''
794 !! html/*
795 <p><i><b>foo'</b></i>
796 </p>
797 !!end
798
799
800 # same html as previous, but wikitext adjusted to match parsoid html2wt
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
803 !! wikitext
804 '''''<nowiki>foo'</nowiki>'''''
805 !! html
806 <p><i><b>foo'</b></i>
807 </p>
808 !! end
809
810
811 !! test
812 Italics and bold: 5-quote opening sequence: (5,5)
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><i><b>foo</b></i>
817 </p>
818 !!end
819
820 ###
821 ### multiple quote sequences in a line
822 ###
823 !! test
824 Italics and bold: multiple quote sequences: (2,4,2)
825 !! options
826 parsoid=wt2html
827 !! wikitext
828 ''foo''''bar''
829 !! html/*
830 <p><i>foo'<b>bar</b></i>
831 </p>
832 !!end
833
834
835 # same html as previous, but wikitext adjusted to match parsoid html2wt
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
838 !! wikitext
839 ''<nowiki>foo'</nowiki>'''bar'''''
840 !! html
841 <p><i>foo'<b>bar</b></i>
842 </p>
843 !! end
844
845
846 !! test
847 Italics and bold: multiple quote sequences: (2,4,3)
848 !! options
849 parsoid=wt2html
850 !! wikitext
851 ''foo''''bar'''
852 !! html/*
853 <p><i>foo'<b>bar</b></i>
854 </p>
855 !!end
856
857
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
861 !! wikitext
862 ''<nowiki>foo'</nowiki>'''bar'''''
863 !! html
864 <p><i>foo'<b>bar</b></i>
865 </p>
866 !! end
867
868
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,4)
871 !! options
872 parsoid=wt2html
873 !! wikitext
874 ''foo''''bar''''
875 !! html/*
876 <p><i>foo'<b>bar'</b></i>
877 </p>
878 !!end
879
880
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
884 !! wikitext
885 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
886 !! html
887 <p><i>foo'<b>bar'</b></i>
888 </p>
889 !! end
890
891
892 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
893 !! test
894 Italics and bold: multiple quote sequences: (3,4,2)
895 !! options
896 parsoid=wt2html
897 !! wikitext
898 '''foo''''bar''
899 !! html/php
900 <p><b>foo'</b>bar
901 </p>
902 !! html/parsoid
903 <p><b>foo'</b>bar<i></i>
904 </p>
905 !!end
906
907 # same html as previous, but wikitext adjusted to match parsoid html2wt
908 !! test
909 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
910 !! options
911 parsoid
912 !! wikitext
913 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
914 !! html/php
915 <p><b>foo'</b>bar
916 </p>
917 !! html/parsoid
918 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
919 </p>
920 !! end
921
922
923 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
924 !! test
925 Italics and bold: multiple quote sequences: (3,4,3)
926 !! options
927 parsoid=wt2html
928 !! wikitext
929 '''foo''''bar'''
930 !! html/php
931 <p><b>foo'</b>bar
932 </p>
933 !! html/parsoid
934 <p><b>foo'</b>bar<b></b>
935 </p>
936 !!end
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
941 !! wikitext
942 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
948 </p>
949 !! end
950
951 ###
952 ### other quote tests
953 ###
954 !! test
955 Italics and bold: other quote tests: (2,3,5)
956 !! wikitext
957 ''this is about '''foo's family'''''
958 !! html
959 <p><i>this is about <b>foo's family</b></i>
960 </p>
961 !!end
962
963
964 !! test
965 Italics and bold: other quote tests: (2,(3,3),2)
966 !! wikitext
967 ''this is about '''foo's''' family''
968 !! html
969 <p><i>this is about <b>foo's</b> family</i>
970 </p>
971 !!end
972
973
974 !! test
975 Italics and bold: other quote tests: (3,2,3,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''this is about ''foo'''s family''
980 !! html/*
981 <p><b>this is about <i>foo</i></b><i>s family</i>
982 </p>
983 !!end
984
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
988 !! test
989 Italics and bold: other quote tests: (3,2,3+2+2,2)
990 !! options
991 parsoid
992 !! wikitext
993 '''this is about ''foo'''''<nowiki/>''s family''
994 !! html/*
995 <p><b>this is about <i>foo</i></b><i>s family</i>
996 </p>
997 !! end
998
999
1000 !! test
1001 Italics and bold: other quote tests: (3,2,3,3)
1002 !! options
1003 !! wikitext
1004 '''this is about ''foo'''s family'''
1005 !! html
1006 <p>'<i>this is about </i>foo<b>s family</b>
1007 </p>
1008 !!end
1009
1010
1011 !! test
1012 Italics and bold: other quote tests: (3,(2,2),3)
1013 !! wikitext
1014 '''this is about ''foo's'' family'''
1015 !! html
1016 <p><b>this is about <i>foo's</i> family</b>
1017 </p>
1018 !!end
1019
1020
1021 !! test
1022 Italicized possessive
1023 !! wikitext
1024 The ''[[Main Page]]'''s talk page.
1025 !! html
1026 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1027 </p>
1028 !! end
1029
1030 !! test
1031 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1032 (Requires tidy for PHP parser output to be fixed up)
1033 !! options
1034 parsoid=wt2html,wt2wt
1035 !! wikitext
1036 {|
1037 !''a!!''b
1038 |''a||''b
1039 |}
1040 !! html
1041 <table>
1042 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1043 <td><i>a</i></td><td><i>b</i></td></tr>
1044 </tbody></table>
1045 !! end
1046
1047 ###
1048 ### Non-html5 tags
1049 ###
1050
1051 !! test
1052 Non-html5 tags should be accepted
1053 !! wikitext
1054 <center>''foo''</center>
1055 <big>''foo''</big>
1056 <font>''foo''</font>
1057 <strike>''foo''</strike>
1058 <tt>''foo''</tt>
1059 !! html
1060 <center><i>foo</i></center>
1061 <p><big><i>foo</i></big>
1062 <font><i>foo</i></font>
1063 <strike><i>foo</i></strike>
1064 <tt><i>foo</i></tt>
1065 </p>
1066 !! end
1067
1068 !! test
1069 <wbr> is valid wikitext (bug 52468)
1070 !! wikitext
1071 <wbr>
1072 !! html
1073 <p><wbr />
1074 </p>
1075 !! end
1076
1077 # <strike> is HTML4, <s> is HTML4/5.
1078 !! test
1079 <s> or <strike> for strikethrough
1080 !! wikitext
1081 <strike>strike</strike>
1082
1083 <s>s</s>
1084 !! html
1085 <p><strike>strike</strike>
1086 </p><p><s>s</s>
1087 </p>
1088 !! end
1089
1090 ## a not permitted
1091 ## i,b,br omitted
1092 !! test
1093 Text-level semantic html elements in wikitext
1094 !! wikitext
1095 <em>text</em>
1096 <strong>text</strong>
1097 <small>text</small>
1098 <s>text</s>
1099 <cite>text</cite>
1100 <q>text</q>
1101 <dfn>text</dfn>
1102 <abbr>text</abbr>
1103 <data>text</data>
1104 <time>text</time>
1105 <code>text</code>
1106 <var>text</var>
1107 <samp>text</samp>
1108 <kbd>text</kbd>
1109 <sub>text</sub>
1110 <u>text</u>
1111 <mark>text</mark>
1112 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1113 <bdi>text</bdi>
1114 <bdo>text</bdo>
1115 <span>text</span>
1116 <wbr />
1117 !! html
1118 <p><em>text</em>
1119 <strong>text</strong>
1120 <small>text</small>
1121 <s>text</s>
1122 <cite>text</cite>
1123 <q>text</q>
1124 <dfn>text</dfn>
1125 <abbr>text</abbr>
1126 <data>text</data>
1127 <time>text</time>
1128 <code>text</code>
1129 <var>text</var>
1130 <samp>text</samp>
1131 <kbd>text</kbd>
1132 <sub>text</sub>
1133 <u>text</u>
1134 <mark>text</mark>
1135 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1136 <bdi>text</bdi>
1137 <bdo>text</bdo>
1138 <span>text</span>
1139 <wbr />
1140 </p>
1141 !! end
1142
1143 # test cases taken from
1144 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1145 !! test
1146 Ruby markup (W3C-style)
1147 !! wikitext
1148 ; Mono-ruby for individual base characters
1149 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1150 ; Group ruby
1151 : <ruby>今日<rt>きょう</rt></ruby>
1152 ; Jukugo ruby
1153 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1154 ; Inline ruby
1155 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1156 ; Double-sided ruby
1157 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1158
1159 <ruby>
1160 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang=fr><rt>Cœur</rt></rtc>
1161 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang=fr><rt>Trèfle</rt></rtc>
1162 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang=fr><rt>Étoile</rt></rtc>
1163 </ruby>
1164 !! html
1165 <dl><dt> Mono-ruby for individual base characters</dt>
1166 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1167 <dt> Group ruby</dt>
1168 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1169 <dt> Jukugo ruby</dt>
1170 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1171 <dt> Inline ruby</dt>
1172 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1173 <dt> Double-sided ruby</dt>
1174 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1175 <p><ruby>
1176 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1177 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1178 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1179 </ruby>
1180 </p>
1181 !! end
1182
1183 !! test
1184 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1185 !! wikitext
1186 <b→> doesn't work! </b→>
1187
1188 <bä> doesn't work! </bä>
1189
1190 <boo> works fine </boo>
1191
1192 <s.foo>s.foo</s.foo>
1193
1194 <sub-ID#1>
1195 !! html
1196 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1197 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1198 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1199 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1200 </p><p>&lt;sub-ID#1&gt;
1201 </p>
1202 !! end
1203
1204 !! test
1205 Isolated close tags should be treated as literal text (bug 52760)
1206 !! wikitext
1207 </b>
1208
1209 <s.foo>s</s>
1210 !! html
1211 <p>&lt;/b&gt;
1212 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1213 </p>
1214 !! end
1215
1216 ###
1217 ### Special characters
1218 ###
1219
1220 !! test
1221 Bare pipe character (bug 52363)
1222 !! wikitext
1223 |
1224 !! html
1225 <p>|
1226 </p>
1227 !! end
1228
1229 !! test
1230 Bare pipe character from a template (bug 52363)
1231 !! wikitext
1232 {{pipe}}
1233 !! html
1234 <p>|
1235 </p>
1236 !! end
1237
1238 ###
1239 ### <nowiki> test cases
1240 ###
1241
1242 !! test
1243 <nowiki> unordered list
1244 !! wikitext
1245 <nowiki>* This is not an unordered list item.</nowiki>
1246 !! html
1247 <p>* This is not an unordered list item.
1248 </p>
1249 !! end
1250
1251 !! test
1252 <nowiki> spacing
1253 !! wikitext
1254 <nowiki>Lorem ipsum dolor
1255
1256 sed abit.
1257 sed nullum.
1258
1259 :and a colon
1260 </nowiki>
1261 !! html
1262 <p>Lorem ipsum dolor
1263
1264 sed abit.
1265 sed nullum.
1266
1267 :and a colon
1268
1269 </p>
1270 !! end
1271
1272 !! test
1273 nowiki 3
1274 !! wikitext
1275 :There is not nowiki.
1276 :There is <nowiki>nowiki</nowiki>.
1277
1278 #There is not nowiki.
1279 #There is <nowiki>nowiki</nowiki>.
1280
1281 *There is not nowiki.
1282 *There is <nowiki>nowiki</nowiki>.
1283 !! html
1284 <dl><dd>There is not nowiki.</dd>
1285 <dd>There is nowiki.</dd></dl>
1286 <ol><li>There is not nowiki.</li>
1287 <li>There is nowiki.</li></ol>
1288 <ul><li>There is not nowiki.</li>
1289 <li>There is nowiki.</li></ul>
1290
1291 !! end
1292
1293 !! test
1294 Entities inside <nowiki>
1295 !! wikitext
1296 <nowiki>&lt;</nowiki>
1297 !! html
1298 <p>&lt;
1299 </p>
1300 !! end
1301
1302 !! test
1303 Entities inside template parameters
1304 !! options
1305 parsoid
1306 !! wikitext
1307 {{echo|&ndash;}}
1308 !! html
1309 <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>
1310 </p>
1311 !! end
1312
1313 !! test
1314 Properly escape nowiki when combined with other wiki markup
1315 !! options
1316 parsoid=html2wt
1317 !! wikitext
1318 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1319 !! html
1320 <p>* &lt;/nowiki&gt; tag</p>
1321 !! end
1322
1323 ###
1324 ### Comments
1325 ###
1326 !! test
1327 Comments and Indent-Pre
1328 !! wikitext
1329 <!-- comment 1 --> asdf
1330
1331 <!-- comment 1 --> asdf
1332 <!-- comment 2 -->
1333
1334 <!-- comment 1 --> asdf
1335 <!-- comment 2 -->xyz
1336
1337 <!-- comment 1 --> asdf
1338 <!-- comment 2 --> xyz
1339 !! html
1340 <pre>asdf
1341 </pre>
1342 <pre>asdf
1343 </pre>
1344 <pre>asdf
1345 </pre>
1346 <p>xyz
1347 </p>
1348 <pre>asdf
1349 xyz
1350 </pre>
1351 !! end
1352
1353 !! test
1354 Comment test 2a
1355 !! wikitext
1356 asdf
1357 <!-- comment 1 -->
1358 jkl
1359 !! html
1360 <p>asdf
1361 jkl
1362 </p>
1363 !! end
1364
1365 !! test
1366 Comment test 2b
1367 !! wikitext
1368 asdf
1369 <!-- comment 1 -->
1370
1371 jkl
1372 !! html
1373 <p>asdf
1374 </p><p>jkl
1375 </p>
1376 !! end
1377
1378 !! test
1379 Comment test 3
1380 !! wikitext
1381 asdf
1382 <!-- comment 1 -->
1383 <!-- comment 2 -->
1384 jkl
1385 !! html
1386 <p>asdf
1387 jkl
1388 </p>
1389 !! end
1390
1391 !! test
1392 Comment test 4
1393 !! wikitext
1394 asdf<!-- comment 1 -->jkl
1395 !! html
1396 <p>asdfjkl
1397 </p>
1398 !! end
1399
1400 !! test
1401 Comment spacing
1402 !! wikitext
1403 a
1404 <!-- foo --> b <!-- bar -->
1405 c
1406 !! html
1407 <p>a
1408 </p>
1409 <pre> b
1410 </pre>
1411 <p>c
1412 </p>
1413 !! end
1414
1415 !! test
1416 Comment whitespace
1417 !! wikitext
1418 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1419 !! html
1420
1421 !! end
1422
1423 !! test
1424 Comment semantics and delimiters
1425 !! wikitext
1426 <!-- --><!----><!-----><!------>
1427 !! html
1428
1429 !! end
1430
1431 !! test
1432 Comment semantics and delimiters, redux
1433 !! wikitext
1434 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1435 -- foo -- funky huh? ... -->
1436 !! html
1437
1438 !! end
1439
1440 !! test
1441 Comment semantics and delimiters: directors cut
1442 !! wikitext
1443 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1444 everything starting with < followed by !-- until the first -- and > we see,
1445 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1446 -->-->
1447 !! html
1448 <p>--&gt;
1449 </p>
1450 !! end
1451
1452 !! test
1453 Comment semantics: nesting
1454 !! wikitext
1455 <!--<!-- no, we're not going to do anything fancy here -->-->
1456 !! html
1457 <p>--&gt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Comment semantics: unclosed comment at end
1463 !! wikitext
1464 <!--This comment will run out to the end of the document
1465 !! html
1466
1467 !! end
1468
1469 !! test
1470 Comment in template title
1471 !! wikitext
1472 {{f<!---->oo}}
1473 !! html
1474 <p>FOO
1475 </p>
1476 !! end
1477
1478 !! test
1479 Comment on its own line post-expand
1480 !! wikitext
1481 a
1482 {{blank}}<!---->
1483 b
1484 !! html
1485 <p>a
1486 </p><p>b
1487 </p>
1488 !! end
1489
1490 !! test
1491 Comment on its own line post-expand with non-significant whitespace
1492 !! wikitext
1493 a
1494 {{blank}} <!---->
1495 b
1496 !! html
1497 <p>a
1498 </p><p>b
1499 </p>
1500 !! end
1501
1502 !! test
1503 Multiple comments should still parse as SOL-transparent
1504 !! options
1505 parsoid=wt2html,wt2wt
1506 !! wikitext
1507 <!--c1-->*a
1508 <!--c2--><!--c3--><!--c4-->*b
1509 !! html
1510 <ul>
1511 <li>a
1512 </li>
1513 <li>b
1514 </li>
1515 </ul>
1516 !! end
1517
1518 ###
1519 ### paragraph wrapping tests
1520 ###
1521 !! test
1522 No block tags
1523 !! wikitext
1524 a
1525
1526 b
1527 !! html
1528 <p>a
1529 </p><p>b
1530 </p>
1531 !! end
1532
1533 !! test
1534 Block tag on one line (<div>)
1535 !! wikitext
1536 a <div>foo</div>
1537
1538 b
1539 !! html
1540 a <div>foo</div>
1541 <p>b
1542 </p>
1543 !! end
1544
1545 !! test
1546 Block tag on one line (<blockquote>)
1547 !! wikitext
1548 a <blockquote>foo</blockquote>
1549
1550 b
1551 !! html
1552 a <blockquote>foo</blockquote>
1553 <p>b
1554 </p>
1555 !! end
1556
1557 !! test
1558 Block tag on both lines (<div>)
1559 !! wikitext
1560 a <div>foo</div>
1561
1562 b <div>foo</div>
1563 !! html
1564 a <div>foo</div>
1565 b <div>foo</div>
1566
1567 !! end
1568
1569 !! test
1570 Block tag on both lines (<blockquote>)
1571 !! wikitext
1572 a <blockquote>foo</blockquote>
1573
1574 b <blockquote>foo</blockquote>
1575 !! html
1576 a <blockquote>foo</blockquote>
1577 b <blockquote>foo</blockquote>
1578
1579 !! end
1580
1581 !! test
1582 Multiple lines without block tags
1583 !! wikitext
1584 <div>foo</div> a
1585 b
1586 c
1587 d<!--foo--> e
1588 x <div>foo</div> z
1589 !! html
1590 <div>foo</div> a
1591 <p>b
1592 c
1593 d e
1594 </p>
1595 x <div>foo</div> z
1596
1597 !! end
1598
1599 !! test
1600 Empty lines between lines with block tags
1601 !! wikitext
1602 <div></div>
1603
1604
1605 <div></div>a
1606
1607 b
1608 <div>a</div>b
1609
1610 <div>b</div>d
1611
1612
1613 <div>e</div>
1614 !! html
1615 <div></div>
1616 <p><br />
1617 </p>
1618 <div></div>a
1619 <p>b
1620 </p>
1621 <div>a</div>b
1622 <div>b</div>d
1623 <p><br />
1624 </p>
1625 <div>e</div>
1626
1627 !! end
1628
1629 ## PHP parser emits output which is broken
1630 !! test
1631 Unclosed HTML p-tags should be handled properly
1632 !! wikitext
1633 <div><p>foo</div>
1634 a
1635
1636 b
1637 !! html/parsoid
1638 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1639 <p>a</p>
1640 <p>b</p>
1641 !! end
1642
1643 ###
1644 ### Preformatted text
1645 ###
1646 !! test
1647 Preformatted text
1648 !! wikitext
1649 This is some
1650 Preformatted text
1651 With ''italic''
1652 And '''bold'''
1653 And a [[Main Page|link]]
1654 !! html
1655 <pre>This is some
1656 Preformatted text
1657 With <i>italic</i>
1658 And <b>bold</b>
1659 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1660 </pre>
1661 !! end
1662
1663 !! test
1664 Tabs don't trigger preformatted text
1665 !! wikitext
1666 This is not
1667 preformatted text.
1668 This is preformatted text.
1669 So is this.
1670 !! html
1671 <p> This is not
1672 preformatted text.
1673 </p>
1674 <pre>This is preformatted text.
1675 So is this.
1676 </pre>
1677 !! end
1678
1679 !! test
1680 Ident preformatting with inline content
1681 !! wikitext
1682 a
1683 ''b''
1684 !! html
1685 <pre>a
1686 <i>b</i>
1687 </pre>
1688 !! end
1689
1690 !! test
1691 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1692 !! wikitext
1693 <pre><nowiki>
1694 <b>
1695 <cite>
1696 <em>
1697 </nowiki></pre>
1698 !! html
1699 <pre>
1700 &lt;b&gt;
1701 &lt;cite&gt;
1702 &lt;em&gt;
1703 </pre>
1704
1705 !! end
1706
1707 !! test
1708 Regression with preformatted in <center>
1709 !! wikitext
1710 <center>
1711 Blah
1712 </center>
1713 !! html
1714 <center>
1715 <pre>Blah
1716 </pre>
1717 </center>
1718
1719 !! end
1720
1721 !! test
1722 Bug 52763: Preformatted in <blockquote>
1723 !! wikitext
1724 <blockquote>
1725 Blah
1726 {|
1727 |
1728 indented cell (no pre-wrapping!)
1729 |}
1730 </blockquote>
1731 !! html
1732 <blockquote>
1733 <p> Blah
1734 </p>
1735 <table>
1736 <tr>
1737 <td>
1738 <p> indented cell (no pre-wrapping!)
1739 </p>
1740 </td></tr></table>
1741 </blockquote>
1742
1743 !! end
1744
1745 !! test
1746 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1747 !! wikitext
1748 <blockquote>
1749 Foo
1750
1751 Bar
1752 </blockquote>
1753 !! html
1754 <blockquote>
1755 <p>Foo
1756 </p><p>Bar
1757 </p>
1758 </blockquote>
1759
1760 !! end
1761
1762 !! test
1763 Bug 15491: <ins>/<del> in blockquote
1764 !! wikitext
1765 <blockquote>
1766 Foo <del>bar</del> <ins>baz</ins> quux
1767 </blockquote>
1768 !! html
1769 <blockquote>
1770 <p>Foo <del>bar</del> <ins>baz</ins> quux
1771 </p>
1772 </blockquote>
1773
1774 !! end
1775
1776 # Note that the p-wrapping is newline sensitive, which could be
1777 # considered a bug: tidy will wrap only the 'Foo' in the example
1778 # below in a <p> tag. (see comment 23-25 of bug #6200)
1779 !! test
1780 Bug 15491: <ins>/<del> in blockquote (2)
1781 !! wikitext
1782 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1783 </blockquote>
1784 !! html
1785 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1786 </blockquote>
1787
1788 !! end
1789
1790 !! test
1791 <pre> with attributes (bug 3202)
1792 !! wikitext
1793 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1794 !! html
1795 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1796
1797 !! end
1798
1799 !! test
1800 <pre> with width attribute (bug 3202)
1801 !! wikitext
1802 <pre width="8">Narrow screen goodies</pre>
1803 !! html
1804 <pre width="8">Narrow screen goodies</pre>
1805
1806 !! end
1807
1808 !! test
1809 <pre> with forbidden attribute (bug 3202)
1810 !! wikitext
1811 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1812 !! html
1813 <pre width="8">Narrow screen goodies</pre>
1814
1815 !! end
1816
1817 !! test
1818 Entities inside <pre>
1819 !! wikitext
1820 <pre>&lt;</pre>
1821 !! html
1822 <pre>&lt;</pre>
1823
1824 !! end
1825
1826 !! test
1827 <pre> with forbidden attribute values (bug 3202)
1828 !! wikitext
1829 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1830 !! html
1831 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1832
1833 !! end
1834
1835 !! test
1836 <nowiki> inside <pre> (bug 13238)
1837 !! wikitext
1838 <pre>
1839 <nowiki>
1840 </pre>
1841 <pre>
1842 <nowiki></nowiki>
1843 </pre>
1844 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1845 !! html
1846 <pre>
1847 &lt;nowiki&gt;
1848 </pre>
1849 <pre>
1850
1851 </pre>
1852 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1853
1854 !! end
1855
1856 !! test
1857 <nowiki> and <pre> preference (first one wins)
1858 !! wikitext
1859 <pre>
1860 <nowiki>
1861 </pre>
1862 </nowiki>
1863 </pre>
1864
1865 <nowiki>
1866 <pre>
1867 <nowiki>
1868 </pre>
1869 </nowiki>
1870 </pre>
1871
1872 !! html
1873 <pre>
1874 &lt;nowiki&gt;
1875 </pre>
1876 <p>&lt;/nowiki&gt;
1877 &lt;/pre&gt;
1878 </p><p>
1879 &lt;pre&gt;
1880 &lt;nowiki&gt;
1881 &lt;/pre&gt;
1882
1883 &lt;/pre&gt;
1884 </p>
1885 !! end
1886
1887 !! test
1888 </pre> inside nowiki
1889 !! wikitext
1890 <nowiki></pre></nowiki>
1891 !! html
1892 <p>&lt;/pre&gt;
1893 </p>
1894 !! end
1895
1896 !! test
1897 Empty pre; pre inside other HTML tags (bug 54946)
1898 !! wikitext
1899 a
1900
1901 <div><pre>
1902 foo
1903 </pre></div>
1904 <pre></pre>
1905 !! html
1906 <p>a
1907 </p>
1908 <div><pre>
1909 foo
1910 </pre></div>
1911 <pre></pre>
1912
1913 !! end
1914
1915 !! test
1916 HTML pre followed by indent-pre
1917 !! wikitext
1918 <pre>foo</pre>
1919 bar
1920 !! html
1921 <pre>foo</pre>
1922 <pre>bar
1923 </pre>
1924 !! end
1925
1926 !!test
1927 Block tag pre
1928 !!options
1929 parsoid
1930 !! wikitext
1931 <p><pre>foo</pre></p>
1932 !! html
1933 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1934 !!end
1935
1936 !!test
1937 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1938 !! wikitext
1939 {{echo|}}
1940 !! html
1941
1942 !!end
1943
1944 !!test
1945 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1946 !! wikitext
1947 {{echo|
1948 foo}}
1949 !! html
1950 <p>foo
1951 </p>
1952 !!end
1953
1954 !! test
1955 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1956 !! wikitext
1957 {{echo|a
1958 b}}
1959 !! html
1960 <pre>a
1961 </pre>
1962 <p>b
1963 </p>
1964 !!end
1965
1966 !! test
1967 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1968 !! wikitext
1969 {{echo|a
1970 b
1971 c
1972 d
1973 e
1974 }}
1975 !! html
1976 <pre>a
1977 </pre>
1978 <p>b
1979 c
1980 </p>
1981 <pre>d
1982 </pre>
1983 <p>e
1984 </p>
1985 !!end
1986
1987 !!test
1988 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1989 !! wikitext
1990 {{echo| foo}}
1991
1992 {{echo| foo}}{{echo| bar}}
1993
1994 {{echo| foo}}
1995 {{echo| bar}}
1996
1997 {{echo|<!--cmt--> foo}}
1998
1999 <!--cmt-->{{echo| foo}}
2000
2001 {{echo|{{echo| }}bar}}
2002 !! html
2003 <pre>foo
2004 </pre>
2005 <pre>foo bar
2006 </pre>
2007 <pre>foo
2008 bar
2009 </pre>
2010 <pre>foo
2011 </pre>
2012 <pre>foo
2013 </pre>
2014 <pre>bar
2015 </pre>
2016 !!end
2017
2018 !! test
2019 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2020 !! wikitext
2021 {{echo| }}a
2022
2023 {{echo|
2024 }}a
2025
2026 {{echo|
2027 b}}
2028
2029 {{echo|a
2030 }}b
2031
2032 {{echo|a
2033 }} b
2034 !! html
2035 <pre>a
2036 </pre>
2037 <p><br />
2038 </p>
2039 <pre>a
2040 </pre>
2041 <p><br />
2042 </p>
2043 <pre>b
2044 </pre>
2045 <p>a
2046 </p>
2047 <pre>b
2048 </pre>
2049 <p>a
2050 </p>
2051 <pre>b
2052 </pre>
2053 !!end
2054
2055 !! test
2056 Things that look like <pre> tags aren't treated as such
2057 !! wikitext
2058 Barack Obama <President> of the United States
2059 <President></President>
2060 !! html
2061 <p>Barack Obama &lt;President&gt; of the United States
2062 &lt;President&gt;&lt;/President&gt;
2063 </p>
2064 !! end
2065
2066 ## PHP parser discards the "<pre " string
2067 !! test
2068 Handle broken pre-like tags (bug 64025)
2069 !! options
2070 parsoid=wt2html
2071 !! wikitext
2072 {{echo|<pre <pre>x</pre>}}
2073
2074 <table><pre </table>
2075 !! html/php
2076 <pre>x</pre>
2077 <table><pre></pre></table>
2078
2079 !! html/parsoid
2080 <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>
2081 <pre>x</pre>
2082
2083 <span>&lt;pre </span>
2084 <table></table>
2085 !! end
2086
2087 !! test
2088 Parsoid: handle pre with space after attribute
2089 !! options
2090 parsoid=wt2html
2091 !! wikitext
2092 <pre style="width:50%;" >{{echo|foo}}</pre>
2093 !! html
2094 <pre style="width:50%;">{{echo|foo}}</pre>
2095 !! end
2096
2097 # TODO / maybe: fix wt2wt for this
2098 !! test
2099 Parsoid: Don't paragraph-wrap fosterable content
2100 !! options
2101 parsoid=wt2html
2102 !! wikitext
2103 {|
2104 <td></td>
2105 <td></td>
2106
2107
2108
2109 |}
2110 !! html
2111 <table>
2112
2113 <tbody>
2114 <tr>
2115 <td></td>
2116
2117 <td></td></tr>
2118
2119
2120
2121 </tbody></table>
2122 !! end
2123
2124 !! test
2125 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2126 !! options
2127 parsoid=wt2html
2128 !! wikitext
2129 {|
2130 <td>
2131 <td>
2132 </td>
2133
2134
2135
2136 |}
2137 !! html
2138 <table>
2139
2140 <tbody>
2141 <tr>
2142 <td></td>
2143
2144 <td>
2145 </td></tr>
2146
2147
2148
2149 </tbody></table>
2150 !! end
2151
2152
2153 #--------------------------------------------------------------------
2154 # Transclusion parameter whitespace stripping tests
2155 # Behavior is different for positional and named parameters
2156 #--------------------------------------------------------------------
2157 !! test
2158 Templates: Strip leading and trailing whitespace from named-param values
2159 !! wikitext
2160 {{echo|1= a }}
2161
2162 {{echo|1= {{echo|b}} }}
2163
2164 {{echo| 1 =
2165 c }}
2166
2167 {{echo| 1 =
2168 * d
2169 }}
2170 !! html
2171 <p>a
2172 </p><p>b
2173 </p><p>c
2174 </p>
2175 <ul><li> d</li></ul>
2176
2177 !! end
2178
2179 !! test
2180 Templates: Don't strip whitespace from positional-param values
2181 !! wikitext
2182 {{echo|a }}
2183
2184 {{echo|{{echo|b}} }}
2185
2186 {{echo| c
2187 }}
2188
2189 {{echo| {{echo|d}}
2190 }}
2191
2192 {{echo|
2193 e}}
2194
2195 {{echo|
2196 * f}}
2197
2198 {{echo|
2199 }}g
2200 !! html
2201 <p>a
2202 </p><p>b
2203 </p>
2204 <pre>c
2205 </pre>
2206 <p><br />
2207 </p>
2208 <pre>d
2209 </pre>
2210 <p><br />
2211 </p>
2212 <pre>e
2213 </pre>
2214 <p><br />
2215 </p>
2216 <ul><li> f</li></ul>
2217 <p><br />
2218 </p>
2219 <pre>g
2220 </pre>
2221 !! end
2222
2223 !! test
2224 Templates: Handle empty comment-and-ws-only lines correctly
2225 !! wikitext
2226 {{echo|foo
2227 <!--should be ignored-->
2228 <!--should be ignored as well-->
2229 bar}}
2230 !! html
2231 <p>foo
2232 bar
2233 </p>
2234 !! end
2235
2236 !! test
2237 Templates: Handle comments in the target
2238 !! wikitext
2239 {{echo
2240 <!-- should be ignored -->
2241 |foo}}
2242
2243 {{echo<!-- should be ignored -->
2244 |foo}}
2245
2246 {{echo<!-- should be ignored -->|foo}}
2247
2248 {{<!-- should be ignored -->echo|foo}}
2249 !!html/parsoid
2250 <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>
2251
2252 <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>
2253
2254 <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>
2255
2256 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2257 !!end
2258
2259 #--------------------------------------------------------------------
2260 # Transclusion parameter escaping tests
2261 #--------------------------------------------------------------------
2262 !! test
2263 Templates: Parsoid parameter escaping test 1
2264 !! options
2265 parsoid
2266 !! wikitext
2267 {{echo|[foo]|{{echo|[bar]}}}}
2268 !! html
2269 <p about="#mwt1" typeof="mw:Transclusion"
2270 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2271 !! end
2272
2273 !! test
2274 Parsoid: Pipes in external links in template parameter
2275 !! options
2276 parsoid
2277 !! wikitext
2278 {{echo|[{{echo|http://example.com}} link]}}
2279 !! html
2280 <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>
2281 !! end
2282
2283 !! test
2284 Parsoid: pipe in transclusion parameter
2285 !! options
2286 parsoid
2287 !! wikitext
2288 {{echo|http://foo.com/a&#124;b}}
2289 !! html
2290 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2291 typeof="mw:Transclusion"
2292 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>
2293 !! end
2294
2295 !! test
2296 Parsoid: Pipe in external link target and content in template parameter
2297 !! options
2298 parsoid=html2wt,wt2wt
2299 !! wikitext
2300 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2301 !! html
2302 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2303 typeof="mw:Transclusion"
2304 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2305 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2306 !! end
2307
2308 !! test
2309 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2310 !! options
2311 parsoid
2312 !! wikitext
2313 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2314 !! html
2315 <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>
2316 !! end
2317
2318 !! test
2319 Templates: Don't escape already nowiki-escaped text in template parameters
2320 !! options
2321 parsoid=html2wt,wt2wt
2322 !! wikitext
2323 {{echo|foo<nowiki>|</nowiki>bar}}
2324 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2325 {{echo|<nowiki></nowiki>}}
2326 !! html
2327 <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>
2328 <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>
2329 <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>
2330 </p>
2331 !! end
2332
2333 ## Bug 52824
2334 !! test
2335 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2336 !! options
2337 parsoid=html2wt,wt2wt
2338 !! wikitext
2339 {{echo|{{echo|1=bar}}}}
2340 !! html
2341 <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>
2342 !! end
2343
2344 ## Bug 56733
2345 !! test
2346 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2347 !! options
2348 parsoid
2349 !! wikitext
2350 {{echo|a : b}}
2351 !! html
2352 <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>
2353 !! end
2354
2355 ###
2356 ### Parsoid-centric tests for testing RT edge cases for pre
2357 ###
2358
2359 !!test
2360 1a. Indent-Pre and Comments
2361 !! wikitext
2362 a
2363 <!--a-->
2364 c
2365 !! html
2366 <pre>a
2367 </pre>
2368 <p>c
2369 </p>
2370 !!end
2371
2372 !!test
2373 1b. Indent-Pre and Comments
2374 !! wikitext
2375 a
2376 <!--a-->
2377 c
2378 !! html
2379 <pre>a
2380 </pre>
2381 <p>c
2382 </p>
2383 !!end
2384
2385 !!test
2386 1c. Indent-Pre and Comments
2387 !! wikitext
2388 <!--a--> a
2389
2390 <!--a--> a
2391 !! html
2392 <pre> a
2393 </pre>
2394 <pre> a
2395 </pre>
2396 !!end
2397
2398 !!test
2399 1d. Indent-Pre and Comments
2400 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2401 !! wikitext
2402 <!--a--> a
2403
2404 <!--b-->b
2405 !! html
2406 <pre>a
2407 </pre>
2408 <pre>b
2409 </pre>
2410 !!end
2411
2412 !!test
2413 2a. Indent-Pre and tables
2414 !! wikitext
2415 {|
2416 |-
2417 !h1!!h2
2418 |foo||bar
2419 |}
2420 !! html
2421 <table>
2422
2423 <tr>
2424 <th>h1</th>
2425 <th>h2
2426 </th>
2427 <td>foo</td>
2428 <td>bar
2429 </td></tr></table>
2430
2431 !!end
2432
2433 !!test
2434 2b. Indent-Pre and tables
2435 !! wikitext
2436 {|
2437 |-
2438 |foo
2439 |}
2440 !! html
2441 <table>
2442
2443 <tr>
2444 <td>foo
2445 </td></tr></table>
2446
2447 !!end
2448
2449 !!test
2450 2c. Indent-Pre and tables (bug 42252)
2451 !! wikitext
2452 {|
2453 |+ foo
2454 ! | bar
2455 |}
2456 !! html
2457 <table>
2458 <caption> foo
2459 </caption>
2460 <tr>
2461 <th> bar
2462 </th></tr></table>
2463
2464 !!end
2465
2466 !!test
2467 2d. Indent-Pre and tables
2468 !! wikitext
2469 a
2470 {|
2471 | b
2472 |}
2473 !! html/php
2474 <pre>a
2475 </pre>
2476 <table>
2477 <tr>
2478 <td> b
2479 </td></tr></table>
2480
2481 !! html/parsoid
2482 <pre>a</pre>
2483
2484 <table>
2485
2486 <tbody>
2487 <tr>
2488 <td> b</td></tr>
2489 </tbody></table>
2490 !!end
2491
2492 !!test
2493 2e. Indent-Pre and table-line syntax
2494 !! wikitext
2495 a
2496 | b
2497 | c
2498 !! html/parsoid
2499 <pre>a
2500 | b
2501 | c</pre>
2502 !!end
2503
2504 !!test
2505 2f. Indent-pre started by table-line syntax
2506 !! wikitext
2507 a
2508 | b
2509 | c
2510 !! html/parsoid
2511 <p>a</p>
2512 <pre>
2513 | b
2514 | c</pre>
2515 !!end
2516
2517 !!test
2518 3a. Indent-Pre and block tags (single-line html)
2519 !! wikitext
2520 a <p> foo </p>
2521 b <div> foo </div>
2522 c <blockquote> foo </blockquote>
2523 <span> foo </span>
2524 !! html
2525 a <p> foo </p>
2526 b <div> foo </div>
2527 c <blockquote> foo </blockquote>
2528 <pre><span> foo </span>
2529 </pre>
2530 !!end
2531
2532 !!test
2533 3b. Indent-Pre and block tags (multi-line html)
2534 !! wikitext
2535 a <span>foo</span>
2536 b <div> foo </div>
2537 !! html
2538 <pre>a <span>foo</span>
2539 </pre>
2540 b <div> foo </div>
2541
2542 !!end
2543
2544 !!test
2545 3c. Indent-Pre and block tags (pre-content on separate line)
2546 !! wikitext
2547 <p>
2548 foo
2549 </p>
2550
2551 <div>
2552 foo
2553 </div>
2554
2555 <center>
2556 foo
2557 </center>
2558
2559 <blockquote>
2560 foo
2561 </blockquote>
2562
2563 <blockquote>
2564 <pre>
2565 foo
2566 </pre>
2567 </blockquote>
2568
2569 <table><tr><td>
2570 foo
2571 </td></tr></table>
2572
2573 <ul><li>
2574 foo
2575 </li></ul>
2576
2577 !! html
2578 <p>
2579 foo
2580 </p>
2581 <div>
2582 <pre>foo
2583 </pre>
2584 </div>
2585 <center>
2586 <pre>foo
2587 </pre>
2588 </center>
2589 <blockquote>
2590 <p> foo
2591 </p>
2592 </blockquote>
2593 <blockquote>
2594 <pre>
2595 foo
2596 </pre>
2597 </blockquote>
2598 <table><tr><td>
2599 <pre>foo
2600 </pre>
2601 </td></tr></table>
2602 <ul><li>
2603 foo
2604 </li></ul>
2605
2606 !!end
2607
2608 !!test
2609 4. Indent-Pre and extension tags
2610 !! wikitext
2611 a <gallery>
2612 File:foobar.jpg
2613 </gallery>
2614 !! html
2615 a <ul class="gallery mw-gallery-traditional">
2616 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2617 <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>
2618 <div class="gallerytext">
2619 </div>
2620 </div></li>
2621 </ul>
2622
2623 !!end
2624
2625 !! test
2626 Leading pipes outside of tables
2627 !! options
2628 parsoid
2629 !! wikitext
2630 | foo
2631 !! html
2632 <p>| foo</p>
2633 !! end
2634
2635 !! test
2636 Leading pipes outside of tables 2
2637 !! options
2638 parsoid
2639 !! wikitext
2640 a
2641 | foo
2642 b
2643 !! html
2644 <p>a
2645 | foo
2646 b</p>
2647 !! end
2648
2649 !! test
2650 Leading pipes outside of tables 3
2651 !! options
2652 parsoid
2653 !! wikitext
2654 a
2655 | class="foo bar" | baz
2656 b
2657 !! html
2658 <p>a
2659 | class="foo bar" | baz
2660 b</p>
2661 !! end
2662
2663 !!test
2664 Render paragraphs when indent-pre is suppressed in blocklevels
2665 !! wikitext
2666 <blockquote>
2667 foo
2668
2669 bar
2670 </blockquote>
2671 !! html
2672 <blockquote>
2673 <p> foo
2674 </p><p> bar
2675 </p>
2676 </blockquote>
2677
2678 !!end
2679
2680 !!test
2681 4. Multiple spaces at start-of-line
2682 !! wikitext
2683 <p> foo </p>
2684 foo
2685 {|
2686 |foo
2687 |}
2688 !! html
2689 <p> foo </p>
2690 <pre> foo
2691 </pre>
2692 <table>
2693 <tr>
2694 <td>foo
2695 </td></tr></table>
2696
2697 !!end
2698
2699 ## NOTE: the leading white-space chars on empty line are significant
2700 !! test
2701 5a. White-space in indent-pre
2702 !! wikitext
2703 a<br />
2704
2705 b
2706 !! html
2707 <pre>a<br />
2708
2709 b
2710 </pre>
2711 !! end
2712
2713 ## NOTE: the leading white-space chars on empty line are significant
2714 !! test
2715 5b. White-space in indent-pre
2716 !! wikitext
2717 a
2718
2719 b
2720
2721
2722 c
2723 !! html
2724 <pre>a
2725
2726 b
2727
2728
2729 c
2730 </pre>
2731 !! end
2732
2733 !! test
2734 5c. White-space in indent-pre
2735 !! wikitext
2736 ''a''
2737 ''b''
2738 ''c''
2739 !! html
2740 <pre><i>a</i>
2741 <i>b</i>
2742 <i>c</i>
2743 </pre>
2744 !! end
2745
2746 !! test
2747 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2748 !! wikitext
2749 a
2750
2751 <!-- continue -->
2752 b
2753
2754 c
2755
2756 d
2757 !! html
2758 <pre>a
2759
2760 b
2761 </pre>
2762 <pre>c
2763
2764 </pre>
2765 <p>d
2766 </p>
2767 !! end
2768
2769 !! test
2770 7a. Indent-pre and category links
2771 !! options
2772 parsoid=wt2html,wt2wt
2773 !! wikitext
2774 [[Category:foo]] <!-- No pre-wrapping -->
2775 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2776 !! html
2777 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2778 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2779 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2780 !! end
2781
2782 !! test
2783 7b. Indent-pre and category links
2784 !! options
2785 parsoid=wt2html,wt2wt
2786 !! wikitext
2787 [[Category:foo]] a
2788 [[Category:foo]] {{echo|b}}
2789 !! html
2790 <pre>
2791 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2792
2793 <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>
2794 !! end
2795
2796 ###
2797 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2798 ###
2799
2800 !!test
2801 HTML-pre: 1. embedded newlines
2802 !! wikitext
2803 <pre>foo</pre>
2804
2805 <pre>
2806 foo
2807 </pre>
2808
2809 <pre>
2810
2811 foo
2812 </pre>
2813
2814 <pre>
2815
2816
2817 foo
2818 </pre>
2819 !! html
2820 <pre>foo</pre>
2821 <pre>
2822 foo
2823 </pre>
2824 <pre>
2825
2826 foo
2827 </pre>
2828 <pre>
2829
2830
2831 foo
2832 </pre>
2833
2834 !! html/parsoid
2835 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2836
2837 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2838 foo
2839 </pre>
2840
2841 <pre data-parsoid='{"stx":"html"}'>
2842
2843 foo
2844 </pre>
2845
2846 <pre data-parsoid='{"stx":"html"}'>
2847
2848
2849 foo
2850 </pre>
2851 !!end
2852
2853 !! test
2854 HTML-pre: big spaces
2855 !! wikitext
2856 <pre>
2857
2858
2859
2860
2861 haha
2862
2863
2864
2865
2866 haha
2867
2868
2869
2870
2871 </pre>
2872 !! html
2873 <pre>
2874
2875
2876
2877
2878 haha
2879
2880
2881
2882
2883 haha
2884
2885
2886
2887
2888 </pre>
2889
2890 !! html/parsoid
2891 <pre data-parsoid='{"stx":"html"}'>
2892
2893
2894
2895
2896 haha
2897
2898
2899
2900
2901 haha
2902
2903
2904
2905
2906 </pre>
2907 !! end
2908
2909 !!test
2910 HTML-pre: 2: indented text
2911 !! wikitext
2912 <pre>
2913 foo
2914 </pre>
2915 !! html
2916 <pre>
2917 foo
2918 </pre>
2919
2920 !!end
2921
2922 !!test
2923 HTML-pre: 3: other wikitext
2924 !! wikitext
2925 <pre>
2926 * foo
2927 # bar
2928 = no-h =
2929 '' no-italic ''
2930 [[ NoLink ]]
2931 </pre>
2932 !! html
2933 <pre>
2934 * foo
2935 # bar
2936 = no-h =
2937 '' no-italic ''
2938 [[ NoLink ]]
2939 </pre>
2940
2941 !!end
2942
2943 ###
2944 ### Definition lists
2945 ###
2946 !! test
2947 Simple definition
2948 !! wikitext
2949 ; name : Definition
2950 !! html
2951 <dl><dt> name&#160;</dt>
2952 <dd> Definition</dd></dl>
2953
2954 !! end
2955
2956 !! test
2957 Definition list for indentation only
2958 !! wikitext
2959 : Indented text
2960 !! html
2961 <dl><dd> Indented text</dd></dl>
2962
2963 !! end
2964
2965 !! test
2966 Definition list with no space
2967 !! wikitext
2968 ;name:Definition
2969 !! html
2970 <dl><dt>name</dt>
2971 <dd>Definition</dd></dl>
2972
2973 !!end
2974
2975 !! test
2976 Definition list with URL link
2977 !! wikitext
2978 ; http://example.com/ : definition
2979 !! html
2980 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2981 <dd> definition</dd></dl>
2982
2983 !! end
2984
2985 !! test
2986 Definition list with bracketed URL link
2987 !! wikitext
2988 ;[http://www.example.com/ Example]:Something about it
2989 !! html
2990 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2991 <dd>Something about it</dd></dl>
2992
2993 !! end
2994
2995 !! test
2996 Definition list with wikilink containing colon
2997 !! wikitext
2998 ; [[Help:FAQ]]: The least-read page on Wikipedia
2999 !! html
3000 <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>
3001 <dd> The least-read page on Wikipedia</dd></dl>
3002
3003 !! end
3004
3005 # At Brion's and JeLuF's insistence... :)
3006 !! test
3007 Definition list with news link containing colon
3008 !! wikitext
3009 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3010 !! html
3011 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3012 <dd> This isn't even a real newsgroup!</dd></dl>
3013
3014 !! end
3015
3016 !! test
3017 Malformed definition list with colon
3018 !! wikitext
3019 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3020 !! html
3021 <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>
3022
3023 !! end
3024
3025 !! test
3026 Definition lists: colon in external link text
3027 !! wikitext
3028 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3029 !! html
3030 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3031 <dd> OK, I made that up</dd></dl>
3032
3033 !! end
3034
3035 !! test
3036 Definition lists: colon in HTML attribute
3037 !! wikitext
3038 ;<b style="display: inline">bold</b>
3039 !! html
3040 <dl><dt><b style="display: inline">bold</b></dt></dl>
3041
3042 !! end
3043
3044 !! test
3045 Definition lists: self-closed tag
3046 !! wikitext
3047 ;one<br/>two : two-line fun
3048 !! html
3049 <dl><dt>one<br />two&#160;</dt>
3050 <dd> two-line fun</dd></dl>
3051
3052 !! end
3053
3054 !! test
3055 Bug 11748: Literal closing tags
3056 !! wikitext
3057 <dl>
3058 <dt>test 1</dt>
3059 <dd>test test test test test</dd>
3060 <dt>test 2</dt>
3061 <dd>test test test test test</dd>
3062 </dl>
3063 !! html
3064 <dl>
3065 <dt>test 1</dt>
3066 <dd>test test test test test</dd>
3067 <dt>test 2</dt>
3068 <dd>test test test test test</dd>
3069 </dl>
3070
3071 !! end
3072
3073 !! test
3074 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3075 !! wikitext
3076 <ul><li>
3077 ; term : description
3078 * unordered
3079 </li></ul>
3080 !! html
3081 <ul><li>
3082 <dl><dt> term&#160;</dt>
3083 <dd> description</dd></dl>
3084 <ul><li> unordered</li></ul>
3085 </li></ul>
3086
3087 !! end
3088
3089 !! test
3090
3091 Definition list with empty definition and following paragraph
3092 !! wikitext
3093 ; term:
3094 Paragraph text
3095 !! html
3096 <dl><dt> term</dt>
3097 <dd></dd></dl>
3098 <p>Paragraph text
3099 </p>
3100 !! end
3101
3102 !! test
3103 Nested definition lists using html syntax
3104 !! wikitext
3105 <dl><dt>x</dt>
3106 <dd>a</dd>
3107 <dd>b</dd></dl>
3108
3109 !! end
3110
3111 !! test
3112 Definition Lists: No nesting: Multiple dd's
3113 !! wikitext
3114 ;x
3115 :a
3116 :b
3117 !! html
3118 <dl><dt>x</dt>
3119 <dd>a</dd>
3120 <dd>b</dd></dl>
3121
3122 !! end
3123
3124 !! test
3125 Definition Lists: Indentation: Regular
3126 !! wikitext
3127 :i1
3128 ::i2
3129 :::i3
3130 !! html
3131 <dl><dd>i1
3132 <dl><dd>i2
3133 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3134
3135 !! end
3136
3137 !! test
3138 Definition Lists: Indentation: Missing 1st level
3139 !! wikitext
3140 ::i2
3141 :::i3
3142 !! html
3143 <dl><dd><dl><dd>i2
3144 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3145
3146 !! end
3147
3148 !! test
3149 Definition Lists: Indentation: Multi-level indent
3150 !! wikitext
3151 :::i3
3152 !! html
3153 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3154
3155 !! end
3156
3157 !! test
3158 Definition Lists: Hacky use to indent tables
3159 !! wikitext
3160 ::{|
3161 |foo
3162 |bar
3163 |}
3164 this text
3165 should be left alone
3166 !! html
3167 <dl><dd><dl><dd><table>
3168 <tr>
3169 <td>foo
3170 </td>
3171 <td>bar
3172 </td></tr></table></dd></dl></dd></dl>
3173 <p>this text
3174 should be left alone
3175 </p>
3176 !! end
3177
3178 !! test
3179 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3180 !! wikitext
3181 <!-- foo -->
3182 ::{|
3183 |foo
3184 |bar
3185 |}<!-- bar -->
3186 this text
3187 should be left alone
3188 !! html/parsoid
3189 <!-- foo -->
3190 <dl><dd><dl><dd><table><tr>
3191 <td>foo</td>
3192 <td>bar</td>
3193 </tr></table><!-- bar --></dd></dl></dd></dl>
3194 <p>this text
3195 should be left alone</p>
3196 !! end
3197
3198 !! test
3199 Definition Lists: Hacky use to indent tables, with comment before table
3200 !! wikitext
3201 ::<!-- foo -->{|
3202 |foo
3203 |}
3204 !! html/parsoid
3205 <dl><dd><dl><dd><!-- foo --><table><tr>
3206 <td>foo</td>
3207 </tr></table></dd></dl></dd></dl>
3208 !! end
3209
3210 # Bug 52473
3211 !! test
3212 Definition Lists: Hacky use to indent tables (WS-insensitive)
3213 !! options
3214 parsoid
3215 !! wikitext
3216 : {|
3217 |a
3218 |}
3219 !! html
3220 <dl>
3221 <dd> <table><tr><td>a</td></tr></table> </dd>
3222 </dl>
3223 !! end
3224 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3225 ## as an empty dt item. It also ignores all but the last ";" when followed
3226 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3227 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3228 ## ";"s.
3229 ##
3230 ## Ex: ";;t2 ::d2" is transformed into:
3231 ##
3232 ## <dl>
3233 ## <dt>t2 </dt>
3234 ## <dd>
3235 ## <dl>
3236 ## <dt></dt>
3237 ## <dd>d2</dd>
3238 ## </dl>
3239 ## </dd>
3240 ## </dl>
3241 ##
3242 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3243 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3244 ##
3245 ## <dl>
3246 ## <dt>
3247 ## <dl>
3248 ## <dt>t2 </dt>
3249 ## <dd>:d2</dd>
3250 ## </dl>
3251 ## </dt>
3252 ## </dl>
3253 ##
3254 ## All Parsoid only definition list tests have this difference.
3255 ##
3256 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3257 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3258
3259 !! test
3260 Table / list interaction: indented table with lists in table contents
3261 !! wikitext
3262 :{|
3263 |-
3264 | a
3265 * b
3266 |-
3267 | c
3268 * d
3269 |}
3270 !! html
3271 <dl><dd><table>
3272
3273 <tr>
3274 <td> a
3275 <ul><li> b</li></ul>
3276 </td></tr>
3277 <tr>
3278 <td> c
3279 <ul><li> d</li></ul>
3280 </td></tr></table></dd></dl>
3281
3282 !! end
3283
3284 !!test
3285 Table / list interaction: lists nested in tables nested in indented lists
3286 !! wikitext
3287 :{|
3288 |
3289 :a
3290 :b
3291 |
3292 *c
3293 *d
3294 |}
3295
3296 *e
3297 *f
3298 !! html
3299 <dl><dd><table>
3300 <tr>
3301 <td>
3302 <dl><dd>a</dd>
3303 <dd>b</dd></dl>
3304 </td>
3305 <td>
3306 <ul><li>c</li>
3307 <li>d</li></ul>
3308 </td></tr></table></dd></dl>
3309 <ul><li>e</li>
3310 <li>f</li></ul>
3311
3312 !!end
3313
3314 !! test
3315 Definition Lists: Nesting: Multi-level (Parsoid only)
3316 !! options
3317 parsoid
3318 !! wikitext
3319 ;t1 :d1
3320 ;;t2 ::d2
3321 ;;;t3 :::d3
3322 !! html
3323 <dl>
3324 <dt>t1 </dt>
3325 <dd>d1</dd>
3326 <dt>
3327 <dl>
3328 <dt>t2 </dt>
3329 <dd>:d2</dd>
3330 <dt>
3331 <dl>
3332 <dt>t3 </dt>
3333 <dd>::d3</dd>
3334 </dl>
3335 </dt>
3336 </dl>
3337 </dt>
3338 </dl>
3339
3340
3341 !! end
3342
3343
3344 !! test
3345 Definition Lists: Nesting: Test 2 (Parsoid only)
3346 !! options
3347 parsoid
3348 !! wikitext
3349 ;t1
3350 ::d2
3351 !! html
3352 <dl>
3353 <dt>t1</dt>
3354 <dd>
3355 <dl>
3356 <dd>d2</dd>
3357 </dl>
3358 </dd>
3359 </dl>
3360
3361 !! end
3362
3363
3364 !! test
3365 Definition Lists: Nesting: Test 3 (Parsoid only)
3366 !! options
3367 parsoid
3368 !! wikitext
3369 :;t1
3370 ::::d2
3371 !! html
3372 <dl>
3373 <dd>
3374 <dl>
3375 <dt>t1</dt>
3376 <dd>
3377 <dl>
3378 <dd>
3379 <dl>
3380 <dd>d2</dd>
3381 </dl>
3382 </dd>
3383 </dl>
3384 </dd>
3385 </dl>
3386 </dd>
3387 </dl>
3388
3389 !! end
3390
3391
3392 !! test
3393 Definition Lists: Nesting: Test 4
3394 !! wikitext
3395 ::;t3
3396 :::d3
3397 !! html
3398 <dl><dd><dl><dd><dl><dt>t3</dt>
3399 <dd>d3</dd></dl></dd></dl></dd></dl>
3400
3401 !! end
3402
3403
3404 ## The Parsoid team believes the following three test exposes a
3405 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3406 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3407 !! test
3408 Definition Lists: Mixed Lists: Test 1
3409 !! wikitext
3410 :;* foo
3411 ::* bar
3412 :; baz
3413 !! html/php
3414 <dl><dd><dl><dt><ul><li> foo</li>
3415 <li> bar</li></ul></dt></dl>
3416 <dl><dt> baz</dt></dl></dd></dl>
3417
3418 !! html/parsoid
3419 <dl>
3420 <dd><dl>
3421 <dt><ul>
3422 <li> foo
3423 </li>
3424 </ul></dt>
3425 <dd><ul>
3426 <li> bar
3427 </li>
3428 </ul></dd>
3429 <dt> baz</dt>
3430 </dl></dd>
3431 </dl>
3432 !! end
3433
3434 !! test
3435 Definition Lists: Mixed Lists: Test 2
3436 !! wikitext
3437 *: d1
3438 *: d2
3439 !! html
3440 <ul><li><dl><dd> d1</dd>
3441 <dd> d2</dd></dl></li></ul>
3442
3443 !! end
3444
3445
3446 !! test
3447 Definition Lists: Mixed Lists: Test 3
3448 !! wikitext
3449 *::: d1
3450 *::: d2
3451 !! html
3452 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3453 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3454
3455 !! end
3456
3457
3458 !! test
3459 Definition Lists: Mixed Lists: Test 4
3460 !! wikitext
3461 *;d1 :d2
3462 *;d3 :d4
3463 !! html
3464 <ul><li><dl><dt>d1&#160;</dt>
3465 <dd>d2</dd>
3466 <dt>d3&#160;</dt>
3467 <dd>d4</dd></dl></li></ul>
3468
3469 !! end
3470
3471
3472 !! test
3473 Definition Lists: Mixed Lists: Test 5
3474 !! wikitext
3475 *:d1
3476 *:: d2
3477 !! html
3478 <ul><li><dl><dd>d1
3479 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3480
3481 !! end
3482
3483
3484 !! test
3485 Definition Lists: Mixed Lists: Test 6
3486 !! wikitext
3487 #*:d1
3488 #*::: d3
3489 !! html
3490 <ol><li><ul><li><dl><dd>d1
3491 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3492
3493 !! end
3494
3495
3496 !! test
3497 Definition Lists: Mixed Lists: Test 7
3498 !! wikitext
3499 :* d1
3500 :* d2
3501 !! html
3502 <dl><dd><ul><li> d1</li>
3503 <li> d2</li></ul></dd></dl>
3504
3505 !! end
3506
3507
3508 !! test
3509 Definition Lists: Mixed Lists: Test 8
3510 !! wikitext
3511 :* d1
3512 ::* d2
3513 !! html
3514 <dl><dd><ul><li> d1</li></ul>
3515 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3516
3517 !! end
3518
3519
3520 !! test
3521 Definition Lists: Mixed Lists: Test 9
3522 !! wikitext
3523 *;foo :bar
3524 !! html
3525 <ul><li><dl><dt>foo&#160;</dt>
3526 <dd>bar</dd></dl></li></ul>
3527
3528 !! end
3529
3530
3531 !! test
3532 Definition Lists: Mixed Lists: Test 10
3533 !! wikitext
3534 *#;foo :bar
3535 !! html
3536 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3537 <dd>bar</dd></dl></li></ol></li></ul>
3538
3539 !! end
3540
3541 # The Parsoid team disagrees with the PHP parser's seemingly-random
3542 # rules regarding dd/dt on the next two tests. Parsoid is more
3543 # consistent, and recognizes the shared nesting and keeps the
3544 # still-open tags around until the nesting is complete.
3545
3546 !! test
3547 Definition Lists: Mixed Lists: Test 11
3548 !! wikitext
3549 *#*#;*;;foo :bar
3550 *#*#;boo :baz
3551 !! html/php
3552 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3553 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3554 <dl><dt>boo&#160;</dt>
3555 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3556
3557 !! html/parsoid
3558 <ul>
3559 <li>
3560 <ol>
3561 <li>
3562 <ul>
3563 <li>
3564 <ol>
3565 <li>
3566 <dl>
3567 <dt>
3568 <ul>
3569 <li>
3570 <dl>
3571 <dt>
3572 <dl>
3573 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3574 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3575 </dl></dt>
3576 </dl></li>
3577 </ul></dt>
3578 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3579 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3580 </dl></li>
3581 </ol></li>
3582 </ul></li>
3583 </ol></li>
3584 </ul>
3585 !! end
3586
3587
3588 !! test
3589 Definition Lists: Weird Ones: Test 1
3590 !! wikitext
3591 *#;*::;; foo : bar (who uses this?)
3592 !! html/php
3593 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3594 <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>
3595
3596 !! html/parsoid
3597 <ul>
3598 <li>
3599 <ol>
3600 <li>
3601 <dl>
3602 <dt>
3603 <ul>
3604 <li>
3605 <dl>
3606 <dd>
3607 <dl>
3608 <dd>
3609 <dl>
3610 <dt>
3611 <dl>
3612 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3613 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3614 </dl></dt>
3615 </dl></dd>
3616 </dl></dd>
3617 </dl></li>
3618 </ul></dt>
3619 </dl></li>
3620 </ol></li>
3621 </ul>
3622 !! end
3623
3624 ###
3625 ### External links
3626 ###
3627 !! test
3628 External links: non-bracketed
3629 !! wikitext
3630 Non-bracketed: http://example.com
3631 !! html
3632 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3633 </p>
3634 !! end
3635
3636 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3637 !! test
3638 External links: numbered
3639 !! wikitext
3640 Numbered: [http://example.com]
3641 Numbered: [http://example.net]
3642 Numbered: [http://example.com]
3643 !! html/php
3644 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3645 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3646 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3647 </p>
3648 !! html/parsoid
3649 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3650 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3651 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3652 !!end
3653
3654 !! test
3655 External links: specified text
3656 !! wikitext
3657 Specified text: [http://example.com link]
3658 !! html
3659 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3660 </p>
3661 !!end
3662
3663 !! test
3664 External links: trail
3665 !! wikitext
3666 Linktrails should not work for external links: [http://example.com link]s
3667 !! html
3668 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3669 </p>
3670 !! end
3671
3672 !! test
3673 External links: dollar sign in URL
3674 !! wikitext
3675 http://example.com/1$2345
3676 !! html
3677 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3678 </p>
3679 !! end
3680
3681 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3682 !! test
3683 External links: dollar sign in URL (autonumber)
3684 !! wikitext
3685 [http://example.com/1$2345]
3686 !! html/php
3687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3688 </p>
3689 !! html/parsoid
3690 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3691 !!end
3692
3693 !! test
3694 External links: open square bracket forbidden in URL (bug 4377)
3695 !! options
3696 parsoid=wt2html,wt2wt,html2html
3697 !! wikitext
3698 http://example.com/1[2345
3699 !! html/php
3700 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3701 </p>
3702 !! html/parsoid
3703 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3704 !! end
3705
3706 !! test
3707 External links: open square bracket forbidden in URL (named) (bug 4377)
3708 !! options
3709 parsoid=wt2html,html2html
3710 !! wikitext
3711 [http://example.com/1[2345]
3712 !! html/php
3713 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3714 </p>
3715 !! html/parsoid
3716 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3717 !!end
3718
3719 # parsoid adds a space before the link name
3720 !! test
3721 External links: open square bracket forbidden in URL (named) (bug 4377)
3722 Parsoid variant.
3723 !! wikitext
3724 [http://example.com/1 [2345]
3725 !! html
3726 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3727 </p>
3728 !!end
3729
3730 !! test
3731 External links: nowiki in URL link text (bug 6230)
3732 !! wikitext
3733 [http://example.com/ <nowiki>''example site''</nowiki>]
3734 !! html
3735 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3736 </p>
3737 !! end
3738
3739 !! test
3740 External links: newline forbidden in text (bug 6230 regression check)
3741 !! wikitext
3742 [http://example.com/ first
3743 second]
3744 !! html
3745 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3746 second]
3747 </p>
3748 !!end
3749
3750 !! test
3751 External links: Pipe char between url and text
3752 !! wikitext
3753 [http://example.com | link]
3754 !! html
3755 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3756 </p>
3757 !!end
3758
3759 !! test
3760 External links: protocol-relative URL in brackets
3761 !! wikitext
3762 [//example.com/ Test]
3763 !! html
3764 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3765 </p>
3766 !! end
3767
3768 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3769 !! test
3770 External links: protocol-relative URL in brackets without text
3771 !! wikitext
3772 [//example.com]
3773 !! html/php
3774 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3775 </p>
3776 !! html/parsoid
3777 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3778 !! end
3779
3780 !! test
3781 External links: protocol-relative URL in free text is left alone
3782 !! wikitext
3783 //example.com/Foo
3784 !! html
3785 <p>//example.com/Foo
3786 </p>
3787 !!end
3788
3789 !! test
3790 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3791 !! wikitext
3792 foo//example.com/Foo
3793 !! html
3794 <p>foo//example.com/Foo
3795 </p>
3796 !! end
3797
3798 !! test
3799 External links: with no contents
3800 !! wikitext
3801 [http://en.wikipedia.org/wiki/Foo]
3802
3803 [[wikipedia:Foo|Bar]]
3804
3805 [[wikipedia:Foo|<span>Bar</span>]]
3806 !! html/parsoid
3807 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3808 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3809 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3810 !! end
3811
3812 !! test
3813 External image
3814 !! wikitext
3815 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3816 !! html
3817 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3818 </p>
3819 !! end
3820
3821 !! test
3822 External image from https
3823 !! wikitext
3824 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3825 !! html
3826 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3827 </p>
3828 !! end
3829
3830 !! test
3831 External image (when not allowed)
3832 !! options
3833 wgAllowExternalImages=0
3834 !! wikitext
3835 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3836 !! html
3837 <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>
3838 </p>
3839 !! end
3840
3841 !! test
3842 Link to non-http image, no img tag
3843 !! wikitext
3844 Link to non-http image, no img tag: ftp://example.com/test.jpg
3845 !! html
3846 <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>
3847 </p>
3848 !! end
3849
3850 !! test
3851 External links: terminating separator
3852 !! wikitext
3853 Terminating separator: http://example.com/thing,
3854 !! html
3855 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3856 </p>
3857 !! end
3858
3859 !! test
3860 External links: intervening separator
3861 !! wikitext
3862 Intervening separator: http://example.com/1,2,3
3863 !! html
3864 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3865 </p>
3866 !! end
3867
3868 !! test
3869 External links: old bug with URL in query
3870 !! wikitext
3871 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3872 !! html
3873 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3874 </p>
3875 !! end
3876
3877 !! test
3878 External links: old URL-in-URL bug, mixed protocols
3879 !! wikitext
3880 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3881 !! html
3882 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3883 </p>
3884 !!end
3885
3886 !! test
3887 External links: URL in text
3888 !! wikitext
3889 URL in text: [http://example.com http://example.com]
3890 !! html
3891 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3892 </p>
3893 !! end
3894
3895 !! test
3896 External links: Clickable images
3897 !! wikitext
3898 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3899 !! html
3900 <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>
3901 </p>
3902 !!end
3903
3904 !! test
3905 External links: raw ampersand
3906 !! wikitext
3907 Old &amp; use: http://x&y
3908 !! html
3909 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3910 </p>
3911 !! end
3912
3913 !! test
3914 External links: encoded ampersand
3915 !! wikitext
3916 Old &amp; use: http://x&amp;y
3917 !! html/php
3918 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3919 </p>
3920 !! html/parsoid
3921 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3922 !! end
3923
3924 !! test
3925 External links: encoded equals (bug 6102)
3926 !! wikitext
3927 http://example.com/?foo&#61;bar
3928 !! html/php
3929 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3930 </p>
3931 !! html/parsoid
3932 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3933 !! end
3934
3935 ##
3936 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3937 ## does it number them. As discussed in bug 53505, we can identify
3938 ## autonumbered links via CSS.
3939 ##
3940
3941 !! test
3942 External links: [raw ampersand]
3943 !! wikitext
3944 Old &amp; use: [http://x&y]
3945 !! html/php
3946 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3947 </p>
3948 !! html/parsoid
3949 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3950 !! end
3951
3952 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3953 # mode will return the [raw ampersand] wikitext
3954 !! test
3955 External links: [encoded ampersand]
3956 !! options
3957 parsoid=wt2html,wt2wt,html2html
3958 !! wikitext
3959 Old &amp; use: [http://x&amp;y]
3960 !! html/php
3961 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3962 </p>
3963 !! html/parsoid
3964 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3965 !! end
3966
3967 !! test
3968 External links: [raw equals]
3969 !! wikitext
3970 [http://example.com/?foo=bar]
3971 !! html/php
3972 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3973 </p>
3974 !! html/parsoid
3975 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3976 !! end
3977
3978 # note that parsoid html is identical to [raw equals] case; so html2wt
3979 # mode will return the [raw equals] wikitext
3980 !! test
3981 External links: [encoded equals] (bug 6102)
3982 !! options
3983 parsoid=wt2html,wt2wt,html2html
3984 !! wikitext
3985 [http://example.com/?foo&#61;bar]
3986 !! html/php
3987 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3988 </p>
3989 !! html/parsoid
3990 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3991 !! end
3992
3993 # xxx parsoid strips the IDN character, so the round-trip tests will
3994 # obviously fail and are disabled. --cscott
3995 !! test
3996 External links: [IDN ignored character reference in hostname; strip it right off]
3997 !! options
3998 parsoid=wt2html,wt2wt,html2html
3999 !! wikitext
4000 [http://e&zwnj;xample.com/]
4001 !! html/php
4002 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4003 </p>
4004 !! html/parsoid
4005 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4006 !! end
4007
4008 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4009 # Where an external link could easily circumvent the sanitization of the text of
4010 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4011 # test demands a higher standard. That's a bit strange.
4012 #
4013 # Example:
4014 #
4015 # http://e‌xample.com -> [http://example.com|http://example.com]
4016 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4017 #
4018 # The first example is sanitized, but the second is not. Any security benefits
4019 # from this production are trivial to circumvent. Either remove this test and
4020 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4021 # the test accordingly.
4022 #
4023 # All our love,
4024 # The Parsoid team.
4025 # xxx parsoid strips the IDN character, so the round-trip tests will
4026 # obviously fail and are disabled. --cscott
4027 !! test
4028 External links: IDN ignored character reference in hostname; strip it right off
4029 !! options
4030 parsoid=wt2html,html2html
4031 !! wikitext
4032 http://e&zwnj;xample.com/
4033 !! html/php
4034 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4035 </p>
4036 !! html/parsoid
4037 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4038 !! end
4039
4040 !! test
4041 External links: www.jpeg.org (bug 554)
4042 !! wikitext
4043 http://www.jpeg.org
4044 !! html
4045 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4046 </p>
4047 !! end
4048
4049 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4050 !! test
4051 External links: URL within URL (original bug 2)
4052 !! wikitext
4053 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4054 !! html/php
4055 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4056 </p>
4057 !! html/parsoid
4058 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4059 !! end
4060
4061 !! test
4062 BUG 361: URL inside bracketed URL
4063 !! wikitext
4064 [http://www.example.com/foo http://www.example.com/bar]
4065 !! html
4066 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4067 </p>
4068 !! end
4069
4070 !! test
4071 BUG 361: URL within URL, not bracketed
4072 !! wikitext
4073 http://www.example.com/foo?=http://www.example.com/bar
4074 !! html
4075 <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>
4076 </p>
4077 !! end
4078
4079 !! test
4080 BUG 289: ">"-token in URL-tail
4081 !! wikitext
4082 http://www.example.com/<hello>
4083 !! html
4084 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4085 </p>
4086 !!end
4087
4088 !! test
4089 BUG 289: literal ">"-token in URL-tail
4090 !! wikitext
4091 http://www.example.com/<b>html</b>
4092 !! html
4093 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4094 </p>
4095 !!end
4096
4097 !! test
4098 BUG 289: ">"-token in bracketed URL
4099 !! wikitext
4100 [http://www.example.com/<hello> stuff]
4101 !! html
4102 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4103 </p>
4104 !!end
4105
4106 !! test
4107 BUG 289: literal ">"-token in bracketed URL
4108 !! wikitext
4109 [http://www.example.com/<b>html</b> stuff]
4110 !! html
4111 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4112 </p>
4113 !!end
4114
4115 !! test
4116 BUG 289: literal double quote at end of URL
4117 !! wikitext
4118 http://www.example.com/"hello"
4119 !! html
4120 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4121 </p>
4122 !!end
4123
4124 !! test
4125 BUG 289: literal double quote in bracketed URL
4126 !! wikitext
4127 [http://www.example.com/"hello" stuff]
4128 !! html
4129 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4130 </p>
4131 !!end
4132
4133 !! test
4134 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4135 !! wikitext
4136 [http://www.example.com test]
4137 !! html
4138 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4139 </p>
4140 !! end
4141
4142 !! test
4143 External links: link text with spaces
4144 !! wikitext
4145 [http://www.example.com a b c]
4146 [http://www.example.com ''a'' ''b'']
4147 !! html
4148 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4149 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4150 </p>
4151 !! end
4152
4153 !! test
4154 External links: wiki links within external link (Bug 3695)
4155 !! wikitext
4156 [http://example.com [[wikilink]] embedded in ext link]
4157 !! html/php
4158 <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>
4159 </p>
4160 !! html/parsoid
4161 <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>
4162 !! end
4163
4164 !! test
4165 BUG 787: Links with one slash after the url protocol are invalid
4166 !! wikitext
4167 http:/example.com
4168
4169 [http:/example.com title]
4170 !! html
4171 <p>http:/example.com
4172 </p><p>[http:/example.com title]
4173 </p>
4174 !! end
4175
4176 !! test
4177 Bracketed external links with template-generated invalid target
4178 !! wikitext
4179 [{{echo|http:/example.com}} title]
4180 !! html
4181 <p>[http:/example.com title]
4182 </p>
4183 !! end
4184
4185 !! test
4186 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4187 !! wikitext
4188 ''[http://example.com text'']
4189 [http://example.com '''text]'''
4190 ''Something [http://example.com in italic'']
4191 ''Something [http://example.com mixed''''', even bold]'''
4192 '''''Now [http://example.com both''''']
4193 !! html
4194 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4195 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4196 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4197 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4198 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4199 </p>
4200 !! end
4201
4202
4203 !! test
4204 Bug 4781: %26 in URL
4205 !! wikitext
4206 http://www.example.com/?title=AT%26T
4207 !! html/php
4208 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4209 </p>
4210 !! html/parsoid
4211 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4212 !! end
4213
4214 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4215 # % is actually legal in HTML5. Any change in output would need testing though.
4216 !! test
4217 Bug 4781, 5267: %25 in URL
4218 !! wikitext
4219 http://www.example.com/?title=100%25_Bran
4220 !! html/php
4221 <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>
4222 </p>
4223 !! html/parsoid
4224 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4225 !! end
4226
4227 !! test
4228 Bug 4781, 5267: %28, %29 in URL
4229 !! wikitext
4230 http://www.example.com/?title=Ben-Hur_%281959_film%29
4231 !! html/php
4232 <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>
4233 </p>
4234 !! html/parsoid
4235 <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>
4236 !! end
4237
4238
4239 !! test
4240 Bug 4781: %26 in autonumber URL
4241 !! wikitext
4242 [http://www.example.com/?title=AT%26T]
4243 !! html/php
4244 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4245 </p>
4246 !! html/parsoid
4247 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4248 !! end
4249
4250 !! test
4251 Bug 4781, 5267: %26 in autonumber URL
4252 !! wikitext
4253 [http://www.example.com/?title=100%25_Bran]
4254 !! html/php
4255 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4256 </p>
4257 !! html/parsoid
4258 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4259 !! end
4260
4261 !! test
4262 Bug 4781, 5267: %28, %29 in autonumber URL
4263 !! wikitext
4264 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4265 !! html/php
4266 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4267 </p>
4268 !! html/parsoid
4269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4270 !! end
4271
4272
4273 !! test
4274 Bug 4781: %26 in bracketed URL
4275 !! wikitext
4276 [http://www.example.com/?title=AT%26T link]
4277 !! html/php
4278 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4279 </p>
4280 !! html/parsoid
4281 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4282 !! end
4283
4284 !! test
4285 Bug 4781, 5267: %25 in bracketed URL
4286 !! wikitext
4287 [http://www.example.com/?title=100%25_Bran link]
4288 !! html
4289 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4290 </p>
4291 !! end
4292
4293 !! test
4294 Bug 4781, 5267: %28, %29 in bracketed URL
4295 !! wikitext
4296 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4297 !! html/php
4298 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4299 </p>
4300 !! html/parsoid
4301 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4302 !! end
4303
4304 !! test
4305 External link containing a period in the anchor. (bug 63947)
4306 !! wikitext
4307 [//foo.org/bar#baz. bang]
4308
4309 [//foo.org/bar. bang]
4310 !! html/php
4311 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4312 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4313 </p>
4314 !! html/parsoid
4315 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4316 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4317 !! end
4318
4319 !! test
4320 External link containing a single quote. (bug 63947)
4321 !! wikitext
4322 [//foo.org/bar'baz]
4323
4324 [//foo.org/bar'baz bang]
4325 !! html/php
4326 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4327 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4328 </p>
4329 !! html/parsoid
4330 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4331 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4332 !! end
4333
4334
4335 !! test
4336 External link containing a period in the anchor. (bug 63947)
4337 !! wikitext
4338 [//foo.org/bar#baz. bang]
4339
4340 [//foo.org/bar. bang]
4341 !! html/php
4342 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4343 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4344 </p>
4345 !! html/parsoid
4346 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4347 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4348 !! end
4349
4350 !! test
4351 External link containing a single quote. (bug 63947)
4352 !! wikitext
4353 [//foo.org/bar'baz]
4354
4355 [//foo.org/bar'baz bang]
4356 !! html/php
4357 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4358 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4359 </p>
4360 !! html/parsoid
4361 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4362 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4363 !! end
4364
4365
4366 !! test
4367 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4368 !! wikitext
4369 Some [http://example.com/ pretty ''italics'' and stuff]!
4370 !! html
4371 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4372 </p>
4373 !! end
4374
4375 !! test
4376 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4377 !! wikitext
4378 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4379 !! html
4380 <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>
4381 </p>
4382 !! end
4383
4384 !! test
4385 External link containing double-single-quotes with no space separating the url from text in italics
4386 !! wikitext
4387 [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]].]
4388 !! html/php
4389 <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>
4390 </p>
4391 !! html/parsoid
4392 <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>
4393 !! end
4394
4395 !! test
4396 External link with comments in link text
4397 !! wikitext
4398 [http://www.google.com Google <!-- comment -->]
4399 !! html
4400 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4401 </p>
4402 !! end
4403
4404 !! test
4405 URL-encoding in URL functions (single parameter)
4406 !! wikitext
4407 {{localurl:Some page|amp=&}}
4408 !! html
4409 <p>/index.php?title=Some_page&amp;amp=&amp;
4410 </p>
4411 !! end
4412
4413 !! test
4414 URL-encoding in URL functions (multiple parameters)
4415 !! wikitext
4416 {{localurl:Some page|q=?&amp=&}}
4417 !! html
4418 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4419 </p>
4420 !! end
4421
4422 !! test
4423 Brackets in urls
4424 !! wikitext
4425 http://example.com/index.php?foozoid%5B%5D=bar
4426
4427 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4428 !! html/php
4429 <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>
4430 </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>
4431 </p>
4432 !! html/parsoid
4433 <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>
4434
4435 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4436 !! end
4437
4438 !! test
4439 IPv6 urls (bug 21261)
4440 !! options
4441 disabled
4442 !! wikitext
4443 http://[2404:130:0:1000::187:2]/index.php
4444 !! html
4445 <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>
4446 </p>
4447 !! end
4448
4449 !! test
4450 Non-extlinks in brackets
4451 !! wikitext
4452 [foo]
4453 [foo bar]
4454 [foo ''bar'']
4455 [fool's] errand
4456 [fool's errand]
4457 [{{echo|foo}}]
4458 [{{echo|foo}} bar]
4459 [{{echo|foo}} ''bar'']
4460 [{{echo|foo}}l's] errand
4461 [{{echo|foo}}l's errand]
4462 [url={{echo|foo}}]
4463 [url=http://example.com]
4464 !! html
4465 <p>[foo]
4466 [foo bar]
4467 [foo <i>bar</i>]
4468 [fool's] errand
4469 [fool's errand]
4470 [foo]
4471 [foo bar]
4472 [foo <i>bar</i>]
4473 [fool's] errand
4474 [fool's errand]
4475 [url=foo]
4476 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4477 </p>
4478 !! end
4479
4480 !! test
4481 Percent encoding in external links
4482 !! wikitext
4483 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4484 !! html/php
4485 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4486 </p>
4487 !! html/parsoid
4488 <p><a rel="mw:ExtLink"
4489 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4490 !! end
4491
4492 !! test
4493 Use url link syntax for links where the content is equal the link target
4494 !! wikitext
4495 http://example.com
4496 !! html/php
4497 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4498 </p>
4499 !! html/parsoid
4500 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4501 !! end
4502
4503 !! test
4504 Parenthesis in external links, especially URL links
4505 !! wikitext
4506 http://example.com)
4507
4508 http://example.com/test)
4509
4510 http://example.com/(test)
4511
4512 http://example.com/((test)
4513
4514 (http://example.com/(test))
4515
4516 (http://example.com/(test)))))
4517
4518 http://example.com/a)b
4519
4520 [http://example.com) foo]
4521 !! html/php
4522 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4523 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4524 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4525 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4526 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4527 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4528 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4529 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4530 </p>
4531 !! html/parsoid
4532 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4533 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4534 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4535 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4536 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4537 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4538 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4539 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4540 !! end
4541
4542 !! test
4543 Parenthesis in external links, w/ transclusion or comment
4544 !! wikitext
4545 (http://example.com/{{echo|hi}})
4546
4547 (http://example.com<!-- hi -->)
4548 !! html/php
4549 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4550 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4551 </p>
4552 !! html/parsoid
4553 <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>
4554
4555 <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>
4556 !! end
4557
4558 !! test
4559 Replace invalid link targets when serializing
4560 !! options
4561 parsoid=html2wt
4562 !! html
4563 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4564 !! wikitext
4565 [[MediaWiki:Badtitletext|Manual]]
4566 !! end
4567
4568 ###
4569 ### Quotes
4570 ###
4571
4572 !! test
4573 Quotes
4574 !! wikitext
4575 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4576
4577 Normal text. '''''Bold italic text.''''' Normal text.
4578 !! html
4579 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4580 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4581 </p>
4582 !! end
4583
4584
4585 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4586 # parser strips. The wikitext contains just the first half of the bold
4587 # quote pair.
4588 !! test
4589 Unclosed and unmatched quotes
4590 !! wikitext
4591 '''''Bold italic text '''with bold deactivated''' in between.'''''
4592
4593 '''''Bold italic text ''with italic deactivated'' in between.'''''
4594
4595 '''Bold text..
4596
4597 ..spanning two paragraphs (should not work).'''
4598
4599 '''Bold tag left open
4600
4601 ''Italic tag left open
4602
4603 Normal text.
4604
4605 <!-- Unmatching number of opening, closing tags: -->
4606 '''This year''''s election ''should'' beat '''last year''''s.
4607
4608 ''Tom'''s car is bigger than ''Susan'''s.
4609
4610 Plain ''italic'''s plain
4611 !! html/php
4612 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4613 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4614 </p><p><b>Bold text..</b>
4615 </p><p>..spanning two paragraphs (should not work).
4616 </p><p><b>Bold tag left open</b>
4617 </p><p><i>Italic tag left open</i>
4618 </p><p>Normal text.
4619 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4620 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4621 </p><p>Plain <i>italic'</i>s plain
4622 </p>
4623 !! html/parsoid
4624 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4625 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4626 </p><p><b>Bold text..</b>
4627 </p><p>..spanning two paragraphs (should not work).<b></b>
4628 </p><p><b>Bold tag left open</b>
4629 </p><p><i>Italic tag left open</i>
4630 </p><p>Normal text.
4631 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4632 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4633 </p><p>Plain <i>italic'</i>s plain
4634 </p>
4635 !! end
4636
4637 ###
4638 ### Tables
4639 ###
4640 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4641 ###
4642
4643 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4644 # is the bare minimum required by the spec, see:
4645 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4646 # Parsoid team replies: empty table tags are legal in HTML5
4647 !! test
4648 A table with no data.
4649 !! options
4650 parsoid=wt2html
4651 !! wikitext
4652 {||}
4653 !! html/php
4654
4655 !! html/parsoid
4656 <table></table>
4657
4658 !! end
4659
4660 !! test
4661 A table with stray table end tags on start tag line (wt2html)
4662 !! options
4663 parsoid=wt2html
4664 !! wikitext
4665 {|style="color: red;"|}
4666
4667 {|style="color: red;" |}
4668 |foo
4669 |}
4670
4671 {|style="color: red;"|} id="foo"
4672 |foo
4673 |}
4674
4675 {|style="color: red;" |} id="foo"
4676 |foo
4677 |}
4678 !! html
4679 <table style="color: red;"></table>
4680
4681 <table style="color: red;">
4682 <tbody><tr>
4683 <td>foo</td>
4684 </tr></tbody>
4685 </table>
4686
4687 <table style="color: red;" id="foo">
4688 <tbody><tr>
4689 <td>foo</td>
4690 </tr></tbody>
4691 </table>
4692
4693 <table style="color: red;" id="foo">
4694 <tbody><tr>
4695 <td>foo</td>
4696 </tr></tbody>
4697 </table>
4698
4699 !! end
4700
4701 !! test
4702 A table with no data (take 2)
4703 !! wikitext
4704 {|
4705 |}
4706 !! html/parsoid
4707 <table></table>
4708 !! end
4709
4710 # A table with nothing but a caption is invalid XHTML, we might want to render
4711 # this as <p>caption</p>
4712 # Parsoid team replies: table with only a caption is legal in HTML5
4713 !! test
4714 A table with nothing but a caption
4715 !! wikitext
4716 {|
4717 |+ caption
4718 |}
4719 !! html/php
4720 <table>
4721 <caption> caption
4722 </caption><tr><td></td></tr></table>
4723
4724 !! html/parsoid
4725 <table><caption> caption</caption></table>
4726 !! end
4727
4728 !! test
4729 A table with caption with default-spaced attributes and a table row
4730 !! wikitext
4731 {|
4732 |+ style="color: red;" | caption1
4733 |-
4734 | foo
4735 |}
4736 !! html
4737 <table>
4738 <caption style="color: red;"> caption1
4739 </caption>
4740 <tr>
4741 <td> foo
4742 </td></tr></table>
4743
4744 !! end
4745
4746 !! test
4747 A table with captions with non-default spaced attributes and a table row
4748 !! wikitext
4749 {|
4750 |+style="color: red;"|caption2
4751 |+ style="color: red;"| caption3
4752 |-
4753 | foo
4754 |}
4755 !! html
4756 <table>
4757 <caption style="color: red;">caption2
4758 </caption>
4759 <caption style="color: red;"> caption3
4760 </caption>
4761 <tr>
4762 <td> foo
4763 </td></tr></table>
4764
4765 !! end
4766
4767 !! test
4768 Table td-cell syntax variations
4769 !! wikitext
4770 {|
4771 | foo bar foo | baz
4772 | foo bar foo || baz
4773 | style='color:red;' | baz
4774 | style='color:red;' || baz
4775 |}
4776 !! html
4777 <table>
4778 <tr>
4779 <td> baz
4780 </td>
4781 <td> foo bar foo </td>
4782 <td> baz
4783 </td>
4784 <td style="color:red;"> baz
4785 </td>
4786 <td> style='color:red;' </td>
4787 <td> baz
4788 </td></tr></table>
4789
4790 !! end
4791
4792 !! test
4793 Simple table
4794 !! wikitext
4795 {|
4796 | 1 || 2
4797 |-
4798 | 3 || 4
4799 |}
4800 !! html
4801 <table>
4802 <tr>
4803 <td> 1 </td>
4804 <td> 2
4805 </td></tr>
4806 <tr>
4807 <td> 3 </td>
4808 <td> 4
4809 </td></tr></table>
4810
4811 !! end
4812
4813 !! test
4814 Simple table but with multiple dashes for row wikitext
4815 !! wikitext
4816 {|
4817 | foo
4818 |-----
4819 | bar
4820 |}
4821 !! html
4822 <table>
4823 <tr>
4824 <td> foo
4825 </td></tr>
4826 <tr>
4827 <td> bar
4828 </td></tr></table>
4829
4830 !! end
4831 !! test
4832 Multiplication table
4833 !! wikitext
4834 {| border="1" cellpadding="2"
4835 |+Multiplication table
4836 |-
4837 ! &times; !! 1 !! 2 !! 3
4838 |-
4839 ! 1
4840 | 1 || 2 || 3
4841 |-
4842 ! 2
4843 | 2 || 4 || 6
4844 |-
4845 ! 3
4846 | 3 || 6 || 9
4847 |-
4848 ! 4
4849 | 4 || 8 || 12
4850 |-
4851 ! 5
4852 | 5 || 10 || 15
4853 |}
4854 !! html
4855 <table border="1" cellpadding="2">
4856 <caption>Multiplication table
4857 </caption>
4858 <tr>
4859 <th> &#215; </th>
4860 <th> 1 </th>
4861 <th> 2 </th>
4862 <th> 3
4863 </th></tr>
4864 <tr>
4865 <th> 1
4866 </th>
4867 <td> 1 </td>
4868 <td> 2 </td>
4869 <td> 3
4870 </td></tr>
4871 <tr>
4872 <th> 2
4873 </th>
4874 <td> 2 </td>
4875 <td> 4 </td>
4876 <td> 6
4877 </td></tr>
4878 <tr>
4879 <th> 3
4880 </th>
4881 <td> 3 </td>
4882 <td> 6 </td>
4883 <td> 9
4884 </td></tr>
4885 <tr>
4886 <th> 4
4887 </th>
4888 <td> 4 </td>
4889 <td> 8 </td>
4890 <td> 12
4891 </td></tr>
4892 <tr>
4893 <th> 5
4894 </th>
4895 <td> 5 </td>
4896 <td> 10 </td>
4897 <td> 15
4898 </td></tr></table>
4899
4900 !! end
4901
4902 !! test
4903 Accept "||" in table headings
4904 !! wikitext
4905 {|
4906 !h1 || h2
4907 |}
4908 !! html
4909 <table>
4910 <tr>
4911 <th>h1 </th>
4912 <th> h2
4913 </th></tr></table>
4914
4915 !! end
4916
4917 !! test
4918 Accept "!!" in table data
4919 !! wikitext
4920 {|
4921 | Foo!! ||
4922 |}
4923 !! html/parsoid
4924 <table data-parsoid='{}'>
4925 <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>
4926 </tbody></table>
4927 !! end
4928
4929 !! test
4930 Accept "||" in indented table headings
4931 !! wikitext
4932 :{|
4933 !h1 || h2
4934 |}
4935 !! html
4936 <dl><dd><table>
4937 <tr>
4938 <th>h1 </th>
4939 <th> h2
4940 </th></tr></table></dd></dl>
4941
4942 !! end
4943
4944 !! test
4945 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4946 !! wikitext
4947 {|
4948 !| h1
4949 || a
4950 |}
4951 !! html
4952 <table>
4953 <tr>
4954 <th> h1
4955 </th>
4956 <td> a
4957 </td></tr></table>
4958
4959 !! end
4960
4961 !!test
4962 Accept "| !" at start of line in tables (ignore !-attribute)
4963 !! wikitext
4964 {|
4965 |-
4966 | !style="color:red" | bar
4967 |}
4968 !! html
4969 <table>
4970
4971 <tr>
4972 <td> bar
4973 </td></tr></table>
4974
4975 !!end
4976
4977 !!test
4978 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 +/-
4979 !! wikitext
4980 {|
4981 |-
4982 |style='color:red;'|+1
4983 |style='color:blue;'|-1
4984 |-
4985 | 1 || 2 || 3
4986 | 1 ||+2 ||-3
4987 |-
4988 | +1
4989 | -1
4990 |}
4991 !! html
4992 <table>
4993
4994 <tr>
4995 <td style="color:red;">+1
4996 </td>
4997 <td style="color:blue;">-1
4998 </td></tr>
4999 <tr>
5000 <td> 1 </td>
5001 <td> 2 </td>
5002 <td> 3
5003 </td>
5004 <td> 1 </td>
5005 <td>+2 </td>
5006 <td>-3
5007 </td></tr>
5008 <tr>
5009 <td> +1
5010 </td>
5011 <td> -1
5012 </td></tr></table>
5013
5014 !!end
5015
5016 !! test
5017 Table rowspan
5018 !! wikitext
5019 {| border=1
5020 | Cell 1, row 1
5021 |rowspan=2| Cell 2, row 1 (and 2)
5022 | Cell 3, row 1
5023 |-
5024 | Cell 1, row 2
5025 | Cell 3, row 2
5026 |}
5027 !! html
5028 <table border="1">
5029 <tr>
5030 <td> Cell 1, row 1
5031 </td>
5032 <td rowspan="2"> Cell 2, row 1 (and 2)
5033 </td>
5034 <td> Cell 3, row 1
5035 </td></tr>
5036 <tr>
5037 <td> Cell 1, row 2
5038 </td>
5039 <td> Cell 3, row 2
5040 </td></tr></table>
5041
5042 !! end
5043
5044 !! test
5045 Nested table
5046 !! wikitext
5047 {| border=1
5048 | &alpha;
5049 |
5050 {| bgcolor=#ABCDEF border=2
5051 |nested
5052 |-
5053 |table
5054 |}
5055 |the original table again
5056 |}
5057 !! html
5058 <table border="1">
5059 <tr>
5060 <td> &#945;
5061 </td>
5062 <td>
5063 <table bgcolor="#ABCDEF" border="2">
5064 <tr>
5065 <td>nested
5066 </td></tr>
5067 <tr>
5068 <td>table
5069 </td></tr></table>
5070 </td>
5071 <td>the original table again
5072 </td></tr></table>
5073
5074 !! end
5075
5076 !! test
5077 Invalid attributes in table cell (bug 1830)
5078 !! wikitext
5079 {|
5080 |Cell:|broken
5081 |}
5082 !! html
5083 <table>
5084 <tr>
5085 <td>broken
5086 </td></tr></table>
5087
5088 !! end
5089
5090
5091 # The "|}" to close the table is missing from the input, so parsoid's
5092 # *2wt modes will fail.
5093 !! test
5094 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5095 !! options
5096 parsoid=wt2html,html2html
5097 !! wikitext
5098 {|
5099 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5100 !! html/php
5101 <table>
5102 <tr>
5103 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5104 <td>]" onmouseover="alert(document.cookie)"&gt;test
5105 </td>
5106 </tr>
5107 </table>
5108
5109 !! html/parsoid
5110 <table><tbody>
5111 <tr>
5112 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5113 !! end
5114
5115
5116 !! test
5117 Indented table markup mixed with indented pre content (proposed in bug 6200)
5118 !! wikitext
5119 <table>
5120 <tr>
5121 <td>
5122 Text that should be rendered preformatted
5123 </td>
5124 </tr>
5125 </table>
5126 !! html
5127 <table>
5128 <tr>
5129 <td>
5130 <pre>Text that should be rendered preformatted
5131 </pre>
5132 </td>
5133 </tr>
5134 </table>
5135
5136 !! end
5137
5138 !! test
5139 Template-generated table cell attributes and cell content
5140 !! wikitext
5141 {|
5142 |{{table_attribs}}
5143 | {{table_attribs}}
5144 |}
5145 !! html
5146 <table>
5147 <tr>
5148 <td style="color: red"> Foo
5149 </td>
5150 <td style="color: red"> Foo
5151 </td></tr></table>
5152
5153 !! end
5154
5155 !! test
5156 Template-generated table cell attributes and cell content (2)
5157 !! wikitext
5158 {|
5159 |align=center {{table_attribs}}
5160 |}
5161 !! html
5162 <table>
5163 <tr>
5164 <td align="center" style="color: red"> Foo
5165 </td></tr></table>
5166
5167 !! end
5168
5169 !! test
5170 Template-generated table cell attributes and cell content (3)
5171 !! wikitext
5172 {|
5173 |align=center {{table_cells}}
5174 |}
5175 !! html
5176 <table>
5177 <tr>
5178 <td align="center" style="color: red"> Foo </td>
5179 <td> Bar </td>
5180 <td> Baz
5181 </td></tr></table>
5182
5183 !! end
5184
5185 !! test
5186 Table with row followed by newlines and table heading
5187 !! wikitext
5188 {|
5189 |-
5190
5191 ! foo
5192 |}
5193 !! html
5194 <table>
5195
5196
5197 <tr>
5198 <th> foo
5199 </th></tr></table>
5200
5201 !! end
5202
5203 !! test
5204 Table with empty line following the start tag
5205 !! wikitext
5206 {|
5207
5208 |-
5209 | foo
5210 |}
5211 !! html
5212 <table>
5213
5214
5215 <tr>
5216 <td> foo
5217 </td></tr></table>
5218
5219 !! end
5220
5221 # FIXME: Preserve the attribute properly (with an empty string as value) in
5222 # the PHP parser. Parsoid implements the behavior below.
5223 !! test
5224 Table attributes with empty value
5225 !! wikitext
5226 {|
5227 | style=| hello
5228 |}
5229 !! html/parsoid
5230 <table>
5231 <tbody>
5232 <tr>
5233 <td style=""> hello
5234 </td></tr></tbody></table>
5235
5236 !! end
5237
5238 !! test
5239 Wikitext table with a lot of comments
5240 !! wikitext
5241 {|
5242 <!-- c0 -->
5243 | foo
5244 <!-- c1 -->
5245 |- <!-- c2 -->
5246 <!-- c3 -->
5247 |<!-- c4 -->
5248 <!-- c5 -->
5249 |}
5250 !! html
5251 <table>
5252 <tr>
5253 <td> foo
5254 </td></tr>
5255 <tr>
5256 <td>
5257 </td></tr></table>
5258
5259 !! end
5260
5261 !! test
5262 Wikitext table with double-line table cell
5263 !! wikitext
5264 {|
5265 |a
5266 b
5267 |}
5268 !! html
5269 <table>
5270 <tr>
5271 <td>a
5272 <p>b
5273 </p>
5274 </td></tr></table>
5275
5276 !! end
5277
5278 !! test
5279 Table cell with a single comment
5280 !! wikitext
5281 {|
5282 | <!-- c1 -->
5283 | a
5284 |}
5285 !! html
5286 <table>
5287 <tr>
5288 <td>
5289 </td>
5290 <td> a
5291 </td></tr></table>
5292
5293 !! end
5294
5295 !! test
5296 Table-cell after a comment-only-empty-line
5297 !! wikitext
5298 {|
5299 |a
5300 <!--c1-->
5301 <!--c2-->| b
5302 |}
5303 !! html/parsoid
5304 <table>
5305 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5306 <!--c1-->
5307 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5308 </tbody></table>
5309
5310 !! end
5311
5312 # The expected HTML structure in this test is debatable. The PHP parser does
5313 # not parse this kind of table at all. The main focus for Parsoid is on
5314 # round-tripping, so this output is ok for now. TODO: revisit!
5315 !! test
5316 Wikitext table with html-syntax row
5317 !! wikitext
5318 {|
5319 |-
5320 <td>foo</td>
5321 |}
5322 !! html/parsoid
5323 <table>
5324 <tbody>
5325 <tr>
5326 <td>foo</td></tr></tbody></table>
5327 !! end
5328
5329 !! test
5330 Implicit <td> after a |-
5331 (PHP parser relies on Tidy to add the missing <td> tags)
5332 !! options
5333 parsoid=wt2html,wt2wt
5334 !! wikitext
5335 {|
5336 |-
5337 a
5338 |}
5339 !! html
5340 <table>
5341 <tr><td>a</td></tr>
5342 </table>
5343 !! end
5344
5345 !! test
5346 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5347 (PHP parser relies on Tidy to add the missing <td> tags)
5348 !! options
5349 parsoid=wt2html,wt2wt
5350 !! wikitext
5351 {|
5352 |-
5353 |
5354 a
5355 |-
5356 b
5357 |}
5358 !! html
5359 <table>
5360 <tbody>
5361 <tr><td><pre>a</pre></td></tr>
5362 <tr><td> b</td></tr>
5363 </tbody>
5364 </table>
5365 !! end
5366
5367 !! test
5368 Lists should be recognized in an implicit <td> context
5369 (PHP parser relies on Tidy to add the missing <td> tags)
5370 !! options
5371 parsoid=wt2html,wt2wt
5372 !! wikitext
5373 {|
5374 |-
5375 *a
5376 |}
5377 !! html
5378 <table>
5379 <tr>
5380 <td><ul>
5381 <li>a</li>
5382 </ul></td>
5383 </tr>
5384 </table>
5385 !! end
5386
5387 !! test
5388 Parsoid: Round-trip tables directly followed by content (bug 51219)
5389 !! options
5390 parsoid=wt2html,wt2wt
5391 !! wikitext
5392 {|
5393 |foo
5394 |} bar
5395
5396 {|
5397 |baz
5398 |}<b>quux</b>
5399 !! html
5400 <table><tbody>
5401 <tr>
5402 <td>foo</td></tr></tbody></table> bar
5403 <table>
5404 <tbody>
5405 <tr>
5406 <td>baz</td></tr></tbody></table><b>quux</b>
5407 !! end
5408
5409 !! test
5410 Parsoid: Default to a newline after tables in new content (bug 51219)
5411 !! options
5412 parsoid=html2wt
5413 !! wikitext
5414 {|
5415 |foo
5416 |}
5417 <nowiki> </nowiki>bar
5418 {|
5419 |baz
5420 |}
5421 '''quux'''
5422 !! html
5423 <table><tbody>
5424 <tr><td>foo</td></tr></tbody></table> bar
5425 <table><tbody>
5426 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5427 !! end
5428
5429 !! test
5430 Parsoid: newline inducing block nodes don't suppress <nowiki>
5431 !! options
5432 parsoid=html2wt
5433 !! wikitext
5434 <nowiki> </nowiki>a
5435
5436 = foo =
5437 !! html
5438 a<h1>foo</h1>
5439 !! end
5440
5441 !! test
5442 Parsoid: Row-syntax table headings followed by comment & table cells
5443 !! options
5444 parsoid=wt2html,wt2wt
5445 !! wikitext
5446 {|
5447 ! foo || bar
5448 <!-- foo --> || baz || quux
5449 |}
5450 !! html/parsoid
5451 <table>
5452 <tbody>
5453 <tr><th>foo </th><th>bar </th>
5454 <td>baz </td>
5455 <td>quux</td></tr></tbody></table>
5456 !! end
5457
5458
5459 !!test
5460 Parsoid: Recover better from broken table attributes
5461 !!options
5462 parsoid=wt2html
5463 !!wikitext
5464 {| class="foo
5465 | class="bar" |
5466 foo
5467 |}
5468 !!html/parsoid
5469 <table class="foo">
5470 <tr>
5471 <td class="bar">
5472 <p>foo</p></td></tr>
5473 </tbody></table>
5474 !!end
5475
5476 !! test
5477 Strip unsupported table tags
5478 !! options
5479 parsoid=html2wt
5480 !! html
5481 <table>
5482 <thead>
5483 <tr>
5484 <th>Month</th>
5485 <th>Savings</th>
5486 </tr>
5487 </thead>
5488 <tbody>
5489 <tr>
5490 <td>January</td>
5491 <td>$100</td>
5492 </tr>
5493 <tr>
5494 <td>February</td>
5495 <td>$80</td>
5496 </tr>
5497 </tbody>
5498 <tfoot>
5499 <tr>
5500 <td>Sum</td>
5501 <td>$180</td>
5502 </tr>
5503 </tfoot>
5504 </table>
5505 !! wikitext
5506 {|
5507
5508 !Month
5509 !Savings
5510
5511 |January
5512 |$100
5513
5514 |-
5515 |February
5516 |$80
5517
5518 |Sum
5519 |$180
5520
5521 |}
5522 !! end
5523
5524 ###
5525 ### Internal links
5526 ###
5527 !! test
5528 Plain link, capitalized
5529 !! wikitext
5530 [[Main Page]]
5531 !! html
5532 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5533 </p>
5534 !! end
5535
5536 !! test
5537 Plain link, uncapitalized
5538 !! wikitext
5539 [[main Page]]
5540 !! html
5541 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5542 </p>
5543 !! end
5544
5545 !! test
5546 Piped link
5547 !! wikitext
5548 [[Main Page|The Main Page]]
5549 !! html
5550 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5551 </p>
5552 !! end
5553
5554 !! test
5555 Piped link with comment in link text
5556 !! wikitext
5557 [[Main Page|The Main<!--front--> Page]]
5558 !! html
5559 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5560 </p>
5561 !! end
5562
5563 !! test
5564 Piped link with multiple pipe characters in link text
5565 !! wikitext
5566 [[Main Page||The|Main|Page|]]
5567 !! html/php
5568 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5569 </p>
5570 !! html/parsoid
5571 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5572 !! end
5573
5574 !! test
5575 Broken link
5576 !! wikitext
5577 [[Zigzagzogzagzig]]
5578 !! html
5579 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5580 </p>
5581 !! end
5582
5583 !! test
5584 Broken link with fragment
5585 !! wikitext
5586 [[Zigzagzogzagzig#zug]]
5587 !! html
5588 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5589 </p>
5590 !! end
5591
5592 !! test
5593 Special page link with fragment
5594 !! wikitext
5595 [[Special:Version#anchor]]
5596 !! html
5597 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5598 </p>
5599 !! end
5600
5601 !! test
5602 Nonexistent special page link with fragment
5603 !! wikitext
5604 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5605 !! html
5606 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5607 </p>
5608 !! end
5609
5610 !! test
5611 Link with prefix
5612 !! wikitext
5613 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5614 !! html
5615 <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>
5616 </p>
5617 !! end
5618
5619 !! test
5620 Link with suffix
5621 !! wikitext
5622 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5623 !! html
5624 <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>!!!
5625 </p>
5626 !! end
5627
5628 !! article
5629 prefixed article
5630 !! text
5631 Some text
5632 !! endarticle
5633
5634 !! test
5635 Bug 43661: Piped links with identical prefixes
5636 !! wikitext
5637 [[prefixed article|prefixed articles with spaces]]
5638
5639 [[prefixed article|prefixed articlesaoeu]]
5640
5641 [[Main Page|Main Page test]]
5642 !! html
5643 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5644 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5645 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5646 </p>
5647 !! end
5648
5649
5650 !! test
5651 Link with HTML entity in suffix / tail
5652 !! wikitext
5653 [[Main Page]]&quot;, [[Main Page]]&#97;
5654 !! html
5655 <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;
5656 </p>
5657 !! end
5658
5659 !! test
5660 Link with 3 brackets
5661 !! wikitext
5662 [[[Main Page]]]
5663 !! html
5664 <p>[[[Main Page]]]
5665 </p>
5666 !! end
5667
5668 !! test
5669 Link with 4 brackets
5670 !! wikitext
5671 [[[[Main Page]]]]
5672 !! html
5673 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5674 </p>
5675 !! end
5676
5677 !! test
5678 Piped link with 3 brackets
5679 !! wikitext
5680 [[[main page|the main page]]]
5681 !! html
5682 <p>[[[main page|the main page]]]
5683 </p>
5684 !! end
5685
5686 !! test
5687 Piped link with extlink-like text
5688 !! wikitext
5689 [[Main Page|[bar]]]
5690 [[Main Page|This is a [bar]]]
5691 !! html
5692 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5693 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5694 </p>
5695 !! end
5696
5697 !! test
5698 Link with multiple pipes
5699 !! wikitext
5700 [[Main Page|The|Main|Page]]
5701 !! html
5702 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5703 </p>
5704 !! end
5705
5706 # Note that parsoid does not munge anchor text; all non-space
5707 # characters are valid in HTML5 ids.
5708 !! test
5709 Anchor containing a #. (bug 63430)
5710 !! wikitext
5711 [[Main Page#And#Link]]
5712 !! html/php
5713 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5714 </p>
5715 !! html/parsoid
5716 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5717 !! end
5718
5719 !! test
5720 Link to namespaces
5721 !! wikitext
5722 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5723 !! html
5724 <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>
5725 </p>
5726 !! end
5727
5728 !! test
5729 Link with space in namespace
5730 !! wikitext
5731 [[User talk:Foo bar]]
5732 !! html
5733 <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>
5734 </p>
5735 !! end
5736
5737 !! article
5738 MemoryAlpha:AlphaTest
5739 !! text
5740 This is an article in the MemoryAlpha namespace
5741 (which shadows the memoryalpha interwiki link).
5742 !! endarticle
5743
5744 !! test
5745 Namespace takes precedence over interwiki link (bug 51680)
5746 !! wikitext
5747 [[MemoryAlpha:AlphaTest]]
5748 !! html
5749 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5750 </p>
5751 !! end
5752
5753 # The previous test doesn't work correctly in html2*, due to not recognizing the
5754 # link as an internal one. This one checks for the correct behavior.
5755 !! test
5756 Link to namespace preferred over interwiki with correct rel attribute
5757 !! options
5758 parsoid=html2wt,html2html
5759 !! wikitext
5760 [[MemoryAlpha:AlphaTest]]
5761 !! html
5762 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5763 </p>
5764 !! end
5765
5766 !! test
5767 Piped link to namespace
5768 !! wikitext
5769 [[Meta:Disclaimers|The disclaimers]]
5770 !! html
5771 <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>
5772 </p>
5773 !! end
5774
5775 !! test
5776 Link containing }
5777 !! wikitext
5778 [[Usually caused by a typo (oops}]]
5779 !! html
5780 <p>[[Usually caused by a typo (oops}]]
5781 </p>
5782 !! end
5783
5784 !! article
5785 7% Solution
5786 !! text
5787 Just a test of an article title containing a percent.
5788 !! endarticle
5789
5790 !! test
5791 Link containing % (not as a hex sequence)
5792 !! wikitext
5793 [[7% Solution]]
5794 !! html/php
5795 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5796 </p>
5797 !! html/parsoid
5798 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5799 !! end
5800
5801 # note that the parsoid HTML is identical to the previous test output,
5802 # so the previous test ensures that the html2wt mode will generate the
5803 # "not as a hex sequence" wikitext.
5804 !! test
5805 Link containing % as a single hex sequence interpreted to char
5806 !! options
5807 parsoid=wt2wt,wt2html,html2html
5808 !! wikitext
5809 [[7%25 Solution]]
5810 !! html/php
5811 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5812 </p>
5813 !! html/parsoid
5814 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5815 !!end
5816
5817 !! test
5818 Link containing % as a double hex sequence interpreted to hex sequence
5819 !! wikitext
5820 [[7%2525 Solution]]
5821 !! html
5822 <p>[[7%2525 Solution]]
5823 </p>
5824 !!end
5825
5826 # note that parsoid does not munge anchor text; all non-space
5827 # characters are valid in HTML5 anchors.
5828 !! test
5829 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5830 Example for such a section: == < ==
5831 !! wikitext
5832 [[%23%3c]][[%23%3e]]
5833 !! html/php
5834 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5835 </p>
5836 !! html/parsoid
5837 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5838 !! end
5839
5840 !! test
5841 Link containing "<#" and ">#" as a hex sequences
5842 !! wikitext
5843 [[%3c%23]][[%3e%23]]
5844 !! html
5845 <p>[[%3c%23]][[%3e%23]]
5846 </p>
5847 !! end
5848
5849 !! test
5850 Link containing an equals sign
5851 !! wikitext
5852 [[Special:BookSources/isbn=4-00-026157-6]]
5853 !! html/php
5854 <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>
5855 </p>
5856 !! html/parsoid
5857 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5858 !! end
5859
5860 !! article
5861 Foo~bar
5862 !! text
5863 Just a test of an article title containing a tilde.
5864 !! endarticle
5865
5866 # note that links containing signatures, like [[Foo~~~~]], are
5867 # massaged by the pre-save transform (PST) and so the tildes are never
5868 # seen by the parser.
5869 !! test
5870 Link containing a tilde
5871 !! wikitext
5872 [[Foo~bar]]
5873 !! html/php
5874 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5875 </p>
5876 !! html/parsoid
5877 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5878 !! end
5879
5880 !! test
5881 Link containing double-single-quotes '' (bug 4598)
5882 !! wikitext
5883 [[Lista d''e paise d''o munno]]
5884 !! html/php
5885 <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>
5886 </p>
5887 !! html/parsoid
5888 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5889 !! end
5890
5891 !! test
5892 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5893 !! wikitext
5894 Some [[Link|pretty ''italics'' and stuff]]!
5895 !! html/php
5896 <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>!
5897 </p>
5898 !! html/parsoid
5899 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5900 !! end
5901
5902 !! test
5903 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5904 !! wikitext
5905 ''Some [[Link|pretty ''italics'' and stuff]]!''
5906 !! html
5907 <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>
5908 </p>
5909 !! end
5910
5911 !! test
5912 Link with double quotes in title part (literal) and alternate part (interpreted)
5913 !! wikitext
5914 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5915
5916 [[''Pentecoste'']]
5917
5918 [[''Pentecoste''|Pentecoste]]
5919
5920 [[''Pentecoste''|''Pentecoste'']]
5921 !! html/php
5922 <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>
5923 </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>
5924 </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>
5925 </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>
5926 </p>
5927 !! html/parsoid
5928 <meta typeof="mw:Placeholder"/>
5929 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5930 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5931 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5932 !! end
5933
5934 !! test
5935 Broken image links with HTML captions (bug 39700)
5936 !! wikitext
5937 [[File:Nonexistent|<script></script>]]
5938 [[File:Nonexistent|100px|<script></script>]]
5939 [[File:Nonexistent|&lt;]]
5940 [[File:Nonexistent|a<i>b</i>c]]
5941 !! html
5942 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5943 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5944 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5945 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5946 </p>
5947 !! end
5948
5949 !! test
5950 Plain link to URL
5951 !! wikitext
5952 [[http://www.example.com]]
5953 !! html/php
5954 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5955 </p>
5956 !! html/parsoid
5957 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5958 !! end
5959
5960 !! test
5961 Plain link to URL with link text
5962 !! wikitext
5963 [[http://www.example.com Link text]]
5964 !! html
5965 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5966 </p>
5967 !! end
5968
5969 !! test
5970 Plain link to protocol-relative URL
5971 !! wikitext
5972 [[//www.example.com]]
5973 !! html/php
5974 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5975 </p>
5976 !! html/parsoid
5977 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5978 !! end
5979
5980 !! test
5981 Plain link to protocol-relative URL with link text
5982 !! wikitext
5983 [[//www.example.com Link text]]
5984 !! html
5985 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5986 </p>
5987 !! end
5988
5989 !! test
5990 Plain link to page with question mark in title
5991 !! wikitext
5992 [[A?b]]
5993
5994 [[A?b|Baz]]
5995 !! html
5996 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5997 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5998 </p>
5999 !! end
6000
6001
6002 # I'm fairly sure the expected result here is wrong.
6003 # We want these to be URL links, not pseudo-pages with URLs for titles....
6004 # However the current output is also pretty screwy.
6005 #
6006 # ----
6007 # I'm changing it to match the current output--it arguably makes more
6008 # sense in the light of the test above. Old expected result was:
6009 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6010 #</p>
6011 # But I think this test is bordering on "garbage in, garbage out" anyway.
6012 # -- wtm
6013 !! test
6014 Piped link to URL
6015 !! wikitext
6016 Piped link to URL: [[http://www.example.com|an example URL]]
6017 !! html/php
6018 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6019 </p>
6020 !! html/parsoid
6021 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6022 !! end
6023
6024 !! test
6025 BUG 2: [[page|http://url/]] should link to page, not http://url/
6026 !! wikitext
6027 [[Main Page|http://url/]]
6028 !! html/php
6029 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6030 </p>
6031 !! html/parsoid
6032 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
6033 !! end
6034
6035 # Parsoid does not mark self-links, by design.
6036 !! test
6037 BUG 337: Escaped self-links should be bold
6038 !! options
6039 title=[[Bug462]]
6040 !! wikitext
6041 [[Bu&#103;462]] [[Bug462]]
6042 !! html/php
6043 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6044 </p>
6045 !! html/parsoid
6046 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6047 !! end
6048
6049 !! test
6050 Self-link to section should not be bold
6051 !! options
6052 title=[[Main Page]]
6053 !! wikitext
6054 [[Main Page#section]]
6055 !! html
6056 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6057 </p>
6058 !! end
6059
6060 !! article
6061 00
6062 !! text
6063 This is 00.
6064 !! endarticle
6065
6066 !!test
6067 Self-link to numeric title
6068 !!options
6069 title=[[0]]
6070 !! wikitext
6071 [[0]]
6072 !! html
6073 <p><strong class="selflink">0</strong>
6074 </p>
6075 !!end
6076
6077 !!test
6078 Link to numeric-equivalent title
6079 !!options
6080 title=[[0]]
6081 !! wikitext
6082 [[00]]
6083 !! html
6084 <p><a href="/wiki/00" title="00">00</a>
6085 </p>
6086 !!end
6087
6088 !! test
6089 <nowiki> inside a link
6090 !! wikitext
6091 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6092 !! html
6093 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6094 </p>
6095 !! end
6096
6097 !! test
6098 Non-breaking spaces in title
6099 !! wikitext
6100 [[&nbsp; Main &nbsp; Page &nbsp;]]
6101 !! html
6102 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6103 </p>
6104 !!end
6105
6106 !! test
6107 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6108 !! options
6109 language=ca
6110 !! wikitext
6111 '''[[Main Page]]'''
6112 !! html
6113 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6114 </p>
6115 !! end
6116
6117 !! test
6118 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6119 !! options
6120 language=ca
6121 !! wikitext
6122 ''[[Main Page]]''
6123 !! html
6124 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6125 </p>
6126 !! end
6127
6128 !! test
6129 Internal link with en linktrail: no apostrophes (bug 27473)
6130 !! options
6131 language=en
6132 !! wikitext
6133 [[Something]]'nice
6134 !! html
6135 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6136 </p>
6137 !! end
6138
6139 !! test
6140 Internal link with ca linktrail with apostrophes (bug 27473)
6141 !! options
6142 language=ca
6143 !! wikitext
6144 [[Something]]'nice
6145 !! html
6146 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6147 </p>
6148 !! end
6149
6150 !! test
6151 Internal link with kaa linktrail with apostrophes (bug 27473)
6152 !! options
6153 language=kaa
6154 !! wikitext
6155 [[Something]]'nice
6156 !! html
6157 <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>
6158 </p>
6159 !! end
6160
6161 !! test
6162 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6163 !! wikitext
6164 [[User:Foo/Test/63636:Bar|Test]]
6165 !! html/php
6166 <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>
6167 </p>
6168 !! html/parsoid
6169 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6170 !! end
6171
6172 !! test
6173 1. Interaction of linktrail and template encapsulation
6174 !! options
6175 parsoid
6176 !! wikitext
6177 {{echo|[[Foo]]}}l
6178 !! html
6179 <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>
6180 !! end
6181
6182 !! test
6183 2. Interaction of linktrail and template encapsulation
6184 !! options
6185 parsoid
6186 !! wikitext
6187 {{echo|Some [[Fool]]}}s
6188 !! html
6189 <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>
6190 !! end
6191
6192 !! test
6193 3. Interaction of linktrail and template encapsulation
6194 !! options
6195 parsoid
6196 !! wikitext
6197 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6198 !! html
6199 <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>
6200 !! end
6201
6202 !! article
6203 Söfnuður
6204 !! text
6205 Test.
6206 !! endarticle
6207
6208 !! test
6209 Internal link with is link prefix
6210 !! options
6211 language=is
6212 !! wikitext
6213 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6214 !! html
6215 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6216 </p>
6217 !! end
6218
6219 !! article
6220 Mótmælendatrú
6221 !! text
6222 Test.
6223 !! endarticle
6224
6225 !! test
6226 Internal link with is link trail and link prefix
6227 !! options
6228 language=is
6229 !! wikitext
6230 [[mótmælendatrú|xxx]]ar
6231 [[mótmælendatrú]]ar
6232 mótmælenda[[söfnuður]]
6233 mótmælenda[[söfnuður|söfnuðir]]
6234 mótmælenda[[söfnuður|söfnuðir]]xxx
6235 !! html
6236 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6237 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6238 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6239 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6240 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6241 </p>
6242 !! end
6243
6244 !! test
6245 Parsoid link trail escaping
6246 !! options
6247 parsoid=html2wt,html2html
6248 !! wikitext
6249 [[apple]]<nowiki/>s
6250 !! html
6251 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6252 !! end
6253
6254 !! test
6255 Parsoid link prefix escaping
6256 !! options
6257 language=is
6258 parsoid=html2wt,html2html
6259 !! wikitext
6260 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6261 !! html
6262 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6263 !! end
6264
6265 !! test
6266 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6267 !! wikitext
6268 [[Foo| bar]]
6269
6270 [[Foo| ''bar'']]
6271
6272 [http://wp.org foo]
6273
6274 [http://wp.org ''foo'']
6275 !! html
6276 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
6277 </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>
6278 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6279 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6280 </p>
6281 !! end
6282
6283 !! test
6284 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6285 !! options
6286 parsoid
6287 !! wikitext
6288 [[Foo|{{echo|a}} b {{echo|c}}]]
6289 !! html
6290 <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>
6291 !! end
6292
6293 !! test
6294 Link with angle bracket after anchor
6295 !! wikitext
6296 [[Foo#<bar>]]
6297 !! html/parsoid
6298 <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>
6299 !! end
6300
6301 ###
6302 ### Interwiki links (see maintenance/interwiki.sql)
6303 ###
6304
6305 !! test
6306 Inline interwiki link
6307 !! wikitext
6308 [[MeatBall:SoftSecurity]]
6309 !! html
6310 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6311 </p>
6312 !! end
6313
6314 !! test
6315 Inline interwiki link with empty title (bug 2372)
6316 !! wikitext
6317 [[MeatBall:]]
6318 !! html
6319 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6320 </p>
6321 !! end
6322
6323 !! test
6324 Interwiki link encoding conversion (bug 1636)
6325 !! wikitext
6326 *[[Wikipedia:ro:Olteni&#0355;a]]
6327 *[[Wikipedia:ro:Olteni&#355;a]]
6328 !! html
6329 <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>
6330 <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>
6331
6332 !! end
6333
6334 !! test
6335 Interwiki link with fragment (bug 2130)
6336 !! wikitext
6337 [[MeatBall:SoftSecurity#foo]]
6338 !! html
6339 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6340 </p>
6341 !! end
6342
6343 # Ideally the wikipedia: prefix here should be proto-relative too
6344 !! test
6345 Different interwiki prefixes mapping to the same URL
6346 !! wikitext
6347 [[:en:Foo]]
6348
6349 [[:en:Foo|Foo]]
6350
6351 [[wikipedia:Foo]]
6352
6353 [[:wikipedia:Foo|Foo]]
6354
6355 [[wikipedia:en:Foo]]
6356
6357 [[:wikipedia:en:Foo]]
6358 !! html/parsoid
6359 <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>
6360
6361 <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>
6362
6363 <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>
6364
6365 <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>
6366
6367 <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>
6368
6369 <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>
6370 !! end
6371
6372 !! test
6373 Interwiki links that cannot be represented in wiki syntax
6374 !! wikitext
6375 [[meatball:ok]]
6376 [[meatball:ok#foo|ok with fragment]]
6377 [[meatball:ok_as_well?|ok ending with ? mark]]
6378 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6379 [http://de.wikipedia.org/wiki/#foo is just fragment]
6380
6381 !! html/parsoid
6382 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6383 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6384 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6385 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6386 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6387 !! end
6388
6389 !! test
6390 Interwiki links: trail
6391 !! options
6392 parsoid
6393 !! wikitext
6394 [[wikipedia:Foo|Ba]]r
6395 !! html
6396 <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>
6397 !! end
6398
6399 ###
6400 ### Interlanguage links
6401 ### Language links (so that searching for '### language' matches..)
6402 ###
6403
6404 !! test
6405 Interlanguage link
6406 !! wikitext
6407 Blah blah blah
6408 [[zh:Chinese]]
6409 !! html
6410 <p>Blah blah blah
6411 </p>
6412 !! end
6413
6414 !! test
6415 Double interlanguage link
6416 !! wikitext
6417 Blah blah blah
6418 [[es:Spanish]]
6419 [[zh:Chinese]]
6420 !! html
6421 <p>Blah blah blah
6422 </p>
6423 !! end
6424
6425 !! test
6426 Interlanguage link, with prefix links
6427 !! options
6428 language=ln
6429 !! wikitext
6430 Blah blah blah
6431 [[zh:Chinese]]
6432 !! html
6433 <p>Blah blah blah
6434 </p>
6435 !! end
6436
6437 !! test
6438 Double interlanguage link, with prefix links (bug 8897)
6439 !! options
6440 language=ln
6441 !! wikitext
6442 Blah blah blah
6443 [[es:Spanish]]
6444 [[zh:Chinese]]
6445 !! html
6446 <p>Blah blah blah
6447 </p>
6448 !! end
6449
6450 !! test
6451 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6452 !! wikitext
6453 Blah blah blah
6454 [[mul:Multilingual]]
6455 !! html
6456 <p>Blah blah blah
6457 </p>
6458 !! end
6459
6460 !! test
6461 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6462 !! options
6463 language=ln
6464 !! wikitext
6465 [[WW&nbsp;II]]
6466 !! html
6467 <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>
6468 </p>
6469 !! end
6470
6471 !! test
6472 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6473 !! options
6474 parsoid=html2wt
6475 !! wikitext
6476 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6477
6478 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6479 !! html
6480 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6481 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6482 !! end
6483
6484 !! test
6485 Parsoid: handle constructor well
6486 !! options
6487 parsoid
6488 !! wikitext
6489 [[constructor]]
6490
6491 [[constructor:foo]]
6492 !! html
6493 <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>
6494
6495 <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>
6496 !! end
6497
6498 !! test
6499 Parsoid: recognize interlanguage links without a target page
6500 !! options
6501 parsoid
6502 !! wikitext
6503 [[ko:]]
6504 !! html
6505 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6506 !! end
6507
6508 !! test
6509 Parsoid: recognize interwiki links without a target page
6510 !! options
6511 parsoid
6512 !! wikitext
6513 [[:ko:]]
6514 !! html
6515 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6516 !! end
6517
6518 !! test
6519 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6520 !! options
6521 parsoid
6522 !! wikitext
6523 [[en:Foo]]
6524 !! html
6525 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6526 !! end
6527
6528 ###
6529 ### Redirects, Parsoid-only
6530 ###
6531 !! test
6532 1. Simple redirect to page
6533 !! options
6534 parsoid
6535 !! wikitext
6536 #REDIRECT [[Main Page]]
6537 !! html
6538 <link rel="mw:PageProp/redirect" href="./Main_Page">
6539 !! end
6540
6541 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6542 !! test
6543 2. Other redirect variants
6544 !! options
6545 parsoid=wt2html,wt2wt
6546 !! wikitext
6547 #REDIRECT [[Main_Page]]
6548 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6549 !! html
6550 <link rel="mw:PageProp/redirect" href="./Main_Page">
6551 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6552 !! end
6553
6554 !! test
6555 Empty redirect
6556 !! options
6557 parsoid=wt2html,wt2wt
6558 !! wikitext
6559 #REDIRECT [[]]
6560 !! html
6561 <ol>
6562 <li>REDIRECT [[]]</li></ol>
6563 !! end
6564
6565 !! test
6566 Optional colon in #REDIRECT
6567 !! options
6568 # the colon is archaic syntax. we support it for wt2html, but we
6569 # don't care that it roundtrips back to the modern syntax.
6570 parsoid=wt2html,html2html
6571 !! wikitext
6572 #REDIRECT:[[Main Page]]
6573 !! html
6574 <link rel="mw:PageProp/redirect" href="./Main_Page">
6575 !! end
6576
6577 !! test
6578 Whitespace in #REDIRECT with optional colon
6579 !! options
6580 # the colon and gratuitous whitespace is archaic syntax. we support
6581 # it for wt2html, but we don't care that it roundtrips back to the
6582 # modern syntax (without extra whitespace)
6583 parsoid=wt2html,html2html
6584 !! wikitext
6585
6586 #REDIRECT
6587 :
6588 [[Main Page]]
6589 !! html
6590 <link rel="mw:PageProp/redirect" href="./Main_Page">
6591 !! end
6592
6593 !! test
6594 Piped link in #REDIRECT
6595 !! options
6596 # content after piped link is ignored. we support this syntax,
6597 # but don't care that the piped link is lost when we roundtrip this.
6598 parsoid=wt2html
6599 !! wikitext
6600 #REDIRECT [[Main Page|bar]]
6601 !! html
6602 <link rel="mw:PageProp/redirect" href="./Main_Page">
6603 !! end
6604
6605 !! test
6606 Redirect to category
6607 !! options
6608 parsoid=wt2html
6609 !! wikitext
6610 #REDIRECT [[Category:Foo]]
6611 !! html
6612 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6613 !! end
6614
6615 !! test
6616 Redirect to category with URL encoding
6617 !! options
6618 parsoid=wt2html
6619 !! wikitext
6620 #REDIRECT [[Category%3AFoo]]
6621 !! html
6622 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6623 !! end
6624
6625 !! test
6626 Redirect to category page
6627 !! options
6628 parsoid=wt2html,html2html
6629 !! wikitext
6630 #REDIRECT [[:Category:Foo]]
6631 !! html
6632 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6633 !! end
6634
6635 !! test
6636 Redirect to image page (1)
6637 !! options
6638 parsoid
6639 !! wikitext
6640 #REDIRECT [[File:Wiki.png]]
6641 !! html
6642 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6643 !! end
6644
6645 !! test
6646 Redirect to image page (2)
6647 !! options
6648 parsoid
6649 !! wikitext
6650 #REDIRECT [[Image:Wiki.png]]
6651 !! html
6652 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6653 !! end
6654
6655 !! test
6656 Redirect to language
6657 !! options
6658 parsoid
6659 !! wikitext
6660 #REDIRECT [[en:File:Wiki.png]]
6661 !! html
6662 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6663 !! end
6664
6665 !! test
6666 Redirect to interwiki
6667 !! options
6668 parsoid
6669 !! wikitext
6670 #REDIRECT [[meatball:File:Wiki.png]]
6671 !! html
6672 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6673 !! end
6674
6675 !! test
6676 Non-English #REDIRECT
6677 !! options
6678 parsoid
6679 language=is
6680 !! wikitext
6681 #TILVÍSUN [[Main Page]]
6682 !! html
6683 <link rel="mw:PageProp/redirect" href="./Main_Page">
6684 !! end
6685
6686 !! test
6687 New redirect
6688 !! options
6689 parsoid=html2wt
6690 !! wikitext
6691 Foo
6692 #REDIRECT [[Foo]]
6693 !! html
6694 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6695 !! end
6696
6697 ##
6698 ## XHTML tidiness
6699 ###
6700
6701 !! test
6702 <br> to <br />
6703 !! wikitext
6704 1<br>2<br />3
6705 !! html
6706 <p>1<br />2<br />3
6707 </p>
6708 !! end
6709
6710 !! test
6711 Broken br tag sanitization
6712 !! wikitext
6713 </br>
6714 !! html/php
6715 <p>&lt;/br&gt;
6716 </p>
6717 !! end
6718
6719 # TODO: Fix html2html mode (bug 51055)!
6720 !! test
6721 Parsoid: Broken br tag recognition
6722 !! options
6723 parsoid=wt2html
6724 !! wikitext
6725 </br>
6726
6727 <br/ >
6728 !! html/parsoid
6729 <p><br></p>
6730 <p><br/></p>
6731 !! end
6732
6733 !! test
6734 Incorrecly removing closing slashes from correctly formed XHTML
6735 !! wikitext
6736 <br style="clear:both;" />
6737 !! html
6738 <p><br style="clear:both;" />
6739 </p>
6740 !! end
6741
6742 !! test
6743 Failing to transform badly formed HTML into correct XHTML
6744 !! wikitext
6745 <br style="clear: left;">
6746 <br style="clear: right;">
6747 <br style="clear: both;">
6748 !! html
6749 <p><br style="clear: left;" />
6750 <br style="clear: right;" />
6751 <br style="clear: both;" />
6752 </p>
6753 !!end
6754
6755 !! test
6756 Handling html with a div self-closing tag
6757 !! wikitext
6758 <div title />
6759 <div title/>
6760 <div title/ >
6761 <div title=bar />
6762 <div title=bar/>
6763 <div title=bar/ >
6764 !! html
6765 <p>&lt;div title /&gt;
6766 &lt;div title/&gt;
6767 </p>
6768 <div>
6769 <p>&lt;div title=bar /&gt;
6770 &lt;div title=bar/&gt;
6771 </p>
6772 <div title="bar/"></div>
6773 </div>
6774
6775 !! end
6776
6777 !! test
6778 Handling html with a br self-closing tag
6779 !! wikitext
6780 <br title />
6781 <br title/>
6782 <br title/ >
6783 <br title=bar />
6784 <br title=bar/>
6785 <br title=bar/ >
6786 !! html
6787 <p><br title="title" />
6788 <br title="title" />
6789 <br />
6790 <br title="bar" />
6791 <br title="bar" />
6792 <br title="bar/" />
6793 </p>
6794 !! end
6795
6796 !! test
6797 Horizontal ruler (should it add that extra space?)
6798 !! wikitext
6799 <hr>
6800 <hr >
6801 foo <hr
6802 > bar
6803 !! html
6804 <hr />
6805 <hr />
6806 foo <hr /> bar
6807
6808 !! end
6809
6810 !! test
6811 Horizontal ruler -- 4+ dashes render hr
6812 !! wikitext
6813 ----
6814 !! html
6815 <hr />
6816
6817 !! end
6818
6819 !! test
6820 Horizontal ruler -- eats additional dashes on the same line
6821 !! wikitext
6822 ---------
6823 !! html
6824 <hr />
6825
6826 !! end
6827
6828 !! test
6829 Horizontal ruler -- does not collapse dashes on consecutive lines
6830 !! wikitext
6831 ----
6832 ----
6833 !! html
6834 <hr />
6835 <hr />
6836
6837 !! end
6838
6839 !! test
6840 Horizontal ruler -- <4 dashes render as plain text
6841 !! wikitext
6842 ---
6843 !! html
6844 <p>---
6845 </p>
6846 !! end
6847
6848 !! test
6849 Horizontal ruler -- Supports content following dashes on same line
6850 !! wikitext
6851 ---- Foo
6852 !! html
6853 <hr /> Foo
6854
6855 !! end
6856
6857 ###
6858 ### Block-level elements
6859 ###
6860 !! test
6861 Common list
6862 !! wikitext
6863 *Common list
6864 * item 2
6865 *item 3
6866 !! html
6867 <ul><li>Common list</li>
6868 <li> item 2</li>
6869 <li>item 3</li></ul>
6870
6871 !! end
6872
6873 !! test
6874 Numbered list
6875 !! wikitext
6876 #Numbered list
6877 #item 2
6878 # item 3
6879 !! html
6880 <ol><li>Numbered list</li>
6881 <li>item 2</li>
6882 <li> item 3</li></ol>
6883
6884 !! end
6885
6886 !! test
6887 Mixed list
6888 !! wikitext
6889 *Mixed list
6890 *# with numbers
6891 ** and bullets
6892 *# and numbers
6893 *bullets again
6894 **bullet level 2
6895 ***bullet level 3
6896 ***#Number on level 4
6897 **bullet level 2
6898 **#Number on level 3
6899 **#Number on level 3
6900 *#number level 2
6901 *Level 1
6902 *** Level 3
6903 #** Level 3, but ordered
6904 !! html
6905 <ul><li>Mixed list
6906 <ol><li> with numbers</li></ol>
6907 <ul><li> and bullets</li></ul>
6908 <ol><li> and numbers</li></ol></li>
6909 <li>bullets again
6910 <ul><li>bullet level 2
6911 <ul><li>bullet level 3
6912 <ol><li>Number on level 4</li></ol></li></ul></li>
6913 <li>bullet level 2
6914 <ol><li>Number on level 3</li>
6915 <li>Number on level 3</li></ol></li></ul>
6916 <ol><li>number level 2</li></ol></li>
6917 <li>Level 1
6918 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6919 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6920
6921 !! end
6922
6923 !! test
6924 Nested lists 1
6925 !! wikitext
6926 *foo
6927 **bar
6928 !! html
6929 <ul><li>foo
6930 <ul><li>bar</li></ul></li></ul>
6931
6932 !! end
6933
6934 !! test
6935 Nested lists 2
6936 !! wikitext
6937 **foo
6938 *bar
6939 !! html
6940 <ul><li><ul><li>foo</li></ul></li>
6941 <li>bar</li></ul>
6942
6943 !! end
6944
6945 !! test
6946 Nested lists 3 (first element empty)
6947 !! wikitext
6948 *
6949 **bar
6950 !! html
6951 <ul><li>
6952 <ul><li>bar</li></ul></li></ul>
6953
6954 !! end
6955
6956 !! test
6957 Nested lists 4 (first element empty)
6958 !! wikitext
6959 **
6960 *bar
6961 !! html
6962 <ul><li><ul><li></li></ul></li>
6963 <li>bar</li></ul>
6964
6965 !! end
6966
6967 !! test
6968 Nested lists 5 (both elements empty)
6969 !! wikitext
6970 **
6971 *
6972 !! html
6973 <ul><li><ul><li></li></ul></li>
6974 <li></li></ul>
6975
6976 !! end
6977
6978 !! test
6979 Nested lists 6 (both elements empty)
6980 !! wikitext
6981 *
6982 **
6983 !! html
6984 <ul><li>
6985 <ul><li></li></ul></li></ul>
6986
6987 !! end
6988
6989 !! test
6990 Nested lists 7 (skip initial nesting levels)
6991 !! wikitext
6992 *** foo
6993 !! html
6994 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6995
6996 !! end
6997
6998 !! test
6999 Nested lists 8 (multiple nesting transitions)
7000 !! wikitext
7001 * foo
7002 *** bar
7003 ** baz
7004 * boo
7005 !! html
7006 <ul><li> foo
7007 <ul><li><ul><li> bar</li></ul></li>
7008 <li> baz</li></ul></li>
7009 <li> boo</li></ul>
7010
7011 !! end
7012
7013 !! test
7014 1. Lists with start-of-line-transparent tokens before bullets: Comments
7015 !! wikitext
7016 *foo
7017 *<!--cmt-->bar
7018 <!--cmt-->*baz
7019 !! html
7020 <ul><li>foo</li>
7021 <li>bar</li>
7022 <li>baz</li></ul>
7023
7024 !! end
7025
7026 !! test
7027 2. Lists with start-of-line-transparent tokens before bullets: Template close
7028 !! wikitext
7029 *foo {{echo|bar
7030 }}*baz
7031 !! html
7032 <ul><li>foo bar</li>
7033 <li>baz</li></ul>
7034
7035 !! end
7036
7037 !! test
7038 List items are not parsed correctly following a <pre> block (bug 785)
7039 !! wikitext
7040 * <pre>foo</pre>
7041 * <pre>bar</pre>
7042 * zar
7043 !! html
7044 <ul><li> <pre>foo</pre></li>
7045 <li> <pre>bar</pre></li>
7046 <li> zar</li></ul>
7047
7048 !! end
7049
7050 !! test
7051 List items from template
7052 !! wikitext
7053
7054 {{inner list}}
7055 * item 2
7056
7057 * item 0
7058 {{inner list}}
7059 * item 2
7060
7061 * item 0
7062 * notSOL{{inner list}}
7063 * item 2
7064 !! html
7065 <ul><li> item 1</li>
7066 <li> item 2</li></ul>
7067 <ul><li> item 0</li>
7068 <li> item 1</li>
7069 <li> item 2</li></ul>
7070 <ul><li> item 0</li>
7071 <li> notSOL</li>
7072 <li> item 1</li>
7073 <li> item 2</li></ul>
7074
7075 !! end
7076
7077 !! test
7078 List interrupted by empty line or heading
7079 !! wikitext
7080 * foo
7081
7082 ** bar
7083 == A heading ==
7084 * Another list item
7085 !! html
7086 <ul><li> foo</li></ul>
7087 <ul><li><ul><li> bar</li></ul></li></ul>
7088 <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>
7089 <ul><li> Another list item</li></ul>
7090
7091 !!end
7092
7093 !!test
7094 Multiple list tags generated by templates
7095 !! wikitext
7096 {{echo|<li>}}a
7097 {{echo|<li>}}b
7098 {{echo|<li>}}c
7099 !! html
7100 <li>a
7101 <li>b
7102 <li>c</li>
7103 </li>
7104 </li>
7105
7106 !!end
7107
7108 !!test
7109 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7110 !! wikitext
7111 *a
7112 <!--This line will NOT split the list-->
7113 *b
7114 <!--This line will NOT split the list either-->
7115 *c
7116 <!--foo--> <!----> <!--This line NOT split the list either-->
7117 *d
7118 !! html
7119 <ul><li>a</li>
7120 <li>b</li>
7121 <li>c</li>
7122 <li>d</li></ul>
7123
7124 !!end
7125
7126 !!test
7127 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7128 !! wikitext
7129 *a
7130 <!--This line will NOT split the list-->
7131 *b
7132 <!--This line will NOT split the list either-->
7133 *c
7134 <!--foo--> <!----> <!--This line NOT split the list
7135 either-->
7136 *d
7137 !! html
7138 <ul><li>a</li>
7139 <li>b</li>
7140 <li>c</li>
7141 <li>d</li></ul>
7142
7143 !!end
7144
7145 !!test
7146 Test the li-hack
7147 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7148 !!options
7149 parsoid=wt2html,wt2wt
7150 !! wikitext
7151 * foo
7152 * <li>li-hack
7153 * {{echo|<li>templated li-hack}}
7154 * <!--foo--> <li> unsupported li-hack with preceding comments
7155
7156 <ul>
7157 <li><li>not a li-hack
7158 </li>
7159 </ul>
7160 !! html
7161 <ul>
7162 <li> foo</li>
7163 <li>li-hack</li>
7164 <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>
7165 <li> <!--foo--> </li>
7166 <li> li-hack with preceding comments</li>
7167 </ul>
7168
7169 <ul>
7170 <li></li>
7171 <li>not a li-hack
7172 </li>
7173 </ul>
7174 !!end
7175
7176 !! test
7177 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7178 !! options
7179 parsoid
7180 !! wikitext
7181 # foo
7182 ## bar
7183 * foo
7184 ** bar
7185 : foo
7186 :: bar
7187 !! html
7188 <ol>
7189 <li> foo<ol>
7190 <li> bar</li>
7191 </ol></li>
7192 </ol><ul>
7193 <li> foo<ul>
7194 <li> bar</li>
7195 </ul></li>
7196 </ul><dl>
7197 <dd> foo<dl>
7198 <dd> bar</dd>
7199 </dl></dd>
7200 </dl>
7201 !! end
7202
7203 !! test
7204 Parsoid: Test of whitespace serialization with Templated bullets
7205 !! options
7206 parsoid
7207 !! wikitext
7208 * {{bullet}}
7209 !! html
7210 <ul>
7211 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7212 </ul>
7213 !! end
7214
7215 # ------------------------------------------------------------------------
7216 # The next set of tests are about Parsoid's ability to handle badly nested
7217 # tags (parse, minimize scope of fixup, and roundtrip back)
7218 # ------------------------------------------------------------------------
7219
7220 !! test
7221 Unbalanced closing block tags break a list
7222 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7223 !! wikitext
7224 <div>
7225 *a</div><div>
7226 *b</div>
7227 !! html/parsoid
7228 <div>
7229 <ul>
7230 <li>a
7231 </li>
7232 </ul></div><div>
7233 <ul>
7234 <li>b
7235 </li>
7236 </ul></div>
7237 !! end
7238
7239 !! test
7240 Unbalanced closing non-block tags don't break a list
7241 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7242 !! wikitext
7243 <span>
7244 *a</span><span>
7245 *b</span>
7246 !! html/parsoid
7247 <p><span></span>
7248 </p>
7249 <ul>
7250 <li>a<span></span>
7251 </li>
7252 <li>b
7253 </li>
7254 </ul>
7255 !! end
7256
7257 !! test
7258 Unclosed formatting tags that straddle lists are closed and reopened
7259 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7260 !! wikitext
7261 # <s> a
7262 # b </s>
7263 !! html/parsoid
7264 <ol>
7265 <li> <s> a </s>
7266 </li>
7267 <li> <s> b </s>
7268 </li>
7269 </ol>
7270 !! end
7271
7272 !!test
7273 List embedded in a non-block tag
7274 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7275 !! wikitext
7276 <small>
7277 * foo
7278 </small>
7279 !! html/parsoid
7280 <p><small></small></p>
7281 <small>
7282 <ul>
7283 <li> foo</li>
7284 </ul>
7285 </small>
7286 <p><small></small></p>
7287 !!end
7288
7289 !! test
7290 Table with missing opening <tr> tag
7291 !! options
7292 parsoid=wt2html,wt2wt
7293 !! wikitext
7294 <table>
7295 <td>foo</td>
7296 </tr>
7297 </table>
7298 !! html/parsoid
7299 <table>
7300 <tr>
7301 <td>foo</td>
7302 </tr>
7303 </table>
7304 !! end
7305
7306 ###
7307 ### Magic Words
7308 ###
7309
7310 # Note that the current date is hard-coded as
7311 # 1970-01-01T00:02:03Z (a Thursday)
7312 # when running parser tests. The timezone is also fixed to GMT, so
7313 # local date will be identical to current date.
7314
7315 !! test
7316 Magic Word: {{CURRENTDAY}}
7317 !! wikitext
7318 {{CURRENTDAY}}
7319 !! html
7320 <p>1
7321 </p>
7322 !! end
7323
7324 !! test
7325 Magic Word: {{CURRENTDAY2}}
7326 !! wikitext
7327 {{CURRENTDAY2}}
7328 !! html
7329 <p>01
7330 </p>
7331 !! end
7332
7333 !! test
7334 Magic Word: {{CURRENTDAYNAME}}
7335 !! wikitext
7336 {{CURRENTDAYNAME}}
7337 !! html
7338 <p>Thursday
7339 </p>
7340 !! end
7341
7342 !! test
7343 Magic Word: {{CURRENTDOW}}
7344 !! wikitext
7345 {{CURRENTDOW}}
7346 !! html
7347 <p>4
7348 </p>
7349 !! end
7350
7351 !! test
7352 Magic Word: {{CURRENTMONTH}}
7353 !! wikitext
7354 {{CURRENTMONTH}}
7355 !! html
7356 <p>01
7357 </p>
7358 !! end
7359
7360 !! test
7361 Magic Word: {{CURRENTMONTH1}}
7362 !! wikitext
7363 {{CURRENTMONTH1}}
7364 !! html
7365 <p>1
7366 </p>
7367 !! end
7368
7369 !! test
7370 Magic Word: {{CURRENTMONTHABBREV}}
7371 !! wikitext
7372 {{CURRENTMONTHABBREV}}
7373 !! html
7374 <p>Jan
7375 </p>
7376 !! end
7377
7378 !! test
7379 Magic Word: {{CURRENTMONTHNAME}}
7380 !! wikitext
7381 {{CURRENTMONTHNAME}}
7382 !! html
7383 <p>January
7384 </p>
7385 !! end
7386
7387 !! test
7388 Magic Word: {{CURRENTMONTHNAMEGEN}}
7389 !! wikitext
7390 {{CURRENTMONTHNAMEGEN}}
7391 !! html
7392 <p>January
7393 </p>
7394 !! end
7395
7396 !! test
7397 Magic Word: {{CURRENTTIME}}
7398 !! wikitext
7399 {{CURRENTTIME}}
7400 !! html
7401 <p>00:02
7402 </p>
7403 !! end
7404
7405 !! test
7406 Magic Word: {{CURRENTHOUR}}
7407 !! wikitext
7408 {{CURRENTHOUR}}
7409 !! html
7410 <p>00
7411 </p>
7412 !! end
7413
7414 !! test
7415 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7416 !! wikitext
7417 {{CURRENTWEEK}}
7418 !! html
7419 <p>1
7420 </p>
7421 !! end
7422
7423 !! test
7424 Magic Word: {{CURRENTYEAR}}
7425 !! wikitext
7426 {{CURRENTYEAR}}
7427 !! html
7428 <p>1970
7429 </p>
7430 !! end
7431
7432 !! test
7433 Magic Word: {{CURRENTTIMESTAMP}}
7434 !! wikitext
7435 {{CURRENTTIMESTAMP}}
7436 !! html
7437 <p>19700101000203
7438 </p>
7439 !! end
7440
7441 !! test
7442 Magic Words LOCAL (UTC)
7443 !! wikitext
7444 * {{LOCALMONTH}}
7445 * {{LOCALMONTH1}}
7446 * {{LOCALMONTHNAME}}
7447 * {{LOCALMONTHNAMEGEN}}
7448 * {{LOCALMONTHABBREV}}
7449 * {{LOCALDAY}}
7450 * {{LOCALDAY2}}
7451 * {{LOCALDAYNAME}}
7452 * {{LOCALYEAR}}
7453 * {{LOCALTIME}}
7454 * {{LOCALHOUR}}
7455 * {{LOCALWEEK}}
7456 * {{LOCALDOW}}
7457 * {{LOCALTIMESTAMP}}
7458 !! html
7459 <ul><li> 01</li>
7460 <li> 1</li>
7461 <li> January</li>
7462 <li> January</li>
7463 <li> Jan</li>
7464 <li> 1</li>
7465 <li> 01</li>
7466 <li> Thursday</li>
7467 <li> 1970</li>
7468 <li> 00:02</li>
7469 <li> 00</li>
7470 <li> 1</li>
7471 <li> 4</li>
7472 <li> 19700101000203</li></ul>
7473
7474 !! end
7475
7476 !! test
7477 Magic Word: {{FULLPAGENAME}}
7478 !! options
7479 title=[[User:Ævar Arnfjörð Bjarmason]]
7480 !! wikitext
7481 {{FULLPAGENAME}}
7482 !! html
7483 <p>User:Ævar Arnfjörð Bjarmason
7484 </p>
7485 !! end
7486
7487 !! test
7488 Magic Word: {{FULLPAGENAMEE}}
7489 !! options
7490 title=[[User:Ævar Arnfjörð Bjarmason]]
7491 !! wikitext
7492 {{FULLPAGENAMEE}}
7493 !! html
7494 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7495 </p>
7496 !! end
7497
7498 !! test
7499 Magic Word: {{TALKSPACE}}
7500 !! options
7501 title=[[User:Ævar Arnfjörð Bjarmason]]
7502 !! wikitext
7503 {{TALKSPACE}}
7504 !! html
7505 <p>User talk
7506 </p>
7507 !! end
7508
7509 !! test
7510 Magic Word: {{TALKSPACE}}, same namespace
7511 !! options
7512 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7513 !! wikitext
7514 {{TALKSPACE}}
7515 !! html
7516 <p>User talk
7517 </p>
7518 !! end
7519
7520 !! test
7521 Magic Word: {{TALKSPACE}}, main namespace
7522 !! options
7523 title=[[Parser Test]]
7524 !! wikitext
7525 {{TALKSPACE}}
7526 !! html
7527 <p>Talk
7528 </p>
7529 !! end
7530
7531 !! test
7532 Magic Word: {{TALKSPACEE}}
7533 !! options
7534 title=[[User:Ævar Arnfjörð Bjarmason]]
7535 !! wikitext
7536 {{TALKSPACEE}}
7537 !! html
7538 <p>User_talk
7539 </p>
7540 !! end
7541
7542 !! test
7543 Magic Word: {{SUBJECTSPACE}}
7544 !! options
7545 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7546 !! wikitext
7547 {{SUBJECTSPACE}}
7548 !! html
7549 <p>User
7550 </p>
7551 !! end
7552
7553 !! test
7554 Magic Word: {{SUBJECTSPACE}}, same namespace
7555 !! options
7556 title=[[User:Ævar Arnfjörð Bjarmason]]
7557 !! wikitext
7558 {{SUBJECTSPACE}}
7559 !! html
7560 <p>User
7561 </p>
7562 !! end
7563
7564 !! test
7565 Magic Word: {{SUBJECTSPACE}}, main namespace
7566 !! options
7567 title=[[Parser Test]]
7568 !! wikitext
7569 {{SUBJECTSPACE}}
7570 !! html
7571
7572 !! end
7573
7574 !! test
7575 Magic Word: {{SUBJECTSPACEE}}
7576 !! options
7577 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7578 !! wikitext
7579 {{SUBJECTSPACEE}}
7580 !! html
7581 <p>User
7582 </p>
7583 !! end
7584
7585 !! test
7586 Magic Word: {{NAMESPACE}}
7587 !! options
7588 title=[[User:Ævar Arnfjörð Bjarmason]]
7589 !! wikitext
7590 {{NAMESPACE}}
7591 !! html
7592 <p>User
7593 </p>
7594 !! end
7595
7596 !! test
7597 Magic Word: {{NAMESPACEE}}
7598 !! options
7599 title=[[User:Ævar Arnfjörð Bjarmason]]
7600 !! wikitext
7601 {{NAMESPACEE}}
7602 !! html
7603 <p>User
7604 </p>
7605 !! end
7606
7607 !! test
7608 Magic Word: {{NAMESPACENUMBER}}
7609 !! options
7610 title=[[User:Ævar Arnfjörð Bjarmason]]
7611 !! wikitext
7612 {{NAMESPACENUMBER}}
7613 !! html
7614 <p>2
7615 </p>
7616 !! end
7617
7618 !! test
7619 Magic Word: {{SUBPAGENAME}}
7620 !! options
7621 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7622 !! wikitext
7623 {{SUBPAGENAME}}
7624 !! html
7625 <p>sub ö
7626 </p>
7627 !! end
7628
7629 !! test
7630 Magic Word: {{SUBPAGENAMEE}}
7631 !! options
7632 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7633 !! wikitext
7634 {{SUBPAGENAMEE}}
7635 !! html
7636 <p>sub_%C3%B6
7637 </p>
7638 !! end
7639
7640 !! test
7641 Magic Word: {{ROOTPAGENAME}}
7642 !! options
7643 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7644 !! wikitext
7645 {{ROOTPAGENAME}}
7646 !! html
7647 <p>Ævar Arnfjörð Bjarmason
7648 </p>
7649 !! end
7650
7651 !! test
7652 Magic Word: {{ROOTPAGENAMEE}}
7653 !! options
7654 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7655 !! wikitext
7656 {{ROOTPAGENAMEE}}
7657 !! html
7658 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7659 </p>
7660 !! end
7661
7662 !! test
7663 Magic Word: {{BASEPAGENAME}}
7664 !! options
7665 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7666 !! wikitext
7667 {{BASEPAGENAME}}
7668 !! html
7669 <p>Ævar Arnfjörð Bjarmason
7670 </p>
7671 !! end
7672
7673 !! test
7674 Magic Word: {{BASEPAGENAMEE}}
7675 !! options
7676 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7677 !! wikitext
7678 {{BASEPAGENAMEE}}
7679 !! html
7680 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7681 </p>
7682 !! end
7683
7684 !! test
7685 Magic Word: {{TALKPAGENAME}}
7686 !! options
7687 title=[[User:Ævar Arnfjörð Bjarmason]]
7688 !! wikitext
7689 {{TALKPAGENAME}}
7690 !! html
7691 <p>User talk:Ævar Arnfjörð Bjarmason
7692 </p>
7693 !! end
7694
7695 !! test
7696 Magic Word: {{TALKPAGENAMEE}}
7697 !! options
7698 title=[[User:Ævar Arnfjörð Bjarmason]]
7699 !! wikitext
7700 {{TALKPAGENAMEE}}
7701 !! html
7702 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7703 </p>
7704 !! end
7705
7706 !! test
7707 Magic Word: {{SUBJECTPAGENAME}}
7708 !! options
7709 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7710 !! wikitext
7711 {{SUBJECTPAGENAME}}
7712 !! html
7713 <p>User:Ævar Arnfjörð Bjarmason
7714 </p>
7715 !! end
7716
7717 !! test
7718 Magic Word: {{SUBJECTPAGENAMEE}}
7719 !! options
7720 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7721 !! wikitext
7722 {{SUBJECTPAGENAMEE}}
7723 !! html
7724 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7725 </p>
7726 !! end
7727
7728 !! test
7729 Magic Word: {{NUMBEROFFILES}}
7730 !! wikitext
7731 {{NUMBEROFFILES}}
7732 !! html
7733 <p>5
7734 </p>
7735 !! end
7736
7737 !! test
7738 Magic Word: {{PAGENAME}}
7739 !! options
7740 title=[[User:Ævar Arnfjörð Bjarmason]]
7741 !! wikitext
7742 {{PAGENAME}}
7743 !! html
7744 <p>Ævar Arnfjörð Bjarmason
7745 </p>
7746 !! end
7747
7748 !! test
7749 Magic Word: {{PAGENAME}} with metacharacters
7750 !! options
7751 title=[['foo & bar = baz']]
7752 !! wikitext
7753 ''{{PAGENAME}}''
7754 !! html
7755 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7756 </p>
7757 !! end
7758
7759 !! test
7760 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7761 !! options
7762 title=[[*RFC 1234 http://example.com/]]
7763 !! wikitext
7764 {{PAGENAME}}
7765 !! html
7766 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7767 </p>
7768 !! end
7769
7770 !! test
7771 Magic Word: {{PAGENAMEE}}
7772 !! options
7773 title=[[User:Ævar Arnfjörð Bjarmason]]
7774 !! wikitext
7775 {{PAGENAMEE}}
7776 !! html
7777 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7778 </p>
7779 !! end
7780
7781 !! test
7782 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7783 !! options
7784 title=[[*RFC 1234 http://example.com/]]
7785 !! wikitext
7786 {{PAGENAMEE}}
7787 !! html
7788 <p>&#42;RFC_1234_http&#58;//example.com/
7789 </p>
7790 !! end
7791
7792 !! test
7793 Magic Word: {{REVISIONID}}
7794 !! wikitext
7795 {{REVISIONID}}
7796 !! html
7797 <p>1337
7798 </p>
7799 !! end
7800
7801 !! test
7802 Magic Word: {{SCRIPTPATH}}
7803 !! wikitext
7804 {{SCRIPTPATH}}
7805 !! html
7806 <p>/
7807 </p>
7808 !! end
7809
7810 !! test
7811 Magic Word: {{STYLEPATH}}
7812 !! wikitext
7813 {{STYLEPATH}}
7814 !! html
7815 <p>/skins
7816 </p>
7817 !! end
7818
7819 !! test
7820 Magic Word: {{SERVER}}
7821 !! wikitext
7822 {{SERVER}}
7823 !! html
7824 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7825 </p>
7826 !! end
7827
7828 !! test
7829 Magic Word: {{SERVERNAME}}
7830 !! wikitext
7831 {{SERVERNAME}}
7832 !! html
7833 <p>example.org
7834 </p>
7835 !! end
7836
7837 !! test
7838 Magic Word: {{SITENAME}}
7839 !! wikitext
7840 {{SITENAME}}
7841 !! html
7842 <p>MediaWiki
7843 </p>
7844 !! end
7845
7846 !! test
7847 Case-sensitive magic words, when cased differently, should just be template transclusions
7848 !! wikitext
7849 {{CurrentMonth}}
7850 {{currentday}}
7851 {{cURreNTweEK}}
7852 {{currentHour}}
7853 !! html
7854 <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>
7855 <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>
7856 <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>
7857 <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>
7858 </p>
7859 !! end
7860
7861 !! test
7862 Case-insensitive magic words should still work with weird casing.
7863 !! wikitext
7864 {{sErVeRNaMe}}
7865 {{LCFirst:AOEU}}
7866 {{ucFIRST:aoeu}}
7867 {{SERver}}
7868 !! html
7869 <p>example.org
7870 aOEU
7871 Aoeu
7872 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Namespace 1 {{ns:1}}
7878 !! wikitext
7879 {{ns:1}}
7880 !! html
7881 <p>Talk
7882 </p>
7883 !! end
7884
7885 !! test
7886 Namespace 1 {{ns:01}}
7887 !! wikitext
7888 {{ns:01}}
7889 !! html
7890 <p>Talk
7891 </p>
7892 !! end
7893
7894 !! test
7895 Namespace 0 {{ns:0}} (bug 4783)
7896 !! wikitext
7897 {{ns:0}}
7898 !! html
7899
7900 !! end
7901
7902 !! test
7903 Namespace 0 {{ns:00}} (bug 4783)
7904 !! wikitext
7905 {{ns:00}}
7906 !! html
7907
7908 !! end
7909
7910 !! test
7911 Namespace -1 {{ns:-1}}
7912 !! wikitext
7913 {{ns:-1}}
7914 !! html
7915 <p>Special
7916 </p>
7917 !! end
7918
7919 !! test
7920 Namespace User {{ns:User}}
7921 !! wikitext
7922 {{ns:User}}
7923 !! html
7924 <p>User
7925 </p>
7926 !! end
7927
7928 !! test
7929 Namespace User talk {{ns:User_talk}}
7930 !! wikitext
7931 {{ns:User_talk}}
7932 !! html
7933 <p>User talk
7934 </p>
7935 !! end
7936
7937 !! test
7938 Namespace User talk {{ns:uSeR tAlK}}
7939 !! wikitext
7940 {{ns:uSeR tAlK}}
7941 !! html
7942 <p>User talk
7943 </p>
7944 !! end
7945
7946 !! test
7947 Namespace File {{ns:File}}
7948 !! wikitext
7949 {{ns:File}}
7950 !! html
7951 <p>File
7952 </p>
7953 !! end
7954
7955 !! test
7956 Namespace File {{ns:Image}}
7957 !! wikitext
7958 {{ns:Image}}
7959 !! html
7960 <p>File
7961 </p>
7962 !! end
7963
7964 !! test
7965 Namespace (lang=de) Benutzer {{ns:User}}
7966 !! options
7967 language=de
7968 !! wikitext
7969 {{ns:User}}
7970 !! html
7971 <p>Benutzer
7972 </p>
7973 !! end
7974
7975 !! test
7976 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7977 !! options
7978 language=de
7979 !! wikitext
7980 {{ns:3}}
7981 !! html
7982 <p>Benutzer Diskussion
7983 </p>
7984 !! end
7985
7986
7987 !! test
7988 Urlencode
7989 !! wikitext
7990 {{urlencode:hi world?!}}
7991 {{urlencode:hi world?!|WIKI}}
7992 {{urlencode:hi world?!|PATH}}
7993 {{urlencode:hi world?!|QUERY}}
7994 !! html
7995 <p>hi+world%3F%21
7996 hi_world%3F!
7997 hi%20world%3F%21
7998 hi+world%3F%21
7999 </p>
8000 !! end
8001
8002 !! test
8003 Magic Word: prioritize type info over data-parsoid
8004 !! options
8005 parsoid=html2wt
8006 !! wikitext
8007 __FORCETOC__
8008 !! html
8009 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8010 !! end
8011
8012 !! test
8013 Magic Word: serialize on separate line (parsoid)
8014 !! options
8015 parsoid=wt2wt,html2wt
8016 !! wikitext
8017 foo
8018 __NOTOC__
8019 bar
8020 !! html
8021 foo<meta property="mw:PageProp/notoc"/>bar
8022 !! end
8023
8024 !! test
8025 Magic Word: rt non-english wikis
8026 !! options
8027 parsoid=wt2wt
8028 language=de
8029 !! wikitext
8030 __NOEDITSECTION__
8031 !! html
8032 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8033 !! end
8034
8035 ###
8036 ### Magic links
8037 ###
8038 !! test
8039 Magic links: internal link to RFC (bug 479)
8040 !! wikitext
8041 [[RFC 123]]
8042 !! html
8043 <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>
8044 </p>
8045 !! end
8046
8047 !! test
8048 Magic links: RFC (bug 479)
8049 !! wikitext
8050 RFC 822
8051 !! html
8052 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8053 </p>
8054 !! end
8055
8056 !! test
8057 Magic links: ISBN (bug 1937)
8058 !! wikitext
8059 ISBN 0-306-40615-2
8060 !! html
8061 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8062 </p>
8063 !! end
8064
8065 !! test
8066 Magic links: PMID incorrectly converts space to underscore
8067 !! wikitext
8068 PMID 1234
8069 !! html
8070 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8071 </p>
8072 !! end
8073
8074 ###
8075 ### Templates
8076 ####
8077
8078 !! test
8079 Nonexistent template
8080 !! wikitext
8081 {{thistemplatedoesnotexist}}
8082 !! html
8083 <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>
8084 </p>
8085 !! end
8086
8087 !! test
8088 Template with invalid target containing tags
8089 !! wikitext
8090 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8091 !! html
8092 <p>{{a<b>b</b>|foo|a=b|a = b}}
8093 </p>
8094 !! end
8095
8096 !! test
8097 Template with invalid target containing unclosed tag
8098 !! wikitext
8099 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8100 !! html
8101 <p>{{a<b>|foo|a=b|a = b}}</b>
8102 </p>
8103 !! end
8104
8105 !! test
8106 Template with invalid target containing wikilink
8107 !! wikitext
8108 {{[[Main Page]]}}
8109 !! html/php
8110 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8111 </p>
8112 !! html/parsoid
8113 <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>
8114 !! end
8115
8116 !! article
8117 Template:test
8118 !! text
8119 This is a test template
8120 !! endarticle
8121
8122 !! test
8123 Simple template
8124 !! wikitext
8125 {{test}}
8126 !! html
8127 <p>This is a test template
8128 </p>
8129 !! end
8130
8131 !! test
8132 Template with explicit namespace
8133 !! wikitext
8134 {{Template:test}}
8135 !! html
8136 <p>This is a test template
8137 </p>
8138 !! end
8139
8140
8141 !! article
8142 Template:paramtest
8143 !! text
8144 This is a test template with parameter {{{param}}}
8145 !! endarticle
8146
8147 !! test
8148 Template parameter
8149 !! wikitext
8150 {{paramtest|param=foo}}
8151 !! html
8152 <p>This is a test template with parameter foo
8153 </p>
8154 !! end
8155
8156 !! article
8157 Template:paramtestnum
8158 !! text
8159 [[{{{1}}}|{{{2}}}]]
8160 !! endarticle
8161
8162 !! test
8163 Template unnamed parameter
8164 !! wikitext
8165 {{paramtestnum|Main Page|the main page}}
8166 !! html
8167 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8168 </p>
8169 !! end
8170
8171 !! article
8172 Template:templatesimple
8173 !! text
8174 (test)
8175 !! endarticle
8176
8177 !! article
8178 Template:templateredirect
8179 !! text
8180 #redirect [[Template:templatesimple]]
8181 !! endarticle
8182
8183 !! article
8184 Template:templateasargtestnum
8185 !! text
8186 {{{{{1}}}}}
8187 !! endarticle
8188
8189 !! article
8190 Template:templateasargtest
8191 !! text
8192 {{template{{{templ}}}}}
8193 !! endarticle
8194
8195 !! article
8196 Template:templateasargtest2
8197 !! text
8198 {{{{{templ}}}}}
8199 !! endarticle
8200
8201 !! test
8202 Template with template name as unnamed argument
8203 !! wikitext
8204 {{templateasargtestnum|templatesimple}}
8205 !! html
8206 <p>(test)
8207 </p>
8208 !! end
8209
8210 !! test
8211 Template with template name as argument
8212 !! wikitext
8213 {{templateasargtest|templ=simple}}
8214 !! html
8215 <p>(test)
8216 </p>
8217 !! end
8218
8219 !! test
8220 Template with template name as argument (2)
8221 !! wikitext
8222 {{templateasargtest2|templ=templatesimple}}
8223 !! html
8224 <p>(test)
8225 </p>
8226 !! end
8227
8228 !! article
8229 Template:templateasargtestdefault
8230 !! text
8231 {{{{{templ|templatesimple}}}}}
8232 !! endarticle
8233
8234 !! article
8235 Template:templa
8236 !! text
8237 '''templ'''
8238 !! endarticle
8239
8240 !! test
8241 Template with default value
8242 !! wikitext
8243 {{templateasargtestdefault}}
8244 !! html
8245 <p>(test)
8246 </p>
8247 !! end
8248
8249 !! test
8250 Template with default value (value set)
8251 !! wikitext
8252 {{templateasargtestdefault|templ=templa}}
8253 !! html
8254 <p><b>templ</b>
8255 </p>
8256 !! end
8257
8258 !! test
8259 Template redirect
8260 !! wikitext
8261 {{templateredirect}}
8262 !! html
8263 <p>(test)
8264 </p>
8265 !! end
8266
8267 !! test
8268 Template with argument in separate line
8269 !! wikitext
8270 {{ templateasargtest |
8271 templ = simple }}
8272 !! html
8273 <p>(test)
8274 </p>
8275 !! end
8276
8277 !! test
8278 Template with complex template as argument
8279 !! wikitext
8280 {{paramtest|
8281 param ={{ templateasargtest |
8282 templ = simple }}}}
8283 !! html
8284 <p>This is a test template with parameter (test)
8285 </p>
8286 !! end
8287
8288 !! test
8289 Template with thumb image (with link in description)
8290 !! wikitext
8291 {{paramtest|
8292 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8293 !! html
8294 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>
8295
8296 !! end
8297
8298 !! article
8299 Template:complextemplate
8300 !! text
8301 {{{1}}} {{paramtest|
8302 param ={{{param}}}}}
8303 !! endarticle
8304
8305 !! test
8306 Template with complex arguments
8307 !! wikitext
8308 {{complextemplate|
8309 param ={{ templateasargtest |
8310 templ = simple }}|[[Template:complextemplate|link]]}}
8311 !! html
8312 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8313 </p>
8314 !! end
8315
8316 !! test
8317 BUG 553: link with two variables in a piped link
8318 !! wikitext
8319 {|
8320 |[[{{{1}}}|{{{2}}}]]
8321 |}
8322 !! html
8323 <table>
8324 <tr>
8325 <td>[[{{{1}}}|{{{2}}}]]
8326 </td></tr></table>
8327
8328 !! end
8329
8330 !! test
8331 Magic variable as template parameter
8332 !! wikitext
8333 {{paramtest|param={{SITENAME}}}}
8334 !! html
8335 <p>This is a test template with parameter MediaWiki
8336 </p>
8337 !! end
8338
8339 !! article
8340 Template:linktest
8341 !! text
8342 [[{{{param}}}|link]]
8343 !! endarticle
8344
8345 !! test
8346 Template parameter as link source
8347 !! wikitext
8348 {{linktest|param=Main Page}}
8349 !! html
8350 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8351 </p>
8352 !! end
8353
8354 !!test
8355 Template-generated attribute string (k='v')
8356 !! wikitext
8357 <span {{attr_str|id|v1}}>bar</span>
8358 !! html
8359 <p><span id="v1">bar</span>
8360 </p>
8361 !!end
8362
8363 !!article
8364 Template:paramtest2
8365 !! text
8366 including another template, {{paramtest|param={{{arg}}}}}
8367 !! endarticle
8368
8369 !! test
8370 Template passing argument to another template
8371 !! wikitext
8372 {{paramtest2|arg='hmm'}}
8373 !! html
8374 <p>including another template, This is a test template with parameter 'hmm'
8375 </p>
8376 !! end
8377
8378 !! article
8379 Template:Linktest2
8380 !! text
8381 Main Page
8382 !! endarticle
8383
8384 !! test
8385 Template as link source
8386 !! wikitext
8387 [[{{linktest2}}]]
8388
8389 [[{{linktest2}}|Main Page]]
8390
8391 [[{{linktest2}}]]Page
8392 !! html
8393 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8394 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8395 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8396 </p>
8397 !! end
8398
8399
8400 !! article
8401 Template:loop1
8402 !! text
8403 {{loop2}}
8404 !! endarticle
8405
8406 !! article
8407 Template:loop2
8408 !! text
8409 {{loop1}}
8410 !! endarticle
8411
8412 !! test
8413 Template infinite loop
8414 !! wikitext
8415 {{loop1}}
8416 !! html
8417 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8418 </p>
8419 !! end
8420
8421 !! test
8422 Template from main namespace
8423 !! wikitext
8424 {{:Main Page}}
8425 !! html
8426 <p>blah blah
8427 </p>
8428 !! end
8429
8430 !! article
8431 Template:table
8432 !! text
8433 {|
8434 | 1 || 2
8435 |-
8436 | 3 || 4
8437 |}
8438 !! endarticle
8439
8440 !! test
8441 BUG 529: Template with table, not included at beginning of line
8442 !! wikitext
8443 foo {{table}}
8444 !! html
8445 <p>foo
8446 </p>
8447 <table>
8448 <tr>
8449 <td> 1 </td>
8450 <td> 2
8451 </td></tr>
8452 <tr>
8453 <td> 3 </td>
8454 <td> 4
8455 </td></tr></table>
8456
8457 !! end
8458
8459 !! test
8460 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8461 !! wikitext
8462 foo
8463 {{table}}
8464 !! html
8465 <p>foo
8466 </p>
8467 <table>
8468 <tr>
8469 <td> 1 </td>
8470 <td> 2
8471 </td></tr>
8472 <tr>
8473 <td> 3 </td>
8474 <td> 4
8475 </td></tr></table>
8476
8477 !! end
8478
8479 !! test
8480 BUG 41: Template parameters shown as broken links
8481 !! wikitext
8482 {{{parameter}}}
8483 !! html
8484 <p>{{{parameter}}}
8485 </p>
8486 !! end
8487
8488 !! test
8489 Template with targets containing wikilinks
8490 !! wikitext
8491 {{[[foo]]}}
8492
8493 {{[[{{echo|foo}}]]}}
8494
8495 {{{{echo|[[foo}}]]}}
8496 !! html
8497 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8498 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8499 </p><p>{{[[foo}}]]
8500 </p>
8501 !! end
8502
8503 !! article
8504 Template:MSGNW test
8505 !! text
8506 ''None'' of '''this''' should be
8507 * interpreted
8508 but rather passed unmodified
8509 {{test}}
8510 <gallery>
8511 File:Foobar.jpg
8512 </gallery>
8513 !! endarticle
8514
8515 # hmm, fix this or just deprecate msgnw and document its behavior?
8516 !! test
8517 msgnw keyword
8518 !! wikitext
8519 {{msgnw:MSGNW test}}
8520 !! html
8521 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
8522 &#42; interpreted
8523 &#32;but rather passed unmodified
8524 &#123;&#123;test&#125;&#125;
8525 &#60;gallery&#62;
8526 File:Foobar.jpg
8527 &#60;/gallery&#62;
8528 </p>
8529 !! end
8530
8531 !! test
8532 int keyword
8533 !! wikitext
8534 {{int:youhavenewmessages|lots of money|not!}}
8535 !! html
8536 <p>You have lots of money (not!).
8537 </p>
8538 !! end
8539
8540 !! article
8541 Template:Includes
8542 !! text
8543 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8544 !! endarticle
8545
8546 !! test
8547 <includeonly> and <noinclude> being included
8548 !! wikitext
8549 {{Includes}}
8550 !! html
8551 <p>Foobar
8552 </p>
8553 !! end
8554
8555 !! article
8556 Template:Includes2
8557 !! text
8558 <onlyinclude>Foo</onlyinclude>bar
8559 !! endarticle
8560
8561 !! test
8562 <onlyinclude> being included
8563 !! wikitext
8564 {{Includes2}}
8565 !! html
8566 <p>Foo
8567 </p>
8568 !! end
8569
8570
8571 !! article
8572 Template:Includes3
8573 !! text
8574 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8575 !! endarticle
8576
8577 !! test
8578 <onlyinclude> and <includeonly> being included
8579 !! wikitext
8580 {{Includes3}}
8581 !! html
8582 <p>Foo
8583 </p>
8584 !! end
8585
8586 !! test
8587 <includeonly> and <noinclude> on a page
8588 !! wikitext
8589 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8590 !! html
8591 <p>Foozar
8592 </p>
8593 !! end
8594
8595 !! test
8596 Un-closed <noinclude>
8597 !! wikitext
8598 <noinclude>
8599 !! html
8600 !! end
8601
8602 !! test
8603 <onlyinclude> on a page
8604 !! wikitext
8605 <onlyinclude>Foo</onlyinclude>bar
8606 !! html
8607 <p>Foobar
8608 </p>
8609 !! end
8610
8611 !! test
8612 Un-closed <onlyinclude>
8613 !! wikitext
8614 <onlyinclude>
8615 !! html
8616 !! end
8617
8618 !!test
8619 Self-closed noinclude, includeonly, onlyinclude tags
8620 !! wikitext
8621 <noinclude />
8622 <includeonly />
8623 <onlyinclude />
8624 !! html
8625 <p><br />
8626 </p>
8627 !!end
8628
8629 !!test
8630 Unbalanced includeonly and noinclude tags
8631 !! wikitext
8632 {|
8633 |a</noinclude>
8634 |b</noinclude></noinclude>
8635 |c</noinclude></includeonly>
8636 |d</includeonly></includeonly>
8637 |}
8638 !! html
8639 <table>
8640 <tr>
8641 <td>a
8642 </td>
8643 <td>b
8644 </td>
8645 <td>c&lt;/includeonly&gt;
8646 </td>
8647 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8648 </td></tr></table>
8649
8650 !!end
8651
8652 !! article
8653 Template:Includeonly section
8654 !! text
8655 <includeonly>
8656 ==Includeonly section==
8657 </includeonly>
8658 ==Section T-1==
8659 !!endarticle
8660
8661 !! test
8662 Bug 6563: Edit link generation for section shown by <includeonly>
8663 !! wikitext
8664 {{includeonly section}}
8665 !! html
8666 <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>
8667 <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>
8668
8669 !! end
8670
8671 # Uses same input as the contents of [[Template:Includeonly section]]
8672 !! test
8673 Bug 6563: Section extraction for section shown by <includeonly>
8674 !! options
8675 section=T-2
8676 !! wikitext
8677 <includeonly>
8678 ==Includeonly section==
8679 </includeonly>
8680 ==Section T-2==
8681 !! html
8682 ==Section T-2==
8683 !! end
8684
8685 !! test
8686 Bug 6563: Edit link generation for section suppressed by <includeonly>
8687 !! wikitext
8688 <includeonly>
8689 ==Includeonly section==
8690 </includeonly>
8691 ==Section 1==
8692 !! html
8693 <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>
8694
8695 !! end
8696
8697 !! test
8698 Bug 6563: Section extraction for section suppressed by <includeonly>
8699 !! options
8700 section=1
8701 !! wikitext
8702 <includeonly>
8703 ==Includeonly section==
8704 </includeonly>
8705 ==Section 1==
8706 !! html
8707 ==Section 1==
8708 !! end
8709
8710 !! test
8711 Un-closed <includeonly>
8712 !! wikitext
8713 <includeonly>
8714 !! html
8715 !! end
8716
8717 # TODO: test with DOM fragment reuse!
8718 !! test
8719 Parsoid: DOM fragment reuse
8720 !! options
8721 parsoid=wt2wt,wt2html
8722 !! wikitext
8723 a{{echo|b<table></table>c}}d
8724
8725 a{{echo|b
8726 <table></table>
8727 c}}d
8728
8729 {{echo|a
8730
8731 <table></table>
8732
8733 b}}
8734 !! html
8735 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8736 <table></table>c"}},"i":0}}]}'>b</span>
8737 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8738
8739
8740 <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">
8741 </span>
8742 <table about="#mwt2"></table><span about="#mwt2">
8743 </span>
8744 <p about="#mwt2">cd</p>
8745
8746
8747 <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">
8748
8749 </span>
8750 <table about="#mwt3"></table><span about="#mwt3">
8751
8752 </span>
8753 <p about="#mwt3">b</p>
8754 !! end
8755
8756 !! test
8757 Parsoid: Merge double tds (bug 50603)
8758 !! options
8759 parsoid
8760 !! wikitext
8761 {|
8762 |{{echo|{{!}} foo}}
8763 |}
8764 !! html
8765 <table><tbody>
8766 <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>
8767 </tbody></table>
8768 !! end
8769
8770 !! test
8771 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8772 !! options
8773 parsoid
8774 !! wikitext
8775 {{echo|<div>}}
8776 {|
8777 |{{echo|{{!}} foo}}
8778 |}
8779 {{echo|</div>}}
8780 !! html
8781 <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}}]}'>
8782 <table><tbody>
8783 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8784 </tbody></table>
8785 </div>
8786 !! end
8787
8788 ###
8789 ### <includeonly> and <noinclude> in attributes
8790 ###
8791 !!test
8792 0. includeonly around the entire attribute
8793 !! wikitext
8794 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8795 !! html
8796 <p><span id="v2">bar</span>
8797 </p>
8798 !!end
8799
8800 !!test
8801 1. includeonly in html attr key
8802 !! wikitext
8803 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8804 !! html
8805 <p><span id="foo">bar</span>
8806 </p>
8807 !!end
8808
8809 !!test
8810 2. includeonly in html attr value
8811 !! wikitext
8812 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8813 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8814 !! html
8815 <p><span id="v1">bar</span>
8816 <span id="v1">bar</span>
8817 </p>
8818 !!end
8819
8820 !!test
8821 3. includeonly in part of an attr value
8822 !! wikitext
8823 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8824 !! html
8825 <p><span style="color:red;">bar</span>
8826 </p>
8827 !!end
8828
8829 !!test
8830 4. includeonly in table attributes
8831 !! wikitext
8832 {|
8833 |- <noinclude>
8834 |-
8835 |a
8836 </noinclude>
8837 |- <includeonly>
8838 |-
8839 |b
8840 </includeonly>
8841 |}
8842 !! html
8843 <table>
8844
8845
8846 <tr>
8847 <td>a
8848 </td></tr>
8849 </table>
8850
8851 !!end
8852
8853 ###
8854 ### Token Stream Patcher tests
8855 ###
8856 ### These tests won't always pass wt2wt and other modes because
8857 ### on serialization, the table will be output on a new line.
8858 ### For now, we are blacklisting them, and using this to test selser.
8859 ###
8860
8861 !!test
8862 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8863 !!options
8864 parsoid=wt2html,wt2wt
8865 !!wikitext
8866 {{echo|}}{| width = '100%'
8867 |foo
8868 |}
8869 !!html/parsoid
8870 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8871 <table width="100%">
8872 <tbody>
8873 <tr>
8874 <td>foo</td></tr></tbody></table>
8875 !!end
8876
8877 !!test
8878 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8879 !!options
8880 parsoid=wt2html,wt2wt
8881 !!wikitext
8882 <includeonly>a</includeonly>{| {{{b}}}
8883 |c
8884 |}
8885 !!html/parsoid
8886 <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|}"}'>
8887 <tbody><tr><td>c</td></tr>
8888 </tbody></table>
8889 !!end
8890
8891 ###
8892 ### Testing parsing of templates where a template arg
8893 ### has the same name as the template itself.
8894 ###
8895
8896 !! article
8897 Template:quote
8898 !! text
8899 {{{quote|{{{1}}}}}}
8900 !! endarticle
8901
8902 !!test
8903 Templates: Template Name/Arg clash: 1. Use of positional param
8904 !! wikitext
8905 {{quote|foo}}
8906 !! html
8907 <p>foo
8908 </p>
8909 !!end
8910
8911 !!test
8912 Templates: Template Name/Arg clash: 2. Use of named param
8913 !! wikitext
8914 {{quote|quote=foo}}
8915 !! html
8916 <p>foo
8917 </p>
8918 !!end
8919
8920 !!test
8921 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8922 !! wikitext
8923 {{quote|quote}}
8924 !! html
8925 <p>quote
8926 </p>
8927 !!end
8928
8929 ###
8930 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8931 ###
8932
8933 !!test
8934 Templates: 1. Simple use
8935 !! wikitext
8936 {{echo|Foo}}
8937 !! html
8938 <p>Foo
8939 </p>
8940 !!end
8941
8942 !!test
8943 Templates: 2. Inside a block tag
8944 !! wikitext
8945 <div>{{echo|Foo}}</div>
8946 <blockquote>{{echo|Foo}}</blockquote>
8947 !! html
8948 <div>Foo</div>
8949 <blockquote>Foo</blockquote>
8950
8951 !!end
8952
8953 !!test
8954 Templates: P-wrapping: 1a. Templates on consecutive lines
8955 !! wikitext
8956 {{echo|Foo}}
8957 {{echo|bar}}
8958 !! html
8959 <p>Foo
8960 bar
8961 </p>
8962 !!end
8963
8964 !!test
8965 Templates: P-wrapping: 1b. Templates on consecutive lines
8966 !! wikitext
8967 Foo
8968
8969 {{echo|bar}}
8970 {{echo|baz}}
8971 !! html
8972 <p>Foo
8973 </p><p>bar
8974 baz
8975 </p>
8976 !!end
8977
8978 !!test
8979 Templates: P-wrapping: 1c. Templates on consecutive lines
8980 !! wikitext
8981 {{echo|Foo}}
8982 {{echo|bar}} <div>baz</div>
8983 !! html
8984 <p>Foo
8985 </p>
8986 bar <div>baz</div>
8987
8988 !!end
8989
8990 !!test
8991 Templates: P-wrapping: 1d. Template preceded by comment-only line
8992 !!options
8993 parsoid
8994 !! wikitext
8995 <!-- foo -->
8996 {{echo|Bar}}
8997 !! html
8998 <!-- foo -->
8999
9000 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9001 !!end
9002
9003 !!test
9004 Templates: Inline Text: 1. Multiple template uses
9005 !! wikitext
9006 {{echo|Foo}}bar{{echo|baz}}
9007 !! html
9008 <p>Foobarbaz
9009 </p>
9010 !!end
9011
9012 !!test
9013 Templates: Inline Text: 2. Back-to-back template uses
9014 !! wikitext
9015 {{echo|Foo}}{{echo|bar}}
9016 !! html
9017 <p>Foobar
9018 </p>
9019 !!end
9020
9021 !!test
9022 Templates: Block Tags: 1. Multiple template uses
9023 !! wikitext
9024 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9025 !! html
9026 <div>Foo</div><div>bar</div><div>baz</div>
9027
9028 !!end
9029
9030 !!test
9031 Templates: Block Tags: 2. Back-to-back template uses
9032 !! wikitext
9033 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9034 !! html
9035 <div>Foo</div><div>bar</div>
9036
9037 !!end
9038
9039 !!test
9040 Templates: Links: 1. Simple example
9041 !! wikitext
9042 {{echo|[[Foo|bar]]}}
9043 !! html
9044 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9045 </p>
9046 !!end
9047
9048 !!test
9049 Templates: Links: 2. Generation of link href
9050 !! wikitext
9051 [[{{echo|Foo}}|bar]]
9052 !! html
9053 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9054 </p>
9055 !!end
9056
9057 !!test
9058 Templates: Links: 3. Generation of part of a link href
9059 !! wikitext
9060 [[Fo{{echo|o}}|bar]]
9061
9062 [[Foo{{echo|bar}}]]
9063
9064 [[Foo{{echo|bar}}baz]]
9065
9066 [[Foo{{echo|bar}}|bar]]
9067
9068 [[:Foo{{echo|bar}}]]
9069
9070 [[:Foo{{echo|bar}}|bar]]
9071 !! html
9072 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9073 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9074 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9075 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9076 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9077 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9078 </p>
9079 !!end
9080
9081 !!test
9082 Templates: Links: 4. Multiple templates generating link href
9083 !! wikitext
9084 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9085 !! html
9086 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9087 </p>
9088 !!end
9089
9090 !!test
9091 Templates: Links: 5. Generation of link text
9092 !! wikitext
9093 [[Foo|{{echo|bar}}]]
9094 !! html
9095 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9096 </p>
9097 !!end
9098
9099 !!test
9100 Templates: Links: 5. Nested templates (only outermost template should be marked)
9101 !! wikitext
9102 {{echo|[[{{echo|Foo}}|bar]]}}
9103 !! html
9104 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9105 </p>
9106 !!end
9107
9108 !!test
9109 Templates: HTML Tag: 1. Generation of HTML attr. key
9110 !! wikitext
9111 <div {{echo|style}}="color:red;">foo</div>
9112 !! html
9113 <div style="color:red;">foo</div>
9114
9115 !!end
9116
9117 !!test
9118 Templates: HTML Tag: 2. Generation of HTML attr. value
9119 !! wikitext
9120 <div style={{echo|'color:red;'}}>foo</div>
9121 !! html
9122 <div style="color:red;">foo</div>
9123
9124 !!end
9125
9126 !!test
9127 Templates: HTML Tag: 3. Generation of HTML attr key and value
9128 !! wikitext
9129 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9130 !! html
9131 <div style="color:red;">foo</div>
9132
9133 !!end
9134
9135 !!test
9136 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9137 !! wikitext
9138 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9139 !! html
9140 <div title="This is a long title with just one piece templated">foo</div>
9141
9142 !!end
9143
9144 !!test
9145 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9146 !! wikitext
9147 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9148 !! html
9149 <div title="This is a long title with just one piece templated">foo</div>
9150
9151 !!end
9152
9153 !!test
9154 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9155 !! wikitext
9156 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9157 !! html
9158 <div title="This is a long title with just one piece templated">foo</div>
9159
9160 !!end
9161
9162 !!test
9163 Templates: HTML Tag: 7. Generation of partial attribute key string
9164 !! wikitext
9165 <div st{{echo|yle}}="color:red;">foo</div>
9166 !! html
9167 <div style="color:red;">foo</div>
9168
9169 !!end
9170
9171 !!test
9172 Templates: HTML Tables: 1. Generating start of a HTML table
9173 !! wikitext
9174 {{echo|<table><tr><td>foo</td>}}</tr></table>
9175 !! html
9176 <table><tr><td>foo</td></tr></table>
9177
9178 !!end
9179
9180 !!test
9181 Templates: HTML Tables: 2a. Generating middle of a HTML table
9182 !! wikitext
9183 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9184 !! html
9185 <table><tr><td>foo</td></tr></table>
9186
9187 !!end
9188
9189 !!test
9190 Templates: HTML Tables: 2b. Generating middle of a HTML table
9191 !! wikitext
9192 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9193 !! html
9194 <table><tr><td>foo</td></tr></table>
9195
9196 !!end
9197
9198 !!test
9199 Templates: HTML Tables: 3. Generating end of a HTML table
9200 !! wikitext
9201 <table><tr>{{echo|<td>foo</td></tr></table>}}
9202 !! html
9203 <table><tr><td>foo</td></tr></table>
9204
9205 !!end
9206
9207 !!test
9208 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9209 !! wikitext
9210 {{echo|<table>}}<tr><td>foo</td></tr></table>
9211 !! html
9212 <table><tr><td>foo</td></tr></table>
9213
9214 !!end
9215
9216 !!test
9217 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9218 !! wikitext
9219 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9220 !! html
9221 <table><tr><td>foo</td></tr></table>
9222
9223 !!end
9224
9225 !!test
9226 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9227 !! wikitext
9228 <table><tr>{{echo|<td>}}foo</td></tr></table>
9229 !! html
9230 <table><tr><td>foo</td></tr></table>
9231
9232 !!end
9233
9234 !!test
9235 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9236 !! wikitext
9237 <table><tr><td>foo{{echo|</td>}}</tr></table>
9238 !! html
9239 <table><tr><td>foo</td></tr></table>
9240
9241 !!end
9242
9243 !!test
9244 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9245 !! wikitext
9246 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9247 !! html
9248 <table><tr><td>foo</td></tr></table>
9249
9250 !!end
9251
9252 !!test
9253 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9254 !! wikitext
9255 <table><tr><td>foo</td></tr>{{echo|</table>}}
9256 !! html
9257 <table><tr><td>foo</td></tr></table>
9258
9259 !!end
9260
9261 !!test
9262 Templates: HTML Tables: 5. Proper fostering of categories from inside
9263 !!options
9264 parsoid=wt2html,wt2wt
9265 !! wikitext
9266 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9267 <!--Two categories (Bug 50330)-->
9268 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9269 !! html
9270 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9271 <!--Two categories (Bug 50330)-->
9272 <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>
9273 !!end
9274
9275 !!test
9276 Templates: Wiki Tables: 1a. Fostering of entire template content
9277 !! wikitext
9278 {|
9279 {{echo|a}}
9280 |}
9281 !! html
9282 <table>
9283 a
9284 <tr><td></td></tr></table>
9285
9286 !!end
9287
9288 !!test
9289 Templates: Wiki Tables: 1b. Fostering of entire template content
9290 !! wikitext
9291 {|
9292 {{echo|<div>}}
9293 foo
9294 {{echo|</div>}}
9295 |}
9296 !! html
9297 <table>
9298 <div>
9299 <p>foo
9300 </p>
9301 </div>
9302 <tr><td></td></tr></table>
9303
9304 !!end
9305
9306 !!test
9307 Templates: Wiki Tables: 2. Fostering of partial template content
9308 !! wikitext
9309 {|
9310 {{echo|a
9311 <div>b</div>}}
9312 |}
9313 !! html
9314 <table>
9315 a
9316 <div>b</div>
9317 <tr><td></td></tr></table>
9318
9319 !!end
9320
9321 !!test
9322 Templates: Wiki Tables: 3. td-content via multiple templates
9323 !! wikitext
9324 {|
9325 {{echo|{{pipe}}a}}{{echo|b}}
9326 |}
9327 !! html
9328 <table>
9329 <tr>
9330 <td>ab
9331 </td></tr></table>
9332
9333 !!end
9334
9335 !!test
9336 Templates: Wiki Tables: 4. Templated tags, no content
9337 !! wikitext
9338 {{tbl-start}}
9339 {{tbl-end}}
9340 !! html
9341 <table>
9342 <tr><td></td></tr></table>
9343
9344 !!end
9345
9346 !!test
9347 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9348 !! wikitext
9349 {{tbl-start}}
9350 |foo
9351 {{tbl-end}}
9352 !! html
9353 <table>
9354 <tr>
9355 <td>foo
9356 </td></tr></table>
9357
9358 !!end
9359
9360 !!test
9361 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9362 !! wikitext
9363 {{tbl-start}}
9364 {{!}}foo
9365 {{tbl-end}}
9366 !! html
9367 <table>
9368 <tr>
9369 <td>foo
9370 </td></tr></table>
9371
9372 !!end
9373
9374 !!test
9375 Templates: Lists: Multi-line list-items via templates
9376 !! wikitext
9377 *{{echo|a {{nonexistent|
9378 unused}}}}
9379 *{{echo|b {{nonexistent|
9380 unused}}}}
9381 !! html
9382 <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>
9383 <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>
9384
9385 !!end
9386
9387 !!test
9388 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9389 !! wikitext
9390 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9391 !! html
9392 <p><i>ab</i>c<i>d</i>e
9393 </p>
9394 !!end
9395
9396 !!test
9397 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9398 (PHP parser generates misnested html)
9399 !! wikitext
9400 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9401 !! html/parsoid
9402 <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>
9403 !!end
9404
9405 !!test
9406 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9407 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9408 !! options
9409 parsoid=wt2html,wt2wt
9410 !! wikitext
9411 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9412 !! html
9413 <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>
9414 <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>
9415 <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>
9416 !!end
9417
9418 !!test
9419 Templates: Ugly nesting: 4. Divs opened/closed across templates
9420 !! wikitext
9421 a<div>b{{echo|c</div>d}}e
9422 !! html
9423 a<div>bc</div>de
9424
9425 !!end
9426
9427 !!test
9428 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9429 (Parsoid-centric)
9430 !! options
9431 parsoid
9432 !! wikitext
9433 {|
9434 |{{echo|foo</table>}}
9435 |bar
9436 |}
9437 !! html
9438 <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|}"]}'>
9439
9440 <tbody>
9441 <tr>
9442 <td>foo</td></tr></tbody></table><span about="#mwt1">
9443 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9444 |}</span>
9445 !!end
9446
9447 !!test
9448 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9449 (Parsoid-centric)
9450 !! options
9451 parsoid
9452 !! wikitext
9453 <table>
9454 <tr>
9455 <td>
9456 <table>
9457 <tr>
9458 <td>1. {{echo|foo </table>}}</td>
9459 <td> bar </td>
9460 <td>2. {{echo|baz </table>}}</td>
9461 </tr>
9462 <tr>
9463 <td>abc</td>
9464 </tr>
9465 </table>
9466 </td>
9467 </tr>
9468 <tr>
9469 <td>xyz</td>
9470 </tr>
9471 </table>
9472 !! html
9473 <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>"]}'>
9474 <tbody><tr>
9475 <td>
9476 <table>
9477 <tbody><tr>
9478 <td>1. foo </td></tr></tbody></table></td>
9479 <td> bar </td>
9480 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9481 </span><span about="#mwt2">
9482 </span><span about="#mwt2">
9483 </span><span about="#mwt2">abc</span><span about="#mwt2">
9484 </span><span about="#mwt2">
9485 </span><span about="#mwt2">
9486 </span><span about="#mwt2">
9487 </span><span about="#mwt2">
9488 </span><span about="#mwt2">
9489 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9490 </span><span about="#mwt2">
9491 </span>
9492 !!end
9493
9494 !! test
9495 Templates: Ugly templates: 3. newline-only template parameter
9496 !! wikitext
9497 foo {{echo|
9498 }}
9499 !! html
9500 <p>foo
9501 </p>
9502 !! end
9503
9504 # This looks like a bug: a single newline triggers p/br for some reason.
9505 !! test
9506 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9507 !! wikitext
9508 {{echo|
9509 }}
9510 !! html
9511 <p><br />
9512 </p>
9513 !! end
9514
9515 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9516 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9517 !! test
9518 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9519 !! wikitext
9520 {{echo|<table>}}
9521 {{echo|<div>foo}}
9522 {{echo|</table>}}
9523 !! html/parsoid
9524 <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
9525 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9526 </table>
9527 !! end
9528
9529 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9530 # that are "identical" and generate nesting cycles in the algorithm
9531 !! test
9532 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9533 !! wikitext
9534 {{echo|<table><tr><td><table>}}
9535 {{echo|<div>}}
9536 {{echo|</div>}}
9537 !! html/parsoid
9538 <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"}'>
9539 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9540 </table></td></tr></tbody></table>
9541 !! end
9542
9543 !!test
9544 Parser Functions: 1. Simple example
9545 !! wikitext
9546 {{uc:foo}}
9547 !! html
9548 <p>FOO
9549 </p>
9550 !!end
9551
9552 !!test
9553 Parser Functions: 2. Nested use (only outermost should be marked up)
9554 !! wikitext
9555 {{uc:{{lc:FOO}}}}
9556 !! html
9557 <p>FOO
9558 </p>
9559 !!end
9560
9561 ###
9562 ### Pre-save transform tests
9563 ###
9564 !! test
9565 pre-save transform: subst:
9566 !! options
9567 PST
9568 !! wikitext
9569 {{subst:test}}
9570 !! html
9571 This is a test template
9572 !! end
9573
9574 !! test
9575 pre-save transform: normal template
9576 !! options
9577 PST
9578 !! wikitext
9579 {{test}}
9580 !! html
9581 {{test}}
9582 !! end
9583
9584 !! test
9585 pre-save transform: nonexistent template
9586 !! options
9587 PST
9588 !! wikitext
9589 {{thistemplatedoesnotexist}}
9590 !! html
9591 {{thistemplatedoesnotexist}}
9592 !! end
9593
9594
9595 !! test
9596 pre-save transform: subst magic variables
9597 !! options
9598 PST
9599 !! wikitext
9600 {{subst:SITENAME}}
9601 !! html
9602 MediaWiki
9603 !! end
9604
9605 # This is bug 89, which I fixed. -- wtm
9606 !! test
9607 pre-save transform: subst: templates with parameters
9608 !! options
9609 pst
9610 !! wikitext
9611 {{subst:paramtest|param="something else"}}
9612 !! html
9613 This is a test template with parameter "something else"
9614 !! end
9615
9616 !! article
9617 Template:nowikitest
9618 !! text
9619 <nowiki>'''not wiki'''</nowiki>
9620 !! endarticle
9621
9622 !! test
9623 pre-save transform: nowiki in subst (bug 1188)
9624 !! options
9625 pst
9626 !! wikitext
9627 {{subst:nowikitest}}
9628 !! html
9629 <nowiki>'''not wiki'''</nowiki>
9630 !! end
9631
9632
9633 !! article
9634 Template:commenttest
9635 !! text
9636 This template has <!-- a comment --> in it.
9637 !! endarticle
9638
9639 !! test
9640 pre-save transform: comment in subst (bug 1936)
9641 !! options
9642 pst
9643 !! wikitext
9644 {{subst:commenttest}}
9645 !! html
9646 This template has <!-- a comment --> in it.
9647 !! end
9648
9649 !! test
9650 pre-save transform: unclosed tag
9651 !! options
9652 pst noxml
9653 !! wikitext
9654 <nowiki>'''not wiki'''
9655 !! html
9656 <nowiki>'''not wiki'''
9657 !! end
9658
9659 !! test
9660 pre-save transform: mixed tag case
9661 !! options
9662 pst noxml
9663 !! wikitext
9664 <NOwiki>'''not wiki'''</noWIKI>
9665 !! html
9666 <NOwiki>'''not wiki'''</noWIKI>
9667 !! end
9668
9669 !! test
9670 pre-save transform: unclosed comment in <nowiki>
9671 !! options
9672 pst noxml
9673 !! wikitext
9674 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9675 !! html
9676 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9677 !!end
9678
9679 # Leading @ in this template definition works around a limitation
9680 # in parsoid's parserTests which otherwise strips the <span> from the
9681 # result (confusing it for a template wrapper)
9682 !! article
9683 Template:dangerous
9684 !!text
9685 @<span onmouseover="alert('crap')">Oh no</span>
9686 !!endarticle
9687
9688 !!test
9689 (confirming safety of fix for subst bug 1936)
9690 !! wikitext
9691 {{Template:dangerous}}
9692 !! html
9693 <p>@<span>Oh no</span>
9694 </p>
9695 !! end
9696
9697 !! test
9698 pre-save transform: comment containing gallery (bug 5024)
9699 !! options
9700 pst
9701 !! wikitext
9702 <!-- <gallery>data</gallery> -->
9703 !! html
9704 <!-- <gallery>data</gallery> -->
9705 !!end
9706
9707 !! test
9708 pre-save transform: comment containing extension
9709 !! options
9710 pst
9711 !! wikitext
9712 <!-- <tag>data</tag> -->
9713 !! html
9714 <!-- <tag>data</tag> -->
9715 !!end
9716
9717 !! test
9718 pre-save transform: comment containing nowiki
9719 !! options
9720 pst
9721 !! wikitext
9722 <!-- <nowiki>data</nowiki> -->
9723 !! html
9724 <!-- <nowiki>data</nowiki> -->
9725 !!end
9726
9727 !! test
9728 pre-save transform: <noinclude> in subst (bug 3298)
9729 !! options
9730 pst
9731 !! wikitext
9732 {{subst:Includes}}
9733 !! html
9734 Foobar
9735 !! end
9736
9737 !! test
9738 pre-save transform: <onlyinclude> in subst (bug 3298)
9739 !! options
9740 pst
9741 !! wikitext
9742 {{subst:Includes2}}
9743 !! html
9744 Foo
9745 !! end
9746
9747 !! article
9748 Template:SubstTest
9749 !!text
9750 {{<includeonly>subst:</includeonly>Includes}}
9751 !! endarticle
9752
9753 !! article
9754 Template:SafeSubstTest
9755 !! text
9756 {{<includeonly>safesubst:</includeonly>Includes}}
9757 !! endarticle
9758
9759 !! test
9760 bug 22297: safesubst: works during PST
9761 !! options
9762 pst
9763 !! wikitext
9764 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9765 !! html
9766 FoobarFoobar
9767 !! end
9768
9769 !! test
9770 bug 22297: safesubst: works during normal parse
9771 !! wikitext
9772 {{SafeSubstTest}}
9773 !! html
9774 <p>Foobar
9775 </p>
9776 !! end
9777
9778 !! test
9779 subst: does not work during normal parse
9780 !! wikitext
9781 {{SubstTest}}
9782 !! html
9783 <p>{{subst:Includes}}
9784 </p>
9785 !! end
9786
9787 !! test
9788 pre-save transform: context links ("pipe trick")
9789 !! options
9790 pst
9791 !! wikitext
9792 [[Article (context)|]]
9793 [[Bar:Article|]]
9794 [[:Bar:Article|]]
9795 [[Bar:Article (context)|]]
9796 [[:Bar:Article (context)|]]
9797 [[|Article]]
9798 [[|Article (context)]]
9799 [[Bar:X (Y) Z|]]
9800 [[:Bar:X (Y) Z|]]
9801 !! html
9802 [[Article (context)|Article]]
9803 [[Bar:Article|Article]]
9804 [[:Bar:Article|Article]]
9805 [[Bar:Article (context)|Article]]
9806 [[:Bar:Article (context)|Article]]
9807 [[Article]]
9808 [[Article (context)]]
9809 [[Bar:X (Y) Z|X (Y) Z]]
9810 [[:Bar:X (Y) Z|X (Y) Z]]
9811 !! end
9812
9813 !! test
9814 pre-save transform: context links ("pipe trick") with interwiki prefix
9815 !! options
9816 pst
9817 !! wikitext
9818 [[interwiki:Article|]]
9819 [[:interwiki:Article|]]
9820 [[interwiki:Bar:Article|]]
9821 [[:interwiki:Bar:Article|]]
9822 !! html
9823 [[interwiki:Article|Article]]
9824 [[:interwiki:Article|Article]]
9825 [[interwiki:Bar:Article|Bar:Article]]
9826 [[:interwiki:Bar:Article|Bar:Article]]
9827 !! end
9828
9829 !! test
9830 pre-save transform: context links ("pipe trick") with parens in title
9831 !! options
9832 pst title=[[Somearticle (context)]]
9833 !! wikitext
9834 [[|Article]]
9835 !! html
9836 [[Article (context)|Article]]
9837 !! end
9838
9839 !! test
9840 pre-save transform: context links ("pipe trick") with comma in title
9841 !! options
9842 pst title=[[Someplace, Somewhere]]
9843 !! wikitext
9844 [[|Otherplace]]
9845 [[Otherplace, Elsewhere|]]
9846 [[Otherplace, Elsewhere, Anywhere|]]
9847 !! html
9848 [[Otherplace, Somewhere|Otherplace]]
9849 [[Otherplace, Elsewhere|Otherplace]]
9850 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9851 !! end
9852
9853 !! test
9854 pre-save transform: context links ("pipe trick") with parens and comma
9855 !! options
9856 pst title=[[Someplace (IGNORED), Somewhere]]
9857 !! wikitext
9858 [[|Otherplace]]
9859 [[Otherplace (place), Elsewhere|]]
9860 !! html
9861 [[Otherplace, Somewhere|Otherplace]]
9862 [[Otherplace (place), Elsewhere|Otherplace]]
9863 !! end
9864
9865 !! test
9866 pre-save transform: context links ("pipe trick") with comma and parens
9867 !! options
9868 pst title=[[Who, me? (context)]]
9869 !! wikitext
9870 [[|Yes, you.]]
9871 [[Me, Myself, and I (1937 song)|]]
9872 !! html
9873 [[Yes, you. (context)|Yes, you.]]
9874 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9875 !! end
9876
9877 !! test
9878 pre-save transform: context links ("pipe trick") with namespace
9879 !! options
9880 pst title=[[Ns:Somearticle]]
9881 !! wikitext
9882 [[|Article]]
9883 !! html
9884 [[Ns:Article|Article]]
9885 !! end
9886
9887 !! test
9888 pre-save transform: context links ("pipe trick") with namespace and parens
9889 !! options
9890 pst title=[[Ns:Somearticle (context)]]
9891 !! wikitext
9892 [[|Article]]
9893 !! html
9894 [[Ns:Article (context)|Article]]
9895 !! end
9896
9897 !! test
9898 pre-save transform: context links ("pipe trick") with namespace and comma
9899 !! options
9900 pst title=[[Ns:Somearticle, Context, Whatever]]
9901 !! wikitext
9902 [[|Article]]
9903 !! html
9904 [[Ns:Article, Context, Whatever|Article]]
9905 !! end
9906
9907 !! test
9908 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9909 !! options
9910 pst title=[[Ns:Somearticle, Context (context)]]
9911 !! wikitext
9912 [[|Article]]
9913 !! html
9914 [[Ns:Article (context)|Article]]
9915 !! end
9916
9917 !! test
9918 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9919 !! options
9920 pst title=[[Ns:Somearticle (IGNORED), Context]]
9921 !! wikitext
9922 [[|Article]]
9923 !! html
9924 [[Ns:Article, Context|Article]]
9925 !! end
9926
9927 !! test
9928 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9929 !! options
9930 pst
9931 !! wikitext
9932 [[Article(context)|]]
9933 [[Bar:Article(context)|]]
9934 [[:Bar:Article(context)|]]
9935 [[|Article(context)]]
9936 [[Bar:X(Y)Z|]]
9937 [[:Bar:X(Y)Z|]]
9938 !! html
9939 [[Article(context)|Article]]
9940 [[Bar:Article(context)|Article]]
9941 [[:Bar:Article(context)|Article]]
9942 [[Article(context)]]
9943 [[Bar:X(Y)Z|X(Y)Z]]
9944 [[:Bar:X(Y)Z|X(Y)Z]]
9945 !! end
9946
9947 !! test
9948 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9949 !! options
9950 pst
9951 !! wikitext
9952 [[Article (context)|]]
9953 [[Bar:Article (context)|]]
9954 [[:Bar:Article (context)|]]
9955 [[|Article (context)]]
9956 [[Bar:X (Y) Z|]]
9957 [[:Bar:X (Y) Z|]]
9958 !! html
9959 [[Article (context)|Article]]
9960 [[Bar:Article (context)|Article]]
9961 [[:Bar:Article (context)|Article]]
9962 [[Article (context)]]
9963 [[Bar:X (Y) Z|X (Y) Z]]
9964 [[:Bar:X (Y) Z|X (Y) Z]]
9965 !! end
9966
9967 !! test
9968 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9969 !! options
9970 pst
9971 !! wikitext
9972 [[Article(context)|]]
9973 [[Bar:Article(context)|]]
9974 [[:Bar:Article(context)|]]
9975 [[|Article(context)]]
9976 [[Bar:X(Y)Z|]]
9977 [[:Bar:X(Y)Z|]]
9978 !! html
9979 [[Article(context)|Article]]
9980 [[Bar:Article(context)|Article]]
9981 [[:Bar:Article(context)|Article]]
9982 [[Article(context)]]
9983 [[Bar:X(Y)Z|X(Y)Z]]
9984 [[:Bar:X(Y)Z|X(Y)Z]]
9985 !! end
9986
9987 !! test
9988 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9989 !! options
9990 pst
9991 !! wikitext
9992 [[Article (context), context|]]
9993 [[Article (context),context|]]
9994 [[Bar:Article (context), context|]]
9995 [[Bar:Article (context),context|]]
9996 [[:Bar:Article (context), context|]]
9997 [[:Bar:Article (context),context|]]
9998 !! html
9999 [[Article (context), context|Article]]
10000 [[Article (context),context|Article]]
10001 [[Bar:Article (context), context|Article]]
10002 [[Bar:Article (context),context|Article]]
10003 [[:Bar:Article (context), context|Article]]
10004 [[:Bar:Article (context),context|Article]]
10005 !! end
10006
10007 !! test
10008 pre-save transform: trim trailing empty lines
10009 !! options
10010 pst
10011 !! wikitext
10012 Empty lines are trimmed
10013
10014
10015
10016
10017 !! html
10018 Empty lines are trimmed
10019 !! end
10020
10021 !! test
10022 pre-save transform: Signature expansion
10023 !! options
10024 pst
10025 !! wikitext
10026 * ~~~
10027 * <noinclude>~~~</noinclude>
10028 * <includeonly>~~~</includeonly>
10029 * <onlyinclude>~~~</onlyinclude>
10030 !! html
10031 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10032 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10033 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10034 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10035 !! end
10036
10037
10038 !! test
10039 pre-save transform: Signature expansion in nowiki tags (bug 93)
10040 !! options
10041 pst disabled
10042 !! wikitext
10043 Shall not expand:
10044
10045 <nowiki>~~~~</nowiki>
10046
10047 <includeonly><nowiki>~~~~</nowiki></includeonly>
10048
10049 <noinclude><nowiki>~~~~</nowiki></noinclude>
10050
10051 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10052
10053 {{subst:Foo}} shall be converted to FOO
10054
10055 As well as inside noinclude/onlyinclude
10056 <noinclude>{{subst:Foo}}</noinclude>
10057 <onlyinclude>{{subst:Foo}}</onlyinclude>
10058
10059 But not inside includeonly
10060 <includeonly>{{subst:Foo}}</includeonly>
10061 !! html
10062 Shall not expand:
10063
10064 <nowiki>~~~~</nowiki>
10065
10066 <includeonly><nowiki>~~~~</nowiki></includeonly>
10067
10068 <noinclude><nowiki>~~~~</nowiki></noinclude>
10069
10070 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10071
10072 FOO shall be converted to FOO
10073
10074 As well as inside noinclude/onlyinclude
10075 <noinclude>FOO</noinclude>
10076 <onlyinclude>FOO</onlyinclude>
10077
10078 But not inside includeonly
10079 <includeonly>{{subst:Foo}}</includeonly>
10080 !! end
10081
10082 !! test
10083 Parsoid: Recognize nowiki with trailing space in tags
10084 !! options
10085 parsoid=wt2html
10086 !! wikitext
10087 <nowiki ><div>[[foo]]</nowiki >
10088
10089 a<nowiki / >b
10090
10091 c<nowiki />d
10092
10093 e<nowiki/ >f
10094 !! html
10095 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10096 <p>ab</p>
10097 <p>cd</p>
10098 <p>ef</p>
10099 !! end
10100
10101 !! test
10102 Parsoid: Recognize nowiki with odd capitalization
10103 !! options
10104 parsoid=wt2html
10105 !! wikitext
10106 <noWikI ><div>[[foo]]</Nowiki >
10107 !! html
10108 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10109 !! end
10110
10111
10112 !! test
10113 Parsoid: Escape nowiki with trailing space in tags
10114 !! options
10115 parsoid=html2wt
10116 !! wikitext
10117 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10118
10119 a&lt;nowiki /&gt;b
10120
10121 c&lt;nowiki/ &gt;d
10122 !! html
10123 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10124 <p>a&lt;nowiki /&gt;b</p>
10125 <p>c&lt;nowiki/ &gt;d</p>
10126 !! end
10127
10128 !! test
10129 Parsoid: Escape weird noWikI capitalizations
10130 !! options
10131 parsoid=html2wt
10132 !! wikitext
10133 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10134 !! html
10135 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10136 !! end
10137
10138 ###
10139 ### Message transform tests
10140 ###
10141 !! test
10142 message transform: magic variables
10143 !! options
10144 msg
10145 !! wikitext
10146 {{SITENAME}}
10147 !! html
10148 MediaWiki
10149 !! end
10150
10151 !! test
10152 message transform: should not transform wiki markup
10153 !! options
10154 msg
10155 !! wikitext
10156 ''test''
10157 !! html
10158 ''test''
10159 !! end
10160
10161 !! test
10162 message transform: <noinclude> in transcluded template (bug 4926)
10163 !! options
10164 msg
10165 !! wikitext
10166 {{Includes}}
10167 !! html
10168 Foobar
10169 !! end
10170
10171 !! test
10172 message transform: <onlyinclude> in transcluded template (bug 4926)
10173 !! options
10174 msg
10175 !! wikitext
10176 {{Includes2}}
10177 !! html
10178 Foo
10179 !! end
10180
10181 !! test
10182 {{#special:}} page name, known
10183 !! options
10184 msg
10185 !! wikitext
10186 {{#special:Recentchanges}}
10187 !! html
10188 Special:RecentChanges
10189 !! end
10190
10191 !! test
10192 {{#special:}} page name with subpage, known
10193 !! options
10194 msg
10195 !! wikitext
10196 {{#special:Recentchanges/param}}
10197 !! html
10198 Special:RecentChanges/param
10199 !! end
10200
10201 !! test
10202 {{#special:}} page name, unknown
10203 !! options
10204 msg
10205 !! wikitext
10206 {{#special:foobar nonexistent}}
10207 !! html
10208 Special:Foobar nonexistent
10209 !! end
10210
10211 !! test
10212 {{#speciale:}} page name, known
10213 !! options
10214 msg
10215 !! wikitext
10216 {{#speciale:Recentchanges}}
10217 !! html
10218 Special:RecentChanges
10219 !! end
10220
10221 !! test
10222 {{#speciale:}} page name with subpage, known
10223 !! options
10224 msg
10225 !! wikitext
10226 {{#speciale:Recentchanges/param}}
10227 !! html
10228 Special:RecentChanges/param
10229 !! end
10230
10231 !! test
10232 {{#speciale:}} page name, unknown
10233 !! options
10234 msg
10235 !! wikitext
10236 {{#speciale:foobar nonexistent}}
10237 !! html
10238 Special:Foobar_nonexistent
10239 !! end
10240
10241 ###
10242 ### Images
10243 ###
10244 ### For Parsoid-specific tests, see
10245 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10246
10247 !! test
10248 Simple image
10249 !! options
10250 parsoid=wt2html,wt2wt,html2html
10251 !! wikitext
10252 [[Image:foobar.jpg]]
10253 !! html/php
10254 <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>
10255 </p>
10256 !! html/parsoid
10257 <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>
10258 </p>
10259 !! end
10260
10261 !! test
10262 Simple image (using File: namespace, now canonical)
10263 !! wikitext
10264 [[File:Foobar.jpg]]
10265 !! html/php
10266 <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>
10267 </p>
10268 !! html/parsoid
10269 <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>
10270 </p>
10271 !! end
10272
10273 !! test
10274 Right-aligned image
10275 !! wikitext
10276 [[File:Foobar.jpg|right]]
10277 !! html/php
10278 <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>
10279
10280 !! html/parsoid
10281 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></figure>
10282 !! end
10283
10284 !! test
10285 Image with caption
10286 !! wikitext
10287 [[File:Foobar.jpg|right|Caption text]]
10288 !! html/php
10289 <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>
10290
10291 !! html/parsoid
10292 <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>
10293 !! end
10294
10295 !! test
10296 Image with caption, bug 53312 #1
10297 !! wikitext
10298 [[File:Foobar.jpg|right|Caption page stuff]]
10299 !! html/php
10300 <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>
10301
10302 !! html/parsoid
10303 <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>
10304 !! end
10305
10306 !! test
10307 Image with caption, bug 53312 #2
10308 !! wikitext
10309 [[File:Foobar.jpg|right|Caption page=]]
10310 !! html/php
10311 <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>
10312
10313 !! html/parsoid
10314 <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>
10315 !! end
10316
10317 !! test
10318 Image with caption, bug 53312 #3
10319 !! wikitext
10320 [[File:Foobar.jpg|right|Caption page=stuff]]
10321 !! html/php
10322 <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>
10323
10324 !! html/parsoid
10325 <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>
10326 !! end
10327
10328 !! test
10329 Allow empty links in image captions (Bug 60753)
10330 !! options
10331 thumbsize=220
10332 !! wikitext
10333 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10334 [[]]
10335 [[Link2]]
10336 ]]
10337 !! html/php
10338 <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>
10339
10340 !! html/parsoid
10341 <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>
10342 [[]]
10343 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10344 </figcaption></figure>
10345 !! end
10346
10347 !! test
10348 Link with empty target
10349 !! wikitext
10350 [[]]
10351 !! html
10352 <p>[[]]
10353 </p>
10354 !! end
10355
10356 !! test
10357 Image with empty attribute
10358 !! options
10359 parsoid=wt2html,wt2wt,html2html
10360 !! wikitext
10361 [[File:Foobar.jpg|right||Caption text]]
10362 !! html/php
10363 <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>
10364
10365 !! html/parsoid
10366 <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>
10367 !! end
10368
10369 !! test
10370 1. Block image with individual attributes from templates
10371 !! wikitext
10372 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10373 !! html/php
10374 <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>
10375
10376 !! html/parsoid
10377 <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>
10378 !! end
10379
10380 !! test
10381 2. Block Image with individual attributes from templates
10382 !! wikitext
10383 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10384 !! html/php
10385 <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>
10386
10387 !! html/parsoid
10388 <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>
10389 !! end
10390
10391 !! test
10392 3. Inline image with individual attributes from templates
10393 !! wikitext
10394 [[File:Foobar.jpg|{{echo|50px}}]]
10395 !! html/php
10396 <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>
10397 </p>
10398 !! html/parsoid
10399 <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>
10400 !! end
10401
10402 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10403 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10404 !! test
10405 Image with multiple attributes from the same template
10406 !! wikitext
10407 [[File:Foobar.jpg|{{image_attribs}}]]
10408 !! html/php
10409 <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>
10410
10411 !! html/parsoid
10412 <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>
10413 !! end
10414
10415 !! test
10416 Image with link tails
10417 !! options
10418 thumbsize=220
10419 !! wikitext
10420 123[[File:Foobar.jpg]]456
10421 123[[File:Foobar.jpg|right]]456
10422 123[[File:Foobar.jpg|thumb]]456
10423 !! html/php
10424 <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
10425 </p>
10426 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
10427 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
10428
10429 !! html/parsoid
10430 <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>
10431 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
10432 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
10433 !! end
10434
10435 !! test
10436 Image with multiple captions -- only last one is accepted
10437 !! wikitext
10438 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10439 !! html/php
10440 <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>
10441
10442 !! html/parsoid
10443 <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>
10444 !! end
10445
10446 !! test
10447 Image with multiple widths -- use last
10448 !! wikitext
10449 [[File:Foobar.jpg|200px|300px|caption]]
10450 !! html/php
10451 <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>
10452 </p>
10453 !! html/parsoid
10454 <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>
10455 !! end
10456
10457 !! test
10458 Image with multiple alignments -- use first (bug 48664)
10459 !! options
10460 thumbsize=220
10461 !! wikitext
10462 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10463
10464 [[File:Foobar.jpg|middle|text-top|caption]]
10465 !! html/php
10466 <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>
10467 <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>
10468 </p>
10469 !! html/parsoid
10470 <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>
10471 <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>
10472 !! end
10473
10474 !! test
10475 Image with width attribute at different positions
10476 !! wikitext
10477 [[File:Foobar.jpg|200px|right|Caption]]
10478 [[File:Foobar.jpg|right|200px|Caption]]
10479 [[File:Foobar.jpg|right|Caption|200px]]
10480 !! html/php
10481 <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>
10482 <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>
10483 <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>
10484
10485 !! html/parsoid
10486 <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>
10487 <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>
10488 <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>
10489 !! end
10490
10491 # a sad bit of backward-compatibility
10492 !! test
10493 Image with size specified with pxpx (bug 13500, 51628)
10494 !! options
10495 parsoid=wt2html,wt2wt,html2html
10496 !! wikitext
10497 [[File:Foobar.jpg|20pxpx]]
10498 [[File:Foobar.jpg|200x20pxpx]]
10499 !! html/php
10500 <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>
10501 <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>
10502 </p>
10503 !! html/parsoid
10504 <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>
10505 !! end
10506
10507 !! test
10508 Image with link parameter, wiki target
10509 !! wikitext
10510 [[File:Foobar.jpg|link=Main Page]]
10511 !! html/php
10512 <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>
10513 </p>
10514 !! html/parsoid
10515 <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>
10516 !! end
10517
10518 # parsoid bug 49293 (part 1)
10519 !! test
10520 Image with link parameter, URL target
10521 !! wikitext
10522 [[File:Foobar.jpg|link=http://example.com/]]
10523 !! html/php
10524 <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>
10525 </p>
10526 !! html/parsoid
10527 <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>
10528 !! end
10529
10530 # parsoid bug 49293 (part 2)
10531 !! test
10532 Image with link parameter, protocol-less URL target
10533 !! wikitext
10534 [[File:Foobar.jpg|link=//example.com/]]
10535 !! html/php
10536 <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>
10537 </p>
10538 !! html/parsoid
10539 <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>
10540 !! end
10541
10542 !! test
10543 Image with link parameter, wgExternalLinkTarget
10544 !! wikitext
10545 [[Image:foobar.jpg|link=http://example.com/]]
10546 !! config
10547 wgExternalLinkTarget='foobar'
10548 !! html
10549 <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>
10550 </p>
10551 !! end
10552
10553 !! test
10554 Image with link parameter, wgNoFollowLinks set to false
10555 !! wikitext
10556 [[Image:foobar.jpg|link=http://example.com/]]
10557 !! config
10558 wgNoFollowLinks=false
10559 !! html
10560 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10561 </p>
10562 !! end
10563
10564 !! test
10565 Image with link parameter, wgNoFollowDomainExceptions
10566 !! wikitext
10567 [[Image:foobar.jpg|link=http://example.com/]]
10568 !! config
10569 wgNoFollowDomainExceptions='example.com'
10570 !! html
10571 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10572 </p>
10573 !! end
10574
10575 !! test
10576 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10577 !! wikitext
10578 [[Image:foobar.jpg|link=http://example.com/|Title]]
10579 !! config
10580 wgExternalLinkTarget='foobar'
10581 !! html
10582 <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>
10583 </p>
10584 !! end
10585
10586 !! test
10587 Image with empty link parameter
10588 !! wikitext
10589 [[File:Foobar.jpg|link=]]
10590 !! html/php
10591 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10592 </p>
10593 !! html/parsoid
10594 <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>
10595 !! end
10596
10597 !! test
10598 Image with link parameter (wiki target) and unnamed parameter
10599 !! wikitext
10600 [[File:Foobar.jpg|link=Main_Page|Title]]
10601 !! html/php
10602 <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>
10603 </p>
10604 !! html/parsoid
10605 <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>
10606 !! end
10607
10608 !! test
10609 Image with link parameter (URL target) and unnamed parameter
10610 !! wikitext
10611 [[File:Foobar.jpg|link=http://example.com/|Title]]
10612 !! html/php
10613 <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>
10614 </p>
10615 !! html/parsoid
10616 <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>
10617 !! end
10618
10619 !! test
10620 Thumbnail image with link parameter
10621 !! options
10622 thumbsize=220
10623 parsoid=wt2html,wt2wt,html2html
10624 !! wikitext
10625 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10626 !! html/php
10627 <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>
10628
10629 !! html/parsoid
10630 <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>
10631 !! end
10632
10633 !! test
10634 Manually-specified thumbnail image
10635 !! options
10636 thumbsize=220
10637 !! wikitext
10638 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10639 !! html/php
10640 <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>
10641
10642 !! html/parsoid
10643 <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>
10644 !! end
10645
10646 !! test
10647 Manually-specified thumbnail image with explicit link to wiki page
10648 !! options
10649 thumbsize=220
10650 parsoid=wt2html,wt2wt,html2html
10651 !! wikitext
10652 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10653 !! html/php
10654 <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>
10655
10656 !! html/parsoid
10657 <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>
10658 !! end
10659
10660 !! test
10661 Manually-specified thumbnail image with explicit link to url
10662 !! options
10663 thumbsize=220
10664 parsoid=wt2html,wt2wt,html2html
10665 !! wikitext
10666 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10667 !! html/php
10668 <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>
10669
10670 !! html/parsoid
10671 <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>
10672 !! end
10673
10674 !! test
10675 Manually-specified thumbnail image with explicit no link
10676 !! options
10677 thumbsize=220
10678 parsoid=wt2html,wt2wt,html2html
10679 !! wikitext
10680 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10681 !! html/php
10682 <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>
10683
10684 !! html/parsoid
10685 <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>
10686 !! end
10687
10688 !! test
10689 Manually-specified thumbnail image with explicit link and alt text
10690 !! options
10691 thumbsize=220
10692 parsoid=wt2html,wt2wt,html2html
10693 !! wikitext
10694 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10695 !! html/php
10696 <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>
10697
10698 !! html/parsoid
10699 <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>
10700 !! end
10701
10702 !! test
10703 Image with frame and link
10704 !! options
10705 parsoid=wt2html,wt2wt,html2html
10706 !! wikitext
10707 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10708 !! html/php
10709 <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>
10710
10711 !! html/parsoid
10712 <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>
10713 !! end
10714
10715 !! test
10716 Image with frame and link and explicit alt
10717 !! options
10718 parsoid=wt2html,wt2wt,html2html
10719 !! wikitext
10720 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10721 !! html/php
10722 <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>
10723
10724 !! html/parsoid
10725 <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>
10726 !! end
10727
10728 !! test
10729 Image with wiki markup in implicit alt
10730 !! options
10731 parsoid=wt2html,wt2wt,html2html
10732 !! wikitext
10733 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10734
10735 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10736 !! html/php
10737 <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>
10738 </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>
10739 </p>
10740 !! html/parsoid
10741 <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>
10742 <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>
10743 !! end
10744
10745 ###################
10746 # Conflicting image format options.
10747 # First option specified should 'win'.
10748 # All three cases in each test should be identical.
10749
10750 !! test
10751 Image with 'frameless' first.
10752 !! options
10753 parsoid=wt2html,wt2wt,html2html
10754 !! wikitext
10755 [[File:Foobar.jpg|frameless|caption]]
10756
10757 [[File:Foobar.jpg|frameless|frame|caption]]
10758
10759 [[File:Foobar.jpg|frameless|thumb|caption]]
10760 !! html/php
10761 <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>
10762 </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>
10763 </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>
10764 </p>
10765 !! html/parsoid
10766 <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>
10767 <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>
10768 <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>
10769 !! end
10770
10771 !! test
10772 Image with 'frame' first.
10773 !! options
10774 parsoid=wt2html,wt2wt,html2html
10775 !! wikitext
10776 [[File:Foobar.jpg|frame|caption]]
10777 [[File:Foobar.jpg|frame|frameless|caption]]
10778 [[File:Foobar.jpg|frame|thumb|caption]]
10779 !! html/php
10780 <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>
10781 <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>
10782 <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>
10783
10784 !! html/parsoid
10785 <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>
10786 !! end
10787
10788 !! test
10789 Image with 'thumb' first.
10790 !! options
10791 parsoid=wt2html,wt2wt,html2html
10792 !! wikitext
10793 [[File:Foobar.jpg|thumb|caption]]
10794 [[File:Foobar.jpg|thumb|frameless|caption]]
10795 [[File:Foobar.jpg|thumb|frame|caption]]
10796 !! html/php
10797 <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>
10798 <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>
10799 <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>
10800
10801 !! html/parsoid
10802 <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>
10803 !! end
10804
10805 ###################
10806 # Image sizing.
10807 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10808 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10809 # Foobar has actual size of 1941x220
10810 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10811 # a scalable format.
10812 # 2. Framed images always ignore size options; always render at default size.
10813 # 3. "Unspecified format" and border are the only types which can be
10814 # enlarged.
10815
10816 !! test
10817 Image: "unspecified format" and border enlarge
10818 !! options
10819 parsoid=wt2html,wt2wt,html2html
10820 !! wikitext
10821 [[File:Foobar.jpg|2000px]]
10822
10823 [[File:Foobar.jpg|border|2000px]]
10824 !! html/php
10825 <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>
10826 </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>
10827 </p>
10828 !! html/parsoid
10829 <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>
10830 <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>
10831 !! end
10832
10833 !! test
10834 Image: "unspecified format" and border reduce
10835 !! options
10836 parsoid=wt2html,wt2wt,html2html
10837 !! wikitext
10838 [[File:Foobar.jpg|1000px]]
10839
10840 [[File:Foobar.jpg|border|1000px]]
10841 !! html/php
10842 <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>
10843 </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>
10844 </p>
10845 !! html/parsoid
10846 <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>
10847 <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>
10848 !! end
10849
10850 !! test
10851 Image: thumbs reduce
10852 !! options
10853 parsoid=wt2html,wt2wt,html2html
10854 !! wikitext
10855 [[File:Foobar.jpg|thumb|50px]]
10856 !! html/php
10857 <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>
10858
10859 !! html/parsoid
10860 <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>
10861 !! end
10862
10863 !! test
10864 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10865 !! options
10866 parsoid=wt2html,wt2wt,html2html
10867 !! wikitext
10868 [[File:Foobar.jpg|thumb|2000px]]
10869
10870 [[File:Foobar.svg|thumb|2000px]]
10871 !! html/php
10872 <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>
10873 <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>
10874
10875 !! html/parsoid
10876 <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>
10877 <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>
10878 !! end
10879
10880 !! test
10881 Image: frameless can reduce in size
10882 !! options
10883 parsoid=wt2html,wt2wt,html2html
10884 !! wikitext
10885 [[File:Foobar.jpg|frameless|50px]]
10886 !! html/php
10887 <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>
10888 </p>
10889 !! html/parsoid
10890 <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>
10891 !! end
10892
10893 !! test
10894 Image: bitmap frameless can't be enlarged past original size, but vector can
10895 !! options
10896 parsoid=wt2html,wt2wt,html2html
10897 !! wikitext
10898 [[File:Foobar.jpg|frameless|2000px]]
10899
10900 [[File:Foobar.svg|frameless|2000px]]
10901 !! html/php
10902 <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>
10903 </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>
10904 </p>
10905 !! html/parsoid
10906 <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>
10907 <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>
10908 !! end
10909
10910 !! test
10911 Image: framed images are always unscaled.
10912 !! options
10913 parsoid=wt2html,wt2wt,html2html
10914 !! wikitext
10915 [[File:Foobar.jpg|frame]]
10916
10917 [[File:Foobar.jpg|frame|50px]]
10918
10919 [[File:Foobar.jpg|frame|50x50px]]
10920
10921 [[File:Foobar.jpg|frame|2000px]]
10922 !! html/php
10923 <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>
10924 <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>
10925 <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>
10926 <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>
10927
10928 !! html/parsoid
10929 <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>
10930 !! end
10931
10932 ###################
10933
10934 !! test
10935 Link to image page- image page normally doesn't exists, hence edit link
10936 Add test with existing image page
10937 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10938 !! wikitext
10939 [[:Image:test]]
10940 !! html
10941 <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>
10942 </p>
10943 !! end
10944
10945 !! test
10946 bug 18784 Link to non-existent image page with caption should use caption as link text
10947 !! wikitext
10948 [[:Image:test|caption]]
10949 !! html
10950 <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>
10951 </p>
10952 !! end
10953
10954 !! test
10955 Frameless image caption with a free URL
10956 !! wikitext
10957 [[File:Foobar.jpg|http://example.com]]
10958 !! html/php
10959 <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>
10960 </p>
10961 !! html/parsoid
10962 <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>
10963 !! end
10964
10965 !! test
10966 Thumbnail image caption with a free URL
10967 !! options
10968 thumbsize=220
10969 !! wikitext
10970 [[File:Foobar.jpg|thumb|http://example.com]]
10971 !! html/php
10972 <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>
10973
10974 !! html/parsoid
10975 <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>
10976 !! end
10977
10978 !! test
10979 Thumbnail image caption with a free URL and explicit alt
10980 !! options
10981 thumbsize=220
10982 parsoid=wt2html,wt2wt,html2html
10983 !! wikitext
10984 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10985 !! html/php
10986 <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>
10987
10988 !! html/parsoid
10989 <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>
10990 !! end
10991
10992 !! test
10993 SVG thumbnails with no language set
10994 !! options
10995 !! wikitext
10996 [[File:Foobar.svg|thumb|caption]]
10997 !! html/php
10998 <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>
10999
11000 !! html/parsoid
11001 <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>
11002 !! end
11003
11004 !! test
11005 SVG thumbnails with language de
11006 !! options
11007 parsoid=wt2html,wt2wt,html2html
11008 !! wikitext
11009 [[File:Foobar.svg|thumb|caption|lang=de]]
11010 !! html/php
11011 <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>
11012
11013 !! html/parsoid
11014 <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>
11015 !! end
11016
11017 !! test
11018 SVG thumbnails with invalid language code
11019 !! options
11020 parsoid=wt2html,wt2wt,html2html
11021 !! wikitext
11022 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11023 !! html/php
11024 <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>
11025
11026 !! html/parsoid
11027 <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>
11028 !! end
11029
11030 !! test
11031 BUG 1887: A ISBN with a thumbnail
11032 !! wikitext
11033 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11034 !! html/php
11035 <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>
11036
11037 !! html/parsoid
11038 <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>
11039 !! end
11040
11041 !! test
11042 BUG 1887: A RFC with a thumbnail
11043 !! wikitext
11044 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11045 !! html/php
11046 <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>
11047
11048 !! html/parsoid
11049 <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>
11050 !! end
11051
11052 !! test
11053 BUG 1887: A mailto link with a thumbnail
11054 !! wikitext
11055 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11056 !! html/php
11057 <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>
11058
11059 !! html/parsoid
11060 <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>
11061 !! end
11062
11063 # Pending resolution to bug 368
11064 !! test
11065 BUG 648: Frameless image caption with a link
11066 !! wikitext
11067 [[File:Foobar.jpg|text with a [[link]] in it]]
11068 !! html/php
11069 <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>
11070 </p>
11071 !! html/parsoid
11072 <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>
11073 !! end
11074
11075 !! test
11076 BUG 648: Frameless image caption with a link (suffix)
11077 !! wikitext
11078 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11079 !! html/php
11080 <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>
11081 </p>
11082 !! html/parsoid
11083 <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>
11084 !! end
11085
11086 !! test
11087 BUG 648: Frameless image caption with an interwiki link
11088 !! wikitext
11089 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11090 !! html/php
11091 <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>
11092 </p>
11093 !! html/parsoid
11094 <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>
11095 !! end
11096
11097 !! test
11098 BUG 648: Frameless image caption with a piped interwiki link
11099 !! wikitext
11100 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11101 !! html/php
11102 <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>
11103 </p>
11104 !! html/parsoid
11105 <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>
11106 !! end
11107
11108 !! test
11109 Escape HTML special chars in image alt text
11110 !! wikitext
11111 [[File:Foobar.jpg|& < > "]]
11112 !! html/php
11113 <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>
11114 </p>
11115 !! html/parsoid
11116 <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>
11117 !! end
11118
11119 !! test
11120 BUG 499: Alt text should have &#1234;, not &amp;1234;
11121 !! wikitext
11122 [[File:Foobar.jpg|&#9792;]]
11123 !! html/php
11124 <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>
11125 </p>
11126 !! html/parsoid
11127 <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>
11128 !! end
11129
11130 !! test
11131 Broken image caption with link
11132 !! options
11133 parsoid=wt2html,wt2wt,html2html
11134 !! wikitext
11135 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11136 !! html/php
11137 <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.
11138 </p>
11139 !! html/parsoid
11140 <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>
11141 !! end
11142
11143 !! test
11144 Image caption containing another image
11145 !! wikitext
11146 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11147 !! html/php
11148 <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>
11149
11150 !! html/parsoid
11151 <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>
11152 !! end
11153
11154 !! test
11155 Image: caption containing a newline
11156 !! wikitext
11157 [[File:Foobar.jpg|This
11158 *is some text]]
11159 !! html/php
11160 <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>
11161 </p>
11162 !! html/parsoid
11163 <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>
11164 !!end
11165
11166 !!test
11167 Image: caption containing leading space
11168 (The leading space should not trigger nowiki escaping in wt2wt mode)
11169 !! wikitext
11170 [[File:Foobar.jpg|thumb| bar]]
11171 !! html/php
11172 <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>
11173
11174 !! html/parsoid
11175 <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>
11176 !!end
11177
11178 !! test
11179 Image: caption containing a table
11180 !! options
11181 parsoid=wt2html,wt2wt,html2html
11182 !! wikitext
11183 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11184 {|
11185 ! Foo !! Bar
11186 |-
11187 | Foo1 || Bar1
11188 |}
11189 and some more text.]]
11190 !! html/php
11191 <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>
11192
11193 !! html/parsoid
11194 <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
11195 <table>
11196 <tbody>
11197 <tr><th>Foo </th><th>Bar</th></tr>
11198 <tr>
11199 <td>Foo1 </td>
11200 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11201 !! end
11202
11203 !! test
11204 Bug 3090: External links other than http: in image captions
11205 !! wikitext
11206 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11207 !! html/php
11208 <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>
11209
11210 !! html/parsoid
11211 <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>
11212 !! end
11213
11214 !! test
11215 Custom class
11216 !! options
11217 parsoid=wt2html,wt2wt,html2html
11218 !! wikitext
11219 [[Image:foobar.jpg|a|class=b]]
11220 !! html/php
11221 <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>
11222 </p>
11223 !! html/parsoid
11224 <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>
11225 !! end
11226
11227 !! test
11228 Localized image handling (1).
11229 !! options
11230 parsoid=wt2html,wt2wt,html2html
11231 language=es
11232 !! wikitext
11233 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11234 !! html/php
11235 <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>
11236
11237 !! html/parsoid
11238 <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>
11239 !! end
11240
11241 !! test
11242 Localized image handling (2).
11243 !! options
11244 thumbsize=220
11245 parsoid=wt2html,wt2wt,html2html
11246 language=es
11247 !! wikitext
11248 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11249 !! html/php
11250 <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>
11251
11252 !! html/parsoid
11253 <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>
11254 !! end
11255
11256 !! test
11257 "border", "frameless" and "class" attributes on an image.
11258 !! options
11259 thumbsize=220
11260 parsoid=wt2html,wt2wt,html2html
11261 !! wikitext
11262 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11263 !! html/php
11264 <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>
11265 </p>
11266 !! html/parsoid
11267 <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>
11268 !! end
11269
11270 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11271 !! test
11272 Invalid image attributes (bug 62500)
11273 !! options
11274 thumbsize=220
11275 parsoid=wt2html,wt2wt,html2html
11276 !! wikitext
11277 [[File:Foobar.jpg|thumb|float|left|caption]]
11278
11279 [[File:Foobar.jpg|thumb|righ|caption]]
11280
11281 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11282 !! html/php
11283 <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>
11284 <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>
11285 <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>
11286
11287 !! html/parsoid
11288 <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>
11289 !! end
11290
11291 !! article
11292 File:Barfoo.jpg
11293 !! text
11294 #REDIRECT [[File:Barfoo.jpg]]
11295 !! endarticle
11296
11297 !! test
11298 Redirected image
11299 !! wikitext
11300 [[Image:Barfoo.jpg]]
11301 !! html
11302 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11303 </p>
11304 !! end
11305
11306 !! test
11307 Missing image with uploads disabled
11308 !! options
11309 wgEnableUploads=0
11310 !! wikitext
11311 [[Image:Foobaz.jpg]]
11312 !! html
11313 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11314 </p>
11315 !! end
11316
11317 # Parsoid-specific testing for images
11318 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11319 # Currently imperfect due to a flaw in the Parsoid testrunner
11320 # Work in progress
11321 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11322 # image tests.
11323
11324 !! test
11325 Parsoid-specific image handling - simple image with size and middle alignment
11326 !! wikitext
11327 [[File:Foobar.jpg|middle|50px]]
11328 !! html/parsoid
11329 <p><span class="mw-valign-middle" typeof="mw:Image">
11330 <a href="File:Foobar.jpg">
11331 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11332 </a>
11333 </span>
11334 </p>
11335 !! end
11336
11337 !! test
11338 Parsoid-specific image handling - simple image with size, middle alignment,
11339 non-standard namespace alias
11340 !! options
11341 parsoid=wt2wt,wt2html,html2html
11342 !! wikitext
11343 [[Image:Foobar.jpg|middle|50px]]
11344 !! html/parsoid
11345 <p><span class="mw-valign-middle" typeof="mw:Image">
11346 <a href="File:Foobar.jpg">
11347 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11348 </a>
11349 </span>
11350 </p>
11351 !! end
11352
11353 !! test
11354 Parsoid-specific image handling - simple image with size and middle alignment
11355 (existing content)
11356 !! wikitext
11357 [[File:Foobar.jpg|50px|middle]]
11358 !! html/parsoid
11359 <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>
11360 !! end
11361
11362 !! test
11363 Parsoid-specific image handling - simple image with size and middle alignment
11364 and non-standard namespace name
11365 !! options
11366 parsoid=wt2html,wt2wt,html2html
11367 !! wikitext
11368 [[Image:Foobar.jpg|50px|middle]]
11369 !! html/parsoid
11370 <p><span class="mw-valign-middle" typeof="mw:Image">
11371 <a href="File:Foobar.jpg">
11372 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11373 </a>
11374 </span>
11375 </p>
11376 !! end
11377
11378 !! test
11379 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11380 !! wikitext
11381 [[File:Foobar.jpg|500x10px|baseline|caption]]
11382 !! html/parsoid
11383 <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>
11384 !! end
11385
11386 !! test
11387 Parsoid-specific image handling - simple image with border and size spec
11388 !! wikitext
11389 [[File:Foobar.jpg|50px|border|caption]]
11390 !! html/parsoid
11391 <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>
11392 !! end
11393
11394 !! test
11395 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11396 !! wikitext
11397 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11398 !! html/parsoid
11399 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11400 <a href="File:Foobar.jpg">
11401 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11402 </a>
11403 <figcaption>caption content</figcaption>
11404 </figure>
11405 !! end
11406
11407 !! test
11408 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11409 (existing content)
11410 !! wikitext
11411 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11412 !! html/parsoid
11413 <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>
11414 !! end
11415
11416 !! test
11417 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11418 !! wikitext
11419 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11420 !! html/parsoid
11421 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11422 <a href="File:Foobar.jpg">
11423 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11424 </a>
11425 <figcaption>caption</figcaption>
11426 </figure>
11427 !! end
11428
11429 !! test
11430 Parsoid-specific image handling - thumbnail with specific size, halign,
11431 valign, and caption (existing content)
11432 !! wikitext
11433 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11434 !! html/parsoid
11435 <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>
11436 !! end
11437
11438 !! test
11439 Parsoid-specific image handling - framed image with specific size and caption
11440 (size is ignored)
11441 !! options
11442 parsoid=wt2html,wt2wt,html2html
11443 !! wikitext
11444 [[File:Foobar.jpg|frame|500x50px|caption]]
11445 !! html/parsoid
11446 <figure typeof="mw:Image/Frame">
11447 <a href="File:Foobar.jpg">
11448 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11449 </a>
11450 <figcaption>caption</figcaption>
11451 </figure>
11452 !! end
11453
11454 !! test
11455 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11456 (size is ignored)
11457 !! options
11458 parsoid=wt2html,wt2wt,html2html
11459 !! wikitext
11460 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11461 !! html/parsoid
11462 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11463 <a href="File:Foobar.jpg">
11464 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11465 </a>
11466 <figcaption>caption</figcaption>
11467 </figure>
11468 !! end
11469
11470 !! test
11471 Parsoid-specific image handling - frameless image with specific size, border, and caption
11472 !! wikitext
11473 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11474 !! html/parsoid
11475 <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>
11476 !! end
11477
11478 !! test
11479 Parsoid-specific image handling - simple image with a formatted caption
11480 !! wikitext
11481 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11482 !! html/parsoid
11483 <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>"}'>
11484 <a href="File:Foobar.jpg">
11485 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11486 </a></span></p>
11487 !! end
11488
11489 !! test
11490 Parsoid-specific image handling - caption with a template in it
11491 !! wikitext
11492 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11493 !! html/parsoid
11494 <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>
11495 !! end
11496
11497 !! test
11498 Parsoid-specific image handling - caption with unbalanced tags in it
11499 !! options
11500 parsoid=wt2html,wt2wt,html2html
11501 !! wikitext
11502 foo
11503 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11504 bar
11505 !! html/parsoid
11506 <p>foo</p>
11507 <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>
11508 <p>bar</p>
11509 !! end
11510
11511 !! test
11512 Parsoid-specific image handling - empty caption (1)
11513 !! options
11514 parsoid=wt2html,wt2wt
11515 !! wikitext
11516 [[File:Foobar.jpg|thumb|]]
11517 !! html/parsoid
11518 <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>
11519 !! end
11520
11521 # empty captions don't get serialized unless we're in the "round trip" case
11522 !! test
11523 Parsoid-specific image handling - empty caption (2)
11524 !! options
11525 parsoid=html2wt
11526 !! html/parsoid
11527 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11528 <a href="File:Foobar.jpg">
11529 <img resource="./File:Foobar.jpg"
11530 src="//example.com/images/3/3a/Foobar.jpg"
11531 height="25" width="220"/>
11532 </a>
11533 <figcaption></figcaption>
11534 </figure>
11535 !! wikitext
11536 [[File:Foobar.jpg|thumb]]
11537 !! end
11538
11539 !! test
11540 Parsoid-specific image handling - whitespace caption
11541 !! wikitext
11542 [[File:Foobar.jpg|thumb| ]]
11543 !! html/parsoid
11544 <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>
11545 !! end
11546
11547 !! test
11548 Parsoid-specific image handling - lang option
11549 !! wikitext
11550 foo
11551 [[File:Foobar.svg|lang=de|caption]]
11552 bar
11553 !! html/parsoid
11554 <p>foo
11555 <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>
11556 bar</p>
11557 !! end
11558
11559
11560 ###
11561 ### Subpages
11562 ###
11563 !! article
11564 Subpage test/subpage
11565 !! text
11566 foo
11567 !! endarticle
11568
11569 !! test
11570 Subpage link
11571 !! options
11572 subpage title=[[Subpage test]]
11573 !! wikitext
11574 [[/subpage]]
11575 !! html
11576 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11577 </p>
11578 !! end
11579
11580 !! test
11581 Subpage noslash link
11582 !! options
11583 subpage title=[[Subpage test]]
11584 !! wikitext
11585 [[/subpage/]]
11586 !! html
11587 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11588 </p>
11589 !! end
11590
11591 # TODO: make this PHP-parser compatible!
11592 !! test
11593 Relative subpage noslash link
11594 !! options
11595 parsoid=wt2wt,wt2html,html2html
11596 subpage title=[[Subpage test/1/2/3/4]]
11597 !! wikitext
11598 [[../../subpage/]]
11599
11600 [[../../subpage]]
11601 !! html
11602 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11603 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11604 !! end
11605
11606 !! test
11607 Parsoid: dot-slash prefixed wikilinks
11608 !! wikitext
11609 [[./foo]]
11610
11611 [[././bar]]
11612
11613 [[././baz/]]
11614 !! html/php
11615 <p>[[./foo]]
11616 </p><p>[[././bar]]
11617 </p><p>[[././baz/]]
11618 </p>
11619 !! html/parsoid
11620 <p>[[./foo]]
11621 </p><p>[[././bar]]
11622 </p><p>[[././baz/]]
11623 </p>
11624 !! end
11625
11626 !! test
11627 Render invalid page names as plain text (bug 51090)
11628 !! wikitext
11629 [[./../foo|bar]]
11630 [[foo�|bar]]
11631 [[foo/.|bar]]
11632 [[foo/..|bar]]
11633 [[foo~~~bar]]
11634 [[foo>bar]]
11635 [[foo[bar]]
11636 [[.]]
11637 [[..]]
11638 [[foo././bar]]
11639
11640 [[{{echo|./../foo}}|bar]]
11641 [[{{echo|foo/.}}|bar]]
11642 [[{{echo|foo/..}}|bar]]
11643 [[{{echo|foo~~~~bar}}]]
11644 [[{{echo|foo>bar}}]]
11645 [[{{echo|foo././bar}}]]
11646 [[{{echo|foo{bar}}]]
11647 [[{{echo|foo}bar}}]]
11648 [[{{echo|foo[bar}}]]
11649 [[{{echo|foo]bar}}]]
11650 [[{{echo|foo<bar}}]]
11651 !!html/php
11652 <p>[[./../foo|bar]]
11653 [[foo�|bar]]
11654 [[foo/.|bar]]
11655 [[foo/..|bar]]
11656 [[foo~~~bar]]
11657 [[foo&gt;bar]]
11658 [[foo[bar]]
11659 [[.]]
11660 [[..]]
11661 [[foo././bar]]
11662 </p><p>[[./../foo|bar]]
11663 [[foo/.|bar]]
11664 [[foo/..|bar]]
11665 [[foo~~~~bar]]
11666 [[foo&gt;bar]]
11667 [[foo././bar]]
11668 [[foo{bar]]
11669 [[foo}bar]]
11670 [[foo[bar]]
11671 [[foo]bar]]
11672 [[foo&lt;bar]]
11673 </p>
11674 !!html/parsoid
11675 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11676 <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>
11677 !!end
11678
11679 !! test
11680 Disabled subpages
11681 !! wikitext
11682 [[/subpage]]
11683 !! html
11684 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11685 </p>
11686 !! end
11687
11688 !! test
11689 BUG 561: {{/Subpage}}
11690 !! options
11691 subpage title=[[Page]]
11692 !! wikitext
11693 {{/Subpage}}
11694 !! html
11695 <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>
11696 </p>
11697 !! end
11698
11699 ###
11700 ### Categories
11701 ###
11702 !! article
11703 Category:MediaWiki User's Guide
11704 !! text
11705 blah
11706 !! endarticle
11707
11708 !! test
11709 Link to category
11710 !! wikitext
11711 [[:Category:MediaWiki User's Guide]]
11712 !! html
11713 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11714 </p>
11715 !! end
11716
11717 !! test
11718 Simple category
11719 !! options
11720 cat
11721 !! wikitext
11722 [[Category:MediaWiki User's Guide]]
11723 !! html
11724 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11725 !! end
11726
11727 !! test
11728 PAGESINCATEGORY invalid title fatal (r33546 fix)
11729 !! wikitext
11730 {{PAGESINCATEGORY:<bogus>}}
11731 !! html
11732 <p>0
11733 </p>
11734 !! end
11735
11736 !! test
11737 Category with different sort key
11738 !! options
11739 cat
11740 !! wikitext
11741 [[Category:MediaWiki User's Guide|Foo]]
11742 !! html
11743 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11744 !! end
11745
11746 !! test
11747 Category with identical sort key
11748 !! options
11749 cat
11750 !! wikitext
11751 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11752 !! html
11753 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11754 !! end
11755
11756 !! test
11757 Category with empty sort key
11758 !! options
11759 cat
11760 pst
11761 !! wikitext
11762 [[Category:MediaWiki User's Guide|]]
11763 !! html
11764 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11765 !! end
11766
11767 !! test
11768 Category with empty sort key and parentheses
11769 !! options
11770 cat
11771 pst
11772 !! wikitext
11773 [[Category:Foo (bar)|]]
11774 !! html
11775 [[Category:Foo (bar)|Foo]]
11776 !! end
11777
11778 !! test
11779 Category with link tail
11780 !! options
11781 cat
11782 pst
11783 !! wikitext
11784 123[[Category:Foo]]456
11785 !! html
11786 123[[Category:Foo]]456
11787 !! end
11788
11789 !! test
11790 Category with template
11791 !! options
11792 cat
11793 pst
11794 !! wikitext
11795 [[Category:{{echo|Foo}}]]
11796 !! html
11797 [[Category:{{echo|Foo}}]]
11798 !! end
11799
11800 !! test
11801 Category with template in sort key
11802 !! options
11803 cat
11804 pst
11805 !! wikitext
11806 [[Category:Foo|{{echo|Bar}}]]
11807 !! html
11808 [[Category:Foo|{{echo|Bar}}]]
11809 !! end
11810
11811 !! test
11812 Category with template in sort key and title
11813 !! options
11814 cat
11815 pst
11816 !! wikitext
11817 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11818 !! html
11819 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11820 !! end
11821
11822 !! test
11823 Category / paragraph interactions
11824 !! wikitext
11825 Foo [[Category:Baz]] Bar
11826
11827 Foo [[Category:Baz]]
11828 Bar
11829
11830 Foo
11831 [[Category:Baz]]
11832 Bar
11833
11834 Foo
11835 [[Category:Baz]] Bar
11836
11837 Foo
11838 [[Category:Baz]]
11839 [[Category:Baz]]
11840 [[Category:Baz]]
11841 Bar
11842
11843 [[Category:Baz]]
11844 [[Category:Baz]]
11845 [[Category:Baz]]
11846
11847 [[Category:Baz]]
11848 {{echo|[[Category:Baz]]}}
11849 [[Category:Baz]]
11850 !! html
11851 <p>Foo Bar
11852 </p><p>Foo
11853 Bar
11854 </p><p>Foo
11855 Bar
11856 </p><p>Foo Bar
11857 </p><p>Foo
11858 Bar
11859 </p>
11860 !! end
11861
11862 !! test
11863 Parsoid: Serialize link to category page with colon escape
11864 !! options
11865 parsoid
11866 !! wikitext
11867
11868 [[:Category:Foo]]
11869 [[:Category:Foo|Bar]]
11870 !! html
11871 <p>
11872 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11873 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11874 </p>
11875 !! end
11876
11877 !! test
11878 Parsoid: Link prefix/suffixes aren't applied to category links
11879 !! options
11880 parsoid=wt2html,wt2wt,html2html
11881 language=is
11882 !! wikitext
11883 x[[Category:Foo]]y
11884 !! html
11885 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11886 !! end
11887
11888 !! test
11889 Parsoid: Serialize link to file page with colon escape
11890 !! options
11891 parsoid
11892 !! wikitext
11893
11894 [[:File:Foo.png]]
11895 [[:File:Foo.png|Bar]]
11896 !! html
11897 <p>
11898 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11899 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11900 </p>
11901 !! end
11902
11903 !! test
11904 Parsoid: Serialize a genuine category link without colon escape
11905 !! options
11906 parsoid
11907 !! wikitext
11908 [[Category:Foo]]
11909 [[Category:Foo|Bar]]
11910 !! html
11911 <link rel="mw:PageProp/Category" href="Category:Foo">
11912 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11913 !! end
11914
11915 !! test
11916 Parsoid: Defaultsort
11917 !! options
11918 parsoid
11919 !! wikitext
11920 {{DEFAULTSORT:Foo}}
11921 !! html
11922 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11923 !! end
11924
11925 ###
11926 ### Inter-language links
11927 ###
11928 !! test
11929 Inter-language links
11930 !! options
11931 ill
11932 !! wikitext
11933 [[es:Alimento]]
11934 [[fr:Nourriture]]
11935 [[zh:&#39135;&#21697;]]
11936 !! html
11937 es:Alimento fr:Nourriture zh:食品
11938 !! end
11939
11940 !! test
11941 Duplicate interlanguage links (bug 24502)
11942 !! options
11943 ill
11944 !! wikitext
11945 [[es:1]]
11946 [[es:2]]
11947 [[fr:1]]
11948 [[fr:2]]
11949 !! html
11950 es:1 fr:1
11951 !! end
11952
11953 ###
11954 ### Sections
11955 ###
11956 !! test
11957 Basic section headings
11958 !! wikitext
11959 == Headline 1 ==
11960 Some text
11961
11962 ==Headline 2==
11963 More
11964 ===Smaller headline===
11965 Blah blah
11966 !! html
11967 <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>
11968 <p>Some text
11969 </p>
11970 <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>
11971 <p>More
11972 </p>
11973 <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>
11974 <p>Blah blah
11975 </p>
11976 !! end
11977
11978 !! test
11979 Section headings with TOC
11980 !! wikitext
11981 == Headline 1 ==
11982 === Subheadline 1 ===
11983 ===== Skipping a level =====
11984 ====== Skipping a level ======
11985
11986 == Headline 2 ==
11987 Some text
11988 ===Another headline===
11989 !! html
11990 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11991 <ul>
11992 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11993 <ul>
11994 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11995 <ul>
11996 <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>
11997 <ul>
11998 <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>
11999 </ul>
12000 </li>
12001 </ul>
12002 </li>
12003 </ul>
12004 </li>
12005 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12006 <ul>
12007 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12008 </ul>
12009 </li>
12010 </ul>
12011 </div>
12012
12013 <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>
12014 <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>
12015 <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>
12016 <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>
12017 <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>
12018 <p>Some text
12019 </p>
12020 <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>
12021
12022 !! end
12023
12024 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12025 !! test
12026 Handling of sections up to level 6 and beyond
12027 !! wikitext
12028 = Level 1 Heading=
12029 == Level 2 Heading==
12030 === Level 3 Heading===
12031 ==== Level 4 Heading====
12032 ===== Level 5 Heading=====
12033 ====== Level 6 Heading======
12034 ======= Level 7 Heading=======
12035 ======== Level 8 Heading========
12036 ========= Level 9 Heading=========
12037 ========== Level 10 Heading==========
12038 !! html
12039 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12040 <ul>
12041 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12042 <ul>
12043 <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>
12044 <ul>
12045 <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>
12046 <ul>
12047 <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>
12048 <ul>
12049 <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>
12050 <ul>
12051 <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>
12052 <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>
12053 <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>
12054 <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>
12055 <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>
12056 </ul>
12057 </li>
12058 </ul>
12059 </li>
12060 </ul>
12061 </li>
12062 </ul>
12063 </li>
12064 </ul>
12065 </li>
12066 </ul>
12067 </div>
12068
12069 <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>
12070 <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>
12071 <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>
12072 <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>
12073 <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>
12074 <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>
12075 <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>
12076 <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>
12077 <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>
12078 <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>
12079
12080 !! end
12081
12082 !! test
12083 TOC regression (bug 9764)
12084 !! wikitext
12085 == title 1 ==
12086 === title 1.1 ===
12087 ==== title 1.1.1 ====
12088 === title 1.2 ===
12089 == title 2 ==
12090 === title 2.1 ===
12091 !! html
12092 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12093 <ul>
12094 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12095 <ul>
12096 <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>
12097 <ul>
12098 <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>
12099 </ul>
12100 </li>
12101 <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>
12102 </ul>
12103 </li>
12104 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12105 <ul>
12106 <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>
12107 </ul>
12108 </li>
12109 </ul>
12110 </div>
12111
12112 <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>
12113 <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>
12114 <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>
12115 <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>
12116 <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>
12117 <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>
12118
12119 !! end
12120
12121 !! test
12122 TOC with wgMaxTocLevel=3 (bug 6204)
12123 !! options
12124 wgMaxTocLevel=3
12125 !! wikitext
12126 == title 1 ==
12127 === title 1.1 ===
12128 ==== title 1.1.1 ====
12129 === title 1.2 ===
12130 == title 2 ==
12131 === title 2.1 ===
12132 !! html
12133 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12134 <ul>
12135 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12136 <ul>
12137 <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>
12138 <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>
12139 </ul>
12140 </li>
12141 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12142 <ul>
12143 <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>
12144 </ul>
12145 </li>
12146 </ul>
12147 </div>
12148
12149 <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>
12150 <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>
12151 <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>
12152 <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>
12153 <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>
12154 <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>
12155
12156 !! end
12157
12158 !! test
12159 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12160 !! options
12161 wgMaxTocLevel=3
12162 !! wikitext
12163 ==Section 1==
12164 ===Section 1.1===
12165 ====Section 1.1.1====
12166 ====Section 1.1.1.1====
12167 ==Section 2==
12168 !! html
12169 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12170 <ul>
12171 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12172 <ul>
12173 <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>
12174 </ul>
12175 </li>
12176 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12177 </ul>
12178 </div>
12179
12180 <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>
12181 <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>
12182 <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>
12183 <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>
12184 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12185
12186 !! end
12187
12188
12189 !! test
12190 Resolving duplicate section names
12191 !! wikitext
12192 == Foo bar ==
12193 == Foo bar ==
12194 !! html
12195 <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>
12196 <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>
12197
12198 !! end
12199
12200 !! test
12201 Resolving duplicate section names with differing case (bug 10721)
12202 !! wikitext
12203 == Foo bar ==
12204 == Foo Bar ==
12205 !! html
12206 <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>
12207 <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>
12208
12209 !! end
12210
12211 !! article
12212 Template:sections
12213 !! text
12214 ===Section 1===
12215 ==Section 2==
12216 !! endarticle
12217
12218 !! test
12219 Template with sections, __NOTOC__
12220 !! wikitext
12221 __NOTOC__
12222 ==Section 0==
12223 {{sections}}
12224 ==Section 4==
12225 !! html
12226 <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>
12227 <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>
12228 <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>
12229 <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>
12230
12231 !! end
12232
12233 !! test
12234 __NOEDITSECTION__ keyword
12235 !! wikitext
12236 __NOEDITSECTION__
12237 ==Section 1==
12238 ==Section 2==
12239 !! html
12240 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12241 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12242
12243 !! end
12244
12245 !! test
12246 Link inside a section heading
12247 !! wikitext
12248 ==Section with a [[Main Page|link]] in it==
12249 !! html
12250 <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>
12251
12252 !! end
12253
12254 !! test
12255 TOC regression (bug 12077)
12256 !! wikitext
12257 __TOC__
12258 == title 1 ==
12259 === title 1.1 ===
12260 == title 2 ==
12261 !! html
12262 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12263 <ul>
12264 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12265 <ul>
12266 <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>
12267 </ul>
12268 </li>
12269 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12270 </ul>
12271 </div>
12272
12273 <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>
12274 <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>
12275 <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>
12276
12277 !! end
12278
12279 !! test
12280 BUG 1219 URL next to image (good)
12281 !! wikitext
12282 http://example.com [[Image:foobar.jpg]]
12283 !! html
12284 <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>
12285 </p>
12286 !!end
12287
12288 !! test
12289 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12290 !! wikitext
12291 ===
12292 The line above must have a trailing space!
12293 === <!--
12294 --> <!-- -->
12295 But just in case it doesn't...
12296 !! html
12297 <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>
12298 <p>The line above must have a trailing space!
12299 </p>
12300 <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>
12301 <p>But just in case it doesn't...
12302 </p>
12303 !! end
12304
12305 !! test
12306 Header with special characters (bug 25462)
12307 !! wikitext
12308 The tooltips shall not show entities to the user (ie. be double escaped)
12309
12310 == text > text ==
12311 section 1
12312
12313 == text < text ==
12314 section 2
12315
12316 == text & text ==
12317 section 3
12318
12319 == text ' text ==
12320 section 4
12321
12322 == text " text ==
12323 section 5
12324 !! html
12325 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12326 </p>
12327 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12328 <ul>
12329 <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>
12330 <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>
12331 <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>
12332 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12333 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12334 </ul>
12335 </div>
12336
12337 <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>
12338 <p>section 1
12339 </p>
12340 <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>
12341 <p>section 2
12342 </p>
12343 <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>
12344 <p>section 3
12345 </p>
12346 <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>
12347 <p>section 4
12348 </p>
12349 <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>
12350 <p>section 5
12351 </p>
12352 !! end
12353
12354 !! test
12355 Headers with excess '=' characters
12356 (Are similar tests necessary beyond the 1st level?)
12357 !! wikitext
12358 =foo==
12359 ==foo=
12360 =''italic'' heading==
12361 ==''italic'' heading=
12362 !! html
12363 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12364 <ul>
12365 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12366 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12367 <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>
12368 <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>
12369 </ul>
12370 </div>
12371
12372 <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>
12373 <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>
12374 <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>
12375 <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>
12376
12377 !! end
12378
12379 !! test
12380 HTML headers vs TOC (bug 23393)
12381 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12382 !! wikitext
12383 <h1>Header 1</h1>
12384 == Header 1.1 ==
12385 == Header 1.2 ==
12386
12387 <h1>Header 2
12388 </h1>
12389 == Header 2.1 ==
12390 == Header 2.2 ==
12391 __NOEDITSECTION__
12392 !! html
12393 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12394 <ul>
12395 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12396 <ul>
12397 <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>
12398 <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>
12399 </ul>
12400 </li>
12401 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12402 <ul>
12403 <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>
12404 <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>
12405 </ul>
12406 </li>
12407 </ul>
12408 </div>
12409
12410 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12411 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12412 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12413 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12414 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12415 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12416
12417 !! end
12418
12419 !! test
12420 Single-line or multiline-comments can follow headings
12421 !! options
12422 parsoid=wt2html,wt2wt
12423 !! wikitext
12424 ==foo==<!---->
12425 ==bar==<!--c1-->
12426 ==baz==<!--
12427 c2
12428 c3-->
12429 !! html
12430 <h2><span class="mw-headline" id="foo">foo</span></h2>
12431 <h2><span class="mw-headline" id="bar">bar</span></h2>
12432 <h2><span class="mw-headline" id="baz">baz</span></h2>
12433
12434 !! end
12435
12436 !! test
12437 BUG 1219 URL next to image (broken)
12438 !! wikitext
12439 http://example.com[[Image:foobar.jpg]]
12440 !! html
12441 <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>
12442 </p>
12443 !!end
12444
12445 !! test
12446 Bug 1186 news: in the middle of text
12447 !! wikitext
12448 http://en.wikinews.org/wiki/Wikinews:Workplace
12449 !! html
12450 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12451 </p>
12452 !!end
12453
12454
12455 !! test
12456 Namespaced link must have a title
12457 !! wikitext
12458 [[Project:]]
12459 !! html
12460 <p>[[Project:]]
12461 </p>
12462 !!end
12463
12464 !! test
12465 Namespaced link must have a title (bad fragment version)
12466 !! wikitext
12467 [[Project:#fragment]]
12468 !! html
12469 <p>[[Project:#fragment]]
12470 </p>
12471 !!end
12472
12473
12474 ###
12475 ### HTML tags and HTML attributes
12476 ###
12477
12478 !! test
12479 div with no attributes
12480 !! wikitext
12481 <div>HTML rocks</div>
12482 !! html
12483 <div>HTML rocks</div>
12484
12485 !! end
12486
12487 !! test
12488 div with double-quoted attribute
12489 !! wikitext
12490 <div id="rock">HTML rocks</div>
12491 !! html
12492 <div id="rock">HTML rocks</div>
12493
12494 !! end
12495
12496 !! test
12497 div with single-quoted attribute
12498 !! wikitext
12499 <div id='rock'>HTML rocks</div>
12500 !! html
12501 <div id="rock">HTML rocks</div>
12502
12503 !! end
12504
12505 !! test
12506 div with unquoted attribute
12507 !! wikitext
12508 <div id=rock>HTML rocks</div>
12509 !! html
12510 <div id="rock">HTML rocks</div>
12511
12512 !! end
12513
12514 !! test
12515 div with illegal double attributes
12516 !! wikitext
12517 <div id="a" id="b">HTML rocks</div>
12518 !! html
12519 <div id="b">HTML rocks</div>
12520
12521 !!end
12522
12523 # FIXME: produce empty string instead of "class" in the PHP parser, following
12524 # the HTML5 spec.
12525 !! test
12526 div with empty attribute value, space before equals
12527 !! options
12528 parsoid
12529 !! wikitext
12530 <div class =>HTML rocks</div>
12531 !! html
12532 <div class="">HTML rocks</div>
12533
12534 !! end
12535
12536 # The PHP parser escapes the opening brace to &#123; for some reason, so
12537 # disabled this test for it.
12538 !! test
12539 div with braces in attribute value
12540 !! options
12541 parsoid
12542 !! wikitext
12543 <div title="{}">Foo</div>
12544 !! html
12545 <div title="{}">Foo</div>
12546 !! end
12547
12548 # This it very inconsistent in the PHP parser: it returns
12549 # class="class" if there is a space between the name and the equal sign (see
12550 # 'div with empty attribute value, space before equals'), but strips the
12551 # attribute completely if the space is missing. We hope that not much content
12552 # depends on this, so are implementing the behavior below in Parsoid for
12553 # consistencies' sake. Disabled for the PHP parser.
12554 # FIXME: fix this behavior in the PHP parser?
12555 !! test
12556 div with empty attribute value, no space before equals
12557 !! options
12558 parsoid
12559 !! wikitext
12560 <div class=>HTML rocks</div>
12561 !! html
12562 <div class="">HTML rocks</div>
12563
12564 !! end
12565
12566 !! test
12567 HTML multiple attributes correction
12568 !! wikitext
12569 <p class="error" class="awesome">Awesome!</p>
12570 !! html
12571 <p class="awesome">Awesome!</p>
12572
12573 !!end
12574
12575 !! test
12576 Table multiple attributes correction
12577 !! wikitext
12578 {|
12579 !+ class="error" class="awesome"| status
12580 |}
12581 !! html
12582 <table>
12583 <tr>
12584 <th class="awesome"> status
12585 </th></tr></table>
12586
12587 !!end
12588
12589 !! test
12590 DIV IN UPPERCASE
12591 !! wikitext
12592 <DIV ID="x">HTML ROCKS</DIV>
12593 !! html
12594 <div id="x">HTML ROCKS</div>
12595
12596 !!end
12597
12598 !! test
12599 Non-ASCII pseudo-tags are rendered as text
12600 !! wikitext
12601 <khyô>
12602 !! html
12603 <p>&lt;khyô&gt;
12604 </p>
12605 !! end
12606
12607 !! test
12608 Pseudo-tag with URL 'name' renders as url link
12609 !! wikitext
12610 <http://example.com/>
12611 !! html
12612 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12613 </p>
12614 !! end
12615
12616 !! test
12617 text with amp in the middle of nowhere
12618 !! wikitext
12619 Remember AT&T?
12620 !! html
12621 <p>Remember AT&amp;T?
12622 </p>
12623 !! end
12624
12625 !! test
12626 text with character entity: eacute
12627 !! wikitext
12628 I always thought &eacute; was a cute letter.
12629 !! html
12630 <p>I always thought &#233; was a cute letter.
12631 </p>
12632 !! end
12633
12634 !! test
12635 text with entity-escaped character entity-like string: eacute
12636 !! wikitext
12637 I always thought &amp;eacute; was a cute letter.
12638 !! html
12639 <p>I always thought &amp;eacute; was a cute letter.
12640 </p>
12641 !! end
12642
12643 !! test
12644 text with undefined character entity: xacute
12645 !! wikitext
12646 I always thought &xacute; was a cute letter.
12647 !! html
12648 <p>I always thought &amp;xacute; was a cute letter.
12649 </p>
12650 !! end
12651
12652 # TODO: generalize to PHP parser?
12653 !! test
12654 HTML5 tags
12655 !! options
12656 parsoid
12657 !! wikitext
12658 <data value="5">five</data>
12659 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12660 <mark>This highlighted text</mark>
12661 !! html
12662 <p><data value="5">five</data>
12663 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12664 <mark>This highlighted text</mark></p>
12665 !! end
12666
12667 !! test
12668 HTML tag with leading space is parsed as text
12669 !! wikitext
12670 < div>foo< /div>
12671 !! html
12672 <p>&lt; div&gt;foo&lt; /div&gt;
12673 </p>
12674 !! end
12675
12676 ###
12677 ### Nesting tests (see bug 41545, 50604, 51081)
12678 ###
12679
12680 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12681 # Note that html2wt is considerably more difficult if we use <b> in
12682 # the test case, instead of <big>
12683 !! test
12684 Ensure that HTML adoption agency algorithm is properly implemented.
12685 !! wikitext
12686 <big>X<big>Y</big>Z</big>
12687 !! html
12688 <p><big>X<big>Y</big>Z</big>
12689 </p>
12690 !! end
12691
12692 # This was bug 41545 in the PHP parser.
12693 !! test
12694 Nesting of <kbd>
12695 !! wikitext
12696 <kbd>X<kbd>Y</kbd>Z</kbd>
12697 !! html
12698 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12699 </p>
12700 !! end
12701
12702 # The following cases were bug 51081 in the PHP parser.
12703 # Note that there are some other nestable tags (b, i, etc) which are
12704 # not covered; see bug 51081 for discussion.
12705 !! test
12706 Nesting of <em>
12707 !! wikitext
12708 <em>X<em>Y</em>Z</em>
12709 !! html
12710 <p><em>X<em>Y</em>Z</em>
12711 </p>
12712 !! end
12713
12714 !! test
12715 Nesting of <strong>
12716 !! wikitext
12717 <strong>X<strong>Y</strong>Z</strong>
12718 !! html
12719 <p><strong>X<strong>Y</strong>Z</strong>
12720 </p>
12721 !! end
12722
12723 !! test
12724 Nesting of <q>
12725 !! wikitext
12726 <q>X<q>Y</q>Z</q>
12727 !! html
12728 <p><q>X<q>Y</q>Z</q>
12729 </p>
12730 !! end
12731
12732 !! test
12733 Nesting of <ruby>
12734 !! wikitext
12735 <ruby>X<ruby>Y</ruby>Z</ruby>
12736 !! html
12737 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12738 </p>
12739 !! end
12740
12741 !! test
12742 Nesting of <bdo>
12743 !! wikitext
12744 <bdo>X<bdo>Y</bdo>Z</bdo>
12745 !! html
12746 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12747 </p>
12748 !! end
12749
12750
12751 ###
12752 ### Media links
12753 ###
12754
12755 !! test
12756 Media link
12757 !! wikitext
12758 [[Media:Foobar.jpg]]
12759 !! html
12760 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12761 </p>
12762 !! end
12763
12764 !! test
12765 Media link with text
12766 !! wikitext
12767 [[Media:Foobar.jpg|A neat file to look at]]
12768 !! html
12769 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12770 </p>
12771 !! end
12772
12773 # FIXME: this is still bad HTML tag nesting
12774 !! test
12775 Media link with nasty text
12776 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12777 !! wikitext
12778 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12779 !! html
12780 <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>
12781
12782 !! end
12783
12784 !! test
12785 Media link to nonexistent file (bug 1702)
12786 !! wikitext
12787 [[Media:No such.jpg]]
12788 !! html
12789 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12790 </p>
12791 !! end
12792
12793 !! test
12794 Image link to nonexistent file (bug 1850 - good)
12795 !! wikitext
12796 [[Image:No such.jpg]]
12797 !! html
12798 <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>
12799 </p>
12800 !! end
12801
12802 !! test
12803 :Image link to nonexistent file (bug 1850 - bad)
12804 !! wikitext
12805 [[:Image:No such.jpg]]
12806 !! html
12807 <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>
12808 </p>
12809 !! end
12810
12811
12812
12813 !! test
12814 Character reference normalization in link text (bug 1938)
12815 !! wikitext
12816 [[Main Page|this&that]]
12817 !! html
12818 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12819 </p>
12820 !!end
12821
12822 !! article
12823 אַ
12824 !! text
12825 Test for unicode normalization
12826
12827 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12828 !! endarticle
12829
12830 !! test
12831 (bug 19451) Links should refer to the normalized form.
12832 !! wikitext
12833 [[&#xFB2E;]]
12834 [[&#x5d0;&#x5b7;]]
12835 [[&#x5d0;ַ]]
12836 [[א&#x5b7;]]
12837 [[אַ]]
12838 !! html
12839 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12840 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12841 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12842 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12843 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12844 </p>
12845 !! end
12846
12847 !! test
12848 Empty attribute crash test (bug 2067)
12849 !! wikitext
12850 <font color="">foo</font>
12851 !! html
12852 <p><font color="">foo</font>
12853 </p>
12854 !! end
12855
12856 !! test
12857 Empty attribute crash test single-quotes (bug 2067)
12858 !! wikitext
12859 <font color=''>foo</font>
12860 !! html
12861 <p><font color="">foo</font>
12862 </p>
12863 !! end
12864
12865 !! test
12866 Attribute test: equals, then nothing
12867 !! wikitext
12868 <font color=>foo</font>
12869 !! html
12870 <p><font>foo</font>
12871 </p>
12872 !! end
12873
12874 !! test
12875 Attribute test: unquoted value
12876 !! wikitext
12877 <font color=x>foo</font>
12878 !! html
12879 <p><font color="x">foo</font>
12880 </p>
12881 !! end
12882
12883 !! test
12884 Attribute test: unquoted but illegal value (hash)
12885 !! wikitext
12886 <font color=#x>foo</font>
12887 !! html
12888 <p><font color="#x">foo</font>
12889 </p>
12890 !! end
12891
12892 !! test
12893 Attribute test: no value
12894 !! wikitext
12895 <font color>foo</font>
12896 !! html
12897 <p><font color="color">foo</font>
12898 </p>
12899 !! end
12900
12901 !! test
12902 Bug 2095: link with three closing brackets
12903 !! wikitext
12904 [[Main Page]]]
12905 !! html/php
12906 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12907 </p>
12908 !! html/parsoid
12909 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12910 !! end
12911
12912 !! test
12913 Bug 2095: link with pipe and three closing brackets
12914 !! wikitext
12915 [[Main Page|link]]]
12916 !! html/php
12917 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12918 </p>
12919 !! html/parsoid
12920 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12921 !! end
12922
12923 !! test
12924 Bug 2095: link with pipe and three closing brackets, version 2
12925 !! wikitext
12926 [[Main Page|[http://example.com/]]]
12927 !! html/php
12928 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12929 </p>
12930 !! html/parsoid
12931 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12932 !! end
12933
12934
12935 ###
12936 ### Safety
12937 ###
12938
12939 !! article
12940 Template:Dangerous attribute
12941 !! text
12942 " onmouseover="alert(document.cookie)
12943 !! endarticle
12944
12945 !! article
12946 Template:Dangerous style attribute
12947 !! text
12948 border-size: expression(alert(document.cookie))
12949 !! endarticle
12950
12951 !! article
12952 Template:Div style
12953 !! text
12954 <div style="float: right; {{{1}}}">Magic div</div>
12955 !! endarticle
12956
12957 !! test
12958 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12959 !! wikitext
12960 <div title="{{test}}"></div>
12961 !! html
12962 <div title="This is a test template"></div>
12963
12964 !! end
12965
12966 !! test
12967 Bug 2304: HTML attribute safety (dangerous template; 2309)
12968 !! wikitext
12969 <div title="{{dangerous attribute}}"></div>
12970 !! html
12971 <div title=""></div>
12972
12973 !! end
12974
12975 !! test
12976 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12977 !! wikitext
12978 <div style="{{dangerous style attribute}}"></div>
12979 !! html
12980 <div style="/* insecure input */"></div>
12981
12982 !! end
12983
12984 !! test
12985 Bug 2304: HTML attribute safety (safe parameter; 2309)
12986 !! wikitext
12987 {{div style|width: 200px}}
12988 !! html
12989 <div style="float: right; width: 200px">Magic div</div>
12990
12991 !! end
12992
12993 !! test
12994 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12995 !! wikitext
12996 {{div style|width: expression(alert(document.cookie))}}
12997 !! html
12998 <div style="/* insecure input */">Magic div</div>
12999
13000 !! end
13001
13002 !! test
13003 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13004 !! wikitext
13005 {{div style|"><script>alert(document.cookie)</script>}}
13006 !! html
13007 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13008
13009 !! end
13010
13011 !! test
13012 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13013 !! wikitext
13014 {{div style|" ><script>alert(document.cookie)</script>}}
13015 !! html
13016 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13017
13018 !! end
13019
13020 !! test
13021 Bug 2304: HTML attribute safety (link)
13022 !! wikitext
13023 <div title="[[Main Page]]"></div>
13024 !! html
13025 <div title="&#91;&#91;Main Page]]"></div>
13026
13027 !! end
13028
13029 !! test
13030 Bug 2304: HTML attribute safety (italics)
13031 !! wikitext
13032 <div title="''foobar''"></div>
13033 !! html
13034 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13035
13036 !! end
13037
13038 !! test
13039 Bug 2304: HTML attribute safety (bold)
13040 !! wikitext
13041 <div title="'''foobar'''"></div>
13042 !! html
13043 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13044
13045 !! end
13046
13047
13048 !! test
13049 Bug 2304: HTML attribute safety (ISBN)
13050 !! wikitext
13051 <div title="ISBN 1234567890"></div>
13052 !! html
13053 <div title="&#73;SBN 1234567890"></div>
13054
13055 !! end
13056
13057 !! test
13058 Bug 2304: HTML attribute safety (RFC)
13059 !! wikitext
13060 <div title="RFC 1234"></div>
13061 !! html
13062 <div title="&#82;FC 1234"></div>
13063
13064 !! end
13065
13066 !! test
13067 Bug 2304: HTML attribute safety (PMID)
13068 !! wikitext
13069 <div title="PMID 1234567890"></div>
13070 !! html
13071 <div title="&#80;MID 1234567890"></div>
13072
13073 !! end
13074
13075 !! test
13076 Bug 2304: HTML attribute safety (web link)
13077 !! wikitext
13078 <div title="http://example.com/"></div>
13079 !! html
13080 <div title="http&#58;//example.com/"></div>
13081
13082 !! end
13083
13084 !! test
13085 Bug 2304: HTML attribute safety (named web link)
13086 !! wikitext
13087 <div title="[http://example.com/ link]"></div>
13088 !! html
13089 <div title="&#91;http&#58;//example.com/ link]"></div>
13090
13091 !! end
13092
13093 !! test
13094 Bug 3244: HTML attribute safety (extension; safe)
13095 !! wikitext
13096 <div style="<nowiki>background:blue</nowiki>"></div>
13097 !! html
13098 <div style="background:blue"></div>
13099
13100 !! end
13101
13102 !! test
13103 Bug 3244: HTML attribute safety (extension; unsafe)
13104 !! wikitext
13105 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13106 !! html
13107 <div style="/* insecure input */"></div>
13108
13109 !! end
13110
13111 # More MSIE fun discovered by Tom Gilder
13112
13113 !! test
13114 MSIE CSS safety test: spurious slash
13115 !! wikitext
13116 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13117 !! html
13118 <div style="/* insecure input */">evil</div>
13119
13120 !! end
13121
13122 !! test
13123 MSIE CSS safety test: hex code
13124 !! wikitext
13125 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13126 !! html
13127 <div style="/* insecure input */">evil</div>
13128
13129 !! end
13130
13131 !! test
13132 MSIE CSS safety test: comment in url
13133 !! wikitext
13134 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13135 !! html
13136 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13137
13138 !! end
13139
13140 !! test
13141 MSIE CSS safety test: comment in expression
13142 !! wikitext
13143 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13144 !! html
13145 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13146
13147 !! end
13148
13149 !! test
13150 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13151 !! wikitext
13152 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13153 !! html
13154 <p style="/* invalid control char */">A</p>
13155
13156 !! end
13157
13158 !! test
13159 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13160 !! wikitext
13161 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13162 <div style="top:EXPRESSION(alert())">B</div>
13163 !! html
13164 <p style="/* insecure input */">A</p>
13165 <div style="/* insecure input */">B</div>
13166
13167 !! end
13168
13169 !! test
13170 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13171 !! wikitext
13172 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13173 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13174 !! html
13175 <div style="/* insecure input */">A</div>
13176 <p style="/* insecure input */">B</p>
13177
13178 !! end
13179
13180 !! test
13181 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13182 !! wikitext
13183 <div style="background-image:url⁽javascript:alert())">A</div>
13184 <div style="background-image:url₍javascript:alert())">B</div>
13185 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13186 !! html
13187 <div style="/* insecure input */">A</div>
13188 <div style="/* insecure input */">B</div>
13189 <p style="/* insecure input */">C</p>
13190
13191 !! end
13192
13193 !! test
13194 Opera -o-link CSS
13195 !! wikitext
13196 <div
13197 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;"
13198 style="-o-link:attr(title);-o-link-source:current">X</div>
13199 !! html
13200 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13201
13202 !! end
13203
13204 !! test
13205 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13206 !! wikitext
13207 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13208 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13209 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13210 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13211 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13212 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13213 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13214 !! html
13215 <p style="/* insecure input */">A</p>
13216 <p style="/* insecure input */">B</p>
13217 <p style="/* insecure input */">C</p>
13218 <p style="/* insecure input */">D</p>
13219 <p style="/* insecure input */">E</p>
13220 <p style="/* insecure input */">F</p>
13221 <p style="/* insecure input */">G</p>
13222
13223 !! end
13224
13225 !! test
13226 Table attribute legitimate extension
13227 !! wikitext
13228 {|
13229 !+ style="<nowiki>color:blue</nowiki>"| status
13230 |}
13231 !! html
13232 <table>
13233 <tr>
13234 <th style="color:blue"> status
13235 </th></tr></table>
13236
13237 !!end
13238
13239 !! test
13240 Table attribute safety
13241 !! wikitext
13242 {|
13243 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13244 |}
13245 !! html
13246 <table>
13247 <tr>
13248 <th style="/* insecure input */"> status
13249 </th></tr></table>
13250
13251 !! end
13252
13253 !! test
13254 CSS line continuation 1
13255 !! wikitext
13256 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13257 !! html
13258 <div style="/* insecure input */"></div>
13259
13260 !! end
13261
13262 !! test
13263 CSS line continuation 2
13264 !! wikitext
13265 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13266 !! html
13267 <div style="/* insecure input */"></div>
13268
13269 !! end
13270
13271 !! article
13272 Template:Identity
13273 !! text
13274 {{{1}}}
13275 !! endarticle
13276
13277 !! test
13278 Expansion of multi-line templates in attribute values (bug 6255)
13279 !! wikitext
13280 <div style="background: {{identity|#00FF00}}">-</div>
13281 !! html
13282 <div style="background: #00FF00">-</div>
13283
13284 !! end
13285
13286
13287 !! test
13288 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13289 !! wikitext
13290 <div style="background:
13291 #00FF00">-</div>
13292 !! html
13293 <div style="background: #00FF00">-</div>
13294
13295 !! end
13296
13297 !! test
13298 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13299 !! wikitext
13300 <div style="background: &#10;#00FF00">-</div>
13301 !! html
13302 <div style="background: &#10;#00FF00">-</div>
13303
13304 !! end
13305
13306 ###
13307 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13308 ###
13309 !! test
13310 Parser hook: empty input
13311 !! wikitext
13312 <tag></tag>
13313 !! html
13314 <pre>
13315 ''
13316 array (
13317 )
13318 </pre>
13319
13320 !! end
13321
13322 !! test
13323 Parser hook: empty input using terminated empty elements
13324 !! wikitext
13325 <tag/>
13326 !! html
13327 <pre>
13328 NULL
13329 array (
13330 )
13331 </pre>
13332
13333 !! end
13334
13335 !! test
13336 Parser hook: empty input using terminated empty elements (space before)
13337 !! wikitext
13338 <tag />
13339 !! html
13340 <pre>
13341 NULL
13342 array (
13343 )
13344 </pre>
13345
13346 !! end
13347
13348 !! test
13349 Parser hook: basic input
13350 !! wikitext
13351 <tag>input</tag>
13352 !! html
13353 <pre>
13354 'input'
13355 array (
13356 )
13357 </pre>
13358
13359 !! end
13360
13361
13362 !! test
13363 Parser hook: case insensitive
13364 !! wikitext
13365 <TAG>input</TAG>
13366 !! html
13367 <pre>
13368 'input'
13369 array (
13370 )
13371 </pre>
13372
13373 !! end
13374
13375
13376 !! test
13377 Parser hook: case insensitive, redux
13378 !! wikitext
13379 <TaG>input</TAg>
13380 !! html
13381 <pre>
13382 'input'
13383 array (
13384 )
13385 </pre>
13386
13387 !! end
13388
13389 !! test
13390 Parser hook: nested tags
13391 !! options
13392 noxml
13393 !! wikitext
13394 <tag><tag></tag></tag>
13395 !! html
13396 <pre>
13397 '<tag>'
13398 array (
13399 )
13400 </pre>&lt;/tag&gt;
13401
13402 !! end
13403
13404 !! test
13405 Parser hook: basic arguments
13406 !! wikitext
13407 <tag width=200 height = "100" depth = '50' square></tag>
13408 !! html
13409 <pre>
13410 ''
13411 array (
13412 'width' => '200',
13413 'height' => '100',
13414 'depth' => '50',
13415 'square' => 'square',
13416 )
13417 </pre>
13418
13419 !! end
13420
13421 !! test
13422 Parser hook: argument containing a forward slash (bug 5344)
13423 !! wikitext
13424 <tag filename='/tmp/bla'></tag>
13425 !! html
13426 <pre>
13427 ''
13428 array (
13429 'filename' => '/tmp/bla',
13430 )
13431 </pre>
13432
13433 !! end
13434
13435 !! test
13436 Parser hook: empty input using terminated empty elements (bug 2374)
13437 !! wikitext
13438 <tag foo=bar/>text
13439 !! html
13440 <pre>
13441 NULL
13442 array (
13443 'foo' => 'bar',
13444 )
13445 </pre>text
13446
13447 !! end
13448
13449 # </tag> should be output literally since there is no matching tag that begins it
13450 !! test
13451 Parser hook: basic arguments using terminated empty elements (bug 2374)
13452 !! wikitext
13453 <tag width=200 height = "100" depth = '50' square/>
13454 other stuff
13455 </tag>
13456 !! html
13457 <pre>
13458 NULL
13459 array (
13460 'width' => '200',
13461 'height' => '100',
13462 'depth' => '50',
13463 'square' => 'square',
13464 )
13465 </pre>
13466 <p>other stuff
13467 &lt;/tag&gt;
13468 </p>
13469 !! end
13470
13471 ###
13472 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13473 ###
13474
13475 !! test
13476 Parser hook: static parser hook not inside a comment
13477 !! wikitext
13478 <statictag>hello, world</statictag>
13479 <statictag action=flush/>
13480 !! html
13481 <p>hello, world
13482 </p>
13483 !! end
13484
13485
13486 !! test
13487 Parser hook: static parser hook inside a comment
13488 !! wikitext
13489 <!-- <statictag>hello, world</statictag> -->
13490 <statictag action=flush/>
13491 !! html
13492 <p><br />
13493 </p>
13494 !! end
13495
13496 # Nested template calls; this case was broken by Parser.php rev 1.506,
13497 # since reverted.
13498
13499 !! article
13500 Template:One-parameter
13501 !! text
13502 (My parameter is: {{{1}}})
13503 !! endarticle
13504
13505 !! article
13506 Template:Map-one-parameter
13507 !! text
13508 {{{{{1}}}|{{{2}}}}}
13509 !! endarticle
13510
13511 !! test
13512 Nested template calls
13513 !! wikitext
13514 {{Map-one-parameter|One-parameter|param}}
13515 !! html
13516 <p>(My parameter is: param)
13517 </p>
13518 !! end
13519
13520
13521 ###
13522 ### Sanitizer
13523 ###
13524 !! test
13525 Sanitizer: Closing of open tags
13526 !! wikitext
13527 <s></s><table></table>
13528 !! html
13529 <s></s><table></table>
13530
13531 !! end
13532
13533 !! test
13534 Sanitizer: Closing of open but not closed tags
13535 !! wikitext
13536 <s>foo
13537 !! html
13538 <p><s>foo</s>
13539 </p>
13540 !! end
13541
13542 !! test
13543 Sanitizer: Closing of closed but not open tags
13544 !! wikitext
13545 </s>
13546 !! html
13547 <p>&lt;/s&gt;
13548 </p>
13549 !! end
13550
13551 !! test
13552 Sanitizer: Closing of closed but not open table tags
13553 !! wikitext
13554 Table not started</td></tr></table>
13555 !! html
13556 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13557 </p>
13558 !! end
13559
13560 !! test
13561 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13562 !! wikitext
13563 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13564 !! html
13565 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13566 </p>
13567 !! end
13568
13569 !! test
13570 Sanitizer: Validating the contents of the id attribute (bug 4515)
13571 !! options
13572 disabled
13573 !! wikitext
13574 <br id=9 />
13575 !! html
13576 Something, but definitely not <br id="9" />...
13577 !! end
13578
13579 !! test
13580 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13581 !! options
13582 disabled
13583 !! wikitext
13584 <br id="foo" /><br id="foo" />
13585 !! html
13586 Something need to be done. foo-2 ?
13587 !! end
13588
13589 !! test
13590 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13591 !! wikitext
13592 <div itemscope>
13593 <meta itemprop="hello" content="world">
13594 <meta http-equiv="refresh" content="5">
13595 <meta itemprop="hello" http-equiv="refresh" content="5">
13596 <link itemprop="hello" href="{{SERVER}}">
13597 <link rel="stylesheet" href="{{SERVER}}">
13598 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13599 </div>
13600 !! html
13601 <div itemscope="itemscope">
13602 <p> <meta itemprop="hello" content="world" />
13603 &lt;meta http-equiv="refresh" content="5"&gt;
13604 <meta itemprop="hello" content="5" />
13605 </p>
13606 <link itemprop="hello" href="http&#58;//example.org" />
13607 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13608 <link itemprop="hello" href="http&#58;//example.org" />
13609 </div>
13610
13611 !! end
13612
13613 !! test
13614 Language converter: output gets cut off unexpectedly (bug 5757)
13615 !! options
13616 language=zh
13617 !! wikitext
13618 this bit is safe: }-
13619
13620 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13621
13622 then we get cut off here: }-
13623
13624 all additional text is vanished
13625 !! html
13626 <p>this bit is safe: }-
13627 </p><p>but if we add a conversion instance: xxx
13628 </p><p>then we get cut off here: }-
13629 </p><p>all additional text is vanished
13630 </p>
13631 !! end
13632
13633 !! test
13634 Self closed html pairs (bug 5487)
13635 !! options
13636 !! wikitext
13637 <center><font id="bug" />Centered text</center>
13638 <div><font id="bug2" />In div text</div>
13639 !! html
13640 <center>&lt;font id="bug" /&gt;Centered text</center>
13641 <div>&lt;font id="bug2" /&gt;In div text</div>
13642
13643 !! end
13644
13645 #
13646 #
13647 #
13648
13649 !! test
13650 Punctuation: nbsp before exclamation
13651 !! wikitext
13652 C'est grave !
13653 !! html
13654 <p>C'est grave&#160;!
13655 </p>
13656 !! end
13657
13658 !! test
13659 Punctuation: CSS !important (bug 11874)
13660 !! wikitext
13661 <div style="width:50% !important">important</div>
13662 !! html
13663 <div style="width:50% !important">important</div>
13664
13665 !!end
13666
13667 !! test
13668 Punctuation: CSS ! important (bug 11874; with space after)
13669 !! wikitext
13670 <div style="width:50% ! important">important</div>
13671 !! html
13672 <div style="width:50% ! important">important</div>
13673
13674 !!end
13675
13676
13677 !! test
13678 HTML bullet list, closed tags (bug 5497)
13679 !! wikitext
13680 <ul>
13681 <li>One</li>
13682 <li>Two</li>
13683 </ul>
13684 !! html
13685 <ul>
13686 <li>One</li>
13687 <li>Two</li>
13688 </ul>
13689
13690 !! end
13691
13692 !! test
13693 HTML bullet list, unclosed tags (bug 5497)
13694 !! options
13695 disabled
13696 !! wikitext
13697 <ul>
13698 <li>One
13699 <li>Two
13700 </ul>
13701 !! html
13702 <ul>
13703 <li>One
13704 </li>
13705 <li>Two
13706 </li>
13707 </ul>
13708
13709 !! end
13710
13711 !! test
13712 HTML ordered list, closed tags (bug 5497)
13713 !! wikitext
13714 <ol>
13715 <li>One</li>
13716 <li>Two</li>
13717 </ol>
13718 !! html
13719 <ol>
13720 <li>One</li>
13721 <li>Two</li>
13722 </ol>
13723
13724 !! end
13725
13726 !! test
13727 HTML ordered list, unclosed tags (bug 5497)
13728 !! options
13729 disabled
13730 !! wikitext
13731 <ol>
13732 <li>One
13733 <li>Two
13734 </ol>
13735 !! html
13736 <ol>
13737 <li>One
13738 </li>
13739 <li>Two
13740 </li>
13741 </ol>
13742
13743 !! end
13744
13745 !! test
13746 HTML nested bullet list, closed tags (bug 5497)
13747 !! wikitext
13748 <ul>
13749 <li>One</li>
13750 <li>Two:
13751 <ul>
13752 <li>Sub-one</li>
13753 <li>Sub-two</li>
13754 </ul>
13755 </li>
13756 </ul>
13757 !! html
13758 <ul>
13759 <li>One</li>
13760 <li>Two:
13761 <ul>
13762 <li>Sub-one</li>
13763 <li>Sub-two</li>
13764 </ul>
13765 </li>
13766 </ul>
13767
13768 !! end
13769
13770 !! test
13771 HTML nested bullet list, open tags (bug 5497)
13772 !! options
13773 disabled
13774 !! wikitext
13775 <ul>
13776 <li>One
13777 <li>Two:
13778 <ul>
13779 <li>Sub-one
13780 <li>Sub-two
13781 </ul>
13782 </ul>
13783 !! html
13784 <ul>
13785 <li>One
13786 </li>
13787 <li>Two:
13788 <ul>
13789 <li>Sub-one
13790 </li>
13791 <li>Sub-two
13792 </li>
13793 </ul>
13794 </li>
13795 </ul>
13796
13797 !! end
13798
13799 !! test
13800 HTML nested ordered list, closed tags (bug 5497)
13801 !! wikitext
13802 <ol>
13803 <li>One</li>
13804 <li>Two:
13805 <ol>
13806 <li>Sub-one</li>
13807 <li>Sub-two</li>
13808 </ol>
13809 </li>
13810 </ol>
13811 !! html
13812 <ol>
13813 <li>One</li>
13814 <li>Two:
13815 <ol>
13816 <li>Sub-one</li>
13817 <li>Sub-two</li>
13818 </ol>
13819 </li>
13820 </ol>
13821
13822 !! end
13823
13824 !! test
13825 HTML nested ordered list, open tags (bug 5497)
13826 !! options
13827 disabled
13828 !! wikitext
13829 <ol>
13830 <li>One
13831 <li>Two:
13832 <ol>
13833 <li>Sub-one
13834 <li>Sub-two
13835 </ol>
13836 </ol>
13837 !! html
13838 <ol>
13839 <li>One
13840 </li>
13841 <li>Two:
13842 <ol>
13843 <li>Sub-one
13844 </li>
13845 <li>Sub-two
13846 </li>
13847 </ol>
13848 </li>
13849 </ol>
13850
13851 !! end
13852
13853 !! test
13854 HTML ordered list item with parameters oddity
13855 !! wikitext
13856 <ol><li id="fragment">One</li>
13857 </ol>
13858 !! html
13859 <ol><li id="fragment">One</li>
13860 </ol>
13861
13862 !! end
13863
13864 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13865 !!test
13866 bug 5918: autonumbering
13867 !! wikitext
13868 [http://first/] [http://second] [ftp://ftp]
13869
13870 ftp://inlineftp
13871
13872 [mailto:enclosed@mail.tld With target]
13873
13874 [mailto:enclosed@mail.tld]
13875
13876 mailto:inline@mail.tld
13877 !! html/php
13878 <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>
13879 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13880 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13881 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13882 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13883 </p>
13884 !! html/parsoid
13885 <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>
13886 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13887 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13888 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13889 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13890 !! end
13891
13892
13893 #
13894 # Security and HTML correctness
13895 # From Nick Jenkins' fuzz testing
13896 #
13897
13898 !! test
13899 Fuzz testing: Parser13
13900 !! wikitext
13901 {|
13902 | http://a|
13903 !! html
13904 <table>
13905 <tr>
13906 <td>
13907 </td>
13908 </tr>
13909 </table>
13910
13911 !! end
13912
13913 !! test
13914 Fuzz testing: Parser14
13915 !! wikitext
13916 == onmouseover= ==
13917 http://__TOC__
13918 !! html
13919 <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>
13920 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13921 <ul>
13922 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13923 </ul>
13924 </div>
13925
13926
13927 !! end
13928
13929 !! test
13930 Fuzz testing: Parser14-table
13931 !! wikitext
13932 ==a==
13933 {| STYLE=__TOC__
13934 !! html
13935 <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>
13936 <table style="&#95;_TOC&#95;_">
13937 <tr><td></td></tr>
13938 </table>
13939
13940 !! end
13941
13942 # Known to produce bogus xml (extra </td>)
13943 !! test
13944 Fuzz testing: Parser16
13945 !! options
13946 noxml
13947 !! wikitext
13948 {|
13949 !https://||||||
13950 !! html
13951 <table>
13952 <tr>
13953 <th>https://</th>
13954 <th></th>
13955 <th></th>
13956 <th>
13957 </td>
13958 </tr>
13959 </table>
13960
13961 !! end
13962
13963 !! test
13964 Fuzz testing: Parser21
13965 !! wikitext
13966 {|
13967 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13968 |
13969 !! html
13970 <table>
13971 <tr>
13972 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13973 </th>
13974 <td>
13975 </td>
13976 </tr>
13977 </table>
13978
13979 !! end
13980
13981 !! test
13982 Fuzz testing: Parser22
13983 !! wikitext
13984 http://===r:::https://b
13985
13986 {|
13987 !! html
13988 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13989 </p>
13990 <table>
13991 <tr><td></td></tr>
13992 </table>
13993
13994 !! end
13995
13996 # Known to produce bad XML for now
13997 !! test
13998 Fuzz testing: Parser24
13999 !! options
14000 noxml
14001 !! wikitext
14002 {|
14003 {{{|
14004 <u CLASS=
14005 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14006 <br style="onmouseover='alert(document.cookie);' " />
14007
14008 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14009 |
14010 !! html
14011 <table>
14012 {{{|
14013 <u class="&#124;">}}}} &gt;
14014 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14015
14016 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14017 <tr>
14018 <td></u>
14019 </td>
14020 </tr>
14021 </table>
14022
14023 !! end
14024
14025 # Note: the current result listed for this is not what the original one was,
14026 # but the original bug was JavaScript injection, which is fixed in any case.
14027 # It's not clear that the original result listed was any more correct than the
14028 # current one. Original result:
14029 # <p>{{{|
14030 # </p>
14031 # <li class="&#124;&#124;">
14032 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14033 !!test
14034 Fuzz testing: Parser25 (bug 6055)
14035 !! wikitext
14036 {{{
14037 |
14038 <LI CLASS=||
14039 >
14040 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14041 !! html
14042 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14043 </p>
14044 !! end
14045
14046 !!test
14047 Fuzz testing: URL adjacent extension (with space, clean)
14048 !! options
14049 !! wikitext
14050 http://example.com <nowiki>junk</nowiki>
14051 !! html
14052 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14053 </p>
14054 !!end
14055
14056 !!test
14057 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14058 !! options
14059 !! wikitext
14060 http://example.com<nowiki>junk</nowiki>
14061 !! html
14062 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14063 </p>
14064 !!end
14065
14066 !!test
14067 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14068 !! options
14069 !! wikitext
14070 http://example.com<pre>junk</pre>
14071 !! html
14072 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14073
14074 !!end
14075
14076 !!test
14077 Fuzz testing: image with bogus manual thumbnail
14078 !! wikitext
14079 [[Image:foobar.jpg|thumbnail= ]]
14080 !! html/php
14081 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14082
14083 !! html/parsoid
14084 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14085 !!end
14086
14087 !! test
14088 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14089 !! wikitext
14090 <pre dir="&#10;"></pre>
14091 !! html
14092 <pre dir="&#10;"></pre>
14093
14094 !! end
14095
14096 !! test
14097 Parsing optional HTML elements (Bug 6171)
14098 !! options
14099 !! wikitext
14100 <table>
14101 <tr>
14102 <td> Some tabular data</td>
14103 <td> More tabular data ...
14104 <td> And yet som tabular data</td>
14105 </tr>
14106 </table>
14107 !! html
14108 <table>
14109 <tr>
14110 <td> Some tabular data</td>
14111 <td> More tabular data ...
14112 </td><td> And yet som tabular data</td>
14113 </tr>
14114 </table>
14115
14116 !! end
14117
14118 !! test
14119 Correct handling of <td>, <tr> (Bug 6171)
14120 !! options
14121 !! wikitext
14122 <table>
14123 <tr>
14124 <td> Some tabular data</td>
14125 <td> More tabular data ...</td>
14126 <td> And yet som tabular data</td>
14127 </tr>
14128 </table>
14129 !! html
14130 <table>
14131 <tr>
14132 <td> Some tabular data</td>
14133 <td> More tabular data ...</td>
14134 <td> And yet som tabular data</td>
14135 </tr>
14136 </table>
14137
14138 !! end
14139
14140
14141 !! test
14142 Parsing crashing regression (fr:JavaScript)
14143 !! wikitext
14144 </body></x>
14145 !! html
14146 <p>&lt;/body&gt;&lt;/x&gt;
14147 </p>
14148 !! end
14149
14150 !! test
14151 Inline wiki vs wiki block nesting
14152 !! wikitext
14153 '''Bold paragraph
14154
14155 New wiki paragraph
14156 !! html
14157 <p><b>Bold paragraph</b>
14158 </p><p>New wiki paragraph
14159 </p>
14160 !! end
14161
14162 !! test
14163 Inline HTML vs wiki block nesting
14164 !! options
14165 disabled
14166 !! wikitext
14167 <b>Bold paragraph
14168
14169 New wiki paragraph
14170 !! html
14171 <p><b>Bold paragraph</b>
14172 </p><p>New wiki paragraph
14173 </p>
14174 !! end
14175
14176 # Original result was this:
14177 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14178 # </p>
14179 # While that might be marginally more intuitive, maybe, the six-apostrophe
14180 # construct is clearly pathological and the result stated here (which is what
14181 # the parser actually does) is about as reasonable as anything.
14182 !!test
14183 Mixing markup for italics and bold
14184 !! options
14185 !! wikitext
14186 '''bold''''''bold''bolditalics'''''
14187 !! html
14188 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14189 </p>
14190 !! end
14191
14192
14193 !! article
14194 Xyzzyx
14195 !! text
14196 Article for special page transclusion test
14197 !! endarticle
14198
14199 !! test
14200 Special page transclusion
14201 !! options
14202 !! wikitext
14203 {{Special:Prefixindex/Xyzzyx}}
14204 !! html
14205 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14206
14207 !! end
14208
14209 !! test
14210 Special page transclusion twice (bug 5021)
14211 !! options
14212 !! wikitext
14213 {{Special:Prefixindex/Xyzzyx}}
14214 {{Special:Prefixindex/Xyzzyx}}
14215 !! html
14216 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14217 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14218
14219 !! end
14220
14221 !! test
14222 Transclusion of default MediaWiki message
14223 !! wikitext
14224 {{MediaWiki:Mainpage}}
14225 !! html
14226 <p>Main Page
14227 </p>
14228 !! end
14229
14230 !! test
14231 Transclusion of nonexistent MediaWiki message
14232 !! wikitext
14233 {{MediaWiki:Mainpagexxx}}
14234 !! html
14235 <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>
14236 </p>
14237 !! end
14238
14239 !! test
14240 Transclusion of MediaWiki message with underscore
14241 !! wikitext
14242 {{MediaWiki:history_short}}
14243 !! html
14244 <p>History
14245 </p>
14246 !! end
14247
14248 !! test
14249 Transclusion of MediaWiki message with space
14250 !! wikitext
14251 {{MediaWiki:history short}}
14252 !! html
14253 <p>History
14254 </p>
14255 !! end
14256
14257 !! test
14258 Invalid header with following text
14259 !! wikitext
14260 = x = y
14261 !! html
14262 <p>= x = y
14263 </p>
14264 !! end
14265
14266
14267 !! test
14268 Section extraction test (section 0)
14269 !! options
14270 section=0
14271 !! wikitext
14272 start
14273 ==a==
14274 ===aa===
14275 ====aaa====
14276 ==b==
14277 ===ba===
14278 ===bb===
14279 ====bba====
14280 ===bc===
14281 ==c==
14282 ===ca===
14283 !! html
14284 start
14285 !! end
14286
14287 !! test
14288 Section extraction test (section 1)
14289 !! options
14290 section=1
14291 !! wikitext
14292 start
14293 ==a==
14294 ===aa===
14295 ====aaa====
14296 ==b==
14297 ===ba===
14298 ===bb===
14299 ====bba====
14300 ===bc===
14301 ==c==
14302 ===ca===
14303 !! html
14304 ==a==
14305 ===aa===
14306 ====aaa====
14307 !! end
14308
14309 !! test
14310 Section extraction test (section 2)
14311 !! options
14312 section=2
14313 !! wikitext
14314 start
14315 ==a==
14316 ===aa===
14317 ====aaa====
14318 ==b==
14319 ===ba===
14320 ===bb===
14321 ====bba====
14322 ===bc===
14323 ==c==
14324 ===ca===
14325 !! html
14326 ===aa===
14327 ====aaa====
14328 !! end
14329
14330 !! test
14331 Section extraction test (section 3)
14332 !! options
14333 section=3
14334 !! wikitext
14335 start
14336 ==a==
14337 ===aa===
14338 ====aaa====
14339 ==b==
14340 ===ba===
14341 ===bb===
14342 ====bba====
14343 ===bc===
14344 ==c==
14345 ===ca===
14346 !! html
14347 ====aaa====
14348 !! end
14349
14350 !! test
14351 Section extraction test (section 4)
14352 !! options
14353 section=4
14354 !! wikitext
14355 start
14356 ==a==
14357 ===aa===
14358 ====aaa====
14359 ==b==
14360 ===ba===
14361 ===bb===
14362 ====bba====
14363 ===bc===
14364 ==c==
14365 ===ca===
14366 !! html
14367 ==b==
14368 ===ba===
14369 ===bb===
14370 ====bba====
14371 ===bc===
14372 !! end
14373
14374 !! test
14375 Section extraction test (section 5)
14376 !! options
14377 section=5
14378 !! wikitext
14379 start
14380 ==a==
14381 ===aa===
14382 ====aaa====
14383 ==b==
14384 ===ba===
14385 ===bb===
14386 ====bba====
14387 ===bc===
14388 ==c==
14389 ===ca===
14390 !! html
14391 ===ba===
14392 !! end
14393
14394 !! test
14395 Section extraction test (section 6)
14396 !! options
14397 section=6
14398 !! wikitext
14399 start
14400 ==a==
14401 ===aa===
14402 ====aaa====
14403 ==b==
14404 ===ba===
14405 ===bb===
14406 ====bba====
14407 ===bc===
14408 ==c==
14409 ===ca===
14410 !! html
14411 ===bb===
14412 ====bba====
14413 !! end
14414
14415 !! test
14416 Section extraction test (section 7)
14417 !! options
14418 section=7
14419 !! wikitext
14420 start
14421 ==a==
14422 ===aa===
14423 ====aaa====
14424 ==b==
14425 ===ba===
14426 ===bb===
14427 ====bba====
14428 ===bc===
14429 ==c==
14430 ===ca===
14431 !! html
14432 ====bba====
14433 !! end
14434
14435 !! test
14436 Section extraction test (section 8)
14437 !! options
14438 section=8
14439 !! wikitext
14440 start
14441 ==a==
14442 ===aa===
14443 ====aaa====
14444 ==b==
14445 ===ba===
14446 ===bb===
14447 ====bba====
14448 ===bc===
14449 ==c==
14450 ===ca===
14451 !! html
14452 ===bc===
14453 !! end
14454
14455 !! test
14456 Section extraction test (section 9)
14457 !! options
14458 section=9
14459 !! wikitext
14460 start
14461 ==a==
14462 ===aa===
14463 ====aaa====
14464 ==b==
14465 ===ba===
14466 ===bb===
14467 ====bba====
14468 ===bc===
14469 ==c==
14470 ===ca===
14471 !! html
14472 ==c==
14473 ===ca===
14474 !! end
14475
14476 !! test
14477 Section extraction test (section 10)
14478 !! options
14479 section=10
14480 !! wikitext
14481 start
14482 ==a==
14483 ===aa===
14484 ====aaa====
14485 ==b==
14486 ===ba===
14487 ===bb===
14488 ====bba====
14489 ===bc===
14490 ==c==
14491 ===ca===
14492 !! html
14493 ===ca===
14494 !! end
14495
14496 !! test
14497 Section extraction test (nonexistent section 11)
14498 !! options
14499 section=11
14500 !! wikitext
14501 start
14502 ==a==
14503 ===aa===
14504 ====aaa====
14505 ==b==
14506 ===ba===
14507 ===bb===
14508 ====bba====
14509 ===bc===
14510 ==c==
14511 ===ca===
14512 !! html
14513 !! end
14514
14515 !! test
14516 Section extraction test with bogus heading (section 1)
14517 !! options
14518 section=1
14519 !! wikitext
14520 ==a==
14521 ==bogus== not a legal section
14522 ==b==
14523 !! html
14524 ==a==
14525 ==bogus== not a legal section
14526 !! end
14527
14528 !! test
14529 Section extraction test with bogus heading (section 2)
14530 !! options
14531 section=2
14532 !! wikitext
14533 ==a==
14534 ==bogus== not a legal section
14535 ==b==
14536 !! html
14537 ==b==
14538 !! end
14539
14540 !! test
14541 Section extraction test with comment after heading (section 1)
14542 !! options
14543 section=1
14544 !! wikitext
14545 ==a==
14546 ==b== <!-- -->
14547 ==c==
14548 !! html
14549 ==a==
14550 !! end
14551
14552 !! test
14553 Section extraction test with comment after heading (section 2)
14554 !! options
14555 section=2
14556 !! wikitext
14557 ==a==
14558 ==b== <!-- -->
14559 ==c==
14560 !! html
14561 ==b== <!-- -->
14562 !! end
14563
14564 !! test
14565 Section extraction test with bogus <nowiki> heading (section 1)
14566 !! options
14567 section=1
14568 !! wikitext
14569 ==a==
14570 ==bogus== <nowiki>not a legal section</nowiki>
14571 ==b==
14572 !! html
14573 ==a==
14574 ==bogus== <nowiki>not a legal section</nowiki>
14575 !! end
14576
14577 !! test
14578 Section extraction test with bogus <nowiki> heading (section 2)
14579 !! options
14580 section=2
14581 !! wikitext
14582 ==a==
14583 ==bogus== <nowiki>not a legal section</nowiki>
14584 ==b==
14585 !! html
14586 ==b==
14587 !! end
14588
14589
14590 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14591 # instead of respecting commented sections
14592 !! test
14593 Section extraction prefixed by comment (section 1)
14594 !! options
14595 section=1
14596 !! wikitext
14597 <!-- -->==sec1==
14598 ==sec2==
14599 !! html
14600 ==sec2==
14601 !!end
14602
14603 !! test
14604 Section extraction prefixed by comment (section 2)
14605 !! options
14606 section=2
14607 !! wikitext
14608 <!-- -->==sec1==
14609 ==sec2==
14610 !! html
14611
14612 !!end
14613
14614
14615 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14616 # instead of respecting HTML-style headings
14617 !! test
14618 Section extraction, mixed wiki and html (section 1)
14619 !! options
14620 section=1
14621 !! wikitext
14622 <h2>unmarked</h2>
14623 unmarked
14624 ==1==
14625 one
14626 ==2==
14627 two
14628 !! html
14629 ==1==
14630 one
14631 !! end
14632
14633 !! test
14634 Section extraction, mixed wiki and html (section 2)
14635 !! options
14636 section=2
14637 !! wikitext
14638 <h2>unmarked</h2>
14639 unmarked
14640 ==1==
14641 one
14642 ==2==
14643 two
14644 !! html
14645 ==2==
14646 two
14647 !! end
14648
14649
14650 # Formerly testing for bug 3342
14651 !! test
14652 Section extraction, heading surrounded by <noinclude>
14653 !! options
14654 section=1
14655 !! wikitext
14656 <noinclude>==unmarked==</noinclude>
14657 ==marked==
14658 !! html
14659 ==marked==
14660 !!end
14661
14662 # Test behavior of bug 19910
14663 !! test
14664 Sectiion with all-equals
14665 !! options
14666 section=2
14667 !! wikitext
14668 ===
14669 The line above must have a trailing space
14670 === <!--
14671 --> <!-- -->
14672 But just in case it doesn't...
14673 !! html
14674 === <!--
14675 --> <!-- -->
14676 But just in case it doesn't...
14677 !! end
14678
14679 !! test
14680 Section replacement test (section 0)
14681 !! options
14682 replace=0,"xxx"
14683 !! wikitext
14684 start
14685 ==a==
14686 ===aa===
14687 ====aaa====
14688 ==b==
14689 ===ba===
14690 ===bb===
14691 ====bba====
14692 ===bc===
14693 ==c==
14694 ===ca===
14695 !! html
14696 xxx
14697
14698 ==a==
14699 ===aa===
14700 ====aaa====
14701 ==b==
14702 ===ba===
14703 ===bb===
14704 ====bba====
14705 ===bc===
14706 ==c==
14707 ===ca===
14708 !! end
14709
14710 !! test
14711 Section replacement test (section 1)
14712 !! options
14713 replace=1,"xxx"
14714 !! wikitext
14715 start
14716 ==a==
14717 ===aa===
14718 ====aaa====
14719 ==b==
14720 ===ba===
14721 ===bb===
14722 ====bba====
14723 ===bc===
14724 ==c==
14725 ===ca===
14726 !! html
14727 start
14728 xxx
14729
14730 ==b==
14731 ===ba===
14732 ===bb===
14733 ====bba====
14734 ===bc===
14735 ==c==
14736 ===ca===
14737 !! end
14738
14739 !! test
14740 Section replacement test (section 2)
14741 !! options
14742 replace=2,"xxx"
14743 !! wikitext
14744 start
14745 ==a==
14746 ===aa===
14747 ====aaa====
14748 ==b==
14749 ===ba===
14750 ===bb===
14751 ====bba====
14752 ===bc===
14753 ==c==
14754 ===ca===
14755 !! html
14756 start
14757 ==a==
14758 xxx
14759
14760 ==b==
14761 ===ba===
14762 ===bb===
14763 ====bba====
14764 ===bc===
14765 ==c==
14766 ===ca===
14767 !! end
14768
14769 !! test
14770 Section replacement test (section 3)
14771 !! options
14772 replace=3,"xxx"
14773 !! wikitext
14774 start
14775 ==a==
14776 ===aa===
14777 ====aaa====
14778 ==b==
14779 ===ba===
14780 ===bb===
14781 ====bba====
14782 ===bc===
14783 ==c==
14784 ===ca===
14785 !! html
14786 start
14787 ==a==
14788 ===aa===
14789 xxx
14790
14791 ==b==
14792 ===ba===
14793 ===bb===
14794 ====bba====
14795 ===bc===
14796 ==c==
14797 ===ca===
14798 !! end
14799
14800 !! test
14801 Section replacement test (section 4)
14802 !! options
14803 replace=4,"xxx"
14804 !! wikitext
14805 start
14806 ==a==
14807 ===aa===
14808 ====aaa====
14809 ==b==
14810 ===ba===
14811 ===bb===
14812 ====bba====
14813 ===bc===
14814 ==c==
14815 ===ca===
14816 !! html
14817 start
14818 ==a==
14819 ===aa===
14820 ====aaa====
14821 xxx
14822
14823 ==c==
14824 ===ca===
14825 !! end
14826
14827 !! test
14828 Section replacement test (section 5)
14829 !! options
14830 replace=5,"xxx"
14831 !! wikitext
14832 start
14833 ==a==
14834 ===aa===
14835 ====aaa====
14836 ==b==
14837 ===ba===
14838 ===bb===
14839 ====bba====
14840 ===bc===
14841 ==c==
14842 ===ca===
14843 !! html
14844 start
14845 ==a==
14846 ===aa===
14847 ====aaa====
14848 ==b==
14849 xxx
14850
14851 ===bb===
14852 ====bba====
14853 ===bc===
14854 ==c==
14855 ===ca===
14856 !! end
14857
14858 !! test
14859 Section replacement test (section 6)
14860 !! options
14861 replace=6,"xxx"
14862 !! wikitext
14863 start
14864 ==a==
14865 ===aa===
14866 ====aaa====
14867 ==b==
14868 ===ba===
14869 ===bb===
14870 ====bba====
14871 ===bc===
14872 ==c==
14873 ===ca===
14874 !! html
14875 start
14876 ==a==
14877 ===aa===
14878 ====aaa====
14879 ==b==
14880 ===ba===
14881 xxx
14882
14883 ===bc===
14884 ==c==
14885 ===ca===
14886 !! end
14887
14888 !! test
14889 Section replacement test (section 7)
14890 !! options
14891 replace=7,"xxx"
14892 !! wikitext
14893 start
14894 ==a==
14895 ===aa===
14896 ====aaa====
14897 ==b==
14898 ===ba===
14899 ===bb===
14900 ====bba====
14901 ===bc===
14902 ==c==
14903 ===ca===
14904 !! html
14905 start
14906 ==a==
14907 ===aa===
14908 ====aaa====
14909 ==b==
14910 ===ba===
14911 ===bb===
14912 xxx
14913
14914 ===bc===
14915 ==c==
14916 ===ca===
14917 !! end
14918
14919 !! test
14920 Section replacement test (section 8)
14921 !! options
14922 replace=8,"xxx"
14923 !! wikitext
14924 start
14925 ==a==
14926 ===aa===
14927 ====aaa====
14928 ==b==
14929 ===ba===
14930 ===bb===
14931 ====bba====
14932 ===bc===
14933 ==c==
14934 ===ca===
14935 !! html
14936 start
14937 ==a==
14938 ===aa===
14939 ====aaa====
14940 ==b==
14941 ===ba===
14942 ===bb===
14943 ====bba====
14944 xxx
14945
14946 ==c==
14947 ===ca===
14948 !!end
14949
14950 !! test
14951 Section replacement test (section 9)
14952 !! options
14953 replace=9,"xxx"
14954 !! wikitext
14955 start
14956 ==a==
14957 ===aa===
14958 ====aaa====
14959 ==b==
14960 ===ba===
14961 ===bb===
14962 ====bba====
14963 ===bc===
14964 ==c==
14965 ===ca===
14966 !! html
14967 start
14968 ==a==
14969 ===aa===
14970 ====aaa====
14971 ==b==
14972 ===ba===
14973 ===bb===
14974 ====bba====
14975 ===bc===
14976 xxx
14977 !! end
14978
14979 !! test
14980 Section replacement test (section 10)
14981 !! options
14982 replace=10,"xxx"
14983 !! wikitext
14984 start
14985 ==a==
14986 ===aa===
14987 ====aaa====
14988 ==b==
14989 ===ba===
14990 ===bb===
14991 ====bba====
14992 ===bc===
14993 ==c==
14994 ===ca===
14995 !! html
14996 start
14997 ==a==
14998 ===aa===
14999 ====aaa====
15000 ==b==
15001 ===ba===
15002 ===bb===
15003 ====bba====
15004 ===bc===
15005 ==c==
15006 xxx
15007 !! end
15008
15009 !! test
15010 Section replacement test with initial whitespace (bug 13728)
15011 !! options
15012 replace=2,"xxx"
15013 !! wikitext
15014 Preformatted initial line
15015 ==a==
15016 ===a===
15017 !! html
15018 Preformatted initial line
15019 ==a==
15020 xxx
15021 !! end
15022
15023
15024 !! test
15025 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15026 !! options
15027 section=1
15028 !! wikitext
15029 ==a==
15030 a
15031 !! html
15032 ==a==
15033 a
15034 !! end
15035
15036 !! test
15037 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15038 !! options
15039 section=1
15040 !! wikitext
15041 ==a==
15042 a
15043 !! html
15044 ==a==
15045 a
15046 !! end
15047
15048
15049 !! test
15050 Section extraction, <pre> around bogus header (bug 10309)
15051 !! options
15052 noxml section=2
15053 !! wikitext
15054 == Section One ==
15055 <pre>
15056 =======
15057 </pre>
15058
15059 == Section Two ==
15060 stuff
15061 !! html
15062 == Section Two ==
15063 stuff
15064 !! end
15065
15066 !! test
15067 Section replacement, <pre> around bogus header (bug 10309)
15068 !! options
15069 noxml replace=2,"xxx"
15070 !! wikitext
15071 == Section One ==
15072 <pre>
15073 =======
15074 </pre>
15075
15076 == Section Two ==
15077 stuff
15078 !! html
15079 == Section One ==
15080 <pre>
15081 =======
15082 </pre>
15083
15084 xxx
15085 !! end
15086
15087
15088
15089 !! test
15090 Handling of &#x0A; in URLs
15091 !! wikitext
15092 ** irc://&#x0A;a
15093 !! html/php
15094 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15095
15096 !! html/parsoid
15097 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15098 a">irc://
15099 a</a></li></ul></li></ul>
15100 !! end
15101
15102 !! test
15103 Handling of %0A in URLs
15104 !! wikitext
15105 ** irc://%0Aa
15106 !! html/php
15107 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15108
15109 !! html/parsoid
15110 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15111 !! end
15112
15113
15114 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15115 !! test
15116 5 quotes, code coverage +1 line
15117 !! options
15118 parsoid=wt2html
15119 !! wikitext
15120 '''''
15121 !! html/php
15122 !! html/parsoid
15123 <p><b><i></i></b></p>
15124 !! end
15125
15126 # same html as previous, but wikitext adjusted to match parsoid html2wt
15127 # note that wt2html and html2html will put the <i> before the <b>
15128 !! test
15129 5 quotes, code coverage +1 line w/ nowiki (1)
15130 !! options
15131 parsoid=wt2wt,html2wt
15132 !! wikitext
15133 '''''<nowiki/>'''''
15134 !! html/php
15135 <p><i></i>
15136 </p>
15137 !! html/parsoid
15138 <p><b><i></i></b></p>
15139 !! end
15140
15141 # same as previous, just swapping the <i> and <b>
15142 !! test
15143 5 quotes, code coverage +1 line w/ nowiki (2)
15144 !! wikitext
15145 '''''<nowiki/>'''''
15146 !! html/php
15147 <p><i></i>
15148 </p>
15149 !! html/parsoid
15150 <p><i><b></b></i></p>
15151 !! end
15152
15153 !! test
15154 Special:Search page linking.
15155 !! wikitext
15156 {{Special:search}}
15157 !! html
15158 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15159 </p>
15160 !! end
15161
15162 !! test
15163 Say the magic word
15164 !! options
15165 title=[[Parser test]]
15166 !! wikitext
15167 * {{PAGENAME}}
15168 * {{PAGENAMEE}}
15169 * {{FULLPAGENAME}}
15170 * {{FULLPAGENAMEE}}
15171 * {{BASEPAGENAME}}
15172 * {{BASEPAGENAMEE}}
15173 * {{SUBPAGENAME}}
15174 * {{SUBPAGENAMEE}}
15175 * {{ROOTPAGENAME}}
15176 * {{ROOTPAGENAMEE}}
15177 * {{TALKPAGENAME}}
15178 * {{TALKPAGENAMEE}}
15179 * {{SUBJECTPAGENAME}}
15180 * {{SUBJECTPAGENAMEE}}
15181 * {{NAMESPACEE}}
15182 * {{NAMESPACE}}
15183 * {{NAMESPACENUMBER}}
15184 * {{TALKSPACE}}
15185 * {{TALKSPACEE}}
15186 * {{SUBJECTSPACE}}
15187 * {{SUBJECTSPACEE}}
15188 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15189 !! html
15190 <ul><li> Parser test</li>
15191 <li> Parser_test</li>
15192 <li> Parser test</li>
15193 <li> Parser_test</li>
15194 <li> Parser test</li>
15195 <li> Parser_test</li>
15196 <li> Parser test</li>
15197 <li> Parser_test</li>
15198 <li> Parser test</li>
15199 <li> Parser_test</li>
15200 <li> Talk:Parser test</li>
15201 <li> Talk:Parser_test</li>
15202 <li> Parser test</li>
15203 <li> Parser_test</li>
15204 <li> </li>
15205 <li> </li>
15206 <li> 0</li>
15207 <li> Talk</li>
15208 <li> Talk</li>
15209 <li> </li>
15210 <li> </li>
15211 <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>
15212
15213 !! end
15214 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15215
15216 !! test
15217 Gallery
15218 !! wikitext
15219 <gallery>
15220 image1.png |
15221 image2.gif|||||
15222
15223 image3|
15224 image4 |300px| centre
15225 image5.svg| http://///////
15226 [[x|xx]]]]
15227 * image6
15228 </gallery>
15229 !! html
15230 <ul class="gallery mw-gallery-traditional">
15231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15232 <div class="thumb" style="height: 150px;">Image1.png</div>
15233 <div class="gallerytext">
15234 </div>
15235 </div></li>
15236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15237 <div class="thumb" style="height: 150px;">Image2.gif</div>
15238 <div class="gallerytext">
15239 <p>||||
15240 </p>
15241 </div>
15242 </div></li>
15243 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15244 <div class="thumb" style="height: 150px;">Image3</div>
15245 <div class="gallerytext">
15246 </div>
15247 </div></li>
15248 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15249 <div class="thumb" style="height: 150px;">Image4</div>
15250 <div class="gallerytext">
15251 <p>300px| centre
15252 </p>
15253 </div>
15254 </div></li>
15255 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15256 <div class="thumb" style="height: 150px;">Image5.svg</div>
15257 <div class="gallerytext">
15258 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15259 </p>
15260 </div>
15261 </div></li>
15262 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15263 <div class="thumb" style="height: 150px;">* image6</div>
15264 <div class="gallerytext">
15265 </div>
15266 </div></li>
15267 </ul>
15268
15269 !! end
15270
15271 !! test
15272 Gallery (with options)
15273 !! wikitext
15274 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15275 File:Nonexistant.jpg|caption
15276 File:Nonexistant.jpg
15277 image:foobar.jpg|some '''caption''' [[Main Page]]
15278 image:foobar.jpg
15279 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15280 </gallery>
15281 !! html
15282 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15283 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15284 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15285 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15286 <div class="gallerytext">
15287 <p>caption
15288 </p>
15289 </div>
15290 </div></li>
15291 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15292 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15293 <div class="gallerytext">
15294 </div>
15295 </div></li>
15296 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15297 <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>
15298 <div class="gallerytext">
15299 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15300 </p>
15301 </div>
15302 </div></li>
15303 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15304 <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>
15305 <div class="gallerytext">
15306 </div>
15307 </div></li>
15308 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15309 <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>
15310 <div class="gallerytext">
15311 <p>Blabla|blabla.
15312 </p>
15313 </div>
15314 </div></li>
15315 </ul>
15316
15317 !! end
15318
15319 !! test
15320 Gallery with link that has fragment
15321 !! wikitext
15322 <gallery>
15323 image:foobar.jpg|link=Main_Page
15324 image:foobar.jpg|link=Main_Page#section
15325 image:foobar.jpg|link=Main Page#section|caption
15326 </gallery>
15327 !! html
15328 <ul class="gallery mw-gallery-traditional">
15329 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15330 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15331 <div class="gallerytext">
15332 </div>
15333 </div></li>
15334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15335 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15336 <div class="gallerytext">
15337 </div>
15338 </div></li>
15339 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15340 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15341 <div class="gallerytext">
15342 <p>caption
15343 </p>
15344 </div>
15345 </div></li>
15346 </ul>
15347
15348 !! end
15349
15350 !! test
15351 Gallery with wikitext inside caption
15352 !! wikitext
15353 <gallery>
15354 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15355 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15356 </gallery>
15357 !! html
15358 <ul class="gallery mw-gallery-traditional">
15359 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15360 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15361 <div class="gallerytext">
15362 <p><a href="/wiki/File:Foobar.jpg" 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>
15363 </p>
15364 </div>
15365 </div></li>
15366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15367 <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>
15368 <div class="gallerytext">
15369 <p>This is a test template
15370 </p>
15371 </div>
15372 </div></li>
15373 </ul>
15374
15375 !! end
15376
15377 !! test
15378 gallery (with showfilename option)
15379 !! wikitext
15380 <gallery showfilename>
15381 File:Nonexistant.jpg|caption
15382 File:Nonexistant.jpg
15383 image:foobar.jpg|some '''caption''' [[Main Page]]
15384 File:Foobar.jpg
15385 </gallery>
15386 !! html
15387 <ul class="gallery mw-gallery-traditional">
15388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15389 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15390 <div class="gallerytext">
15391 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15392 caption
15393 </p>
15394 </div>
15395 </div></li>
15396 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15397 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15398 <div class="gallerytext">
15399 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15400 </p>
15401 </div>
15402 </div></li>
15403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15404 <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>
15405 <div class="gallerytext">
15406 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15407 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15408 </p>
15409 </div>
15410 </div></li>
15411 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15412 <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>
15413 <div class="gallerytext">
15414 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15415 </p>
15416 </div>
15417 </div></li>
15418 </ul>
15419
15420 !! end
15421
15422 !! test
15423 Gallery (with namespace-less filenames)
15424 !! wikitext
15425 <gallery>
15426 File:Nonexistant.jpg
15427 Nonexistant.jpg
15428 image:foobar.jpg
15429 foobar.jpg
15430 </gallery>
15431 !! html
15432 <ul class="gallery mw-gallery-traditional">
15433 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15434 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15435 <div class="gallerytext">
15436 </div>
15437 </div></li>
15438 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15439 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15440 <div class="gallerytext">
15441 </div>
15442 </div></li>
15443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15444 <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>
15445 <div class="gallerytext">
15446 </div>
15447 </div></li>
15448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15449 <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>
15450 <div class="gallerytext">
15451 </div>
15452 </div></li>
15453 </ul>
15454
15455 !! end
15456
15457 !! test
15458 HTML Hex character encoding (spells the word "JavaScript")
15459 !! options
15460 parsoid=wt2html,wt2wt,html2html
15461 !! wikitext
15462 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15463 !! html/php
15464 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15465 </p>
15466 !! html/parsoid
15467 <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>
15468 !! end
15469
15470 !! test
15471 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15472 !! wikitext
15473 &#xsee;&#XSEE;
15474 !! html/php
15475 <p>&amp;#xsee;&amp;#XSEE;
15476 </p>
15477 !! html/parsoid
15478 <p>&amp;#xsee;&amp;#XSEE;</p>
15479 !! end
15480
15481 !! test
15482 HTML Hex character encoding mixed case
15483 !! options
15484 parsoid=wt2html,wt2wt,html2html
15485 !! wikitext
15486 &#xEE;&#Xee;
15487 !! html/php
15488 <p>&#xee;&#xee;
15489 </p>
15490 !! html/parsoid
15491 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15492 !! end
15493
15494 !! test
15495 __FORCETOC__ override
15496 !! wikitext
15497 __NEWSECTIONLINK__
15498 __FORCETOC__
15499 !! html
15500 <p><br />
15501 </p>
15502 !! end
15503
15504 !! test
15505 ISBN code coverage
15506 !! wikitext
15507 ISBN 978-0-1234-56&#x20;789
15508 !! html
15509 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15510 </p>
15511 !! end
15512
15513 !! test
15514 ISBN followed by 5 spaces
15515 !! wikitext
15516 ISBN
15517 !! html
15518 <p>ISBN
15519 </p>
15520 !! end
15521
15522 !! test
15523 Double ISBN
15524 !! wikitext
15525 ISBN ISBN 1234567890
15526 !! html
15527 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15528 </p>
15529 !! end
15530
15531 !! test
15532 ISBN with an X
15533 !! wikitext
15534 ISBN 3-462-04561-X
15535 !! html
15536 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15537 </p>
15538 !! end
15539
15540 !! test
15541 ISBN with empty prefix (parsoid test)
15542 !! wikitext
15543 ISBN 1234567890
15544 !! html/parsoid
15545 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15546 !! end
15547
15548 !! test
15549 Bug 22905: <abbr> followed by ISBN followed by </a>
15550 !! wikitext
15551 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15552 !! html
15553 <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>
15554 </p>
15555 !! end
15556
15557 !! test
15558 Double RFC
15559 !! wikitext
15560 RFC RFC 1234
15561 !! html
15562 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15563 </p>
15564 !! end
15565
15566 !! test
15567 Double RFC with a wiki link
15568 !! wikitext
15569 RFC [[RFC 1234]]
15570 !! html
15571 <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>
15572 </p>
15573 !! end
15574
15575 !! test
15576 RFC code coverage
15577 !! wikitext
15578 RFC 983&#x20;987
15579 !! html
15580 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15581 </p>
15582 !! end
15583
15584 !! test
15585 Centre-aligned image
15586 !! wikitext
15587 [[Image:foobar.jpg|centre]]
15588 !! html
15589 <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>
15590
15591 !!end
15592
15593 !! test
15594 None-aligned image
15595 !! wikitext
15596 [[Image:foobar.jpg|none]]
15597 !! html
15598 <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>
15599
15600 !!end
15601
15602 !! test
15603 Width + Height sized image (using px) (height is ignored)
15604 !! wikitext
15605 [[Image:foobar.jpg|640x480px]]
15606 !! html
15607 <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>
15608 </p>
15609 !!end
15610
15611 !! test
15612 Width-sized image (using px, no following whitespace)
15613 !! wikitext
15614 [[Image:foobar.jpg|640px]]
15615 !! html
15616 <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>
15617 </p>
15618 !!end
15619
15620 !! test
15621 Width-sized image (using px, with following whitespace - test regression from r39467)
15622 !! wikitext
15623 [[Image:foobar.jpg|640px ]]
15624 !! html
15625 <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>
15626 </p>
15627 !!end
15628
15629 !! test
15630 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15631 !! wikitext
15632 [[Image:foobar.jpg| 640px]]
15633 !! html
15634 <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>
15635 </p>
15636 !!end
15637
15638 !! test
15639 Image with page parameter
15640 !! options
15641 djvu
15642 !! wikitext
15643 [[File:LoremIpsum.djvu|page=2]]
15644 !! html
15645 <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>
15646 </p>
15647 !! end
15648
15649 !! test
15650 Another italics / bold test
15651 !! wikitext
15652 ''' ''x'
15653 !! html
15654 <pre>'<i> </i>x'
15655 </pre>
15656 !!end
15657
15658 # Note the results may be incorrect, as parserTest output included this:
15659 # XML error: Mismatched tag at byte 6120:
15660 # ...<dd> </dt></dl> </dd...
15661 !! test
15662 dt/dd/dl test
15663 !! options
15664 disabled
15665 !! wikitext
15666 :;;;::
15667 !! html
15668 <dl>
15669 <dd><dl>
15670 <dt><dl>
15671 <dt><dl>
15672 <dt><dl>
15673 <dd><dl>
15674 <dd>
15675 </dd>
15676 </dl>
15677 </dd>
15678 </dl>
15679 </dt>
15680 </dl>
15681 </dt>
15682 </dl>
15683 </dt>
15684 </dl>
15685 </dd>
15686 </dl>
15687
15688 !!end
15689
15690
15691 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15692 !! test
15693 Images with the "|" character in the comment
15694 !! wikitext
15695 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15696 !! html/php
15697 <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>
15698
15699 !! html/parsoid
15700 <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>
15701 !! end
15702
15703 !! test
15704 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15705 !! wikitext
15706 <html><script>alert(1);</script></html>
15707 !! html
15708 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15709 </p>
15710 !! end
15711
15712 !! test
15713 HTML with raw HTML ($wgRawHtml==true)
15714 !! options
15715 wgRawHtml=1
15716 !! wikitext
15717 <html><script>alert(1);</script></html>
15718 !! html
15719 <p><script>alert(1);</script>
15720 </p>
15721 !! end
15722
15723 !! test
15724 Parents of subpages, one level up
15725 !! options
15726 subpage title=[[Subpage test/L1/L2/L3]]
15727 !! wikitext
15728 [[../|L2]]
15729 !! html
15730 <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>
15731 </p>
15732 !! end
15733
15734
15735 !! test
15736 Parents of subpages, one level up, not named
15737 !! options
15738 subpage title=[[Subpage test/L1/L2/L3]]
15739 !! wikitext
15740 [[../]]
15741 !! html
15742 <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>
15743 </p>
15744 !! end
15745
15746
15747
15748 !! test
15749 Parents of subpages, two levels up
15750 !! options
15751 subpage title=[[Subpage test/L1/L2/L3]]
15752 !! wikitext
15753 [[../../|L1]]2
15754
15755 [[../../|L1]]l
15756 !! html
15757 <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
15758 </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>
15759 </p>
15760 !! end
15761
15762 !! test
15763 Parents of subpages, two levels up, without trailing slash or name.
15764 !! options
15765 subpage title=[[Subpage test/L1/L2/L3]]
15766 !! wikitext
15767 [[../..]]
15768 !! html
15769 <p>[[../..]]
15770 </p>
15771 !! end
15772
15773 !! test
15774 Parents of subpages, two levels up, with lots of extra trailing slashes.
15775 !! options
15776 subpage title=[[Subpage test/L1/L2/L3]]
15777 !! wikitext
15778 [[../../////]]
15779 !! html
15780 <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>
15781 </p>
15782 !! end
15783
15784 !! article
15785 Subpage test/L1/L2/L3Sibling
15786 !! text
15787 Sibling article
15788 !! endarticle
15789
15790 !! test
15791 Transclusion of a sibling page (one level up)
15792 !! options
15793 subpage title=[[Subpage test/L1/L2/L3]]
15794 !! wikitext
15795 {{../L3Sibling}}
15796 !! html
15797 <p>Sibling article
15798 </p>
15799 !! end
15800
15801 !! test
15802 Transclusion of a child page
15803 !! options
15804 subpage title=[[Subpage test/L1/L2]]
15805 !! wikitext
15806 {{/L3Sibling}}
15807 !! html
15808 <p>Sibling article
15809 </p>
15810 !! end
15811
15812 !! test
15813 Non-transclusion because of too many up levels
15814 !! options
15815 subpage title=[[Subpage test/L1/L2/L3]]
15816 !! wikitext
15817 {{../../../../More than parent}}
15818 !! html
15819 <p>{{../../../../More than parent}}
15820 </p>
15821 !! end
15822
15823 !! test
15824 Definition list code coverage
15825 !! wikitext
15826 ; title : def
15827 ; title : def
15828 ;title: def
15829 !! html
15830 <dl><dt> title &#160;</dt>
15831 <dd> def</dd>
15832 <dt> title&#160;</dt>
15833 <dd> def</dd>
15834 <dt>title</dt>
15835 <dd> def</dd></dl>
15836
15837 !! end
15838
15839 !! test
15840 Don't fall for the self-closing div
15841 !! wikitext
15842 <div>hello world</div/>
15843 !! html
15844 <div>hello world</div>
15845
15846 !! end
15847
15848 !! test
15849 MSGNW magic word
15850 !! wikitext
15851 {{MSGNW:msg}}
15852 !! html
15853 <p>&#91;&#91;:Template:Msg&#93;&#93;
15854 </p>
15855 !! end
15856
15857 !! test
15858 RAW magic word
15859 !! wikitext
15860 {{RAW:QUERTY}}
15861 !! html
15862 <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>
15863 </p>
15864 !! end
15865
15866 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15867 !! test
15868 Always escape literal '>' in output, not just after '<'
15869 !! wikitext
15870 ><>
15871 !! html
15872 <p>&gt;&lt;&gt;
15873 </p>
15874 !! end
15875
15876 !! test
15877 Template caching
15878 !! wikitext
15879 {{Test}}
15880 {{Test}}
15881 !! html
15882 <p>This is a test template
15883 This is a test template
15884 </p>
15885 !! end
15886
15887
15888 !! article
15889 MediaWiki:Fake
15890 !! text
15891 ==header==
15892 !! endarticle
15893
15894 !! test
15895 Inclusion of !userCanEdit() content
15896 !! wikitext
15897 {{MediaWiki:Fake}}
15898 !! html
15899 <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>
15900
15901 !! end
15902
15903
15904 !! test
15905 Out-of-order TOC heading levels
15906 !! wikitext
15907 ==2==
15908 ======6======
15909 ===3===
15910 =1=
15911 =====5=====
15912 ==2==
15913 !! html
15914 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15915 <ul>
15916 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15917 <ul>
15918 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15919 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15920 </ul>
15921 </li>
15922 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15923 <ul>
15924 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15925 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15926 </ul>
15927 </li>
15928 </ul>
15929 </div>
15930
15931 <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>
15932 <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>
15933 <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>
15934 <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>
15935 <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>
15936 <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>
15937
15938 !! end
15939
15940
15941 !! test
15942 ISBN with a dummy number
15943 !! wikitext
15944 ISBN ---
15945 !! html
15946 <p>ISBN ---
15947 </p>
15948 !! end
15949
15950
15951 !! test
15952 ISBN with space-delimited number
15953 !! wikitext
15954 ISBN 92 9017 032 8
15955 !! html
15956 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15957 </p>
15958 !! end
15959
15960
15961 !! test
15962 ISBN with multiple spaces, no number
15963 !! wikitext
15964 ISBN foo
15965 !! html
15966 <p>ISBN foo
15967 </p>
15968 !! end
15969
15970
15971 !! test
15972 ISBN length
15973 !! wikitext
15974 ISBN 123456789
15975
15976 ISBN 1234567890
15977
15978 ISBN 12345678901
15979 !! html
15980 <p>ISBN 123456789
15981 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15982 </p><p>ISBN 12345678901
15983 </p>
15984 !! end
15985
15986
15987 !! test
15988 ISBN with trailing year (bug 8110)
15989 !! wikitext
15990 ISBN 1-234-56789-0 - 2006
15991
15992 ISBN 1 234 56789 0 - 2006
15993 !! html
15994 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15995 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15996 </p>
15997 !! end
15998
15999
16000 !! test
16001 anchorencode
16002 !! wikitext
16003 {{anchorencode:foo bar©#%n}}
16004 !! html
16005 <p>foo_bar.C2.A9.23.25n
16006 </p>
16007 !! end
16008
16009 !! test
16010 anchorencode trims spaces
16011 !! wikitext
16012 {{anchorencode: __pretty__please__}}
16013 !! html
16014 <p>pretty_please
16015 </p>
16016 !! end
16017
16018 !! test
16019 anchorencode deals with links
16020 !! wikitext
16021 {{anchorencode: [[hello|world]] [[hi]]}}
16022 !! html
16023 <p>world_hi
16024 </p>
16025 !! end
16026
16027 !! test
16028 anchorencode deals with templates
16029 !! wikitext
16030 {{anchorencode: {{Foo}} }}
16031 !! html
16032 <p>FOO
16033 </p>
16034 !! end
16035
16036 !! test
16037 anchorencode encodes like the TOC generator: (bug 18431)
16038 !! wikitext
16039 === _ +:.3A%3A&&amp;]] ===
16040 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16041 __NOEDITSECTION__
16042 !! html
16043 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16044 <p>.2B:.3A.253A.26.26.5D.5D
16045 </p>
16046 !! end
16047
16048 !! test
16049 Bug 6200: blockquotes and paragraph formatting
16050 !! wikitext
16051 <blockquote>
16052 foo
16053 </blockquote>
16054
16055 bar
16056
16057 baz
16058 !! html
16059 <blockquote>
16060 <p>foo
16061 </p>
16062 </blockquote>
16063 <p>bar
16064 </p>
16065 <pre>baz
16066 </pre>
16067 !! end
16068
16069 !! test
16070 Bug 8293: Use of center tag ruins paragraph formatting
16071 !! wikitext
16072 <center>
16073 foo
16074 </center>
16075
16076 bar
16077
16078 baz
16079 !! html
16080 <center>
16081 <p>foo
16082 </p>
16083 </center>
16084 <p>bar
16085 </p>
16086 <pre>baz
16087 </pre>
16088 !! end
16089
16090 !!test
16091 Parsing of overlapping (improperly nested) inline html tags
16092 !! wikitext
16093 <span><s>x</span></s>
16094 !! html/php
16095 <p><span><s>x&lt;/span&gt;</s></span>
16096 </p>
16097 !! html/parsoid
16098 <p><span><s>x</s></span>
16099 </p>
16100 !!end
16101
16102 ###
16103 ### Language variants related tests
16104 ###
16105 !! test
16106 Self-link in language variants
16107 !! options
16108 title=[[Dunav]] language=sr
16109 !! wikitext
16110 Both [[Dunav]] and [[Дунав]] are names for this river.
16111 !! html
16112 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16113 </p>
16114 !!end
16115
16116 !! article
16117 Дуна
16118 !! text
16119 content
16120 !! endarticle
16121
16122 !! test
16123 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16124 !! options
16125 title=[[Duna]] language=sr
16126 !! wikitext
16127 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16128 !! html
16129 <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.
16130 </p>
16131 !! end
16132
16133 !! test
16134 Link to a section of a variant of this title shouldn't be parsed as self-link
16135 !! options
16136 title=[[Duna]] language=sr
16137 !! wikitext
16138 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16139 !! html
16140 <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.
16141 </p>
16142 !! end
16143
16144 !! test
16145 Link to pages in language variants
16146 !! options
16147 language=sr
16148 !! wikitext
16149 Main Page can be written as [[Маин Паге]]
16150 !! html
16151 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16152 </p>
16153 !!end
16154
16155
16156 !! test
16157 Multiple links to pages in language variants
16158 !! options
16159 language=sr
16160 !! wikitext
16161 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16162 !! html
16163 <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>.
16164 </p>
16165 !!end
16166
16167
16168 !! test
16169 Simple template in language variants
16170 !! options
16171 language=sr
16172 !! wikitext
16173 {{тест}}
16174 !! html
16175 <p>This is a test template
16176 </p>
16177 !! end
16178
16179
16180 !! test
16181 Template with explicit namespace in language variants
16182 !! options
16183 language=sr
16184 !! wikitext
16185 {{Template:тест}}
16186 !! html
16187 <p>This is a test template
16188 </p>
16189 !! end
16190
16191
16192 !! test
16193 Basic test for template parameter in language variants
16194 !! options
16195 language=sr
16196 !! wikitext
16197 {{парамтест|param=foo}}
16198 !! html
16199 <p>This is a test template with parameter foo
16200 </p>
16201 !! end
16202
16203
16204 !! test
16205 Simple category in language variants
16206 !! options
16207 language=sr cat
16208 !! wikitext
16209 [[Category:МедиаWики Усер'с Гуиде]]
16210 !! html
16211 <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>
16212 !! end
16213
16214
16215 !! article
16216 Category:分类
16217 !! text
16218 blah
16219 !! endarticle
16220
16221 !! article
16222 Category:分類
16223 !! text
16224 blah
16225 !! endarticle
16226
16227 !! test
16228 Don't convert blue categorylinks to another variant (bug 33210)
16229 !! options
16230 language=zh cat
16231 !! wikitext
16232 [[A]][[Category:分类]]
16233 !! html
16234 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16235 !! end
16236
16237
16238 !! test
16239 Stripping -{}- tags (language variants)
16240 !! options
16241 language=sr
16242 !! wikitext
16243 Latin proverb: -{Ne nuntium necare}-
16244 !! html
16245 <p>Latin proverb: Ne nuntium necare
16246 </p>
16247 !! end
16248
16249
16250 !! test
16251 Prevent conversion with -{}- tags (language variants)
16252 !! options
16253 language=sr variant=sr-ec
16254 !! wikitext
16255 Latinski: -{Ne nuntium necare}-
16256 !! html
16257 <p>Латински: Ne nuntium necare
16258 </p>
16259 !! end
16260
16261
16262 !! test
16263 Prevent conversion of text with -{}- tags (language variants)
16264 !! options
16265 language=sr variant=sr-ec
16266 !! wikitext
16267 Latinski: -{Ne nuntium necare}-
16268 !! html
16269 <p>Латински: Ne nuntium necare
16270 </p>
16271 !! end
16272
16273
16274 !! test
16275 Prevent conversion of links with -{}- tags (language variants)
16276 !! options
16277 language=sr variant=sr-ec
16278 !! wikitext
16279 -{[[Main Page]]}-
16280 !! html
16281 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16282 </p>
16283 !! end
16284
16285
16286 !! test
16287 -{}- tags within headlines (within html for parserConvert())
16288 !! options
16289 language=sr variant=sr-ec
16290 !! wikitext
16291 == -{Naslov}- ==
16292 !! html
16293 <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>
16294
16295 !! end
16296
16297
16298 !! test
16299 Explicit definition of language variant alternatives
16300 !! options
16301 language=zh variant=zh-tw
16302 !! wikitext
16303 -{zh:China;zh-tw:Taiwan}-, not China
16304 !! html
16305 <p>Taiwan, not China
16306 </p>
16307 !! end
16308
16309
16310 !! test
16311 Conversion around HTML tags
16312 !! options
16313 language=sr variant=sr-ec
16314 !! wikitext
16315 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16316 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16317 !! html
16318 <p>
16319 <span title="ЛаCтин">ски</span>
16320 </p>
16321 !! end
16322
16323
16324 !! test
16325 Explicit session-wise language variant mapping (A flag and - flag)
16326 !! options
16327 language=zh variant=zh-tw
16328 !! wikitext
16329 Taiwan is not China.
16330 But -{A|zh:China;zh-tw:Taiwan}- is China,
16331 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16332 and -{China}- is China.
16333 !! html
16334 <p>Taiwan is not China.
16335 But Taiwan is Taiwan,
16336 (This should be stripped!)
16337 and China is China.
16338 </p>
16339 !! end
16340
16341 !! test
16342 Explicit session-wise language variant mapping (H flag for hide)
16343 !! options
16344 language=zh variant=zh-tw
16345 !! wikitext
16346 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16347 Taiwan is China.
16348 !! html
16349 <p>(This should be stripped!)
16350 Taiwan is Taiwan.
16351 </p>
16352 !! end
16353
16354 !! test
16355 Adding explicit conversion rule for title (T flag)
16356 !! options
16357 language=zh variant=zh-tw showtitle
16358 !! wikitext
16359 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16360 !! html
16361 Taiwan
16362 <p>Should be stripped!
16363 </p>
16364 !! end
16365
16366 !! test
16367 Testing that changing the language variant here in the tests actually works
16368 !! options
16369 language=zh variant=zh showtitle
16370 !! wikitext
16371 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16372 !! html
16373 China
16374 <p>Should be stripped!
16375 </p>
16376 !! end
16377
16378 !! test
16379 Recursive conversion of alt and title attrs shouldn't clear converter state
16380 !! options
16381 language=zh variant=zh-cn showtitle
16382 !! wikitext
16383 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16384 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16385 !! html
16386 China
16387 <p>
16388 Should be stripped<span title="Exclamation">!</span>
16389 </p>
16390 !! end
16391
16392 !! test
16393 Bug 24072: more test on conversion rule for title
16394 !! options
16395 language=zh variant=zh-tw showtitle
16396 !! wikitext
16397 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16398 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16399 !! html
16400 Taiwan
16401 <p>This should be stripped!
16402 This won't take interferes with the title rule.
16403 </p>
16404 !! end
16405
16406 !! test
16407 Partly disable title conversion if variant == main language code
16408 !! options
16409 language=zh variant=zh title=[[ZH]] showtitle
16410 !! wikitext
16411 -{T|zh-cn:CN;zh-tw:TW}-
16412 !! html
16413 ZH
16414 <p>
16415 </p>
16416 !! end
16417
16418 !! test
16419 Partly disable title conversion if variant == main language code, more
16420 !! options
16421 language=zh variant=zh title=[[ZH]] showtitle
16422 !! wikitext
16423 -{T|TW}-
16424 !! html
16425 ZH
16426 <p>
16427 </p>
16428 !! end
16429
16430 !! test
16431 Raw output of variant escape tags (R flag)
16432 !! options
16433 language=zh variant=zh-tw
16434 !! wikitext
16435 Raw: -{R|zh:China;zh-tw:Taiwan}-
16436 !! html
16437 <p>Raw: zh:China;zh-tw:Taiwan
16438 </p>
16439 !! end
16440
16441 !! test
16442 Nested using of manual convert syntax
16443 !! options
16444 language=zh variant=zh-hk
16445 !! wikitext
16446 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16447 !! html
16448 <p>Nested: Hello Hong Kong!
16449 </p>
16450 !! end
16451
16452 !! test
16453 Proper conversion of text in external links
16454 !! options
16455 language=sr variant=sr-ec
16456 !! wikitext
16457 http://www.google.com
16458 gopher://www.google.com
16459 [http://www.google.com http://www.google.com]
16460 [gopher://www.google.com gopher://www.google.com]
16461 [https://www.google.com irc://www.google.com]
16462 [ftp://www.google.com www.google.com/ftp://dir]
16463 [//www.google.com www.google.com]
16464 !! html
16465 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16466 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16467 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16468 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16469 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16470 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16471 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16472 </p>
16473 !! end
16474
16475 !! test
16476 Do not convert roman numbers to language variants
16477 !! options
16478 language=sr variant=sr-ec
16479 !! wikitext
16480 Fridrih IV je car.
16481 !! html
16482 <p>Фридрих IV је цар.
16483 </p>
16484 !! end
16485
16486 !! test
16487 Unclosed language converter markup "-{"
16488 !! options
16489 language=sr
16490 !! wikitext
16491 -{T|hello
16492 !! html
16493 <p>-{T|hello
16494 </p>
16495 !! end
16496
16497 !! test
16498 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16499 !! options
16500 language=sr
16501 !! wikitext
16502 -{R|=&gt;}-
16503 !! html
16504 <p>=&gt;
16505 </p>
16506 !!end
16507
16508 !! test
16509 Don't break link parsing if language converter markup is in the caption.
16510 !! options
16511 language=sr variant=sr-ec
16512 !! wikitext
16513 [[Main Page|-{R|main page}-]]
16514 !! html
16515 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16516 </p>
16517 !! end
16518
16519 # This test is currently broken in the PHP parser (bug 52661)
16520 !! test
16521 Don't break image parsing if language converter markup is in the caption.
16522 !! options
16523 language=sr
16524 disabled
16525 !! wikitext
16526 [[File:Foobar.jpg|-{R|caption}-]]
16527 !! html
16528 <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>
16529 </p>
16530 !! end
16531
16532 # This test is currently broken in the PHP parser (bug 52661)
16533 !! test
16534 Don't break list handling if language converter markup is in the item.
16535 !! options
16536 language=zh variant=zh-cn
16537 disabled
16538 !! wikitext
16539 ;-{zh-cn:AAA;zh-tw:BBB}-
16540 !! html
16541 <dl><dt>AAA
16542 </dt></dl>
16543
16544 !! end
16545
16546 # This test is currently broken in the PHP parser (bug 52661)
16547 !! test
16548 Don't break table handling if language converter markup is in the cell.
16549 !! options
16550 language=sr variant=sr-ec
16551 disabled
16552 !! wikitext
16553 {|
16554 |-
16555 | -{R|B}-
16556 |}
16557 !! html
16558 <table>
16559
16560 <tr>
16561 <td> B
16562 </td></tr></table>
16563
16564 !! end
16565
16566 !! test
16567 Bug 529: Uncovered bullet
16568 !! wikitext
16569 * Foo {{bullet}}
16570 !! html
16571 <ul><li> Foo </li>
16572 <li> Bar</li></ul>
16573
16574 !! end
16575
16576 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16577 # Templates in Wikipedia rely on this behavior, as tidy has always been
16578 # enabled there. These tests are normally run *without* tidy, so specify the
16579 # full output here.
16580 # To test realistic parsing behavior, apply a tidy-like transformation to both
16581 # the expected output and your parser's output.
16582 !! test
16583 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16584 !! wikitext
16585 ******* Foo {{bullet}}
16586 !! html
16587 <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>
16588 <li> Bar</li></ul>
16589
16590 !! end
16591
16592 !! test
16593 Bug 529: Uncovered table already at line-start
16594 !! wikitext
16595 x
16596
16597 {{table}}
16598 y
16599 !! html
16600 <p>x
16601 </p>
16602 <table>
16603 <tr>
16604 <td> 1 </td>
16605 <td> 2
16606 </td></tr>
16607 <tr>
16608 <td> 3 </td>
16609 <td> 4
16610 </td></tr></table>
16611 <p>y
16612 </p>
16613 !! end
16614
16615 !! test
16616 Bug 529: Uncovered bullet in parser function result
16617 !! wikitext
16618 * Foo {{lc:{{bullet}} }}
16619 !! html
16620 <ul><li> Foo </li>
16621 <li> bar</li></ul>
16622
16623 !! end
16624
16625 !! test
16626 Bug 5678: Double-parsed template argument
16627 !! wikitext
16628 {{lc:{{{1}}}|hello}}
16629 !! html
16630 <p>{{{1}}}
16631 </p>
16632 !! end
16633
16634 !! test
16635 Bug 5678: Double-parsed template invocation
16636 !! wikitext
16637 {{lc:{{paramtest {{!}} param = hello }} }}
16638 !! html
16639 <p>{{paramtest | param = hello }}
16640 </p>
16641 !! end
16642
16643 !! test
16644 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16645 !! options
16646 language=cs
16647 title=[[Main Page]]
16648 !! wikitext
16649 {{PRVNÍVELKÉ:ěščř}}
16650 {{prvnívelké:ěščř}}
16651 {{PRVNÍMALÉ:ěščř}}
16652 {{prvnímalé:ěščř}}
16653 {{MALÁ:ěščř}}
16654 {{malá:ěščř}}
16655 {{VELKÁ:ěščř}}
16656 {{velká:ěščř}}
16657 !! html
16658 <p>Ěščř
16659 Ěščř
16660 ěščř
16661 ěščř
16662 ěščř
16663 ěščř
16664 ĚŠČŘ
16665 ĚŠČŘ
16666 </p>
16667 !! end
16668
16669 !! test
16670 Morwen/13: Unclosed link followed by heading
16671 !! wikitext
16672 [[link
16673 ==heading==
16674 !! html
16675 <p>[[link
16676 </p>
16677 <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>
16678
16679 !! end
16680
16681 !! test
16682 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16683 !! wikitext
16684 {{foo|
16685 =heading=
16686 !! html
16687 <p>{{foo|
16688 </p>
16689 <h1><span class="mw-headline" id="heading">heading</span></h1>
16690
16691 !! end
16692
16693 !! test
16694 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16695 !! wikitext
16696 {{foo|
16697 ==heading==
16698 !! html
16699 <p>{{foo|
16700 </p>
16701 <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>
16702
16703 !! end
16704
16705 !! test
16706 Tildes in comments
16707 !! options
16708 pst
16709 !! wikitext
16710 <!-- ~~~~ -->
16711 !! html
16712 <!-- ~~~~ -->
16713 !! end
16714
16715 !! test
16716 Paragraphs inside divs (no extra line breaks)
16717 !! wikitext
16718 <div>Line one
16719
16720 Line two</div>
16721 !! html
16722 <div>Line one
16723 Line two</div>
16724
16725 !! end
16726
16727 !! test
16728 Paragraphs inside divs (extra line break on open)
16729 !! wikitext
16730 <div>
16731 Line one
16732
16733 Line two</div>
16734 !! html
16735 <div>
16736 <p>Line one
16737 </p>
16738 Line two</div>
16739
16740 !! end
16741
16742 !! test
16743 Paragraphs inside divs (extra line break on close)
16744 !! wikitext
16745 <div>Line one
16746
16747 Line two
16748 </div>
16749 !! html
16750 <div>Line one
16751 <p>Line two
16752 </p>
16753 </div>
16754
16755 !! end
16756
16757 !! test
16758 Paragraphs inside divs (extra line break on open and close)
16759 !! wikitext
16760 <div>
16761 Line one
16762
16763 Line two
16764 </div>
16765 !! html
16766 <div>
16767 <p>Line one
16768 </p><p>Line two
16769 </p>
16770 </div>
16771
16772 !! end
16773
16774 !! test
16775 Nesting tags, paragraphs on lines which begin with <div>
16776 !! options
16777 disabled
16778 !! wikitext
16779 <div></div><strong>A
16780 B</strong>
16781 !! html
16782 <div></div>
16783 <p><strong>A
16784 B</strong>
16785 </p>
16786 !! end
16787
16788 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16789 !! test
16790 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16791 !! wikitext
16792 <blockquote>Line one
16793
16794 Line two</blockquote>
16795 !! html
16796 <blockquote>Line one
16797 Line two</blockquote>
16798
16799 !! end
16800
16801 !! test
16802 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16803 !! wikitext
16804 <blockquote>
16805 Line one
16806
16807 Line two</blockquote>
16808 !! html
16809 <blockquote>
16810 <p>Line one
16811 </p>
16812 Line two</blockquote>
16813
16814 !! end
16815
16816 !! test
16817 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16818 !! wikitext
16819 <blockquote>Line one
16820
16821 Line two
16822 </blockquote>
16823 !! html
16824 <blockquote>Line one
16825 <p>Line two
16826 </p>
16827 </blockquote>
16828
16829 !! end
16830
16831 !! test
16832 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16833 !! wikitext
16834 <blockquote>
16835 Line one
16836
16837 Line two
16838 </blockquote>
16839 !! html
16840 <blockquote>
16841 <p>Line one
16842 </p><p>Line two
16843 </p>
16844 </blockquote>
16845
16846 !! end
16847
16848 !! test
16849 Paragraphs inside blockquotes/divs (no extra line breaks)
16850 !! wikitext
16851 <blockquote><div>Line one
16852
16853 Line two</div></blockquote>
16854 !! html
16855 <blockquote><div>Line one
16856 Line two</div></blockquote>
16857
16858 !! end
16859
16860 !! test
16861 Paragraphs inside blockquotes/divs (extra line break on open)
16862 !! wikitext
16863 <blockquote><div>
16864 Line one
16865
16866 Line two</div></blockquote>
16867 !! html
16868 <blockquote><div>
16869 <p>Line one
16870 </p>
16871 Line two</div></blockquote>
16872
16873 !! end
16874
16875 !! test
16876 Paragraphs inside blockquotes/divs (extra line break on close)
16877 !! wikitext
16878 <blockquote><div>Line one
16879
16880 Line two
16881 </div></blockquote>
16882 !! html
16883 <blockquote><div>Line one
16884 <p>Line two
16885 </p>
16886 </div></blockquote>
16887
16888 !! end
16889
16890 !! test
16891 Paragraphs inside blockquotes/divs (extra line break on open and close)
16892 !! wikitext
16893 <blockquote><div>
16894 Line one
16895
16896 Line two
16897 </div></blockquote>
16898 !! html
16899 <blockquote><div>
16900 <p>Line one
16901 </p><p>Line two
16902 </p>
16903 </div></blockquote>
16904
16905 !! end
16906
16907 !! test
16908 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16909 !! options
16910 wgLinkHolderBatchSize=0
16911 !! wikitext
16912 [[meatball:1]]
16913 [[meatball:2]]
16914 [[meatball:3]]
16915 !! html
16916 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16917 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16918 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16919 </p>
16920 !! end
16921
16922 !! test
16923 Free external link invading image caption
16924 !! wikitext
16925 [[Image:Foobar.jpg|thumb|http://x|hello]]
16926 !! html
16927 <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>
16928
16929 !! end
16930
16931 !! test
16932 Bug 15196: localised external link numbers
16933 !! options
16934 language=fa
16935 !! wikitext
16936 [http://en.wikipedia.org/]
16937 !! html/php
16938 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16939 </p>
16940 !! html/parsoid
16941 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16942 !! end
16943
16944 !! test
16945 Multibyte character in padleft
16946 !! wikitext
16947 {{padleft:-Hello|7|Æ}}
16948 !! html
16949 <p>Æ-Hello
16950 </p>
16951 !! end
16952
16953 !! test
16954 Multibyte character in padright
16955 !! wikitext
16956 {{padright:Hello-|7|Æ}}
16957 !! html
16958 <p>Hello-Æ
16959 </p>
16960 !! end
16961
16962 !!test
16963 formatdate parser function
16964 !! wikitext
16965 {{#formatdate:2009-03-24}}
16966 !! html
16967 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16968 </p>
16969 !! end
16970
16971 !!test
16972 formatdate parser function, with default format
16973 !! wikitext
16974 {{#formatdate:2009-03-24|mdy}}
16975 !! html
16976 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16977 </p>
16978 !! end
16979
16980 !! test
16981 Spacing of numbers in formatted dates
16982 !! wikitext
16983 {{#formatdate:January 15}}
16984 !! html
16985 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16986 </p>
16987 !! end
16988
16989 !! test
16990 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
16991 !! options
16992 language=nl title=[[MediaWiki:Common.css]]
16993 !! wikitext
16994 {{#formatdate:2009-03-24|dmy}}
16995 !! html
16996 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16997 </p>
16998 !! end
16999
17000 #
17001 #
17002 #
17003
17004 #
17005 # Edit comments
17006 #
17007
17008 !! test
17009 Edit comment with link
17010 !! options
17011 comment
17012 !! wikitext
17013 I like the [[Main Page]] a lot
17014 !! html
17015 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17016 !!end
17017
17018 !! test
17019 Edit comment with link and link text
17020 !! options
17021 comment
17022 !! wikitext
17023 I like the [[Main Page|best pages]] a lot
17024 !! html
17025 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17026 !!end
17027
17028 !! test
17029 Edit comment with link and link text with suffix
17030 !! options
17031 comment
17032 !! wikitext
17033 I like the [[Main Page|best page]]s a lot
17034 !! html
17035 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17036 !!end
17037
17038 !! test
17039 Edit comment with section link (non-local, eg in history list)
17040 !! options
17041 comment title=[[Main Page]]
17042 !! wikitext
17043 /* External links */ removed bogus entries
17044 !! html
17045 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17046 !!end
17047
17048 !! test
17049 Edit comment with section link and text before it (non-local, eg in history list)
17050 !! options
17051 comment title=[[Main Page]]
17052 !! wikitext
17053 pre-comment text /* External links */ removed bogus entries
17054 !! html
17055 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>
17056 !!end
17057
17058 !! test
17059 Edit comment with section link (local, eg in diff view)
17060 !! options
17061 comment local title=[[Main Page]]
17062 !! wikitext
17063 /* External links */ removed bogus entries
17064 !! html
17065 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17066 !!end
17067
17068 !! test
17069 Edit comment with subpage link (bug 14080)
17070 !! options
17071 comment
17072 subpage
17073 title=[[Subpage test]]
17074 !! wikitext
17075 Poked at a [[/subpage]] here...
17076 !! html
17077 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17078 !!end
17079
17080 !! test
17081 Edit comment with subpage link and link text (bug 14080)
17082 !! options
17083 comment
17084 subpage
17085 title=[[Subpage test]]
17086 !! wikitext
17087 Poked at a [[/subpage|neat little page]] here...
17088 !! html
17089 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17090 !!end
17091
17092 !! test
17093 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17094 !! options
17095 comment
17096 title=[[Subpage test]]
17097 !! wikitext
17098 Poked at a [[/subpage]] here...
17099 !! html
17100 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...
17101 !!end
17102
17103 !! test
17104 Edit comment with bare anchor link (local, as on diff)
17105 !! options
17106 comment
17107 local
17108 title=[[Main Page]]
17109 !! wikitext
17110 [[#section]]
17111 !! html
17112 <a href="#section">#section</a>
17113 !! end
17114
17115 !! test
17116 Edit comment with bare anchor link (non-local, as on history)
17117 !! options
17118 comment
17119 title=[[Main Page]]
17120 !! wikitext
17121 [[#section]]
17122 !! html
17123 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17124 !! end
17125
17126 !! test
17127 Anchor starting with underscore
17128 !! wikitext
17129 [[#_ref|One]]
17130 !! html
17131 <p><a href="#_ref">One</a>
17132 </p>
17133 !! end
17134
17135 !! test
17136 Id starting with underscore
17137 !! wikitext
17138 <div id="_ref"></div>
17139 !! html
17140 <div id="_ref"></div>
17141
17142 !! end
17143
17144 !! test
17145 Space normalisation on autocomment (bug 22784)
17146 !! options
17147 comment
17148 title=[[Main Page]]
17149 !! wikitext
17150 /* __hello__world__ */
17151 !! html
17152 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17153 !! end
17154
17155 !! test
17156 percent-encoding and + signs in comments (Bug 26410)
17157 !! options
17158 comment
17159 !! wikitext
17160 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17161 !! html
17162 <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>
17163 !! end
17164
17165 !! test
17166 Bad images - basic functionality
17167 !! options
17168 disabled
17169 !! wikitext
17170 [[File:Bad.jpg]]
17171 !! html
17172 !! end
17173
17174 !! test
17175 Bad images - bug 16039: text after bad image disappears
17176 !! options
17177 disabled
17178 !! wikitext
17179 Foo bar
17180 [[File:Bad.jpg]]
17181 Bar foo
17182 !! html
17183 <p>Foo bar
17184 </p><p>Bar foo
17185 </p>
17186 !! end
17187
17188 !! test
17189 Verify that displaytitle works (bug #22501) no displaytitle
17190 !! options
17191 showtitle
17192 !! config
17193 wgAllowDisplayTitle=true
17194 wgRestrictDisplayTitle=false
17195 !! wikitext
17196 this is not the the title
17197 !! html
17198 Parser test
17199 <p>this is not the the title
17200 </p>
17201 !! end
17202
17203 !! test
17204 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17205 !! options
17206 showtitle
17207 title=[[Screen]]
17208 !! config
17209 wgAllowDisplayTitle=true
17210 wgRestrictDisplayTitle=false
17211 !! wikitext
17212 this is not the the title
17213 {{DISPLAYTITLE:whatever}}
17214 !! html
17215 whatever
17216 <p>this is not the the title
17217 </p>
17218 !! end
17219
17220 !! test
17221 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17222 !! options
17223 showtitle
17224 title=[[Screen]]
17225 !! config
17226 wgAllowDisplayTitle=true
17227 wgRestrictDisplayTitle=true
17228 !! wikitext
17229 this is not the the title
17230 {{DISPLAYTITLE:whatever}}
17231 !! html
17232 Screen
17233 <p>this is not the the title
17234 </p>
17235 !! end
17236
17237 !! test
17238 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17239 !! options
17240 showtitle
17241 title=[[Screen]]
17242 !! config
17243 wgAllowDisplayTitle=true
17244 wgRestrictDisplayTitle=true
17245 !! wikitext
17246 this is not the the title
17247 {{DISPLAYTITLE:screen}}
17248 !! html
17249 screen
17250 <p>this is not the the title
17251 </p>
17252 !! end
17253
17254 !! test
17255 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17256 !! options
17257 showtitle
17258 title=[[Screen]]
17259 !! config
17260 wgAllowDisplayTitle=false
17261 !! wikitext
17262 this is not the the title
17263 {{DISPLAYTITLE:screen}}
17264 !! html
17265 Screen
17266 <p>this is not the the title
17267 <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>
17268 </p>
17269 !! end
17270
17271 !! test
17272 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17273 !! options
17274 showtitle
17275 title=[[Screen]]
17276 !! config
17277 wgAllowDisplayTitle=false
17278 !! wikitext
17279 this is not the the title
17280 !! html
17281 Screen
17282 <p>this is not the the title
17283 </p>
17284 !! end
17285
17286 !! test
17287 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17288 !! options
17289 showtitle
17290 title=[[Screen]]
17291 !! config
17292 wgAllowDisplayTitle=true
17293 wgRestrictDisplayTitle=true
17294 !! wikitext
17295 this is not the the title
17296 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17297 !! html
17298 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17299 <p>this is not the the title
17300 </p>
17301 !! end
17302
17303 !! test
17304 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17305 !! options
17306 showtitle
17307 title=[[Screen]]
17308 !! config
17309 wgAllowDisplayTitle=true
17310 wgRestrictDisplayTitle=true
17311 !! wikitext
17312 this is not the the title
17313 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17314 !! html
17315 <span style="color: red;">s</span>creen
17316 <p>this is not the the title
17317 </p>
17318 !! end
17319
17320 !! test
17321 preload: check <noinclude> and <includeonly>
17322 !! options
17323 preload
17324 !! wikitext
17325 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17326 !! html
17327 Hello kind world.
17328 !! end
17329
17330 !! test
17331 preload: check <onlyinclude>
17332 !! options
17333 preload
17334 !! wikitext
17335 Goodbye <onlyinclude>Hello world</onlyinclude>
17336 !! html
17337 Hello world
17338 !! end
17339
17340 !! test
17341 preload: can pass tags through if we want to
17342 !! options
17343 preload
17344 !! wikitext
17345 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17346 !! html
17347 <includeonly>Hello world</includeonly>
17348 !! end
17349
17350 !! test
17351 preload: check that it doesn't try to do tricks
17352 !! options
17353 preload
17354 !! wikitext
17355 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17356 !! html
17357 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17358 !! end
17359
17360 !! test
17361 Play a bit with r67090 and bug 3158
17362 !! options
17363 disabled
17364 !! wikitext
17365 <div style="width:50% !important">&nbsp;</div>
17366 <div style="width:50%&nbsp;!important">&nbsp;</div>
17367 <div style="width:50%&#160;!important">&nbsp;</div>
17368 <div style="border : solid;">&nbsp;</div>
17369 !! html
17370 <div style="width:50% !important">&nbsp;</div>
17371 <div style="width:50% !important">&nbsp;</div>
17372 <div style="width:50% !important">&nbsp;</div>
17373 <div style="border&#160;: solid;">&nbsp;</div>
17374
17375 !! end
17376
17377 !! test
17378 HTML5 data attributes
17379 !! wikitext
17380 <span data-foo="bar">Baz</span>
17381 <p data-abc-def_hij="">Quuz</p>
17382 !! html
17383 <p><span data-foo="bar">Baz</span>
17384 </p>
17385 <p data-abc-def_hij="">Quuz</p>
17386
17387 !! end
17388
17389 !! test
17390 percent-encoding and + signs in internal links (Bug 26410)
17391 !! wikitext
17392 [[User:+%]] [[Page+title%]]
17393 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17394 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17395 [[%33%45]] [[%33%45+]]
17396 !! html
17397 <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>
17398 <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>
17399 <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>
17400 <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>
17401 </p>
17402 !! end
17403
17404 !! test
17405 Special characters in embedded file links (bug 27679)
17406 !! wikitext
17407 [[File:Contains & ampersand.jpg]]
17408 [[File:Does not exist.jpg|Title with & ampersand]]
17409 !! html
17410 <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>
17411 <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>
17412 </p>
17413 !! end
17414
17415
17416 !! test
17417 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17418 !! wikitext
17419 Text&apos;s been normalized?
17420 !! html
17421 <p>Text&#39;s been normalized?
17422 </p>
17423 !! end
17424
17425 !! test
17426 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17427 !! wikitext
17428 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17429 !! html
17430 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17431 </p>
17432 !! end
17433
17434 !! test
17435 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17436 !! wikitext
17437 [http://www.example.org/ ideograms]
17438 !! html
17439 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17440 </p>
17441 !! end
17442
17443 !! test
17444 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17445 !! wikitext
17446 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17447 !! html
17448 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17449 </p>
17450 !! end
17451
17452 !! article
17453 Mediawiki:loop1
17454 !! text
17455 {{Identical|A}}
17456 !! endarticle
17457
17458 !! article
17459 Mediawiki:loop2
17460 !! text
17461 {{Identical|B}}
17462 !! endarticle
17463
17464 !! article
17465 Template:Identical
17466 !! text
17467 {{int:loop1}}
17468 {{int:loop2}}
17469 !! endarticle
17470
17471 !! test
17472 Bug 31098 Template which includes system messages which includes the template
17473 !! wikitext
17474 {{Identical}}
17475 !! html
17476 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17477 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17478 </p>
17479 !! end
17480
17481 !! test
17482 Bug31490 Turkish: ucfirst 'blah'
17483 !! options
17484 language=tr
17485 !! wikitext
17486 {{ucfirst:blah}}
17487 !! html
17488 <p>Blah
17489 </p>
17490 !! end
17491
17492 !! test
17493 Bug31490 Turkish: ucfirst 'ix'
17494 !! options
17495 language=tr
17496 !! wikitext
17497 {{ucfirst:ix}}
17498 !! html
17499 <p>İx
17500 </p>
17501 !! end
17502
17503 !! test
17504 Bug31490 Turkish: lcfirst 'BLAH'
17505 !! options
17506 language=tr
17507 !! wikitext
17508 {{lcfirst:BLAH}}
17509 !! html
17510 <p>bLAH
17511 </p>
17512 !! end
17513
17514 !! test
17515 Bug31490 Turkish: ucfırst (with a dotless i)
17516 !! options
17517 language=tr
17518 !! wikitext
17519 {{ucfırst:blah}}
17520 !! html
17521 <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>
17522 </p>
17523 !! end
17524
17525 !! test
17526 Bug31490 ucfırst (with a dotless i) with English language
17527 !! options
17528 language=en
17529 !! wikitext
17530 {{ucfırst:blah}}
17531 !! html
17532 <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>
17533 </p>
17534 !! end
17535
17536 !! test
17537 Bug 26375: TOC with italics
17538 !! options
17539 title=[[Main Page]]
17540 !! wikitext
17541 __TOC__
17542 == ''Lost'' episodes ==
17543 !! html
17544 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17545 <ul>
17546 <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>
17547 </ul>
17548 </div>
17549
17550 <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>
17551
17552 !! end
17553
17554 !! test
17555 Bug 26375: TOC with bold
17556 !! options
17557 title=[[Main Page]]
17558 !! wikitext
17559 __TOC__
17560 == '''should be bold''' then normal text ==
17561 !! html
17562 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17563 <ul>
17564 <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>
17565 </ul>
17566 </div>
17567
17568 <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>
17569
17570 !! end
17571
17572 !! test
17573 Bug 33845: Headings become cursive in TOC when they contain an image
17574 !! options
17575 title=[[Main Page]]
17576 !! wikitext
17577 __TOC__
17578 == Image [[Image:foobar.jpg]] ==
17579 !! html
17580 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17581 <ul>
17582 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17583 </ul>
17584 </div>
17585
17586 <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>
17587
17588 !! end
17589
17590 !! test
17591 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17592 !! options
17593 title=[[Main Page]]
17594 !! wikitext
17595 __TOC__
17596 == <blockquote>Quote</blockquote> ==
17597 !! html
17598 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17599 <ul>
17600 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17601 </ul>
17602 </div>
17603
17604 <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>
17605
17606 !! end
17607
17608 !! test
17609 Unclosed tags in TOC
17610 !! options
17611 title=[[Main Page]]
17612 !! wikitext
17613 __TOC__
17614 == Proof: 2 < 3 ==
17615 <small>Hanc marginis exiguitas non caperet.</small>
17616 QED
17617 !! html
17618 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17619 <ul>
17620 <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>
17621 </ul>
17622 </div>
17623
17624 <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>
17625 <p><small>Hanc marginis exiguitas non caperet.</small>
17626 QED
17627 </p>
17628 !! end
17629
17630 !! test
17631 Multiple tags in TOC
17632 !! wikitext
17633 __TOC__
17634 == <i>Foo</i> <b>Bar</b> ==
17635
17636 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17637 !! html
17638 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17639 <ul>
17640 <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>
17641 <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>
17642 </ul>
17643 </div>
17644
17645 <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>
17646 <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>
17647
17648 !! end
17649
17650 !! test
17651 Tags with parameters in TOC
17652 !! wikitext
17653 __TOC__
17654 == <sup class="in-h2">Hello</sup> ==
17655
17656 == <sup class="a > b">Evilbye</sup> ==
17657 !! html
17658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17659 <ul>
17660 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17661 <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>
17662 </ul>
17663 </div>
17664
17665 <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>
17666 <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>
17667
17668 !! end
17669
17670 !! test
17671 span tags with directionality in TOC
17672 !! wikitext
17673 __TOC__
17674 == <span dir="ltr">C++</span> ==
17675
17676 == <span dir="rtl">זבנג!</span> ==
17677
17678 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17679
17680 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17681
17682 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17683 !! html
17684 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17685 <ul>
17686 <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>
17687 <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>
17688 <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>
17689 <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>
17690 <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>
17691 </ul>
17692 </div>
17693
17694 <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>
17695 <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>
17696 <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>
17697 <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>
17698 <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>
17699
17700 !! end
17701
17702 !! article
17703 MediaWiki:Bug32057
17704 !! text
17705 == {{int:headline_sample}} ==
17706 !! endarticle
17707
17708 !! test
17709 Bug 32057: Title needed when expanding <h> nodes.
17710 !! options
17711 title=[[Main Page]]
17712 !! wikitext
17713 {{int:Bug32057}}
17714 !! html
17715 <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>
17716
17717 !! end
17718
17719 !! test
17720 Strip marker in urlencode
17721 !! wikitext
17722 {{urlencode:x<nowiki/>y}}
17723 {{urlencode:x<nowiki/>y|wiki}}
17724 {{urlencode:x<nowiki/>y|path}}
17725 !! html
17726 <p>xy
17727 xy
17728 xy
17729 </p>
17730 !! end
17731
17732 !! test
17733 Strip marker in lc
17734 !! wikitext
17735 {{lc:x<nowiki/>y}}
17736 !! html
17737 <p>xy
17738 </p>
17739 !! end
17740
17741 !! test
17742 Strip marker in uc
17743 !! wikitext
17744 {{uc:x<nowiki/>y}}
17745 !! html
17746 <p>XY
17747 </p>
17748 !! end
17749
17750 !! test
17751 Strip marker in formatNum
17752 !! wikitext
17753 {{formatnum:1<nowiki/>2}}
17754 {{formatnum:1<nowiki/>2|R}}
17755 !! html
17756 <p>12
17757 12
17758 </p>
17759 !! end
17760
17761 !! test
17762 Check noCommafy in formatNum
17763 !! options
17764 language=be-tarask
17765 !! wikitext
17766 {{formatnum:123456.78}}
17767 {{formatnum:123456.78|NOSEP}}
17768 !! html
17769 <p>123 456,78
17770 123456.78
17771 </p>
17772 !! end
17773
17774 !! test
17775 Wrong option for formatNum (bug 56199)
17776 !! wikitext
17777 {{formatnum:1,234.56|Random}}
17778 {{formatnum:1,234.56|EVERYTHING}}
17779 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17780 !! html
17781 <p>1,234.56
17782 1,234.56
17783 1,234.56
17784 </p>
17785 !! end
17786
17787 !! test
17788 Strip marker in grammar
17789 !! options
17790 language=fi
17791 !! wikitext
17792 {{grammar:elative|foo<nowiki/>bar}}
17793 !! html
17794 <p>foobarista
17795 </p>
17796 !! end
17797
17798 !! test
17799 Strip marker in padleft
17800 !! wikitext
17801 {{padleft:|2|x<nowiki/>y}}
17802 !! html
17803 <p>xy
17804 </p>
17805 !! end
17806
17807 !! test
17808 Strip marker in padright
17809 !! wikitext
17810 {{padright:|2|x<nowiki/>y}}
17811 !! html
17812 <p>xy
17813 </p>
17814 !! end
17815
17816 !! test
17817 Strip marker in anchorencode
17818 !! wikitext
17819 {{anchorencode:x<nowiki/>y}}
17820 !! html
17821 <p>xy
17822 </p>
17823 !! end
17824
17825 !! test
17826 nowiki inside link inside heading (bug 18295)
17827 !! wikitext
17828 ==[[foo|x<nowiki>y</nowiki>z]]==
17829 !! html
17830 <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>
17831
17832 !! end
17833
17834 !! test
17835 new support for bdi element (bug 31817)
17836 !! wikitext
17837 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17838 !! html
17839 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17840
17841 !!end
17842
17843 !! test
17844 Ignore pipe between table row attributes
17845 !! wikitext
17846 {|
17847 | quux
17848 |- id=foo | style='color: red'
17849 | bar
17850 |}
17851 !! html
17852 <table>
17853 <tr>
17854 <td> quux
17855 </td></tr>
17856 <tr id="foo" style="color: red">
17857 <td> bar
17858 </td></tr></table>
17859
17860 !! end
17861
17862 !!test
17863 Gallery override link with WikiLink (bug 34852)
17864 !! wikitext
17865 <gallery>
17866 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17867 </gallery>
17868 !! html
17869 <ul class="gallery mw-gallery-traditional">
17870 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17871 <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>
17872 <div class="gallerytext">
17873 <p>caption
17874 </p>
17875 </div>
17876 </div></li>
17877 </ul>
17878
17879 !! end
17880
17881 !!test
17882 Gallery override link with absolute external link (bug 34852)
17883 !! wikitext
17884 <gallery>
17885 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17886 </gallery>
17887 !! html
17888 <ul class="gallery mw-gallery-traditional">
17889 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17890 <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>
17891 <div class="gallerytext">
17892 <p>caption
17893 </p>
17894 </div>
17895 </div></li>
17896 </ul>
17897
17898 !! end
17899
17900 !!test
17901 Gallery override link with malicious javascript (bug 34852)
17902 !! wikitext
17903 <gallery>
17904 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17905 </gallery>
17906 !! html
17907 <ul class="gallery mw-gallery-traditional">
17908 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17909 <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>
17910 <div class="gallerytext">
17911 <p>caption
17912 </p>
17913 </div>
17914 </div></li>
17915 </ul>
17916
17917 !! end
17918
17919 !!test
17920 Gallery with invalid title as link (bug 43964)
17921 !! wikitext
17922 <gallery>
17923 File:foobar.jpg|link=<
17924 </gallery>
17925 !! html
17926 <ul class="gallery mw-gallery-traditional">
17927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17928 <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>
17929 <div class="gallerytext">
17930 </div>
17931 </div></li>
17932 </ul>
17933
17934 !! end
17935
17936 !!test
17937 Language parser function
17938 !! wikitext
17939 {{#language:ar}}
17940 !! html
17941 <p>العربية
17942 </p>
17943 !! end
17944
17945 !!test
17946 Padleft and padright as substr
17947 !! wikitext
17948 {{padleft:|3|abcde}}
17949 {{padright:|3|abcde}}
17950 !! html
17951 <p>abc
17952 abc
17953 </p>
17954 !! end
17955
17956 !!test
17957 Special parser function
17958 !! wikitext
17959 {{#special:RandomPage}}
17960 {{#special:BaDtItLe}}
17961 {{#special:Foobar}}
17962 !! html
17963 <p>Special:Random
17964 Special:Badtitle
17965 Special:Foobar
17966 </p>
17967 !! end
17968
17969 !!test
17970 Bug 34939 - Case insensitive link parsing ([HttP://])
17971 !! wikitext
17972 [HttP://MediaWiki.Org/]
17973 !! html/php
17974 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17975 </p>
17976 !! html/parsoid
17977 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17978 !! end
17979
17980 !!test
17981 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17982 !! wikitext
17983 [HttP://MediaWiki.Org/ MediaWiki]
17984 !! html
17985 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17986 </p>
17987 !! end
17988
17989 !!test
17990 Bug 34939 - Case insensitive link parsing (HttP://)
17991 !! wikitext
17992 HttP://MediaWiki.Org/
17993 !! html/php
17994 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17995 </p>
17996 !! html/parsoid
17997 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17998 !! end
17999
18000 !!test
18001 Disable TOC
18002 !! options
18003 notoc
18004 !! wikitext
18005 Lead
18006 == Section 1 ==
18007 == Section 2 ==
18008 == Section 3 ==
18009 == Section 4 ==
18010 == Section 5 ==
18011 !! html
18012 <p>Lead
18013 </p>
18014
18015 <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>
18016 <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>
18017 <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>
18018 <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>
18019 <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>
18020
18021 !! end
18022
18023
18024 ###
18025 ### Parsoid-specific tests
18026 ### Parsoid-PHP parser incompatibilities
18027 ###
18028 !!test
18029 1. SOL-sensitive wikitext tokens as template-args
18030 !!options
18031 parsoid=wt2html,wt2wt
18032 !! wikitext
18033 {{echo|*a}}
18034 {{echo|#a}}
18035 {{echo|:a}}
18036 !! html
18037 <span about="#mwt1" typeof="mw:Transclusion">
18038 </span><ul about="#mwt1"><li>a</li>
18039 </ul>
18040 <span about="#mwt2" typeof="mw:Transclusion">
18041 </span><ol about="#mwt2"><li>a</li>
18042 </ol>
18043 <span about="#mwt3" typeof="mw:Transclusion">
18044 </span><dl about="#mwt3"><dd>a</dd>
18045 </dl>
18046 !!end
18047
18048 #### -----------------------------------------------------------------
18049 #### Parsoid-specific functionality tests
18050 #### -----------------------------------------------------------------
18051
18052 # Bug 63642: Formatting elt fixup is cleaned up.
18053 # We know wt2wt will fail, but we expect selser to pass.
18054 # Due to the nature of our testing, wt2wt and selser tests will enter the
18055 # blacklist and we'll catch selser regressions based on changes to the
18056 # blacklist entries for selser tests.
18057 !! test
18058 Bad treebuilder fixup of formatting elt is cleaned up
18059 !! options
18060 parsoid=wt2html,wt2wt
18061 !! wikitext
18062 {|
18063 |
18064 <small>
18065 [[Image:Foobar.jpg|right|Test]]
18066 </small>
18067 |}
18068 !! html/parsoid
18069 <table>
18070 <tbody><tr><td>
18071 <p><small></small></p>
18072 <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>
18073 <p></p></td></tr>
18074 </tbody></table>
18075 !! end
18076
18077 #### ----------------------------------------------------------------
18078 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18079 #### tags. Parsoid's output for these tags differs from that of the
18080 #### PHP parser.
18081 #### ----------------------------------------------------------------
18082
18083 !!test
18084 Ref: 1. ref-location should be replaced with an index span
18085 !!options
18086 parsoid
18087 !! wikitext
18088 A <ref>foo</ref>
18089 B <ref name="x">foo</ref>
18090 C <ref name="y" />
18091 !! html
18092 <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>
18093 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>
18094 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>
18095 !!end
18096
18097 !!test
18098 Ref: 2. ref-tags with identical names should all get the same index
18099 !!options
18100 parsoid
18101 !! wikitext
18102 A <ref name="x">foo</ref>
18103 B <ref name="x" />
18104 !! html
18105 <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>
18106 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>
18107 !!end
18108
18109 !!test
18110 Ref: 3. spaces in ref-names should be ignored
18111 !!options
18112 parsoid
18113 !! wikitext
18114 A <ref name="x">foo</ref>
18115 B <ref name=" x " />
18116 C <ref name= x />
18117 !! html
18118 <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>
18119 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>
18120 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>
18121 !!end
18122
18123 !!test
18124 Ref: 4. 'constructor' should be accepted as a valid ref-name
18125 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18126 !!options
18127 parsoid
18128 !! wikitext
18129 A <ref name="constructor">foo</ref>
18130 !! html
18131 <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>
18132 !!end
18133
18134 !!test
18135 Ref: 5. body should accept generic wikitext
18136 !!options
18137 parsoid
18138 !! wikitext
18139 A <ref>
18140 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18141 </ref>
18142
18143 <references />
18144 !! html
18145 <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>
18146
18147 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18148 <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>
18149 </li>
18150 </ol>
18151 !!end
18152
18153 !!test
18154 Ref: 6. indent-pres should not be output in ref-body
18155 !!options
18156 parsoid
18157 !! wikitext
18158 A <ref>
18159 foo
18160 bar
18161 baz
18162 </ref>
18163
18164 <references />
18165 !! html
18166 <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>
18167
18168 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18169 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18170 bar
18171 baz
18172 </li>
18173 </ol>
18174 !!end
18175
18176 !!test
18177 Ref: 7. No p-wrapping in ref-body
18178 !!options
18179 parsoid
18180 !! wikitext
18181 A <ref>
18182 foo
18183
18184 bar
18185
18186
18187 baz
18188
18189
18190
18191 booz
18192 </ref>
18193
18194 <references />
18195 !! html
18196 <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>
18197
18198 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18199 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18200
18201 bar
18202
18203
18204 baz
18205
18206
18207
18208 booz
18209 </li>
18210 </ol>
18211 !!end
18212
18213 !!test
18214 Ref: 8. transclusion wikitext has lower precedence
18215 !!options
18216 parsoid
18217 !! wikitext
18218 A <ref> foo {{echo|</ref> B C}}
18219
18220 <references />
18221 !! html
18222 <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>
18223 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18224 <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>
18225 </ol>
18226 !!end
18227
18228 !!test
18229 Ref: 9. unclosed comments should not leak out of ref-body
18230 !!options
18231 parsoid
18232 !! wikitext
18233 A <ref> foo <!--</ref> B C
18234 <references />
18235 !! html
18236 <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>
18237 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18238 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18239 </ol>
18240 !!end
18241
18242 !!test
18243 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18244 !!options
18245 parsoid
18246 !! wikitext
18247 A <ref> <b> foo </ref> B C
18248
18249 <references />
18250 !! html
18251 <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>
18252
18253
18254 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18255 <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>
18256 </ol>
18257 !!end
18258
18259 !!test
18260 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18261 !!options
18262 parsoid
18263 !! wikitext
18264 A <ref>foo</ref> B
18265 C <ref>bar</ref> D
18266 !! html
18267 <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
18268 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>
18269 !!end
18270
18271 !!test
18272 Ref: 12. ref-tags act as trailing newline migration barrier
18273 !!options
18274 parsoid
18275 !! wikitext
18276 <!--the newline at the end of this line moves out of the p-tag-->a
18277
18278 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18279 <ref />
18280
18281 c
18282 !! html
18283 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18284
18285
18286 <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>
18287 <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>
18288
18289
18290 <p>c</p>
18291 !!end
18292
18293 !!test
18294 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18295 !!options
18296 parsoid
18297 !! wikitext
18298 <ref>foo</ref> A
18299 <ref>bar
18300 </ref> B
18301 !! html
18302 <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
18303 <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>
18304 !!end
18305
18306 !!test
18307 Ref: 14. A nested ref-tag should be emitted as plain text
18308 !!options
18309 parsoid
18310 !! wikitext
18311 <ref>foo <ref>bar</ref> baz</ref>
18312
18313 <references />
18314 !! html
18315 <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>
18316
18317 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18318 <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>
18319 </ol>
18320 !!end
18321
18322 !!test
18323 Ref: 15. ref-tags with identical names should get identical indexes
18324 !!options
18325 parsoid
18326 !! wikitext
18327 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18328 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18329
18330 <references />
18331 !! html
18332 <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>
18333 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>
18334
18335 <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>
18336 </ol>
18337 !!end
18338
18339 ## We don't bother wt2wt-ing non-standard whitespace
18340 !!test
18341 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18342 !!options
18343 parsoid=wt2html
18344 !! wikitext
18345 A <ref >foo</ref >
18346
18347 <references />
18348 !! html
18349 <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>
18350
18351 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18352 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18353 !!end
18354
18355 !!test
18356 References: 1. references tag without any refs should be handled properly
18357 !!options
18358 parsoid
18359 !! wikitext
18360 <references />
18361 !! html
18362 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18363 !!end
18364
18365 !!test
18366 References: 2. references tag with group only outputs references from that group
18367 !!options
18368 parsoid
18369 !! wikitext
18370 A <ref group="a">foo</ref>
18371 B <ref group="b">bar</ref>
18372
18373 <references group="a" />
18374 !! html
18375 <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>
18376 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>
18377
18378 <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>
18379 </ol>
18380 !!end
18381
18382 !!test
18383 References: 3. ref list should be cleared after processing references
18384 !!options
18385 parsoid
18386 !! wikitext
18387 A <ref>foo</ref>
18388
18389 <references />
18390
18391 B <ref>bar</ref>
18392
18393 <references />
18394 !! html
18395 <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>
18396
18397 <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>
18398 </ol>
18399
18400 <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>
18401
18402 <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>
18403 </ol>
18404 !!end
18405
18406 !!test
18407 References: 4. only referenced group should be cleared after processing references
18408 !!options
18409 parsoid
18410 !! wikitext
18411 A <ref group="a">afoo</ref>
18412 B <ref>bfoo</ref>
18413
18414 <references group="a" />
18415
18416 C <ref>cfoo</ref>
18417
18418 <references />
18419 !! html
18420 <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>
18421 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>
18422
18423 <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>
18424 </ol>
18425
18426 <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>
18427
18428 <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>
18429 </ol>
18430 !!end
18431
18432 !!test
18433 References: 5. ref tags in references should be processed while ignoring all other content
18434 !!options
18435 parsoid
18436 !! wikitext
18437 A <ref name="a" />
18438 B <ref name="b">bar</ref>
18439
18440 <references>
18441 <ref name="a">foo</ref>
18442 This should just get lost.
18443 </references>
18444 !! html
18445 <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>
18446 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>
18447
18448
18449 <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":{}}'>
18450 <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>
18451 <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>
18452 </ol>
18453 !!end
18454
18455 !!test
18456 References: 6. <references /> from a transclusion
18457 !!options
18458 parsoid
18459 !! wikitext
18460 <ref>Foo</ref> {{echo|<references />}}
18461 !! html
18462 <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>
18463 !!end
18464
18465 !! test
18466 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18467 !! options
18468 parsoid
18469 !! wikitext
18470 A <ref>foo bar for a</ref>
18471 B <ref group="X" name="b" />
18472
18473 <references />
18474
18475 <references group="X">
18476 <ref name="b">foo</ref>
18477 </references>
18478 !! html
18479 <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>
18480 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>
18481
18482 <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>
18483
18484 <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>
18485 !! end
18486
18487 !! test
18488 Entities in ref name
18489 !! options
18490 parsoid
18491 !! wikitext
18492 <ref name="test &amp; me">hi</ref>
18493 !! html
18494 <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>
18495 !! end
18496
18497 # This test is wt2html only because we're permitting the serializer to produce
18498 # dirty diffs, normalizing the unclosed references to the self-closed version.
18499 !! test
18500 Generate references for unclosed references tag
18501 !! options
18502 parsoid=wt2html
18503 !! wikitext
18504 a<ref>foo</ref>
18505
18506 <references>
18507 !! html
18508 <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>
18509
18510
18511 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18512 <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>
18513 !! end
18514
18515 !! test
18516 New reference serializes on its own line
18517 !! options
18518 parsoid=wt2wt,html2wt
18519 !! wikitext
18520 foo
18521 <references />
18522 !! html
18523 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18524 !! end
18525
18526 #### ----------------------------------------------------------------
18527 #### The following section of tests are primarily to test
18528 #### wikitext escaping capabilities of Parsoid. Given that
18529 #### escaping can be done any number of ways, the wikitext (input)
18530 #### is always adjusted to reflect how Parsoid adds nowiki
18531 #### escape tags.
18532 ####
18533 #### We are marking several tests as parsoid-only since the
18534 #### HTML in the result section is different from what the
18535 #### PHP parser generates for it.
18536 #### ----------------------------------------------------------------
18537
18538
18539 #### --------------- Headings ---------------
18540 #### 0. Unnested
18541 #### 1. Nested inside html <h1>=foo=</h1>
18542 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18543 #### 3. Nested inside html with wikitext split by html tags
18544 #### 4. No escape needed
18545 #### 5. Empty headings <h1></h1>
18546 #### 6. Heading chars in SOL context
18547 #### ----------------------------------------
18548 !! test
18549 Headings: 0. Unnested
18550 !! options
18551 parsoid
18552 !! wikitext
18553 <nowiki>=foo=</nowiki>
18554
18555 <nowiki> =foo= </nowiki>
18556 <!--cmt-->
18557 <nowiki>=foo=</nowiki>
18558
18559 =foo''a''<nowiki>=</nowiki>
18560 !! html
18561 <p><span typeof="mw:Nowiki">=foo=</span></p>
18562
18563 <p><span typeof="mw:Nowiki"> =foo= </span>
18564 <!--cmt-->
18565 <span typeof="mw:Nowiki">=foo=</span></p>
18566
18567 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18568 !!end
18569
18570 !! test
18571 Headings: 1. Nested inside html
18572 (New headings and existing headings are handled differently)
18573 !! options
18574 parsoid=html2wt
18575 !! wikitext
18576 = =foo= =
18577
18578 == =foo= ==
18579
18580 === =foo= ===
18581
18582 =<nowiki>=foo=</nowiki>=
18583 ==<nowiki>=foo=</nowiki>==
18584 ===<nowiki>=foo=</nowiki>===
18585 ====<nowiki>=foo=</nowiki>====
18586 =====<nowiki>=foo=</nowiki>=====
18587 ======<nowiki>=foo=</nowiki>======
18588
18589 !! html
18590 <h1>=foo=</h1>
18591 <h2>=foo=</h2>
18592 <h3>=foo=</h3>
18593
18594 <h1 data-parsoid='{}'>=foo=</h1>
18595 <h2 data-parsoid='{}'>=foo=</h2>
18596 <h3 data-parsoid='{}'>=foo=</h3>
18597 <h4 data-parsoid='{}'>=foo=</h4>
18598 <h5 data-parsoid='{}'>=foo=</h5>
18599 <h6 data-parsoid='{}'>=foo=</h6>
18600 !!end
18601
18602 !! test
18603 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18604 !! options
18605 parsoid=html2wt
18606 !! wikitext
18607 = foo =
18608 <nowiki>*</nowiki>bar
18609
18610 = foo =
18611 =bar
18612
18613 = foo =
18614 <nowiki>=bar=</nowiki>
18615 !! html
18616 <h1>foo</h1>*bar
18617 <h1>foo</h1>=bar
18618 <h1>foo</h1>=bar=
18619 !!end
18620
18621 !! test
18622 Headings: 3. Nested inside html with wikitext split by html tags
18623 !! options
18624 parsoid=html2wt
18625 !! wikitext
18626 = ='''bold'''<nowiki>foo=</nowiki> =
18627 !! html
18628 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18629 !!end
18630
18631 !! test
18632 Headings: 4a. No escaping needed (testing just h1 and h2)
18633 !! options
18634 parsoid=html2wt
18635 !! wikitext
18636 = =foo =
18637
18638 = foo= =
18639
18640 = =foo= =
18641
18642 = =foo= bar =
18643
18644 == =foo ==
18645
18646 == foo= ==
18647
18648 = ''=''foo= =
18649
18650 = <nowiki>=</nowiki> =
18651 !! html
18652 <h1>=foo</h1>
18653 <h1>foo=</h1>
18654 <h1> =foo= </h1>
18655 <h1>=foo= bar</h1>
18656 <h2>=foo</h2>
18657 <h2>foo=</h2>
18658 <h1><i>=</i>foo=</h1>
18659 <h1><span typeof="mw:Nowiki">=</span></h1>
18660 !!end
18661
18662 !! test
18663 Headings: 4b. No escaping needed (inside p-tags)
18664 !! options
18665 parsoid=html2wt
18666 !! wikitext
18667 ===
18668 =foo= x
18669 =foo= <s></s>
18670 !! html
18671 <p>===
18672 =foo= x
18673 =foo= <s></s>
18674 </p>
18675 !!end
18676
18677 !! test
18678 Headings: 5. Empty headings
18679 !! options
18680 parsoid
18681 !! wikitext
18682 =<nowiki/>=
18683
18684 ==<nowiki/>==
18685
18686 ===<nowiki/>===
18687
18688 ====<nowiki/>====
18689
18690 =====<nowiki/>=====
18691
18692 ======<nowiki/>======
18693 !! html
18694 <h1></h1>
18695 <h2></h2>
18696 <h3></h3>
18697 <h4></h4>
18698 <h5></h5>
18699 <h6></h6>
18700 !!end
18701
18702 !! test
18703 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18704 !! options
18705 parsoid
18706 !! wikitext
18707 <nowiki>=a=</nowiki>
18708
18709 <nowiki>=a=</nowiki>
18710
18711 <nowiki>=a=</nowiki>
18712
18713 <nowiki>=a=</nowiki>
18714 !! html
18715 <p>=a=</p>
18716 <p>=a= </p>
18717 <p>=a= </p>
18718 <p>=a= </p>
18719 !!end
18720
18721 !! test
18722 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18723 !! options
18724 parsoid
18725 !! wikitext
18726 <nowiki>=a=
18727 b</nowiki>
18728
18729 <nowiki>=a=
18730 b</nowiki>
18731
18732 <nowiki>=a=
18733 b</nowiki>
18734
18735 <nowiki>=a=
18736 b</nowiki>
18737 !! html
18738 <p>=a=
18739 b</p>
18740 <p>=a=
18741 b</p>
18742 <p>=a=
18743 b</p>
18744 <p>=a=
18745 b</p>
18746 </p>
18747 !!end
18748
18749 !! test
18750 Headings: 6c. Heading chars in SOL context (leading newline break)
18751 !! options
18752 parsoid
18753 !! wikitext
18754 a
18755 <nowiki>=b=</nowiki>
18756 !! html
18757 <p>a
18758 =b=</p>
18759 !!end
18760
18761 !! test
18762 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18763 !! options
18764 parsoid
18765 !! wikitext
18766 <!--c0--><nowiki>=a=</nowiki>
18767
18768 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18769 !! html
18770 <p><!--c0-->=a=</p>
18771 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18772 !!end
18773
18774 !! test
18775 Headings: 6d. Heading chars in SOL context (No escaping needed)
18776 !! options
18777 parsoid=html2wt
18778 !! wikitext
18779 =a=<div>b</div>
18780 !! html
18781 =a=<div>b</div>
18782 !!end
18783
18784 #### --------------- Lists ---------------
18785 #### 0. Outside nests (*foo, etc.)
18786 #### 1. Nested inside html <ul><li>*foo</li></ul>
18787 #### 2. Inside definition lists
18788 #### 3. Only bullets at start should be escaped
18789 #### 4. No escapes needed
18790 #### 5. No unnecessary escapes
18791 #### 6. Escape bullets in SOL position
18792 #### 7. Escape bullets in a multi-line context
18793 #### ----------------------------------------
18794
18795 !! test
18796 Lists: 0. Outside nests
18797 !! wikitext
18798 <nowiki>*</nowiki>foo
18799
18800 <nowiki>#</nowiki>foo
18801
18802 <nowiki>;Foo:</nowiki>bar
18803 !! html
18804 <p>*foo
18805 </p><p>#foo
18806 </p><p>;Foo:bar
18807 </p>
18808 !!end
18809
18810 !! test
18811 Lists: 1. Nested inside html
18812 !! wikitext
18813 *<nowiki>*foo</nowiki>
18814
18815 *<nowiki>#foo</nowiki>
18816
18817 *<nowiki>:foo</nowiki>
18818
18819 *<nowiki>;foo</nowiki>
18820
18821 #<nowiki>*foo</nowiki>
18822
18823 #<nowiki>#foo</nowiki>
18824
18825 #<nowiki>:foo</nowiki>
18826
18827 #<nowiki>;foo</nowiki>
18828 !! html
18829 <ul><li>*foo</li></ul>
18830 <ul><li>#foo</li></ul>
18831 <ul><li>:foo</li></ul>
18832 <ul><li>;foo</li></ul>
18833 <ol><li>*foo</li></ol>
18834 <ol><li>#foo</li></ol>
18835 <ol><li>:foo</li></ol>
18836 <ol><li>;foo</li></ol>
18837
18838 !!end
18839
18840 !! test
18841 Lists: 2. Inside definition lists
18842 !! wikitext
18843 ;<nowiki>;foo</nowiki>
18844
18845 ;<nowiki>:foo</nowiki>
18846
18847 ;<nowiki>:foo</nowiki>
18848 :bar
18849
18850 :<nowiki>:foo</nowiki>
18851 !! html
18852 <dl><dt>;foo</dt></dl>
18853 <dl><dt>:foo</dt></dl>
18854 <dl><dt>:foo</dt>
18855 <dd>bar</dd></dl>
18856 <dl><dd>:foo</dd></dl>
18857
18858 !!end
18859
18860 !! test
18861 Lists: 3. Only bullets at start of text should be escaped
18862 !! wikitext
18863 *<nowiki>*foo*bar</nowiki>
18864
18865 *<nowiki>*foo</nowiki>''it''*bar
18866 !! html
18867 <ul><li>*foo*bar</li></ul>
18868 <ul><li>*foo<i>it</i>*bar</li></ul>
18869
18870 !!end
18871
18872 !! test
18873 Lists: 4. No escapes needed
18874 !! options
18875 parsoid
18876 !! wikitext
18877 *foo*bar
18878
18879 *''foo''*bar
18880
18881 *[[Foo]]: bar
18882
18883 *[[Foo]]*bar
18884 !! html
18885 <ul>
18886 <li>foo*bar
18887 </li>
18888 </ul>
18889 <ul>
18890 <li><i>foo</i>*bar
18891 </li>
18892 </ul>
18893 <ul>
18894 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18895 </li>
18896 </ul>
18897 <ul>
18898 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18899 </li>
18900 </ul>
18901 !!end
18902
18903 !! test
18904 Lists: 5. No unnecessary escapes
18905 !! wikitext
18906 * bar <span><nowiki>[[foo]]</nowiki></span>
18907
18908 *=bar <span><nowiki>[[foo]]</nowiki></span>
18909
18910 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18911
18912 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18913
18914 *=bar <span>foo]]</span>=
18915
18916 * <s></s>: a
18917 !! html
18918 <ul><li> bar <span>[[foo]]</span></li></ul>
18919 <ul><li>=bar <span>[[foo]]</span></li></ul>
18920 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18921 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18922 <ul><li>=bar <span>foo]]</span>=</li></ul>
18923 <ul><li> <s></s>: a</li></ul>
18924
18925 !!end
18926
18927 !! test
18928 Lists: 6. Escape bullets in SOL position
18929 !! options
18930 parsoid
18931 !! wikitext
18932 <!--cmt--><nowiki>*foo</nowiki>
18933 !! html
18934 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18935 !!end
18936
18937 !! test
18938 Lists: 7. Escape bullets in a multi-line context
18939 !! wikitext
18940 a
18941 <nowiki>*</nowiki>b
18942 !! html
18943 <p>a
18944 *b
18945 </p>
18946 !!end
18947
18948 #### --------------- HRs ---------------
18949 #### 1. Single line
18950 #### -----------------------------------
18951
18952 !! test
18953 HRs: 1. Single line
18954 !! options
18955 parsoid
18956 !! wikitext
18957 ----<nowiki>----</nowiki>
18958 ----=foo=
18959 ----*foo
18960 !! html
18961 <hr><span typeof="mw:Nowiki">----</span>
18962 <hr>=foo=
18963 <hr>*foo
18964 !! end
18965
18966 #### --------------- Tables ---------------
18967 #### 1a. Simple example
18968 #### 1b. No escaping needed (!foo)
18969 #### 1c. No escaping needed (|foo)
18970 #### 1d. No escaping needed (|}foo)
18971 ####
18972 #### 2a. Nested in td (<td>foo|bar</td>)
18973 #### 2b. Nested in td (<td>foo||bar</td>)
18974 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18975 ####
18976 #### 3a. Nested in th (<th>foo!bar</th>)
18977 #### 3b. Nested in th (<th>foo!!bar</th>)
18978 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18979 ####
18980 #### 4a. Escape -
18981 #### 4b. Escape +
18982 #### 4c. No escaping needed
18983 #### --------------------------------------
18984
18985 !! test
18986 Tables: 1a. Simple example
18987 !! wikitext
18988 <nowiki>{|
18989 |}</nowiki>
18990 !! html
18991 <p>{|
18992 |}
18993 </p>
18994 !! end
18995
18996 !! test
18997 Tables: 1b. No escaping needed
18998 !! wikitext
18999 !foo
19000 !! html
19001 <p>!foo
19002 </p>
19003 !! end
19004
19005 !! test
19006 Tables: 1c. No escaping needed
19007 !! wikitext
19008 |foo
19009 !! html
19010 <p>|foo
19011 </p>
19012 !! end
19013
19014 !! test
19015 Tables: 1d. No escaping needed
19016 !! wikitext
19017 |}foo
19018 !! html
19019 <p>|}foo
19020 </p>
19021 !! end
19022
19023 !! test
19024 Tables: 2a. Nested in td
19025 !! options
19026 parsoid=html2wt
19027 !! wikitext
19028 {|
19029 |<nowiki>foo|bar</nowiki>
19030 |-
19031 |x<div><nowiki>a|b</nowiki></div>
19032 |}
19033 !! html
19034 <table><tbody><tr>
19035 <td>foo|bar</td></tr>
19036 <tr><td>x<div>a|b</div></td>
19037 </tbody></table>
19038 !! end
19039
19040 !! test
19041 Tables: 2b. Nested in td
19042 !! options
19043 parsoid
19044 !! wikitext
19045 {|
19046 |<nowiki>foo||bar</nowiki>
19047 |''it''<nowiki>foo||bar</nowiki>
19048 |}
19049 !! html
19050 <table><tbody><tr>
19051 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19052 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19053 !! end
19054
19055 !! test
19056 Tables: 2c. Nested in td -- no escaping needed
19057 !! options
19058 parsoid
19059 !! wikitext
19060 {|
19061 |foo!!bar
19062 |}
19063 !! html
19064 <table><tbody><tr><td>foo!!bar
19065 </td></tr></tbody></table>
19066
19067 !! end
19068
19069 !! test
19070 Tables: 3a. Nested in th
19071 !! options
19072 parsoid
19073 !! wikitext
19074 {|
19075 !foo!bar
19076 |}
19077 !! html
19078 <table><tbody><tr><th>foo!bar
19079 </th></tr></tbody></table>
19080
19081 !! end
19082
19083 !! test
19084 Tables: 3b. Nested in th
19085 !! options
19086 parsoid
19087 !! wikitext
19088 {|
19089 !<nowiki>foo!!bar</nowiki>
19090 |}
19091 !! html
19092 <table>
19093 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19094 </tbody></table>
19095 !! end
19096
19097 !! test
19098 Tables: 3c. Nested in th -- no escaping needed
19099 !! options
19100 parsoid
19101 !! wikitext
19102 {|
19103 !<nowiki>foo||bar</nowiki>
19104 |}
19105 !! html
19106 <table><tbody><tr>
19107 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19108 !! end
19109
19110 !! test
19111 Tables: 4a. Escape -
19112 !! options
19113 parsoid
19114 !! wikitext
19115 {|
19116 !-bar
19117 |-
19118 |<nowiki>-bar</nowiki>
19119 |}
19120 !! html
19121 <table><tbody>
19122 <tr><th>-bar</th></tr>
19123 <tr>
19124 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19125 !! end
19126
19127 !! test
19128 Tables: 4b. Escape +
19129 !! options
19130 parsoid
19131 !! wikitext
19132 {|
19133 !+bar
19134 |-
19135 |<nowiki>+bar</nowiki>
19136 |}
19137 !! html
19138 <table><tbody>
19139 <tr><th>+bar</th></tr>
19140 <tr>
19141 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19142 !! end
19143
19144 !! test
19145 Tables: 4c. No escaping needed
19146 !! options
19147 parsoid
19148 !! wikitext
19149 {|
19150 |foo-bar
19151 |foo+bar
19152 |-
19153 |''foo''-bar
19154 |''foo''+bar
19155 |-
19156 |foo
19157 bar|baz
19158 +bar
19159 -bar
19160 |-
19161 |x
19162 <div>a|b</div>
19163 |}
19164 !! html
19165 <table><tbody>
19166 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19167 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19168 <tr><td>foo
19169 <p>bar|baz
19170 +bar
19171 -bar</p></td></tr>
19172 <tr><td>x
19173 <div>a|b</div></td>
19174 </tbody></table>
19175 !! end
19176
19177 !! test
19178 Tables: 4d. No escaping needed
19179 !! options
19180 parsoid
19181 !! wikitext
19182 {|
19183 |[[Foo]]-bar
19184 ||+1
19185 ||-2
19186 |}
19187 !! html
19188 <table>
19189 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19190 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19191 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19192 </tbody></table>
19193 !! end
19194
19195 !! test
19196 Tables: Digest broken attributes on table and tr tag
19197 !! options
19198 parsoid=wt2html
19199 !! wikitext
19200 {| || |} ++
19201 |- || || ++ --
19202 |- > [
19203 |}
19204 !! html
19205 <table>
19206 <tbody>
19207 <tr></tr>
19208 <tr></tr>
19209 </tbody></table>
19210 !! end
19211
19212 #### --------------- Links ----------------
19213 #### 1. Quote marks in link text
19214 #### 2. Wikilinks: Escapes needed
19215 #### 3. Wikilinks: No escapes needed
19216 #### 4. Extlinks: Escapes needed
19217 #### 5. Extlinks: No escapes needed
19218 #### --------------------------------------
19219 !! test
19220 Links 1. Quote marks in link text
19221 !! options
19222 parsoid
19223 !! wikitext
19224 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19225 !! html
19226 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19227 !! end
19228
19229 !! test
19230 Links 2. WikiLinks: Escapes needed
19231 !! options
19232 parsoid
19233 !! wikitext
19234 [[Foo|[Foobar]]]
19235 [[Foo|<nowiki>Foobar]</nowiki>]]
19236 [[Foo|x [Foobar] x]]
19237 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19238 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19239 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19240 [[Foo|<nowiki>|Bar</nowiki>]]
19241 [[Foo|<nowiki>]]bar</nowiki>]]
19242 [[Foo|<nowiki>[[bar</nowiki>]]
19243 [[Foo|<nowiki>x [[ y</nowiki>]]
19244 [[Foo|<nowiki>x ]] y</nowiki>]]
19245 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19246 !! html
19247 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19248 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19249 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19250 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19251 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19252 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19253 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19254 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19255 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19256 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19257 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19258 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19259 !! end
19260
19261 !! test
19262 Links 3. WikiLinks: No escapes needed
19263 !! options
19264 parsoid
19265 !! wikitext
19266 [[Foo|[Foobar]]
19267 [[Foo|foo|bar]]
19268 !! html
19269 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19270 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19271 !! end
19272
19273 !! test
19274 Links 4. ExtLinks: Escapes needed
19275 !! options
19276 parsoid
19277 !! wikitext
19278 [http://google.com <nowiki>[google]</nowiki>]
19279 [http://google.com <nowiki>google]</nowiki>]
19280
19281 <nowiki>[http://google.com]</nowiki>
19282
19283 <nowiki>[http://google.com google]</nowiki>
19284
19285 !! html
19286 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19287 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19288 <p>[http://google.com]</p>
19289 <p>[http://google.com google]</p>
19290 !! end
19291
19292 !! test
19293 Links 5. ExtLinks: No escapes needed
19294 !! options
19295 parsoid
19296 !! wikitext
19297 [http://google.com [google]
19298 !! html
19299 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19300 !! end
19301
19302 !! test
19303 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19304 !! html/parsoid
19305 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19306 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19307 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19308 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19309 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19310 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19311 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19312 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19313 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19314 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19315 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19316 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19317 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19318 </p>
19319 !! wikitext
19320 x<nowiki/>http://example.com<nowiki/>y
19321 http://example.com<nowiki/>?x
19322 http://example.com<nowiki/>&x
19323 http://example.com<nowiki/>'x
19324 http://example.com<nowiki/>,x
19325 http://example.com<nowiki/>.x
19326 http://example.com<nowiki/>;x
19327 http://example.com<nowiki/>:x
19328 http://example.com<nowiki/>;x
19329 http://example.com<nowiki/>!x
19330 http://example.com<nowiki/>=x
19331 http://example.com<nowiki/>(x)
19332 http://example.com(x<nowiki/>)
19333 !! end
19334
19335 !! test
19336 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19337 !! html/parsoid
19338 <p>x
19339 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19340 y
19341 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19342 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19343 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19344 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19345 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19346 </p>
19347 !! wikitext
19348 x
19349 http://example.com
19350 y
19351 "http://example.com"
19352 (http://example.com)
19353 (http://example.com) foo
19354 http://example.com,
19355 http://example.com, foo
19356 !! end
19357
19358 ## Parsoid currently fails wt2html on this one!
19359 !! test
19360 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19361 !! html/parsoid
19362 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19363 !! wikitext
19364 http://example.com.,;:!?
19365 !! end
19366
19367 !! test
19368 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19369 !! html/parsoid
19370 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19371 !! wikitext
19372 RFC 123<nowiki/>4
19373 !! end
19374
19375 !! test
19376 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19377 !! html/parsoid
19378 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19379 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19380 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19381 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19382 </p>
19383 !! wikitext
19384 xRFC 123y
19385 XRFC 123y
19386 RFC 123?foo
19387 RFC 123&foo
19388 !! end
19389
19390 !! test
19391 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19392 !! html/parsoid
19393 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19394 !! wikitext
19395 PMID 123<nowiki/>4
19396 !! end
19397
19398 !! test
19399 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19400 !! html/parsoid
19401 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19402 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19403 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19404 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19405 </p>
19406 !! wikitext
19407 xPMID 123y
19408 XPMID 123y
19409 PMID 123?foo
19410 PMID 123&foo
19411 !! end
19412
19413 !! test
19414 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19415 !! html/parsoid
19416 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19417 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19418 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19419 </p>
19420 !! wikitext
19421 ISBN 1234567890<nowiki/>1
19422 ISBN 1234567890<nowiki/>x
19423 ISBN 1234567890<nowiki/>b
19424 !! end
19425
19426 !! test
19427 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19428 !! html/parsoid
19429 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19430 !! wikitext
19431 ISBN 1234567890's
19432 !! end
19433
19434 #### --------------- Quotes ---------------
19435 #### 1. Quotes inside <b> and <i>
19436 #### 2. Link fragments separated by <i> and <b> tags
19437 #### 3. Link fragments inside <i> and <b>
19438 #### 4. No escaping needed
19439 #### --------------------------------------
19440 !! test
19441 1. Quotes inside <b> and <i>
19442 !! options
19443 parsoid=html2wt,wt2wt
19444 !! wikitext
19445 ''<nowiki>'foo'</nowiki>''
19446 ''<nowiki>''foo''</nowiki>''
19447 ''<nowiki>'''foo'''</nowiki>''
19448 ''foo''<nowiki/>'s
19449 '''<nowiki>'foo'</nowiki>'''
19450 '''<nowiki>''foo''</nowiki>'''
19451 '''<nowiki>'''foo'''</nowiki>'''
19452 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19453 '''foo'''<nowiki/>'s
19454 '''foo''
19455 ''foo''<nowiki/>'
19456 '<nowiki/>''foo''<nowiki/>'
19457 ''''foo'''
19458 '''foo'''<nowiki/>'
19459 '<nowiki/>'''foo'''<nowiki/>'
19460 ''fools'<span> errand</span>''
19461 ''<span>fool</span>'s errand''
19462 !! html
19463 <p><i>'foo'</i>
19464 <i>''foo''</i>
19465 <i>'''foo'''</i>
19466 <i>foo</i>'s
19467 <b>'foo'</b>
19468 <b>''foo''</b>
19469 <b>'''foo'''</b>
19470 <b>foo'<i>bar'</i>baz</b>
19471 <b>foo</b>'s
19472 '<i>foo</i>
19473 <i>foo</i>'
19474 '<i>foo</i>'
19475 '<b>foo</b>
19476 <b>foo</b>'
19477 '<b>foo</b>'</p>
19478 <i>fools'<span> errand</span></i>
19479 <i><span>fool</span>'s errand</i>
19480 !! end
19481
19482 !! test
19483 2. Link fragments separated by <i> and <b> tags
19484 !! wikitext
19485 [[''foo''<nowiki>hello]]</nowiki>
19486
19487 [['''foo'''<nowiki>hello]]</nowiki>
19488 !! html
19489 <p>[[<i>foo</i>hello]]
19490 </p><p>[[<b>foo</b>hello]]
19491 </p>
19492 !! end
19493
19494 !! test
19495 3. Link fragments inside <i> and <b>
19496 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19497 this is one of the shortcomings of this format)
19498 !! wikitext
19499 ''[[foo''<nowiki>]]</nowiki>
19500
19501 '''[[foo'''<nowiki>]]</nowiki>
19502 !! html
19503 <p><i>[[foo</i>]]
19504 </p><p><b>[[foo</b>]]
19505 </p>
19506 !! end
19507
19508 !! test
19509 4. No escaping needed
19510 !! wikitext
19511 '<span>''bar''</span>'
19512 '<span>'''bar'''</span>'
19513 !! html
19514 <p>'<span><i>bar</i></span>'
19515 '<span><b>bar</b></span>'
19516 </p>
19517 !! end
19518
19519 #### ----------- Paragraphs ---------------
19520 #### 1. No unnecessary escapes
19521 #### --------------------------------------
19522
19523 !! test
19524 1. No unnecessary escapes
19525 !! wikitext
19526 bar <span><nowiki>[[foo]]</nowiki></span>
19527
19528 =bar <span><nowiki>[[foo]]</nowiki></span>
19529
19530 [[bar <span><nowiki>[[foo]]</nowiki></span>
19531
19532 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19533
19534 =bar <span>foo]]</span><nowiki>=</nowiki>
19535 !! html
19536 <p>bar <span>[[foo]]</span>
19537 </p><p>=bar <span>[[foo]]</span>
19538 </p><p>[[bar <span>[[foo]]</span>
19539 </p><p>]]bar <span>[[foo]]</span>
19540 </p><p>=bar <span>foo]]</span>=
19541 </p>
19542 !!end
19543
19544 #### ----------------------- PRE --------------------------
19545 #### 1. Leading whitespace in SOL context should be escaped
19546 #### ------------------------------------------------------
19547 !! test
19548 1. Leading whitespace in SOL context should be escaped
19549 !! options
19550 parsoid
19551 !! wikitext
19552 <nowiki> </nowiki>a
19553
19554 <nowiki> </nowiki> a
19555
19556 <nowiki> </nowiki>a(tab)
19557
19558 <nowiki> </nowiki> a
19559 <!--cmt-->
19560 <nowiki> </nowiki> a
19561
19562 a
19563 <nowiki> </nowiki>b
19564
19565 a
19566 <nowiki> </nowiki>b
19567
19568 a
19569 <nowiki> </nowiki> b
19570 !! html
19571 <p> a</p>
19572 <p> a</p>
19573 <p> a(tab)</p>
19574 <p> a</p>
19575 <p><!--cmt--> a</p>
19576 <p>a
19577 b</p>
19578 <p>a
19579 b</p>
19580 <p>a
19581 b</p>
19582 !! end
19583
19584 !! test
19585 2. Leading whitespace in non-indent-pre contexts should not be escaped
19586 !! options
19587 parsoid
19588 !! wikitext
19589 foo <ref>''a''
19590 b</ref>
19591 !! html
19592 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19593 !! end
19594
19595 !! test
19596 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19597 !! options
19598 parsoid
19599 !! wikitext
19600 <blockquote>
19601 a
19602 <span>b</span>
19603 c
19604 </blockquote>
19605 !! html
19606 <blockquote>
19607 <p>
19608 a
19609 <span>b</span>
19610 c</p>
19611 </blockquote>
19612 !! end
19613
19614 !! test
19615 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19616 !! options
19617 parsoid
19618 !! wikitext
19619 [[File:Foobar.jpg|thumb|caption]]
19620 !! html
19621 !! html/parsoid
19622 <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>
19623 !! end
19624
19625 #### --------------- Behavior Switches --------------------
19626 !! test
19627 1. Valid behavior switches should be escaped
19628 !! options
19629 parsoid=html2wt
19630 !! wikitext
19631 <nowiki>__TOC__</nowiki>
19632 ''<nowiki>__TOC__</nowiki>''
19633 !! html
19634 __TOC__
19635 <i>__TOC__</i>
19636 !! end
19637
19638 !! test
19639 2. Invalid behavior switches should not be escaped
19640 !! options
19641 parsoid=html2wt
19642 !! wikitext
19643 __TOO__
19644 __|__
19645 !! html
19646 __TOO__
19647 __|__
19648 !! end
19649
19650 #### --------------- HTML tags ---------------
19651 #### 1. a tags
19652 #### 2. other tags
19653 #### 3. multi-line html tag
19654 #### 4. extension tags
19655 #### -----------------------------------------
19656 !! test
19657 1. a tags
19658 !! options
19659 parsoid
19660 !! wikitext
19661 <a href="http://google.com">google</a>
19662 !! html
19663 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19664 !! end
19665
19666 !! test
19667 2. other tags
19668 !! wikitext
19669 <nowiki><div>foo</div>
19670 <div style="color:red">foo</div></nowiki>
19671 !! html
19672 <p>&lt;div&gt;foo&lt;/div&gt;
19673 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19674 </p>
19675 !! end
19676
19677 !! test
19678 3. multi-line html tag
19679 !! wikitext
19680 <nowiki><div
19681 >foo</div
19682 ></nowiki>
19683 !! html
19684 <p>&lt;div
19685 &gt;foo&lt;/div
19686 &gt;
19687 </p>
19688 !! end
19689
19690 !! test
19691 4. extension tags
19692 !! wikitext
19693 <nowiki><ref>foo</ref></nowiki>
19694
19695 <nowiki><ref>bar</nowiki>
19696
19697 baz<nowiki></ref></nowiki>
19698 !! html
19699 <p>&lt;ref&gt;foo&lt;/ref&gt;
19700 </p><p>&lt;ref&gt;bar
19701 </p><p>baz&lt;/ref&gt;
19702 </p>
19703 !! end
19704
19705 #### --------------- Others ---------------
19706 !! test
19707 Escaping nowikis
19708 !! wikitext
19709 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19710 !! html
19711 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19712 </p>
19713 !! end
19714
19715 ## The quote-char in the input is necessary for triggering the bug
19716 !! test
19717 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19718 !! options
19719 parsoid=wt2wt,html2wt
19720 !! wikitext
19721 foo's bar :
19722 !! html
19723 <p>foo's bar :</p>
19724 !! end
19725
19726 !! test
19727
19728 Tag-like HTML structures are passed through as text
19729 !! wikitext
19730 <x y>
19731
19732 <x.y>
19733
19734 <x-y>
19735
19736 1>2
19737
19738 x<y
19739
19740 a>b
19741
19742 1<d e>f
19743 !! html
19744 <p>&lt;x y&gt;
19745 </p><p>&lt;x.y&gt;
19746 </p><p>&lt;x-y&gt;
19747 </p><p>1&gt;2
19748 </p><p>x&lt;y
19749 </p><p>a&gt;b
19750 </p><p>1&lt;d e&gt;f
19751 </p>
19752 !! end
19753
19754
19755 # This was a bug in the PHP parser (see bug 17663 and its dups,
19756 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19757 !! test
19758 Tag names followed by punctuation should not be recognized as tags
19759 !! wikitext
19760 <s.ome> text
19761 !! html
19762 <p>&lt;s.ome&gt; text
19763 </p>
19764 !! end
19765
19766 !! test
19767 HTML tag with necessary entities in attributes
19768 !! wikitext
19769 <span title="&amp;amp;">foo</span>
19770 !! html
19771 <p><span title="&amp;amp;">foo</span>
19772 </p>
19773 !! end
19774
19775 !! test
19776 HTML tag with 'unnecessary' entity encoding in attributes
19777 !! wikitext
19778 <span title="&amp;">foo</span>
19779 !! html
19780 <p><span title="&amp;">foo</span>
19781 </p>
19782 !! end
19783
19784 !! test
19785 HTML tag with broken attribute value quoting
19786 !! wikitext
19787 <span title="Hello world>Foo</span>
19788 !! html
19789 <p><span>Foo</span>
19790 </p>
19791 !! end
19792
19793 !! test
19794 Parsoid-only: HTML tag with broken attribute value quoting
19795 !! options
19796 parsoid
19797 !! wikitext
19798 <span title="Hello world>Foo</span>
19799 !! html
19800 <p><span title="Hello world">Foo</span>
19801 </p>
19802 !! end
19803
19804 !! test
19805 Table with broken attribute value quoting
19806 !! wikitext
19807 {|
19808 | title="Hello world|Foo
19809 |}
19810 !! html
19811 <table>
19812 <tr>
19813 <td>Foo
19814 </td></tr></table>
19815
19816 !! end
19817
19818 !! test
19819 Table with broken attribute value quoting on consecutive lines
19820 !! wikitext
19821 {|
19822 | title="Hello world|Foo
19823 | style="color:red|Bar
19824 |}
19825 !! html
19826 <table>
19827 <tr>
19828 <td>Foo
19829 </td>
19830 <td>Bar
19831 </td></tr></table>
19832
19833 !! end
19834
19835 !! test
19836 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19837 !! options
19838 parsoid
19839 !! wikitext
19840 {|
19841 | title="Hello world|Foo
19842 | style="color:red|Bar
19843 |}
19844 !! html
19845 <table><tbody>
19846 <tr>
19847 <td title="Hello world">Foo
19848 </td><td style="color: red">Bar
19849 </td></tr></tbody></table>
19850
19851 !! end
19852
19853 !! test
19854 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19855 !! options
19856 parsoid
19857 !! wikitext
19858 {{}}
19859 !! html
19860 {{}}
19861 !! end
19862
19863 !! test
19864 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19865 !! options
19866 parsoid
19867 !! wikitext
19868 }}{{
19869 !! html
19870 }}{{
19871 !! end
19872
19873 !!test
19874 Accept empty td cell attribute
19875 !! wikitext
19876 {|
19877 | align="center" | foo || |
19878 |}
19879 !! html
19880 <table>
19881 <tr>
19882 <td align="center"> foo </td>
19883 <td>
19884 </td></tr></table>
19885
19886 !!end
19887
19888 !!test
19889 Non-empty attributes in th-cells
19890 !! wikitext
19891 {|
19892 ! Foo !! style="color: red" | Bar
19893 |}
19894 !! html
19895 <table>
19896 <tr>
19897 <th> Foo </th>
19898 <th style="color: red"> Bar
19899 </th></tr></table>
19900
19901 !!end
19902
19903 !!test
19904 Accept empty attributes in th-cells
19905 !! wikitext
19906 {|
19907 !| foo !!| bar
19908 |}
19909 !! html
19910 <table>
19911 <tr>
19912 <th> foo </th>
19913 <th> bar
19914 </th></tr></table>
19915
19916 !!end
19917
19918 !!test
19919 Empty table rows go away
19920 !! wikitext
19921 {|
19922 | Hello
19923 | there
19924 |- class="foo"
19925 |-
19926 |}
19927 !! html
19928 <table>
19929 <tr>
19930 <td> Hello
19931 </td>
19932 <td> there
19933 </td></tr>
19934
19935 </table>
19936
19937 !! end
19938
19939 ###
19940 ### Parsoid-centric tests for testing RTing of inter-element separators
19941 ### Edge cases not tested by existing parser tests and specific to
19942 ### Parsoid-specific serialization strategies.
19943 ###
19944
19945 !!test
19946 RT-ed inter-element separators should be valid separators
19947 !! wikitext
19948 {|
19949 |- [[foo]]
19950 |}
19951 !! html
19952 <table>
19953
19954 </table>
19955
19956 !!end
19957
19958 !!test
19959 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19960 (Parsoid-only since PHP parser relies on Tidy for correct output)
19961 !!options
19962 parsoid
19963 !! wikitext
19964 {|
19965 |<small>foo
19966 bar
19967 |}
19968
19969 {|
19970 |<small>foo<small>
19971 |}
19972 !! html
19973 !!end
19974
19975 !!test
19976 Empty TD followed by TD with tpl-generated attribute
19977 !! wikitext
19978 {|
19979 |-
19980 |
19981 |{{echo|style='color:red'}}|foo
19982 |}
19983 !! html
19984 <table>
19985
19986 <tr>
19987 <td>
19988 </td>
19989 <td>foo
19990 </td></tr></table>
19991
19992 !!end
19993
19994 !!test
19995 Indented table with an empty td
19996 !! wikitext
19997 {|
19998 |-
19999 |
20000 |foo
20001 |}
20002 !! html
20003 <table>
20004
20005 <tr>
20006 <td>
20007 </td>
20008 <td>foo
20009 </td></tr></table>
20010
20011 !!end
20012
20013 !!test
20014 Indented block & table
20015 !! wikitext
20016 <div>foo</div>
20017 {|
20018 |foo
20019 |}
20020 !! html/parsoid
20021 <div data-parsoid='{"stx":"html"}'>foo</div>
20022 <table><tbody>
20023 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20024 </tbody></table>
20025 !!end
20026
20027 !! test
20028 Indent and comment before table row
20029 !! wikitext
20030 {|
20031 <!--hi-->|-
20032 | there
20033 |}
20034 !! html/parsoid
20035 <table data-parsoid='{}'>
20036 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20037 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20038 </tbody></table>
20039 !! end
20040
20041 !!test
20042 Empty TR followed by a template-generated TR
20043 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20044 !!options
20045 parsoid
20046 !! wikitext
20047 {|
20048 |-
20049 {{echo|<tr><td>foo</td></tr>}}
20050 |}
20051 !! html
20052 <table>
20053 <tbody>
20054 <tr></tr>
20055 <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}}]}'>
20056 <td>foo</td></tr>
20057 </tbody></table>
20058 !!end
20059
20060 ## PHP and parsoid output differ for this, and since this is primarily
20061 ## for testing Parsoid's serializer, marking this Parsoid only
20062 !!test
20063 Empty TR followed by mixed-ws-comment line should RT correctly
20064 !!options
20065 parsoid
20066 !! wikitext
20067 {|
20068 |-
20069 <!--c-->
20070 |-
20071 <!--c--> <!--d-->
20072 |}
20073 !! html
20074 <table>
20075 <tbody>
20076 <tr></tr>
20077 <!--c-->
20078 <tr>
20079 <!--c--> </tr><!--d-->
20080 </tbody></table>
20081
20082 !!end
20083
20084 !!test
20085 Multi-line image caption generated by templates with/without trailing newlines
20086 !!options
20087 parsoid
20088 !! wikitext
20089 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20090 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20091 !! html
20092 <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>
20093 <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>
20094
20095 !!end
20096
20097 !! test
20098 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20099 !! options
20100 parsoid=html2wt
20101 !! wikitext
20102 <includeonly>foo</includeonly>
20103 new para
20104
20105 [[./Category:Foo]]
20106
20107 = new heading =
20108 !! html
20109 <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>
20110
20111 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20112 !! end
20113
20114 ## PHP emits broken html for this, and since this is primarily
20115 ## a Parsoid serializer test, marking this Parsoid only
20116 !!test
20117 Improperly nested inline or quotes tags with whitespace in between
20118 !!options
20119 parsoid
20120 !! wikitext
20121 <span> <s>x</span> </s>
20122 ''' ''x''' ''
20123 !! html
20124 <p><span> <s>x</s></span><s> </s>
20125 <b> <i>x</i></b><i> </i>
20126 </p>
20127 !!end
20128
20129 !!test
20130 Encapsulate protected attributes from wt
20131 !!options
20132 parsoid
20133 !! wikitext
20134 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20135 !! html
20136 <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>
20137 </body>
20138 !!end
20139
20140 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20141 ## Having nested or stray pre tags results in the attempt to add duplicates,
20142 ## causing an assertion fail. This test tries to prevent that situation.
20143 !!test
20144 Ensure ParagraphWrapper can deal with stray closing pre tags
20145 !!options
20146 parsoid=wt2html
20147 !! wikitext
20148 plain text</pre>
20149 !! html
20150 plain text
20151 !!end
20152
20153 !!test
20154 1. Ensure fostered text content is wrapped in spans
20155 !!options
20156 parsoid=wt2html
20157 !! wikitext
20158 <table>hi</table><table>ho</table>
20159 !! html
20160 <span>hi</span>
20161 <table></table>
20162 <span>ho</span>
20163 <table></table>
20164 !!end
20165
20166 !!test
20167 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20168 !!options
20169 parsoid=wt2html,wt2wt
20170 !! wikitext
20171 <table>
20172 <tr> || ||
20173 <td> a
20174 </table>
20175 !! html
20176 <span> || ||</span>
20177 <table>
20178 <tbody>
20179 <tr>
20180 <td> a</td></tr>
20181 </tbody></table>
20182 !!end
20183
20184 !!test
20185 Encapsulation properly handles null DSR information from foster box
20186 !!options
20187 parsoid=wt2html,wt2wt
20188 !! wikitext
20189 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20190 !! html
20191 <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;
20192 <table>foo
20193 <tr>
20194 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20195 <table>
20196 <tbody>
20197 <tr>
20198 <td>bar</td></tr></tbody></table>
20199 !!end
20200
20201 !!test
20202 1. Encapsulate foster-parented transclusion content
20203 !!options
20204 parsoid=wt2wt,wt2html
20205 !! wikitext
20206 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20207 !! html
20208 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20209 <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
20210 <tr>
20211 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20212 <table>
20213 <tbody>
20214 <tr>
20215 <td>bar</td></tr></tbody></table>
20216 !!end
20217
20218 !!test
20219 2. Encapsulate foster-parented transclusion content
20220 !!options
20221 parsoid=wt2wt,wt2html
20222 !! wikitext
20223 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20224 !! html
20225 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20226 <table>
20227 <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>
20228 <tr>
20229 <td>bar</td></tr></table>&quot;]}">foo</div>
20230 <table>
20231 <tbody>
20232 <tr>
20233 <td>bar</td></tr></tbody></table>
20234 !!end
20235
20236 !!test
20237 3. Encapsulate foster-parented transclusion content
20238 !!options
20239 parsoid=wt2wt,wt2html
20240 !! wikitext
20241 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20242 !! html
20243 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20244 <table>
20245 <div>
20246 <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>
20247 <tr>
20248 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20249 <p>foo</p></div>
20250 <table>
20251 <tbody>
20252 <tr>
20253 <td>bar</td></tr></tbody></table>
20254 !!end
20255
20256 !!test
20257 4. Encapsulate foster-parented transclusion content
20258 !!options
20259 parsoid=wt2wt,wt2html
20260 !! wikitext
20261 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20262 !! html
20263 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20264 <table>
20265 <div>
20266 <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>
20267 <tr>
20268 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20269 <p>foo</p></div>
20270 <table>
20271 <tbody>
20272 <tr>
20273 <td>bar</td></tr></tbody></table>
20274 !!end
20275
20276 !!test
20277 5. Encapsulate foster-parented transclusion content
20278 !!options
20279 parsoid=wt2wt,wt2html
20280 !! wikitext
20281 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20282 !! html
20283 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20284 <table>
20285 <tr>
20286 <td>
20287 <div>
20288 <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>
20289 <table>
20290 <tbody>
20291 <tr>
20292 <td>
20293 <div>
20294 <p>foo</p></div></td></tr></tbody></table>
20295 !!end
20296
20297 !!test
20298 6. Encapsulate foster-parented transclusion content
20299 !!options
20300 parsoid=wt2wt,wt2html
20301 !! wikitext
20302 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20303 !! html
20304 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20305 <table>
20306 <tr>
20307 <td>
20308 <div>
20309 <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>
20310 <table>
20311 <tbody>
20312 <tr>
20313 <td>
20314 <div>
20315 <p>foo</p></div></td></tr></tbody></table>
20316 <p>ok</p>
20317 !!end
20318
20319 !!test
20320 7. Encapsulate foster-parented transclusion content
20321 !!options
20322 parsoid=wt2wt,wt2html
20323 !! wikitext
20324 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20325 !! html
20326 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20327 <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;
20328 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20329 <td>bar</td></table>&quot;]}">foo</p>
20330 <table>
20331 <tbody>
20332 <tr>
20333 <td>bar</td></tr></tbody></table>
20334 !!end
20335
20336 !!test
20337 8. Encapsulate foster-parented transclusion content
20338 !!options
20339 parsoid=wt2wt,wt2html
20340 !! wikitext
20341 {{echo|a
20342 }}{|{{echo|style='color:red'}}
20343 |-
20344 |b
20345 |}
20346 !! html
20347 <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>
20348 <table>
20349 <tbody>
20350 <tr>
20351 <td>b</td></tr></tbody></table>
20352 !!end
20353
20354 !!test
20355 9. Encapsulate foster-parented transclusion content
20356 !!options
20357 parsoid=wt2wt,wt2html
20358 !! wikitext
20359 <table>{{echo|hi</table>hello}}
20360 !! html
20361 <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>
20362 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20363 !!end
20364
20365 !!test
20366 Table in fosterable position
20367 !!options
20368 parsoid=wt2html,wt2wt
20369 !! wikitext
20370 {{OpenTable}}
20371 <div>
20372 {|
20373 |}
20374 </div>
20375 |}
20376 !! html
20377 <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="{}">
20378 </span>
20379 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20380
20381 <table>
20382 </table>
20383 !!end
20384
20385 # Parsoid only for bug 64747
20386 !! test
20387 Properly encapsulate empty-content transclusions in fosterable positions
20388 !! wikitext
20389 <table>
20390 {{#if:|
20391 <td>foo</td>
20392 }}
20393 </table>
20394 !! html/parsoid
20395 <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>"}'>
20396
20397 </table>
20398 !! end
20399
20400 !!test
20401 Support <object> element with .data attribute
20402 !!options
20403 parsoid=html2wt
20404 !! wikitext
20405 <object data="test.swf"></object>
20406 !! html
20407 <object data="test.swf"></object>
20408 !!end
20409
20410 # -----------------------------------------------------------------
20411 # The following section of tests are primarily to spec requirements
20412 # around serialization of new/edited content.
20413 #
20414 # All these tests are marked Parsoid html2wt and html2html only
20415 # ----------------------------------------------------------------
20416
20417 !! test
20418 Image: Modifying size of an image (1)
20419 !! options
20420 parsoid={
20421 "modes": ["wt2wt"],
20422 "changes": [
20423 ["img[height]", "attr", "height", "22"],
20424 ["img[width]", "attr", "width", "200"]
20425 ]
20426 }
20427 !! wikitext
20428 [[Image:Foobar.jpg|230x230px]]
20429 !! wikitext/edited
20430 [[Image:Foobar.jpg|200x200px]]
20431 !!end
20432
20433 !! test
20434 Image: Modifying size of an image (2)
20435 !! options
20436 parsoid={
20437 "modes": ["wt2wt"],
20438 "changes": [
20439 ["img[height]", "attr", "height", "100"],
20440 ["img[width]", "attr", "width", "500"]
20441 ]
20442 }
20443 !! wikitext
20444 [[Image:Foobar.jpg|230x230px]]
20445 !! wikitext/edited
20446 [[Image:Foobar.jpg|500x500px]]
20447 !!end
20448
20449 # Change in size is ignored so long as class='mw-default-size'
20450 !! test
20451 Image: Modifying size of an image (3)
20452 !! options
20453 parsoid={
20454 "modes": ["wt2wt"],
20455 "changes": [
20456 ["figure[class]", "removeClass", "mw-default-size"],
20457 ["figure img", "attr", "height", "19"],
20458 ["figure img", "attr", "width", "170"]
20459 ]
20460 }
20461 !! wikitext
20462 [[Image:Foobar.jpg|thumb]]
20463 !! wikitext/edited
20464 [[Image:Foobar.jpg|thumb|170x170px]]
20465 !!end
20466
20467 !! test
20468 Image: Modifying alignment of an image (bug 48665)
20469 !! options
20470 parsoid={
20471 "modes": ["wt2wt"],
20472 "changes": [
20473 ["figure[class]", "removeClass", "mw-halign-right"],
20474 ["figure[class]", "addClass", "mw-halign-left"]
20475 ]
20476 }
20477 !! wikitext
20478 [[Image:Foobar.jpg|thumb|caption|right]]
20479 !! wikitext/edited
20480 [[Image:Foobar.jpg|thumb|caption|left]]
20481 !! end
20482
20483 !! test
20484 Image: Modifying mw-default-size of an frameless image (bug 62805)
20485 !! options
20486 parsoid={
20487 "modes": ["wt2wt"],
20488 "changes": [
20489 ["figure.mw-default-size", "removeClass", "mw-default-size"]
20490 ]
20491 }
20492 !! wikitext
20493 [[Image:Foobar.jpg|frameless|right]]
20494 !! wikitext/edited
20495 [[Image:Foobar.jpg|frameless|right|220x220px]]
20496 !! end
20497
20498 !! test
20499 Image: Modifying valign of an image (bug 49221)
20500 !! options
20501 parsoid={
20502 "modes": ["wt2wt"],
20503 "changes": [
20504 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20505 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20506 ]
20507 }
20508 !! wikitext
20509 [[File:Foobar.jpg|20px|middle]]
20510 !! wikitext/edited
20511 [[File:Foobar.jpg|20px|text-top]]
20512 !! end
20513
20514 !! test
20515 Image: Modifying alt attribute of an image (bug 56400)
20516 !! options
20517 parsoid={
20518 "modes": ["wt2wt"],
20519 "changes": [
20520 ["img[alt]", "attr", "alt", "some alternate edited text"]
20521 ]
20522 }
20523 !! wikitext
20524 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20525 !! wikitext/edited
20526 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20527 !!end
20528
20529 !! test
20530 Image: Modifying caption of an image
20531 !! options
20532 parsoid={
20533 "modes": ["wt2wt"],
20534 "changes": [
20535 ["figcaption", "text", "new caption"]
20536 ]
20537 }
20538 !! wikitext
20539 [[Image:Foobar.jpg|thumb|original caption]]
20540 !! wikitext/edited
20541 [[Image:Foobar.jpg|thumb|new caption]]
20542 !!end
20543
20544 !! test
20545 Image: empty alt attribute (bug 48924)
20546 !! options
20547 parsoid
20548 !! wikitext
20549 [[File:Foobar.jpg|thumb|alt=|bar]]
20550 !! html
20551 <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>
20552 !! end
20553
20554 #!! test
20555 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20556 #!! options
20557 #parsoid=html2wt
20558 #language=ar
20559 #!! input
20560 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20561 #!! result
20562 #<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>
20563 #!! end
20564
20565 !! test
20566 Image: Block level image should have \n before and after
20567 !! options
20568 parsoid
20569 !! wikitext
20570 123
20571 [[File:Foobar.jpg|right|thumb|150x150px]]
20572 456
20573 !! html
20574 <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>
20575 !!end
20576
20577 !! test
20578 Image: New block level image should have \n before and after (existing
20579 content)
20580 !! options
20581 parsoid
20582 !! wikitext
20583 123
20584 [[File:Foobar.jpg|right|thumb|150x150px]]
20585 456
20586 !! html
20587 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20588 <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>
20589 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20590 !!end
20591
20592 !! test
20593 Image: upright option (parsoid)
20594 !! options
20595 parsoid
20596 !! wikitext
20597 [[File:Foobar.jpg|thumb|upright|caption]]
20598 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20599 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20600 !! html
20601 <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>
20602 !!end
20603
20604 !! test
20605 Image: upright option is ignored on inline and frame images (parsoid)
20606 !! options
20607 parsoid
20608 !! wikitext
20609 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20610 !! html
20611 <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>
20612 !!end
20613
20614 !! test
20615 Image: from basic HTML (1)
20616 !! options
20617 parsoid=html2wt
20618 !! html/parsoid
20619 <span typeof="mw:Image">
20620 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20621 </span>
20622 !! wikitext
20623 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20624 !! end
20625
20626 !! test
20627 Image: from basic HTML (2)
20628 !! options
20629 parsoid=html2wt
20630 !! html/parsoid
20631 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20632 !! wikitext
20633 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20634 !! end
20635
20636 !! test
20637 Image: from basic HTML (3)
20638 !! options
20639 parsoid=html2wt
20640 !! html/parsoid
20641 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20642 !! wikitext
20643 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20644 !! end
20645
20646 !! test
20647 Image: from basic HTML (4)
20648 !! options
20649 parsoid=html2wt
20650 !! html/parsoid
20651 <img src="File:Foobar.jpg">
20652 !! wikitext
20653 [[File:Foobar.jpg|link=]]
20654 !! end
20655
20656 !! test
20657 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20658 !! options
20659 parsoid=html2wt
20660 !! wikitext
20661 * foo
20662 !! html
20663 <ul>
20664 <li><p>foo</p></li>
20665 </ul>
20666 !! end
20667
20668 !! test
20669 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20670 !! options
20671 parsoid=html2wt
20672 !! wikitext
20673 * foo
20674 !! html
20675 <ul> <li>foo</li></ul>
20676 !! end
20677
20678 !! test
20679 Don't strip leading whitespace when handling indent-pre suppressing tags
20680 !! options
20681 parsoid=html2wt
20682 !! wikitext
20683 {|
20684 | indented row
20685 |}
20686 <blockquote>
20687 '''This is very bold of you!'''
20688
20689 {|
20690 |
20691 indented cell (no pre-wrapping!)
20692 |}
20693 </blockquote>
20694 foo
20695 <div>bar</div>
20696 !! html
20697 <table>
20698 <tr><td> indented row</td></tr>
20699 </table>
20700 <blockquote><p>
20701 <b>This is very bold of you!</b>
20702 </p>
20703 <table><tr><td>
20704 indented cell (no pre-wrapping!)
20705 </td></tr></table>
20706 </blockquote>
20707 <p>foo</p>
20708 <div>bar</div>
20709 !! end
20710
20711 !! test
20712 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20713 !! options
20714 parsoid=html2wt
20715 !! wikitext
20716 foo
20717 <nowiki> </nowiki><span>bar</span>
20718
20719 <span>foo2
20720 <nowiki> </nowiki></span>bar2
20721
20722 <div>foo</div>
20723 <nowiki> </nowiki><span>bar</span>
20724
20725 <div>
20726 <nowiki> </nowiki><span>foo</span>
20727 </div>
20728 !! html
20729 <p>foo</p>
20730 <span>bar</span>
20731
20732 <span>foo2
20733 </span>bar2
20734
20735 <div>foo</div>
20736 <span>bar</span>
20737
20738 <div>
20739 <span>foo</span>
20740 </div>
20741 !! end
20742
20743 !! test
20744 Lists: Add space after bullets
20745 !! options
20746 parsoid=html2wt
20747 !! wikitext
20748 * foo
20749 * bar
20750 * <span> baz</span>
20751 !! html
20752 <ul>
20753 <li>foo</li>
20754 <li> bar</li>
20755 <li><span> baz</span></li>
20756 </ul>
20757 !! end
20758
20759 !! test
20760 Lists: Dont insert newlines in a serialized list item.
20761 !! options
20762 parsoid=html2wt
20763 !! wikitext
20764 * a<br>b
20765 * c
20766 !! html
20767 <ul><li>a<br>b</li><li>c</li></ul>
20768 !! end
20769
20770 !! test
20771 Headings: Add space before/after == (Bug 51744)
20772 !! options
20773 parsoid=html2wt
20774 !! wikitext
20775 == foo ==
20776
20777 == bar ==
20778
20779 == baz ==
20780
20781 == <span> baz</span> ==
20782 !! html
20783 <h2>foo</h2>
20784 <h2> bar</h2>
20785 <h2>baz </h2>
20786 <h2><span> baz</span></h2>
20787 !! end
20788
20789 !! test
20790 Parsoid: Serialize positional parameters with = in them as named parameter
20791 !! options
20792 parsoid=html2wt
20793 !! wikitext
20794 {{echo|1 = f=oo}}
20795
20796 {{echo|1 = f=oo|2 = bar}}
20797
20798 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20799 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20800 {{echo|<nowiki>f=oo</nowiki>|bar}}
20801 !! html
20802 <p about="#mwt1" typeof="mw:Transclusion"
20803 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20804
20805 <p about="#mwt1" typeof="mw:Transclusion"
20806 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20807
20808 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20809 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20810 <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>
20811 !! end
20812
20813 !! test
20814 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20815 !! options
20816 parsoid=html2wt
20817 !! wikitext
20818 <div>a
20819 b
20820 </div>
20821 <div>a
20822 b
20823 </div>
20824 <div>
20825 a
20826
20827 b
20828 </div>
20829 !! html
20830 <div>a<p>b</p></div>
20831 <div>a
20832 <p>b</p></div>
20833 <div>
20834 a
20835 <p>b</p></div>
20836 !! end
20837
20838 !! test
20839 Substrings resembling wikitext in hrefs should not get nowiki escapes
20840 !! options
20841 parsoid=html2wt
20842 !! wikitext
20843 [[Foo''bar''baz]]
20844 !! html
20845 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20846 !! end
20847
20848 #-----------------------------
20849 # I/B quote minimization tests
20850 #-----------------------------
20851
20852 !! test
20853 1. I/B quote minimization: wikitext-only tags should be combined
20854 !! options
20855 parsoid=html2wt
20856 !! wikitext
20857 ''AB''
20858
20859 '''AB'''
20860
20861 ''A'''B'''''
20862
20863 '''A''B'''''
20864
20865 '''A''BC''D'''
20866
20867 '''''AB'''''
20868
20869 '''''AB'''''
20870
20871 '''''AB'''''
20872 !! html
20873 <p><i>A</i><i>B</i></p>
20874 <p><b>A</b><b>B</b></p>
20875 <p><i>A</i><b><i>B</i></b></p>
20876 <p><b>A</b><i><b>B</b></i></p>
20877 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20878 <p><i><b>A</b></i><i><b>B</b></i></p>
20879 <p><i><b>A</b></i><b><i>B</i></b></p>
20880 <p><b><i>A</i></b><i><b>B</b></i></p>
20881 !! end
20882
20883 !! test
20884 2. I/B quote minimization: wikitext and html tags should not be combined
20885 !! options
20886 parsoid=html2wt
20887 !! wikitext
20888 ''A''<i>B</i>
20889
20890 ''A'''''<i>B</i>'''
20891 !! html
20892 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20893 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20894 !! end
20895
20896 !! test
20897 3. I/B quote minimization: templated content stops minimization
20898 !! options
20899 parsoid=html2wt
20900 !! wikitext
20901 ''A''{{echo|''B''}}
20902
20903 ''A''{{echo|'''''B'''''}}
20904 !! html
20905 <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>
20906 <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>
20907 !! end
20908
20909 !! test
20910 4. I/B quote minimization: new content should be mimimized with adjacent old content
20911 !! options
20912 parsoid=html2wt
20913 !! wikitext
20914 ''AB''
20915
20916 '''AB'''
20917
20918 ''A'''B'''''
20919 !! html
20920 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20921 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20922 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20923 !! end
20924
20925 #------------------------------------
20926 # End of I/B quote minimization tests
20927 #------------------------------------
20928
20929 !!test
20930 Bug 54262: New entities
20931 !! options
20932 parsoid=html2wt
20933 !! wikitext
20934 &nbsp;
20935 !! html
20936 <span typeof="mw:Entity">&nbsp;</span>
20937 !! end
20938
20939 ## Note that there is no wikitext output for 'unknownproperty' ##
20940 ## Unknown magic words are silently dropped ##
20941
20942 !! test
20943 Magic words
20944 !! options
20945 parsoid=html2wt
20946 !! wikitext
20947 __TOC__
20948 __NOTOC__
20949 __FORCETOC__
20950 __INDEX__
20951 __NOINDEX__
20952 __NOGALLERY__
20953 __NOEDITSECTION__
20954 __NOTITLECONVERT__
20955 __NOCONTENTCONVERT__
20956 !! html
20957 <meta property='mw:PageProp/toc' />
20958 <meta property='mw:PageProp/notoc' />
20959 <meta property='mw:PageProp/forcetoc' />
20960 <meta property='mw:PageProp/index' />
20961 <meta property='mw:PageProp/noindex' />
20962 <meta property='mw:PageProp/nogallery' />
20963 <meta property='mw:PageProp/noeditsection' />
20964 <meta property='mw:PageProp/notitleconvert' />
20965 <meta property='mw:PageProp/nocontentconvert' />
20966 <meta property='mw:PageProp/unknownproperty' />
20967 !! end
20968
20969 !! test
20970 Consecutive <pre>s should not get merged
20971 !! options
20972 parsoid=html2wt,html2html
20973 !! wikitext
20974 a
20975
20976 b
20977
20978 c
20979
20980 d
20981
20982 e
20983
20984
20985
20986 f
20987 !! html
20988 <pre>a</pre><pre>b</pre>
20989
20990 <pre>c
20991 </pre><pre>
20992 d</pre>
20993
20994 <pre>e
20995
20996 </pre><pre>
20997
20998 f</pre>
20999 !! end
21000
21001 !! test
21002 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21003 !! options
21004 parsoid=html2wt
21005 !! wikitext
21006 [[Special:BookSources/1234567890|ISBN 1234567895]]
21007 !! html
21008 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21009 !! end
21010
21011 !! test
21012 Edited RFC links not serializable as RFC links should serialize as extlinks
21013 !! options
21014 parsoid=html2wt
21015 !! wikitext
21016 [//tools.ietf.org/html/rfc123 New RFC]
21017 !! html
21018 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21019 !! end
21020
21021 !! test
21022 Edited PMID links not serializable as PMID links should serialize as extlinks
21023 !! options
21024 parsoid=html2wt
21025 !! wikitext
21026 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21027 !! html
21028 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21029 !! end
21030
21031 !! test
21032 Edited Redirect link should emit a non-piped wikitext link
21033 !! options
21034 parsoid=html2wt
21035 !! wikitext
21036 #REDIRECT [[Bar]]
21037 !! html
21038 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21039 !! end
21040
21041 # -----------------------------------------------------------------
21042 # End of section for Parsoid-only html2wt tests for serialization
21043 # of new content
21044 # -----------------------------------------------------------------
21045
21046 TODO:
21047 more images
21048 more tables
21049 character entities
21050 and much more
21051 Try for 100% code coverage