Merge "Remove unneeded spaces inside html in NoLocalSettings.php"
[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 Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
60
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
65
66 !! article
67 Template:pipe
68 !! text
69 |
70 !! endarticle
71
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
77
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
83
84 !! article
85 Template:tbl-start
86 !! text
87 {|
88 !! endarticle
89
90 !! article
91 Template:tbl-end
92 !! text
93 |}
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 ###
159 ### Basic tests
160 ###
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
166
167
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
180 foo
181
182 bar
183
184
185 baz
186
187
188
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
194 baz
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
199
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
204 a
205 <!--foo-->
206 b
207 ----
208 a
209 <!--foo--><!--More than 1 comment, still stripped-->
210 b
211 ----
212 a
213 <!--foo--> <!----> <!-- bar -->
214 b
215 ----
216 a
217 <!--foo-->
218
219 b
220 ----
221 a
222
223 <!--foo-->
224 b
225 ----
226 a
227 <!--foo-->
228
229
230 b
231 ----
232 a
233
234
235 <!--foo-->
236 b
237 ----
238 !! html
239 <hr />
240 <p>a
241 b
242 </p>
243 <hr />
244 <p>a
245 b
246 </p>
247 <hr />
248 <p>a
249 b
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
262 b
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
267 b
268 </p>
269 <hr />
270
271 !! end
272
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
277 a
278
279 b
280 ----
281 a
282
283
284 b
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br />
294 b
295 </p>
296 <hr />
297
298 !! end
299
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
304 a
305 <!--foo-->
306 b
307 ----
308 a
309 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316 b
317 ----
318 a
319
320 <!--foo-->
321 <!--bar-->
322
323 b
324 ----
325 !! html
326 <hr />
327 <p>a
328 b
329 </p>
330 <hr />
331 <p>a
332 b
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br />
341 b
342 </p>
343 <hr />
344
345 !! end
346
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
350 a
351
352 <!--boo-->
353
354 b
355 !! html
356 <p>a
357 </p><p><br />
358 b
359 </p>
360 !!end
361
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
365 a
366
367
368
369 =b=
370 [[a]]
371
372
373 =b=
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
383
384 !! end
385
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
389 =b=
390
391
392
393 [[a]]
394 !! html
395 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
399
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
409
410 # Note that the html+tidy output removes the spaces after the <li>,
411 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
412 # This is an issue for all tests with lists. We intentionally do
413 # *not* add html+tidy clauses for these, as we don't want to
414 # document/test the broken behavior. (Parsoid matches the non-tidy
415 # output in these cases.)
416
417 !! test
418 Simple list
419 !! wikitext
420 * Item 1
421 * Item 2
422 !! html
423 <ul><li> Item 1</li>
424 <li> Item 2</li></ul>
425
426 !! end
427
428 !! test
429 Italics and bold
430 !! wikitext
431 * plain
432 * plain''italic''plain
433 * plain''italic''plain''italic''plain
434 * plain'''bold'''plain
435 * plain'''bold'''plain'''bold'''plain
436 * plain''italic''plain'''bold'''plain
437 * plain'''bold'''plain''italic''plain
438 * plain''italic'''bold-italic'''italic''plain
439 * plain'''bold''bold-italic''bold'''plain
440 * plain'''''bold-italic'''italic''plain
441 * plain'''''bold-italic''bold'''plain
442 * plain''italic'''bold-italic'''''plain
443 * plain'''bold''bold-italic'''''plain
444 * plain l'''italic''plain
445 * plain l''''bold''' plain
446 !! html
447 <ul><li> plain</li>
448 <li> plain<i>italic</i>plain</li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
450 <li> plain<b>bold</b>plain</li>
451 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
453 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
454 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
455 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
456 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
457 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
458 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
459 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
460 <li> plain l'<i>italic</i>plain</li>
461 <li> plain l'<b>bold</b> plain</li></ul>
462
463 !! end
464
465 # this example taken from the [[simple:Moon]] article (bug 47326)
466 !! test
467 Italics and possessives (1)
468 !! wikitext
469 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
470 !! html
471 <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
472 </p>
473 !! end
474
475 # this example taken from [[en:Flaming Pie]] (bug 49926)
476 !! test
477 Italics and possessives (2)
478 !! wikitext
479 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
480 !! html
481 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
482 </p>
483 !! end
484
485 # this example taken from [[en:Dictionary]] (bug 49926)
486 !! test
487 Italics and possessives (3)
488 !! wikitext
489 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''.
490 !! html
491 <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>.
492 </p>
493 !! end
494
495
496 ###
497 ### 2-quote opening sequence tests
498 ###
499 !! test
500 Italics and bold: 2-quote opening sequence: (2,2)
501 !! wikitext
502 ''foo''
503 !! html
504 <p><i>foo</i>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3)
511 !! options
512 parsoid=wt2html
513 !! wikitext
514 ''foo'''
515 !! html/*
516 <p><i>foo'</i>
517 </p>
518 !!end
519
520
521 # same html as previous, but wikitext adjusted to match parsoid html2wt
522 !! test
523 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
524 !! wikitext
525 ''<nowiki>foo'</nowiki>''
526 !! html
527 <p><i>foo'</i>
528 </p>
529 !! end
530
531
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4)
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 ''foo''''
538 !! html/*
539 <p><i>foo''</i>
540 </p>
541 !!end
542
543
544 # same html as previous, but wikitext adjusted to match parsoid html2wt
545 !! test
546 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
547 !! wikitext
548 ''<nowiki>foo''</nowiki>''
549 !! html
550 <p><i>foo''</i>
551 </p>
552 !! end
553
554
555 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
556 !! test
557 Italics and bold: 2-quote opening sequence: (2,5)
558 !! options
559 parsoid=wt2html
560 !! wikitext
561 ''foo'''''
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 # same html as previous, but wikitext adjusted to match parsoid html2wt
571 !! test
572 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
573 !! wikitext
574 ''foo'''''<nowiki/>'''
575 !! html/php
576 <p><i>foo</i>
577 </p>
578 !! html/parsoid
579 <p><i>foo</i><b></b>
580 </p>
581 !! end
582
583
584 ###
585 ### 3-quote opening sequence tests
586 ###
587
588 !! test
589 Italics and bold: 3-quote opening sequence: (3,2)
590 !! wikitext
591 '''foo''
592 !! html
593 <p>'<i>foo</i>
594 </p>
595 !!end
596
597
598 !! test
599 Italics and bold: 3-quote opening sequence: (3,3)
600 !! wikitext
601 '''foo'''
602 !! html
603 <p><b>foo</b>
604 </p>
605 !!end
606
607
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4)
610 !! options
611 parsoid=wt2html
612 !! wikitext
613 '''foo''''
614 !! html/*
615 <p><b>foo'</b>
616 </p>
617 !!end
618
619
620 # same html as previous, but wikitext adjusted to match parsoid html2wt
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
623 !! wikitext
624 '''<nowiki>foo'</nowiki>'''
625 !! html
626 <p><b>foo'</b>
627 </p>
628 !! end
629
630
631 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
632 !! test
633 Italics and bold: 3-quote opening sequence: (3,5)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 '''foo'''''
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 # same html as previous, but wikitext adjusted to match parsoid html2wt
647 !! test
648 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
649 !! wikitext
650 '''foo'''''<nowiki/>''
651 !! html/php
652 <p><b>foo</b>
653 </p>
654 !! html/parsoid
655 <p><b>foo</b><i></i>
656 </p>
657 !! end
658
659
660 ###
661 ### 4-quote opening sequence tests
662 ###
663
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''''foo''
670 !! html/*
671 <p>''<i>foo</i>
672 </p>
673 !!end
674
675
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
679 !! wikitext
680 <nowiki>''</nowiki>''foo''
681 !! html
682 <p>''<i>foo</i>
683 </p>
684 !! end
685
686
687 !! test
688 Italics and bold: 4-quote opening sequence: (4,3)
689 !! wikitext
690 ''''foo'''
691 !! html
692 <p>'<b>foo</b>
693 </p>
694 !!end
695
696
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''''
703 !! html/*
704 <p>'<b>foo'</b>
705 </p>
706 !!end
707
708
709 # same html as previous, but wikitext adjusted to match parsoid html2wt
710 !! test
711 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
712 !! wikitext
713 ''''<nowiki>foo'</nowiki>'''
714 !! html
715 <p>'<b>foo'</b>
716 </p>
717 !! end
718
719
720 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,5)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''''
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 # same html as previous, but wikitext adjusted to match parsoid html2wt
736 !! test
737 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
738 !! wikitext
739 ''''foo'''''<nowiki/>''
740 !! html/php
741 <p>'<b>foo</b>
742 </p>
743 !! html/parsoid
744 <p>'<b>foo</b><i></i>
745 </p>
746 !! end
747
748
749 ###
750 ### 5-quote opening sequence tests
751 ###
752
753 !! test
754 Italics and bold: 5-quote opening sequence: (5,2)
755 !! options
756 parsoid=wt2html
757 !! wikitext
758 '''''foo''
759 !! html/*
760 <p><b><i>foo</i></b>
761 </p>
762 !!end
763
764
765 # same html as previous, but wikitext adjusted to match parsoid html2wt
766 # skipping wt2html and html2html because it wants to put <i> before <b>
767 !! test
768 Italics and bold: 5-quote opening sequence: (5,2+3)
769 !! options
770 parsoid=wt2wt,html2wt
771 !! wikitext
772 '''''foo'''''
773 !! html
774 <p><b><i>foo</i></b>
775 </p>
776 !! end
777
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 '''''foo'''
784 !! html/*
785 <p><i><b>foo</b></i>
786 </p>
787 !!end
788
789
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 5-quote opening sequence: (5,3+2)
793 !! wikitext
794 '''''foo'''''
795 !! html
796 <p><i><b>foo</b></i>
797 </p>
798 !! end
799
800
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4)
803 !! options
804 parsoid=wt2html
805 !! wikitext
806 '''''foo''''
807 !! html/*
808 <p><i><b>foo'</b></i>
809 </p>
810 !!end
811
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
816 !! wikitext
817 '''''<nowiki>foo'</nowiki>'''''
818 !! html
819 <p><i><b>foo'</b></i>
820 </p>
821 !! end
822
823
824 !! test
825 Italics and bold: 5-quote opening sequence: (5,5)
826 !! wikitext
827 '''''foo'''''
828 !! html
829 <p><i><b>foo</b></i>
830 </p>
831 !!end
832
833 ###
834 ### multiple quote sequences in a line
835 ###
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2)
838 !! options
839 parsoid=wt2html
840 !! wikitext
841 ''foo''''bar''
842 !! html/*
843 <p><i>foo'<b>bar</b></i>
844 </p>
845 !!end
846
847
848 # same html as previous, but wikitext adjusted to match parsoid html2wt
849 !! test
850 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
851 !! wikitext
852 ''<nowiki>foo'</nowiki>'''bar'''''
853 !! html
854 <p><i>foo'<b>bar</b></i>
855 </p>
856 !! end
857
858
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3)
861 !! options
862 parsoid=wt2html
863 !! wikitext
864 ''foo''''bar'''
865 !! html/*
866 <p><i>foo'<b>bar</b></i>
867 </p>
868 !!end
869
870
871 # same html as previous, but wikitext adjusted to match parsoid html2wt
872 !! test
873 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
874 !! wikitext
875 ''<nowiki>foo'</nowiki>'''bar'''''
876 !! html
877 <p><i>foo'<b>bar</b></i>
878 </p>
879 !! end
880
881
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4)
884 !! options
885 parsoid=wt2html
886 !! wikitext
887 ''foo''''bar''''
888 !! html/*
889 <p><i>foo'<b>bar'</b></i>
890 </p>
891 !!end
892
893
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
897 !! wikitext
898 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
899 !! html
900 <p><i>foo'<b>bar'</b></i>
901 </p>
902 !! end
903
904
905 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
906 !! test
907 Italics and bold: multiple quote sequences: (3,4,2)
908 !! options
909 parsoid=wt2html
910 !! wikitext
911 '''foo''''bar''
912 !! html/php
913 <p><b>foo'</b>bar
914 </p>
915 !! html/parsoid
916 <p><b>foo'</b>bar<i></i>
917 </p>
918 !!end
919
920 # same html as previous, but wikitext adjusted to match parsoid html2wt
921 !! test
922 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
923 !! options
924 parsoid
925 !! wikitext
926 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
927 !! html/php
928 <p><b>foo'</b>bar
929 </p>
930 !! html/parsoid
931 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
932 </p>
933 !! end
934
935
936 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
937 !! test
938 Italics and bold: multiple quote sequences: (3,4,3)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 '''foo''''bar'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b>foo'</b>bar<b></b>
948 </p>
949 !!end
950
951 # same html as previous, but wikitext adjusted to match parsoid html2wt
952 !! test
953 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
954 !! wikitext
955 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
956 !! html/php
957 <p><b>foo'</b>bar
958 </p>
959 !! html/parsoid
960 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
961 </p>
962 !! end
963
964 ###
965 ### other quote tests
966 ###
967 !! test
968 Italics and bold: other quote tests: (2,3,5)
969 !! wikitext
970 ''this is about '''foo's family'''''
971 !! html
972 <p><i>this is about <b>foo's family</b></i>
973 </p>
974 !!end
975
976
977 !! test
978 Italics and bold: other quote tests: (2,(3,3),2)
979 !! wikitext
980 ''this is about '''foo's''' family''
981 !! html
982 <p><i>this is about <b>foo's</b> family</i>
983 </p>
984 !!end
985
986
987 !! test
988 Italics and bold: other quote tests: (3,2,3,2)
989 !! options
990 parsoid=wt2html
991 !! wikitext
992 '''this is about ''foo'''s family''
993 !! html/*
994 <p><b>this is about <i>foo</i></b><i>s family</i>
995 </p>
996 !!end
997
998
999 # same html as previous, but wikitext adjusted to match parsoid html2wt
1000 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1001 !! test
1002 Italics and bold: other quote tests: (3,2,3+2+2,2)
1003 !! options
1004 parsoid
1005 !! wikitext
1006 '''this is about ''foo'''''<nowiki/>''s family''
1007 !! html/*
1008 <p><b>this is about <i>foo</i></b><i>s family</i>
1009 </p>
1010 !! end
1011
1012
1013 !! test
1014 Italics and bold: other quote tests: (3,2,3,3)
1015 !! options
1016 !! wikitext
1017 '''this is about ''foo'''s family'''
1018 !! html
1019 <p>'<i>this is about </i>foo<b>s family</b>
1020 </p>
1021 !!end
1022
1023
1024 !! test
1025 Italics and bold: other quote tests: (3,(2,2),3)
1026 !! wikitext
1027 '''this is about ''foo's'' family'''
1028 !! html
1029 <p><b>this is about <i>foo's</i> family</b>
1030 </p>
1031 !!end
1032
1033
1034 !! test
1035 Italicized possessive
1036 !! wikitext
1037 The ''[[Main Page]]'''s talk page.
1038 !! html
1039 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1040 </p>
1041 !! end
1042
1043 !! test
1044 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1045 (Requires tidy for PHP parser output to be fixed up)
1046 !! options
1047 parsoid=wt2html,wt2wt
1048 !! wikitext
1049 {|
1050 !''a!!''b
1051 |''a||''b
1052 |}
1053 !! html/php+tidy
1054 <table>
1055 <tr>
1056 <th><i>a</i></th>
1057 <th><i>b</i></th>
1058 <td><i>a</i></td>
1059 <td><i>b</i></td>
1060 </tr>
1061 </table>
1062 !! html/parsoid
1063 <table>
1064 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1065 <td><i>a</i></td><td><i>b</i></td></tr>
1066 </tbody></table>
1067 !! end
1068
1069 ###
1070 ### Non-html5 tags
1071 ###
1072
1073 !! test
1074 Non-html5 tags should be accepted
1075 !! wikitext
1076 <center>''foo''</center>
1077 <big>''foo''</big>
1078 <font>''foo''</font>
1079 <strike>''foo''</strike>
1080 <tt>''foo''</tt>
1081 !! html
1082 <center><i>foo</i></center>
1083 <p><big><i>foo</i></big>
1084 <font><i>foo</i></font>
1085 <strike><i>foo</i></strike>
1086 <tt><i>foo</i></tt>
1087 </p>
1088 !! end
1089
1090 !! test
1091 <wbr> is valid wikitext (bug 52468)
1092 !! wikitext
1093 <wbr>
1094 !! html
1095 <p><wbr />
1096 </p>
1097 !! end
1098
1099 # <strike> is HTML4, <s> is HTML4/5.
1100 !! test
1101 <s> or <strike> for strikethrough
1102 !! wikitext
1103 <strike>strike</strike>
1104
1105 <s>s</s>
1106 !! html
1107 <p><strike>strike</strike>
1108 </p><p><s>s</s>
1109 </p>
1110 !! end
1111
1112 ## a not permitted
1113 ## i,b,br omitted
1114 !! test
1115 Text-level semantic html elements in wikitext
1116 !! wikitext
1117 <em>text</em>
1118 <strong>text</strong>
1119 <small>text</small>
1120 <s>text</s>
1121 <cite>text</cite>
1122 <q>text</q>
1123 <dfn>text</dfn>
1124 <abbr>text</abbr>
1125 <data>text</data>
1126 <time>text</time>
1127 <code>text</code>
1128 <var>text</var>
1129 <samp>text</samp>
1130 <kbd>text</kbd>
1131 <sub>text</sub>
1132 <u>text</u>
1133 <mark>text</mark>
1134 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1135 <bdi>text</bdi>
1136 <bdo>text</bdo>
1137 <span>text</span>
1138 <wbr />
1139 !! html
1140 <p><em>text</em>
1141 <strong>text</strong>
1142 <small>text</small>
1143 <s>text</s>
1144 <cite>text</cite>
1145 <q>text</q>
1146 <dfn>text</dfn>
1147 <abbr>text</abbr>
1148 <data>text</data>
1149 <time>text</time>
1150 <code>text</code>
1151 <var>text</var>
1152 <samp>text</samp>
1153 <kbd>text</kbd>
1154 <sub>text</sub>
1155 <u>text</u>
1156 <mark>text</mark>
1157 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1158 <bdi>text</bdi>
1159 <bdo>text</bdo>
1160 <span>text</span>
1161 <wbr />
1162 </p>
1163 !! end
1164
1165 # test cases taken from
1166 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1167 !! test
1168 Ruby markup (W3C-style)
1169 !! wikitext
1170 ; Mono-ruby for individual base characters
1171 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1172 ; Group ruby
1173 : <ruby>今日<rt>きょう</rt></ruby>
1174 ; Jukugo ruby
1175 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1176 ; Inline ruby
1177 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1178 ; Double-sided ruby
1179 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1180 <ruby>
1181 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1182 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1183 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1184 </ruby>
1185 !! html
1186 <dl><dt> Mono-ruby for individual base characters</dt>
1187 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1188 <dt> Group ruby</dt>
1189 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1190 <dt> Jukugo ruby</dt>
1191 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1192 <dt> Inline ruby</dt>
1193 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1194 <dt> Double-sided ruby</dt>
1195 <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>
1196 <p><ruby>
1197 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1198 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1199 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1200 </ruby>
1201 </p>
1202 !! end
1203
1204 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1205 !! test
1206 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1207 !! wikitext
1208 <b→> doesn't work! </b→>
1209
1210 <bä> doesn't work! </bä>
1211
1212 <boo> works fine </boo>
1213
1214 <s.foo>s.foo</s.foo>
1215
1216 <sub-ID#1>
1217 !! html
1218 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1219 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1220 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1221 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1222 </p><p>&lt;sub-ID#1&gt;
1223 </p>
1224 !! end
1225
1226 !! test
1227 Isolated close tags should be treated as literal text (bug 52760)
1228 !! wikitext
1229 </b>
1230
1231 <s.foo>s</s>
1232 !! html
1233 <p>&lt;/b&gt;
1234 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1235 </p>
1236 !! end
1237
1238 ###
1239 ### Special characters
1240 ###
1241
1242 !! test
1243 Bare pipe character (bug 52363)
1244 !! wikitext
1245 |
1246 !! html
1247 <p>|
1248 </p>
1249 !! end
1250
1251 !! test
1252 Bare pipe character from a template (bug 52363)
1253 !! wikitext
1254 {{pipe}}
1255 !! html
1256 <p>|
1257 </p>
1258 !! end
1259
1260 ###
1261 ### <nowiki> test cases
1262 ###
1263
1264 !! test
1265 <nowiki> unordered list
1266 !! wikitext
1267 <nowiki>* This is not an unordered list item.</nowiki>
1268 !! html
1269 <p>* This is not an unordered list item.
1270 </p>
1271 !! end
1272
1273 !! test
1274 <nowiki> spacing
1275 !! wikitext
1276 <nowiki>Lorem ipsum dolor
1277
1278 sed abit.
1279 sed nullum.
1280
1281 :and a colon
1282 </nowiki>
1283 !! html
1284 <p>Lorem ipsum dolor
1285
1286 sed abit.
1287 sed nullum.
1288
1289 :and a colon
1290
1291 </p>
1292 !! end
1293
1294 !! test
1295 nowiki 3
1296 !! wikitext
1297 :There is not nowiki.
1298 :There is <nowiki>nowiki</nowiki>.
1299
1300 #There is not nowiki.
1301 #There is <nowiki>nowiki</nowiki>.
1302
1303 *There is not nowiki.
1304 *There is <nowiki>nowiki</nowiki>.
1305 !! html
1306 <dl><dd>There is not nowiki.</dd>
1307 <dd>There is nowiki.</dd></dl>
1308 <ol><li>There is not nowiki.</li>
1309 <li>There is nowiki.</li></ol>
1310 <ul><li>There is not nowiki.</li>
1311 <li>There is nowiki.</li></ul>
1312
1313 !! end
1314
1315 !! test
1316 Entities inside <nowiki>
1317 !! wikitext
1318 <nowiki>&lt;</nowiki>
1319 !! html
1320 <p>&lt;
1321 </p>
1322 !! end
1323
1324 !! test
1325 Entities inside template parameters
1326 !! options
1327 parsoid
1328 !! wikitext
1329 {{echo|&ndash;}}
1330 !! html
1331 <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>
1332 </p>
1333 !! end
1334
1335 !! test
1336 Properly escape nowiki when combined with other wiki markup
1337 !! options
1338 parsoid=html2wt
1339 !! wikitext
1340 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1341 !! html
1342 <p>* &lt;/nowiki&gt; tag</p>
1343 !! end
1344
1345 ###
1346 ### Comments
1347 ###
1348 !! test
1349 Comments and Indent-Pre
1350 !! wikitext
1351 <!-- comment 1 --> asdf
1352
1353 <!-- comment 1 --> asdf
1354 <!-- comment 2 -->
1355
1356 <!-- comment 1 --> asdf
1357 <!-- comment 2 -->xyz
1358
1359 <!-- comment 1 --> asdf
1360 <!-- comment 2 --> xyz
1361 !! html
1362 <pre>asdf
1363 </pre>
1364 <pre>asdf
1365 </pre>
1366 <pre>asdf
1367 </pre>
1368 <p>xyz
1369 </p>
1370 <pre>asdf
1371 xyz
1372 </pre>
1373 !! end
1374
1375 !! test
1376 Comment test 2a
1377 !! wikitext
1378 asdf
1379 <!-- comment 1 -->
1380 jkl
1381 !! html
1382 <p>asdf
1383 jkl
1384 </p>
1385 !! end
1386
1387 !! test
1388 Comment test 2b
1389 !! wikitext
1390 asdf
1391 <!-- comment 1 -->
1392
1393 jkl
1394 !! html
1395 <p>asdf
1396 </p><p>jkl
1397 </p>
1398 !! end
1399
1400 !! test
1401 Comment test 3
1402 !! wikitext
1403 asdf
1404 <!-- comment 1 -->
1405 <!-- comment 2 -->
1406 jkl
1407 !! html
1408 <p>asdf
1409 jkl
1410 </p>
1411 !! end
1412
1413 !! test
1414 Comment test 4
1415 !! wikitext
1416 asdf<!-- comment 1 -->jkl
1417 !! html
1418 <p>asdfjkl
1419 </p>
1420 !! end
1421
1422 !! test
1423 Comment spacing
1424 !! wikitext
1425 a
1426 <!-- foo --> b <!-- bar -->
1427 c
1428 !! html
1429 <p>a
1430 </p>
1431 <pre> b
1432 </pre>
1433 <p>c
1434 </p>
1435 !! end
1436
1437 !! test
1438 Comment whitespace
1439 !! wikitext
1440 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1441 !! html
1442
1443 !! end
1444
1445 !! test
1446 Comment semantics and delimiters
1447 !! wikitext
1448 <!-- --><!----><!-----><!------>
1449 !! html
1450
1451 !! end
1452
1453 !! test
1454 Comment semantics and delimiters, redux
1455 !! wikitext
1456 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1457 -- foo -- funky huh? ... -->
1458 !! html
1459
1460 !! end
1461
1462 !! test
1463 Comment semantics and delimiters: directors cut
1464 !! wikitext
1465 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1466 everything starting with < followed by !-- until the first -- and > we see,
1467 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1468 -->-->
1469 !! html
1470 <p>--&gt;
1471 </p>
1472 !! end
1473
1474 !! test
1475 Comment semantics: nesting
1476 !! wikitext
1477 <!--<!-- no, we're not going to do anything fancy here -->-->
1478 !! html
1479 <p>--&gt;
1480 </p>
1481 !! end
1482
1483 !! test
1484 Comment semantics: unclosed comment at end
1485 !! wikitext
1486 <!--This comment will run out to the end of the document
1487 !! html
1488
1489 !! end
1490
1491 !! test
1492 Comment in template title
1493 !! wikitext
1494 {{f<!---->oo}}
1495 !! html
1496 <p>FOO
1497 </p>
1498 !! end
1499
1500 !! test
1501 Comment on its own line post-expand
1502 !! wikitext
1503 a
1504 {{blank}}<!---->
1505 b
1506 !! html
1507 <p>a
1508 </p><p>b
1509 </p>
1510 !! end
1511
1512 !! test
1513 Comment on its own line post-expand with non-significant whitespace
1514 !! wikitext
1515 a
1516 {{blank}} <!---->
1517 b
1518 !! html
1519 <p>a
1520 </p><p>b
1521 </p>
1522 !! end
1523
1524 !! test
1525 Multiple comments should still parse as SOL-transparent
1526 !! options
1527 parsoid=wt2html,wt2wt
1528 !! wikitext
1529 <!--c1-->*a
1530 <!--c2--><!--c3--><!--c4-->*b
1531 !! html
1532 <ul>
1533 <li>a
1534 </li>
1535 <li>b
1536 </li>
1537 </ul>
1538 !! end
1539
1540 ###
1541 ### paragraph wrapping tests
1542 ###
1543 !! test
1544 No block tags
1545 !! wikitext
1546 a
1547
1548 b
1549 !! html
1550 <p>a
1551 </p><p>b
1552 </p>
1553 !! end
1554
1555 !! test
1556 Block tag on one line (<div>)
1557 !! wikitext
1558 a <div>foo</div>
1559
1560 b
1561 !! html
1562 a <div>foo</div>
1563 <p>b
1564 </p>
1565 !! html+tidy
1566 <p>a</p>
1567 <div>foo</div>
1568 <p>b</p>
1569 !! end
1570
1571 !! test
1572 Block tag on one line (<blockquote>)
1573 !! wikitext
1574 a <blockquote>foo</blockquote>
1575
1576 b
1577 !! html
1578 a <blockquote>foo</blockquote>
1579 <p>b
1580 </p>
1581 !! html+tidy
1582 <p>a</p>
1583 <blockquote>
1584 <p>foo</p>
1585 </blockquote>
1586 <p>b</p>
1587 !! end
1588
1589 !! test
1590 Block tag on both lines (<div>)
1591 !! wikitext
1592 a <div>foo</div>
1593
1594 b <div>foo</div>
1595 !! html
1596 a <div>foo</div>
1597 b <div>foo</div>
1598
1599 !! html+tidy
1600 <p>a</p>
1601 <div>foo</div>
1602 <p>b</p>
1603 <div>foo</div>
1604 !! end
1605
1606 !! test
1607 Block tag on both lines (<blockquote>)
1608 !! wikitext
1609 a <blockquote>foo</blockquote>
1610
1611 b <blockquote>foo</blockquote>
1612 !! html
1613 a <blockquote>foo</blockquote>
1614 b <blockquote>foo</blockquote>
1615
1616 !! html+tidy
1617 <p>a</p>
1618 <blockquote>
1619 <p>foo</p>
1620 </blockquote>
1621 <p>b</p>
1622 <blockquote>
1623 <p>foo</p>
1624 </blockquote>
1625 !! end
1626
1627 !! test
1628 Multiple lines without block tags
1629 !! wikitext
1630 <div>foo</div> a
1631 b
1632 c
1633 d<!--foo--> e
1634 x <div>foo</div> z
1635 !! html
1636 <div>foo</div> a
1637 <p>b
1638 c
1639 d e
1640 </p>
1641 x <div>foo</div> z
1642
1643 !! html+tidy
1644 <div>foo</div>
1645 <p>a</p>
1646 <p>b c d e</p>
1647 <p>x</p>
1648 <div>foo</div>
1649 <p>z</p>
1650 !! end
1651
1652 !! test
1653 Empty lines between lines with block tags
1654 !! wikitext
1655 <div></div>
1656
1657
1658 <div></div>a
1659
1660 b
1661 <div>a</div>b
1662
1663 <div>b</div>d
1664
1665
1666 <div>e</div>
1667 !! html
1668 <div></div>
1669 <p><br />
1670 </p>
1671 <div></div>a
1672 <p>b
1673 </p>
1674 <div>a</div>b
1675 <div>b</div>d
1676 <p><br />
1677 </p>
1678 <div>e</div>
1679
1680 !! html+tidy
1681 <p><br /></p>
1682 <p>a</p>
1683 <p>b</p>
1684 <div>a</div>
1685 <p>b</p>
1686 <div>b</div>
1687 <p>d</p>
1688 <p><br /></p>
1689 <div>e</div>
1690 !! end
1691
1692 ## PHP parser emits output which is broken
1693 ## XXX The parsoid output doesn't match the tidy output.
1694 !! test
1695 Unclosed HTML p-tags should be handled properly
1696 !! wikitext
1697 <div><p>foo</div>
1698 a
1699
1700 b
1701 !! html/php+tidy
1702 <div>
1703 <p>foo&lt;/div&gt;</p>
1704 <p>a</p>
1705 b</div>
1706 !! html/parsoid
1707 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1708 <p>a</p>
1709 <p>b</p>
1710 !! end
1711
1712 ###
1713 ### Preformatted text
1714 ###
1715 !! test
1716 Preformatted text
1717 !! wikitext
1718 This is some
1719 Preformatted text
1720 With ''italic''
1721 And '''bold'''
1722 And a [[Main Page|link]]
1723 !! html
1724 <pre>This is some
1725 Preformatted text
1726 With <i>italic</i>
1727 And <b>bold</b>
1728 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1729 </pre>
1730 !! end
1731
1732 !! test
1733 Tabs don't trigger preformatted text
1734 !! wikitext
1735 This is not
1736 preformatted text.
1737 This is preformatted text.
1738 So is this.
1739 !! html
1740 <p> This is not
1741 preformatted text.
1742 </p>
1743 <pre>This is preformatted text.
1744 So is this.
1745 </pre>
1746 !! end
1747
1748 !! test
1749 Ident preformatting with inline content
1750 !! wikitext
1751 a
1752 ''b''
1753 !! html
1754 <pre>a
1755 <i>b</i>
1756 </pre>
1757 !! end
1758
1759 !! test
1760 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1761 !! wikitext
1762 <pre><nowiki>
1763 <b>
1764 <cite>
1765 <em>
1766 </nowiki></pre>
1767 !! html
1768 <pre>
1769 &lt;b&gt;
1770 &lt;cite&gt;
1771 &lt;em&gt;
1772 </pre>
1773
1774 !! end
1775
1776 !! test
1777 Regression with preformatted in <center>
1778 !! wikitext
1779 <center>
1780 Blah
1781 </center>
1782 !! html
1783 <center>
1784 <pre>Blah
1785 </pre>
1786 </center>
1787
1788 !! end
1789
1790 !! test
1791 Bug 52763: Preformatted in <blockquote>
1792 !! wikitext
1793 <blockquote>
1794 Blah
1795 {|
1796 |
1797 indented cell (no pre-wrapping!)
1798 |}
1799 </blockquote>
1800 !! html
1801 <blockquote>
1802 <p> Blah
1803 </p>
1804 <table>
1805 <tr>
1806 <td>
1807 <p> indented cell (no pre-wrapping!)
1808 </p>
1809 </td></tr></table>
1810 </blockquote>
1811
1812 !! end
1813
1814 !! test
1815 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1816 !! wikitext
1817 <blockquote>
1818 Foo
1819
1820 Bar
1821 </blockquote>
1822 !! html
1823 <blockquote>
1824 <p>Foo
1825 </p><p>Bar
1826 </p>
1827 </blockquote>
1828
1829 !! end
1830
1831 !! test
1832 Bug 15491: <ins>/<del> in blockquote
1833 !! wikitext
1834 <blockquote>
1835 Foo <del>bar</del> <ins>baz</ins> quux
1836 </blockquote>
1837 !! html
1838 <blockquote>
1839 <p>Foo <del>bar</del> <ins>baz</ins> quux
1840 </p>
1841 </blockquote>
1842
1843 !! end
1844
1845 # Note that the p-wrapping is newline sensitive, which could be
1846 # considered a bug: tidy will wrap only the 'Foo' in the example
1847 # below in a <p> tag. (see comment 23-25 of bug #6200)
1848 !! test
1849 Bug 15491: <ins>/<del> in blockquote (2)
1850 !! wikitext
1851 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1852 </blockquote>
1853 !! html
1854 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1855 </blockquote>
1856
1857 !! html+tidy
1858 <blockquote>
1859 <p>Foo</p>
1860 <del>bar</del> <ins>baz</ins> quux</blockquote>
1861 !! end
1862
1863 !! test
1864 <pre> with attributes (bug 3202)
1865 !! wikitext
1866 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1867 !! html
1868 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1869
1870 !! end
1871
1872 !! test
1873 <pre> with width attribute (bug 3202)
1874 !! wikitext
1875 <pre width="8">Narrow screen goodies</pre>
1876 !! html
1877 <pre width="8">Narrow screen goodies</pre>
1878
1879 !! end
1880
1881 !! test
1882 <pre> with forbidden attribute (bug 3202)
1883 !! wikitext
1884 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1885 !! html
1886 <pre width="8">Narrow screen goodies</pre>
1887
1888 !! end
1889
1890 !! test
1891 Entities inside <pre>
1892 !! wikitext
1893 <pre>&lt;</pre>
1894 !! html
1895 <pre>&lt;</pre>
1896
1897 !! end
1898
1899 !! test
1900 <pre> with forbidden attribute values (bug 3202)
1901 !! wikitext
1902 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1903 !! html
1904 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1905
1906 !! end
1907
1908 !! test
1909 <nowiki> inside <pre> (bug 13238)
1910 !! wikitext
1911 <pre>
1912 <nowiki>
1913 </pre>
1914 <pre>
1915 <nowiki></nowiki>
1916 </pre>
1917 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1918 !! html
1919 <pre>
1920 &lt;nowiki&gt;
1921 </pre>
1922 <pre>
1923
1924 </pre>
1925 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1926
1927 !! end
1928
1929 !! test
1930 <nowiki> and <pre> preference (first one wins)
1931 !! wikitext
1932 <pre>
1933 <nowiki>
1934 </pre>
1935 </nowiki>
1936 </pre>
1937
1938 <nowiki>
1939 <pre>
1940 <nowiki>
1941 </pre>
1942 </nowiki>
1943 </pre>
1944
1945 !! html
1946 <pre>
1947 &lt;nowiki&gt;
1948 </pre>
1949 <p>&lt;/nowiki&gt;
1950 &lt;/pre&gt;
1951 </p><p>
1952 &lt;pre&gt;
1953 &lt;nowiki&gt;
1954 &lt;/pre&gt;
1955
1956 &lt;/pre&gt;
1957 </p>
1958 !! end
1959
1960 !! test
1961 </pre> inside nowiki
1962 !! wikitext
1963 <nowiki></pre></nowiki>
1964 !! html
1965 <p>&lt;/pre&gt;
1966 </p>
1967 !! end
1968
1969 !! test
1970 Empty pre; pre inside other HTML tags (bug 54946)
1971 !! wikitext
1972 a
1973
1974 <div><pre>
1975 foo
1976 </pre></div>
1977 <pre></pre>
1978 !! html
1979 <p>a
1980 </p>
1981 <div><pre>
1982 foo
1983 </pre></div>
1984 <pre></pre>
1985
1986 !! html+tidy
1987 <p>a</p>
1988 <div>
1989 <pre>
1990 foo
1991 </pre></div>
1992 !! end
1993
1994 !! test
1995 HTML pre followed by indent-pre
1996 !! wikitext
1997 <pre>foo</pre>
1998 bar
1999 !! html
2000 <pre>foo</pre>
2001 <pre>bar
2002 </pre>
2003 !! end
2004
2005 !!test
2006 Block tag pre
2007 !!options
2008 parsoid
2009 !! wikitext
2010 <p><pre>foo</pre></p>
2011 !! html
2012 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2013 !!end
2014
2015 !!test
2016 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2017 !! wikitext
2018 {{echo|}}
2019 !! html
2020
2021 !!end
2022
2023 !!test
2024 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2025 !! wikitext
2026 {{echo|
2027 foo}}
2028 !! html
2029 <p>foo
2030 </p>
2031 !!end
2032
2033 !! test
2034 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2035 !! wikitext
2036 {{echo|a
2037 b}}
2038 !! html
2039 <pre>a
2040 </pre>
2041 <p>b
2042 </p>
2043 !!end
2044
2045 !! test
2046 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2047 !! wikitext
2048 {{echo|a
2049 b
2050 c
2051 d
2052 e
2053 }}
2054 !! html
2055 <pre>a
2056 </pre>
2057 <p>b
2058 c
2059 </p>
2060 <pre>d
2061 </pre>
2062 <p>e
2063 </p>
2064 !!end
2065
2066 !!test
2067 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2068 !! wikitext
2069 {{echo| foo}}
2070
2071 {{echo| foo}}{{echo| bar}}
2072
2073 {{echo| foo}}
2074 {{echo| bar}}
2075
2076 {{echo|<!--cmt--> foo}}
2077
2078 <!--cmt-->{{echo| foo}}
2079
2080 {{echo|{{echo| }}bar}}
2081 !! html
2082 <pre>foo
2083 </pre>
2084 <pre>foo bar
2085 </pre>
2086 <pre>foo
2087 bar
2088 </pre>
2089 <pre>foo
2090 </pre>
2091 <pre>foo
2092 </pre>
2093 <pre>bar
2094 </pre>
2095 !!end
2096
2097 !! test
2098 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2099 !! wikitext
2100 {{echo| }}a
2101
2102 {{echo|
2103 }}a
2104
2105 {{echo|
2106 b}}
2107
2108 {{echo|a
2109 }}b
2110
2111 {{echo|a
2112 }} b
2113 !! html
2114 <pre>a
2115 </pre>
2116 <p><br />
2117 </p>
2118 <pre>a
2119 </pre>
2120 <p><br />
2121 </p>
2122 <pre>b
2123 </pre>
2124 <p>a
2125 </p>
2126 <pre>b
2127 </pre>
2128 <p>a
2129 </p>
2130 <pre>b
2131 </pre>
2132 !!end
2133
2134 !! test
2135 Things that look like <pre> tags aren't treated as such
2136 !! wikitext
2137 Barack Obama <President> of the United States
2138 <President></President>
2139 !! html
2140 <p>Barack Obama &lt;President&gt; of the United States
2141 &lt;President&gt;&lt;/President&gt;
2142 </p>
2143 !! end
2144
2145 ## PHP parser discards the "<pre " string
2146 !! test
2147 Handle broken pre-like tags (bug 64025)
2148 !! options
2149 parsoid=wt2html
2150 !! wikitext
2151 {{echo|<pre <pre>x</pre>}}
2152
2153 <table><pre </table>
2154 !! html/php
2155 <pre>x</pre>
2156 <table><pre></pre></table>
2157
2158 !! html/parsoid
2159 <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>
2160 <pre>x</pre>
2161
2162 <span>&lt;pre </span>
2163 <table></table>
2164 !! end
2165
2166 !! test
2167 Parsoid: handle pre with space after attribute
2168 !! options
2169 parsoid=wt2html
2170 !! wikitext
2171 <pre style="width:50%;" >{{echo|foo}}</pre>
2172 !! html
2173 <pre style="width:50%;">{{echo|foo}}</pre>
2174 !! end
2175
2176 # TODO / maybe: fix wt2wt for this
2177 !! test
2178 Parsoid: Don't paragraph-wrap fosterable content
2179 !! options
2180 parsoid=wt2html
2181 !! wikitext
2182 {|
2183 <td></td>
2184 <td></td>
2185
2186
2187
2188 |}
2189 !! html
2190 <table>
2191
2192 <tbody>
2193 <tr>
2194 <td></td>
2195
2196 <td></td></tr>
2197
2198
2199
2200 </tbody></table>
2201 !! end
2202
2203 !! test
2204 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2205 !! options
2206 parsoid=wt2html
2207 !! wikitext
2208 {|
2209 <td>
2210 <td>
2211 </td>
2212
2213
2214
2215 |}
2216 !! html
2217 <table>
2218
2219 <tbody>
2220 <tr>
2221 <td></td>
2222
2223 <td>
2224 </td></tr>
2225
2226
2227
2228 </tbody></table>
2229 !! end
2230
2231
2232 #--------------------------------------------------------------------
2233 # Transclusion parameter whitespace stripping tests
2234 # Behavior is different for positional and named parameters
2235 #--------------------------------------------------------------------
2236 !! test
2237 Templates: Strip leading and trailing whitespace from named-param values
2238 !! wikitext
2239 {{echo|1= a }}
2240
2241 {{echo|1= {{echo|b}} }}
2242
2243 {{echo| 1 =
2244 c }}
2245
2246 {{echo| 1 =
2247 * d
2248 }}
2249 !! html
2250 <p>a
2251 </p><p>b
2252 </p><p>c
2253 </p>
2254 <ul><li> d</li></ul>
2255
2256 !! end
2257
2258 !! test
2259 Templates: Don't strip whitespace from positional-param values
2260 !! wikitext
2261 {{echo|a }}
2262
2263 {{echo|{{echo|b}} }}
2264
2265 {{echo| c
2266 }}
2267
2268 {{echo| {{echo|d}}
2269 }}
2270
2271 {{echo|
2272 e}}
2273
2274 {{echo|
2275 * f}}
2276
2277 {{echo|
2278 }}g
2279 !! html
2280 <p>a
2281 </p><p>b
2282 </p>
2283 <pre>c
2284 </pre>
2285 <p><br />
2286 </p>
2287 <pre>d
2288 </pre>
2289 <p><br />
2290 </p>
2291 <pre>e
2292 </pre>
2293 <p><br />
2294 </p>
2295 <ul><li> f</li></ul>
2296 <p><br />
2297 </p>
2298 <pre>g
2299 </pre>
2300 !! end
2301
2302 !! test
2303 Templates: Handle empty comment-and-ws-only lines correctly
2304 !! wikitext
2305 {{echo|foo
2306 <!--should be ignored-->
2307 <!--should be ignored as well-->
2308 bar}}
2309 !! html
2310 <p>foo
2311 bar
2312 </p>
2313 !! end
2314
2315 !! test
2316 Templates: Handle comments in the target
2317 !! wikitext
2318 {{echo
2319 <!-- should be ignored -->
2320 |foo}}
2321
2322 {{echo<!-- should be ignored -->
2323 |foo}}
2324
2325 {{echo<!-- should be ignored -->|foo}}
2326
2327 {{<!-- should be ignored -->echo|foo}}
2328 !!html/parsoid
2329 <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>
2330
2331 <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>
2332
2333 <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>
2334
2335 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2336 !!end
2337
2338 #--------------------------------------------------------------------
2339 # Transclusion parameter escaping tests
2340 #--------------------------------------------------------------------
2341 !! test
2342 Templates: Parsoid parameter escaping test 1
2343 !! options
2344 parsoid
2345 !! wikitext
2346 {{echo|[foo]|{{echo|[bar]}}}}
2347 !! html
2348 <p about="#mwt1" typeof="mw:Transclusion"
2349 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2350 !! end
2351
2352 !! test
2353 Parsoid: Pipes in external links in template parameter
2354 !! options
2355 parsoid
2356 !! wikitext
2357 {{echo|[{{echo|http://example.com}} link]}}
2358 !! html
2359 <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>
2360 !! end
2361
2362 !! test
2363 Parsoid: pipe in transclusion parameter
2364 !! options
2365 parsoid
2366 !! wikitext
2367 {{echo|http://foo.com/a&#124;b}}
2368 !! html
2369 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2370 typeof="mw:Transclusion"
2371 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>
2372 !! end
2373
2374 !! test
2375 Parsoid: Pipe in external link target and content in template parameter
2376 !! options
2377 parsoid=html2wt,wt2wt
2378 !! wikitext
2379 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2380 !! html
2381 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2382 typeof="mw:Transclusion"
2383 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2384 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2385 !! end
2386
2387 !! test
2388 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2389 !! options
2390 parsoid
2391 !! wikitext
2392 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2393 !! html
2394 <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>
2395 !! end
2396
2397 !! test
2398 Templates: Don't escape already nowiki-escaped text in template parameters
2399 !! options
2400 parsoid=html2wt,wt2wt
2401 !! wikitext
2402 {{echo|foo<nowiki>|</nowiki>bar}}
2403 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2404 {{echo|<nowiki></nowiki>}}
2405 !! html
2406 <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>
2407 <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>
2408 <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>
2409 </p>
2410 !! end
2411
2412 ## Bug 52824
2413 !! test
2414 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2415 !! options
2416 parsoid=html2wt,wt2wt
2417 !! wikitext
2418 {{echo|{{echo|1=bar}}}}
2419 !! html
2420 <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>
2421 !! end
2422
2423 ## Bug 56733
2424 !! test
2425 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2426 !! options
2427 parsoid
2428 !! wikitext
2429 {{echo|a : b}}
2430 !! html
2431 <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>
2432 !! end
2433
2434 ###
2435 ### Parsoid-centric tests for testing RT edge cases for pre
2436 ###
2437
2438 !!test
2439 1a. Indent-Pre and Comments
2440 !! wikitext
2441 a
2442 <!--a-->
2443 c
2444 !! html
2445 <pre>a
2446 </pre>
2447 <p>c
2448 </p>
2449 !!end
2450
2451 !!test
2452 1b. Indent-Pre and Comments
2453 !! wikitext
2454 a
2455 <!--a-->
2456 c
2457 !! html
2458 <pre>a
2459 </pre>
2460 <p>c
2461 </p>
2462 !!end
2463
2464 !!test
2465 1c. Indent-Pre and Comments
2466 !! wikitext
2467 <!--a--> a
2468
2469 <!--a--> a
2470 !! html
2471 <pre> a
2472 </pre>
2473 <pre> a
2474 </pre>
2475 !!end
2476
2477 !!test
2478 1d. Indent-Pre and Comments
2479 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2480 !! wikitext
2481 <!--a--> a
2482
2483 <!--b-->b
2484 !! html
2485 <pre>a
2486 </pre>
2487 <pre>b
2488 </pre>
2489 !!end
2490
2491 !!test
2492 2a. Indent-Pre and tables
2493 !! wikitext
2494 {|
2495 |-
2496 !h1!!h2
2497 |foo||bar
2498 |}
2499 !! html
2500 <table>
2501
2502 <tr>
2503 <th>h1</th>
2504 <th>h2
2505 </th>
2506 <td>foo</td>
2507 <td>bar
2508 </td></tr></table>
2509
2510 !!end
2511
2512 !!test
2513 2b. Indent-Pre and tables
2514 !! wikitext
2515 {|
2516 |-
2517 |foo
2518 |}
2519 !! html
2520 <table>
2521
2522 <tr>
2523 <td>foo
2524 </td></tr></table>
2525
2526 !!end
2527
2528 !!test
2529 2c. Indent-Pre and tables (bug 42252)
2530 !! wikitext
2531 {|
2532 |+ foo
2533 ! | bar
2534 |}
2535 !! html
2536 <table>
2537 <caption> foo
2538 </caption>
2539 <tr>
2540 <th> bar
2541 </th></tr></table>
2542
2543 !!end
2544
2545 !!test
2546 2d. Indent-Pre and tables
2547 !! wikitext
2548 a
2549 {|
2550 | b
2551 |}
2552 !! html/php
2553 <pre>a
2554 </pre>
2555 <table>
2556 <tr>
2557 <td> b
2558 </td></tr></table>
2559
2560 !! html/parsoid
2561 <pre>a</pre>
2562
2563 <table>
2564
2565 <tbody>
2566 <tr>
2567 <td> b</td></tr>
2568 </tbody></table>
2569 !!end
2570
2571 !!test
2572 2e. Indent-Pre and table-line syntax
2573 !! wikitext
2574 a
2575 | b
2576 | c
2577 !! html/php
2578 <pre>a
2579 | b
2580 | c
2581 </pre>
2582 !!end
2583
2584 !!test
2585 2f. Indent-pre started by table-line syntax
2586 !! wikitext
2587 a
2588 | b
2589 | c
2590 !! html/php
2591 <p>a
2592 </p>
2593 <pre>| b
2594 | c
2595 </pre>
2596 !! html/parsoid
2597 <p>a</p>
2598 <pre>
2599 | b
2600 | c</pre>
2601 !!end
2602
2603 !!test
2604 3a. Indent-Pre and block tags (single-line html)
2605 !! wikitext
2606 a <p> foo </p>
2607 b <div> foo </div>
2608 c <blockquote> foo </blockquote>
2609 <span> foo </span>
2610 !! html
2611 a <p> foo </p>
2612 b <div> foo </div>
2613 c <blockquote> foo </blockquote>
2614 <pre><span> foo </span>
2615 </pre>
2616 !! html+tidy
2617 <p>a</p>
2618 <p>foo</p>
2619 <p>b</p>
2620 <div>foo</div>
2621 <p>c</p>
2622 <blockquote>
2623 <p>foo</p>
2624 </blockquote>
2625 <pre>
2626 <span> foo </span>
2627 </pre>
2628 !! end
2629
2630 !!test
2631 3b. Indent-Pre and block tags (multi-line html)
2632 !! wikitext
2633 a <span>foo</span>
2634 b <div> foo </div>
2635 !! html
2636 <pre>a <span>foo</span>
2637 </pre>
2638 b <div> foo </div>
2639
2640 !! html+tidy
2641 <pre>
2642 a <span>foo</span>
2643 </pre>
2644 <p>b</p>
2645 <div>foo</div>
2646 !!end
2647
2648 !!test
2649 3c. Indent-Pre and block tags (pre-content on separate line)
2650 !! wikitext
2651 <p>
2652 foo
2653 </p>
2654
2655 <div>
2656 foo
2657 </div>
2658
2659 <center>
2660 foo
2661 </center>
2662
2663 <blockquote>
2664 foo
2665 </blockquote>
2666
2667 <blockquote>
2668 <pre>
2669 foo
2670 </pre>
2671 </blockquote>
2672
2673 <table><tr><td>
2674 foo
2675 </td></tr></table>
2676
2677 <ul><li>
2678 foo
2679 </li></ul>
2680
2681 !! html
2682 <p>
2683 foo
2684 </p>
2685 <div>
2686 <pre>foo
2687 </pre>
2688 </div>
2689 <center>
2690 <pre>foo
2691 </pre>
2692 </center>
2693 <blockquote>
2694 <p> foo
2695 </p>
2696 </blockquote>
2697 <blockquote>
2698 <pre>
2699 foo
2700 </pre>
2701 </blockquote>
2702 <table><tr><td>
2703 <pre>foo
2704 </pre>
2705 </td></tr></table>
2706 <ul><li>
2707 foo
2708 </li></ul>
2709
2710 !!end
2711
2712 !!test
2713 4. Indent-Pre and extension tags
2714 !! wikitext
2715 a <gallery>
2716 File:foobar.jpg
2717 </gallery>
2718 !! html
2719 a <ul class="gallery mw-gallery-traditional">
2720 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2721 <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>
2722 <div class="gallerytext">
2723 </div>
2724 </div></li>
2725 </ul>
2726
2727 !! html+tidy
2728 <p>a</p>
2729 <ul class="gallery mw-gallery-traditional">
2730 <li class="gallerybox" style="width: 155px">
2731 <div style="width: 155px">
2732 <div class="thumb" style="width: 150px;">
2733 <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>
2734 </div>
2735 <div class="gallerytext"></div>
2736 </div>
2737 </li>
2738 </ul>
2739 !!end
2740
2741 !! test
2742 Table wikitext syntax outside wiki-tables
2743 !! wikitext
2744 a
2745 ! not a table heading
2746 |- not a table row
2747 | not a table cell
2748 | class="foo bar" | baz
2749 b
2750 |}
2751 |-
2752 c
2753 !! html
2754 <p>a
2755 ! not a table heading
2756 |- not a table row
2757 | not a table cell
2758 | class="foo bar" | baz
2759 b
2760 |}
2761 |-
2762 c
2763 </p>
2764 !! end
2765
2766 !!test
2767 Render paragraphs when indent-pre is suppressed in blocklevels
2768 !! wikitext
2769 <blockquote>
2770 foo
2771
2772 bar
2773 </blockquote>
2774 !! html
2775 <blockquote>
2776 <p> foo
2777 </p><p> bar
2778 </p>
2779 </blockquote>
2780
2781 !!end
2782
2783 !!test
2784 4. Multiple spaces at start-of-line
2785 !! wikitext
2786 <p> foo </p>
2787 foo
2788 {|
2789 |foo
2790 |}
2791 !! html
2792 <p> foo </p>
2793 <pre> foo
2794 </pre>
2795 <table>
2796 <tr>
2797 <td>foo
2798 </td></tr></table>
2799
2800 !!end
2801
2802 ## NOTE: the leading white-space chars on empty line are significant
2803 !! test
2804 5a. White-space in indent-pre
2805 !! wikitext
2806 a<br />
2807
2808 b
2809 !! html
2810 <pre>a<br />
2811
2812 b
2813 </pre>
2814 !! end
2815
2816 ## NOTE: the leading white-space chars on empty line are significant
2817 !! test
2818 5b. White-space in indent-pre
2819 !! wikitext
2820 a
2821
2822 b
2823
2824
2825 c
2826 !! html
2827 <pre>a
2828
2829 b
2830
2831
2832 c
2833 </pre>
2834 !! end
2835
2836 !! test
2837 5c. White-space in indent-pre
2838 !! wikitext
2839 ''a''
2840 ''b''
2841 ''c''
2842 !! html
2843 <pre><i>a</i>
2844 <i>b</i>
2845 <i>c</i>
2846 </pre>
2847 !! end
2848
2849 !! test
2850 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2851 !! wikitext
2852 a
2853
2854 <!-- continue -->
2855 b
2856
2857 c
2858
2859 d
2860 !! html
2861 <pre>a
2862
2863 b
2864 </pre>
2865 <pre>c
2866
2867 </pre>
2868 <p>d
2869 </p>
2870 !! end
2871
2872 !! test
2873 7a. Indent-pre and category links
2874 !! options
2875 parsoid=wt2html,wt2wt
2876 !! wikitext
2877 [[Category:foo]] <!-- No pre-wrapping -->
2878 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2879 !! html
2880 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2881 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2882 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2883 !! end
2884
2885 !! test
2886 7b. Indent-pre and category links
2887 !! options
2888 parsoid=wt2html,wt2wt
2889 !! wikitext
2890 [[Category:foo]] a
2891 [[Category:foo]] {{echo|b}}
2892 !! html
2893 <pre>
2894 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2895
2896 <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>
2897 !! end
2898
2899 ###
2900 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2901 ###
2902
2903 !!test
2904 HTML-pre: 1. embedded newlines
2905 !! wikitext
2906 <pre>foo</pre>
2907
2908 <pre>
2909 foo
2910 </pre>
2911
2912 <pre>
2913
2914 foo
2915 </pre>
2916
2917 <pre>
2918
2919
2920 foo
2921 </pre>
2922 !! html
2923 <pre>foo</pre>
2924 <pre>
2925 foo
2926 </pre>
2927 <pre>
2928
2929 foo
2930 </pre>
2931 <pre>
2932
2933
2934 foo
2935 </pre>
2936
2937 !! html/parsoid
2938 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2939
2940 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2941 foo
2942 </pre>
2943
2944 <pre data-parsoid='{"stx":"html"}'>
2945
2946 foo
2947 </pre>
2948
2949 <pre data-parsoid='{"stx":"html"}'>
2950
2951
2952 foo
2953 </pre>
2954 !!end
2955
2956 !! test
2957 HTML-pre: big spaces
2958 !! wikitext
2959 <pre>
2960
2961
2962
2963
2964 haha
2965
2966
2967
2968
2969 haha
2970
2971
2972
2973
2974 </pre>
2975 !! html
2976 <pre>
2977
2978
2979
2980
2981 haha
2982
2983
2984
2985
2986 haha
2987
2988
2989
2990
2991 </pre>
2992
2993 !! html/parsoid
2994 <pre data-parsoid='{"stx":"html"}'>
2995
2996
2997
2998
2999 haha
3000
3001
3002
3003
3004 haha
3005
3006
3007
3008
3009 </pre>
3010 !! end
3011
3012 !!test
3013 HTML-pre: 2: indented text
3014 !! wikitext
3015 <pre>
3016 foo
3017 </pre>
3018 !! html
3019 <pre>
3020 foo
3021 </pre>
3022
3023 !!end
3024
3025 !!test
3026 HTML-pre: 3: other wikitext
3027 !! wikitext
3028 <pre>
3029 * foo
3030 # bar
3031 = no-h =
3032 '' no-italic ''
3033 [[ NoLink ]]
3034 </pre>
3035 !! html
3036 <pre>
3037 * foo
3038 # bar
3039 = no-h =
3040 '' no-italic ''
3041 [[ NoLink ]]
3042 </pre>
3043
3044 !!end
3045
3046 ###
3047 ### Definition lists
3048 ###
3049 !! test
3050 Simple definition
3051 !! wikitext
3052 ; name : Definition
3053 !! html
3054 <dl><dt> name&#160;</dt>
3055 <dd> Definition</dd></dl>
3056
3057 !! end
3058
3059 !! test
3060 Definition list for indentation only
3061 !! wikitext
3062 : Indented text
3063 !! html
3064 <dl><dd> Indented text</dd></dl>
3065
3066 !! end
3067
3068 !! test
3069 Definition list with no space
3070 !! wikitext
3071 ;name:Definition
3072 !! html
3073 <dl><dt>name</dt>
3074 <dd>Definition</dd></dl>
3075
3076 !!end
3077
3078 !! test
3079 Definition list with URL link
3080 !! wikitext
3081 ; http://example.com/ : definition
3082 !! html
3083 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3084 <dd> definition</dd></dl>
3085
3086 !! end
3087
3088 !! test
3089 Definition list with bracketed URL link
3090 !! wikitext
3091 ;[http://www.example.com/ Example]:Something about it
3092 !! html
3093 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3094 <dd>Something about it</dd></dl>
3095
3096 !! end
3097
3098 !! test
3099 Definition list with wikilink containing colon
3100 !! wikitext
3101 ; [[Help:FAQ]]: The least-read page on Wikipedia
3102 !! html
3103 <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>
3104 <dd> The least-read page on Wikipedia</dd></dl>
3105
3106 !! end
3107
3108 # At Brion's and JeLuF's insistence... :)
3109 !! test
3110 Definition list with news link containing colon
3111 !! wikitext
3112 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3113 !! html
3114 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3115 <dd> This isn't even a real newsgroup!</dd></dl>
3116
3117 !! end
3118
3119 !! test
3120 Malformed definition list with colon
3121 !! wikitext
3122 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3123 !! html
3124 <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>
3125
3126 !! end
3127
3128 !! test
3129 Definition lists: colon in external link text
3130 !! wikitext
3131 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3132 !! html
3133 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3134 <dd> OK, I made that up</dd></dl>
3135
3136 !! end
3137
3138 !! test
3139 Definition lists: colon in HTML attribute
3140 !! wikitext
3141 ;<b style="display: inline">bold</b>
3142 !! html
3143 <dl><dt><b style="display: inline">bold</b></dt></dl>
3144
3145 !! end
3146
3147 !! test
3148 Definition lists: self-closed tag
3149 !! wikitext
3150 ;one<br/>two : two-line fun
3151 !! html
3152 <dl><dt>one<br />two&#160;</dt>
3153 <dd> two-line fun</dd></dl>
3154
3155 !! end
3156
3157 !! test
3158 Bug 11748: Literal closing tags
3159 !! wikitext
3160 <dl>
3161 <dt>test 1</dt>
3162 <dd>test test test test test</dd>
3163 <dt>test 2</dt>
3164 <dd>test test test test test</dd>
3165 </dl>
3166 !! html
3167 <dl>
3168 <dt>test 1</dt>
3169 <dd>test test test test test</dd>
3170 <dt>test 2</dt>
3171 <dd>test test test test test</dd>
3172 </dl>
3173
3174 !! end
3175
3176 !! test
3177 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3178 !! wikitext
3179 <ul><li>
3180 ; term : description
3181 * unordered
3182 </li></ul>
3183 !! html
3184 <ul><li>
3185 <dl><dt> term&#160;</dt>
3186 <dd> description</dd></dl>
3187 <ul><li> unordered</li></ul>
3188 </li></ul>
3189
3190 !! end
3191
3192 !! test
3193
3194 Definition list with empty definition and following paragraph
3195 !! wikitext
3196 ; term:
3197 Paragraph text
3198 !! html
3199 <dl><dt> term</dt>
3200 <dd></dd></dl>
3201 <p>Paragraph text
3202 </p>
3203 !! end
3204
3205 !! test
3206 Nested definition lists using html syntax
3207 !! wikitext
3208 <dl><dt>x</dt>
3209 <dd>a</dd>
3210 <dd>b</dd></dl>
3211
3212 !! end
3213
3214 !! test
3215 Definition Lists: No nesting: Multiple dd's
3216 !! wikitext
3217 ;x
3218 :a
3219 :b
3220 !! html
3221 <dl><dt>x</dt>
3222 <dd>a</dd>
3223 <dd>b</dd></dl>
3224
3225 !! end
3226
3227 !! test
3228 Definition Lists: Indentation: Regular
3229 !! wikitext
3230 :i1
3231 ::i2
3232 :::i3
3233 !! html
3234 <dl><dd>i1
3235 <dl><dd>i2
3236 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3237
3238 !! end
3239
3240 !! test
3241 Definition Lists: Indentation: Missing 1st level
3242 !! wikitext
3243 ::i2
3244 :::i3
3245 !! html
3246 <dl><dd><dl><dd>i2
3247 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3248
3249 !! end
3250
3251 !! test
3252 Definition Lists: Indentation: Multi-level indent
3253 !! wikitext
3254 :::i3
3255 !! html
3256 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3257
3258 !! end
3259
3260 !! test
3261 Definition Lists: Hacky use to indent tables
3262 !! wikitext
3263 ::{|
3264 |foo
3265 |bar
3266 |}
3267 this text
3268 should be left alone
3269 !! html
3270 <dl><dd><dl><dd><table>
3271 <tr>
3272 <td>foo
3273 </td>
3274 <td>bar
3275 </td></tr></table></dd></dl></dd></dl>
3276 <p>this text
3277 should be left alone
3278 </p>
3279 !! end
3280
3281 !! test
3282 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3283 !! wikitext
3284 <!-- foo -->
3285 ::{|
3286 |foo
3287 |bar
3288 |}<!-- bar -->
3289 this text
3290 should be left alone
3291 !! html/parsoid
3292 <!-- foo -->
3293 <dl><dd><dl><dd><table><tr>
3294 <td>foo</td>
3295 <td>bar</td>
3296 </tr></table><!-- bar --></dd></dl></dd></dl>
3297 <p>this text
3298 should be left alone</p>
3299 !! end
3300
3301 !! test
3302 Definition Lists: Hacky use to indent tables, with comment before table
3303 !! wikitext
3304 ::<!-- foo -->{|
3305 |foo
3306 |}
3307 !! html/parsoid
3308 <dl><dd><dl><dd><!-- foo --><table><tr>
3309 <td>foo</td>
3310 </tr></table></dd></dl></dd></dl>
3311 !! end
3312
3313 # Bug 52473
3314 !! test
3315 Definition Lists: Hacky use to indent tables (WS-insensitive)
3316 !! options
3317 parsoid
3318 !! wikitext
3319 : {|
3320 |a
3321 |}
3322 !! html
3323 <dl>
3324 <dd> <table><tr><td>a</td></tr></table> </dd>
3325 </dl>
3326 !! end
3327 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3328 ## as an empty dt item. It also ignores all but the last ";" when followed
3329 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3330 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3331 ## ";"s.
3332 ##
3333 ## Ex: ";;t2 ::d2" is transformed into:
3334 ##
3335 ## <dl>
3336 ## <dt>t2 </dt>
3337 ## <dd>
3338 ## <dl>
3339 ## <dt></dt>
3340 ## <dd>d2</dd>
3341 ## </dl>
3342 ## </dd>
3343 ## </dl>
3344 ##
3345 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3346 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3347 ##
3348 ## <dl>
3349 ## <dt>
3350 ## <dl>
3351 ## <dt>t2 </dt>
3352 ## <dd>:d2</dd>
3353 ## </dl>
3354 ## </dt>
3355 ## </dl>
3356 ##
3357 ## All Parsoid only definition list tests have this difference.
3358 ##
3359 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3360 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3361
3362 !! test
3363 Table / list interaction: indented table with lists in table contents
3364 !! wikitext
3365 :{|
3366 |-
3367 | a
3368 * b
3369 |-
3370 | c
3371 * d
3372 |}
3373 !! html
3374 <dl><dd><table>
3375
3376 <tr>
3377 <td> a
3378 <ul><li> b</li></ul>
3379 </td></tr>
3380 <tr>
3381 <td> c
3382 <ul><li> d</li></ul>
3383 </td></tr></table></dd></dl>
3384
3385 !! end
3386
3387 !!test
3388 Table / list interaction: lists nested in tables nested in indented lists
3389 !! wikitext
3390 :{|
3391 |
3392 :a
3393 :b
3394 |
3395 *c
3396 *d
3397 |}
3398
3399 *e
3400 *f
3401 !! html
3402 <dl><dd><table>
3403 <tr>
3404 <td>
3405 <dl><dd>a</dd>
3406 <dd>b</dd></dl>
3407 </td>
3408 <td>
3409 <ul><li>c</li>
3410 <li>d</li></ul>
3411 </td></tr></table></dd></dl>
3412 <ul><li>e</li>
3413 <li>f</li></ul>
3414
3415 !!end
3416
3417 !! test
3418 Definition Lists: Nesting: Multi-level (Parsoid only)
3419 !! options
3420 parsoid
3421 !! wikitext
3422 ;t1 :d1
3423 ;;t2 ::d2
3424 ;;;t3 :::d3
3425 !! html
3426 <dl>
3427 <dt>t1 </dt>
3428 <dd>d1</dd>
3429 <dt>
3430 <dl>
3431 <dt>t2 </dt>
3432 <dd>:d2</dd>
3433 <dt>
3434 <dl>
3435 <dt>t3 </dt>
3436 <dd>::d3</dd>
3437 </dl>
3438 </dt>
3439 </dl>
3440 </dt>
3441 </dl>
3442
3443
3444 !! end
3445
3446
3447 !! test
3448 Definition Lists: Nesting: Test 2 (Parsoid only)
3449 !! options
3450 parsoid
3451 !! wikitext
3452 ;t1
3453 ::d2
3454 !! html
3455 <dl>
3456 <dt>t1</dt>
3457 <dd>
3458 <dl>
3459 <dd>d2</dd>
3460 </dl>
3461 </dd>
3462 </dl>
3463
3464 !! end
3465
3466
3467 !! test
3468 Definition Lists: Nesting: Test 3 (Parsoid only)
3469 !! options
3470 parsoid
3471 !! wikitext
3472 :;t1
3473 ::::d2
3474 !! html
3475 <dl>
3476 <dd>
3477 <dl>
3478 <dt>t1</dt>
3479 <dd>
3480 <dl>
3481 <dd>
3482 <dl>
3483 <dd>d2</dd>
3484 </dl>
3485 </dd>
3486 </dl>
3487 </dd>
3488 </dl>
3489 </dd>
3490 </dl>
3491
3492 !! end
3493
3494
3495 !! test
3496 Definition Lists: Nesting: Test 4
3497 !! wikitext
3498 ::;t3
3499 :::d3
3500 !! html
3501 <dl><dd><dl><dd><dl><dt>t3</dt>
3502 <dd>d3</dd></dl></dd></dl></dd></dl>
3503
3504 !! end
3505
3506
3507 ## The Parsoid team believes the following three test exposes a
3508 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3509 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3510 ## It also exposes a "misfeature" in tidy, which doesn't like
3511 ## <dl> tags with a single <dt> child; it converts the <dt> into
3512 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3513 !! test
3514 Definition Lists: Mixed Lists: Test 1
3515 !! wikitext
3516 :;* foo
3517 ::* bar
3518 :; baz
3519 !! html/php
3520 <dl><dd><dl><dt><ul><li> foo</li>
3521 <li> bar</li></ul></dt></dl>
3522 <dl><dt> baz</dt></dl></dd></dl>
3523
3524 !! html/php+tidy
3525 <dl>
3526 <dd>
3527 <dl>
3528 <dd>
3529 <ul>
3530 <li>foo</li>
3531 <li>bar</li>
3532 </ul>
3533 </dd>
3534 </dl>
3535 <dl>
3536 <dt>baz</dt>
3537 </dl>
3538 </dd>
3539 </dl>
3540 !! html/parsoid
3541 <dl>
3542 <dd><dl>
3543 <dt><ul>
3544 <li> foo
3545 </li>
3546 </ul></dt>
3547 <dd><ul>
3548 <li> bar
3549 </li>
3550 </ul></dd>
3551 <dt> baz</dt>
3552 </dl></dd>
3553 </dl>
3554 !! end
3555
3556 !! test
3557 Definition Lists: Mixed Lists: Test 2
3558 !! wikitext
3559 *: d1
3560 *: d2
3561 !! html
3562 <ul><li><dl><dd> d1</dd>
3563 <dd> d2</dd></dl></li></ul>
3564
3565 !! end
3566
3567
3568 !! test
3569 Definition Lists: Mixed Lists: Test 3
3570 !! wikitext
3571 *::: d1
3572 *::: d2
3573 !! html
3574 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3575 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3576
3577 !! end
3578
3579
3580 !! test
3581 Definition Lists: Mixed Lists: Test 4
3582 !! wikitext
3583 *;d1 :d2
3584 *;d3 :d4
3585 !! html
3586 <ul><li><dl><dt>d1&#160;</dt>
3587 <dd>d2</dd>
3588 <dt>d3&#160;</dt>
3589 <dd>d4</dd></dl></li></ul>
3590
3591 !! end
3592
3593
3594 !! test
3595 Definition Lists: Mixed Lists: Test 5
3596 !! wikitext
3597 *:d1
3598 *:: d2
3599 !! html
3600 <ul><li><dl><dd>d1
3601 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3602
3603 !! end
3604
3605
3606 !! test
3607 Definition Lists: Mixed Lists: Test 6
3608 !! wikitext
3609 #*:d1
3610 #*::: d3
3611 !! html
3612 <ol><li><ul><li><dl><dd>d1
3613 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3614
3615 !! end
3616
3617
3618 !! test
3619 Definition Lists: Mixed Lists: Test 7
3620 !! wikitext
3621 :* d1
3622 :* d2
3623 !! html
3624 <dl><dd><ul><li> d1</li>
3625 <li> d2</li></ul></dd></dl>
3626
3627 !! end
3628
3629
3630 !! test
3631 Definition Lists: Mixed Lists: Test 8
3632 !! wikitext
3633 :* d1
3634 ::* d2
3635 !! html
3636 <dl><dd><ul><li> d1</li></ul>
3637 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3638
3639 !! end
3640
3641
3642 !! test
3643 Definition Lists: Mixed Lists: Test 9
3644 !! wikitext
3645 *;foo :bar
3646 !! html
3647 <ul><li><dl><dt>foo&#160;</dt>
3648 <dd>bar</dd></dl></li></ul>
3649
3650 !! end
3651
3652
3653 !! test
3654 Definition Lists: Mixed Lists: Test 10
3655 !! wikitext
3656 *#;foo :bar
3657 !! html
3658 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3659 <dd>bar</dd></dl></li></ol></li></ul>
3660
3661 !! end
3662
3663 # The Parsoid team disagrees with the PHP parser's seemingly-random
3664 # rules regarding dd/dt on the next two tests. Parsoid is more
3665 # consistent, and recognizes the shared nesting and keeps the
3666 # still-open tags around until the nesting is complete.
3667 # (And tidy again converts <dt> to <dd> before 'bar'.)
3668
3669 !! test
3670 Definition Lists: Mixed Lists: Test 11
3671 !! wikitext
3672 *#*#;*;;foo :bar
3673 *#*#;boo :baz
3674 !! html/php
3675 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3676 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3677 <dl><dt>boo&#160;</dt>
3678 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3679
3680 !! html/php+tidy
3681 <ul>
3682 <li>
3683 <ol>
3684 <li>
3685 <ul>
3686 <li>
3687 <ol>
3688 <li>
3689 <dl>
3690 <dt>foo&#160;</dt>
3691 <dd>
3692 <ul>
3693 <li>
3694 <dl>
3695 <dd>
3696 <dl>
3697 <dt>bar</dt>
3698 </dl>
3699 </dd>
3700 </dl>
3701 </li>
3702 </ul>
3703 </dd>
3704 </dl>
3705 <dl>
3706 <dt>boo&#160;</dt>
3707 <dd>baz</dd>
3708 </dl>
3709 </li>
3710 </ol>
3711 </li>
3712 </ul>
3713 </li>
3714 </ol>
3715 </li>
3716 </ul>
3717 !! html/parsoid
3718 <ul>
3719 <li>
3720 <ol>
3721 <li>
3722 <ul>
3723 <li>
3724 <ol>
3725 <li>
3726 <dl>
3727 <dt>
3728 <ul>
3729 <li>
3730 <dl>
3731 <dt>
3732 <dl>
3733 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3734 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3735 </dl></dt>
3736 </dl></li>
3737 </ul></dt>
3738 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3739 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3740 </dl></li>
3741 </ol></li>
3742 </ul></li>
3743 </ol></li>
3744 </ul>
3745 !! end
3746
3747
3748 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3749 !! test
3750 Definition Lists: Weird Ones: Test 1
3751 !! wikitext
3752 *#;*::;; foo : bar (who uses this?)
3753 !! html/php
3754 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3755 <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>
3756
3757 !! html/php+tidy
3758 <ul>
3759 <li>
3760 <ol>
3761 <li>
3762 <dl>
3763 <dt>foo&#160;</dt>
3764 <dd>
3765 <ul>
3766 <li>
3767 <dl>
3768 <dd>
3769 <dl>
3770 <dd>
3771 <dl>
3772 <dd>
3773 <dl>
3774 <dt>bar (who uses this?)</dt>
3775 </dl>
3776 </dd>
3777 </dl>
3778 </dd>
3779 </dl>
3780 </dd>
3781 </dl>
3782 </li>
3783 </ul>
3784 </dd>
3785 </dl>
3786 </li>
3787 </ol>
3788 </li>
3789 </ul>
3790 !! html/parsoid
3791 <ul>
3792 <li>
3793 <ol>
3794 <li>
3795 <dl>
3796 <dt>
3797 <ul>
3798 <li>
3799 <dl>
3800 <dd>
3801 <dl>
3802 <dd>
3803 <dl>
3804 <dt>
3805 <dl>
3806 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3807 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3808 </dl></dt>
3809 </dl></dd>
3810 </dl></dd>
3811 </dl></li>
3812 </ul></dt>
3813 </dl></li>
3814 </ol></li>
3815 </ul>
3816 !! end
3817
3818 ###
3819 ### External links
3820 ###
3821 !! test
3822 External links: non-bracketed
3823 !! wikitext
3824 Non-bracketed: http://example.com
3825 !! html
3826 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3827 </p>
3828 !! end
3829
3830 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3831 !! test
3832 External links: numbered
3833 !! wikitext
3834 Numbered: [http://example.com]
3835 Numbered: [http://example.net]
3836 Numbered: [http://example.com]
3837 !! html/php
3838 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3839 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3840 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3841 </p>
3842 !! html/parsoid
3843 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3844 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3845 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3846 !!end
3847
3848 !! test
3849 External links: specified text
3850 !! wikitext
3851 Specified text: [http://example.com link]
3852 !! html
3853 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3854 </p>
3855 !!end
3856
3857 !! test
3858 External links: trail
3859 !! wikitext
3860 Linktrails should not work for external links: [http://example.com link]s
3861 !! html
3862 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3863 </p>
3864 !! end
3865
3866 !! test
3867 External links: dollar sign in URL
3868 !! wikitext
3869 http://example.com/1$2345
3870 !! html
3871 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3872 </p>
3873 !! end
3874
3875 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3876 !! test
3877 External links: dollar sign in URL (autonumber)
3878 !! wikitext
3879 [http://example.com/1$2345]
3880 !! html/php
3881 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3882 </p>
3883 !! html/parsoid
3884 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3885 !!end
3886
3887 !! test
3888 External links: open square bracket forbidden in URL (bug 4377)
3889 !! options
3890 parsoid=wt2html,wt2wt,html2html
3891 !! wikitext
3892 http://example.com/1[2345
3893 !! html/php
3894 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3895 </p>
3896 !! html/parsoid
3897 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3898 !! end
3899
3900 !! test
3901 External links: open square bracket forbidden in URL (named) (bug 4377)
3902 !! options
3903 parsoid=wt2html,html2html
3904 !! wikitext
3905 [http://example.com/1[2345]
3906 !! html/php
3907 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3908 </p>
3909 !! html/parsoid
3910 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3911 !!end
3912
3913 # parsoid adds a space before the link name
3914 !! test
3915 External links: open square bracket forbidden in URL (named) (bug 4377)
3916 Parsoid variant.
3917 !! wikitext
3918 [http://example.com/1 [2345]
3919 !! html
3920 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3921 </p>
3922 !!end
3923
3924 !! test
3925 External links: nowiki in URL link text (bug 6230)
3926 !! wikitext
3927 [http://example.com/ <nowiki>''example site''</nowiki>]
3928 !! html
3929 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 External links: newline forbidden in text (bug 6230 regression check)
3935 !! wikitext
3936 [http://example.com/ first
3937 second]
3938 !! html
3939 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3940 second]
3941 </p>
3942 !!end
3943
3944 !! test
3945 External links: Pipe char between url and text
3946 !! wikitext
3947 [http://example.com | link]
3948 !! html
3949 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3950 </p>
3951 !!end
3952
3953 !! test
3954 External links: protocol-relative URL in brackets
3955 !! wikitext
3956 [//example.com/ Test]
3957 !! html
3958 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3959 </p>
3960 !! end
3961
3962 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3963 !! test
3964 External links: protocol-relative URL in brackets without text
3965 !! wikitext
3966 [//example.com]
3967 !! html/php
3968 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3969 </p>
3970 !! html/parsoid
3971 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3972 !! end
3973
3974 !! test
3975 External links: protocol-relative URL in free text is left alone
3976 !! wikitext
3977 //example.com/Foo
3978 !! html
3979 <p>//example.com/Foo
3980 </p>
3981 !!end
3982
3983 !! test
3984 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3985 !! wikitext
3986 foo//example.com/Foo
3987 !! html
3988 <p>foo//example.com/Foo
3989 </p>
3990 !! end
3991
3992 !! test
3993 External links: with no contents
3994 !! wikitext
3995 [http://en.wikipedia.org/wiki/Foo]
3996
3997 [[wikipedia:Foo|Bar]]
3998
3999 [[wikipedia:Foo|<span>Bar</span>]]
4000 !! html/php
4001 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4002 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4003 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4004 </p>
4005 !! html/parsoid
4006 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4007 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
4008 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
4009 !! end
4010
4011 !! test
4012 External image
4013 !! wikitext
4014 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4015 !! html
4016 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4017 </p>
4018 !! end
4019
4020 !! test
4021 External image from https
4022 !! wikitext
4023 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4024 !! html
4025 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4026 </p>
4027 !! end
4028
4029 !! test
4030 External image (when not allowed)
4031 !! options
4032 wgAllowExternalImages=0
4033 !! wikitext
4034 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4035 !! html
4036 <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>
4037 </p>
4038 !! end
4039
4040 !! test
4041 Link to non-http image, no img tag
4042 !! wikitext
4043 Link to non-http image, no img tag: ftp://example.com/test.jpg
4044 !! html
4045 <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>
4046 </p>
4047 !! end
4048
4049 !! test
4050 External links: terminating separator
4051 !! wikitext
4052 Terminating separator: http://example.com/thing,
4053 !! html
4054 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4055 </p>
4056 !! end
4057
4058 !! test
4059 External links: intervening separator
4060 !! wikitext
4061 Intervening separator: http://example.com/1,2,3
4062 !! html
4063 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4064 </p>
4065 !! end
4066
4067 !! test
4068 External links: old bug with URL in query
4069 !! wikitext
4070 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4071 !! html
4072 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4073 </p>
4074 !! end
4075
4076 !! test
4077 External links: old URL-in-URL bug, mixed protocols
4078 !! wikitext
4079 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4080 !! html
4081 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4082 </p>
4083 !!end
4084
4085 !! test
4086 External links: URL in text
4087 !! wikitext
4088 URL in text: [http://example.com http://example.com]
4089 !! html
4090 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4091 </p>
4092 !! end
4093
4094 !! test
4095 External links: Clickable images
4096 !! wikitext
4097 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4098 !! html
4099 <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>
4100 </p>
4101 !!end
4102
4103 !! test
4104 External links: raw ampersand
4105 !! wikitext
4106 Old &amp; use: http://x&y
4107 !! html
4108 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4109 </p>
4110 !! end
4111
4112 !! test
4113 External links: encoded ampersand
4114 !! wikitext
4115 Old &amp; use: http://x&amp;y
4116 !! html/php
4117 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4118 </p>
4119 !! html/parsoid
4120 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4121 !! end
4122
4123 !! test
4124 External links: encoded equals (bug 6102)
4125 !! wikitext
4126 http://example.com/?foo&#61;bar
4127 !! html/php
4128 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4129 </p>
4130 !! html/parsoid
4131 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4132 !! end
4133
4134 ##
4135 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4136 ## does it number them. As discussed in bug 53505, we can identify
4137 ## autonumbered links via CSS.
4138 ##
4139
4140 !! test
4141 External links: [raw ampersand]
4142 !! wikitext
4143 Old &amp; use: [http://x&y]
4144 !! html/php
4145 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4146 </p>
4147 !! html/parsoid
4148 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4149 !! end
4150
4151 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4152 # mode will return the [raw ampersand] wikitext
4153 !! test
4154 External links: [encoded ampersand]
4155 !! options
4156 parsoid=wt2html,wt2wt,html2html
4157 !! wikitext
4158 Old &amp; use: [http://x&amp;y]
4159 !! html/php
4160 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4161 </p>
4162 !! html/parsoid
4163 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4164 !! end
4165
4166 !! test
4167 External links: [raw equals]
4168 !! wikitext
4169 [http://example.com/?foo=bar]
4170 !! html/php
4171 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4172 </p>
4173 !! html/parsoid
4174 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4175 !! end
4176
4177 # note that parsoid html is identical to [raw equals] case; so html2wt
4178 # mode will return the [raw equals] wikitext
4179 !! test
4180 External links: [encoded equals] (bug 6102)
4181 !! options
4182 parsoid=wt2html,wt2wt,html2html
4183 !! wikitext
4184 [http://example.com/?foo&#61;bar]
4185 !! html/php
4186 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4187 </p>
4188 !! html/parsoid
4189 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4190 !! end
4191
4192 # xxx parsoid strips the IDN character, so the round-trip tests will
4193 # obviously fail and are disabled. --cscott
4194 !! test
4195 External links: [IDN ignored character reference in hostname; strip it right off]
4196 !! options
4197 parsoid=wt2html,wt2wt,html2html
4198 !! wikitext
4199 [http://e&zwnj;xample.com/]
4200 !! html/php
4201 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4205 !! end
4206
4207 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4208 # Where an external link could easily circumvent the sanitization of the text of
4209 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4210 # test demands a higher standard. That's a bit strange.
4211 #
4212 # Example:
4213 #
4214 # http://e‌xample.com -> [http://example.com|http://example.com]
4215 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4216 #
4217 # The first example is sanitized, but the second is not. Any security benefits
4218 # from this production are trivial to circumvent. Either remove this test and
4219 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4220 # the test accordingly.
4221 #
4222 # All our love,
4223 # The Parsoid team.
4224 # xxx parsoid strips the IDN character, so the round-trip tests will
4225 # obviously fail and are disabled. --cscott
4226 !! test
4227 External links: IDN ignored character reference in hostname; strip it right off
4228 !! options
4229 parsoid=wt2html,html2html
4230 !! wikitext
4231 http://e&zwnj;xample.com/
4232 !! html/php
4233 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4234 </p>
4235 !! html/parsoid
4236 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4237 !! end
4238
4239 !! test
4240 External links: www.jpeg.org (bug 554)
4241 !! wikitext
4242 http://www.jpeg.org
4243 !! html
4244 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4245 </p>
4246 !! end
4247
4248 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4249 !! test
4250 External links: URL within URL (original bug 2)
4251 !! wikitext
4252 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4253 !! html/php
4254 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4255 </p>
4256 !! html/parsoid
4257 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4258 !! end
4259
4260 !! test
4261 BUG 361: URL inside bracketed URL
4262 !! wikitext
4263 [http://www.example.com/foo http://www.example.com/bar]
4264 !! html
4265 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4266 </p>
4267 !! end
4268
4269 !! test
4270 BUG 361: URL within URL, not bracketed
4271 !! wikitext
4272 http://www.example.com/foo?=http://www.example.com/bar
4273 !! html
4274 <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>
4275 </p>
4276 !! end
4277
4278 !! test
4279 BUG 289: ">"-token in URL-tail
4280 !! wikitext
4281 http://www.example.com/<hello>
4282 !! html
4283 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4284 </p>
4285 !!end
4286
4287 !! test
4288 BUG 289: literal ">"-token in URL-tail
4289 !! wikitext
4290 http://www.example.com/<b>html</b>
4291 !! html
4292 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4293 </p>
4294 !!end
4295
4296 !! test
4297 BUG 289: ">"-token in bracketed URL
4298 !! wikitext
4299 [http://www.example.com/<hello> stuff]
4300 !! html
4301 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4302 </p>
4303 !!end
4304
4305 !! test
4306 BUG 289: literal ">"-token in bracketed URL
4307 !! wikitext
4308 [http://www.example.com/<b>html</b> stuff]
4309 !! html
4310 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4311 </p>
4312 !!end
4313
4314 !! test
4315 BUG 289: literal double quote at end of URL
4316 !! wikitext
4317 http://www.example.com/"hello"
4318 !! html
4319 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4320 </p>
4321 !!end
4322
4323 !! test
4324 BUG 289: literal double quote in bracketed URL
4325 !! wikitext
4326 [http://www.example.com/"hello" stuff]
4327 !! html
4328 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4329 </p>
4330 !!end
4331
4332 !! test
4333 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4334 !! wikitext
4335 [http://www.example.com test]
4336 !! html
4337 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4338 </p>
4339 !! end
4340
4341 !! test
4342 External links: link text with spaces
4343 !! wikitext
4344 [http://www.example.com a b c]
4345 [http://www.example.com ''a'' ''b'']
4346 !! html
4347 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4348 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4349 </p>
4350 !! end
4351
4352 !! test
4353 External links: wiki links within external link (Bug 3695)
4354 !! wikitext
4355 [http://example.com [[wikilink]] embedded in ext link]
4356 !! html/php
4357 <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>
4358 </p>
4359 !! html/parsoid
4360 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4361 !! end
4362
4363 !! test
4364 BUG 787: Links with one slash after the url protocol are invalid
4365 !! wikitext
4366 http:/example.com
4367
4368 [http:/example.com title]
4369 !! html
4370 <p>http:/example.com
4371 </p><p>[http:/example.com title]
4372 </p>
4373 !! end
4374
4375 !! test
4376 Bracketed external links with template-generated invalid target
4377 !! wikitext
4378 [{{echo|http:/example.com}} title]
4379 !! html
4380 <p>[http:/example.com title]
4381 </p>
4382 !! end
4383
4384 !! test
4385 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4386 !! wikitext
4387 ''[http://example.com text'']
4388 [http://example.com '''text]'''
4389 ''Something [http://example.com in italic'']
4390 ''Something [http://example.com mixed''''', even bold]'''
4391 '''''Now [http://example.com both''''']
4392 !! html
4393 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4394 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4395 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4396 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4397 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4398 </p>
4399 !! end
4400
4401
4402 !! test
4403 Bug 4781: %26 in URL
4404 !! wikitext
4405 http://www.example.com/?title=AT%26T
4406 !! html/php
4407 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4408 </p>
4409 !! html/parsoid
4410 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4411 !! end
4412
4413 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4414 # % is actually legal in HTML5. Any change in output would need testing though.
4415 !! test
4416 Bug 4781, 5267: %25 in URL
4417 !! wikitext
4418 http://www.example.com/?title=100%25_Bran
4419 !! html/php
4420 <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>
4421 </p>
4422 !! html/parsoid
4423 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4424 !! end
4425
4426 !! test
4427 Bug 4781, 5267: %28, %29 in URL
4428 !! wikitext
4429 http://www.example.com/?title=Ben-Hur_%281959_film%29
4430 !! html/php
4431 <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>
4432 </p>
4433 !! html/parsoid
4434 <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>
4435 !! end
4436
4437
4438 !! test
4439 Bug 4781: %26 in autonumber URL
4440 !! wikitext
4441 [http://www.example.com/?title=AT%26T]
4442 !! html/php
4443 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4447 !! end
4448
4449 !! test
4450 Bug 4781, 5267: %26 in autonumber URL
4451 !! wikitext
4452 [http://www.example.com/?title=100%25_Bran]
4453 !! html/php
4454 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4455 </p>
4456 !! html/parsoid
4457 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4458 !! end
4459
4460 !! test
4461 Bug 4781, 5267: %28, %29 in autonumber URL
4462 !! wikitext
4463 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4464 !! html/php
4465 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4466 </p>
4467 !! html/parsoid
4468 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4469 !! end
4470
4471
4472 !! test
4473 Bug 4781: %26 in bracketed URL
4474 !! wikitext
4475 [http://www.example.com/?title=AT%26T link]
4476 !! html/php
4477 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4478 </p>
4479 !! html/parsoid
4480 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4481 !! end
4482
4483 !! test
4484 Bug 4781, 5267: %25 in bracketed URL
4485 !! wikitext
4486 [http://www.example.com/?title=100%25_Bran link]
4487 !! html
4488 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4489 </p>
4490 !! end
4491
4492 !! test
4493 Bug 4781, 5267: %28, %29 in bracketed URL
4494 !! wikitext
4495 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4496 !! html/php
4497 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4498 </p>
4499 !! html/parsoid
4500 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4501 !! end
4502
4503 !! test
4504 External link containing a period in the anchor. (bug 63947)
4505 !! wikitext
4506 [//foo.org/bar#baz. bang]
4507
4508 [//foo.org/bar. bang]
4509 !! html/php
4510 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4511 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4512 </p>
4513 !! html/parsoid
4514 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4515 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4516 !! end
4517
4518 !! test
4519 External link containing a single quote. (bug 63947)
4520 !! wikitext
4521 [//foo.org/bar'baz]
4522
4523 [//foo.org/bar'baz bang]
4524 !! html/php
4525 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4526 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4530 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4531 !! end
4532
4533
4534 !! test
4535 External link containing a period in the anchor. (bug 63947)
4536 !! wikitext
4537 [//foo.org/bar#baz. bang]
4538
4539 [//foo.org/bar. bang]
4540 !! html/php
4541 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4542 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4543 </p>
4544 !! html/parsoid
4545 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4546 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4547 !! end
4548
4549 !! test
4550 External link containing a single quote. (bug 63947)
4551 !! wikitext
4552 [//foo.org/bar'baz]
4553
4554 [//foo.org/bar'baz bang]
4555 !! html/php
4556 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4557 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4558 </p>
4559 !! html/parsoid
4560 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4561 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4562 !! end
4563
4564
4565 !! test
4566 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4567 !! wikitext
4568 Some [http://example.com/ pretty ''italics'' and stuff]!
4569 !! html
4570 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4571 </p>
4572 !! end
4573
4574 !! test
4575 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4576 !! wikitext
4577 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4578 !! html
4579 <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>
4580 </p>
4581 !! end
4582
4583 !! test
4584 External link containing double-single-quotes with no space separating the url from text in italics
4585 !! wikitext
4586 [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]].]
4587 !! html/php
4588 <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>
4589 </p>
4590 !! html/php+tidy
4591 <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> <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>.</p>
4592 !! html/parsoid
4593 <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)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
4594 !! end
4595
4596 !! test
4597 External link with comments in link text
4598 !! wikitext
4599 [http://www.google.com Google <!-- comment -->]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4602 </p>
4603 !! end
4604
4605 !! test
4606 URL-encoding in URL functions (single parameter)
4607 !! wikitext
4608 {{localurl:Some page|amp=&}}
4609 !! html
4610 <p>/index.php?title=Some_page&amp;amp=&amp;
4611 </p>
4612 !! end
4613
4614 !! test
4615 URL-encoding in URL functions (multiple parameters)
4616 !! wikitext
4617 {{localurl:Some page|q=?&amp=&}}
4618 !! html
4619 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4620 </p>
4621 !! end
4622
4623 !! test
4624 Brackets in urls
4625 !! wikitext
4626 http://example.com/index.php?foozoid%5B%5D=bar
4627
4628 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4629 !! html/php
4630 <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>
4631 </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>
4632 </p>
4633 !! html/parsoid
4634 <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>
4635
4636 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4637 !! end
4638
4639 !! test
4640 IPv6 urls (bug 21261)
4641 !! options
4642 disabled
4643 !! wikitext
4644 http://[2404:130:0:1000::187:2]/index.php
4645 !! html
4646 <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>
4647 </p>
4648 !! end
4649
4650 !! test
4651 Non-extlinks in brackets
4652 !! wikitext
4653 [foo]
4654 [foo bar]
4655 [foo ''bar'']
4656 [fool's] errand
4657 [fool's errand]
4658 [{{echo|foo}}]
4659 [{{echo|foo}} bar]
4660 [{{echo|foo}} ''bar'']
4661 [{{echo|foo}}l's] errand
4662 [{{echo|foo}}l's errand]
4663 [url={{echo|foo}}]
4664 [url=http://example.com]
4665 !! html
4666 <p>[foo]
4667 [foo bar]
4668 [foo <i>bar</i>]
4669 [fool's] errand
4670 [fool's errand]
4671 [foo]
4672 [foo bar]
4673 [foo <i>bar</i>]
4674 [fool's] errand
4675 [fool's errand]
4676 [url=foo]
4677 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4678 </p>
4679 !! end
4680
4681 !! test
4682 Percent encoding in external links
4683 !! wikitext
4684 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4685 !! html/php
4686 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4687 </p>
4688 !! html/parsoid
4689 <p><a rel="mw:ExtLink"
4690 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4691 !! end
4692
4693 !! test
4694 Use url link syntax for links where the content is equal the link target
4695 !! wikitext
4696 http://example.com
4697 !! html/php
4698 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4702 !! end
4703
4704 !! test
4705 Parenthesis in external links, especially URL links
4706 !! wikitext
4707 http://example.com)
4708
4709 http://example.com/test)
4710
4711 http://example.com/(test)
4712
4713 http://example.com/((test)
4714
4715 (http://example.com/(test))
4716
4717 (http://example.com/(test)))))
4718
4719 http://example.com/a)b
4720
4721 [http://example.com) foo]
4722 !! html/php
4723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4724 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4725 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4726 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4727 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4728 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4729 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4730 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4734 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4735 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4736 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4737 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4738 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4739 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4740 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4741 !! end
4742
4743 !! test
4744 Parenthesis in external links, w/ transclusion or comment
4745 !! wikitext
4746 (http://example.com/{{echo|hi}})
4747
4748 (http://example.com<!-- hi -->)
4749 !! html/php
4750 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4751 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4752 </p>
4753 !! html/parsoid
4754 <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>
4755
4756 <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>
4757 !! end
4758
4759 !! test
4760 Replace invalid link targets when serializing
4761 !! options
4762 parsoid=html2wt
4763 !! html
4764 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4765 !! wikitext
4766 [[MediaWiki:Badtitletext|Manual]]
4767 !! end
4768
4769 ###
4770 ### Quotes
4771 ###
4772
4773 !! test
4774 Quotes
4775 !! wikitext
4776 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4777
4778 Normal text. '''''Bold italic text.''''' Normal text.
4779 !! html
4780 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4781 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4782 </p>
4783 !! end
4784
4785
4786 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4787 # parser strips. The wikitext contains just the first half of the bold
4788 # quote pair.
4789 !! test
4790 Unclosed and unmatched quotes
4791 !! wikitext
4792 '''''Bold italic text '''with bold deactivated''' in between.'''''
4793
4794 '''''Bold italic text ''with italic deactivated'' in between.'''''
4795
4796 '''Bold text..
4797
4798 ..spanning two paragraphs (should not work).'''
4799
4800 '''Bold tag left open
4801
4802 ''Italic tag left open
4803
4804 Normal text.
4805
4806 <!-- Unmatching number of opening, closing tags: -->
4807 '''This year''''s election ''should'' beat '''last year''''s.
4808
4809 ''Tom'''s car is bigger than ''Susan'''s.
4810
4811 Plain ''italic'''s plain
4812 !! html/php
4813 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4814 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4815 </p><p><b>Bold text..</b>
4816 </p><p>..spanning two paragraphs (should not work).
4817 </p><p><b>Bold tag left open</b>
4818 </p><p><i>Italic tag left open</i>
4819 </p><p>Normal text.
4820 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4821 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4822 </p><p>Plain <i>italic'</i>s plain
4823 </p>
4824 !! html/parsoid
4825 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4826 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4827 </p><p><b>Bold text..</b>
4828 </p><p>..spanning two paragraphs (should not work).<b></b>
4829 </p><p><b>Bold tag left open</b>
4830 </p><p><i>Italic tag left open</i>
4831 </p><p>Normal text.
4832 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4834 </p><p>Plain <i>italic'</i>s plain
4835 </p>
4836 !! end
4837
4838 ###
4839 ### Tables
4840 ###
4841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4842 ###
4843
4844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4845 # is the bare minimum required by the spec, see:
4846 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4847 # Parsoid team replies: empty table tags are legal in HTML5
4848 !! test
4849 A table with no data.
4850 !! options
4851 parsoid=wt2html
4852 !! wikitext
4853 {||}
4854 !! html/php
4855
4856 !! html/parsoid
4857 <table></table>
4858
4859 !! end
4860
4861 !! test
4862 A table with stray table end tags on start tag line (wt2html)
4863 !! options
4864 parsoid=wt2html
4865 !! wikitext
4866 {|style="color: red;"|}
4867
4868 {|style="color: red;" |}
4869 |foo
4870 |}
4871
4872 {|style="color: red;"|} id="foo"
4873 |foo
4874 |}
4875
4876 {|style="color: red;" |} id="foo"
4877 |foo
4878 |}
4879 !! html
4880 <table style="color: red;"></table>
4881
4882 <table style="color: red;">
4883 <tbody><tr>
4884 <td>foo</td>
4885 </tr></tbody>
4886 </table>
4887
4888 <table style="color: red;" id="foo">
4889 <tbody><tr>
4890 <td>foo</td>
4891 </tr></tbody>
4892 </table>
4893
4894 <table style="color: red;" id="foo">
4895 <tbody><tr>
4896 <td>foo</td>
4897 </tr></tbody>
4898 </table>
4899
4900 !! end
4901
4902 !! test
4903 A table with no data (take 2)
4904 !! wikitext
4905 {|
4906 |}
4907 !! html/parsoid
4908 <table></table>
4909 !! end
4910
4911 # A table with nothing but a caption is invalid XHTML, we might want to render
4912 # this as <p>caption</p>
4913 # Parsoid team replies: table with only a caption is legal in HTML5
4914 !! test
4915 A table with nothing but a caption
4916 !! wikitext
4917 {|
4918 |+ caption
4919 |}
4920 !! html/php
4921 <table>
4922 <caption> caption
4923 </caption><tr><td></td></tr></table>
4924
4925 !! html/parsoid
4926 <table><caption> caption</caption></table>
4927 !! end
4928
4929 !! test
4930 A table with caption with default-spaced attributes and a table row
4931 !! wikitext
4932 {|
4933 |+ style="color: red;" | caption1
4934 |-
4935 | foo
4936 |}
4937 !! html
4938 <table>
4939 <caption style="color: red;"> caption1
4940 </caption>
4941 <tr>
4942 <td> foo
4943 </td></tr></table>
4944
4945 !! end
4946
4947 !! test
4948 A table with captions with non-default spaced attributes and a table row
4949 !! wikitext
4950 {|
4951 |+style="color: red;"|caption2
4952 |+ style="color: red;"| caption3
4953 |-
4954 | foo
4955 |}
4956 !! html
4957 <table>
4958 <caption style="color: red;">caption2
4959 </caption>
4960 <caption style="color: red;"> caption3
4961 </caption>
4962 <tr>
4963 <td> foo
4964 </td></tr></table>
4965
4966 !! end
4967
4968 !! test
4969 Table td-cell syntax variations
4970 !! wikitext
4971 {|
4972 | foo bar foo | baz
4973 | foo bar foo || baz
4974 | style='color:red;' | baz
4975 | style='color:red;' || baz
4976 |}
4977 !! html
4978 <table>
4979 <tr>
4980 <td> baz
4981 </td>
4982 <td> foo bar foo </td>
4983 <td> baz
4984 </td>
4985 <td style="color:red;"> baz
4986 </td>
4987 <td> style='color:red;' </td>
4988 <td> baz
4989 </td></tr></table>
4990
4991 !! end
4992
4993 !! test
4994 Simple table
4995 !! wikitext
4996 {|
4997 | 1 || 2
4998 |-
4999 | 3 || 4
5000 |}
5001 !! html
5002 <table>
5003 <tr>
5004 <td> 1 </td>
5005 <td> 2
5006 </td></tr>
5007 <tr>
5008 <td> 3 </td>
5009 <td> 4
5010 </td></tr></table>
5011
5012 !! end
5013
5014 !! test
5015 Simple table but with multiple dashes for row wikitext
5016 !! wikitext
5017 {|
5018 | foo
5019 |-----
5020 | bar
5021 |}
5022 !! html
5023 <table>
5024 <tr>
5025 <td> foo
5026 </td></tr>
5027 <tr>
5028 <td> bar
5029 </td></tr></table>
5030
5031 !! end
5032 !! test
5033 Multiplication table
5034 !! wikitext
5035 {| border="1" cellpadding="2"
5036 |+Multiplication table
5037 |-
5038 ! &times; !! 1 !! 2 !! 3
5039 |-
5040 ! 1
5041 | 1 || 2 || 3
5042 |-
5043 ! 2
5044 | 2 || 4 || 6
5045 |-
5046 ! 3
5047 | 3 || 6 || 9
5048 |-
5049 ! 4
5050 | 4 || 8 || 12
5051 |-
5052 ! 5
5053 | 5 || 10 || 15
5054 |}
5055 !! html
5056 <table border="1" cellpadding="2">
5057 <caption>Multiplication table
5058 </caption>
5059 <tr>
5060 <th> &#215; </th>
5061 <th> 1 </th>
5062 <th> 2 </th>
5063 <th> 3
5064 </th></tr>
5065 <tr>
5066 <th> 1
5067 </th>
5068 <td> 1 </td>
5069 <td> 2 </td>
5070 <td> 3
5071 </td></tr>
5072 <tr>
5073 <th> 2
5074 </th>
5075 <td> 2 </td>
5076 <td> 4 </td>
5077 <td> 6
5078 </td></tr>
5079 <tr>
5080 <th> 3
5081 </th>
5082 <td> 3 </td>
5083 <td> 6 </td>
5084 <td> 9
5085 </td></tr>
5086 <tr>
5087 <th> 4
5088 </th>
5089 <td> 4 </td>
5090 <td> 8 </td>
5091 <td> 12
5092 </td></tr>
5093 <tr>
5094 <th> 5
5095 </th>
5096 <td> 5 </td>
5097 <td> 10 </td>
5098 <td> 15
5099 </td></tr></table>
5100
5101 !! end
5102
5103 !! test
5104 Accept "||" in table headings
5105 !! wikitext
5106 {|
5107 !h1 || h2
5108 |}
5109 !! html
5110 <table>
5111 <tr>
5112 <th>h1 </th>
5113 <th> h2
5114 </th></tr></table>
5115
5116 !! end
5117
5118 !! test
5119 Accept "!!" in table data
5120 !! wikitext
5121 {|
5122 | Foo!! ||
5123 |}
5124 !! html
5125 <table>
5126 <tr>
5127 <td> Foo!! </td>
5128 <td>
5129 </td></tr></table>
5130
5131 !! html/parsoid
5132 <table data-parsoid='{}'>
5133 <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>
5134 </tbody></table>
5135 !! end
5136
5137 !! test
5138 Accept "||" in indented table headings
5139 !! wikitext
5140 :{|
5141 !h1 || h2
5142 |}
5143 !! html
5144 <dl><dd><table>
5145 <tr>
5146 <th>h1 </th>
5147 <th> h2
5148 </th></tr></table></dd></dl>
5149
5150 !! end
5151
5152 !! test
5153 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5154 !! wikitext
5155 {|
5156 !| h1
5157 || a
5158 |}
5159 !! html
5160 <table>
5161 <tr>
5162 <th> h1
5163 </th>
5164 <td> a
5165 </td></tr></table>
5166
5167 !! end
5168
5169 !!test
5170 Accept "| !" at start of line in tables (ignore !-attribute)
5171 !! wikitext
5172 {|
5173 |-
5174 | !style="color:red" | bar
5175 |}
5176 !! html
5177 <table>
5178
5179 <tr>
5180 <td> bar
5181 </td></tr></table>
5182
5183 !!end
5184
5185 !!test
5186 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 +/-
5187 !! wikitext
5188 {|
5189 |-
5190 |style='color:red;'|+1
5191 |style='color:blue;'|-1
5192 |-
5193 | 1 || 2 || 3
5194 | 1 ||+2 ||-3
5195 |-
5196 | +1
5197 | -1
5198 |}
5199 !! html
5200 <table>
5201
5202 <tr>
5203 <td style="color:red;">+1
5204 </td>
5205 <td style="color:blue;">-1
5206 </td></tr>
5207 <tr>
5208 <td> 1 </td>
5209 <td> 2 </td>
5210 <td> 3
5211 </td>
5212 <td> 1 </td>
5213 <td>+2 </td>
5214 <td>-3
5215 </td></tr>
5216 <tr>
5217 <td> +1
5218 </td>
5219 <td> -1
5220 </td></tr></table>
5221
5222 !!end
5223
5224 !! test
5225 Table rowspan
5226 !! wikitext
5227 {| border=1
5228 | Cell 1, row 1
5229 |rowspan=2| Cell 2, row 1 (and 2)
5230 | Cell 3, row 1
5231 |-
5232 | Cell 1, row 2
5233 | Cell 3, row 2
5234 |}
5235 !! html
5236 <table border="1">
5237 <tr>
5238 <td> Cell 1, row 1
5239 </td>
5240 <td rowspan="2"> Cell 2, row 1 (and 2)
5241 </td>
5242 <td> Cell 3, row 1
5243 </td></tr>
5244 <tr>
5245 <td> Cell 1, row 2
5246 </td>
5247 <td> Cell 3, row 2
5248 </td></tr></table>
5249
5250 !! end
5251
5252 !! test
5253 Nested table
5254 !! wikitext
5255 {| border=1
5256 | &alpha;
5257 |
5258 {| bgcolor=#ABCDEF border=2
5259 |nested
5260 |-
5261 |table
5262 |}
5263 |the original table again
5264 |}
5265 !! html
5266 <table border="1">
5267 <tr>
5268 <td> &#945;
5269 </td>
5270 <td>
5271 <table bgcolor="#ABCDEF" border="2">
5272 <tr>
5273 <td>nested
5274 </td></tr>
5275 <tr>
5276 <td>table
5277 </td></tr></table>
5278 </td>
5279 <td>the original table again
5280 </td></tr></table>
5281
5282 !! end
5283
5284 !! test
5285 Invalid attributes in table cell (bug 1830)
5286 !! wikitext
5287 {|
5288 |Cell:|broken
5289 |}
5290 !! html
5291 <table>
5292 <tr>
5293 <td>broken
5294 </td></tr></table>
5295
5296 !! end
5297
5298
5299 # The "|}" to close the table is missing from the input, so parsoid's
5300 # *2wt modes will fail.
5301 !! test
5302 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5303 !! options
5304 parsoid=wt2html,html2html
5305 !! wikitext
5306 {|
5307 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5308 !! html/php
5309 <table>
5310 <tr>
5311 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5312 <td>]" onmouseover="alert(document.cookie)"&gt;test
5313 </td>
5314 </tr>
5315 </table>
5316
5317 !! html/parsoid
5318 <table><tbody>
5319 <tr>
5320 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5321 !! end
5322
5323
5324 !! test
5325 Indented table markup mixed with indented pre content (proposed in bug 6200)
5326 !! wikitext
5327 <table>
5328 <tr>
5329 <td>
5330 Text that should be rendered preformatted
5331 </td>
5332 </tr>
5333 </table>
5334 !! html
5335 <table>
5336 <tr>
5337 <td>
5338 <pre>Text that should be rendered preformatted
5339 </pre>
5340 </td>
5341 </tr>
5342 </table>
5343
5344 !! end
5345
5346 !! test
5347 Template-generated table cell attributes and cell content
5348 !! wikitext
5349 {|
5350 |{{table_attribs}}
5351 | {{table_attribs}}
5352 |}
5353 !! html
5354 <table>
5355 <tr>
5356 <td style="color: red"> Foo
5357 </td>
5358 <td style="color: red"> Foo
5359 </td></tr></table>
5360
5361 !! end
5362
5363 !! test
5364 Template-generated table cell attributes and cell content (2)
5365 !! wikitext
5366 {|
5367 |align=center {{table_attribs}}
5368 |}
5369 !! html
5370 <table>
5371 <tr>
5372 <td align="center" style="color: red"> Foo
5373 </td></tr></table>
5374
5375 !! end
5376
5377 !! test
5378 Template-generated table cell attributes and cell content (3)
5379 !! wikitext
5380 {|
5381 |align=center {{table_cells}}
5382 |}
5383 !! html
5384 <table>
5385 <tr>
5386 <td align="center" style="color: red"> Foo </td>
5387 <td> Bar </td>
5388 <td> Baz
5389 </td></tr></table>
5390
5391 !! end
5392
5393 !! test
5394 Table with row followed by newlines and table heading
5395 !! wikitext
5396 {|
5397 |-
5398
5399 ! foo
5400 |}
5401 !! html
5402 <table>
5403
5404
5405 <tr>
5406 <th> foo
5407 </th></tr></table>
5408
5409 !! end
5410
5411 !! test
5412 Table with empty line following the start tag
5413 !! wikitext
5414 {|
5415
5416 |-
5417 | foo
5418 |}
5419 !! html
5420 <table>
5421
5422
5423 <tr>
5424 <td> foo
5425 </td></tr></table>
5426
5427 !! end
5428
5429 # FIXME: Preserve the attribute properly (with an empty string as value) in
5430 # the PHP parser. Parsoid implements the behavior below.
5431 !! test
5432 Table attributes with empty value
5433 !! wikitext
5434 {|
5435 | style=| hello
5436 |}
5437 !! html/parsoid
5438 <table>
5439 <tbody>
5440 <tr>
5441 <td style=""> hello
5442 </td></tr></tbody></table>
5443
5444 !! end
5445
5446 !! test
5447 Wikitext table with a lot of comments
5448 !! wikitext
5449 {|
5450 <!-- c0 -->
5451 | foo
5452 <!-- c1 -->
5453 |- <!-- c2 -->
5454 <!-- c3 -->
5455 |<!-- c4 -->
5456 <!-- c5 -->
5457 |}
5458 !! html
5459 <table>
5460 <tr>
5461 <td> foo
5462 </td></tr>
5463 <tr>
5464 <td>
5465 </td></tr></table>
5466
5467 !! end
5468
5469 !! test
5470 Wikitext table with double-line table cell
5471 !! wikitext
5472 {|
5473 |a
5474 b
5475 |}
5476 !! html
5477 <table>
5478 <tr>
5479 <td>a
5480 <p>b
5481 </p>
5482 </td></tr></table>
5483
5484 !! end
5485
5486 !! test
5487 Table cell with a single comment
5488 !! wikitext
5489 {|
5490 | <!-- c1 -->
5491 | a
5492 |}
5493 !! html
5494 <table>
5495 <tr>
5496 <td>
5497 </td>
5498 <td> a
5499 </td></tr></table>
5500
5501 !! end
5502
5503 !! test
5504 Table-cell after a comment-only-empty-line
5505 !! wikitext
5506 {|
5507 |a
5508 <!--c1-->
5509 <!--c2-->| b
5510 |}
5511 !! html
5512 <table>
5513 <tr>
5514 <td>a
5515 </td>
5516 <td> b
5517 </td></tr></table>
5518
5519 !! html/parsoid
5520 <table>
5521 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5522 <!--c1-->
5523 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5524 </tbody></table>
5525
5526 !! end
5527
5528 # The expected HTML structure in this test is debatable. The PHP parser does
5529 # not parse this kind of table at all. The main focus for Parsoid is on
5530 # round-tripping, so this output is ok for now. TODO: revisit!
5531 !! test
5532 Wikitext table with html-syntax row
5533 !! wikitext
5534 {|
5535 |-
5536 <td>foo</td>
5537 |}
5538 !! html/parsoid
5539 <table>
5540 <tbody>
5541 <tr>
5542 <td>foo</td></tr></tbody></table>
5543 !! end
5544
5545 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5546 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5547 ## PHP parser, which tidy then compounds by fostering the content
5548 ## entirely out of the table. Parsoid recognizes the table context
5549 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
5550 ## depends on PHP's treatment of broken table markup!
5551 !! test
5552 Implicit <td> after a |-
5553 !! options
5554 parsoid=wt2html,wt2wt
5555 !! wikitext
5556 {|
5557 |-
5558 a
5559 |}
5560 !! html/php
5561 <table>
5562
5563 a
5564 </table>
5565
5566 !! html/php+tidy
5567 <p>a</p>
5568 !! html/parsoid
5569 <table>
5570 <tr><td>a</td></tr>
5571 </table>
5572 !! end
5573
5574 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5575 !! test
5576 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5577 !! options
5578 parsoid=wt2html,wt2wt
5579 !! wikitext
5580 {|
5581 |-
5582 |
5583 a
5584 |-
5585 b
5586 |}
5587 !! html/php
5588 <table>
5589
5590 <tr>
5591 <td>
5592 <pre>a
5593 </pre>
5594 </td></tr>
5595 b
5596 </table>
5597
5598 !! html/php+tidy
5599 <p>b</p>
5600 <table>
5601 <tr>
5602 <td>
5603 <pre>
5604 a
5605 </pre></td>
5606 </tr>
5607 </table>
5608 !! html/parsoid
5609 <table>
5610 <tbody>
5611 <tr><td><pre>a</pre></td></tr>
5612 <tr><td> b</td></tr>
5613 </tbody>
5614 </table>
5615 !! end
5616
5617 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5618 !! test
5619 Lists should be recognized in an implicit <td> context
5620 !! options
5621 parsoid=wt2html,wt2wt
5622 !! wikitext
5623 {|
5624 |-
5625 *a
5626 |}
5627 !! html/php
5628 <table>
5629
5630 <ul><li>a</li></ul>
5631 </table>
5632
5633 !! html/php+tidy
5634 <ul>
5635 <li>a</li>
5636 </ul>
5637 !! html/parsoid
5638 <table>
5639 <tr>
5640 <td><ul>
5641 <li>a</li>
5642 </ul></td>
5643 </tr>
5644 </table>
5645 !! end
5646
5647 !! test
5648 Parsoid: Round-trip tables directly followed by content (bug 51219)
5649 !! options
5650 parsoid=wt2html,wt2wt
5651 !! wikitext
5652 {|
5653 |foo
5654 |} bar
5655
5656 {|
5657 |baz
5658 |}<b>quux</b>
5659 !! html
5660 <table><tbody>
5661 <tr>
5662 <td>foo</td></tr></tbody></table> bar
5663 <table>
5664 <tbody>
5665 <tr>
5666 <td>baz</td></tr></tbody></table><b>quux</b>
5667 !! end
5668
5669 !! test
5670 Parsoid: Default to a newline after tables in new content (bug 51219)
5671 !! options
5672 parsoid=html2wt
5673 !! wikitext
5674 {|
5675 |foo
5676 |}
5677 <nowiki> </nowiki>bar
5678 {|
5679 |baz
5680 |}
5681 '''quux'''
5682 !! html
5683 <table><tbody>
5684 <tr><td>foo</td></tr></tbody></table> bar
5685 <table><tbody>
5686 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5687 !! end
5688
5689 !! test
5690 Parsoid: newline inducing block nodes don't suppress <nowiki>
5691 !! options
5692 parsoid=html2wt
5693 !! wikitext
5694 <nowiki> </nowiki>a
5695
5696 = foo =
5697 !! html
5698 a<h1>foo</h1>
5699 !! end
5700
5701 !! test
5702 Parsoid: Row-syntax table headings followed by comment & table cells
5703 !! options
5704 parsoid=wt2html,wt2wt
5705 !! wikitext
5706 {|
5707 ! foo || bar
5708 <!-- foo --> || baz || quux
5709 |}
5710 !! html/php
5711 <table>
5712 <tr>
5713 <th> foo </th>
5714 <th> bar
5715 </th>
5716 <td> baz </td>
5717 <td> quux
5718 </td></tr></table>
5719
5720 !! html/parsoid
5721 <table>
5722 <tbody><tr><th> foo </th><th> bar
5723 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
5724 </tbody></table>
5725 !! end
5726
5727
5728 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5729 # preserves it.
5730 !!test
5731 Parsoid: Recover better from broken table attributes
5732 !!options
5733 parsoid=wt2html
5734 !!wikitext
5735 {| class="foo
5736 | class="bar" |
5737 foo
5738 |}
5739 !!html/php+tidy
5740 <table>
5741 <tr>
5742 <td class="bar">
5743 <p>foo</p>
5744 </td>
5745 </tr>
5746 </table>
5747 !!html/parsoid
5748 <table class="foo">
5749 <tr>
5750 <td class="bar">
5751 <p>foo</p></td></tr>
5752 </tbody></table>
5753 !!end
5754
5755 !! test
5756 Strip unsupported table tags
5757 !! options
5758 parsoid=html2wt
5759 !! html
5760 <table>
5761 <thead>
5762 <tr>
5763 <th>Month</th>
5764 <th>Savings</th>
5765 </tr>
5766 </thead>
5767 <tbody>
5768 <tr>
5769 <td>January</td>
5770 <td>$100</td>
5771 </tr>
5772 <tr>
5773 <td>February</td>
5774 <td>$80</td>
5775 </tr>
5776 </tbody>
5777 <tfoot>
5778 <tr>
5779 <td>Sum</td>
5780 <td>$180</td>
5781 </tr>
5782 </tfoot>
5783 </table>
5784 !! wikitext
5785 {|
5786
5787 !Month
5788 !Savings
5789
5790 |January
5791 |$100
5792
5793 |-
5794 |February
5795 |$80
5796
5797 |Sum
5798 |$180
5799
5800 |}
5801 !! end
5802
5803 ###
5804 ### Internal links
5805 ###
5806 !! test
5807 Plain link, capitalized
5808 !! wikitext
5809 [[Main Page]]
5810 !! html
5811 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5812 </p>
5813 !! end
5814
5815 !! test
5816 Plain link, uncapitalized
5817 !! wikitext
5818 [[main Page]]
5819 !! html
5820 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5821 </p>
5822 !! end
5823
5824 !! test
5825 Piped link
5826 !! wikitext
5827 [[Main Page|The Main Page]]
5828 !! html
5829 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5830 </p>
5831 !! end
5832
5833 !! test
5834 Piped link with comment in link text
5835 !! wikitext
5836 [[Main Page|The Main<!--front--> Page]]
5837 !! html
5838 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5839 </p>
5840 !! end
5841
5842 !! test
5843 Piped link with multiple pipe characters in link text
5844 !! wikitext
5845 [[Main Page||The|Main|Page|]]
5846 !! html/php
5847 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5848 </p>
5849 !! html/parsoid
5850 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
5851 !! end
5852
5853 !! test
5854 Broken link
5855 !! wikitext
5856 [[Zigzagzogzagzig]]
5857 !! html
5858 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5859 </p>
5860 !! end
5861
5862 !! test
5863 Broken link with fragment
5864 !! wikitext
5865 [[Zigzagzogzagzig#zug]]
5866 !! html
5867 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5868 </p>
5869 !! end
5870
5871 !! test
5872 Special page link with fragment
5873 !! wikitext
5874 [[Special:Version#anchor]]
5875 !! html
5876 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5877 </p>
5878 !! end
5879
5880 !! test
5881 Nonexistent special page link with fragment
5882 !! wikitext
5883 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5884 !! html
5885 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5886 </p>
5887 !! end
5888
5889 !! test
5890 Link with prefix
5891 !! wikitext
5892 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5893 !! html
5894 <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>
5895 </p>
5896 !! end
5897
5898 !! test
5899 Link with suffix
5900 !! wikitext
5901 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5902 !! html
5903 <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>!!!
5904 </p>
5905 !! end
5906
5907 !! article
5908 prefixed article
5909 !! text
5910 Some text
5911 !! endarticle
5912
5913 !! test
5914 Bug 43661: Piped links with identical prefixes
5915 !! wikitext
5916 [[prefixed article|prefixed articles with spaces]]
5917
5918 [[prefixed article|prefixed articlesaoeu]]
5919
5920 [[Main Page|Main Page test]]
5921 !! html
5922 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5923 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5924 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5925 </p>
5926 !! end
5927
5928
5929 !! test
5930 Link with HTML entity in suffix / tail
5931 !! wikitext
5932 [[Main Page]]&quot;, [[Main Page]]&#97;
5933 !! html
5934 <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;
5935 </p>
5936 !! end
5937
5938 !! test
5939 Link with 3 brackets
5940 !! wikitext
5941 [[[Main Page]]]
5942 !! html
5943 <p>[[[Main Page]]]
5944 </p>
5945 !! end
5946
5947 !! test
5948 Link with 4 brackets
5949 !! wikitext
5950 [[[[Main Page]]]]
5951 !! html
5952 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5953 </p>
5954 !! end
5955
5956 !! test
5957 Piped link with 3 brackets
5958 !! wikitext
5959 [[[main page|the main page]]]
5960 !! html
5961 <p>[[[main page|the main page]]]
5962 </p>
5963 !! end
5964
5965 !! test
5966 Piped link with extlink-like text
5967 !! wikitext
5968 [[Main Page|[bar]]]
5969 [[Main Page|This is a [bar]]]
5970 !! html
5971 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5972 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5973 </p>
5974 !! end
5975
5976 !! test
5977 Link with multiple pipes
5978 !! wikitext
5979 [[Main Page|The|Main|Page]]
5980 !! html
5981 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5982 </p>
5983 !! end
5984
5985 # Note that parsoid does not munge anchor text; all non-space
5986 # characters are valid in HTML5 ids.
5987 !! test
5988 Anchor containing a #. (bug 63430)
5989 !! wikitext
5990 [[Main Page#And#Link]]
5991 !! html/php
5992 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5993 </p>
5994 !! html/parsoid
5995 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
5996 !! end
5997
5998 !! test
5999 Link to namespaces
6000 !! wikitext
6001 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6002 !! html
6003 <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>
6004 </p>
6005 !! end
6006
6007 !! test
6008 Link with space in namespace
6009 !! wikitext
6010 [[User talk:Foo bar]]
6011 !! html
6012 <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>
6013 </p>
6014 !! end
6015
6016 !! article
6017 MemoryAlpha:AlphaTest
6018 !! text
6019 This is an article in the MemoryAlpha namespace
6020 (which shadows the memoryalpha interwiki link).
6021 !! endarticle
6022
6023 !! test
6024 Namespace takes precedence over interwiki link (bug 51680)
6025 !! wikitext
6026 [[MemoryAlpha:AlphaTest]]
6027 !! html
6028 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6029 </p>
6030 !! end
6031
6032 # The previous test doesn't work correctly in html2*, due to not recognizing the
6033 # link as an internal one. This one checks for the correct behavior.
6034 !! test
6035 Link to namespace preferred over interwiki with correct rel attribute
6036 !! options
6037 parsoid=html2wt,html2html
6038 !! wikitext
6039 [[MemoryAlpha:AlphaTest]]
6040 !! html
6041 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6042 </p>
6043 !! end
6044
6045 !! test
6046 Piped link to namespace
6047 !! wikitext
6048 [[Meta:Disclaimers|The disclaimers]]
6049 !! html
6050 <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>
6051 </p>
6052 !! end
6053
6054 !! test
6055 Link containing }
6056 !! wikitext
6057 [[Usually caused by a typo (oops}]]
6058 !! html
6059 <p>[[Usually caused by a typo (oops}]]
6060 </p>
6061 !! end
6062
6063 !! article
6064 7% Solution
6065 !! text
6066 Just a test of an article title containing a percent.
6067 !! endarticle
6068
6069 !! test
6070 Link containing % (not as a hex sequence)
6071 !! wikitext
6072 [[7% Solution]]
6073 !! html/php
6074 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6075 </p>
6076 !! html/parsoid
6077 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6078 !! end
6079
6080 # note that the parsoid HTML is identical to the previous test output,
6081 # so the previous test ensures that the html2wt mode will generate the
6082 # "not as a hex sequence" wikitext.
6083 !! test
6084 Link containing % as a single hex sequence interpreted to char
6085 !! options
6086 parsoid=wt2wt,wt2html,html2html
6087 !! wikitext
6088 [[7%25 Solution]]
6089 !! html/php
6090 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6091 </p>
6092 !! html/parsoid
6093 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6094 !!end
6095
6096 !! test
6097 Link containing % as a double hex sequence interpreted to hex sequence
6098 !! wikitext
6099 [[7%2525 Solution]]
6100 !! html
6101 <p>[[7%2525 Solution]]
6102 </p>
6103 !!end
6104
6105 # note that parsoid does not munge anchor text; all non-space
6106 # characters are valid in HTML5 anchors.
6107 !! test
6108 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6109 Example for such a section: == < ==
6110 !! wikitext
6111 [[%23%3c]][[%23%3e]]
6112 !! html/php
6113 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6114 </p>
6115 !! html/parsoid
6116 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
6117 !! end
6118
6119 !! test
6120 Link containing "<#" and ">#" as a hex sequences
6121 !! wikitext
6122 [[%3c%23]][[%3e%23]]
6123 !! html
6124 <p>[[%3c%23]][[%3e%23]]
6125 </p>
6126 !! end
6127
6128 !! test
6129 Link containing an equals sign
6130 !! wikitext
6131 [[Special:BookSources/isbn=4-00-026157-6]]
6132 !! html/php
6133 <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>
6134 </p>
6135 !! html/parsoid
6136 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
6137 !! end
6138
6139 !! article
6140 Foo~bar
6141 !! text
6142 Just a test of an article title containing a tilde.
6143 !! endarticle
6144
6145 # note that links containing signatures, like [[Foo~~~~]], are
6146 # massaged by the pre-save transform (PST) and so the tildes are never
6147 # seen by the parser.
6148 !! test
6149 Link containing a tilde
6150 !! wikitext
6151 [[Foo~bar]]
6152 !! html/php
6153 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6154 </p>
6155 !! html/parsoid
6156 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6157 !! end
6158
6159 !! test
6160 Link containing double-single-quotes '' (bug 4598)
6161 !! wikitext
6162 [[Lista d''e paise d''o munno]]
6163 !! html/php
6164 <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>
6165 </p>
6166 !! html/parsoid
6167 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
6168 !! end
6169
6170 !! test
6171 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6172 !! wikitext
6173 Some [[Link|pretty ''italics'' and stuff]]!
6174 !! html/php
6175 <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>!
6176 </p>
6177 !! html/parsoid
6178 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6179 !! end
6180
6181 !! test
6182 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6183 !! wikitext
6184 ''Some [[Link|pretty ''italics'' and stuff]]!''
6185 !! html
6186 <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>
6187 </p>
6188 !! end
6189
6190 !! test
6191 Link with double quotes in title part (literal) and alternate part (interpreted)
6192 !! wikitext
6193 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6194
6195 [[''Pentecoste'']]
6196
6197 [[''Pentecoste''|Pentecoste]]
6198
6199 [[''Pentecoste''|''Pentecoste'']]
6200 !! html/php
6201 <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>
6202 </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>
6203 </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>
6204 </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>
6205 </p>
6206 !! html/parsoid
6207 <meta typeof="mw:Placeholder"/>
6208 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6209 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6210 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6211 !! end
6212
6213 !! test
6214 Broken image links with HTML captions (bug 39700)
6215 !! wikitext
6216 [[File:Nonexistent|<script></script>]]
6217 [[File:Nonexistent|100px|<script></script>]]
6218 [[File:Nonexistent|&lt;]]
6219 [[File:Nonexistent|a<i>b</i>c]]
6220 !! html
6221 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6222 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6223 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6224 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6225 </p>
6226 !! end
6227
6228 !! test
6229 Plain link to URL
6230 !! wikitext
6231 [[http://www.example.com]]
6232 !! html/php
6233 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6234 </p>
6235 !! html/parsoid
6236 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6237 !! end
6238
6239 !! test
6240 Plain link to URL with link text
6241 !! wikitext
6242 [[http://www.example.com Link text]]
6243 !! html
6244 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6245 </p>
6246 !! end
6247
6248 !! test
6249 Plain link to protocol-relative URL
6250 !! wikitext
6251 [[//www.example.com]]
6252 !! html/php
6253 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6254 </p>
6255 !! html/parsoid
6256 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6257 !! end
6258
6259 !! test
6260 Plain link to protocol-relative URL with link text
6261 !! wikitext
6262 [[//www.example.com Link text]]
6263 !! html
6264 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6265 </p>
6266 !! end
6267
6268 !! test
6269 Plain link to page with question mark in title
6270 !! wikitext
6271 [[A?b]]
6272
6273 [[A?b|Baz]]
6274 !! html
6275 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6276 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6277 </p>
6278 !! end
6279
6280
6281 # I'm fairly sure the expected result here is wrong.
6282 # We want these to be URL links, not pseudo-pages with URLs for titles....
6283 # However the current output is also pretty screwy.
6284 #
6285 # ----
6286 # I'm changing it to match the current output--it arguably makes more
6287 # sense in the light of the test above. Old expected result was:
6288 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6289 #</p>
6290 # But I think this test is bordering on "garbage in, garbage out" anyway.
6291 # -- wtm
6292 !! test
6293 Piped link to URL
6294 !! wikitext
6295 Piped link to URL: [[http://www.example.com|an example URL]]
6296 !! html/php
6297 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6298 </p>
6299 !! html/parsoid
6300 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6301 !! end
6302
6303 !! test
6304 BUG 2: [[page|http://url/]] should link to page, not http://url/
6305 !! wikitext
6306 [[Main Page|http://url/]]
6307 !! html/php
6308 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6309 </p>
6310 !! html/parsoid
6311 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6312 !! end
6313
6314 # Parsoid does not mark self-links, by design.
6315 !! test
6316 BUG 337: Escaped self-links should be bold
6317 !! options
6318 title=[[Bug462]]
6319 !! wikitext
6320 [[Bu&#103;462]] [[Bug462]]
6321 !! html/php
6322 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6323 </p>
6324 !! html/php+tidy
6325 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6326 !! html/parsoid
6327 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6328 !! end
6329
6330 !! test
6331 Self-link to section should not be bold
6332 !! options
6333 title=[[Main Page]]
6334 !! wikitext
6335 [[Main Page#section]]
6336 !! html
6337 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6338 </p>
6339 !! end
6340
6341 !! article
6342 00
6343 !! text
6344 This is 00.
6345 !! endarticle
6346
6347 !!test
6348 Self-link to numeric title
6349 !!options
6350 title=[[0]]
6351 !! wikitext
6352 [[0]]
6353 !! html
6354 <p><strong class="selflink">0</strong>
6355 </p>
6356 !!end
6357
6358 !!test
6359 Link to numeric-equivalent title
6360 !!options
6361 title=[[0]]
6362 !! wikitext
6363 [[00]]
6364 !! html
6365 <p><a href="/wiki/00" title="00">00</a>
6366 </p>
6367 !!end
6368
6369 !! test
6370 <nowiki> inside a link
6371 !! wikitext
6372 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6373 !! html
6374 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6375 </p>
6376 !! end
6377
6378 !! test
6379 Non-breaking spaces in title
6380 !! wikitext
6381 [[&nbsp; Main &nbsp; Page &nbsp;]]
6382 !! html
6383 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6384 </p>
6385 !!end
6386
6387 !! test
6388 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6389 !! options
6390 language=ca
6391 !! wikitext
6392 '''[[Main Page]]'''
6393 !! html
6394 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6395 </p>
6396 !! end
6397
6398 !! test
6399 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6400 !! options
6401 language=ca
6402 !! wikitext
6403 ''[[Main Page]]''
6404 !! html
6405 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6406 </p>
6407 !! end
6408
6409 !! test
6410 Internal link with en linktrail: no apostrophes (bug 27473)
6411 !! options
6412 language=en
6413 !! wikitext
6414 [[Something]]'nice
6415 !! html
6416 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6417 </p>
6418 !! end
6419
6420 !! test
6421 Internal link with ca linktrail with apostrophes (bug 27473)
6422 !! options
6423 language=ca
6424 !! wikitext
6425 [[Something]]'nice
6426 !! html
6427 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6428 </p>
6429 !! end
6430
6431 !! test
6432 Internal link with kaa linktrail with apostrophes (bug 27473)
6433 !! options
6434 language=kaa
6435 !! wikitext
6436 [[Something]]'nice
6437 !! html
6438 <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>
6439 </p>
6440 !! end
6441
6442 !! test
6443 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6444 !! wikitext
6445 [[User:Foo/Test/63636:Bar|Test]]
6446 !! html/php
6447 <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>
6448 </p>
6449 !! html/parsoid
6450 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6451 !! end
6452
6453 !! test
6454 Purely hash wikilink
6455 !! options
6456 title=[[User:test/123]]
6457 !! wikitext
6458 [[#a|b]]
6459 !! html/php
6460 <p><a href="#a">b</a>
6461 </p>
6462 !! html/parsoid
6463 <p data-parsoid='{}'><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
6464 !! end
6465
6466 !! test
6467 1. Interaction of linktrail and template encapsulation
6468 !! options
6469 parsoid
6470 !! wikitext
6471 {{echo|[[Foo]]}}l
6472 !! html
6473 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
6474 !! end
6475
6476 !! test
6477 2. Interaction of linktrail and template encapsulation
6478 !! options
6479 parsoid
6480 !! wikitext
6481 {{echo|Some [[Fool]]}}s
6482 !! html
6483 <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" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
6484 !! end
6485
6486 !! test
6487 3. Interaction of linktrail and template encapsulation
6488 !! options
6489 parsoid
6490 !! wikitext
6491 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6492 !! html
6493 <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" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
6494 !! end
6495
6496 !! article
6497 Söfnuður
6498 !! text
6499 Test.
6500 !! endarticle
6501
6502 !! test
6503 Internal link with is link prefix
6504 !! options
6505 language=is
6506 !! wikitext
6507 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6508 !! html
6509 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6510 </p>
6511 !! end
6512
6513 !! article
6514 Mótmælendatrú
6515 !! text
6516 Test.
6517 !! endarticle
6518
6519 !! test
6520 Internal link with is link trail and link prefix
6521 !! options
6522 language=is
6523 !! wikitext
6524 [[mótmælendatrú|xxx]]ar
6525 [[mótmælendatrú]]ar
6526 mótmælenda[[söfnuður]]
6527 mótmælenda[[söfnuður|söfnuðir]]
6528 mótmælenda[[söfnuður|söfnuðir]]xxx
6529 !! html
6530 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6531 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6532 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6533 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6534 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6535 </p>
6536 !! end
6537
6538 !! test
6539 Parsoid link trail escaping
6540 !! options
6541 parsoid=html2wt,html2html
6542 !! wikitext
6543 [[apple]]<nowiki/>s
6544 !! html
6545 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6546 !! end
6547
6548 !! test
6549 Parsoid link prefix escaping
6550 !! options
6551 language=is
6552 parsoid=html2wt,html2html
6553 !! wikitext
6554 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6555 !! html
6556 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6557 !! end
6558
6559 !! test
6560 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6561 !! wikitext
6562 [[Foo| bar]]
6563
6564 [[Foo| ''bar'']]
6565
6566 [http://wp.org foo]
6567
6568 [http://wp.org ''foo'']
6569 !! html
6570 <p><a href="/wiki/Foo" title="Foo"> bar</a>
6571 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
6572 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6573 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6574 </p>
6575 !! end
6576
6577 !! test
6578 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6579 !! options
6580 parsoid
6581 !! wikitext
6582 [[Foo|{{echo|a}} b {{echo|c}}]]
6583 !! html
6584 <p><a rel="mw:WikiLink" href="Foo" title="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>
6585 !! end
6586
6587 !! test
6588 Link with angle bracket after anchor
6589 !! wikitext
6590 [[Foo#<bar>]]
6591 !! html/php
6592 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6593 </p>
6594 !! html/parsoid
6595 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6596 !! end
6597
6598 ###
6599 ### Interwiki links (see maintenance/interwiki.sql)
6600 ###
6601
6602 !! test
6603 Inline interwiki link
6604 !! wikitext
6605 [[MeatBall:SoftSecurity]]
6606 !! html
6607 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6608 </p>
6609 !! end
6610
6611 !! test
6612 Inline interwiki link with empty title (bug 2372)
6613 !! wikitext
6614 [[MeatBall:]]
6615 !! html
6616 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6617 </p>
6618 !! end
6619
6620 !! test
6621 Interwiki link encoding conversion (bug 1636)
6622 !! wikitext
6623 *[[Wikipedia:ro:Olteni&#0355;a]]
6624 *[[Wikipedia:ro:Olteni&#355;a]]
6625 !! html
6626 <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>
6627 <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>
6628
6629 !! html+tidy
6630 <ul>
6631 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
6632 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
6633 </ul>
6634 !! end
6635
6636 !! test
6637 Interwiki link with fragment (bug 2130)
6638 !! wikitext
6639 [[MeatBall:SoftSecurity#foo]]
6640 !! html
6641 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6642 </p>
6643 !! end
6644
6645 # Ideally the wikipedia: prefix here should be proto-relative too
6646 !! test
6647 Different interwiki prefixes mapping to the same URL
6648 !! wikitext
6649 [[:en:Foo]]
6650
6651 [[:en:Foo|Foo]]
6652
6653 [[wikipedia:Foo]]
6654
6655 [[:wikipedia:Foo|Foo]]
6656
6657 [[wikipedia:en:Foo]]
6658
6659 [[:wikipedia:en:Foo]]
6660
6661 [[ wikiPEdia :Foo]]
6662 !! html/parsoid
6663 <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>
6664
6665 <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>
6666
6667 <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>
6668
6669 <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>
6670
6671 <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>
6672
6673 <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>
6674
6675 <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>
6676 !! end
6677
6678 !! test
6679 Interwiki links that cannot be represented in wiki syntax
6680 !! wikitext
6681 [[meatball:ok]]
6682 [[meatball:ok#foo|ok with fragment]]
6683 [[meatball:ok_as_well?|ok ending with ? mark]]
6684 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6685 [http://de.wikipedia.org/wiki/#foo is just fragment]
6686
6687 !! html/parsoid
6688 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6689 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6690 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6691 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6692 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6693 !! end
6694
6695 !! test
6696 Interwiki links: trail
6697 !! options
6698 parsoid
6699 !! wikitext
6700 [[wikipedia:Foo|Ba]]r
6701 !! html
6702 <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>
6703 !! end
6704
6705 !! test
6706 Local interwiki link
6707 !! wikitext
6708 [[local:Template:Foo]]
6709 !! html
6710 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6711 </p>
6712 !! end
6713
6714 !! test
6715 Local interwiki link: self-link to current page
6716 !! options
6717 title=[[Main Page]]
6718 !! wikitext
6719 [[local:Main Page]]
6720 !! html
6721 <p><strong class="selflink">local:Main Page</strong>
6722 </p>
6723 !! end
6724
6725 !! test
6726 Local interwiki link: prefix only (bug 64167)
6727 !! wikitext
6728 [[local:]]
6729 !! html
6730 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6731 </p>
6732 !! end
6733
6734 !! test
6735 Local interwiki link: with additional interwiki prefix (bug 61357)
6736 !! wikitext
6737 [[local:meatball:Hello]]
6738 !! html
6739 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6740 </p>
6741 !! end
6742
6743 ###
6744 ### Interlanguage links
6745 ### Language links (so that searching for '### language' matches..)
6746 ###
6747
6748 !! test
6749 Interlanguage link
6750 !! wikitext
6751 Blah blah blah
6752 [[zh:Chinese]]
6753 !! html/php
6754 <p>Blah blah blah
6755 </p>
6756 !! html/parsoid
6757 <p>Blah blah blah
6758 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6759 !! end
6760
6761 !! test
6762 Interlanguage link with spacing
6763 !! wikitext
6764 Blah blah blah
6765 [[ zh : Chinese ]]
6766 !! html/php
6767 <p>Blah blah blah
6768 </p>
6769 !! html/parsoid
6770 <p>Blah blah blah
6771 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6772 !! end
6773
6774 !! test
6775 Double interlanguage link
6776 !! wikitext
6777 Blah blah blah
6778 [[es:Spanish]]
6779 [[zh:Chinese]]
6780 !! html/php
6781 <p>Blah blah blah
6782 </p>
6783 !! html/parsoid
6784 <p>Blah blah blah
6785 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6786 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6787 !! end
6788
6789 !! test
6790 Interlanguage link variations
6791 !! wikitext
6792 Blah blah blah
6793 [[ es :Spanish]]
6794 [[ ZH :Chinese]]
6795 !! html/php
6796 <p>Blah blah blah
6797 </p>
6798 !! html/parsoid
6799 <p>Blah blah blah
6800 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish" data-parsoid='{"stx":"simple","a":{"href":"//es.wikipedia.org/wiki/Spanish"},"sa":{"href":" es :Spanish"}}'/>
6801 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese" data-parsoid='{"stx":"simple","a":{"href":"//zh.wikipedia.org/wiki/Chinese"},"sa":{"href":" ZH :Chinese"}}'/>
6802 !! end
6803
6804 !! test
6805 Interlanguage link, with prefix links
6806 !! options
6807 language=ln
6808 !! wikitext
6809 Blah blah blah
6810 [[zh:Chinese]]
6811 !! html/php
6812 <p>Blah blah blah
6813 </p>
6814 !! html/parsoid
6815 <p>Blah blah blah
6816 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6817 !! end
6818
6819 !! test
6820 Double interlanguage link, with prefix links (bug 8897)
6821 !! options
6822 language=ln
6823 !! wikitext
6824 Blah blah blah
6825 [[es:Spanish]]
6826 [[zh:Chinese]]
6827 !! html/php
6828 <p>Blah blah blah
6829 </p>
6830 !! html/parsoid
6831 <p>Blah blah blah
6832 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6833 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6834 !! end
6835
6836 !! test
6837 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6838 !! wikitext
6839 Blah blah blah
6840 [[mul:Article]]
6841 !! html/php
6842 <p>Blah blah blah
6843 </p>
6844 !! html/parsoid
6845 <p>Blah blah blah
6846 <link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p>
6847 !! end
6848
6849 !! test
6850 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6851 !! options
6852 language=ln
6853 !! wikitext
6854 [[WW&nbsp;II]]
6855 !! html
6856 <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>
6857 </p>
6858 !! end
6859
6860 !! test
6861 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6862 !! options
6863 parsoid=html2wt
6864 !! wikitext
6865 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6866
6867 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6868 !! html
6869 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6870 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6871 !! end
6872
6873 !! test
6874 Parsoid: handle constructor well
6875 !! options
6876 parsoid
6877 !! wikitext
6878 [[constructor]]
6879
6880 [[constructor:foo]]
6881 !! html
6882 <p><a rel="mw:WikiLink" href="./Constructor" title="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>
6883
6884 <p><a rel="mw:WikiLink" href="./Foo" title="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>
6885 !! end
6886
6887 !! test
6888 Parsoid: recognize interlanguage links without a target page
6889 !! options
6890 parsoid
6891 !! wikitext
6892 [[ko:]]
6893 !! html
6894 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6895 !! end
6896
6897 !! test
6898 Parsoid: recognize interwiki links without a target page
6899 !! options
6900 parsoid
6901 !! wikitext
6902 [[:ko:]]
6903 !! html
6904 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6905 !! end
6906
6907 !! test
6908 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6909 !! options
6910 parsoid
6911 !! wikitext
6912 [[en:Foo]]
6913 !! html
6914 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6915 !! end
6916
6917 !! test
6918 Interlanguage link with preceding local interwiki link (bug 68085)
6919 !! wikitext
6920 Blah blah blah
6921 [[local:es:Spanish]]
6922 !! html
6923 <p>Blah blah blah
6924 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
6925 </p>
6926 !! end
6927
6928 !! test
6929 Looks like an interlanguage link, but is actually a local interwiki
6930 !! wikitext
6931 Blah blah blah
6932 [[mi:Template:Foo]]
6933 !! html
6934 <p>Blah blah blah
6935 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
6936 </p>
6937 !! end
6938
6939 ###
6940 ### Redirects, Parsoid-only
6941 ###
6942 !! test
6943 1. Simple redirect to page
6944 !! options
6945 parsoid
6946 !! wikitext
6947 #REDIRECT [[Main Page]]
6948 !! html
6949 <link rel="mw:PageProp/redirect" href="./Main_Page">
6950 !! end
6951
6952 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6953 !! test
6954 2. Other redirect variants
6955 !! options
6956 parsoid=wt2html,wt2wt
6957 !! wikitext
6958 #REDIRECT [[Main_Page]]
6959 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6960 !! html
6961 <link rel="mw:PageProp/redirect" href="./Main_Page">
6962 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6963 !! end
6964
6965 !! test
6966 Empty redirect
6967 !! options
6968 parsoid=wt2html,wt2wt
6969 !! wikitext
6970 #REDIRECT [[]]
6971 !! html
6972 <ol>
6973 <li>REDIRECT [[]]</li></ol>
6974 !! end
6975
6976 !! test
6977 Optional colon in #REDIRECT
6978 !! options
6979 # the colon is archaic syntax. we support it for wt2html, but we
6980 # don't care that it roundtrips back to the modern syntax.
6981 parsoid=wt2html,html2html
6982 !! wikitext
6983 #REDIRECT:[[Main Page]]
6984 !! html
6985 <link rel="mw:PageProp/redirect" href="./Main_Page">
6986 !! end
6987
6988 !! test
6989 Whitespace in #REDIRECT with optional colon
6990 !! options
6991 # the colon and gratuitous whitespace is archaic syntax. we support
6992 # it for wt2html, but we don't care that it roundtrips back to the
6993 # modern syntax (without extra whitespace)
6994 parsoid=wt2html,html2html
6995 !! wikitext
6996
6997 #REDIRECT
6998 :
6999 [[Main Page]]
7000 !! html
7001 <link rel="mw:PageProp/redirect" href="./Main_Page">
7002 !! end
7003
7004 !! test
7005 Piped link in #REDIRECT
7006 !! options
7007 # content after piped link is ignored. we support this syntax,
7008 # but don't care that the piped link is lost when we roundtrip this.
7009 parsoid=wt2html
7010 !! wikitext
7011 #REDIRECT [[Main Page|bar]]
7012 !! html
7013 <link rel="mw:PageProp/redirect" href="./Main_Page">
7014 !! end
7015
7016 !! test
7017 Redirect to category
7018 !! options
7019 parsoid=wt2html
7020 !! wikitext
7021 #REDIRECT [[Category:Foo]]
7022 !! html
7023 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7024 !! end
7025
7026 !! test
7027 Redirect to category with URL encoding
7028 !! options
7029 parsoid=wt2html
7030 !! wikitext
7031 #REDIRECT [[Category%3AFoo]]
7032 !! html
7033 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7034 !! end
7035
7036 !! test
7037 Redirect to category page
7038 !! options
7039 parsoid=wt2html,html2html
7040 !! wikitext
7041 #REDIRECT [[:Category:Foo]]
7042 !! html
7043 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7044 !! end
7045
7046 !! test
7047 Redirect to image page (1)
7048 !! options
7049 parsoid
7050 !! wikitext
7051 #REDIRECT [[File:Wiki.png]]
7052 !! html
7053 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7054 !! end
7055
7056 !! test
7057 Redirect to image page (2)
7058 !! options
7059 parsoid
7060 !! wikitext
7061 #REDIRECT [[Image:Wiki.png]]
7062 !! html
7063 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7064 !! end
7065
7066 !! test
7067 Redirect to language
7068 !! options
7069 parsoid
7070 !! wikitext
7071 #REDIRECT [[en:File:Wiki.png]]
7072 !! html
7073 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7074 !! end
7075
7076 !! test
7077 Redirect to interwiki
7078 !! options
7079 parsoid
7080 !! wikitext
7081 #REDIRECT [[meatball:File:Wiki.png]]
7082 !! html
7083 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7084 !! end
7085
7086 !! test
7087 Non-English #REDIRECT
7088 !! options
7089 parsoid
7090 language=is
7091 !! wikitext
7092 #TILVÍSUN [[Main Page]]
7093 !! html
7094 <link rel="mw:PageProp/redirect" href="./Main_Page">
7095 !! end
7096
7097 !! test
7098 New redirect
7099 !! options
7100 parsoid=html2wt
7101 !! wikitext
7102 Foo
7103 #REDIRECT [[Foo]]
7104 !! html
7105 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7106 !! end
7107
7108 ##
7109 ## XHTML tidiness
7110 ###
7111
7112 !! test
7113 <br> to <br />
7114 !! wikitext
7115 1<br>2<br />3
7116 !! html
7117 <p>1<br />2<br />3
7118 </p>
7119 !! end
7120
7121 !! test
7122 Broken br tag sanitization
7123 !! wikitext
7124 </br>
7125 !! html/php
7126 <p>&lt;/br&gt;
7127 </p>
7128 !! end
7129
7130 # TODO: Fix html2html mode (bug 51055)!
7131 # This </br> handling was added as part of bug 50831; but it
7132 # differs from how PHP+tidy handles this. We should investigate
7133 # this.
7134 !! test
7135 Parsoid: Broken br tag recognition
7136 !! options
7137 parsoid=wt2html
7138 !! wikitext
7139 </br>
7140
7141 <br/ >
7142 !! html/php+tidy
7143 <p>&lt;/br&gt;</p>
7144 <p><br /></p>
7145 !! html/parsoid
7146 <p><br></p>
7147 <p><br/></p>
7148 !! end
7149
7150 !! test
7151 Incorrecly removing closing slashes from correctly formed XHTML
7152 !! wikitext
7153 <br style="clear:both;" />
7154 !! html
7155 <p><br style="clear:both;" />
7156 </p>
7157 !! end
7158
7159 !! test
7160 Failing to transform badly formed HTML into correct XHTML
7161 !! wikitext
7162 <br style="clear: left;">
7163 <br style="clear: right;">
7164 <br style="clear: both;">
7165 !! html
7166 <p><br style="clear: left;" />
7167 <br style="clear: right;" />
7168 <br style="clear: both;" />
7169 </p>
7170 !!end
7171
7172 !! test
7173 Handling html with a div self-closing tag
7174 !! wikitext
7175 <div title />
7176 <div title/>
7177 <div title/ >
7178 <div title=bar />
7179 <div title=bar/>
7180 <div title=bar/ >
7181 !! html
7182 <p>&lt;div title /&gt;
7183 &lt;div title/&gt;
7184 </p>
7185 <div>
7186 <p>&lt;div title=bar /&gt;
7187 &lt;div title=bar/&gt;
7188 </p>
7189 <div title="bar/"></div>
7190 </div>
7191
7192 !! end
7193
7194 !! test
7195 Handling html with a br self-closing tag
7196 !! wikitext
7197 <br title />
7198 <br title/>
7199 <br title/ >
7200 <br title=bar />
7201 <br title=bar/>
7202 <br title=bar/ >
7203 !! html/php
7204 <p><br title="title" />
7205 <br title="title" />
7206 <br />
7207 <br title="bar" />
7208 <br title="bar" />
7209 <br title="bar/" />
7210 </p>
7211 !! html/parsoid
7212 <p><br title="" />
7213 <br title="" />
7214 <br />
7215 <br title="bar" />
7216 <br title="bar" />
7217 <br title="bar/" />
7218 </p>
7219 !! end
7220
7221 !! test
7222 Horizontal ruler (should it add that extra space?)
7223 !! wikitext
7224 <hr>
7225 <hr >
7226 foo <hr
7227 > bar
7228 !! html
7229 <hr />
7230 <hr />
7231 foo <hr /> bar
7232
7233 !! end
7234
7235 !! test
7236 Horizontal ruler -- 4+ dashes render hr
7237 !! wikitext
7238 ----
7239 !! html
7240 <hr />
7241
7242 !! end
7243
7244 !! test
7245 Horizontal ruler -- eats additional dashes on the same line
7246 !! wikitext
7247 ---------
7248 !! html
7249 <hr />
7250
7251 !! end
7252
7253 !! test
7254 Horizontal ruler -- does not collapse dashes on consecutive lines
7255 !! wikitext
7256 ----
7257 ----
7258 !! html
7259 <hr />
7260 <hr />
7261
7262 !! end
7263
7264 !! test
7265 Horizontal ruler -- <4 dashes render as plain text
7266 !! wikitext
7267 ---
7268 !! html
7269 <p>---
7270 </p>
7271 !! end
7272
7273 !! test
7274 Horizontal ruler -- Supports content following dashes on same line
7275 !! wikitext
7276 ---- Foo
7277 !! html
7278 <hr /> Foo
7279
7280 !! html+tidy
7281 <hr />
7282 <p>Foo</p>
7283 !! end
7284
7285 ###
7286 ### Block-level elements
7287 ###
7288 !! test
7289 Common list
7290 !! wikitext
7291 *Common list
7292 * item 2
7293 *item 3
7294 !! html
7295 <ul><li>Common list</li>
7296 <li> item 2</li>
7297 <li>item 3</li></ul>
7298
7299 !! end
7300
7301 !! test
7302 Numbered list
7303 !! wikitext
7304 #Numbered list
7305 #item 2
7306 # item 3
7307 !! html
7308 <ol><li>Numbered list</li>
7309 <li>item 2</li>
7310 <li> item 3</li></ol>
7311
7312 !! end
7313
7314 !! test
7315 Mixed list
7316 !! wikitext
7317 *Mixed list
7318 *# with numbers
7319 ** and bullets
7320 *# and numbers
7321 *bullets again
7322 **bullet level 2
7323 ***bullet level 3
7324 ***#Number on level 4
7325 **bullet level 2
7326 **#Number on level 3
7327 **#Number on level 3
7328 *#number level 2
7329 *Level 1
7330 *** Level 3
7331 #** Level 3, but ordered
7332 !! html
7333 <ul><li>Mixed list
7334 <ol><li> with numbers</li></ol>
7335 <ul><li> and bullets</li></ul>
7336 <ol><li> and numbers</li></ol></li>
7337 <li>bullets again
7338 <ul><li>bullet level 2
7339 <ul><li>bullet level 3
7340 <ol><li>Number on level 4</li></ol></li></ul></li>
7341 <li>bullet level 2
7342 <ol><li>Number on level 3</li>
7343 <li>Number on level 3</li></ol></li></ul>
7344 <ol><li>number level 2</li></ol></li>
7345 <li>Level 1
7346 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7347 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7348
7349 !! end
7350
7351 !! test
7352 Nested lists 1
7353 !! wikitext
7354 *foo
7355 **bar
7356 !! html
7357 <ul><li>foo
7358 <ul><li>bar</li></ul></li></ul>
7359
7360 !! end
7361
7362 !! test
7363 Nested lists 2
7364 !! wikitext
7365 **foo
7366 *bar
7367 !! html
7368 <ul><li><ul><li>foo</li></ul></li>
7369 <li>bar</li></ul>
7370
7371 !! end
7372
7373 !! test
7374 Nested lists 3 (first element empty)
7375 !! wikitext
7376 *
7377 **bar
7378 !! html
7379 <ul><li>
7380 <ul><li>bar</li></ul></li></ul>
7381
7382 !! end
7383
7384 !! test
7385 Nested lists 4 (first element empty)
7386 !! wikitext
7387 **
7388 *bar
7389 !! html
7390 <ul><li><ul><li></li></ul></li>
7391 <li>bar</li></ul>
7392
7393 !! end
7394
7395 !! test
7396 Nested lists 5 (both elements empty)
7397 !! wikitext
7398 **
7399 *
7400 !! html
7401 <ul><li><ul><li></li></ul></li>
7402 <li></li></ul>
7403
7404 !! end
7405
7406 !! test
7407 Nested lists 6 (both elements empty)
7408 !! wikitext
7409 *
7410 **
7411 !! html
7412 <ul><li>
7413 <ul><li></li></ul></li></ul>
7414
7415 !! end
7416
7417 !! test
7418 Nested lists 7 (skip initial nesting levels)
7419 !! wikitext
7420 *** foo
7421 !! html
7422 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7423
7424 !! end
7425
7426 !! test
7427 Nested lists 8 (multiple nesting transitions)
7428 !! wikitext
7429 * foo
7430 *** bar
7431 ** baz
7432 * boo
7433 !! html
7434 <ul><li> foo
7435 <ul><li><ul><li> bar</li></ul></li>
7436 <li> baz</li></ul></li>
7437 <li> boo</li></ul>
7438
7439 !! end
7440
7441 !! test
7442 1. Lists with start-of-line-transparent tokens before bullets: Comments
7443 !! wikitext
7444 *foo
7445 *<!--cmt-->bar
7446 <!--cmt-->*baz
7447 !! html
7448 <ul><li>foo</li>
7449 <li>bar</li>
7450 <li>baz</li></ul>
7451
7452 !! end
7453
7454 !! test
7455 2. Lists with start-of-line-transparent tokens before bullets: Template close
7456 !! wikitext
7457 *foo {{echo|bar
7458 }}*baz
7459 !! html
7460 <ul><li>foo bar</li>
7461 <li>baz</li></ul>
7462
7463 !! end
7464
7465 !! test
7466 List items are not parsed correctly following a <pre> block (bug 785)
7467 !! wikitext
7468 * <pre>foo</pre>
7469 * <pre>bar</pre>
7470 * zar
7471 !! html
7472 <ul><li> <pre>foo</pre></li>
7473 <li> <pre>bar</pre></li>
7474 <li> zar</li></ul>
7475
7476 !! end
7477
7478 !! test
7479 List items from template
7480 !! wikitext
7481
7482 {{inner list}}
7483 * item 2
7484
7485 * item 0
7486 {{inner list}}
7487 * item 2
7488
7489 * item 0
7490 * notSOL{{inner list}}
7491 * item 2
7492 !! html
7493 <ul><li> item 1</li>
7494 <li> item 2</li></ul>
7495 <ul><li> item 0</li>
7496 <li> item 1</li>
7497 <li> item 2</li></ul>
7498 <ul><li> item 0</li>
7499 <li> notSOL</li>
7500 <li> item 1</li>
7501 <li> item 2</li></ul>
7502
7503 !! end
7504
7505 !! test
7506 List interrupted by empty line or heading
7507 !! wikitext
7508 * foo
7509
7510 ** bar
7511 == A heading ==
7512 * Another list item
7513 !! html
7514 <ul><li> foo</li></ul>
7515 <ul><li><ul><li> bar</li></ul></li></ul>
7516 <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>
7517 <ul><li> Another list item</li></ul>
7518
7519 !!end
7520
7521 !!test
7522 Multiple list tags generated by templates
7523 !! wikitext
7524 {{echo|<li>}}a
7525 {{echo|<li>}}b
7526 {{echo|<li>}}c
7527 !! html
7528 <li>a
7529 <li>b
7530 <li>c</li>
7531 </li>
7532 </li>
7533
7534 !! html+tidy
7535 <ul>
7536 <li>a</li>
7537 <li>b</li>
7538 <li>c</li>
7539 </ul>
7540 !!end
7541
7542 !!test
7543 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7544 !! wikitext
7545 *a
7546 <!--This line will NOT split the list-->
7547 *b
7548 <!--This line will NOT split the list either-->
7549 *c
7550 <!--foo--> <!----> <!--This line NOT split the list either-->
7551 *d
7552 !! html
7553 <ul><li>a</li>
7554 <li>b</li>
7555 <li>c</li>
7556 <li>d</li></ul>
7557
7558 !!end
7559
7560 !!test
7561 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7562 !! wikitext
7563 *a
7564 <!--This line will NOT split the list-->
7565 *b
7566 <!--This line will NOT split the list either-->
7567 *c
7568 <!--foo--> <!----> <!--This line NOT split the list
7569 either-->
7570 *d
7571 !! html
7572 <ul><li>a</li>
7573 <li>b</li>
7574 <li>c</li>
7575 <li>d</li></ul>
7576
7577 !!end
7578
7579 !!test
7580 Test the li-hack
7581 (The PHP parser relies on Tidy for the hack)
7582 !!options
7583 parsoid=wt2html,wt2wt
7584 !! wikitext
7585 * foo
7586 * <li>li-hack
7587 * {{echo|<li>templated li-hack}}
7588 * <!--foo--> <li> unsupported li-hack with preceding comments
7589
7590 <ul>
7591 <li><li>not a li-hack
7592 </li>
7593 </ul>
7594 !! html+tidy
7595 <ul>
7596 <li>foo</li>
7597 <li>li-hack</li>
7598 <li>templated li-hack</li>
7599 <li>unsupported li-hack with preceding comments</li>
7600 </ul>
7601 <ul>
7602 <li>not a li-hack</li>
7603 </ul>
7604 !!end
7605
7606 !! test
7607 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7608 !! options
7609 parsoid
7610 !! wikitext
7611 # foo
7612 ## bar
7613 * foo
7614 ** bar
7615 : foo
7616 :: bar
7617 !! html
7618 <ol>
7619 <li> foo<ol>
7620 <li> bar</li>
7621 </ol></li>
7622 </ol><ul>
7623 <li> foo<ul>
7624 <li> bar</li>
7625 </ul></li>
7626 </ul><dl>
7627 <dd> foo<dl>
7628 <dd> bar</dd>
7629 </dl></dd>
7630 </dl>
7631 !! end
7632
7633 !! test
7634 Parsoid: Test of whitespace serialization with Templated bullets
7635 !! options
7636 parsoid
7637 !! wikitext
7638 * {{bullet}}
7639 !! html
7640 <ul>
7641 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7642 </ul>
7643 !! end
7644
7645 # ------------------------------------------------------------------------
7646 # The next set of tests are about Parsoid's ability to handle badly nested
7647 # tags (parse, minimize scope of fixup, and roundtrip back)
7648 # ------------------------------------------------------------------------
7649
7650 !! test
7651 Unbalanced closing block tags break a list
7652 (php parser relies on Tidy to fix up)
7653 !! wikitext
7654 <div>
7655 *a</div><div>
7656 *b</div>
7657 !! html+tidy
7658 <div>
7659 <ul>
7660 <li>a</li>
7661 </ul>
7662 </div>
7663 <div>
7664 <ul>
7665 <li>b</li>
7666 </ul>
7667 </div>
7668 !! end
7669
7670 # Parsoid fails this test, but it might be tricky to support properly.
7671 # See bug 68395.
7672 !! test
7673 Unbalanced closing non-block tags don't break a list
7674 (php parser relies on Tidy to fix up)
7675 !! wikitext
7676 <span>
7677 *a</span><span>
7678 *b</span>
7679 !! html/php+tidy
7680 <ul>
7681 <li><span>a</span></li>
7682 <li><span>b</span></li>
7683 </ul>
7684 !! html/parsoid
7685 <span>
7686 <ul>
7687 <li>a<span></span>
7688 </li>
7689 <li>b
7690 </li>
7691 </ul>
7692 </span>
7693 !! end
7694
7695 !! test
7696 Unclosed formatting tags that straddle lists are closed and reopened
7697 (php parser relies on Tidy to fix up)
7698 !! wikitext
7699 # <s> a
7700 # b </s>
7701 !! html/php+tidy
7702 <ol>
7703 <li><s>a</s></li>
7704 <li><s>b</s></li>
7705 </ol>
7706 !! html/parsoid
7707 <ol>
7708 <li> <s> a </s>
7709 </li>
7710 <li> <s> b </s>
7711 </li>
7712 </ol>
7713 !! end
7714
7715 # Parsoid fails this test, but it might be tricky to support properly.
7716 # See bug 68395.
7717 !!test
7718 List embedded in a non-block tag
7719 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
7720 !! wikitext
7721 <small>
7722 * foo
7723 </small>
7724 !! html/php+tidy
7725 <ul>
7726 <li><small>foo</small></li>
7727 </ul>
7728 !! html/parsoid
7729 <small>
7730 <ul>
7731 <li> foo</li>
7732 </ul>
7733 </small>
7734 !!end
7735
7736 # This is a bug in the PHP parser + tidy combination.
7737 # (The </tr> tag gets parsed as text and html-escaped by PHP,
7738 # and then fostered out of the table by tidy.)
7739 # We believe the Parsoid output to be correct.
7740 !! test
7741 Table with missing opening <tr> tag
7742 !! options
7743 parsoid=wt2html,wt2wt
7744 !! wikitext
7745 <table>
7746 <td>foo</td>
7747 </tr>
7748 </table>
7749 !! html/php+tidy
7750 <p>&lt;/tr&gt;</p>
7751 <table>
7752 <tr>
7753 <td>foo</td>
7754 </tr>
7755 </table>
7756 !! html/parsoid
7757 <table>
7758 <tr>
7759 <td>foo</td>
7760 </tr>
7761 </table>
7762 !! end
7763
7764 ###
7765 ### Magic Words
7766 ###
7767
7768 # Note that the current date is hard-coded as
7769 # 1970-01-01T00:02:03Z (a Thursday)
7770 # when running parser tests. The timezone is also fixed to GMT, so
7771 # local date will be identical to current date.
7772
7773 !! test
7774 Magic Word: {{CURRENTDAY}}
7775 !! wikitext
7776 {{CURRENTDAY}}
7777 !! html
7778 <p>1
7779 </p>
7780 !! end
7781
7782 !! test
7783 Magic Word: {{CURRENTDAY2}}
7784 !! wikitext
7785 {{CURRENTDAY2}}
7786 !! html
7787 <p>01
7788 </p>
7789 !! end
7790
7791 !! test
7792 Magic Word: {{CURRENTDAYNAME}}
7793 !! wikitext
7794 {{CURRENTDAYNAME}}
7795 !! html
7796 <p>Thursday
7797 </p>
7798 !! end
7799
7800 !! test
7801 Magic Word: {{CURRENTDOW}}
7802 !! wikitext
7803 {{CURRENTDOW}}
7804 !! html
7805 <p>4
7806 </p>
7807 !! end
7808
7809 !! test
7810 Magic Word: {{CURRENTMONTH}}
7811 !! wikitext
7812 {{CURRENTMONTH}}
7813 !! html
7814 <p>01
7815 </p>
7816 !! end
7817
7818 !! test
7819 Magic Word: {{CURRENTMONTH1}}
7820 !! wikitext
7821 {{CURRENTMONTH1}}
7822 !! html
7823 <p>1
7824 </p>
7825 !! end
7826
7827 !! test
7828 Magic Word: {{CURRENTMONTHABBREV}}
7829 !! wikitext
7830 {{CURRENTMONTHABBREV}}
7831 !! html
7832 <p>Jan
7833 </p>
7834 !! end
7835
7836 !! test
7837 Magic Word: {{CURRENTMONTHNAME}}
7838 !! wikitext
7839 {{CURRENTMONTHNAME}}
7840 !! html
7841 <p>January
7842 </p>
7843 !! end
7844
7845 !! test
7846 Magic Word: {{CURRENTMONTHNAMEGEN}}
7847 !! wikitext
7848 {{CURRENTMONTHNAMEGEN}}
7849 !! html
7850 <p>January
7851 </p>
7852 !! end
7853
7854 !! test
7855 Magic Word: {{CURRENTTIME}}
7856 !! wikitext
7857 {{CURRENTTIME}}
7858 !! html
7859 <p>00:02
7860 </p>
7861 !! end
7862
7863 !! test
7864 Magic Word: {{CURRENTHOUR}}
7865 !! wikitext
7866 {{CURRENTHOUR}}
7867 !! html
7868 <p>00
7869 </p>
7870 !! end
7871
7872 !! test
7873 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7874 !! wikitext
7875 {{CURRENTWEEK}}
7876 !! html
7877 <p>1
7878 </p>
7879 !! end
7880
7881 !! test
7882 Magic Word: {{CURRENTYEAR}}
7883 !! wikitext
7884 {{CURRENTYEAR}}
7885 !! html
7886 <p>1970
7887 </p>
7888 !! end
7889
7890 !! test
7891 Magic Word: {{CURRENTTIMESTAMP}}
7892 !! wikitext
7893 {{CURRENTTIMESTAMP}}
7894 !! html
7895 <p>19700101000203
7896 </p>
7897 !! end
7898
7899 !! test
7900 Magic Words LOCAL (UTC)
7901 !! wikitext
7902 * {{LOCALMONTH}}
7903 * {{LOCALMONTH1}}
7904 * {{LOCALMONTHNAME}}
7905 * {{LOCALMONTHNAMEGEN}}
7906 * {{LOCALMONTHABBREV}}
7907 * {{LOCALDAY}}
7908 * {{LOCALDAY2}}
7909 * {{LOCALDAYNAME}}
7910 * {{LOCALYEAR}}
7911 * {{LOCALTIME}}
7912 * {{LOCALHOUR}}
7913 * {{LOCALWEEK}}
7914 * {{LOCALDOW}}
7915 * {{LOCALTIMESTAMP}}
7916 !! html
7917 <ul><li> 01</li>
7918 <li> 1</li>
7919 <li> January</li>
7920 <li> January</li>
7921 <li> Jan</li>
7922 <li> 1</li>
7923 <li> 01</li>
7924 <li> Thursday</li>
7925 <li> 1970</li>
7926 <li> 00:02</li>
7927 <li> 00</li>
7928 <li> 1</li>
7929 <li> 4</li>
7930 <li> 19700101000203</li></ul>
7931
7932 !! end
7933
7934 !! test
7935 Magic Word: {{FULLPAGENAME}}
7936 !! options
7937 title=[[User:Ævar Arnfjörð Bjarmason]]
7938 !! wikitext
7939 {{FULLPAGENAME}}
7940 !! html
7941 <p>User:Ævar Arnfjörð Bjarmason
7942 </p>
7943 !! end
7944
7945 !! test
7946 Magic Word: {{FULLPAGENAMEE}}
7947 !! options
7948 title=[[User:Ævar Arnfjörð Bjarmason]]
7949 !! wikitext
7950 {{FULLPAGENAMEE}}
7951 !! html
7952 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7953 </p>
7954 !! end
7955
7956 !! test
7957 Magic Word: {{TALKSPACE}}
7958 !! options
7959 title=[[User:Ævar Arnfjörð Bjarmason]]
7960 !! wikitext
7961 {{TALKSPACE}}
7962 !! html
7963 <p>User talk
7964 </p>
7965 !! end
7966
7967 !! test
7968 Magic Word: {{TALKSPACE}}, same namespace
7969 !! options
7970 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7971 !! wikitext
7972 {{TALKSPACE}}
7973 !! html
7974 <p>User talk
7975 </p>
7976 !! end
7977
7978 !! test
7979 Magic Word: {{TALKSPACE}}, main namespace
7980 !! options
7981 title=[[Parser Test]]
7982 !! wikitext
7983 {{TALKSPACE}}
7984 !! html
7985 <p>Talk
7986 </p>
7987 !! end
7988
7989 !! test
7990 Magic Word: {{TALKSPACEE}}
7991 !! options
7992 title=[[User:Ævar Arnfjörð Bjarmason]]
7993 !! wikitext
7994 {{TALKSPACEE}}
7995 !! html
7996 <p>User_talk
7997 </p>
7998 !! end
7999
8000 !! test
8001 Magic Word: {{SUBJECTSPACE}}
8002 !! options
8003 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8004 !! wikitext
8005 {{SUBJECTSPACE}}
8006 !! html
8007 <p>User
8008 </p>
8009 !! end
8010
8011 !! test
8012 Magic Word: {{SUBJECTSPACE}}, same namespace
8013 !! options
8014 title=[[User:Ævar Arnfjörð Bjarmason]]
8015 !! wikitext
8016 {{SUBJECTSPACE}}
8017 !! html
8018 <p>User
8019 </p>
8020 !! end
8021
8022 !! test
8023 Magic Word: {{SUBJECTSPACE}}, main namespace
8024 !! options
8025 title=[[Parser Test]]
8026 !! wikitext
8027 {{SUBJECTSPACE}}
8028 !! html
8029
8030 !! end
8031
8032 !! test
8033 Magic Word: {{SUBJECTSPACEE}}
8034 !! options
8035 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8036 !! wikitext
8037 {{SUBJECTSPACEE}}
8038 !! html
8039 <p>User
8040 </p>
8041 !! end
8042
8043 !! test
8044 Magic Word: {{NAMESPACE}}
8045 !! options
8046 title=[[User:Ævar Arnfjörð Bjarmason]]
8047 !! wikitext
8048 {{NAMESPACE}}
8049 !! html
8050 <p>User
8051 </p>
8052 !! end
8053
8054 !! test
8055 Magic Word: {{NAMESPACEE}}
8056 !! options
8057 title=[[User:Ævar Arnfjörð Bjarmason]]
8058 !! wikitext
8059 {{NAMESPACEE}}
8060 !! html
8061 <p>User
8062 </p>
8063 !! end
8064
8065 !! test
8066 Magic Word: {{NAMESPACENUMBER}}
8067 !! options
8068 title=[[User:Ævar Arnfjörð Bjarmason]]
8069 !! wikitext
8070 {{NAMESPACENUMBER}}
8071 !! html
8072 <p>2
8073 </p>
8074 !! end
8075
8076 !! test
8077 Magic Word: {{SUBPAGENAME}}
8078 !! options
8079 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8080 !! wikitext
8081 {{SUBPAGENAME}}
8082 !! html
8083 <p>sub ö
8084 </p>
8085 !! end
8086
8087 !! test
8088 Magic Word: {{SUBPAGENAMEE}}
8089 !! options
8090 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8091 !! wikitext
8092 {{SUBPAGENAMEE}}
8093 !! html
8094 <p>sub_%C3%B6
8095 </p>
8096 !! end
8097
8098 !! test
8099 Magic Word: {{ROOTPAGENAME}}
8100 !! options
8101 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8102 !! wikitext
8103 {{ROOTPAGENAME}}
8104 !! html
8105 <p>Ævar Arnfjörð Bjarmason
8106 </p>
8107 !! end
8108
8109 !! test
8110 Magic Word: {{ROOTPAGENAMEE}}
8111 !! options
8112 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8113 !! wikitext
8114 {{ROOTPAGENAMEE}}
8115 !! html
8116 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8117 </p>
8118 !! end
8119
8120 !! test
8121 Magic Word: {{BASEPAGENAME}}
8122 !! options
8123 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8124 !! wikitext
8125 {{BASEPAGENAME}}
8126 !! html
8127 <p>Ævar Arnfjörð Bjarmason
8128 </p>
8129 !! end
8130
8131 !! test
8132 Magic Word: {{BASEPAGENAMEE}}
8133 !! options
8134 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8135 !! wikitext
8136 {{BASEPAGENAMEE}}
8137 !! html
8138 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8139 </p>
8140 !! end
8141
8142 !! test
8143 Magic Word: {{TALKPAGENAME}}
8144 !! options
8145 title=[[User:Ævar Arnfjörð Bjarmason]]
8146 !! wikitext
8147 {{TALKPAGENAME}}
8148 !! html
8149 <p>User talk:Ævar Arnfjörð Bjarmason
8150 </p>
8151 !! end
8152
8153 !! test
8154 Magic Word: {{TALKPAGENAMEE}}
8155 !! options
8156 title=[[User:Ævar Arnfjörð Bjarmason]]
8157 !! wikitext
8158 {{TALKPAGENAMEE}}
8159 !! html
8160 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8161 </p>
8162 !! end
8163
8164 !! test
8165 Magic Word: {{SUBJECTPAGENAME}}
8166 !! options
8167 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8168 !! wikitext
8169 {{SUBJECTPAGENAME}}
8170 !! html
8171 <p>User:Ævar Arnfjörð Bjarmason
8172 </p>
8173 !! end
8174
8175 !! test
8176 Magic Word: {{SUBJECTPAGENAMEE}}
8177 !! options
8178 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8179 !! wikitext
8180 {{SUBJECTPAGENAMEE}}
8181 !! html
8182 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8183 </p>
8184 !! end
8185
8186 !! test
8187 Magic Word: {{NUMBEROFFILES}}
8188 !! wikitext
8189 {{NUMBEROFFILES}}
8190 !! html
8191 <p>5
8192 </p>
8193 !! end
8194
8195 !! test
8196 Magic Word: {{PAGENAME}}
8197 !! options
8198 title=[[User:Ævar Arnfjörð Bjarmason]]
8199 !! wikitext
8200 {{PAGENAME}}
8201 !! html
8202 <p>Ævar Arnfjörð Bjarmason
8203 </p>
8204 !! end
8205
8206 !! test
8207 Magic Word: {{PAGENAME}} with metacharacters
8208 !! options
8209 title=[['foo & bar = baz']]
8210 !! wikitext
8211 ''{{PAGENAME}}''
8212 !! html/php
8213 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8214 </p>
8215 !! html+tidy
8216 <p><i>'foo &amp; bar = baz'</i></p>
8217 !! end
8218
8219 !! test
8220 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8221 !! options
8222 title=[[*RFC 1234 http://example.com/]]
8223 !! wikitext
8224 {{PAGENAME}}
8225 !! html/php
8226 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8227 </p>
8228 !! html+tidy
8229 <p>*RFC 1234 http://example.com/</p>
8230 !! end
8231
8232 !! test
8233 Magic Word: {{PAGENAMEE}}
8234 !! options
8235 title=[[User:Ævar Arnfjörð Bjarmason]]
8236 !! wikitext
8237 {{PAGENAMEE}}
8238 !! html
8239 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8240 </p>
8241 !! end
8242
8243 !! test
8244 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8245 !! options
8246 title=[[*RFC 1234 http://example.com/]]
8247 !! wikitext
8248 {{PAGENAMEE}}
8249 !! html/php
8250 <p>&#42;RFC_1234_http&#58;//example.com/
8251 </p>
8252 !! html+tidy
8253 <p>*RFC_1234_http://example.com/</p>
8254 !! end
8255
8256 !! test
8257 Magic Word: {{REVISIONID}}
8258 !! wikitext
8259 {{REVISIONID}}
8260 !! html
8261 <p>1337
8262 </p>
8263 !! end
8264
8265 !! test
8266 Magic Word: {{SCRIPTPATH}}
8267 !! wikitext
8268 {{SCRIPTPATH}}
8269 !! html
8270 <p>/
8271 </p>
8272 !! end
8273
8274 !! test
8275 Magic Word: {{STYLEPATH}}
8276 !! wikitext
8277 {{STYLEPATH}}
8278 !! html
8279 <p>/skins
8280 </p>
8281 !! end
8282
8283 !! test
8284 Magic Word: {{SERVER}}
8285 !! wikitext
8286 {{SERVER}}
8287 !! html
8288 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8289 </p>
8290 !! end
8291
8292 !! test
8293 Magic Word: {{SERVERNAME}}
8294 !! wikitext
8295 {{SERVERNAME}}
8296 !! html
8297 <p>example.org
8298 </p>
8299 !! end
8300
8301 !! test
8302 Magic Word: {{SITENAME}}
8303 !! wikitext
8304 {{SITENAME}}
8305 !! html
8306 <p>MediaWiki
8307 </p>
8308 !! end
8309
8310 !! test
8311 Case-sensitive magic words, when cased differently, should just be template transclusions
8312 !! wikitext
8313 {{CurrentMonth}}
8314 {{currentday}}
8315 {{cURreNTweEK}}
8316 {{currentHour}}
8317 !! html
8318 <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>
8319 <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>
8320 <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>
8321 <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>
8322 </p>
8323 !! end
8324
8325 !! test
8326 Case-insensitive magic words should still work with weird casing.
8327 !! wikitext
8328 {{sErVeRNaMe}}
8329 {{LCFirst:AOEU}}
8330 {{ucFIRST:aoeu}}
8331 {{SERver}}
8332 !! html
8333 <p>example.org
8334 aOEU
8335 Aoeu
8336 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8337 </p>
8338 !! end
8339
8340 !! test
8341 Namespace 1 {{ns:1}}
8342 !! wikitext
8343 {{ns:1}}
8344 !! html
8345 <p>Talk
8346 </p>
8347 !! end
8348
8349 !! test
8350 Namespace 1 {{ns:01}}
8351 !! wikitext
8352 {{ns:01}}
8353 !! html
8354 <p>Talk
8355 </p>
8356 !! end
8357
8358 !! test
8359 Namespace 0 {{ns:0}} (bug 4783)
8360 !! wikitext
8361 {{ns:0}}
8362 !! html
8363
8364 !! end
8365
8366 !! test
8367 Namespace 0 {{ns:00}} (bug 4783)
8368 !! wikitext
8369 {{ns:00}}
8370 !! html
8371
8372 !! end
8373
8374 !! test
8375 Namespace -1 {{ns:-1}}
8376 !! wikitext
8377 {{ns:-1}}
8378 !! html
8379 <p>Special
8380 </p>
8381 !! end
8382
8383 !! test
8384 Namespace User {{ns:User}}
8385 !! wikitext
8386 {{ns:User}}
8387 !! html
8388 <p>User
8389 </p>
8390 !! end
8391
8392 !! test
8393 Namespace User talk {{ns:User_talk}}
8394 !! wikitext
8395 {{ns:User_talk}}
8396 !! html
8397 <p>User talk
8398 </p>
8399 !! end
8400
8401 !! test
8402 Namespace User talk {{ns:uSeR tAlK}}
8403 !! wikitext
8404 {{ns:uSeR tAlK}}
8405 !! html
8406 <p>User talk
8407 </p>
8408 !! end
8409
8410 !! test
8411 Namespace File {{ns:File}}
8412 !! wikitext
8413 {{ns:File}}
8414 !! html
8415 <p>File
8416 </p>
8417 !! end
8418
8419 !! test
8420 Namespace File {{ns:Image}}
8421 !! wikitext
8422 {{ns:Image}}
8423 !! html
8424 <p>File
8425 </p>
8426 !! end
8427
8428 !! test
8429 Namespace (lang=de) Benutzer {{ns:User}}
8430 !! options
8431 language=de
8432 !! wikitext
8433 {{ns:User}}
8434 !! html
8435 <p>Benutzer
8436 </p>
8437 !! end
8438
8439 !! test
8440 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8441 !! options
8442 language=de
8443 !! wikitext
8444 {{ns:3}}
8445 !! html
8446 <p>Benutzer Diskussion
8447 </p>
8448 !! end
8449
8450
8451 !! test
8452 Urlencode
8453 !! wikitext
8454 {{urlencode:hi world?!}}
8455 {{urlencode:hi world?!|WIKI}}
8456 {{urlencode:hi world?!|PATH}}
8457 {{urlencode:hi world?!|QUERY}}
8458 !! html
8459 <p>hi+world%3F%21
8460 hi_world%3F!
8461 hi%20world%3F%21
8462 hi+world%3F%21
8463 </p>
8464 !! end
8465
8466 !! test
8467 Magic Word: prioritize type info over data-parsoid
8468 !! options
8469 parsoid=html2wt
8470 !! wikitext
8471 __FORCETOC__
8472 !! html
8473 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8474 !! end
8475
8476 !! test
8477 Magic Word: serialize on separate line (parsoid)
8478 !! options
8479 parsoid=wt2wt,html2wt
8480 !! wikitext
8481 foo
8482 __NOTOC__
8483 bar
8484 !! html
8485 foo<meta property="mw:PageProp/notoc"/>bar
8486 !! end
8487
8488 !! test
8489 Magic Word: rt non-english wikis
8490 !! options
8491 parsoid=wt2wt
8492 language=de
8493 !! wikitext
8494 __NOEDITSECTION__
8495 !! html
8496 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8497 !! end
8498
8499 ###
8500 ### Magic links
8501 ###
8502 !! test
8503 Magic links: internal link to RFC (bug 479)
8504 !! wikitext
8505 [[RFC 123]]
8506 !! html
8507 <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>
8508 </p>
8509 !! end
8510
8511 !! test
8512 Magic links: RFC (bug 479)
8513 !! wikitext
8514 RFC 822
8515 !! html
8516 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8517 </p>
8518 !! end
8519
8520 !! test
8521 Magic links: ISBN (bug 1937)
8522 !! wikitext
8523 ISBN 0-306-40615-2
8524 !! html
8525 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8526 </p>
8527 !! end
8528
8529 !! test
8530 Magic links: PMID incorrectly converts space to underscore
8531 !! wikitext
8532 PMID 1234
8533 !! html
8534 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8535 </p>
8536 !! end
8537
8538 ###
8539 ### Templates
8540 ####
8541
8542 !! test
8543 Nonexistent template
8544 !! wikitext
8545 {{thistemplatedoesnotexist}}
8546 !! html
8547 <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>
8548 </p>
8549 !! end
8550
8551 !! test
8552 Template with invalid target containing tags
8553 !! wikitext
8554 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8555 !! html
8556 <p>{{a<b>b</b>|foo|a=b|a = b}}
8557 </p>
8558 !! end
8559
8560 !! test
8561 Template with invalid target containing unclosed tag
8562 !! wikitext
8563 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8564 !! html
8565 <p>{{a<b>|foo|a=b|a = b}}</b>
8566 </p>
8567 !! end
8568
8569 !! test
8570 Template with invalid target containing wikilink
8571 !! wikitext
8572 {{[[Main Page]]}}
8573 !! html/php
8574 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8575 </p>
8576 !! html/parsoid
8577 <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>
8578 !! end
8579
8580 !! test
8581 Template with just whitespace in it, bug #68421
8582 !! wikitext
8583 {{echo|{{ }}}}
8584 !! html/parsoid
8585 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
8586 !! end
8587
8588 !! article
8589 Template:test
8590 !! text
8591 This is a test template
8592 !! endarticle
8593
8594 !! test
8595 Simple template
8596 !! wikitext
8597 {{test}}
8598 !! html
8599 <p>This is a test template
8600 </p>
8601 !! end
8602
8603 !! test
8604 Template with explicit namespace
8605 !! wikitext
8606 {{Template:test}}
8607 !! html
8608 <p>This is a test template
8609 </p>
8610 !! end
8611
8612
8613 !! article
8614 Template:paramtest
8615 !! text
8616 This is a test template with parameter {{{param}}}
8617 !! endarticle
8618
8619 !! test
8620 Template parameter
8621 !! wikitext
8622 {{paramtest|param=foo}}
8623 !! html
8624 <p>This is a test template with parameter foo
8625 </p>
8626 !! end
8627
8628 !! article
8629 Template:paramtestnum
8630 !! text
8631 [[{{{1}}}|{{{2}}}]]
8632 !! endarticle
8633
8634 !! test
8635 Template unnamed parameter
8636 !! wikitext
8637 {{paramtestnum|Main Page|the main page}}
8638 !! html
8639 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8640 </p>
8641 !! end
8642
8643 !! article
8644 Template:templatesimple
8645 !! text
8646 (test)
8647 !! endarticle
8648
8649 !! article
8650 Template:templateredirect
8651 !! text
8652 #redirect [[Template:templatesimple]]
8653 !! endarticle
8654
8655 !! article
8656 Template:templateasargtestnum
8657 !! text
8658 {{{{{1}}}}}
8659 !! endarticle
8660
8661 !! article
8662 Template:templateasargtest
8663 !! text
8664 {{template{{{templ}}}}}
8665 !! endarticle
8666
8667 !! article
8668 Template:templateasargtest2
8669 !! text
8670 {{{{{templ}}}}}
8671 !! endarticle
8672
8673 !! test
8674 Template with template name as unnamed argument
8675 !! wikitext
8676 {{templateasargtestnum|templatesimple}}
8677 !! html
8678 <p>(test)
8679 </p>
8680 !! end
8681
8682 !! test
8683 Template with template name as argument
8684 !! wikitext
8685 {{templateasargtest|templ=simple}}
8686 !! html
8687 <p>(test)
8688 </p>
8689 !! end
8690
8691 !! test
8692 Template with template name as argument (2)
8693 !! wikitext
8694 {{templateasargtest2|templ=templatesimple}}
8695 !! html
8696 <p>(test)
8697 </p>
8698 !! end
8699
8700 !! article
8701 Template:templateasargtestdefault
8702 !! text
8703 {{{{{templ|templatesimple}}}}}
8704 !! endarticle
8705
8706 !! article
8707 Template:templa
8708 !! text
8709 '''templ'''
8710 !! endarticle
8711
8712 !! test
8713 Template with default value
8714 !! wikitext
8715 {{templateasargtestdefault}}
8716 !! html
8717 <p>(test)
8718 </p>
8719 !! end
8720
8721 !! test
8722 Template with default value (value set)
8723 !! wikitext
8724 {{templateasargtestdefault|templ=templa}}
8725 !! html
8726 <p><b>templ</b>
8727 </p>
8728 !! end
8729
8730 !! test
8731 Template redirect
8732 !! wikitext
8733 {{templateredirect}}
8734 !! html
8735 <p>(test)
8736 </p>
8737 !! end
8738
8739 !! test
8740 Template with argument in separate line
8741 !! wikitext
8742 {{ templateasargtest |
8743 templ = simple }}
8744 !! html
8745 <p>(test)
8746 </p>
8747 !! end
8748
8749 !! test
8750 Template with complex template as argument
8751 !! wikitext
8752 {{paramtest|
8753 param ={{ templateasargtest |
8754 templ = simple }}}}
8755 !! html
8756 <p>This is a test template with parameter (test)
8757 </p>
8758 !! end
8759
8760 !! test
8761 Template with thumb image (with link in description)
8762 !! wikitext
8763 {{paramtest|
8764 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8765 !! html/php
8766 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>
8767
8768 !! html+tidy
8769 <p>This is a test template with parameter</p>
8770 <div class="thumb tright">
8771 <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>
8772 <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>
8773 </div>
8774 </div>
8775 !! end
8776
8777 !! article
8778 Template:complextemplate
8779 !! text
8780 {{{1}}} {{paramtest|
8781 param ={{{param}}}}}
8782 !! endarticle
8783
8784 !! test
8785 Template with complex arguments
8786 !! wikitext
8787 {{complextemplate|
8788 param ={{ templateasargtest |
8789 templ = simple }}|[[Template:complextemplate|link]]}}
8790 !! html
8791 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8792 </p>
8793 !! end
8794
8795 !! test
8796 BUG 553: link with two variables in a piped link
8797 !! wikitext
8798 {|
8799 |[[{{{1}}}|{{{2}}}]]
8800 |}
8801 !! html
8802 <table>
8803 <tr>
8804 <td>[[{{{1}}}|{{{2}}}]]
8805 </td></tr></table>
8806
8807 !! end
8808
8809 !! test
8810 Magic variable as template parameter
8811 !! wikitext
8812 {{paramtest|param={{SITENAME}}}}
8813 !! html
8814 <p>This is a test template with parameter MediaWiki
8815 </p>
8816 !! end
8817
8818 !! article
8819 Template:linktest
8820 !! text
8821 [[{{{param}}}|link]]
8822 !! endarticle
8823
8824 !! test
8825 Template parameter as link source
8826 !! wikitext
8827 {{linktest|param=Main Page}}
8828 !! html
8829 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8830 </p>
8831 !! end
8832
8833 !!test
8834 Template-generated attribute string (k='v')
8835 !! wikitext
8836 <span {{attr_str|id|v1}}>bar</span>
8837 !! html
8838 <p><span id="v1">bar</span>
8839 </p>
8840 !!end
8841
8842 !!article
8843 Template:paramtest2
8844 !! text
8845 including another template, {{paramtest|param={{{arg}}}}}
8846 !! endarticle
8847
8848 !! test
8849 Template passing argument to another template
8850 !! wikitext
8851 {{paramtest2|arg='hmm'}}
8852 !! html
8853 <p>including another template, This is a test template with parameter 'hmm'
8854 </p>
8855 !! end
8856
8857 !! article
8858 Template:Linktest2
8859 !! text
8860 Main Page
8861 !! endarticle
8862
8863 !! test
8864 Template as link source
8865 !! wikitext
8866 [[{{linktest2}}]]
8867
8868 [[{{linktest2}}|Main Page]]
8869
8870 [[{{linktest2}}]]Page
8871 !! html
8872 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8873 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8874 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8875 </p>
8876 !! end
8877
8878
8879 !! article
8880 Template:loop1
8881 !! text
8882 {{loop2}}
8883 !! endarticle
8884
8885 !! article
8886 Template:loop2
8887 !! text
8888 {{loop1}}
8889 !! endarticle
8890
8891 !! test
8892 Template infinite loop
8893 !! wikitext
8894 {{loop1}}
8895 !! html
8896 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8897 </p>
8898 !! end
8899
8900 !! test
8901 Template from main namespace
8902 !! wikitext
8903 {{:Main Page}}
8904 !! html
8905 <p>blah blah
8906 </p>
8907 !! end
8908
8909 !! article
8910 Template:table
8911 !! text
8912 {|
8913 | 1 || 2
8914 |-
8915 | 3 || 4
8916 |}
8917 !! endarticle
8918
8919 !! test
8920 BUG 529: Template with table, not included at beginning of line
8921 !! wikitext
8922 foo {{table}}
8923 !! html
8924 <p>foo
8925 </p>
8926 <table>
8927 <tr>
8928 <td> 1 </td>
8929 <td> 2
8930 </td></tr>
8931 <tr>
8932 <td> 3 </td>
8933 <td> 4
8934 </td></tr></table>
8935
8936 !! end
8937
8938 !! test
8939 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8940 !! wikitext
8941 foo
8942 {{table}}
8943 !! html
8944 <p>foo
8945 </p>
8946 <table>
8947 <tr>
8948 <td> 1 </td>
8949 <td> 2
8950 </td></tr>
8951 <tr>
8952 <td> 3 </td>
8953 <td> 4
8954 </td></tr></table>
8955
8956 !! end
8957
8958 !! test
8959 BUG 41: Template parameters shown as broken links
8960 !! wikitext
8961 {{{parameter}}}
8962 !! html
8963 <p>{{{parameter}}}
8964 </p>
8965 !! end
8966
8967 !! test
8968 Template with targets containing wikilinks
8969 !! wikitext
8970 {{[[foo]]}}
8971
8972 {{[[{{echo|foo}}]]}}
8973
8974 {{{{echo|[[foo}}]]}}
8975 !! html
8976 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
8977 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
8978 </p><p>{{[[foo}}]]
8979 </p>
8980 !! end
8981
8982 !! article
8983 Template:MSGNW test
8984 !! text
8985 ''None'' of '''this''' should be
8986 * interpreted
8987 but rather passed unmodified
8988 {{test}}
8989 <gallery>
8990 File:Foobar.jpg
8991 </gallery>
8992 !! endarticle
8993
8994 # hmm, fix this or just deprecate msgnw and document its behavior?
8995 !! test
8996 msgnw keyword
8997 !! wikitext
8998 {{msgnw:MSGNW test}}
8999 !! html
9000 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
9001 &#42; interpreted
9002 &#32;but rather passed unmodified
9003 &#123;&#123;test&#125;&#125;
9004 &#60;gallery&#62;
9005 File:Foobar.jpg
9006 &#60;/gallery&#62;
9007 </p>
9008 !! end
9009
9010 !! test
9011 int keyword
9012 !! wikitext
9013 {{int:youhavenewmessages|lots of money|not!}}
9014 !! html
9015 <p>You have lots of money (not!).
9016 </p>
9017 !! end
9018
9019 !! article
9020 Template:Includes
9021 !! text
9022 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9023 !! endarticle
9024
9025 !! test
9026 <includeonly> and <noinclude> being included
9027 !! wikitext
9028 {{Includes}}
9029 !! html
9030 <p>Foobar
9031 </p>
9032 !! end
9033
9034 !! article
9035 Template:Includes2
9036 !! text
9037 <onlyinclude>Foo</onlyinclude>bar
9038 !! endarticle
9039
9040 !! test
9041 <onlyinclude> being included
9042 !! wikitext
9043 {{Includes2}}
9044 !! html
9045 <p>Foo
9046 </p>
9047 !! end
9048
9049
9050 !! article
9051 Template:Includes3
9052 !! text
9053 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9054 !! endarticle
9055
9056 !! test
9057 <onlyinclude> and <includeonly> being included
9058 !! wikitext
9059 {{Includes3}}
9060 !! html
9061 <p>Foo
9062 </p>
9063 !! end
9064
9065 !! test
9066 <includeonly> and <noinclude> on a page
9067 !! wikitext
9068 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9069 !! html
9070 <p>Foozar
9071 </p>
9072 !! end
9073
9074 !! test
9075 Un-closed <noinclude>
9076 !! wikitext
9077 <noinclude>
9078 !! html
9079 !! end
9080
9081 !! test
9082 <onlyinclude> on a page
9083 !! wikitext
9084 <onlyinclude>Foo</onlyinclude>bar
9085 !! html
9086 <p>Foobar
9087 </p>
9088 !! end
9089
9090 !! test
9091 Un-closed <onlyinclude>
9092 !! wikitext
9093 <onlyinclude>
9094 !! html
9095 !! end
9096
9097 !!test
9098 Self-closed noinclude, includeonly, onlyinclude tags
9099 !! wikitext
9100 <noinclude />
9101 <includeonly />
9102 <onlyinclude />
9103 !! html
9104 <p><br />
9105 </p>
9106 !!end
9107
9108 !!test
9109 Unbalanced includeonly and noinclude tags
9110 !! wikitext
9111 {|
9112 |a</noinclude>
9113 |b</noinclude></noinclude>
9114 |c</noinclude></includeonly>
9115 |d</includeonly></includeonly>
9116 |}
9117 !! html
9118 <table>
9119 <tr>
9120 <td>a
9121 </td>
9122 <td>b
9123 </td>
9124 <td>c&lt;/includeonly&gt;
9125 </td>
9126 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9127 </td></tr></table>
9128
9129 !!end
9130
9131 !! article
9132 Template:Includeonly section
9133 !! text
9134 <includeonly>
9135 ==Includeonly section==
9136 </includeonly>
9137 ==Section T-1==
9138 !!endarticle
9139
9140 !! test
9141 Bug 6563: Edit link generation for section shown by <includeonly>
9142 !! wikitext
9143 {{includeonly section}}
9144 !! html
9145 <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>
9146 <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>
9147
9148 !! end
9149
9150 # Uses same input as the contents of [[Template:Includeonly section]]
9151 !! test
9152 Bug 6563: Section extraction for section shown by <includeonly>
9153 !! options
9154 section=T-2
9155 !! wikitext
9156 <includeonly>
9157 ==Includeonly section==
9158 </includeonly>
9159 ==Section T-2==
9160 !! html
9161 ==Section T-2==
9162 !! end
9163
9164 !! test
9165 Bug 6563: Edit link generation for section suppressed by <includeonly>
9166 !! wikitext
9167 <includeonly>
9168 ==Includeonly section==
9169 </includeonly>
9170 ==Section 1==
9171 !! html
9172 <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>
9173
9174 !! end
9175
9176 !! test
9177 Bug 6563: Section extraction for section suppressed by <includeonly>
9178 !! options
9179 section=1
9180 !! wikitext
9181 <includeonly>
9182 ==Includeonly section==
9183 </includeonly>
9184 ==Section 1==
9185 !! html
9186 ==Section 1==
9187 !! end
9188
9189 !! test
9190 Un-closed <includeonly>
9191 !! wikitext
9192 <includeonly>
9193 !! html
9194 !! end
9195
9196 !! test
9197 Includes and comments at SOL
9198 !! wikitext
9199 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9200
9201 <noinclude>
9202 some
9203 </noinclude>* stuff
9204 * here
9205
9206 <includeonly>can have stuff</includeonly>=== here ===
9207
9208 !! html/php
9209 <h2><span class="mw-headline" id="hu">hu</span></h2>
9210 <p>some
9211 </p>
9212 <ul><li> stuff</li>
9213 <li> here</li></ul>
9214 <h3><span class="mw-headline" id="here">here</span></h3>
9215
9216 !! html/parsoid
9217 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment -->
9218 <h2 data-parsoid='{}'> hu </h2>
9219
9220 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9221
9222 <p data-parsoid='{}'>some</p>
9223 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
9224 <ul data-parsoid='{}'>
9225 <li data-parsoid='{}'> stuff</li>
9226
9227 <li data-parsoid='{}'> here</li></ul>
9228
9229 <h3 data-parsoid='{}'> here </h3>
9230 !! end
9231
9232 # TODO: test with DOM fragment reuse!
9233 !! test
9234 Parsoid: DOM fragment reuse
9235 !! options
9236 parsoid=wt2wt,wt2html
9237 !! wikitext
9238 a{{echo|b<table></table>c}}d
9239
9240 a{{echo|b
9241 <table></table>
9242 c}}d
9243
9244 {{echo|a
9245
9246 <table></table>
9247
9248 b}}
9249 !! html
9250 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
9251 <table></table>c"}},"i":0}}]}'>b</span>
9252 <table about="#mwt1"></table><span about="#mwt1">c</span>d
9253
9254
9255 <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">
9256 </span>
9257 <table about="#mwt2"></table><span about="#mwt2">
9258 </span>
9259 <p about="#mwt2">cd</p>
9260
9261
9262 <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">
9263
9264 </span>
9265 <table about="#mwt3"></table><span about="#mwt3">
9266
9267 </span>
9268 <p about="#mwt3">b</p>
9269 !! end
9270
9271 !! test
9272 Parsoid: Merge double tds (bug 50603)
9273 !! options
9274 parsoid
9275 !! wikitext
9276 {|
9277 |{{echo|{{!}} foo}}
9278 |}
9279 !! html
9280 <table><tbody>
9281 <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>
9282 </tbody></table>
9283 !! end
9284
9285 !! test
9286 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9287 !! options
9288 parsoid
9289 !! wikitext
9290 {{echo|<div>}}
9291 {|
9292 |{{echo|{{!}} foo}}
9293 |}
9294 {{echo|</div>}}
9295 !! html
9296 <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}}]}'>
9297 <table><tbody>
9298 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9299 </tbody></table>
9300 </div>
9301 !! end
9302
9303 ###
9304 ### <includeonly> and <noinclude> in attributes
9305 ###
9306 !!test
9307 0. includeonly around the entire attribute
9308 !! wikitext
9309 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9310 !! html
9311 <p><span id="v2">bar</span>
9312 </p>
9313 !!end
9314
9315 !!test
9316 1. includeonly in html attr key
9317 !! wikitext
9318 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9319 !! html
9320 <p><span id="foo">bar</span>
9321 </p>
9322 !!end
9323
9324 !!test
9325 2. includeonly in html attr value
9326 !! wikitext
9327 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9328 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9329 !! html
9330 <p><span id="v1">bar</span>
9331 <span id="v1">bar</span>
9332 </p>
9333 !!end
9334
9335 !!test
9336 3. includeonly in part of an attr value
9337 !! wikitext
9338 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9339 !! html
9340 <p><span style="color:red;">bar</span>
9341 </p>
9342 !!end
9343
9344 !!test
9345 4. includeonly in table attributes
9346 !! wikitext
9347 {|
9348 |- <noinclude>
9349 |-
9350 |a
9351 </noinclude>
9352 |- <includeonly>
9353 |-
9354 |b
9355 </includeonly>
9356 |}
9357 !! html
9358 <table>
9359
9360
9361 <tr>
9362 <td>a
9363 </td></tr>
9364 </table>
9365
9366 !!end
9367
9368 ###
9369 ### Token Stream Patcher tests
9370 ###
9371 ### These tests won't always pass wt2wt and other modes because
9372 ### on serialization, the table will be output on a new line.
9373 ### For now, we are blacklisting them, and using this to test selser.
9374 ###
9375
9376 !!test
9377 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9378 !!options
9379 parsoid=wt2html,wt2wt
9380 !!wikitext
9381 {{echo|}}{| width = '100%'
9382 |foo
9383 |}
9384 !!html/parsoid
9385 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
9386 <table width="100%">
9387 <tbody>
9388 <tr>
9389 <td>foo</td></tr></tbody></table>
9390 !!end
9391
9392 !!test
9393 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9394 !!options
9395 parsoid=wt2html,wt2wt
9396 !!wikitext
9397 <includeonly>a</includeonly>{| {{{b}}}
9398 |c
9399 |}
9400 !!html/parsoid
9401 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
9402 <tbody><tr><td>c</td></tr>
9403 </tbody></table>
9404
9405 !!end
9406
9407 ###
9408 ### Testing parsing of templates where a template arg
9409 ### has the same name as the template itself.
9410 ###
9411
9412 !! article
9413 Template:quote
9414 !! text
9415 {{{quote|{{{1}}}}}}
9416 !! endarticle
9417
9418 !!test
9419 Templates: Template Name/Arg clash: 1. Use of positional param
9420 !! wikitext
9421 {{quote|foo}}
9422 !! html
9423 <p>foo
9424 </p>
9425 !!end
9426
9427 !!test
9428 Templates: Template Name/Arg clash: 2. Use of named param
9429 !! wikitext
9430 {{quote|quote=foo}}
9431 !! html
9432 <p>foo
9433 </p>
9434 !!end
9435
9436 !!test
9437 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9438 !! wikitext
9439 {{quote|quote}}
9440 !! html
9441 <p>quote
9442 </p>
9443 !!end
9444
9445 ###
9446 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9447 ###
9448
9449 !!test
9450 Templates: 1. Simple use
9451 !! wikitext
9452 {{echo|Foo}}
9453 !! html
9454 <p>Foo
9455 </p>
9456 !!end
9457
9458 !!test
9459 Templates: 2. Inside a block tag
9460 !! wikitext
9461 <div>{{echo|Foo}}</div>
9462 <blockquote>{{echo|Foo}}</blockquote>
9463 !! html
9464 <div>Foo</div>
9465 <blockquote>Foo</blockquote>
9466
9467 !! html+tidy
9468 <div>Foo</div>
9469 <blockquote>
9470 <p>Foo</p>
9471 </blockquote>
9472 !!end
9473
9474 !!test
9475 Templates: P-wrapping: 1a. Templates on consecutive lines
9476 !! wikitext
9477 {{echo|Foo}}
9478 {{echo|bar}}
9479 !! html
9480 <p>Foo
9481 bar
9482 </p>
9483 !!end
9484
9485 !!test
9486 Templates: P-wrapping: 1b. Templates on consecutive lines
9487 !! wikitext
9488 Foo
9489
9490 {{echo|bar}}
9491 {{echo|baz}}
9492 !! html
9493 <p>Foo
9494 </p><p>bar
9495 baz
9496 </p>
9497 !!end
9498
9499 !!test
9500 Templates: P-wrapping: 1c. Templates on consecutive lines
9501 !! wikitext
9502 {{echo|Foo}}
9503 {{echo|bar}} <div>baz</div>
9504 !! html
9505 <p>Foo
9506 </p>
9507 bar <div>baz</div>
9508
9509 !! html+tidy
9510 <p>Foo</p>
9511 <p>bar</p>
9512 <div>baz</div>
9513 !! end
9514
9515 !!test
9516 Templates: P-wrapping: 1d. Template preceded by comment-only line
9517 !!options
9518 parsoid
9519 !! wikitext
9520 <!-- foo -->
9521 {{echo|Bar}}
9522 !! html
9523 <!-- foo -->
9524
9525 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9526 !!end
9527
9528 !!test
9529 Templates: Inline Text: 1. Multiple template uses
9530 !! wikitext
9531 {{echo|Foo}}bar{{echo|baz}}
9532 !! html
9533 <p>Foobarbaz
9534 </p>
9535 !!end
9536
9537 !!test
9538 Templates: Inline Text: 2. Back-to-back template uses
9539 !! wikitext
9540 {{echo|Foo}}{{echo|bar}}
9541 !! html
9542 <p>Foobar
9543 </p>
9544 !!end
9545
9546 !!test
9547 Templates: Block Tags: 1. Multiple template uses
9548 !! wikitext
9549 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9550 !! html
9551 <div>Foo</div><div>bar</div><div>baz</div>
9552
9553 !!end
9554
9555 !!test
9556 Templates: Block Tags: 2. Back-to-back template uses
9557 !! wikitext
9558 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9559 !! html
9560 <div>Foo</div><div>bar</div>
9561
9562 !!end
9563
9564 # This is an edge case relating to paragraph wrapping.
9565 !!test
9566 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9567 !! wikitext
9568 {{echo|a
9569 b</p>}}
9570 !! html/parsoid
9571 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
9572 b</p><p></p>
9573 !!end
9574
9575 !!test
9576 Templates: Links: 1. Simple example
9577 !! wikitext
9578 {{echo|[[Foo|bar]]}}
9579 !! html
9580 <p><a href="/wiki/Foo" title="Foo">bar</a>
9581 </p>
9582 !!end
9583
9584 !!test
9585 Templates: Links: 2. Generation of link href
9586 !! wikitext
9587 [[{{echo|Foo}}|bar]]
9588 !! html
9589 <p><a href="/wiki/Foo" title="Foo">bar</a>
9590 </p>
9591 !!end
9592
9593 !!test
9594 Templates: Links: 3. Generation of part of a link href
9595 !! wikitext
9596 [[Fo{{echo|o}}|bar]]
9597
9598 [[Foo{{echo|bar}}]]
9599
9600 [[Foo{{echo|bar}}baz]]
9601
9602 [[Foo{{echo|bar}}|bar]]
9603
9604 [[:Foo{{echo|bar}}]]
9605
9606 [[:Foo{{echo|bar}}|bar]]
9607 !! html
9608 <p><a href="/wiki/Foo" title="Foo">bar</a>
9609 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9610 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9611 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9612 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9613 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9614 </p>
9615 !!end
9616
9617 !!test
9618 Templates: Links: 4. Multiple templates generating link href
9619 !! wikitext
9620 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9621 !! html
9622 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9623 </p>
9624 !!end
9625
9626 !!test
9627 Templates: Links: 5. Generation of link text
9628 !! wikitext
9629 [[Foo|{{echo|bar}}]]
9630 !! html
9631 <p><a href="/wiki/Foo" title="Foo">bar</a>
9632 </p>
9633 !!end
9634
9635 !!test
9636 Templates: Links: 5. Nested templates (only outermost template should be marked)
9637 !! wikitext
9638 {{echo|[[{{echo|Foo}}|bar]]}}
9639 !! html
9640 <p><a href="/wiki/Foo" title="Foo">bar</a>
9641 </p>
9642 !!end
9643
9644 !!test
9645 Templates: HTML Tag: 1. Generation of HTML attr. key
9646 !! wikitext
9647 <div {{echo|style}}="color:red;">foo</div>
9648 !! html
9649 <div style="color:red;">foo</div>
9650
9651 !!end
9652
9653 !!test
9654 Templates: HTML Tag: 2. Generation of HTML attr. value
9655 !! wikitext
9656 <div style={{echo|'color:red;'}}>foo</div>
9657 !! html
9658 <div style="color:red;">foo</div>
9659
9660 !!end
9661
9662 !!test
9663 Templates: HTML Tag: 3. Generation of HTML attr key and value
9664 !! wikitext
9665 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9666 !! html
9667 <div style="color:red;">foo</div>
9668
9669 !!end
9670
9671 !!test
9672 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9673 !! wikitext
9674 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9675 !! html
9676 <div title="This is a long title with just one piece templated">foo</div>
9677
9678 !!end
9679
9680 !!test
9681 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9682 !! wikitext
9683 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9684 !! html
9685 <div title="This is a long title with just one piece templated">foo</div>
9686
9687 !!end
9688
9689 !!test
9690 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9691 !! wikitext
9692 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9693 !! html
9694 <div title="This is a long title with just one piece templated">foo</div>
9695
9696 !!end
9697
9698 !!test
9699 Templates: HTML Tag: 7. Generation of partial attribute key string
9700 !! wikitext
9701 <div st{{echo|yle}}="color:red;">foo</div>
9702 !! html
9703 <div style="color:red;">foo</div>
9704
9705 !!end
9706
9707 !!test
9708 Templates: HTML Tables: 1. Generating start of a HTML table
9709 !! wikitext
9710 {{echo|<table><tr><td>foo</td>}}</tr></table>
9711 !! html
9712 <table><tr><td>foo</td></tr></table>
9713
9714 !!end
9715
9716 !!test
9717 Templates: HTML Tables: 2a. Generating middle of a HTML table
9718 !! wikitext
9719 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9720 !! html
9721 <table><tr><td>foo</td></tr></table>
9722
9723 !!end
9724
9725 !!test
9726 Templates: HTML Tables: 2b. Generating middle of a HTML table
9727 !! wikitext
9728 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9729 !! html
9730 <table><tr><td>foo</td></tr></table>
9731
9732 !!end
9733
9734 !!test
9735 Templates: HTML Tables: 3. Generating end of a HTML table
9736 !! wikitext
9737 <table><tr>{{echo|<td>foo</td></tr></table>}}
9738 !! html
9739 <table><tr><td>foo</td></tr></table>
9740
9741 !!end
9742
9743 !!test
9744 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9745 !! wikitext
9746 {{echo|<table>}}<tr><td>foo</td></tr></table>
9747 !! html
9748 <table><tr><td>foo</td></tr></table>
9749
9750 !!end
9751
9752 !!test
9753 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9754 !! wikitext
9755 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9756 !! html
9757 <table><tr><td>foo</td></tr></table>
9758
9759 !!end
9760
9761 !!test
9762 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9763 !! wikitext
9764 <table><tr>{{echo|<td>}}foo</td></tr></table>
9765 !! html
9766 <table><tr><td>foo</td></tr></table>
9767
9768 !!end
9769
9770 !!test
9771 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9772 !! wikitext
9773 <table><tr><td>foo{{echo|</td>}}</tr></table>
9774 !! html
9775 <table><tr><td>foo</td></tr></table>
9776
9777 !!end
9778
9779 !!test
9780 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9781 !! wikitext
9782 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9783 !! html
9784 <table><tr><td>foo</td></tr></table>
9785
9786 !!end
9787
9788 !!test
9789 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9790 !! wikitext
9791 <table><tr><td>foo</td></tr>{{echo|</table>}}
9792 !! html
9793 <table><tr><td>foo</td></tr></table>
9794
9795 !!end
9796
9797 !!test
9798 Templates: HTML Tables: 5. Proper fostering of categories from inside
9799 !!options
9800 parsoid=wt2html,wt2wt
9801 !! wikitext
9802 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9803 <!--Two categories (Bug 50330)-->
9804 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9805 !! html
9806 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9807 <!--Two categories (Bug 50330)-->
9808 <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>
9809 !!end
9810
9811 !!test
9812 Templates: Wiki Tables: 1a. Fostering of entire template content
9813 !! wikitext
9814 {|
9815 {{echo|a}}
9816 |}
9817 !! html
9818 <table>
9819 a
9820 <tr><td></td></tr></table>
9821
9822 !! html+tidy
9823 <p>a</p>
9824 <table>
9825 <tr>
9826 <td></td>
9827 </tr>
9828 </table>
9829 !! end
9830
9831 !!test
9832 Templates: Wiki Tables: 1b. Fostering of entire template content
9833 !! wikitext
9834 {|
9835 {{echo|<div>}}
9836 foo
9837 {{echo|</div>}}
9838 |}
9839 !! html
9840 <table>
9841 <div>
9842 <p>foo
9843 </p>
9844 </div>
9845 <tr><td></td></tr></table>
9846
9847 !! html+tidy
9848 <div>
9849 <p>foo</p>
9850 </div>
9851 <table>
9852 <tr>
9853 <td></td>
9854 </tr>
9855 </table>
9856 !! end
9857
9858 !!test
9859 Templates: Wiki Tables: 2. Fostering of partial template content
9860 !! wikitext
9861 {|
9862 {{echo|a
9863 <div>b</div>}}
9864 |}
9865 !! html
9866 <table>
9867 a
9868 <div>b</div>
9869 <tr><td></td></tr></table>
9870
9871 !! html+tidy
9872 <p>a</p>
9873 <div>b</div>
9874 <table>
9875 <tr>
9876 <td></td>
9877 </tr>
9878 </table>
9879 !! end
9880
9881 !!test
9882 Templates: Wiki Tables: 3. td-content via multiple templates
9883 !! wikitext
9884 {|
9885 {{echo|{{pipe}}a}}{{echo|b}}
9886 |}
9887 !! html
9888 <table>
9889 <tr>
9890 <td>ab
9891 </td></tr></table>
9892
9893 !!end
9894
9895 !!test
9896 Templates: Wiki Tables: 4. Templated tags, no content
9897 !! wikitext
9898 {{tbl-start}}
9899 {{tbl-end}}
9900 !! html
9901 <table>
9902 <tr><td></td></tr></table>
9903
9904 !!end
9905
9906 !!test
9907 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9908 !! wikitext
9909 {{tbl-start}}
9910 |foo
9911 {{tbl-end}}
9912 !! html
9913 <table>
9914 <tr>
9915 <td>foo
9916 </td></tr></table>
9917
9918 !!end
9919
9920 !!test
9921 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9922 !! wikitext
9923 {{tbl-start}}
9924 {{!}}foo
9925 {{tbl-end}}
9926 !! html
9927 <table>
9928 <tr>
9929 <td>foo
9930 </td></tr></table>
9931
9932 !!end
9933
9934 !!test
9935 Templates: Lists: Multi-line list-items via templates
9936 !! wikitext
9937 *{{echo|a {{nonexistent|
9938 unused}}}}
9939 *{{echo|b {{nonexistent|
9940 unused}}}}
9941 !! html
9942 <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>
9943 <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>
9944
9945 !!end
9946
9947 !!test
9948 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9949 !! wikitext
9950 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9951 !! html
9952 <p><i>ab</i>c<i>d</i>e
9953 </p>
9954 !!end
9955
9956 !!test
9957 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9958 (PHP parser generates misnested html)
9959 !! wikitext
9960 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9961 !! html/parsoid
9962 <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>
9963 !!end
9964
9965 !!test
9966 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9967 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9968 !! options
9969 parsoid=wt2html,wt2wt
9970 !! wikitext
9971 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9972 !! html
9973 <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>
9974 <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>
9975 <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>
9976 !!end
9977
9978 !!test
9979 Templates: Ugly nesting: 4. Divs opened/closed across templates
9980 !! wikitext
9981 a<div>b{{echo|c</div>d}}e
9982 !! html
9983 a<div>bc</div>de
9984
9985 !! html+tidy
9986 <p>a</p>
9987 <div>bc</div>
9988 <p>de</p>
9989 !! end
9990
9991 !!test
9992 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9993 (Parsoid-centric)
9994 !! options
9995 parsoid
9996 !! wikitext
9997 {|
9998 |{{echo|foo</table>}}
9999 |bar
10000 |}
10001 !! html
10002 <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|}"]}'>
10003
10004 <tbody>
10005 <tr>
10006 <td>foo</td></tr></tbody></table><span about="#mwt1">
10007 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10008 |}</span>
10009 !!end
10010
10011 !!test
10012 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10013 (Parsoid-centric)
10014 !! options
10015 parsoid
10016 !! wikitext
10017 <table>
10018 <tr>
10019 <td>
10020 <table>
10021 <tr>
10022 <td>1. {{echo|foo </table>}}</td>
10023 <td> bar </td>
10024 <td>2. {{echo|baz </table>}}</td>
10025 </tr>
10026 <tr>
10027 <td>abc</td>
10028 </tr>
10029 </table>
10030 </td>
10031 </tr>
10032 <tr>
10033 <td>xyz</td>
10034 </tr>
10035 </table>
10036 !! html
10037 <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>"]}'>
10038 <tbody><tr>
10039 <td>
10040 <table>
10041 <tbody><tr>
10042 <td>1. foo </td></tr></tbody></table></td>
10043 <td> bar </td>
10044 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10045 </span><span about="#mwt2">
10046 </span><span about="#mwt2">
10047 </span><span about="#mwt2">abc</span><span about="#mwt2">
10048 </span><span about="#mwt2">
10049 </span><span about="#mwt2">
10050 </span><span about="#mwt2">
10051 </span><span about="#mwt2">
10052 </span><span about="#mwt2">
10053 </span><span about="#mwt2">xyz</span><span about="#mwt2">
10054 </span><span about="#mwt2">
10055 </span>
10056 !!end
10057
10058 !! test
10059 Templates: Ugly templates: 3. newline-only template parameter
10060 !! wikitext
10061 foo {{echo|
10062 }}
10063 !! html
10064 <p>foo
10065 </p>
10066 !! end
10067
10068 # This looks like a bug: a single newline triggers p/br for some reason.
10069 !! test
10070 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10071 !! wikitext
10072 {{echo|
10073 }}
10074 !! html
10075 <p><br />
10076 </p>
10077 !! end
10078
10079 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10080 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10081 !! test
10082 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10083 !! wikitext
10084 {{echo|<table>}}
10085 {{echo|<div>foo}}
10086 {{echo|</table>}}
10087 !! html/parsoid
10088 <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
10089 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10090 </table>
10091 !! end
10092
10093 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10094 # that are "identical" and generate nesting cycles in the algorithm
10095 !! test
10096 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10097 !! wikitext
10098 {{echo|<table><tr><td><table>}}
10099 {{echo|<div>}}
10100 {{echo|</div>}}
10101 !! html/parsoid
10102 <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"}'>
10103 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10104 </table></td></tr></tbody></table>
10105 !! end
10106
10107 !!test
10108 Parser Functions: 1. Simple example
10109 !! wikitext
10110 {{uc:foo}}
10111 !! html
10112 <p>FOO
10113 </p>
10114 !!end
10115
10116 !!test
10117 Parser Functions: 2. Nested use (only outermost should be marked up)
10118 !! wikitext
10119 {{uc:{{lc:FOO}}}}
10120 !! html
10121 <p>FOO
10122 </p>
10123 !!end
10124
10125 ###
10126 ### Pre-save transform tests
10127 ###
10128 !! test
10129 pre-save transform: subst:
10130 !! options
10131 PST
10132 !! wikitext
10133 {{subst:test}}
10134 !! html
10135 This is a test template
10136 !! end
10137
10138 !! test
10139 pre-save transform: normal template
10140 !! options
10141 PST
10142 !! wikitext
10143 {{test}}
10144 !! html
10145 {{test}}
10146 !! end
10147
10148 !! test
10149 pre-save transform: nonexistent template
10150 !! options
10151 PST
10152 !! wikitext
10153 {{thistemplatedoesnotexist}}
10154 !! html
10155 {{thistemplatedoesnotexist}}
10156 !! end
10157
10158
10159 !! test
10160 pre-save transform: subst magic variables
10161 !! options
10162 PST
10163 !! wikitext
10164 {{subst:SITENAME}}
10165 !! html
10166 MediaWiki
10167 !! end
10168
10169 # This is bug 89, which I fixed. -- wtm
10170 !! test
10171 pre-save transform: subst: templates with parameters
10172 !! options
10173 pst
10174 !! wikitext
10175 {{subst:paramtest|param="something else"}}
10176 !! html
10177 This is a test template with parameter "something else"
10178 !! end
10179
10180 !! article
10181 Template:nowikitest
10182 !! text
10183 <nowiki>'''not wiki'''</nowiki>
10184 !! endarticle
10185
10186 !! test
10187 pre-save transform: nowiki in subst (bug 1188)
10188 !! options
10189 pst
10190 !! wikitext
10191 {{subst:nowikitest}}
10192 !! html
10193 <nowiki>'''not wiki'''</nowiki>
10194 !! end
10195
10196
10197 !! article
10198 Template:commenttest
10199 !! text
10200 This template has <!-- a comment --> in it.
10201 !! endarticle
10202
10203 !! test
10204 pre-save transform: comment in subst (bug 1936)
10205 !! options
10206 pst
10207 !! wikitext
10208 {{subst:commenttest}}
10209 !! html
10210 This template has <!-- a comment --> in it.
10211 !! end
10212
10213 !! test
10214 pre-save transform: unclosed tag
10215 !! options
10216 pst noxml
10217 !! wikitext
10218 <nowiki>'''not wiki'''
10219 !! html
10220 <nowiki>'''not wiki'''
10221 !! end
10222
10223 !! test
10224 pre-save transform: mixed tag case
10225 !! options
10226 pst noxml
10227 !! wikitext
10228 <NOwiki>'''not wiki'''</noWIKI>
10229 !! html
10230 <NOwiki>'''not wiki'''</noWIKI>
10231 !! end
10232
10233 !! test
10234 pre-save transform: unclosed comment in <nowiki>
10235 !! options
10236 pst noxml
10237 !! wikitext
10238 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10239 !! html
10240 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10241 !!end
10242
10243 # Leading @ in this template definition works around a limitation
10244 # in parsoid's parserTests which otherwise strips the <span> from the
10245 # result (confusing it for a template wrapper)
10246 !! article
10247 Template:dangerous
10248 !!text
10249 @<span onmouseover="alert('crap')">Oh no</span>
10250 !!endarticle
10251
10252 !!test
10253 (confirming safety of fix for subst bug 1936)
10254 !! wikitext
10255 {{Template:dangerous}}
10256 !! html
10257 <p>@<span>Oh no</span>
10258 </p>
10259 !! end
10260
10261 !! test
10262 pre-save transform: comment containing gallery (bug 5024)
10263 !! options
10264 pst
10265 !! wikitext
10266 <!-- <gallery>data</gallery> -->
10267 !! html
10268 <!-- <gallery>data</gallery> -->
10269 !!end
10270
10271 !! test
10272 pre-save transform: comment containing extension
10273 !! options
10274 pst
10275 !! wikitext
10276 <!-- <tag>data</tag> -->
10277 !! html
10278 <!-- <tag>data</tag> -->
10279 !!end
10280
10281 !! test
10282 pre-save transform: comment containing nowiki
10283 !! options
10284 pst
10285 !! wikitext
10286 <!-- <nowiki>data</nowiki> -->
10287 !! html
10288 <!-- <nowiki>data</nowiki> -->
10289 !!end
10290
10291 !! test
10292 pre-save transform: <noinclude> in subst (bug 3298)
10293 !! options
10294 pst
10295 !! wikitext
10296 {{subst:Includes}}
10297 !! html
10298 Foobar
10299 !! end
10300
10301 !! test
10302 pre-save transform: <onlyinclude> in subst (bug 3298)
10303 !! options
10304 pst
10305 !! wikitext
10306 {{subst:Includes2}}
10307 !! html
10308 Foo
10309 !! end
10310
10311 !! article
10312 Template:SubstTest
10313 !!text
10314 {{<includeonly>subst:</includeonly>Includes}}
10315 !! endarticle
10316
10317 !! article
10318 Template:SafeSubstTest
10319 !! text
10320 {{<includeonly>safesubst:</includeonly>Includes}}
10321 !! endarticle
10322
10323 !! test
10324 bug 22297: safesubst: works during PST
10325 !! options
10326 pst
10327 !! wikitext
10328 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10329 !! html
10330 FoobarFoobar
10331 !! end
10332
10333 !! test
10334 bug 22297: safesubst: works during normal parse
10335 !! wikitext
10336 {{SafeSubstTest}}
10337 !! html
10338 <p>Foobar
10339 </p>
10340 !! end
10341
10342 !! test
10343 subst: does not work during normal parse
10344 !! wikitext
10345 {{SubstTest}}
10346 !! html
10347 <p>{{subst:Includes}}
10348 </p>
10349 !! end
10350
10351 !! test
10352 pre-save transform: context links ("pipe trick")
10353 !! options
10354 pst
10355 !! wikitext
10356 [[Article (context)|]]
10357 [[Bar:Article|]]
10358 [[:Bar:Article|]]
10359 [[Bar:Article (context)|]]
10360 [[:Bar:Article (context)|]]
10361 [[|Article]]
10362 [[|Article (context)]]
10363 [[Bar:X (Y) Z|]]
10364 [[:Bar:X (Y) Z|]]
10365 !! html
10366 [[Article (context)|Article]]
10367 [[Bar:Article|Article]]
10368 [[:Bar:Article|Article]]
10369 [[Bar:Article (context)|Article]]
10370 [[:Bar:Article (context)|Article]]
10371 [[Article]]
10372 [[Article (context)]]
10373 [[Bar:X (Y) Z|X (Y) Z]]
10374 [[:Bar:X (Y) Z|X (Y) Z]]
10375 !! end
10376
10377 !! test
10378 pre-save transform: context links ("pipe trick") with interwiki prefix
10379 !! options
10380 pst
10381 !! wikitext
10382 [[interwiki:Article|]]
10383 [[:interwiki:Article|]]
10384 [[interwiki:Bar:Article|]]
10385 [[:interwiki:Bar:Article|]]
10386 !! html
10387 [[interwiki:Article|Article]]
10388 [[:interwiki:Article|Article]]
10389 [[interwiki:Bar:Article|Bar:Article]]
10390 [[:interwiki:Bar:Article|Bar:Article]]
10391 !! end
10392
10393 !! test
10394 pre-save transform: context links ("pipe trick") with parens in title
10395 !! options
10396 pst title=[[Somearticle (context)]]
10397 !! wikitext
10398 [[|Article]]
10399 !! html
10400 [[Article (context)|Article]]
10401 !! end
10402
10403 !! test
10404 pre-save transform: context links ("pipe trick") with comma in title
10405 !! options
10406 pst title=[[Someplace, Somewhere]]
10407 !! wikitext
10408 [[|Otherplace]]
10409 [[Otherplace, Elsewhere|]]
10410 [[Otherplace, Elsewhere, Anywhere|]]
10411 !! html
10412 [[Otherplace, Somewhere|Otherplace]]
10413 [[Otherplace, Elsewhere|Otherplace]]
10414 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10415 !! end
10416
10417 !! test
10418 pre-save transform: context links ("pipe trick") with parens and comma
10419 !! options
10420 pst title=[[Someplace (IGNORED), Somewhere]]
10421 !! wikitext
10422 [[|Otherplace]]
10423 [[Otherplace (place), Elsewhere|]]
10424 !! html
10425 [[Otherplace, Somewhere|Otherplace]]
10426 [[Otherplace (place), Elsewhere|Otherplace]]
10427 !! end
10428
10429 !! test
10430 pre-save transform: context links ("pipe trick") with comma and parens
10431 !! options
10432 pst title=[[Who, me? (context)]]
10433 !! wikitext
10434 [[|Yes, you.]]
10435 [[Me, Myself, and I (1937 song)|]]
10436 !! html
10437 [[Yes, you. (context)|Yes, you.]]
10438 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10439 !! end
10440
10441 !! test
10442 pre-save transform: context links ("pipe trick") with namespace
10443 !! options
10444 pst title=[[Ns:Somearticle]]
10445 !! wikitext
10446 [[|Article]]
10447 !! html
10448 [[Ns:Article|Article]]
10449 !! end
10450
10451 !! test
10452 pre-save transform: context links ("pipe trick") with namespace and parens
10453 !! options
10454 pst title=[[Ns:Somearticle (context)]]
10455 !! wikitext
10456 [[|Article]]
10457 !! html
10458 [[Ns:Article (context)|Article]]
10459 !! end
10460
10461 !! test
10462 pre-save transform: context links ("pipe trick") with namespace and comma
10463 !! options
10464 pst title=[[Ns:Somearticle, Context, Whatever]]
10465 !! wikitext
10466 [[|Article]]
10467 !! html
10468 [[Ns:Article, Context, Whatever|Article]]
10469 !! end
10470
10471 !! test
10472 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10473 !! options
10474 pst title=[[Ns:Somearticle, Context (context)]]
10475 !! wikitext
10476 [[|Article]]
10477 !! html
10478 [[Ns:Article (context)|Article]]
10479 !! end
10480
10481 !! test
10482 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10483 !! options
10484 pst title=[[Ns:Somearticle (IGNORED), Context]]
10485 !! wikitext
10486 [[|Article]]
10487 !! html
10488 [[Ns:Article, Context|Article]]
10489 !! end
10490
10491 !! test
10492 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10493 !! options
10494 pst
10495 !! wikitext
10496 [[Article(context)|]]
10497 [[Bar:Article(context)|]]
10498 [[:Bar:Article(context)|]]
10499 [[|Article(context)]]
10500 [[Bar:X(Y)Z|]]
10501 [[:Bar:X(Y)Z|]]
10502 !! html
10503 [[Article(context)|Article]]
10504 [[Bar:Article(context)|Article]]
10505 [[:Bar:Article(context)|Article]]
10506 [[Article(context)]]
10507 [[Bar:X(Y)Z|X(Y)Z]]
10508 [[:Bar:X(Y)Z|X(Y)Z]]
10509 !! end
10510
10511 !! test
10512 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10513 !! options
10514 pst
10515 !! wikitext
10516 [[Article (context)|]]
10517 [[Bar:Article (context)|]]
10518 [[:Bar:Article (context)|]]
10519 [[|Article (context)]]
10520 [[Bar:X (Y) Z|]]
10521 [[:Bar:X (Y) Z|]]
10522 !! html
10523 [[Article (context)|Article]]
10524 [[Bar:Article (context)|Article]]
10525 [[:Bar:Article (context)|Article]]
10526 [[Article (context)]]
10527 [[Bar:X (Y) Z|X (Y) Z]]
10528 [[:Bar:X (Y) Z|X (Y) Z]]
10529 !! end
10530
10531 !! test
10532 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10533 !! options
10534 pst
10535 !! wikitext
10536 [[Article(context)|]]
10537 [[Bar:Article(context)|]]
10538 [[:Bar:Article(context)|]]
10539 [[|Article(context)]]
10540 [[Bar:X(Y)Z|]]
10541 [[:Bar:X(Y)Z|]]
10542 !! html
10543 [[Article(context)|Article]]
10544 [[Bar:Article(context)|Article]]
10545 [[:Bar:Article(context)|Article]]
10546 [[Article(context)]]
10547 [[Bar:X(Y)Z|X(Y)Z]]
10548 [[:Bar:X(Y)Z|X(Y)Z]]
10549 !! end
10550
10551 !! test
10552 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10553 !! options
10554 pst
10555 !! wikitext
10556 [[Article (context), context|]]
10557 [[Article (context),context|]]
10558 [[Bar:Article (context), context|]]
10559 [[Bar:Article (context),context|]]
10560 [[:Bar:Article (context), context|]]
10561 [[:Bar:Article (context),context|]]
10562 !! html
10563 [[Article (context), context|Article]]
10564 [[Article (context),context|Article]]
10565 [[Bar:Article (context), context|Article]]
10566 [[Bar:Article (context),context|Article]]
10567 [[:Bar:Article (context), context|Article]]
10568 [[:Bar:Article (context),context|Article]]
10569 !! end
10570
10571 !! test
10572 pre-save transform: trim trailing empty lines
10573 !! options
10574 pst
10575 !! wikitext
10576 Empty lines are trimmed
10577
10578
10579
10580
10581 !! html
10582 Empty lines are trimmed
10583 !! end
10584
10585 !! test
10586 pre-save transform: Signature expansion
10587 !! options
10588 pst
10589 !! wikitext
10590 * ~~~
10591 * <noinclude>~~~</noinclude>
10592 * <includeonly>~~~</includeonly>
10593 * <onlyinclude>~~~</onlyinclude>
10594 !! html
10595 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10596 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10597 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10598 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10599 !! end
10600
10601
10602 !! test
10603 pre-save transform: Signature expansion in nowiki tags (bug 93)
10604 !! options
10605 pst disabled
10606 !! wikitext
10607 Shall not expand:
10608
10609 <nowiki>~~~~</nowiki>
10610
10611 <includeonly><nowiki>~~~~</nowiki></includeonly>
10612
10613 <noinclude><nowiki>~~~~</nowiki></noinclude>
10614
10615 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10616
10617 {{subst:Foo}} shall be converted to FOO
10618
10619 As well as inside noinclude/onlyinclude
10620 <noinclude>{{subst:Foo}}</noinclude>
10621 <onlyinclude>{{subst:Foo}}</onlyinclude>
10622
10623 But not inside includeonly
10624 <includeonly>{{subst:Foo}}</includeonly>
10625 !! html
10626 Shall not expand:
10627
10628 <nowiki>~~~~</nowiki>
10629
10630 <includeonly><nowiki>~~~~</nowiki></includeonly>
10631
10632 <noinclude><nowiki>~~~~</nowiki></noinclude>
10633
10634 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10635
10636 FOO shall be converted to FOO
10637
10638 As well as inside noinclude/onlyinclude
10639 <noinclude>FOO</noinclude>
10640 <onlyinclude>FOO</onlyinclude>
10641
10642 But not inside includeonly
10643 <includeonly>{{subst:Foo}}</includeonly>
10644 !! end
10645
10646 !! test
10647 Parsoid: Recognize nowiki with trailing space in tags
10648 !! options
10649 parsoid=wt2html
10650 !! wikitext
10651 <nowiki ><div>[[foo]]</nowiki >
10652
10653 a<nowiki / >b
10654
10655 c<nowiki />d
10656
10657 e<nowiki/ >f
10658 !! html
10659 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10660 <p>ab</p>
10661 <p>cd</p>
10662 <p>ef</p>
10663 !! end
10664
10665 !! test
10666 Parsoid: Recognize nowiki with odd capitalization
10667 !! options
10668 parsoid=wt2html
10669 !! wikitext
10670 <noWikI ><div>[[foo]]</Nowiki >
10671 !! html
10672 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10673 !! end
10674
10675
10676 !! test
10677 Parsoid: Escape nowiki with trailing space in tags
10678 !! options
10679 parsoid=html2wt
10680 !! wikitext
10681 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10682
10683 a&lt;nowiki /&gt;b
10684
10685 c&lt;nowiki/ &gt;d
10686 !! html
10687 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10688 <p>a&lt;nowiki /&gt;b</p>
10689 <p>c&lt;nowiki/ &gt;d</p>
10690 !! end
10691
10692 !! test
10693 Parsoid: Escape weird noWikI capitalizations
10694 !! options
10695 parsoid=html2wt
10696 !! wikitext
10697 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10698 !! html
10699 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10700 !! end
10701
10702 ###
10703 ### Message transform tests
10704 ###
10705 !! test
10706 message transform: magic variables
10707 !! options
10708 msg
10709 !! wikitext
10710 {{SITENAME}}
10711 !! html
10712 MediaWiki
10713 !! end
10714
10715 !! test
10716 message transform: should not transform wiki markup
10717 !! options
10718 msg
10719 !! wikitext
10720 ''test''
10721 !! html
10722 ''test''
10723 !! end
10724
10725 !! test
10726 message transform: <noinclude> in transcluded template (bug 4926)
10727 !! options
10728 msg
10729 !! wikitext
10730 {{Includes}}
10731 !! html
10732 Foobar
10733 !! end
10734
10735 !! test
10736 message transform: <onlyinclude> in transcluded template (bug 4926)
10737 !! options
10738 msg
10739 !! wikitext
10740 {{Includes2}}
10741 !! html
10742 Foo
10743 !! end
10744
10745 !! test
10746 {{#special:}} page name, known
10747 !! options
10748 msg
10749 !! wikitext
10750 {{#special:Recentchanges}}
10751 !! html
10752 Special:RecentChanges
10753 !! end
10754
10755 !! test
10756 {{#special:}} page name with subpage, known
10757 !! options
10758 msg
10759 !! wikitext
10760 {{#special:Recentchanges/param}}
10761 !! html
10762 Special:RecentChanges/param
10763 !! end
10764
10765 !! test
10766 {{#special:}} page name, unknown
10767 !! options
10768 msg
10769 !! wikitext
10770 {{#special:foobar nonexistent}}
10771 !! html
10772 Special:Foobar nonexistent
10773 !! end
10774
10775 !! test
10776 {{#speciale:}} page name, known
10777 !! options
10778 msg
10779 !! wikitext
10780 {{#speciale:Recentchanges}}
10781 !! html
10782 Special:RecentChanges
10783 !! end
10784
10785 !! test
10786 {{#speciale:}} page name with subpage, known
10787 !! options
10788 msg
10789 !! wikitext
10790 {{#speciale:Recentchanges/param}}
10791 !! html
10792 Special:RecentChanges/param
10793 !! end
10794
10795 !! test
10796 {{#speciale:}} page name, unknown
10797 !! options
10798 msg
10799 !! wikitext
10800 {{#speciale:foobar nonexistent}}
10801 !! html
10802 Special:Foobar_nonexistent
10803 !! end
10804
10805 ###
10806 ### Images
10807 ###
10808 ### For Parsoid-specific tests, see
10809 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10810
10811 !! test
10812 Simple image
10813 !! options
10814 parsoid=wt2html,wt2wt,html2html
10815 !! wikitext
10816 [[Image:foobar.jpg]]
10817 !! html/php
10818 <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>
10819 </p>
10820 !! html/parsoid
10821 <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>
10822 </p>
10823 !! end
10824
10825 !! test
10826 Simple image (using File: namespace, now canonical)
10827 !! wikitext
10828 [[File:Foobar.jpg]]
10829 !! html/php
10830 <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>
10831 </p>
10832 !! html/parsoid
10833 <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>
10834 </p>
10835 !! end
10836
10837 !! test
10838 Right-aligned image
10839 !! wikitext
10840 [[File:Foobar.jpg|right]]
10841 !! html/php
10842 <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>
10843
10844 !! html/parsoid
10845 <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>
10846 !! end
10847
10848 !! test
10849 Image with caption
10850 !! wikitext
10851 [[File:Foobar.jpg|right|Caption text]]
10852 !! html/php
10853 <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>
10854
10855 !! html/parsoid
10856 <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>
10857 !! end
10858
10859 !! test
10860 Image with caption, bug 53312 #1
10861 !! wikitext
10862 [[File:Foobar.jpg|right|Caption page stuff]]
10863 !! html/php
10864 <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>
10865
10866 !! html/parsoid
10867 <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>
10868 !! end
10869
10870 !! test
10871 Image with caption, bug 53312 #2
10872 !! wikitext
10873 [[File:Foobar.jpg|right|Caption page=]]
10874 !! html/php
10875 <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>
10876
10877 !! html/parsoid
10878 <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>
10879 !! end
10880
10881 !! test
10882 Image with caption, bug 53312 #3
10883 !! wikitext
10884 [[File:Foobar.jpg|right|Caption page=stuff]]
10885 !! html/php
10886 <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>
10887
10888 !! html/parsoid
10889 <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>
10890 !! end
10891
10892 !! test
10893 Allow empty links in image captions (Bug 60753)
10894 !! options
10895 thumbsize=220
10896 !! wikitext
10897 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10898 [[]]
10899 [[Link2]]
10900 ]]
10901 !! html/php
10902 <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"></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>
10903
10904 !! html/parsoid
10905 <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" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
10906 [[]]
10907 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10908 </figcaption></figure>
10909 !! end
10910
10911 !! test
10912 Link with empty target
10913 !! wikitext
10914 [[]]
10915 !! html
10916 <p>[[]]
10917 </p>
10918 !! end
10919
10920 !! test
10921 Image with empty attribute
10922 !! options
10923 parsoid=wt2html,wt2wt,html2html
10924 !! wikitext
10925 [[File:Foobar.jpg|right||Caption text]]
10926 !! html/php
10927 <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>
10928
10929 !! html/parsoid
10930 <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>
10931 !! end
10932
10933 !! test
10934 1. Block image with individual attributes from templates
10935 !! wikitext
10936 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10937 !! html/php
10938 <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"></a></div>This is a caption</div></div></div>
10939
10940 !! html/parsoid
10941 <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>
10942 !! end
10943
10944 !! test
10945 2. Block Image with individual attributes from templates
10946 !! wikitext
10947 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10948 !! html/php
10949 <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"></a></div>This is a caption</div></div></div>
10950
10951 !! html/parsoid
10952 <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>
10953 !! end
10954
10955 !! test
10956 3. Inline image with individual attributes from templates
10957 !! wikitext
10958 [[File:Foobar.jpg|{{echo|50px}}]]
10959 !! html/php
10960 <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>
10961 </p>
10962 !! html/parsoid
10963 <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>
10964 !! end
10965
10966 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10967 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10968 !! test
10969 Image with multiple attributes from the same template
10970 !! wikitext
10971 [[File:Foobar.jpg|{{image_attribs}}]]
10972 !! html/php
10973 <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>
10974
10975 !! html/parsoid
10976 <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>
10977 !! end
10978
10979 # Parsoid's output here is broken (incorrect p-wrapping); see bug 64901.
10980 !! test
10981 Image with link tails
10982 !! options
10983 thumbsize=220
10984 !! wikitext
10985 123[[File:Foobar.jpg]]456
10986 123[[File:Foobar.jpg|right]]456
10987 123[[File:Foobar.jpg|thumb]]456
10988 !! html/php
10989 <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
10990 </p>
10991 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
10992 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"></a></div></div></div></div>456
10993
10994 !! html/php+tidy
10995 <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</p>
10996 <p>123</p>
10997 <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>
10998 <p>456 123</p>
10999 <div class="thumb tright">
11000 <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>
11001 <div class="thumbcaption">
11002 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11003 </div>
11004 </div>
11005 </div>
11006 <p>456</p>
11007 !! html/parsoid
11008 <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>
11009 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
11010 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
11011 !! end
11012
11013 !! test
11014 Image with multiple captions -- only last one is accepted
11015 !! wikitext
11016 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11017 !! html/php
11018 <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>
11019
11020 !! html/parsoid
11021 <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>
11022 !! end
11023
11024 !! test
11025 Image with multiple widths -- use last
11026 !! wikitext
11027 [[File:Foobar.jpg|200px|300px|caption]]
11028 !! html/php
11029 <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>
11030 </p>
11031 !! html/parsoid
11032 <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>
11033 !! end
11034
11035 !! test
11036 Image with multiple alignments -- use first (bug 48664)
11037 !! options
11038 thumbsize=220
11039 !! wikitext
11040 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11041
11042 [[File:Foobar.jpg|middle|text-top|caption]]
11043 !! html/php
11044 <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"></a></div>caption</div></div></div>
11045 <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>
11046 </p>
11047 !! html/parsoid
11048 <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>
11049 <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>
11050 !! end
11051
11052 !! test
11053 Image with width attribute at different positions
11054 !! wikitext
11055 [[File:Foobar.jpg|200px|right|Caption]]
11056 [[File:Foobar.jpg|right|200px|Caption]]
11057 [[File:Foobar.jpg|right|Caption|200px]]
11058 !! html/php
11059 <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>
11060 <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>
11061 <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>
11062
11063 !! html/parsoid
11064 <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>
11065 <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>
11066 <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>
11067 !! end
11068
11069 # a sad bit of backward-compatibility
11070 !! test
11071 Image with size specified with pxpx (bug 13500, 51628)
11072 !! options
11073 parsoid=wt2html,wt2wt,html2html
11074 !! wikitext
11075 [[File:Foobar.jpg|20pxpx]]
11076 [[File:Foobar.jpg|200x20pxpx]]
11077 !! html/php
11078 <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>
11079 <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>
11080 </p>
11081 !! html/parsoid
11082 <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>
11083 !! end
11084
11085 !! test
11086 Image with link parameter, wiki target
11087 !! wikitext
11088 [[File:Foobar.jpg|link=Main Page]]
11089 !! html/php
11090 <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>
11091 </p>
11092 !! html/parsoid
11093 <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>
11094 !! end
11095
11096 # parsoid bug 49293 (part 1)
11097 !! test
11098 Image with link parameter, URL target
11099 !! wikitext
11100 [[File:Foobar.jpg|link=http://example.com/]]
11101 !! html/php
11102 <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>
11103 </p>
11104 !! html/parsoid
11105 <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>
11106 !! end
11107
11108 # parsoid bug 49293 (part 2)
11109 !! test
11110 Image with link parameter, protocol-less URL target
11111 !! wikitext
11112 [[File:Foobar.jpg|link=//example.com/]]
11113 !! html/php
11114 <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>
11115 </p>
11116 !! html/parsoid
11117 <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>
11118 !! end
11119
11120 !! test
11121 Image with link parameter, wgExternalLinkTarget
11122 !! wikitext
11123 [[Image:foobar.jpg|link=http://example.com/]]
11124 !! config
11125 wgExternalLinkTarget='foobar'
11126 !! html
11127 <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>
11128 </p>
11129 !! end
11130
11131 !! test
11132 Image with link parameter, wgNoFollowLinks set to false
11133 !! wikitext
11134 [[Image:foobar.jpg|link=http://example.com/]]
11135 !! config
11136 wgNoFollowLinks=false
11137 !! html
11138 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11139 </p>
11140 !! end
11141
11142 !! test
11143 Image with link parameter, wgNoFollowDomainExceptions
11144 !! wikitext
11145 [[Image:foobar.jpg|link=http://example.com/]]
11146 !! config
11147 wgNoFollowDomainExceptions='example.com'
11148 !! html
11149 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11150 </p>
11151 !! end
11152
11153 !! test
11154 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11155 !! wikitext
11156 [[Image:foobar.jpg|link=http://example.com/|Title]]
11157 !! config
11158 wgExternalLinkTarget='foobar'
11159 !! html
11160 <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>
11161 </p>
11162 !! end
11163
11164 !! test
11165 Image with empty link parameter
11166 !! wikitext
11167 [[File:Foobar.jpg|link=]]
11168 !! html/php
11169 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11170 </p>
11171 !! html/parsoid
11172 <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>
11173 !! end
11174
11175 !! test
11176 Image with link parameter (wiki target) and unnamed parameter
11177 !! wikitext
11178 [[File:Foobar.jpg|link=Main_Page|Title]]
11179 !! html/php
11180 <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>
11181 </p>
11182 !! html/parsoid
11183 <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>
11184 !! end
11185
11186 !! test
11187 Image with link parameter (URL target) and unnamed parameter
11188 !! wikitext
11189 [[File:Foobar.jpg|link=http://example.com/|Title]]
11190 !! html/php
11191 <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>
11192 </p>
11193 !! html/parsoid
11194 <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>
11195 !! end
11196
11197 !! test
11198 Thumbnail image with link parameter
11199 !! options
11200 thumbsize=220
11201 parsoid=wt2html,wt2wt,html2html
11202 !! wikitext
11203 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11204 !! html/php
11205 <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"></a></div>Title</div></div></div>
11206
11207 !! html/parsoid
11208 <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>
11209 !! end
11210
11211 !! test
11212 Manually-specified thumbnail image
11213 !! options
11214 thumbsize=220
11215 !! wikitext
11216 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11217 !! html/php
11218 <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"></a></div>Title</div></div></div>
11219
11220 !! html/parsoid
11221 <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>
11222 !! end
11223
11224 !! test
11225 Manually-specified thumbnail image with explicit link to wiki page
11226 !! options
11227 thumbsize=220
11228 parsoid=wt2html,wt2wt,html2html
11229 !! wikitext
11230 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11231 !! html/php
11232 <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"></a></div>Title</div></div></div>
11233
11234 !! html/parsoid
11235 <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>
11236 !! end
11237
11238 !! test
11239 Manually-specified thumbnail image with explicit link to url
11240 !! options
11241 thumbsize=220
11242 parsoid=wt2html,wt2wt,html2html
11243 !! wikitext
11244 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11245 !! html/php
11246 <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"></a></div>Title</div></div></div>
11247
11248 !! html/parsoid
11249 <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>
11250 !! end
11251
11252 !! test
11253 Manually-specified thumbnail image with explicit no link
11254 !! options
11255 thumbsize=220
11256 parsoid=wt2html,wt2wt,html2html
11257 !! wikitext
11258 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11259 !! html/php
11260 <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"></a></div>Title</div></div></div>
11261
11262 !! html/parsoid
11263 <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>
11264 !! end
11265
11266 !! test
11267 Manually-specified thumbnail image with explicit link and alt text
11268 !! options
11269 thumbsize=220
11270 parsoid=wt2html,wt2wt,html2html
11271 !! wikitext
11272 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11273 !! html/php
11274 <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"></a></div>Title</div></div></div>
11275
11276 !! html/parsoid
11277 <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>
11278 !! end
11279
11280 !! test
11281 Image with frame and link
11282 !! options
11283 parsoid=wt2html,wt2wt,html2html
11284 !! wikitext
11285 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11286 !! html/php
11287 <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>
11288
11289 !! html/parsoid
11290 <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" title="Main Page">Main Page</a></figcaption></figure>
11291 !! end
11292
11293 !! test
11294 Image with frame and link and explicit alt
11295 !! options
11296 parsoid=wt2html,wt2wt,html2html
11297 !! wikitext
11298 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11299 !! html/php
11300 <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>
11301
11302 !! html/parsoid
11303 <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" title="Main Page">Main Page</a></figcaption></figure>
11304 !! end
11305
11306 !! test
11307 Image with wiki markup in implicit alt
11308 !! options
11309 parsoid=wt2html,wt2wt,html2html
11310 !! wikitext
11311 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11312
11313 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11314 !! html/php
11315 <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>
11316 </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>
11317 </p>
11318 !! html/parsoid
11319 <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>
11320 <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>
11321 !! end
11322
11323 ###################
11324 # Conflicting image format options.
11325 # First option specified should 'win'.
11326 # All three cases in each test should be identical.
11327
11328 !! test
11329 Image with 'frameless' first.
11330 !! options
11331 parsoid=wt2html,wt2wt,html2html
11332 !! wikitext
11333 [[File:Foobar.jpg|frameless|caption]]
11334
11335 [[File:Foobar.jpg|frameless|frame|caption]]
11336
11337 [[File:Foobar.jpg|frameless|thumb|caption]]
11338 !! html/php
11339 <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>
11340 </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>
11341 </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>
11342 </p>
11343 !! html/parsoid
11344 <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>
11345 <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>
11346 <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>
11347 !! end
11348
11349 !! test
11350 Image with 'frame' first.
11351 !! options
11352 parsoid=wt2html,wt2wt,html2html
11353 !! wikitext
11354 [[File:Foobar.jpg|frame|caption]]
11355 [[File:Foobar.jpg|frame|frameless|caption]]
11356 [[File:Foobar.jpg|frame|thumb|caption]]
11357 !! html/php
11358 <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>
11359 <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>
11360 <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>
11361
11362 !! html/parsoid
11363 <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>
11364 !! end
11365
11366 !! test
11367 Image with 'thumb' first.
11368 !! options
11369 parsoid=wt2html,wt2wt,html2html
11370 !! wikitext
11371 [[File:Foobar.jpg|thumb|caption]]
11372 [[File:Foobar.jpg|thumb|frameless|caption]]
11373 [[File:Foobar.jpg|thumb|frame|caption]]
11374 !! html/php
11375 <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"></a></div>caption</div></div></div>
11376 <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"></a></div>caption</div></div></div>
11377 <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"></a></div>caption</div></div></div>
11378
11379 !! html/parsoid
11380 <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>
11381 !! end
11382
11383 ###################
11384 # Image sizing.
11385 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11386 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11387 # Foobar has actual size of 1941x220
11388 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11389 # a scalable format.
11390 # 2. Framed images always ignore size options; always render at default size.
11391 # 3. "Unspecified format" and border are the only types which can be
11392 # enlarged.
11393
11394 !! test
11395 Image: "unspecified format" and border enlarge
11396 !! options
11397 parsoid=wt2html,wt2wt,html2html
11398 !! wikitext
11399 [[File:Foobar.jpg|2000px]]
11400
11401 [[File:Foobar.jpg|border|2000px]]
11402 !! html/php
11403 <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>
11404 </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>
11405 </p>
11406 !! html/parsoid
11407 <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>
11408 <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>
11409 !! end
11410
11411 !! test
11412 Image: "unspecified format" and border reduce
11413 !! options
11414 parsoid=wt2html,wt2wt,html2html
11415 !! wikitext
11416 [[File:Foobar.jpg|1000px]]
11417
11418 [[File:Foobar.jpg|border|1000px]]
11419 !! html/php
11420 <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>
11421 </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>
11422 </p>
11423 !! html/parsoid
11424 <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>
11425 <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>
11426 !! end
11427
11428 !! test
11429 Image: thumbs reduce
11430 !! options
11431 parsoid=wt2html,wt2wt,html2html
11432 !! wikitext
11433 [[File:Foobar.jpg|thumb|50px]]
11434 !! html/php
11435 <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"></a></div></div></div></div>
11436
11437 !! html/parsoid
11438 <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>
11439 !! end
11440
11441 !! test
11442 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11443 !! options
11444 parsoid=wt2html,wt2wt,html2html
11445 !! wikitext
11446 [[File:Foobar.jpg|thumb|2000px]]
11447
11448 [[File:Foobar.svg|thumb|2000px]]
11449 !! html/php
11450 <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"></a></div></div></div></div>
11451 <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"></a></div></div></div></div>
11452
11453 !! html/parsoid
11454 <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>
11455 <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>
11456 !! end
11457
11458 !! test
11459 Image: frameless can reduce in size
11460 !! options
11461 parsoid=wt2html,wt2wt,html2html
11462 !! wikitext
11463 [[File:Foobar.jpg|frameless|50px]]
11464 !! html/php
11465 <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>
11466 </p>
11467 !! html/parsoid
11468 <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>
11469 !! end
11470
11471 !! test
11472 Image: bitmap frameless can't be enlarged past original size, but vector can
11473 !! options
11474 parsoid=wt2html,wt2wt,html2html
11475 !! wikitext
11476 [[File:Foobar.jpg|frameless|2000px]]
11477
11478 [[File:Foobar.svg|frameless|2000px]]
11479 !! html/php
11480 <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>
11481 </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>
11482 </p>
11483 !! html/parsoid
11484 <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>
11485 <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>
11486 !! end
11487
11488 !! test
11489 Image: framed images are always unscaled.
11490 !! options
11491 parsoid=wt2html,wt2wt,html2html
11492 !! wikitext
11493 [[File:Foobar.jpg|frame]]
11494
11495 [[File:Foobar.jpg|frame|50px]]
11496
11497 [[File:Foobar.jpg|frame|50x50px]]
11498
11499 [[File:Foobar.jpg|frame|2000px]]
11500 !! html/php
11501 <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>
11502 <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>
11503 <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>
11504 <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>
11505
11506 !! html/parsoid
11507 <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>
11508 !! end
11509
11510 ###################
11511
11512 !! test
11513 Link to image page- image page normally doesn't exists, hence edit link
11514 Add test with existing image page
11515 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11516 !! wikitext
11517 [[:Image:test]]
11518 !! html
11519 <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>
11520 </p>
11521 !! end
11522
11523 !! test
11524 bug 18784 Link to non-existent image page with caption should use caption as link text
11525 !! wikitext
11526 [[:Image:test|caption]]
11527 !! html
11528 <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>
11529 </p>
11530 !! end
11531
11532 !! test
11533 Frameless image caption with a free URL
11534 !! wikitext
11535 [[File:Foobar.jpg|http://example.com]]
11536 !! html/php
11537 <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>
11538 </p>
11539 !! html/parsoid
11540 <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>
11541 !! end
11542
11543 !! test
11544 Thumbnail image caption with a free URL
11545 !! options
11546 thumbsize=220
11547 !! wikitext
11548 [[File:Foobar.jpg|thumb|http://example.com]]
11549 !! html/php
11550 <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"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
11551
11552 !! html/parsoid
11553 <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>
11554 !! end
11555
11556 !! test
11557 Thumbnail image caption with a free URL and explicit alt
11558 !! options
11559 thumbsize=220
11560 parsoid=wt2html,wt2wt,html2html
11561 !! wikitext
11562 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11563 !! html/php
11564 <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"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
11565
11566 !! html/parsoid
11567 <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>
11568 !! end
11569
11570 !! test
11571 SVG thumbnails with no language set
11572 !! options
11573 !! wikitext
11574 [[File:Foobar.svg|thumb|caption]]
11575 !! html/php
11576 <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"></a></div>caption</div></div></div>
11577
11578 !! html/parsoid
11579 <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>
11580 !! end
11581
11582 !! test
11583 SVG thumbnails with language de
11584 !! options
11585 parsoid=wt2html,wt2wt,html2html
11586 !! wikitext
11587 [[File:Foobar.svg|thumb|caption|lang=de]]
11588 !! html/php
11589 <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"></a></div>caption</div></div></div>
11590
11591 !! html/parsoid
11592 <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>
11593 !! end
11594
11595 !! test
11596 SVG thumbnails with invalid language code
11597 !! options
11598 parsoid=wt2html,wt2wt,html2html
11599 !! wikitext
11600 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11601 !! html/php
11602 <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"></a></div>lang=invalid.language.code</div></div></div>
11603
11604 !! html/parsoid
11605 <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>
11606 !! end
11607
11608 !! test
11609 BUG 1887: A ISBN with a thumbnail
11610 !! wikitext
11611 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11612 !! html/php
11613 <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"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
11614
11615 !! html/parsoid
11616 <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>
11617 !! end
11618
11619 !! test
11620 BUG 1887: A RFC with a thumbnail
11621 !! wikitext
11622 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11623 !! html/php
11624 <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"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
11625
11626 !! html/parsoid
11627 <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>
11628 !! end
11629
11630 !! test
11631 BUG 1887: A mailto link with a thumbnail
11632 !! wikitext
11633 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11634 !! html/php
11635 <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"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
11636
11637 !! html/parsoid
11638 <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>
11639 !! end
11640
11641 # Pending resolution to bug 368
11642 !! test
11643 BUG 648: Frameless image caption with a link
11644 !! wikitext
11645 [[File:Foobar.jpg|text with a [[link]] in it]]
11646 !! html/php
11647 <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>
11648 </p>
11649 !! html/parsoid
11650 <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>
11651 !! end
11652
11653 !! test
11654 BUG 648: Frameless image caption with a link (suffix)
11655 !! wikitext
11656 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11657 !! html/php
11658 <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>
11659 </p>
11660 !! html/parsoid
11661 <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>
11662 !! end
11663
11664 !! test
11665 BUG 648: Frameless image caption with an interwiki link
11666 !! wikitext
11667 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11668 !! html/php
11669 <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>
11670 </p>
11671 !! html/parsoid
11672 <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>
11673 !! end
11674
11675 !! test
11676 BUG 648: Frameless image caption with a piped interwiki link
11677 !! wikitext
11678 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11679 !! html/php
11680 <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>
11681 </p>
11682 !! html/parsoid
11683 <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>
11684 !! end
11685
11686 !! test
11687 Escape HTML special chars in image alt text
11688 !! wikitext
11689 [[File:Foobar.jpg|& < > "]]
11690 !! html/php
11691 <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>
11692 </p>
11693 !! html/parsoid
11694 <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>
11695 !! end
11696
11697 !! test
11698 BUG 499: Alt text should have &#1234;, not &amp;1234;
11699 !! wikitext
11700 [[File:Foobar.jpg|&#9792;]]
11701 !! html/php
11702 <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>
11703 </p>
11704 !! html/parsoid
11705 <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>
11706 !! end
11707
11708 !! test
11709 Broken image caption with link
11710 !! options
11711 parsoid=wt2html,wt2wt,html2html
11712 !! wikitext
11713 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11714 !! html/php
11715 <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.
11716 </p>
11717 !! html/parsoid
11718 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
11719 !! end
11720
11721 !! test
11722 Image caption containing another image
11723 !! wikitext
11724 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11725 !! html/php
11726 <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"></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>
11727
11728 !! html/parsoid
11729 <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>
11730 !! end
11731
11732 !! test
11733 Image: caption containing a newline
11734 !! wikitext
11735 [[File:Foobar.jpg|This
11736 *is some text]]
11737 !! html/php
11738 <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>
11739 </p>
11740 !! html/parsoid
11741 <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>
11742 !!end
11743
11744 !!test
11745 Image: caption containing leading space
11746 (The leading space should not trigger nowiki escaping in wt2wt mode)
11747 !! wikitext
11748 [[File:Foobar.jpg|thumb| bar]]
11749 !! html/php
11750 <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"></a></div>bar</div></div></div>
11751
11752 !! html/parsoid
11753 <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>
11754 !!end
11755
11756 !! test
11757 Image: caption containing a table
11758 !! options
11759 parsoid=wt2html,wt2wt,html2html
11760 !! wikitext
11761 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11762 {|
11763 ! Foo !! Bar
11764 |-
11765 | Foo1 || Bar1
11766 |}
11767 and some more text.]]
11768 !! html/php
11769 <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"></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>
11770
11771 !! html/parsoid
11772 <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
11773 <table>
11774 <tbody>
11775 <tr><th>Foo </th><th>Bar</th></tr>
11776 <tr>
11777 <td>Foo1 </td>
11778 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11779 !! end
11780
11781 !! test
11782 Bug 3090: External links other than http: in image captions
11783 !! wikitext
11784 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11785 !! html/php
11786 <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"></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>
11787
11788 !! html/parsoid
11789 <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>
11790 !! end
11791
11792 !! test
11793 Custom class
11794 !! options
11795 parsoid=wt2html,wt2wt,html2html
11796 !! wikitext
11797 [[Image:foobar.jpg|a|class=b]]
11798 !! html/php
11799 <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>
11800 </p>
11801 !! html/parsoid
11802 <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>
11803 !! end
11804
11805 !! test
11806 Localized image handling (1).
11807 !! options
11808 parsoid=wt2html,wt2wt,html2html
11809 language=es
11810 !! wikitext
11811 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11812 !! html/php
11813 <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>
11814
11815 !! html/parsoid
11816 <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>
11817 !! end
11818
11819 !! test
11820 Localized image handling (2).
11821 !! options
11822 thumbsize=220
11823 parsoid=wt2html,wt2wt,html2html
11824 language=es
11825 !! wikitext
11826 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11827 !! html/php
11828 <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"></a></div>caption</div></div></div>
11829
11830 !! html/parsoid
11831 <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>
11832 !! end
11833
11834 !! test
11835 "border", "frameless" and "class" attributes on an image.
11836 !! options
11837 thumbsize=220
11838 parsoid=wt2html,wt2wt,html2html
11839 !! wikitext
11840 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11841 !! html/php
11842 <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>
11843 </p>
11844 !! html/parsoid
11845 <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>
11846 !! end
11847
11848 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11849 !! test
11850 Invalid image attributes (bug 62500)
11851 !! options
11852 thumbsize=220
11853 parsoid=wt2html,wt2wt,html2html
11854 !! wikitext
11855 [[File:Foobar.jpg|thumb|float|left|caption]]
11856
11857 [[File:Foobar.jpg|thumb|righ|caption]]
11858
11859 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11860 !! html/php
11861 <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"></a></div>caption</div></div></div>
11862 <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"></a></div>caption</div></div></div>
11863 <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"></a></div>caption</div></div></div>
11864
11865 !! html/parsoid
11866 <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>
11867 !! end
11868
11869 !! article
11870 File:Barfoo.jpg
11871 !! text
11872 #REDIRECT [[File:Barfoo.jpg]]
11873 !! endarticle
11874
11875 !! test
11876 Redirected image
11877 !! wikitext
11878 [[Image:Barfoo.jpg]]
11879 !! html
11880 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11881 </p>
11882 !! end
11883
11884 !! test
11885 Missing image with uploads disabled
11886 !! options
11887 wgEnableUploads=0
11888 !! wikitext
11889 [[Image:Foobaz.jpg]]
11890 !! html
11891 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11892 </p>
11893 !! end
11894
11895 # Parsoid-specific testing for images
11896 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11897 # Currently imperfect due to a flaw in the Parsoid testrunner
11898 # Work in progress
11899 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11900 # image tests.
11901
11902 !! test
11903 Parsoid-specific image handling - simple image with size and middle alignment
11904 !! wikitext
11905 [[File:Foobar.jpg|middle|50px]]
11906 !! html/parsoid
11907 <p><span class="mw-valign-middle" typeof="mw:Image">
11908 <a href="File:Foobar.jpg">
11909 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11910 </a>
11911 </span>
11912 </p>
11913 !! end
11914
11915 !! test
11916 Parsoid-specific image handling - simple image with size, middle alignment,
11917 non-standard namespace alias
11918 !! options
11919 parsoid=wt2wt,wt2html,html2html
11920 !! wikitext
11921 [[Image:Foobar.jpg|middle|50px]]
11922 !! html/parsoid
11923 <p><span class="mw-valign-middle" typeof="mw:Image">
11924 <a href="File:Foobar.jpg">
11925 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11926 </a>
11927 </span>
11928 </p>
11929 !! end
11930
11931 !! test
11932 Parsoid-specific image handling - simple image with size and middle alignment
11933 (existing content)
11934 !! wikitext
11935 [[File:Foobar.jpg|50px|middle]]
11936 !! html/parsoid
11937 <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>
11938 !! end
11939
11940 !! test
11941 Parsoid-specific image handling - simple image with size and middle alignment
11942 and non-standard namespace name
11943 !! options
11944 parsoid=wt2html,wt2wt,html2html
11945 !! wikitext
11946 [[Image:Foobar.jpg|50px|middle]]
11947 !! html/parsoid
11948 <p><span class="mw-valign-middle" typeof="mw:Image">
11949 <a href="File:Foobar.jpg">
11950 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11951 </a>
11952 </span>
11953 </p>
11954 !! end
11955
11956 !! test
11957 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11958 !! wikitext
11959 [[File:Foobar.jpg|500x10px|baseline|caption]]
11960 !! html/parsoid
11961 <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>
11962 !! end
11963
11964 !! test
11965 Parsoid-specific image handling - simple image with border and size spec
11966 !! wikitext
11967 [[File:Foobar.jpg|50px|border|caption]]
11968 !! html/parsoid
11969 <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>
11970 !! end
11971
11972 !! test
11973 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11974 !! wikitext
11975 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11976 !! html/parsoid
11977 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11978 <a href="File:Foobar.jpg">
11979 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11980 </a>
11981 <figcaption>caption content</figcaption>
11982 </figure>
11983 !! end
11984
11985 !! test
11986 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11987 (existing content)
11988 !! wikitext
11989 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11990 !! html/parsoid
11991 <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>
11992 !! end
11993
11994 !! test
11995 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11996 !! wikitext
11997 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11998 !! html/parsoid
11999 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
12000 <a href="File:Foobar.jpg">
12001 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
12002 </a>
12003 <figcaption>caption</figcaption>
12004 </figure>
12005 !! end
12006
12007 !! test
12008 Parsoid-specific image handling - thumbnail with specific size, halign,
12009 valign, and caption (existing content)
12010 !! wikitext
12011 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12012 !! html/parsoid
12013 <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>
12014 !! end
12015
12016 !! test
12017 Parsoid-specific image handling - framed image with specific size and caption
12018 (size is ignored)
12019 !! options
12020 parsoid=wt2html,wt2wt,html2html
12021 !! wikitext
12022 [[File:Foobar.jpg|frame|500x50px|caption]]
12023 !! html/parsoid
12024 <figure typeof="mw:Image/Frame">
12025 <a href="File:Foobar.jpg">
12026 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
12027 </a>
12028 <figcaption>caption</figcaption>
12029 </figure>
12030 !! end
12031
12032 !! test
12033 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12034 (size is ignored)
12035 !! options
12036 parsoid=wt2html,wt2wt,html2html
12037 !! wikitext
12038 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12039 !! html/parsoid
12040 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
12041 <a href="File:Foobar.jpg">
12042 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
12043 </a>
12044 <figcaption>caption</figcaption>
12045 </figure>
12046 !! end
12047
12048 !! test
12049 Parsoid-specific image handling - frameless image with specific size, border, and caption
12050 !! wikitext
12051 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12052 !! html/parsoid
12053 <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>
12054 !! end
12055
12056 !! test
12057 Parsoid-specific image handling - simple image with a formatted caption
12058 !! wikitext
12059 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12060 !! html/parsoid
12061 <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>"}'>
12062 <a href="File:Foobar.jpg">
12063 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
12064 </a></span></p>
12065 !! end
12066
12067 !! test
12068 Parsoid-specific image handling - caption with a template in it
12069 !! wikitext
12070 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12071 !! html/parsoid
12072 <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>
12073 !! end
12074
12075 !! test
12076 Parsoid-specific image handling - caption with unbalanced tags in it
12077 !! options
12078 parsoid=wt2html,wt2wt,html2html
12079 !! wikitext
12080 foo
12081 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12082 bar
12083 !! html/parsoid
12084 <p>foo</p>
12085 <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>
12086 <p>bar</p>
12087 !! end
12088
12089 !! test
12090 Parsoid-specific image handling - empty caption (1)
12091 !! options
12092 parsoid=wt2html,wt2wt
12093 !! wikitext
12094 [[File:Foobar.jpg|thumb|]]
12095 !! html/parsoid
12096 <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>
12097 !! end
12098
12099 # empty captions don't get serialized unless we're in the "round trip" case
12100 !! test
12101 Parsoid-specific image handling - empty caption (2)
12102 !! options
12103 parsoid=html2wt
12104 !! html/parsoid
12105 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12106 <a href="File:Foobar.jpg">
12107 <img resource="./File:Foobar.jpg"
12108 src="//example.com/images/3/3a/Foobar.jpg"
12109 height="25" width="220"/>
12110 </a>
12111 <figcaption></figcaption>
12112 </figure>
12113 !! wikitext
12114 [[File:Foobar.jpg|thumb]]
12115 !! end
12116
12117 !! test
12118 Parsoid-specific image handling - whitespace caption
12119 !! wikitext
12120 [[File:Foobar.jpg|thumb| ]]
12121 !! html/parsoid
12122 <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>
12123 !! end
12124
12125 !! test
12126 Parsoid-specific image handling - lang option
12127 !! wikitext
12128 foo
12129 [[File:Foobar.svg|lang=de|caption]]
12130 bar
12131 !! html/parsoid
12132 <p>foo
12133 <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>
12134 bar</p>
12135 !! end
12136
12137
12138 ###
12139 ### Subpages
12140 ###
12141 !! article
12142 Subpage test/subpage
12143 !! text
12144 foo
12145 !! endarticle
12146
12147 !! test
12148 Subpage link
12149 !! options
12150 subpage title=[[Subpage test]]
12151 !! wikitext
12152 [[/subpage]]
12153 !! html
12154 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12155 </p>
12156 !! end
12157
12158 !! test
12159 Subpage noslash link
12160 !! options
12161 subpage title=[[Subpage test]]
12162 !! wikitext
12163 [[/subpage/]]
12164 !! html
12165 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12166 </p>
12167 !! end
12168
12169 # TODO: make this PHP-parser compatible!
12170 !! test
12171 Relative subpage noslash link
12172 !! options
12173 parsoid=wt2wt,wt2html,html2html
12174 subpage title=[[Subpage test/1/2/3/4]]
12175 !! wikitext
12176 [[../../subpage/]]
12177
12178 [[../../subpage]]
12179 !! html
12180 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p>
12181 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12182 !! end
12183
12184 !! test
12185 Parsoid: dot-slash prefixed wikilinks
12186 !! wikitext
12187 [[./foo]]
12188
12189 [[././bar]]
12190
12191 [[././baz/]]
12192 !! html/php
12193 <p>[[./foo]]
12194 </p><p>[[././bar]]
12195 </p><p>[[././baz/]]
12196 </p>
12197 !! html/parsoid
12198 <p>[[./foo]]
12199 </p><p>[[././bar]]
12200 </p><p>[[././baz/]]
12201 </p>
12202 !! end
12203
12204 !! test
12205 Render invalid page names as plain text (bug 51090)
12206 !! wikitext
12207 [[./../foo|bar]]
12208 [[foo�|bar]]
12209 [[foo/.|bar]]
12210 [[foo/..|bar]]
12211 [[foo~~~bar]]
12212 [[foo>bar]]
12213 [[foo[bar]]
12214 [[.]]
12215 [[..]]
12216 [[foo././bar]]
12217
12218 [[{{echo|./../foo}}|bar]]
12219 [[{{echo|foo/.}}|bar]]
12220 [[{{echo|foo/..}}|bar]]
12221 [[{{echo|foo~~~~bar}}]]
12222 [[{{echo|foo>bar}}]]
12223 [[{{echo|foo././bar}}]]
12224 [[{{echo|foo{bar}}]]
12225 [[{{echo|foo}bar}}]]
12226 [[{{echo|foo[bar}}]]
12227 [[{{echo|foo]bar}}]]
12228 [[{{echo|foo<bar}}]]
12229 !!html/php
12230 <p>[[./../foo|bar]]
12231 [[foo�|bar]]
12232 [[foo/.|bar]]
12233 [[foo/..|bar]]
12234 [[foo~~~bar]]
12235 [[foo&gt;bar]]
12236 [[foo[bar]]
12237 [[.]]
12238 [[..]]
12239 [[foo././bar]]
12240 </p><p>[[./../foo|bar]]
12241 [[foo/.|bar]]
12242 [[foo/..|bar]]
12243 [[foo~~~~bar]]
12244 [[foo&gt;bar]]
12245 [[foo././bar]]
12246 [[foo{bar]]
12247 [[foo}bar]]
12248 [[foo[bar]]
12249 [[foo]bar]]
12250 [[foo&lt;bar]]
12251 </p>
12252 !!html/parsoid
12253 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
12254 <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>
12255 !!end
12256
12257 !! test
12258 Disabled subpages
12259 !! wikitext
12260 [[/subpage]]
12261 !! html
12262 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12263 </p>
12264 !! end
12265
12266 !! test
12267 BUG 561: {{/Subpage}}
12268 !! options
12269 subpage title=[[Page]]
12270 !! wikitext
12271 {{/Subpage}}
12272 !! html
12273 <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>
12274 </p>
12275 !! end
12276
12277 ###
12278 ### Categories
12279 ###
12280 !! article
12281 Category:MediaWiki User's Guide
12282 !! text
12283 blah
12284 !! endarticle
12285
12286 !! test
12287 Link to category
12288 !! wikitext
12289 [[:Category:MediaWiki User's Guide]]
12290 !! html
12291 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12292 </p>
12293 !! end
12294
12295 !! test
12296 Simple category
12297 !! options
12298 cat
12299 !! wikitext
12300 [[Category:MediaWiki User's Guide]]
12301 !! html
12302 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12303 !! end
12304
12305 !! test
12306 PAGESINCATEGORY invalid title fatal (r33546 fix)
12307 !! wikitext
12308 {{PAGESINCATEGORY:<bogus>}}
12309 !! html
12310 <p>0
12311 </p>
12312 !! end
12313
12314 !! test
12315 Category with different sort key
12316 !! options
12317 cat
12318 !! wikitext
12319 [[Category:MediaWiki User's Guide|Foo]]
12320 !! html
12321 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12322 !! end
12323
12324 !! test
12325 Category with identical sort key
12326 !! options
12327 cat
12328 !! wikitext
12329 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12330 !! html
12331 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12332 !! end
12333
12334 !! test
12335 Category with empty sort key
12336 !! options
12337 cat
12338 pst
12339 !! wikitext
12340 [[Category:MediaWiki User's Guide|]]
12341 !! html
12342 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12343 !! end
12344
12345 !! test
12346 Category with empty sort key and parentheses
12347 !! options
12348 cat
12349 pst
12350 !! wikitext
12351 [[Category:Foo (bar)|]]
12352 !! html
12353 [[Category:Foo (bar)|Foo]]
12354 !! end
12355
12356 !! test
12357 Category with link tail
12358 !! options
12359 cat
12360 pst
12361 !! wikitext
12362 123[[Category:Foo]]456
12363 !! html
12364 123[[Category:Foo]]456
12365 !! end
12366
12367 !! test
12368 Category with template
12369 !! options
12370 cat
12371 pst
12372 !! wikitext
12373 [[Category:{{echo|Foo}}]]
12374 !! html
12375 [[Category:{{echo|Foo}}]]
12376 !! end
12377
12378 !! test
12379 Category with template in sort key
12380 !! options
12381 cat
12382 pst
12383 !! wikitext
12384 [[Category:Foo|{{echo|Bar}}]]
12385 !! html
12386 [[Category:Foo|{{echo|Bar}}]]
12387 !! end
12388
12389 !! test
12390 Category with template in sort key and title
12391 !! options
12392 cat
12393 pst
12394 !! wikitext
12395 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12396 !! html
12397 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12398 !! end
12399
12400 !! test
12401 Category / paragraph interactions
12402 !! wikitext
12403 Foo [[Category:Baz]] Bar
12404
12405 Foo [[Category:Baz]]
12406 Bar
12407
12408 Foo
12409 [[Category:Baz]]
12410 Bar
12411
12412 Foo
12413 [[Category:Baz]] Bar
12414
12415 Foo
12416 [[Category:Baz]]
12417 [[Category:Baz]]
12418 [[Category:Baz]]
12419 Bar
12420
12421 [[Category:Baz]]
12422 [[Category:Baz]]
12423 [[Category:Baz]]
12424
12425 [[Category:Baz]]
12426 {{echo|[[Category:Baz]]}}
12427 [[Category:Baz]]
12428 !! html
12429 <p>Foo Bar
12430 </p><p>Foo
12431 Bar
12432 </p><p>Foo
12433 Bar
12434 </p><p>Foo Bar
12435 </p><p>Foo
12436 Bar
12437 </p>
12438 !! end
12439
12440 !! test
12441 Parsoid: Serialize link to category page with colon escape
12442 !! options
12443 parsoid
12444 !! wikitext
12445
12446 [[:Category:Foo]]
12447 [[:Category:Foo|Bar]]
12448 !! html
12449 <p>
12450 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12451 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12452 </p>
12453 !! end
12454
12455 !! test
12456 Parsoid: Link prefix/suffixes aren't applied to category links
12457 !! options
12458 parsoid=wt2html,wt2wt,html2html
12459 language=is
12460 !! wikitext
12461 x[[Category:Foo]]y
12462 !! html
12463 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12464 !! end
12465
12466 !! test
12467 Parsoid: Serialize link to file page with colon escape
12468 !! options
12469 parsoid
12470 !! wikitext
12471
12472 [[:File:Foo.png]]
12473 [[:File:Foo.png|Bar]]
12474 !! html
12475 <p>
12476 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12477 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12478 </p>
12479 !! end
12480
12481 !! test
12482 Parsoid: Serialize a genuine category link without colon escape
12483 !! options
12484 parsoid
12485 !! wikitext
12486 [[Category:Foo]]
12487 [[Category:Foo|Bar]]
12488 !! html
12489 <link rel="mw:PageProp/Category" href="Category:Foo">
12490 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12491 !! end
12492
12493 !! test
12494 Parsoid: Defaultsort
12495 !! options
12496 parsoid
12497 !! wikitext
12498 {{DEFAULTSORT:Foo}}
12499 !! html
12500 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12501 !! end
12502
12503 ###
12504 ### Inter-language links
12505 ###
12506 !! test
12507 Interlanguage links
12508 !! options
12509 ill
12510 !! wikitext
12511 [[es:Alimento]]
12512 [[fr:Nourriture]]
12513 [[zh:食品]]
12514 !! html/php
12515 es:Alimento fr:Nourriture zh:食品
12516 !! html/parsoid
12517 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/>
12518 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/>
12519 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p>
12520 !! end
12521
12522 !! test
12523 Duplicate interlanguage links (bug 24502)
12524 !! options
12525 ill
12526 !! wikitext
12527 [[es:1]]
12528 [[es:2]]
12529 [[fr:1]]
12530 [[fr:2]]
12531 !! html/php
12532 es:1 fr:1
12533 !! html/parsoid
12534 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/>
12535 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/>
12536 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/>
12537 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p>
12538 !! end
12539
12540 ###
12541 ### Sections
12542 ###
12543 !! test
12544 Basic section headings
12545 !! wikitext
12546 == Headline 1 ==
12547 Some text
12548
12549 ==Headline 2==
12550 More
12551 ===Smaller headline===
12552 Blah blah
12553 !! html
12554 <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>
12555 <p>Some text
12556 </p>
12557 <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>
12558 <p>More
12559 </p>
12560 <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>
12561 <p>Blah blah
12562 </p>
12563 !! end
12564
12565 !! test
12566 Section headings with TOC
12567 !! wikitext
12568 == Headline 1 ==
12569 === Subheadline 1 ===
12570 ===== Skipping a level =====
12571 ====== Skipping a level ======
12572
12573 == Headline 2 ==
12574 Some text
12575 ===Another headline===
12576 !! html
12577 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12578 <ul>
12579 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12580 <ul>
12581 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12582 <ul>
12583 <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>
12584 <ul>
12585 <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>
12586 </ul>
12587 </li>
12588 </ul>
12589 </li>
12590 </ul>
12591 </li>
12592 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12593 <ul>
12594 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12595 </ul>
12596 </li>
12597 </ul>
12598 </div>
12599
12600 <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>
12601 <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>
12602 <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>
12603 <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>
12604 <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>
12605 <p>Some text
12606 </p>
12607 <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>
12608
12609 !! end
12610
12611 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12612 !! test
12613 Handling of sections up to level 6 and beyond
12614 !! wikitext
12615 = Level 1 Heading=
12616 == Level 2 Heading==
12617 === Level 3 Heading===
12618 ==== Level 4 Heading====
12619 ===== Level 5 Heading=====
12620 ====== Level 6 Heading======
12621 ======= Level 7 Heading=======
12622 ======== Level 8 Heading========
12623 ========= Level 9 Heading=========
12624 ========== Level 10 Heading==========
12625 !! html
12626 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12627 <ul>
12628 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12629 <ul>
12630 <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>
12631 <ul>
12632 <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>
12633 <ul>
12634 <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>
12635 <ul>
12636 <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>
12637 <ul>
12638 <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>
12639 <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>
12640 <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>
12641 <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>
12642 <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>
12643 </ul>
12644 </li>
12645 </ul>
12646 </li>
12647 </ul>
12648 </li>
12649 </ul>
12650 </li>
12651 </ul>
12652 </li>
12653 </ul>
12654 </div>
12655
12656 <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>
12657 <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>
12658 <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>
12659 <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>
12660 <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>
12661 <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>
12662 <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>
12663 <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>
12664 <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>
12665 <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>
12666
12667 !! end
12668
12669 !! test
12670 TOC regression (bug 9764)
12671 !! wikitext
12672 == title 1 ==
12673 === title 1.1 ===
12674 ==== title 1.1.1 ====
12675 === title 1.2 ===
12676 == title 2 ==
12677 === title 2.1 ===
12678 !! html
12679 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12680 <ul>
12681 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12682 <ul>
12683 <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>
12684 <ul>
12685 <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>
12686 </ul>
12687 </li>
12688 <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>
12689 </ul>
12690 </li>
12691 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12692 <ul>
12693 <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>
12694 </ul>
12695 </li>
12696 </ul>
12697 </div>
12698
12699 <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>
12700 <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>
12701 <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>
12702 <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>
12703 <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>
12704 <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>
12705
12706 !! end
12707
12708 !! test
12709 TOC with wgMaxTocLevel=3 (bug 6204)
12710 !! options
12711 wgMaxTocLevel=3
12712 !! wikitext
12713 == title 1 ==
12714 === title 1.1 ===
12715 ==== title 1.1.1 ====
12716 === title 1.2 ===
12717 == title 2 ==
12718 === title 2.1 ===
12719 !! html
12720 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12721 <ul>
12722 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12723 <ul>
12724 <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>
12725 <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>
12726 </ul>
12727 </li>
12728 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12729 <ul>
12730 <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>
12731 </ul>
12732 </li>
12733 </ul>
12734 </div>
12735
12736 <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>
12737 <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>
12738 <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>
12739 <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>
12740 <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>
12741 <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>
12742
12743 !! end
12744
12745 !! test
12746 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12747 !! options
12748 wgMaxTocLevel=3
12749 !! wikitext
12750 ==Section 1==
12751 ===Section 1.1===
12752 ====Section 1.1.1====
12753 ====Section 1.1.1.1====
12754 ==Section 2==
12755 !! html
12756 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12757 <ul>
12758 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12759 <ul>
12760 <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>
12761 </ul>
12762 </li>
12763 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12764 </ul>
12765 </div>
12766
12767 <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>
12768 <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>
12769 <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>
12770 <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>
12771 <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>
12772
12773 !! end
12774
12775
12776 !! test
12777 Resolving duplicate section names
12778 !! wikitext
12779 == Foo bar ==
12780 == Foo bar ==
12781 !! html
12782 <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>
12783 <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>
12784
12785 !! end
12786
12787 !! test
12788 Resolving duplicate section names with differing case (bug 10721)
12789 !! wikitext
12790 == Foo bar ==
12791 == Foo Bar ==
12792 !! html
12793 <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>
12794 <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>
12795
12796 !! end
12797
12798 !! article
12799 Template:sections
12800 !! text
12801 ===Section 1===
12802 ==Section 2==
12803 !! endarticle
12804
12805 !! test
12806 Template with sections, __NOTOC__
12807 !! wikitext
12808 __NOTOC__
12809 ==Section 0==
12810 {{sections}}
12811 ==Section 4==
12812 !! html
12813 <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>
12814 <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>
12815 <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>
12816 <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>
12817
12818 !! end
12819
12820 !! test
12821 __NOEDITSECTION__ keyword
12822 !! wikitext
12823 __NOEDITSECTION__
12824 ==Section 1==
12825 ==Section 2==
12826 !! html
12827 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12828 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12829
12830 !! end
12831
12832 !! test
12833 Link inside a section heading
12834 !! wikitext
12835 ==Section with a [[Main Page|link]] in it==
12836 !! html
12837 <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>
12838
12839 !! end
12840
12841 !! test
12842 TOC regression (bug 12077)
12843 !! wikitext
12844 __TOC__
12845 == title 1 ==
12846 === title 1.1 ===
12847 == title 2 ==
12848 !! html
12849 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12850 <ul>
12851 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12852 <ul>
12853 <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>
12854 </ul>
12855 </li>
12856 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12857 </ul>
12858 </div>
12859
12860 <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>
12861 <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>
12862 <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>
12863
12864 !! end
12865
12866 !! test
12867 BUG 1219 URL next to image (good)
12868 !! wikitext
12869 http://example.com [[Image:foobar.jpg]]
12870 !! html
12871 <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>
12872 </p>
12873 !!end
12874
12875 !! test
12876 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12877 !! wikitext
12878 ===
12879 The line above must have a trailing space!
12880 === <!--
12881 --> <!-- -->
12882 But just in case it doesn't...
12883 !! html
12884 <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>
12885 <p>The line above must have a trailing space!
12886 </p>
12887 <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>
12888 <p>But just in case it doesn't...
12889 </p>
12890 !! end
12891
12892 !! test
12893 Header with special characters (bug 25462)
12894 !! wikitext
12895 The tooltips shall not show entities to the user (ie. be double escaped)
12896
12897 == text > text ==
12898 section 1
12899
12900 == text < text ==
12901 section 2
12902
12903 == text & text ==
12904 section 3
12905
12906 == text ' text ==
12907 section 4
12908
12909 == text " text ==
12910 section 5
12911 !! html
12912 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12913 </p>
12914 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12915 <ul>
12916 <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>
12917 <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>
12918 <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>
12919 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12920 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12921 </ul>
12922 </div>
12923
12924 <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>
12925 <p>section 1
12926 </p>
12927 <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>
12928 <p>section 2
12929 </p>
12930 <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>
12931 <p>section 3
12932 </p>
12933 <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>
12934 <p>section 4
12935 </p>
12936 <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>
12937 <p>section 5
12938 </p>
12939 !! end
12940
12941 !! test
12942 Header with space, plus and underscore as entity
12943 !! wikitext
12944 Id should not contain + for spaces
12945
12946 == Space between Text ==
12947 section 1
12948
12949 == Space-Entity&#32;between&#32;Text ==
12950 section 2
12951
12952 == Plus+between+Text ==
12953 section 3
12954
12955 == Plus-Entity&#43;between&#43;Text ==
12956 section 4
12957
12958 == Underscore_between_Text ==
12959 section 5
12960
12961 == Underscore-Entity&#95;between&#95;Text ==
12962 section 6
12963
12964 [[#Space between Text]]
12965 [[#Space-Entity&#32;between&#32;Text]]
12966 [[#Plus+between+Text]]
12967 [[#Plus-Entity&#43;between&#43;Text]]
12968 [[#Underscore_between_Text]]
12969 [[#Underscore-Entity&#95;between&#95;Text]]
12970 !! html
12971 <p>Id should not contain + for spaces
12972 </p>
12973 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12974 <ul>
12975 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
12976 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
12977 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
12978 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
12979 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
12980 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
12981 </ul>
12982 </div>
12983
12984 <h2><span class="mw-headline" id="Space_between_Text">Space between 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: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12985 <p>section 1
12986 </p>
12987 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;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: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12988 <p>section 2
12989 </p>
12990 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+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: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12991 <p>section 3
12992 </p>
12993 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;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: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12994 <p>section 4
12995 </p>
12996 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_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: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12997 <p>section 5
12998 </p>
12999 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</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: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13000 <p>section 6
13001 </p><p><a href="#Space_between_Text">#Space between Text</a>
13002 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13003 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13004 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13005 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13006 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13007 </p>
13008 !! end
13009
13010 !! test
13011 Headers with excess '=' characters
13012 (Are similar tests necessary beyond the 1st level?)
13013 !! wikitext
13014 =foo==
13015 ==foo=
13016 =''italic'' heading==
13017 ==''italic'' heading=
13018 !! html
13019 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13020 <ul>
13021 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13022 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13023 <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>
13024 <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>
13025 </ul>
13026 </div>
13027
13028 <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>
13029 <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>
13030 <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>
13031 <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>
13032
13033 !! end
13034
13035 !! test
13036 HTML headers vs TOC (bug 23393)
13037 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13038 !! wikitext
13039 <h1>Header 1</h1>
13040 == Header 1.1 ==
13041 == Header 1.2 ==
13042
13043 <h1>Header 2
13044 </h1>
13045 == Header 2.1 ==
13046 == Header 2.2 ==
13047 __NOEDITSECTION__
13048 !! html
13049 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13050 <ul>
13051 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13052 <ul>
13053 <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>
13054 <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>
13055 </ul>
13056 </li>
13057 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13058 <ul>
13059 <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>
13060 <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>
13061 </ul>
13062 </li>
13063 </ul>
13064 </div>
13065
13066 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13067 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13068 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13069 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13070 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13071 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13072
13073 !! end
13074
13075 !! test
13076 Single-line or multiline-comments can follow headings
13077 !! options
13078 parsoid=wt2html,wt2wt
13079 !! wikitext
13080 ==foo==<!---->
13081 ==bar==<!--c1-->
13082 ==baz==<!--
13083 c2
13084 c3-->
13085 !! html
13086 <h2><span class="mw-headline" id="foo">foo</span></h2>
13087 <h2><span class="mw-headline" id="bar">bar</span></h2>
13088 <h2><span class="mw-headline" id="baz">baz</span></h2>
13089
13090 !! end
13091
13092 !! test
13093 BUG 1219 URL next to image (broken)
13094 !! wikitext
13095 http://example.com[[Image:foobar.jpg]]
13096 !! html
13097 <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>
13098 </p>
13099 !!end
13100
13101 !! test
13102 Bug 1186 news: in the middle of text
13103 !! wikitext
13104 http://en.wikinews.org/wiki/Wikinews:Workplace
13105 !! html
13106 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13107 </p>
13108 !!end
13109
13110
13111 !! test
13112 Namespaced link must have a title
13113 !! wikitext
13114 [[Project:]]
13115 !! html
13116 <p>[[Project:]]
13117 </p>
13118 !!end
13119
13120 !! test
13121 Namespaced link must have a title (bad fragment version)
13122 !! wikitext
13123 [[Project:#fragment]]
13124 !! html
13125 <p>[[Project:#fragment]]
13126 </p>
13127 !!end
13128
13129
13130 ###
13131 ### HTML tags and HTML attributes
13132 ###
13133
13134 !! test
13135 div with no attributes
13136 !! wikitext
13137 <div>HTML rocks</div>
13138 !! html
13139 <div>HTML rocks</div>
13140
13141 !! end
13142
13143 !! test
13144 div with double-quoted attribute
13145 !! wikitext
13146 <div id="rock">HTML rocks</div>
13147 !! html
13148 <div id="rock">HTML rocks</div>
13149
13150 !! end
13151
13152 !! test
13153 div with single-quoted attribute
13154 !! wikitext
13155 <div id='rock'>HTML rocks</div>
13156 !! html
13157 <div id="rock">HTML rocks</div>
13158
13159 !! end
13160
13161 !! test
13162 div with unquoted attribute
13163 !! wikitext
13164 <div id=rock>HTML rocks</div>
13165 !! html
13166 <div id="rock">HTML rocks</div>
13167
13168 !! end
13169
13170 !! test
13171 div with illegal double attributes
13172 !! wikitext
13173 <div id="a" id="b">HTML rocks</div>
13174 !! html
13175 <div id="b">HTML rocks</div>
13176
13177 !!end
13178
13179 # FIXME: produce empty string instead of "class" in the PHP parser, following
13180 # the HTML5 spec.
13181 !! test
13182 div with empty attribute value, space before equals
13183 !! options
13184 parsoid
13185 !! wikitext
13186 <div class =>HTML rocks</div>
13187 !! html
13188 <div class="">HTML rocks</div>
13189
13190 !! end
13191
13192 !! test
13193 div with multiple empty attribute values
13194 !! options
13195 parsoid
13196 !! wikitext
13197 <div id= title=>HTML rocks</div>
13198 !! html
13199 <div id="" title="">HTML rocks</div>
13200
13201 !! end
13202
13203 !! test
13204 table with multiple empty attribute values
13205 !! options
13206 parsoid
13207 !! wikitext
13208 {| title= id=
13209 | hi
13210 |}
13211 !! html
13212 <table title="" id="">
13213 <tbody><tr><td> hi</td></tr>
13214 </tbody></table>
13215 !! end
13216
13217 # The PHP parser escapes the opening brace to &#123; for some reason, so
13218 # disabled this test for it.
13219 !! test
13220 div with braces in attribute value
13221 !! options
13222 parsoid
13223 !! wikitext
13224 <div title="{}">Foo</div>
13225 !! html
13226 <div title="{}">Foo</div>
13227 !! end
13228
13229 # This it very inconsistent in the PHP parser: it returns
13230 # class="class" if there is a space between the name and the equal sign (see
13231 # 'div with empty attribute value, space before equals'), but strips the
13232 # attribute completely if the space is missing. We hope that not much content
13233 # depends on this, so are implementing the behavior below in Parsoid for
13234 # consistencies' sake. Disabled for the PHP parser.
13235 # FIXME: fix this behavior in the PHP parser?
13236 !! test
13237 div with empty attribute value, no space before equals
13238 !! options
13239 parsoid
13240 !! wikitext
13241 <div class=>HTML rocks</div>
13242 !! html
13243 <div class="">HTML rocks</div>
13244
13245 !! end
13246
13247 !! test
13248 HTML multiple attributes correction
13249 !! wikitext
13250 <p class="error" class="awesome">Awesome!</p>
13251 !! html
13252 <p class="awesome">Awesome!</p>
13253
13254 !!end
13255
13256 !! test
13257 Table multiple attributes correction
13258 !! wikitext
13259 {|
13260 !+ class="error" class="awesome"| status
13261 |}
13262 !! html
13263 <table>
13264 <tr>
13265 <th class="awesome"> status
13266 </th></tr></table>
13267
13268 !!end
13269
13270 !! test
13271 DIV IN UPPERCASE
13272 !! wikitext
13273 <DIV ID="x">HTML ROCKS</DIV>
13274 !! html
13275 <div id="x">HTML ROCKS</div>
13276
13277 !!end
13278
13279 !! test
13280 Non-ASCII pseudo-tags are rendered as text
13281 !! wikitext
13282 <khyô>
13283 !! html
13284 <p>&lt;khyô&gt;
13285 </p>
13286 !! end
13287
13288 !! test
13289 Pseudo-tag with URL 'name' renders as url link
13290 !! wikitext
13291 <http://example.com/>
13292 !! html
13293 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13294 </p>
13295 !! end
13296
13297 !! test
13298 text with amp in the middle of nowhere
13299 !! wikitext
13300 Remember AT&T?
13301 !! html
13302 <p>Remember AT&amp;T?
13303 </p>
13304 !! end
13305
13306 !! test
13307 text with character entity: eacute
13308 !! wikitext
13309 I always thought &eacute; was a cute letter.
13310 !! html
13311 <p>I always thought &#233; was a cute letter.
13312 </p>
13313 !! html+tidy
13314 <p>I always thought é was a cute letter.</p>
13315 !! end
13316
13317 !! test
13318 text with entity-escaped character entity-like string: eacute
13319 !! wikitext
13320 I always thought &amp;eacute; was a cute letter.
13321 !! html
13322 <p>I always thought &amp;eacute; was a cute letter.
13323 </p>
13324 !! end
13325
13326 !! test
13327 text with undefined character entity: xacute
13328 !! wikitext
13329 I always thought &xacute; was a cute letter.
13330 !! html
13331 <p>I always thought &amp;xacute; was a cute letter.
13332 </p>
13333 !! end
13334
13335 # TODO: generalize to PHP parser?
13336 !! test
13337 HTML5 tags
13338 !! options
13339 parsoid
13340 !! wikitext
13341 <data value="5">five</data>
13342 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13343 <mark>This highlighted text</mark>
13344 !! html
13345 <p><data value="5">five</data>
13346 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13347 <mark>This highlighted text</mark></p>
13348 !! end
13349
13350 !! test
13351 HTML tag with leading space is parsed as text
13352 !! wikitext
13353 < div>foo< /div>
13354 !! html
13355 <p>&lt; div&gt;foo&lt; /div&gt;
13356 </p>
13357 !! end
13358
13359 ###
13360 ### Nesting tests (see bug 41545, 50604, 51081)
13361 ###
13362
13363 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13364 # Note that html2wt is considerably more difficult if we use <b> in
13365 # the test case, instead of <big>
13366 !! test
13367 Ensure that HTML adoption agency algorithm is properly implemented.
13368 !! wikitext
13369 <big>X<big>Y</big>Z</big>
13370 !! html
13371 <p><big>X<big>Y</big>Z</big>
13372 </p>
13373 !! end
13374
13375 # This was bug 41545 in the PHP parser.
13376 # Note that tidy doesn't handle this correctly.
13377 !! test
13378 Nesting of <kbd>
13379 !! wikitext
13380 <kbd>X<kbd>Y</kbd>Z</kbd>
13381 !! html
13382 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13383 </p>
13384 !! end
13385
13386 # The following cases were bug 51081 in the PHP parser.
13387 # Note that there are some other nestable tags (b, i, etc) which are
13388 # not covered; see bug 51081 for discussion.
13389
13390 # Note that tidy doesn't handle this correctly.
13391 !! test
13392 Nesting of <em>
13393 !! wikitext
13394 <em>X<em>Y</em>Z</em>
13395 !! html
13396 <p><em>X<em>Y</em>Z</em>
13397 </p>
13398 !! end
13399
13400 # Note that tidy doesn't handle this correctly.
13401 !! test
13402 Nesting of <strong>
13403 !! wikitext
13404 <strong>X<strong>Y</strong>Z</strong>
13405 !! html
13406 <p><strong>X<strong>Y</strong>Z</strong>
13407 </p>
13408 !! end
13409
13410 !! test
13411 Nesting of <q>
13412 !! wikitext
13413 <q>X<q>Y</q>Z</q>
13414 !! html+tidy
13415 <p><q>X<q>Y</q>Z</q></p>
13416 !! end
13417
13418 # Note that tidy doesn't handle this correctly.
13419 !! test
13420 Nesting of <ruby>
13421 !! wikitext
13422 <ruby>X<ruby>Y</ruby>Z</ruby>
13423 !! html
13424 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13425 </p>
13426 !! end
13427
13428 # Note that tidy doesn't handle this correctly.
13429 !! test
13430 Nesting of <bdo>
13431 !! wikitext
13432 <bdo>X<bdo>Y</bdo>Z</bdo>
13433 !! html
13434 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13435 </p>
13436 !! end
13437
13438
13439 ###
13440 ### Media links
13441 ###
13442
13443 !! test
13444 Media link
13445 !! wikitext
13446 [[Media:Foobar.jpg]]
13447 !! html
13448 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13449 </p>
13450 !! end
13451
13452 !! test
13453 Media link with text
13454 !! wikitext
13455 [[Media:Foobar.jpg|A neat file to look at]]
13456 !! html
13457 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13458 </p>
13459 !! end
13460
13461 # FIXME: this is still bad HTML tag nesting
13462 !! test
13463 Media link with nasty text
13464 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13465 !! wikitext
13466 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13467 !! html
13468 <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>
13469
13470 !! html+tidy
13471 <p><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></p>
13472 !! end
13473
13474 !! test
13475 Media link to nonexistent file (bug 1702)
13476 !! wikitext
13477 [[Media:No such.jpg]]
13478 !! html
13479 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13480 </p>
13481 !! end
13482
13483 !! test
13484 Image link to nonexistent file (bug 1850 - good)
13485 !! wikitext
13486 [[Image:No such.jpg]]
13487 !! html
13488 <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>
13489 </p>
13490 !! end
13491
13492 !! test
13493 :Image link to nonexistent file (bug 1850 - bad)
13494 !! wikitext
13495 [[:Image:No such.jpg]]
13496 !! html
13497 <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>
13498 </p>
13499 !! end
13500
13501
13502
13503 !! test
13504 Character reference normalization in link text (bug 1938)
13505 !! wikitext
13506 [[Main Page|this&that]]
13507 !! html
13508 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13509 </p>
13510 !!end
13511
13512 !! article
13513 אַ
13514 !! text
13515 Test for unicode normalization
13516
13517 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13518 !! endarticle
13519
13520 !! test
13521 (bug 19451) Links should refer to the normalized form.
13522 !! wikitext
13523 [[&#xFB2E;]]
13524 [[&#x5d0;&#x5b7;]]
13525 [[&#x5d0;ַ]]
13526 [[א&#x5b7;]]
13527 [[אַ]]
13528 !! html
13529 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13530 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13531 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13532 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13533 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13534 </p>
13535 !! end
13536
13537 !! test
13538 Empty attribute crash test (bug 2067)
13539 !! wikitext
13540 <font color="">foo</font>
13541 !! html
13542 <p><font color="">foo</font>
13543 </p>
13544 !! end
13545
13546 !! test
13547 Empty attribute crash test single-quotes (bug 2067)
13548 !! wikitext
13549 <font color=''>foo</font>
13550 !! html
13551 <p><font color="">foo</font>
13552 </p>
13553 !! end
13554
13555 !! test
13556 Attribute test: equals, then nothing
13557 !! wikitext
13558 <font color=>foo</font>
13559 !! html
13560 <p><font>foo</font>
13561 </p>
13562 !! end
13563
13564 !! test
13565 Attribute test: unquoted value
13566 !! wikitext
13567 <font color=x>foo</font>
13568 !! html
13569 <p><font color="x">foo</font>
13570 </p>
13571 !! end
13572
13573 !! test
13574 Attribute test: unquoted but illegal value (hash)
13575 !! wikitext
13576 <font color=#x>foo</font>
13577 !! html
13578 <p><font color="#x">foo</font>
13579 </p>
13580 !! end
13581
13582 !! test
13583 Attribute test: no value
13584 !! wikitext
13585 <font color>foo</font>
13586 !! html
13587 <p><font color="color">foo</font>
13588 </p>
13589 !! end
13590
13591 !! test
13592 Bug 2095: link with three closing brackets
13593 !! wikitext
13594 [[Main Page]]]
13595 !! html/php
13596 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13597 </p>
13598 !! html/parsoid
13599 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13600 !! end
13601
13602 !! test
13603 Bug 2095: link with pipe and three closing brackets
13604 !! wikitext
13605 [[Main Page|link]]]
13606 !! html/php
13607 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13608 </p>
13609 !! html/parsoid
13610 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13611 !! end
13612
13613 !! test
13614 Bug 2095: link with pipe and three closing brackets, version 2
13615 !! wikitext
13616 [[Main Page|[http://example.com/]]]
13617 !! html/php
13618 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13619 </p>
13620 !! html/parsoid
13621 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13622 !! end
13623
13624
13625 ###
13626 ### Safety
13627 ###
13628
13629 !! article
13630 Template:Dangerous attribute
13631 !! text
13632 " onmouseover="alert(document.cookie)
13633 !! endarticle
13634
13635 !! article
13636 Template:Dangerous style attribute
13637 !! text
13638 border-size: expression(alert(document.cookie))
13639 !! endarticle
13640
13641 !! article
13642 Template:Div style
13643 !! text
13644 <div style="float: right; {{{1}}}">Magic div</div>
13645 !! endarticle
13646
13647 !! test
13648 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13649 !! wikitext
13650 <div title="{{test}}"></div>
13651 !! html
13652 <div title="This is a test template"></div>
13653
13654 !! end
13655
13656 # Parsoid has enough context to handle this case
13657 !! test
13658 Bug 2304: HTML attribute safety (dangerous template; 2309)
13659 !! wikitext
13660 <div title="{{dangerous attribute}}"></div>
13661 !! html/php
13662 <div title=""></div>
13663
13664 !! html/parsoid
13665 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"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;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}' data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}'></div>
13666 !! end
13667
13668 !! test
13669 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13670 !! wikitext
13671 <div style="{{dangerous style attribute}}"></div>
13672 !! html
13673 <div style="/* insecure input */"></div>
13674
13675 !! end
13676
13677 !! test
13678 Bug 2304: HTML attribute safety (safe parameter; 2309)
13679 !! wikitext
13680 {{div style|width: 200px}}
13681 !! html
13682 <div style="float: right; width: 200px">Magic div</div>
13683
13684 !! end
13685
13686 !! test
13687 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13688 !! wikitext
13689 {{div style|width: expression(alert(document.cookie))}}
13690 !! html
13691 <div style="/* insecure input */">Magic div</div>
13692
13693 !! end
13694
13695 !! test
13696 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13697 !! wikitext
13698 {{div style|"><script>alert(document.cookie)</script>}}
13699 !! html
13700 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13701
13702 !! end
13703
13704 !! test
13705 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13706 !! wikitext
13707 {{div style|" ><script>alert(document.cookie)</script>}}
13708 !! html
13709 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13710
13711 !! end
13712
13713 !! test
13714 Bug 2304: HTML attribute safety (link)
13715 !! wikitext
13716 <div title="[[Main Page]]"></div>
13717 !! html
13718 <div title="&#91;&#91;Main Page]]"></div>
13719
13720 !! end
13721
13722 !! test
13723 Bug 2304: HTML attribute safety (italics)
13724 !! wikitext
13725 <div title="''foobar''"></div>
13726 !! html
13727 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13728
13729 !! end
13730
13731 !! test
13732 Bug 2304: HTML attribute safety (bold)
13733 !! wikitext
13734 <div title="'''foobar'''"></div>
13735 !! html
13736 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13737
13738 !! end
13739
13740
13741 !! test
13742 Bug 2304: HTML attribute safety (ISBN)
13743 !! wikitext
13744 <div title="ISBN 1234567890"></div>
13745 !! html
13746 <div title="&#73;SBN 1234567890"></div>
13747
13748 !! end
13749
13750 !! test
13751 Bug 2304: HTML attribute safety (RFC)
13752 !! wikitext
13753 <div title="RFC 1234"></div>
13754 !! html
13755 <div title="&#82;FC 1234"></div>
13756
13757 !! end
13758
13759 !! test
13760 Bug 2304: HTML attribute safety (PMID)
13761 !! wikitext
13762 <div title="PMID 1234567890"></div>
13763 !! html
13764 <div title="&#80;MID 1234567890"></div>
13765
13766 !! end
13767
13768 !! test
13769 Bug 2304: HTML attribute safety (web link)
13770 !! wikitext
13771 <div title="http://example.com/"></div>
13772 !! html
13773 <div title="http&#58;//example.com/"></div>
13774
13775 !! end
13776
13777 !! test
13778 Bug 2304: HTML attribute safety (named web link)
13779 !! wikitext
13780 <div title="[http://example.com/ link]"></div>
13781 !! html
13782 <div title="&#91;http&#58;//example.com/ link]"></div>
13783
13784 !! end
13785
13786 !! test
13787 Bug 3244: HTML attribute safety (extension; safe)
13788 !! wikitext
13789 <div style="<nowiki>background:blue</nowiki>"></div>
13790 !! html
13791 <div style="background:blue"></div>
13792
13793 !! end
13794
13795 !! test
13796 Bug 3244: HTML attribute safety (extension; unsafe)
13797 !! wikitext
13798 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13799 !! html
13800 <div style="/* insecure input */"></div>
13801
13802 !! end
13803
13804 # More MSIE fun discovered by Tom Gilder
13805
13806 !! test
13807 MSIE CSS safety test: spurious slash
13808 !! wikitext
13809 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13810 !! html
13811 <div style="/* insecure input */">evil</div>
13812
13813 !! end
13814
13815 !! test
13816 MSIE CSS safety test: hex code
13817 !! wikitext
13818 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13819 !! html
13820 <div style="/* insecure input */">evil</div>
13821
13822 !! end
13823
13824 !! test
13825 MSIE CSS safety test: comment in url
13826 !! wikitext
13827 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13828 !! html
13829 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13830
13831 !! end
13832
13833 !! test
13834 MSIE CSS safety test: comment in expression
13835 !! wikitext
13836 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13837 !! html
13838 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13839
13840 !! end
13841
13842 !! test
13843 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13844 !! wikitext
13845 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13846 !! html
13847 <p style="/* invalid control char */">A</p>
13848
13849 !! end
13850
13851 !! test
13852 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13853 !! wikitext
13854 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13855 <div style="top:EXPRESSION(alert())">B</div>
13856 !! html
13857 <p style="/* insecure input */">A</p>
13858 <div style="/* insecure input */">B</div>
13859
13860 !! end
13861
13862 !! test
13863 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13864 !! wikitext
13865 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13866 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13867 !! html
13868 <div style="/* insecure input */">A</div>
13869 <p style="/* insecure input */">B</p>
13870
13871 !! end
13872
13873 !! test
13874 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13875 !! wikitext
13876 <div style="background-image:url⁽javascript:alert())">A</div>
13877 <div style="background-image:url₍javascript:alert())">B</div>
13878 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13879 !! html
13880 <div style="/* insecure input */">A</div>
13881 <div style="/* insecure input */">B</div>
13882 <p style="/* insecure input */">C</p>
13883
13884 !! end
13885
13886 !! test
13887 Opera -o-link CSS
13888 !! wikitext
13889 <div
13890 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;"
13891 style="-o-link:attr(title);-o-link-source:current">X</div>
13892 !! html
13893 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13894
13895 !! end
13896
13897 !! test
13898 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13899 !! wikitext
13900 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13901 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13902 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13903 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13904 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13905 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13906 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13907 !! html
13908 <p style="/* insecure input */">A</p>
13909 <p style="/* insecure input */">B</p>
13910 <p style="/* insecure input */">C</p>
13911 <p style="/* insecure input */">D</p>
13912 <p style="/* insecure input */">E</p>
13913 <p style="/* insecure input */">F</p>
13914 <p style="/* insecure input */">G</p>
13915
13916 !! end
13917
13918 !! test
13919 Table attribute legitimate extension
13920 !! wikitext
13921 {|
13922 !+ style="<nowiki>color:blue</nowiki>"| status
13923 |}
13924 !! html
13925 <table>
13926 <tr>
13927 <th style="color:blue"> status
13928 </th></tr></table>
13929
13930 !!end
13931
13932 !! test
13933 Table attribute safety
13934 !! wikitext
13935 {|
13936 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13937 |}
13938 !! html
13939 <table>
13940 <tr>
13941 <th style="/* insecure input */"> status
13942 </th></tr></table>
13943
13944 !! end
13945
13946 !! test
13947 CSS line continuation 1
13948 !! wikitext
13949 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13950 !! html
13951 <div style="/* insecure input */"></div>
13952
13953 !! end
13954
13955 !! test
13956 CSS line continuation 2
13957 !! wikitext
13958 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13959 !! html
13960 <div style="/* insecure input */"></div>
13961
13962 !! end
13963
13964 !! article
13965 Template:Identity
13966 !! text
13967 {{{1}}}
13968 !! endarticle
13969
13970 !! test
13971 Expansion of multi-line templates in attribute values (bug 6255)
13972 !! wikitext
13973 <div style="background: {{identity|#00FF00}}">-</div>
13974 !! html
13975 <div style="background: #00FF00">-</div>
13976
13977 !! end
13978
13979
13980 !! test
13981 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13982 !! wikitext
13983 <div style="background:
13984 #00FF00">-</div>
13985 !! html
13986 <div style="background: #00FF00">-</div>
13987
13988 !! end
13989
13990 !! test
13991 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13992 !! wikitext
13993 <div style="background: &#10;#00FF00">-</div>
13994 !! html
13995 <div style="background: &#10;#00FF00">-</div>
13996
13997 !! end
13998
13999 !! test
14000 evil <math>-wiki-tags without Extension:Math enabled
14001 !! wikitext
14002 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14003 !! html+tidy
14004 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
14005 !! end
14006
14007 ###
14008 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14009 ###
14010 !! test
14011 Parser hook: empty input
14012 !! wikitext
14013 <tag></tag>
14014 !! html
14015 <pre>
14016 ''
14017 array (
14018 )
14019 </pre>
14020
14021 !! end
14022
14023 !! test
14024 Parser hook: empty input using terminated empty elements
14025 !! wikitext
14026 <tag/>
14027 !! html
14028 <pre>
14029 NULL
14030 array (
14031 )
14032 </pre>
14033
14034 !! end
14035
14036 !! test
14037 Parser hook: empty input using terminated empty elements (space before)
14038 !! wikitext
14039 <tag />
14040 !! html
14041 <pre>
14042 NULL
14043 array (
14044 )
14045 </pre>
14046
14047 !! end
14048
14049 !! test
14050 Parser hook: basic input
14051 !! wikitext
14052 <tag>input</tag>
14053 !! html
14054 <pre>
14055 'input'
14056 array (
14057 )
14058 </pre>
14059
14060 !! end
14061
14062
14063 !! test
14064 Parser hook: case insensitive
14065 !! wikitext
14066 <TAG>input</TAG>
14067 !! html
14068 <pre>
14069 'input'
14070 array (
14071 )
14072 </pre>
14073
14074 !! end
14075
14076
14077 !! test
14078 Parser hook: case insensitive, redux
14079 !! wikitext
14080 <TaG>input</TAg>
14081 !! html
14082 <pre>
14083 'input'
14084 array (
14085 )
14086 </pre>
14087
14088 !! end
14089
14090 !! test
14091 Parser hook: nested tags
14092 !! options
14093 noxml
14094 !! wikitext
14095 <tag><tag></tag></tag>
14096 !! html
14097 <pre>
14098 '<tag>'
14099 array (
14100 )
14101 </pre>&lt;/tag&gt;
14102
14103 !! end
14104
14105 !! test
14106 Parser hook: basic arguments
14107 !! wikitext
14108 <tag width=200 height = "100" depth = '50' square></tag>
14109 !! html
14110 <pre>
14111 ''
14112 array (
14113 'width' => '200',
14114 'height' => '100',
14115 'depth' => '50',
14116 'square' => 'square',
14117 )
14118 </pre>
14119
14120 !! end
14121
14122 !! test
14123 Parser hook: argument containing a forward slash (bug 5344)
14124 !! wikitext
14125 <tag filename='/tmp/bla'></tag>
14126 !! html
14127 <pre>
14128 ''
14129 array (
14130 'filename' => '/tmp/bla',
14131 )
14132 </pre>
14133
14134 !! end
14135
14136 !! test
14137 Parser hook: empty input using terminated empty elements (bug 2374)
14138 !! wikitext
14139 <tag foo=bar/>text
14140 !! html
14141 <pre>
14142 NULL
14143 array (
14144 'foo' => 'bar',
14145 )
14146 </pre>text
14147
14148 !! end
14149
14150 # </tag> should be output literally since there is no matching tag that begins it
14151 !! test
14152 Parser hook: basic arguments using terminated empty elements (bug 2374)
14153 !! wikitext
14154 <tag width=200 height = "100" depth = '50' square/>
14155 other stuff
14156 </tag>
14157 !! html
14158 <pre>
14159 NULL
14160 array (
14161 'width' => '200',
14162 'height' => '100',
14163 'depth' => '50',
14164 'square' => 'square',
14165 )
14166 </pre>
14167 <p>other stuff
14168 &lt;/tag&gt;
14169 </p>
14170 !! end
14171
14172 ###
14173 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14174 ###
14175
14176 !! test
14177 Parser hook: static parser hook not inside a comment
14178 !! wikitext
14179 <statictag>hello, world</statictag>
14180 <statictag action=flush/>
14181 !! html
14182 <p>hello, world
14183 </p>
14184 !! end
14185
14186
14187 !! test
14188 Parser hook: static parser hook inside a comment
14189 !! wikitext
14190 <!-- <statictag>hello, world</statictag> -->
14191 <statictag action=flush/>
14192 !! html
14193 <p><br />
14194 </p>
14195 !! end
14196
14197 # Nested template calls; this case was broken by Parser.php rev 1.506,
14198 # since reverted.
14199
14200 !! article
14201 Template:One-parameter
14202 !! text
14203 (My parameter is: {{{1}}})
14204 !! endarticle
14205
14206 !! article
14207 Template:Map-one-parameter
14208 !! text
14209 {{{{{1}}}|{{{2}}}}}
14210 !! endarticle
14211
14212 !! test
14213 Nested template calls
14214 !! wikitext
14215 {{Map-one-parameter|One-parameter|param}}
14216 !! html
14217 <p>(My parameter is: param)
14218 </p>
14219 !! end
14220
14221
14222 ###
14223 ### Sanitizer
14224 ###
14225 !! test
14226 Sanitizer: Closing of open tags
14227 !! wikitext
14228 <s></s><table></table>
14229 !! html
14230 <s></s><table></table>
14231
14232 !! end
14233
14234 !! test
14235 Sanitizer: Closing of open but not closed tags
14236 !! wikitext
14237 <s>foo
14238 !! html
14239 <p><s>foo</s>
14240 </p>
14241 !! end
14242
14243 !! test
14244 Sanitizer: Closing of closed but not open tags
14245 !! wikitext
14246 </s>
14247 !! html
14248 <p>&lt;/s&gt;
14249 </p>
14250 !! end
14251
14252 !! test
14253 Sanitizer: Closing of closed but not open table tags
14254 !! wikitext
14255 Table not started</td></tr></table>
14256 !! html
14257 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14258 </p>
14259 !! end
14260
14261 !! test
14262 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14263 !! wikitext
14264 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14265 !! html
14266 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14267 </p>
14268 !! end
14269
14270 !! test
14271 Sanitizer: Validating the contents of the id attribute (bug 4515)
14272 !! options
14273 disabled
14274 !! wikitext
14275 <br id=9 />
14276 !! html
14277 Something, but definitely not <br id="9" />...
14278 !! end
14279
14280 !! test
14281 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14282 !! options
14283 disabled
14284 !! wikitext
14285 <br id="foo" /><br id="foo" />
14286 !! html
14287 Something need to be done. foo-2 ?
14288 !! end
14289
14290 !! test
14291 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14292 !! wikitext
14293 <div itemscope>
14294 <meta itemprop="hello" content="world">
14295 <meta http-equiv="refresh" content="5">
14296 <meta itemprop="hello" http-equiv="refresh" content="5">
14297 <link itemprop="hello" href="{{SERVER}}">
14298 <link rel="stylesheet" href="{{SERVER}}">
14299 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14300 </div>
14301 !! html
14302 <div itemscope="itemscope">
14303 <p> <meta itemprop="hello" content="world" />
14304 &lt;meta http-equiv="refresh" content="5"&gt;
14305 <meta itemprop="hello" content="5" />
14306 </p>
14307 <link itemprop="hello" href="http&#58;//example.org" />
14308 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14309 <link itemprop="hello" href="http&#58;//example.org" />
14310 </div>
14311
14312 !! end
14313
14314 !! test
14315 Language converter: output gets cut off unexpectedly (bug 5757)
14316 !! options
14317 language=zh
14318 !! wikitext
14319 this bit is safe: }-
14320
14321 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14322
14323 then we get cut off here: }-
14324
14325 all additional text is vanished
14326 !! html
14327 <p>this bit is safe: }-
14328 </p><p>but if we add a conversion instance: xxx
14329 </p><p>then we get cut off here: }-
14330 </p><p>all additional text is vanished
14331 </p>
14332 !! end
14333
14334 !! test
14335 Self closed html pairs (bug 5487)
14336 !! options
14337 !! wikitext
14338 <center><font id="bug" />Centered text</center>
14339 <div><font id="bug2" />In div text</div>
14340 !! html
14341 <center>&lt;font id="bug" /&gt;Centered text</center>
14342 <div>&lt;font id="bug2" /&gt;In div text</div>
14343
14344 !! end
14345
14346 #
14347 #
14348 #
14349
14350 !! test
14351 Punctuation: nbsp before exclamation
14352 !! wikitext
14353 C'est grave !
14354 !! html
14355 <p>C'est grave&#160;!
14356 </p>
14357 !! end
14358
14359 !! test
14360 Punctuation: CSS !important (bug 11874)
14361 !! wikitext
14362 <div style="width:50% !important">important</div>
14363 !! html
14364 <div style="width:50% !important">important</div>
14365
14366 !!end
14367
14368 !! test
14369 Punctuation: CSS ! important (bug 11874; with space after)
14370 !! wikitext
14371 <div style="width:50% ! important">important</div>
14372 !! html
14373 <div style="width:50% ! important">important</div>
14374
14375 !!end
14376
14377
14378 !! test
14379 HTML bullet list, closed tags (bug 5497)
14380 !! wikitext
14381 <ul>
14382 <li>One</li>
14383 <li>Two</li>
14384 </ul>
14385 !! html
14386 <ul>
14387 <li>One</li>
14388 <li>Two</li>
14389 </ul>
14390
14391 !! end
14392
14393 !! test
14394 HTML bullet list, unclosed tags (bug 5497)
14395 !! options
14396 disabled
14397 !! wikitext
14398 <ul>
14399 <li>One
14400 <li>Two
14401 </ul>
14402 !! html
14403 <ul>
14404 <li>One
14405 </li>
14406 <li>Two
14407 </li>
14408 </ul>
14409
14410 !! end
14411
14412 !! test
14413 HTML ordered list, closed tags (bug 5497)
14414 !! wikitext
14415 <ol>
14416 <li>One</li>
14417 <li>Two</li>
14418 </ol>
14419 !! html
14420 <ol>
14421 <li>One</li>
14422 <li>Two</li>
14423 </ol>
14424
14425 !! end
14426
14427 !! test
14428 HTML ordered list, unclosed tags (bug 5497)
14429 !! options
14430 disabled
14431 !! wikitext
14432 <ol>
14433 <li>One
14434 <li>Two
14435 </ol>
14436 !! html
14437 <ol>
14438 <li>One
14439 </li>
14440 <li>Two
14441 </li>
14442 </ol>
14443
14444 !! end
14445
14446 !! test
14447 HTML nested bullet list, closed tags (bug 5497)
14448 !! wikitext
14449 <ul>
14450 <li>One</li>
14451 <li>Two:
14452 <ul>
14453 <li>Sub-one</li>
14454 <li>Sub-two</li>
14455 </ul>
14456 </li>
14457 </ul>
14458 !! html
14459 <ul>
14460 <li>One</li>
14461 <li>Two:
14462 <ul>
14463 <li>Sub-one</li>
14464 <li>Sub-two</li>
14465 </ul>
14466 </li>
14467 </ul>
14468
14469 !! end
14470
14471 !! test
14472 HTML nested bullet list, open tags (bug 5497)
14473 !! options
14474 disabled
14475 !! wikitext
14476 <ul>
14477 <li>One
14478 <li>Two:
14479 <ul>
14480 <li>Sub-one
14481 <li>Sub-two
14482 </ul>
14483 </ul>
14484 !! html
14485 <ul>
14486 <li>One
14487 </li>
14488 <li>Two:
14489 <ul>
14490 <li>Sub-one
14491 </li>
14492 <li>Sub-two
14493 </li>
14494 </ul>
14495 </li>
14496 </ul>
14497
14498 !! end
14499
14500 !! test
14501 HTML nested ordered list, closed tags (bug 5497)
14502 !! wikitext
14503 <ol>
14504 <li>One</li>
14505 <li>Two:
14506 <ol>
14507 <li>Sub-one</li>
14508 <li>Sub-two</li>
14509 </ol>
14510 </li>
14511 </ol>
14512 !! html
14513 <ol>
14514 <li>One</li>
14515 <li>Two:
14516 <ol>
14517 <li>Sub-one</li>
14518 <li>Sub-two</li>
14519 </ol>
14520 </li>
14521 </ol>
14522
14523 !! end
14524
14525 !! test
14526 HTML nested ordered list, open tags (bug 5497)
14527 !! options
14528 disabled
14529 !! wikitext
14530 <ol>
14531 <li>One
14532 <li>Two:
14533 <ol>
14534 <li>Sub-one
14535 <li>Sub-two
14536 </ol>
14537 </ol>
14538 !! html
14539 <ol>
14540 <li>One
14541 </li>
14542 <li>Two:
14543 <ol>
14544 <li>Sub-one
14545 </li>
14546 <li>Sub-two
14547 </li>
14548 </ol>
14549 </li>
14550 </ol>
14551
14552 !! end
14553
14554 !! test
14555 HTML ordered list item with parameters oddity
14556 !! wikitext
14557 <ol><li id="fragment">One</li>
14558 </ol>
14559 !! html
14560 <ol><li id="fragment">One</li>
14561 </ol>
14562
14563 !! end
14564
14565 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14566 !!test
14567 bug 5918: autonumbering
14568 !! wikitext
14569 [http://first/] [http://second] [ftp://ftp]
14570
14571 ftp://inlineftp
14572
14573 [mailto:enclosed@mail.tld With target]
14574
14575 [mailto:enclosed@mail.tld]
14576
14577 mailto:inline@mail.tld
14578 !! html/php
14579 <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>
14580 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14581 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14582 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14583 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14584 </p>
14585 !! html/parsoid
14586 <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>
14587 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14588 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14589 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14590 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14591 !! end
14592
14593
14594 #
14595 # Security and HTML correctness
14596 # From Nick Jenkins' fuzz testing
14597 #
14598
14599 !! test
14600 Fuzz testing: Parser13
14601 !! wikitext
14602 {|
14603 | http://a|
14604 !! html
14605 <table>
14606 <tr>
14607 <td>
14608 </td>
14609 </tr>
14610 </table>
14611
14612 !! end
14613
14614 !! test
14615 Fuzz testing: Parser14
14616 !! wikitext
14617 == onmouseover= ==
14618 http://__TOC__
14619 !! html
14620 <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>
14621 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14622 <ul>
14623 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14624 </ul>
14625 </div>
14626
14627
14628 !! html+tidy
14629 <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>
14630 <p>http://</p>
14631 <div id="toc" class="toc">
14632 <div id="toctitle">
14633 <h2>Contents</h2>
14634 </div>
14635 <ul>
14636 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14637 </ul>
14638 </div>
14639 !! end
14640
14641 !! test
14642 Fuzz testing: Parser14-table
14643 !! wikitext
14644 ==a==
14645 {| STYLE=__TOC__
14646 !! html
14647 <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>
14648 <table style="&#95;_TOC&#95;_">
14649 <tr><td></td></tr>
14650 </table>
14651
14652 !! html+tidy
14653 <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>
14654 <table style="__TOC__">
14655 <tr>
14656 <td></td>
14657 </tr>
14658 </table>
14659 !! end
14660
14661 # Known to produce bogus xml (extra </td>)
14662 !! test
14663 Fuzz testing: Parser16
14664 !! options
14665 noxml
14666 !! wikitext
14667 {|
14668 !https://||||||
14669 !! html
14670 <table>
14671 <tr>
14672 <th>https://</th>
14673 <th></th>
14674 <th></th>
14675 <th>
14676 </td>
14677 </tr>
14678 </table>
14679
14680 !! html+tidy
14681 <table>
14682 <tr>
14683 <th>https://</th>
14684 <th></th>
14685 <th></th>
14686 <th></th>
14687 </tr>
14688 </table>
14689 !! end
14690
14691 !! test
14692 Fuzz testing: Parser21
14693 !! wikitext
14694 {|
14695 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14696 |
14697 !! html
14698 <table>
14699 <tr>
14700 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14701 </th>
14702 <td>
14703 </td>
14704 </tr>
14705 </table>
14706
14707 !! end
14708
14709 !! test
14710 Fuzz testing: Parser22
14711 !! wikitext
14712 http://===r:::https://b
14713
14714 {|
14715 !! html
14716 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14717 </p>
14718 <table>
14719 <tr><td></td></tr>
14720 </table>
14721
14722 !! end
14723
14724 # Known to produce bad XML for now
14725 !! test
14726 Fuzz testing: Parser24
14727 !! options
14728 noxml
14729 !! wikitext
14730 {|
14731 {{{|
14732 <u CLASS=
14733 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14734 <br style="onmouseover='alert(document.cookie);' " />
14735
14736 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14737 |
14738 !! html
14739 <table>
14740 {{{|
14741 <u class="&#124;">}}}} &gt;
14742 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14743
14744 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14745 <tr>
14746 <td></u>
14747 </td>
14748 </tr>
14749 </table>
14750
14751 !! end
14752
14753 # Note: the current result listed for this is not what the original one was,
14754 # but the original bug was JavaScript injection, which is fixed in any case.
14755 # It's not clear that the original result listed was any more correct than the
14756 # current one. Original result:
14757 # <p>{{{|
14758 # </p>
14759 # <li class="&#124;&#124;">
14760 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14761 !!test
14762 Fuzz testing: Parser25 (bug 6055)
14763 !! wikitext
14764 {{{
14765 |
14766 <LI CLASS=||
14767 >
14768 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14769 !! html
14770 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14771 </p>
14772 !! end
14773
14774 !!test
14775 Fuzz testing: URL adjacent extension (with space, clean)
14776 !! wikitext
14777 http://example.com <nowiki>junk</nowiki>
14778 !! html
14779 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14780 </p>
14781 !!end
14782
14783 !!test
14784 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14785 !! wikitext
14786 http://example.com<nowiki>junk</nowiki>
14787 !! html
14788 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14789 </p>
14790 !!end
14791
14792 !!test
14793 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14794 !! wikitext
14795 http://example.com<pre>junk</pre>
14796 !! html
14797 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14798
14799 !! html+tidy
14800 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
14801 <pre>
14802 junk
14803 </pre>
14804 !!end
14805
14806 !!test
14807 Fuzz testing: image with bogus manual thumbnail
14808 !! wikitext
14809 [[Image:foobar.jpg|thumbnail= ]]
14810 !! html/php
14811 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
14812
14813 !! html/parsoid
14814 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14815 !!end
14816
14817 !! test
14818 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14819 !! wikitext
14820 <pre dir="&#10;"></pre>
14821 !! html
14822 <pre dir="&#10;"></pre>
14823
14824 !! end
14825
14826 !! test
14827 Parsing optional HTML elements (Bug 6171)
14828 !! options
14829 !! wikitext
14830 <table>
14831 <tr>
14832 <td> Some tabular data</td>
14833 <td> More tabular data ...
14834 <td> And yet som tabular data</td>
14835 </tr>
14836 </table>
14837 !! html
14838 <table>
14839 <tr>
14840 <td> Some tabular data</td>
14841 <td> More tabular data ...
14842 </td><td> And yet som tabular data</td>
14843 </tr>
14844 </table>
14845
14846 !! end
14847
14848 !! test
14849 Correct handling of <td>, <tr> (Bug 6171)
14850 !! options
14851 !! wikitext
14852 <table>
14853 <tr>
14854 <td> Some tabular data</td>
14855 <td> More tabular data ...</td>
14856 <td> And yet som tabular data</td>
14857 </tr>
14858 </table>
14859 !! html
14860 <table>
14861 <tr>
14862 <td> Some tabular data</td>
14863 <td> More tabular data ...</td>
14864 <td> And yet som tabular data</td>
14865 </tr>
14866 </table>
14867
14868 !! end
14869
14870
14871 !! test
14872 Parsing crashing regression (fr:JavaScript)
14873 !! wikitext
14874 </body></x>
14875 !! html
14876 <p>&lt;/body&gt;&lt;/x&gt;
14877 </p>
14878 !! end
14879
14880 !! test
14881 Inline wiki vs wiki block nesting
14882 !! wikitext
14883 '''Bold paragraph
14884
14885 New wiki paragraph
14886 !! html
14887 <p><b>Bold paragraph</b>
14888 </p><p>New wiki paragraph
14889 </p>
14890 !! end
14891
14892 !! test
14893 Inline HTML vs wiki block nesting
14894 !! options
14895 disabled
14896 !! wikitext
14897 <b>Bold paragraph
14898
14899 New wiki paragraph
14900 !! html
14901 <p><b>Bold paragraph</b>
14902 </p><p>New wiki paragraph
14903 </p>
14904 !! end
14905
14906 # Original result was this:
14907 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14908 # </p>
14909 # While that might be marginally more intuitive, maybe, the six-apostrophe
14910 # construct is clearly pathological and the result stated here (which is what
14911 # the parser actually does) is about as reasonable as anything.
14912 !!test
14913 Mixing markup for italics and bold
14914 !! options
14915 !! wikitext
14916 '''bold''''''bold''bolditalics'''''
14917 !! html
14918 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14919 </p>
14920 !! end
14921
14922
14923 !! article
14924 Xyzzyx
14925 !! text
14926 Article for special page transclusion test
14927 !! endarticle
14928
14929 !! test
14930 Special page transclusion
14931 !! options
14932 !! wikitext
14933 {{Special:Prefixindex/Xyzzyx}}
14934 !! html
14935 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14936
14937 !! end
14938
14939 !! test
14940 Special page transclusion twice (bug 5021)
14941 !! options
14942 !! wikitext
14943 {{Special:Prefixindex/Xyzzyx}}
14944 {{Special:Prefixindex/Xyzzyx}}
14945 !! html
14946 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14947 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14948
14949 !! end
14950
14951 !! test
14952 Transclusion of default MediaWiki message
14953 !! wikitext
14954 {{MediaWiki:Mainpage}}
14955 !! html
14956 <p>Main Page
14957 </p>
14958 !! end
14959
14960 !! test
14961 Transclusion of nonexistent MediaWiki message
14962 !! wikitext
14963 {{MediaWiki:Mainpagexxx}}
14964 !! html
14965 <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>
14966 </p>
14967 !! end
14968
14969 !! test
14970 Transclusion of MediaWiki message with underscore
14971 !! wikitext
14972 {{MediaWiki:history_short}}
14973 !! html
14974 <p>History
14975 </p>
14976 !! end
14977
14978 !! test
14979 Transclusion of MediaWiki message with space
14980 !! wikitext
14981 {{MediaWiki:history short}}
14982 !! html
14983 <p>History
14984 </p>
14985 !! end
14986
14987 !! test
14988 Invalid header with following text
14989 !! wikitext
14990 = x = y
14991 !! html
14992 <p>= x = y
14993 </p>
14994 !! end
14995
14996
14997 !! test
14998 Section extraction test (section 0)
14999 !! options
15000 section=0
15001 !! wikitext
15002 start
15003 ==a==
15004 ===aa===
15005 ====aaa====
15006 ==b==
15007 ===ba===
15008 ===bb===
15009 ====bba====
15010 ===bc===
15011 ==c==
15012 ===ca===
15013 !! html
15014 start
15015 !! end
15016
15017 !! test
15018 Section extraction test (section 1)
15019 !! options
15020 section=1
15021 !! wikitext
15022 start
15023 ==a==
15024 ===aa===
15025 ====aaa====
15026 ==b==
15027 ===ba===
15028 ===bb===
15029 ====bba====
15030 ===bc===
15031 ==c==
15032 ===ca===
15033 !! html
15034 ==a==
15035 ===aa===
15036 ====aaa====
15037 !! end
15038
15039 !! test
15040 Section extraction test (section 2)
15041 !! options
15042 section=2
15043 !! wikitext
15044 start
15045 ==a==
15046 ===aa===
15047 ====aaa====
15048 ==b==
15049 ===ba===
15050 ===bb===
15051 ====bba====
15052 ===bc===
15053 ==c==
15054 ===ca===
15055 !! html
15056 ===aa===
15057 ====aaa====
15058 !! end
15059
15060 !! test
15061 Section extraction test (section 3)
15062 !! options
15063 section=3
15064 !! wikitext
15065 start
15066 ==a==
15067 ===aa===
15068 ====aaa====
15069 ==b==
15070 ===ba===
15071 ===bb===
15072 ====bba====
15073 ===bc===
15074 ==c==
15075 ===ca===
15076 !! html
15077 ====aaa====
15078 !! end
15079
15080 !! test
15081 Section extraction test (section 4)
15082 !! options
15083 section=4
15084 !! wikitext
15085 start
15086 ==a==
15087 ===aa===
15088 ====aaa====
15089 ==b==
15090 ===ba===
15091 ===bb===
15092 ====bba====
15093 ===bc===
15094 ==c==
15095 ===ca===
15096 !! html
15097 ==b==
15098 ===ba===
15099 ===bb===
15100 ====bba====
15101 ===bc===
15102 !! end
15103
15104 !! test
15105 Section extraction test (section 5)
15106 !! options
15107 section=5
15108 !! wikitext
15109 start
15110 ==a==
15111 ===aa===
15112 ====aaa====
15113 ==b==
15114 ===ba===
15115 ===bb===
15116 ====bba====
15117 ===bc===
15118 ==c==
15119 ===ca===
15120 !! html
15121 ===ba===
15122 !! end
15123
15124 !! test
15125 Section extraction test (section 6)
15126 !! options
15127 section=6
15128 !! wikitext
15129 start
15130 ==a==
15131 ===aa===
15132 ====aaa====
15133 ==b==
15134 ===ba===
15135 ===bb===
15136 ====bba====
15137 ===bc===
15138 ==c==
15139 ===ca===
15140 !! html
15141 ===bb===
15142 ====bba====
15143 !! end
15144
15145 !! test
15146 Section extraction test (section 7)
15147 !! options
15148 section=7
15149 !! wikitext
15150 start
15151 ==a==
15152 ===aa===
15153 ====aaa====
15154 ==b==
15155 ===ba===
15156 ===bb===
15157 ====bba====
15158 ===bc===
15159 ==c==
15160 ===ca===
15161 !! html
15162 ====bba====
15163 !! end
15164
15165 !! test
15166 Section extraction test (section 8)
15167 !! options
15168 section=8
15169 !! wikitext
15170 start
15171 ==a==
15172 ===aa===
15173 ====aaa====
15174 ==b==
15175 ===ba===
15176 ===bb===
15177 ====bba====
15178 ===bc===
15179 ==c==
15180 ===ca===
15181 !! html
15182 ===bc===
15183 !! end
15184
15185 !! test
15186 Section extraction test (section 9)
15187 !! options
15188 section=9
15189 !! wikitext
15190 start
15191 ==a==
15192 ===aa===
15193 ====aaa====
15194 ==b==
15195 ===ba===
15196 ===bb===
15197 ====bba====
15198 ===bc===
15199 ==c==
15200 ===ca===
15201 !! html
15202 ==c==
15203 ===ca===
15204 !! end
15205
15206 !! test
15207 Section extraction test (section 10)
15208 !! options
15209 section=10
15210 !! wikitext
15211 start
15212 ==a==
15213 ===aa===
15214 ====aaa====
15215 ==b==
15216 ===ba===
15217 ===bb===
15218 ====bba====
15219 ===bc===
15220 ==c==
15221 ===ca===
15222 !! html
15223 ===ca===
15224 !! end
15225
15226 !! test
15227 Section extraction test (nonexistent section 11)
15228 !! options
15229 section=11
15230 !! wikitext
15231 start
15232 ==a==
15233 ===aa===
15234 ====aaa====
15235 ==b==
15236 ===ba===
15237 ===bb===
15238 ====bba====
15239 ===bc===
15240 ==c==
15241 ===ca===
15242 !! html
15243 !! end
15244
15245 !! test
15246 Section extraction test with bogus heading (section 1)
15247 !! options
15248 section=1
15249 !! wikitext
15250 ==a==
15251 ==bogus== not a legal section
15252 ==b==
15253 !! html
15254 ==a==
15255 ==bogus== not a legal section
15256 !! end
15257
15258 !! test
15259 Section extraction test with bogus heading (section 2)
15260 !! options
15261 section=2
15262 !! wikitext
15263 ==a==
15264 ==bogus== not a legal section
15265 ==b==
15266 !! html
15267 ==b==
15268 !! end
15269
15270 !! test
15271 Section extraction test with comment after heading (section 1)
15272 !! options
15273 section=1
15274 !! wikitext
15275 ==a==
15276 ==b== <!-- -->
15277 ==c==
15278 !! html
15279 ==a==
15280 !! end
15281
15282 !! test
15283 Section extraction test with comment after heading (section 2)
15284 !! options
15285 section=2
15286 !! wikitext
15287 ==a==
15288 ==b== <!-- -->
15289 ==c==
15290 !! html
15291 ==b== <!-- -->
15292 !! end
15293
15294 !! test
15295 Section extraction test with bogus <nowiki> heading (section 1)
15296 !! options
15297 section=1
15298 !! wikitext
15299 ==a==
15300 ==bogus== <nowiki>not a legal section</nowiki>
15301 ==b==
15302 !! html
15303 ==a==
15304 ==bogus== <nowiki>not a legal section</nowiki>
15305 !! end
15306
15307 !! test
15308 Section extraction test with bogus <nowiki> heading (section 2)
15309 !! options
15310 section=2
15311 !! wikitext
15312 ==a==
15313 ==bogus== <nowiki>not a legal section</nowiki>
15314 ==b==
15315 !! html
15316 ==b==
15317 !! end
15318
15319
15320 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15321 # instead of respecting commented sections
15322 !! test
15323 Section extraction prefixed by comment (section 1)
15324 !! options
15325 section=1
15326 !! wikitext
15327 <!-- -->==sec1==
15328 ==sec2==
15329 !! html
15330 ==sec2==
15331 !!end
15332
15333 !! test
15334 Section extraction prefixed by comment (section 2)
15335 !! options
15336 section=2
15337 !! wikitext
15338 <!-- -->==sec1==
15339 ==sec2==
15340 !! html
15341
15342 !!end
15343
15344
15345 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15346 # instead of respecting HTML-style headings
15347 !! test
15348 Section extraction, mixed wiki and html (section 1)
15349 !! options
15350 section=1
15351 !! wikitext
15352 <h2>unmarked</h2>
15353 unmarked
15354 ==1==
15355 one
15356 ==2==
15357 two
15358 !! html
15359 ==1==
15360 one
15361 !! end
15362
15363 !! test
15364 Section extraction, mixed wiki and html (section 2)
15365 !! options
15366 section=2
15367 !! wikitext
15368 <h2>unmarked</h2>
15369 unmarked
15370 ==1==
15371 one
15372 ==2==
15373 two
15374 !! html
15375 ==2==
15376 two
15377 !! end
15378
15379
15380 # Formerly testing for bug 3342
15381 !! test
15382 Section extraction, heading surrounded by <noinclude>
15383 !! options
15384 section=1
15385 !! wikitext
15386 <noinclude>==unmarked==</noinclude>
15387 ==marked==
15388 !! html
15389 ==marked==
15390 !!end
15391
15392 # Test behavior of bug 19910
15393 !! test
15394 Sectiion with all-equals
15395 !! options
15396 section=2
15397 !! wikitext
15398 ===
15399 The line above must have a trailing space
15400 === <!--
15401 --> <!-- -->
15402 But just in case it doesn't...
15403 !! html
15404 === <!--
15405 --> <!-- -->
15406 But just in case it doesn't...
15407 !! end
15408
15409 !! test
15410 Section replacement test (section 0)
15411 !! options
15412 replace=0,"xxx"
15413 !! wikitext
15414 start
15415 ==a==
15416 ===aa===
15417 ====aaa====
15418 ==b==
15419 ===ba===
15420 ===bb===
15421 ====bba====
15422 ===bc===
15423 ==c==
15424 ===ca===
15425 !! html
15426 xxx
15427
15428 ==a==
15429 ===aa===
15430 ====aaa====
15431 ==b==
15432 ===ba===
15433 ===bb===
15434 ====bba====
15435 ===bc===
15436 ==c==
15437 ===ca===
15438 !! end
15439
15440 !! test
15441 Section replacement test (section 1)
15442 !! options
15443 replace=1,"xxx"
15444 !! wikitext
15445 start
15446 ==a==
15447 ===aa===
15448 ====aaa====
15449 ==b==
15450 ===ba===
15451 ===bb===
15452 ====bba====
15453 ===bc===
15454 ==c==
15455 ===ca===
15456 !! html
15457 start
15458 xxx
15459
15460 ==b==
15461 ===ba===
15462 ===bb===
15463 ====bba====
15464 ===bc===
15465 ==c==
15466 ===ca===
15467 !! end
15468
15469 !! test
15470 Section replacement test (section 2)
15471 !! options
15472 replace=2,"xxx"
15473 !! wikitext
15474 start
15475 ==a==
15476 ===aa===
15477 ====aaa====
15478 ==b==
15479 ===ba===
15480 ===bb===
15481 ====bba====
15482 ===bc===
15483 ==c==
15484 ===ca===
15485 !! html
15486 start
15487 ==a==
15488 xxx
15489
15490 ==b==
15491 ===ba===
15492 ===bb===
15493 ====bba====
15494 ===bc===
15495 ==c==
15496 ===ca===
15497 !! end
15498
15499 !! test
15500 Section replacement test (section 3)
15501 !! options
15502 replace=3,"xxx"
15503 !! wikitext
15504 start
15505 ==a==
15506 ===aa===
15507 ====aaa====
15508 ==b==
15509 ===ba===
15510 ===bb===
15511 ====bba====
15512 ===bc===
15513 ==c==
15514 ===ca===
15515 !! html
15516 start
15517 ==a==
15518 ===aa===
15519 xxx
15520
15521 ==b==
15522 ===ba===
15523 ===bb===
15524 ====bba====
15525 ===bc===
15526 ==c==
15527 ===ca===
15528 !! end
15529
15530 !! test
15531 Section replacement test (section 4)
15532 !! options
15533 replace=4,"xxx"
15534 !! wikitext
15535 start
15536 ==a==
15537 ===aa===
15538 ====aaa====
15539 ==b==
15540 ===ba===
15541 ===bb===
15542 ====bba====
15543 ===bc===
15544 ==c==
15545 ===ca===
15546 !! html
15547 start
15548 ==a==
15549 ===aa===
15550 ====aaa====
15551 xxx
15552
15553 ==c==
15554 ===ca===
15555 !! end
15556
15557 !! test
15558 Section replacement test (section 5)
15559 !! options
15560 replace=5,"xxx"
15561 !! wikitext
15562 start
15563 ==a==
15564 ===aa===
15565 ====aaa====
15566 ==b==
15567 ===ba===
15568 ===bb===
15569 ====bba====
15570 ===bc===
15571 ==c==
15572 ===ca===
15573 !! html
15574 start
15575 ==a==
15576 ===aa===
15577 ====aaa====
15578 ==b==
15579 xxx
15580
15581 ===bb===
15582 ====bba====
15583 ===bc===
15584 ==c==
15585 ===ca===
15586 !! end
15587
15588 !! test
15589 Section replacement test (section 6)
15590 !! options
15591 replace=6,"xxx"
15592 !! wikitext
15593 start
15594 ==a==
15595 ===aa===
15596 ====aaa====
15597 ==b==
15598 ===ba===
15599 ===bb===
15600 ====bba====
15601 ===bc===
15602 ==c==
15603 ===ca===
15604 !! html
15605 start
15606 ==a==
15607 ===aa===
15608 ====aaa====
15609 ==b==
15610 ===ba===
15611 xxx
15612
15613 ===bc===
15614 ==c==
15615 ===ca===
15616 !! end
15617
15618 !! test
15619 Section replacement test (section 7)
15620 !! options
15621 replace=7,"xxx"
15622 !! wikitext
15623 start
15624 ==a==
15625 ===aa===
15626 ====aaa====
15627 ==b==
15628 ===ba===
15629 ===bb===
15630 ====bba====
15631 ===bc===
15632 ==c==
15633 ===ca===
15634 !! html
15635 start
15636 ==a==
15637 ===aa===
15638 ====aaa====
15639 ==b==
15640 ===ba===
15641 ===bb===
15642 xxx
15643
15644 ===bc===
15645 ==c==
15646 ===ca===
15647 !! end
15648
15649 !! test
15650 Section replacement test (section 8)
15651 !! options
15652 replace=8,"xxx"
15653 !! wikitext
15654 start
15655 ==a==
15656 ===aa===
15657 ====aaa====
15658 ==b==
15659 ===ba===
15660 ===bb===
15661 ====bba====
15662 ===bc===
15663 ==c==
15664 ===ca===
15665 !! html
15666 start
15667 ==a==
15668 ===aa===
15669 ====aaa====
15670 ==b==
15671 ===ba===
15672 ===bb===
15673 ====bba====
15674 xxx
15675
15676 ==c==
15677 ===ca===
15678 !!end
15679
15680 !! test
15681 Section replacement test (section 9)
15682 !! options
15683 replace=9,"xxx"
15684 !! wikitext
15685 start
15686 ==a==
15687 ===aa===
15688 ====aaa====
15689 ==b==
15690 ===ba===
15691 ===bb===
15692 ====bba====
15693 ===bc===
15694 ==c==
15695 ===ca===
15696 !! html
15697 start
15698 ==a==
15699 ===aa===
15700 ====aaa====
15701 ==b==
15702 ===ba===
15703 ===bb===
15704 ====bba====
15705 ===bc===
15706 xxx
15707 !! end
15708
15709 !! test
15710 Section replacement test (section 10)
15711 !! options
15712 replace=10,"xxx"
15713 !! wikitext
15714 start
15715 ==a==
15716 ===aa===
15717 ====aaa====
15718 ==b==
15719 ===ba===
15720 ===bb===
15721 ====bba====
15722 ===bc===
15723 ==c==
15724 ===ca===
15725 !! html
15726 start
15727 ==a==
15728 ===aa===
15729 ====aaa====
15730 ==b==
15731 ===ba===
15732 ===bb===
15733 ====bba====
15734 ===bc===
15735 ==c==
15736 xxx
15737 !! end
15738
15739 !! test
15740 Section replacement test with initial whitespace (bug 13728)
15741 !! options
15742 replace=2,"xxx"
15743 !! wikitext
15744 Preformatted initial line
15745 ==a==
15746 ===a===
15747 !! html
15748 Preformatted initial line
15749 ==a==
15750 xxx
15751 !! end
15752
15753
15754 !! test
15755 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15756 !! options
15757 section=1
15758 !! wikitext
15759 ==a==
15760 a
15761 !! html
15762 ==a==
15763 a
15764 !! end
15765
15766 !! test
15767 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15768 !! options
15769 section=1
15770 !! wikitext
15771 ==a==
15772 a
15773 !! html
15774 ==a==
15775 a
15776 !! end
15777
15778
15779 !! test
15780 Section extraction, <pre> around bogus header (bug 10309)
15781 !! options
15782 noxml section=2
15783 !! wikitext
15784 == Section One ==
15785 <pre>
15786 =======
15787 </pre>
15788
15789 == Section Two ==
15790 stuff
15791 !! html
15792 == Section Two ==
15793 stuff
15794 !! end
15795
15796 !! test
15797 Section replacement, <pre> around bogus header (bug 10309)
15798 !! options
15799 noxml replace=2,"xxx"
15800 !! wikitext
15801 == Section One ==
15802 <pre>
15803 =======
15804 </pre>
15805
15806 == Section Two ==
15807 stuff
15808 !! html
15809 == Section One ==
15810 <pre>
15811 =======
15812 </pre>
15813
15814 xxx
15815 !! end
15816
15817
15818
15819 !! test
15820 Handling of &#x0A; in URLs
15821 !! wikitext
15822 ** irc://&#x0A;a
15823 !! html/php
15824 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15825
15826 !! html/parsoid
15827 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15828 a">irc://
15829 a</a></li></ul></li></ul>
15830 !! end
15831
15832 !! test
15833 Handling of %0A in URLs
15834 !! wikitext
15835 ** irc://%0Aa
15836 !! html/php
15837 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15838
15839 !! html/parsoid
15840 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15841 !! end
15842
15843
15844 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15845 !! test
15846 5 quotes, code coverage +1 line
15847 !! options
15848 parsoid=wt2html
15849 !! wikitext
15850 '''''
15851 !! html/php
15852 !! html/parsoid
15853 <p><b><i></i></b></p>
15854 !! end
15855
15856 # same html as previous, but wikitext adjusted to match parsoid html2wt
15857 # note that wt2html and html2html will put the <i> before the <b>
15858 !! test
15859 5 quotes, code coverage +1 line w/ nowiki (1)
15860 !! options
15861 parsoid=wt2wt,html2wt
15862 !! wikitext
15863 '''''<nowiki/>'''''
15864 !! html/php
15865 <p><i></i>
15866 </p>
15867 !! html/parsoid
15868 <p><b><i></i></b></p>
15869 !! end
15870
15871 # same as previous, just swapping the <i> and <b>
15872 !! test
15873 5 quotes, code coverage +1 line w/ nowiki (2)
15874 !! wikitext
15875 '''''<nowiki/>'''''
15876 !! html/php
15877 <p><i></i>
15878 </p>
15879 !! html/parsoid
15880 <p><i><b></b></i></p>
15881 !! end
15882
15883 !! test
15884 Special:Search page linking.
15885 !! wikitext
15886 {{Special:search}}
15887 !! html
15888 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15889 </p>
15890 !! end
15891
15892 !! test
15893 Say the magic word
15894 !! options
15895 title=[[Parser test]]
15896 !! wikitext
15897 * {{PAGENAME}}
15898 * {{PAGENAMEE}}
15899 * {{FULLPAGENAME}}
15900 * {{FULLPAGENAMEE}}
15901 * {{BASEPAGENAME}}
15902 * {{BASEPAGENAMEE}}
15903 * {{SUBPAGENAME}}
15904 * {{SUBPAGENAMEE}}
15905 * {{ROOTPAGENAME}}
15906 * {{ROOTPAGENAMEE}}
15907 * {{TALKPAGENAME}}
15908 * {{TALKPAGENAMEE}}
15909 * {{SUBJECTPAGENAME}}
15910 * {{SUBJECTPAGENAMEE}}
15911 * {{NAMESPACEE}}
15912 * {{NAMESPACE}}
15913 * {{NAMESPACENUMBER}}
15914 * {{TALKSPACE}}
15915 * {{TALKSPACEE}}
15916 * {{SUBJECTSPACE}}
15917 * {{SUBJECTSPACEE}}
15918 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15919 !! html
15920 <ul><li> Parser test</li>
15921 <li> Parser_test</li>
15922 <li> Parser test</li>
15923 <li> Parser_test</li>
15924 <li> Parser test</li>
15925 <li> Parser_test</li>
15926 <li> Parser test</li>
15927 <li> Parser_test</li>
15928 <li> Parser test</li>
15929 <li> Parser_test</li>
15930 <li> Talk:Parser test</li>
15931 <li> Talk:Parser_test</li>
15932 <li> Parser test</li>
15933 <li> Parser_test</li>
15934 <li> </li>
15935 <li> </li>
15936 <li> 0</li>
15937 <li> Talk</li>
15938 <li> Talk</li>
15939 <li> </li>
15940 <li> </li>
15941 <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>
15942
15943 !! end
15944 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15945
15946 !! test
15947 Gallery
15948 !! wikitext
15949 <gallery>
15950 image1.png |
15951 image2.gif|||||
15952
15953 image3|
15954 image4 |300px| centre
15955 image5.svg| http://///////
15956 [[x|xx]]]]
15957 * image6
15958 </gallery>
15959 !! html
15960 <ul class="gallery mw-gallery-traditional">
15961 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15962 <div class="thumb" style="height: 150px;">Image1.png</div>
15963 <div class="gallerytext">
15964 </div>
15965 </div></li>
15966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15967 <div class="thumb" style="height: 150px;">Image2.gif</div>
15968 <div class="gallerytext">
15969 <p>||||
15970 </p>
15971 </div>
15972 </div></li>
15973 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15974 <div class="thumb" style="height: 150px;">Image3</div>
15975 <div class="gallerytext">
15976 </div>
15977 </div></li>
15978 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15979 <div class="thumb" style="height: 150px;">Image4</div>
15980 <div class="gallerytext">
15981 <p>300px| centre
15982 </p>
15983 </div>
15984 </div></li>
15985 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15986 <div class="thumb" style="height: 150px;">Image5.svg</div>
15987 <div class="gallerytext">
15988 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15989 </p>
15990 </div>
15991 </div></li>
15992 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15993 <div class="thumb" style="height: 150px;">* image6</div>
15994 <div class="gallerytext">
15995 </div>
15996 </div></li>
15997 </ul>
15998
15999 !! end
16000
16001 !! test
16002 Gallery (with options)
16003 !! wikitext
16004 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16005 File:Nonexistant.jpg|caption
16006 File:Nonexistant.jpg
16007 image:foobar.jpg|some '''caption''' [[Main Page]]
16008 image:foobar.jpg
16009 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16010 </gallery>
16011 !! html
16012 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16013 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16014 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16015 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16016 <div class="gallerytext">
16017 <p>caption
16018 </p>
16019 </div>
16020 </div></li>
16021 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16022 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16023 <div class="gallerytext">
16024 </div>
16025 </div></li>
16026 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16027 <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>
16028 <div class="gallerytext">
16029 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16030 </p>
16031 </div>
16032 </div></li>
16033 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16034 <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>
16035 <div class="gallerytext">
16036 </div>
16037 </div></li>
16038 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16039 <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>
16040 <div class="gallerytext">
16041 <p>Blabla|blabla.
16042 </p>
16043 </div>
16044 </div></li>
16045 </ul>
16046
16047 !! end
16048
16049 !! test
16050 Gallery with link that has fragment
16051 !! wikitext
16052 <gallery>
16053 image:foobar.jpg|link=Main_Page
16054 image:foobar.jpg|link=Main_Page#section
16055 image:foobar.jpg|link=Main Page#section|caption
16056 </gallery>
16057 !! html
16058 <ul class="gallery mw-gallery-traditional">
16059 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16060 <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>
16061 <div class="gallerytext">
16062 </div>
16063 </div></li>
16064 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16065 <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>
16066 <div class="gallerytext">
16067 </div>
16068 </div></li>
16069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16070 <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>
16071 <div class="gallerytext">
16072 <p>caption
16073 </p>
16074 </div>
16075 </div></li>
16076 </ul>
16077
16078 !! end
16079
16080 !! test
16081 Gallery with wikitext inside caption
16082 !! wikitext
16083 <gallery>
16084 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16085 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16086 </gallery>
16087 !! html
16088 <ul class="gallery mw-gallery-traditional">
16089 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16090 <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>
16091 <div class="gallerytext">
16092 <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>
16093 </p>
16094 </div>
16095 </div></li>
16096 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16097 <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>
16098 <div class="gallerytext">
16099 <p>This is a test template
16100 </p>
16101 </div>
16102 </div></li>
16103 </ul>
16104
16105 !! end
16106
16107 !! test
16108 gallery (with showfilename option)
16109 !! wikitext
16110 <gallery showfilename>
16111 File:Nonexistant.jpg|caption
16112 File:Nonexistant.jpg
16113 image:foobar.jpg|some '''caption''' [[Main Page]]
16114 File:Foobar.jpg
16115 </gallery>
16116 !! html
16117 <ul class="gallery mw-gallery-traditional">
16118 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16119 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16120 <div class="gallerytext">
16121 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16122 caption
16123 </p>
16124 </div>
16125 </div></li>
16126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16127 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16128 <div class="gallerytext">
16129 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16130 </p>
16131 </div>
16132 </div></li>
16133 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16134 <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>
16135 <div class="gallerytext">
16136 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16137 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16138 </p>
16139 </div>
16140 </div></li>
16141 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16142 <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>
16143 <div class="gallerytext">
16144 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16145 </p>
16146 </div>
16147 </div></li>
16148 </ul>
16149
16150 !! end
16151
16152 !! test
16153 Gallery (with namespace-less filenames)
16154 !! wikitext
16155 <gallery>
16156 File:Nonexistant.jpg
16157 Nonexistant.jpg
16158 image:foobar.jpg
16159 foobar.jpg
16160 </gallery>
16161 !! html
16162 <ul class="gallery mw-gallery-traditional">
16163 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16164 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16165 <div class="gallerytext">
16166 </div>
16167 </div></li>
16168 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16169 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16170 <div class="gallerytext">
16171 </div>
16172 </div></li>
16173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16174 <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>
16175 <div class="gallerytext">
16176 </div>
16177 </div></li>
16178 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16179 <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>
16180 <div class="gallerytext">
16181 </div>
16182 </div></li>
16183 </ul>
16184
16185 !! end
16186
16187 !! test
16188 HTML Hex character encoding (spells the word "JavaScript")
16189 !! options
16190 parsoid=wt2html,wt2wt,html2html
16191 !! wikitext
16192 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16193 !! html/php
16194 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16195 </p>
16196 !! html/php+tidy
16197 <p>JavaScript</p>
16198 !! html/parsoid
16199 <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>
16200 !! end
16201
16202 !! test
16203 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16204 !! wikitext
16205 &#xsee;&#XSEE;
16206 !! html/php
16207 <p>&amp;#xsee;&amp;#XSEE;
16208 </p>
16209 !! html/parsoid
16210 <p>&amp;#xsee;&amp;#XSEE;</p>
16211 !! end
16212
16213 !! test
16214 HTML Hex character encoding mixed case
16215 !! options
16216 parsoid=wt2html,wt2wt,html2html
16217 !! wikitext
16218 &#xEE;&#Xee;
16219 !! html/php
16220 <p>&#xee;&#xee;
16221 </p>
16222 !! html/php+tidy
16223 <p>îî</p>
16224 !! html/parsoid
16225 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16226 !! end
16227
16228 !! test
16229 __FORCETOC__ override
16230 !! wikitext
16231 __NEWSECTIONLINK__
16232 __FORCETOC__
16233 !! html
16234 <p><br />
16235 </p>
16236 !! end
16237
16238 !! test
16239 ISBN code coverage
16240 !! wikitext
16241 ISBN 978-0-1234-56&#x20;789
16242 !! html
16243 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16244 </p>
16245 !! html+tidy
16246 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16247 !! end
16248
16249 !! test
16250 ISBN followed by 5 spaces
16251 !! wikitext
16252 ISBN
16253 !! html
16254 <p>ISBN
16255 </p>
16256 !! end
16257
16258 !! test
16259 Double ISBN
16260 !! wikitext
16261 ISBN ISBN 1234567890
16262 !! html
16263 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16264 </p>
16265 !! end
16266
16267 !! test
16268 ISBN with an X
16269 !! wikitext
16270 ISBN 3-462-04561-X
16271 !! html
16272 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16273 </p>
16274 !! end
16275
16276 !! test
16277 ISBN with empty prefix (parsoid test)
16278 !! wikitext
16279 ISBN 1234567890
16280 !! html/parsoid
16281 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16282 !! end
16283
16284 !! test
16285 Bug 22905: <abbr> followed by ISBN followed by </a>
16286 !! wikitext
16287 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16288 !! html
16289 <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>
16290 </p>
16291 !! end
16292
16293 !! test
16294 Double RFC
16295 !! wikitext
16296 RFC RFC 1234
16297 !! html
16298 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16299 </p>
16300 !! end
16301
16302 !! test
16303 Double RFC with a wiki link
16304 !! wikitext
16305 RFC [[RFC 1234]]
16306 !! html
16307 <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>
16308 </p>
16309 !! end
16310
16311 !! test
16312 RFC code coverage
16313 !! wikitext
16314 RFC 983&#x20;987
16315 !! html
16316 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16317 </p>
16318 !! html+tidy
16319 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16320 !! end
16321
16322 !! test
16323 Centre-aligned image
16324 !! wikitext
16325 [[Image:foobar.jpg|centre]]
16326 !! html
16327 <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>
16328
16329 !!end
16330
16331 !! test
16332 None-aligned image
16333 !! wikitext
16334 [[Image:foobar.jpg|none]]
16335 !! html
16336 <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>
16337
16338 !!end
16339
16340 !! test
16341 Width + Height sized image (using px) (height is ignored)
16342 !! wikitext
16343 [[Image:foobar.jpg|640x480px]]
16344 !! html
16345 <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>
16346 </p>
16347 !!end
16348
16349 !! test
16350 Width-sized image (using px, no following whitespace)
16351 !! wikitext
16352 [[Image:foobar.jpg|640px]]
16353 !! html
16354 <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>
16355 </p>
16356 !!end
16357
16358 !! test
16359 Width-sized image (using px, with following whitespace - test regression from r39467)
16360 !! wikitext
16361 [[Image:foobar.jpg|640px ]]
16362 !! html
16363 <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>
16364 </p>
16365 !!end
16366
16367 !! test
16368 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16369 !! wikitext
16370 [[Image:foobar.jpg| 640px]]
16371 !! html
16372 <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>
16373 </p>
16374 !!end
16375
16376 !! test
16377 Image with page parameter
16378 !! options
16379 djvu
16380 !! wikitext
16381 [[File:LoremIpsum.djvu|page=2]]
16382 !! html
16383 <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>
16384 </p>
16385 !! end
16386
16387 !! test
16388 Another italics / bold test
16389 !! wikitext
16390 ''' ''x'
16391 !! html
16392 <pre>'<i> </i>x'
16393 </pre>
16394 !!end
16395
16396 # Note the results may be incorrect, as parserTest output included this:
16397 # XML error: Mismatched tag at byte 6120:
16398 # ...<dd> </dt></dl> </dd...
16399 !! test
16400 dt/dd/dl test
16401 !! options
16402 disabled
16403 !! wikitext
16404 :;;;::
16405 !! html
16406 <dl>
16407 <dd><dl>
16408 <dt><dl>
16409 <dt><dl>
16410 <dt><dl>
16411 <dd><dl>
16412 <dd>
16413 </dd>
16414 </dl>
16415 </dd>
16416 </dl>
16417 </dt>
16418 </dl>
16419 </dt>
16420 </dl>
16421 </dt>
16422 </dl>
16423 </dd>
16424 </dl>
16425
16426 !!end
16427
16428
16429 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16430 !! test
16431 Images with the "|" character in the comment
16432 !! wikitext
16433 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16434 !! html/php
16435 <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"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
16436
16437 !! html/parsoid
16438 <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>
16439 !! end
16440
16441 !! test
16442 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16443 !! wikitext
16444 <html><script>alert(1);</script></html>
16445 !! html
16446 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16447 </p>
16448 !! end
16449
16450 !! test
16451 HTML with raw HTML ($wgRawHtml==true)
16452 !! options
16453 wgRawHtml=1
16454 !! wikitext
16455 <html><script>alert(1);</script></html>
16456 !! html
16457 <p><script>alert(1);</script>
16458 </p>
16459 !! end
16460
16461 !! test
16462 Parents of subpages, one level up
16463 !! options
16464 subpage title=[[Subpage test/L1/L2/L3]]
16465 !! wikitext
16466 [[../|L2]]
16467 !! html
16468 <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>
16469 </p>
16470 !! end
16471
16472
16473 !! test
16474 Parents of subpages, one level up, not named
16475 !! options
16476 subpage title=[[Subpage test/L1/L2/L3]]
16477 !! wikitext
16478 [[../]]
16479 !! html
16480 <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>
16481 </p>
16482 !! end
16483
16484
16485
16486 !! test
16487 Parents of subpages, two levels up
16488 !! options
16489 subpage title=[[Subpage test/L1/L2/L3]]
16490 !! wikitext
16491 [[../../|L1]]2
16492
16493 [[../../|L1]]l
16494 !! html
16495 <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
16496 </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>
16497 </p>
16498 !! end
16499
16500 !! test
16501 Parents of subpages, two levels up, without trailing slash or name.
16502 !! options
16503 subpage title=[[Subpage test/L1/L2/L3]]
16504 !! wikitext
16505 [[../..]]
16506 !! html
16507 <p>[[../..]]
16508 </p>
16509 !! end
16510
16511 !! test
16512 Parents of subpages, two levels up, with lots of extra trailing slashes.
16513 !! options
16514 subpage title=[[Subpage test/L1/L2/L3]]
16515 !! wikitext
16516 [[../../////]]
16517 !! html
16518 <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>
16519 </p>
16520 !! end
16521
16522 !! article
16523 Subpage test/L1/L2/L3Sibling
16524 !! text
16525 Sibling article
16526 !! endarticle
16527
16528 !! test
16529 Transclusion of a sibling page (one level up)
16530 !! options
16531 subpage title=[[Subpage test/L1/L2/L3]]
16532 !! wikitext
16533 {{../L3Sibling}}
16534 !! html
16535 <p>Sibling article
16536 </p>
16537 !! end
16538
16539 !! test
16540 Transclusion of a child page
16541 !! options
16542 subpage title=[[Subpage test/L1/L2]]
16543 !! wikitext
16544 {{/L3Sibling}}
16545 !! html
16546 <p>Sibling article
16547 </p>
16548 !! end
16549
16550 !! test
16551 Non-transclusion because of too many up levels
16552 !! options
16553 subpage title=[[Subpage test/L1/L2/L3]]
16554 !! wikitext
16555 {{../../../../More than parent}}
16556 !! html
16557 <p>{{../../../../More than parent}}
16558 </p>
16559 !! end
16560
16561 !! test
16562 Definition list code coverage
16563 !! wikitext
16564 ; title : def
16565 ; title : def
16566 ;title: def
16567 !! html
16568 <dl><dt> title &#160;</dt>
16569 <dd> def</dd>
16570 <dt> title&#160;</dt>
16571 <dd> def</dd>
16572 <dt>title</dt>
16573 <dd> def</dd></dl>
16574
16575 !! end
16576
16577 !! test
16578 Don't fall for the self-closing div
16579 !! wikitext
16580 <div>hello world</div/>
16581 !! html
16582 <div>hello world</div>
16583
16584 !! end
16585
16586 !! test
16587 MSGNW magic word
16588 !! wikitext
16589 {{MSGNW:msg}}
16590 !! html
16591 <p>&#91;&#91;:Template:Msg&#93;&#93;
16592 </p>
16593 !! end
16594
16595 !! test
16596 RAW magic word
16597 !! wikitext
16598 {{RAW:QUERTY}}
16599 !! html
16600 <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>
16601 </p>
16602 !! end
16603
16604 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16605 !! test
16606 Always escape literal '>' in output, not just after '<'
16607 !! wikitext
16608 ><>
16609 !! html
16610 <p>&gt;&lt;&gt;
16611 </p>
16612 !! end
16613
16614 !! test
16615 Template caching
16616 !! wikitext
16617 {{Test}}
16618 {{Test}}
16619 !! html
16620 <p>This is a test template
16621 This is a test template
16622 </p>
16623 !! end
16624
16625
16626 !! article
16627 MediaWiki:Fake
16628 !! text
16629 ==header==
16630 !! endarticle
16631
16632 !! test
16633 Inclusion of !userCanEdit() content
16634 !! wikitext
16635 {{MediaWiki:Fake}}
16636 !! html
16637 <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>
16638
16639 !! end
16640
16641
16642 !! test
16643 Out-of-order TOC heading levels
16644 !! wikitext
16645 ==2==
16646 ======6======
16647 ===3===
16648 =1=
16649 =====5=====
16650 ==2==
16651 !! html
16652 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16653 <ul>
16654 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16655 <ul>
16656 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16657 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16658 </ul>
16659 </li>
16660 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16661 <ul>
16662 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16663 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16664 </ul>
16665 </li>
16666 </ul>
16667 </div>
16668
16669 <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>
16670 <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>
16671 <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>
16672 <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>
16673 <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>
16674 <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>
16675
16676 !! end
16677
16678
16679 !! test
16680 ISBN with a dummy number
16681 !! wikitext
16682 ISBN ---
16683 !! html
16684 <p>ISBN ---
16685 </p>
16686 !! end
16687
16688
16689 !! test
16690 ISBN with space-delimited number
16691 !! wikitext
16692 ISBN 92 9017 032 8
16693 !! html
16694 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16695 </p>
16696 !! end
16697
16698
16699 !! test
16700 ISBN with multiple spaces, no number
16701 !! wikitext
16702 ISBN foo
16703 !! html
16704 <p>ISBN foo
16705 </p>
16706 !! end
16707
16708
16709 !! test
16710 ISBN length
16711 !! wikitext
16712 ISBN 123456789
16713
16714 ISBN 1234567890
16715
16716 ISBN 12345678901
16717 !! html
16718 <p>ISBN 123456789
16719 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16720 </p><p>ISBN 12345678901
16721 </p>
16722 !! end
16723
16724
16725 !! test
16726 ISBN with trailing year (bug 8110)
16727 !! wikitext
16728 ISBN 1-234-56789-0 - 2006
16729
16730 ISBN 1 234 56789 0 - 2006
16731 !! html
16732 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16733 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16734 </p>
16735 !! end
16736
16737
16738 !! test
16739 anchorencode
16740 !! wikitext
16741 {{anchorencode:foo bar©#%n}}
16742 !! html
16743 <p>foo_bar.C2.A9.23.25n
16744 </p>
16745 !! end
16746
16747 !! test
16748 anchorencode trims spaces
16749 !! wikitext
16750 {{anchorencode: __pretty__please__}}
16751 !! html
16752 <p>pretty_please
16753 </p>
16754 !! end
16755
16756 !! test
16757 anchorencode deals with links
16758 !! wikitext
16759 {{anchorencode: [[hello|world]] [[hi]]}}
16760 !! html
16761 <p>world_hi
16762 </p>
16763 !! end
16764
16765 !! test
16766 anchorencode deals with templates
16767 !! wikitext
16768 {{anchorencode: {{Foo}} }}
16769 !! html
16770 <p>FOO
16771 </p>
16772 !! end
16773
16774 !! test
16775 anchorencode encodes like the TOC generator: (bug 18431)
16776 !! wikitext
16777 === _ +:.3A%3A&&amp;]] ===
16778 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16779 __NOEDITSECTION__
16780 !! html
16781 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16782 <p>.2B:.3A.253A.26.26.5D.5D
16783 </p>
16784 !! end
16785
16786 !! test
16787 Bug 6200: blockquotes and paragraph formatting
16788 !! wikitext
16789 <blockquote>
16790 foo
16791 </blockquote>
16792
16793 bar
16794
16795 baz
16796 !! html
16797 <blockquote>
16798 <p>foo
16799 </p>
16800 </blockquote>
16801 <p>bar
16802 </p>
16803 <pre>baz
16804 </pre>
16805 !! end
16806
16807 !! test
16808 Bug 8293: Use of center tag ruins paragraph formatting
16809 !! wikitext
16810 <center>
16811 foo
16812 </center>
16813
16814 bar
16815
16816 baz
16817 !! html
16818 <center>
16819 <p>foo
16820 </p>
16821 </center>
16822 <p>bar
16823 </p>
16824 <pre>baz
16825 </pre>
16826 !! end
16827
16828 !!test
16829 Parsing of overlapping (improperly nested) inline html tags
16830 !! wikitext
16831 <span><s>x</span></s>
16832 !! html/php
16833 <p><span><s>x&lt;/span&gt;</s></span>
16834 </p>
16835 !! html/parsoid
16836 <p><span><s>x</s></span>
16837 </p>
16838 !!end
16839
16840 ###
16841 ### Language variants related tests
16842 ###
16843 !! test
16844 Self-link in language variants
16845 !! options
16846 title=[[Dunav]] language=sr
16847 !! wikitext
16848 Both [[Dunav]] and [[Дунав]] are names for this river.
16849 !! html
16850 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16851 </p>
16852 !!end
16853
16854 !! article
16855 Дуна
16856 !! text
16857 content
16858 !! endarticle
16859
16860 !! test
16861 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16862 !! options
16863 title=[[Duna]] language=sr
16864 !! wikitext
16865 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16866 !! html
16867 <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.
16868 </p>
16869 !! end
16870
16871 !! test
16872 Link to a section of a variant of this title shouldn't be parsed as self-link
16873 !! options
16874 title=[[Duna]] language=sr
16875 !! wikitext
16876 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16877 !! html
16878 <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.
16879 </p>
16880 !! end
16881
16882 !! test
16883 Link to pages in language variants
16884 !! options
16885 language=sr
16886 !! wikitext
16887 Main Page can be written as [[Маин Паге]]
16888 !! html
16889 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16890 </p>
16891 !!end
16892
16893
16894 !! test
16895 Multiple links to pages in language variants
16896 !! options
16897 language=sr
16898 !! wikitext
16899 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16900 !! html
16901 <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>.
16902 </p>
16903 !!end
16904
16905
16906 !! test
16907 Simple template in language variants
16908 !! options
16909 language=sr
16910 !! wikitext
16911 {{тест}}
16912 !! html
16913 <p>This is a test template
16914 </p>
16915 !! end
16916
16917
16918 !! test
16919 Template with explicit namespace in language variants
16920 !! options
16921 language=sr
16922 !! wikitext
16923 {{Template:тест}}
16924 !! html
16925 <p>This is a test template
16926 </p>
16927 !! end
16928
16929
16930 !! test
16931 Basic test for template parameter in language variants
16932 !! options
16933 language=sr
16934 !! wikitext
16935 {{парамтест|param=foo}}
16936 !! html
16937 <p>This is a test template with parameter foo
16938 </p>
16939 !! end
16940
16941
16942 !! test
16943 Simple category in language variants
16944 !! options
16945 language=sr cat
16946 !! wikitext
16947 [[Category:МедиаWики Усер'с Гуиде]]
16948 !! html
16949 <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>
16950 !! end
16951
16952
16953 !! article
16954 Category:分类
16955 !! text
16956 blah
16957 !! endarticle
16958
16959 !! article
16960 Category:分類
16961 !! text
16962 blah
16963 !! endarticle
16964
16965 !! test
16966 Don't convert blue categorylinks to another variant (bug 33210)
16967 !! options
16968 language=zh cat
16969 !! wikitext
16970 [[A]][[Category:分类]]
16971 !! html
16972 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16973 !! end
16974
16975
16976 !! test
16977 Stripping -{}- tags (language variants)
16978 !! options
16979 language=sr
16980 !! wikitext
16981 Latin proverb: -{Ne nuntium necare}-
16982 !! html
16983 <p>Latin proverb: Ne nuntium necare
16984 </p>
16985 !! end
16986
16987
16988 !! test
16989 Prevent conversion with -{}- tags (language variants)
16990 !! options
16991 language=sr variant=sr-ec
16992 !! wikitext
16993 Latinski: -{Ne nuntium necare}-
16994 !! html
16995 <p>Латински: Ne nuntium necare
16996 </p>
16997 !! end
16998
16999
17000 !! test
17001 Prevent conversion of text with -{}- tags (language variants)
17002 !! options
17003 language=sr variant=sr-ec
17004 !! wikitext
17005 Latinski: -{Ne nuntium necare}-
17006 !! html
17007 <p>Латински: Ne nuntium necare
17008 </p>
17009 !! end
17010
17011
17012 !! test
17013 Prevent conversion of links with -{}- tags (language variants)
17014 !! options
17015 language=sr variant=sr-ec
17016 !! wikitext
17017 -{[[Main Page]]}-
17018 !! html
17019 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17020 </p>
17021 !! end
17022
17023
17024 !! test
17025 -{}- tags within headlines (within html for parserConvert())
17026 !! options
17027 language=sr variant=sr-ec
17028 !! wikitext
17029 == -{Naslov}- ==
17030 !! html
17031 <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>
17032
17033 !! end
17034
17035
17036 !! test
17037 Explicit definition of language variant alternatives
17038 !! options
17039 language=zh variant=zh-tw
17040 !! wikitext
17041 -{zh:China;zh-tw:Taiwan}-, not China
17042 !! html
17043 <p>Taiwan, not China
17044 </p>
17045 !! end
17046
17047
17048 !! test
17049 Conversion around HTML tags
17050 !! options
17051 language=sr variant=sr-ec
17052 !! wikitext
17053 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17054 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17055 !! html
17056 <p>
17057 <span title="ЛаCтин">ски</span>
17058 </p>
17059 !! end
17060
17061
17062 !! test
17063 Explicit session-wise language variant mapping (A flag and - flag)
17064 !! options
17065 language=zh variant=zh-tw
17066 !! wikitext
17067 Taiwan is not China.
17068 But -{A|zh:China;zh-tw:Taiwan}- is China,
17069 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17070 and -{China}- is China.
17071 !! html
17072 <p>Taiwan is not China.
17073 But Taiwan is Taiwan,
17074 (This should be stripped!)
17075 and China is China.
17076 </p>
17077 !! end
17078
17079 !! test
17080 Explicit session-wise language variant mapping (H flag for hide)
17081 !! options
17082 language=zh variant=zh-tw
17083 !! wikitext
17084 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17085 Taiwan is China.
17086 !! html
17087 <p>(This should be stripped!)
17088 Taiwan is Taiwan.
17089 </p>
17090 !! end
17091
17092 !! test
17093 Adding explicit conversion rule for title (T flag)
17094 !! options
17095 language=zh variant=zh-tw showtitle
17096 !! wikitext
17097 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17098 !! html
17099 Taiwan
17100 <p>Should be stripped!
17101 </p>
17102 !! end
17103
17104 !! test
17105 Testing that changing the language variant here in the tests actually works
17106 !! options
17107 language=zh variant=zh showtitle
17108 !! wikitext
17109 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17110 !! html
17111 China
17112 <p>Should be stripped!
17113 </p>
17114 !! end
17115
17116 !! test
17117 Recursive conversion of alt and title attrs shouldn't clear converter state
17118 !! options
17119 language=zh variant=zh-cn showtitle
17120 !! wikitext
17121 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17122 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17123 !! html
17124 China
17125 <p>
17126 Should be stripped<span title="Exclamation">!</span>
17127 </p>
17128 !! end
17129
17130 !! test
17131 Bug 24072: more test on conversion rule for title
17132 !! options
17133 language=zh variant=zh-tw showtitle
17134 !! wikitext
17135 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17136 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17137 !! html
17138 Taiwan
17139 <p>This should be stripped!
17140 This won't take interferes with the title rule.
17141 </p>
17142 !! end
17143
17144 !! test
17145 Partly disable title conversion if variant == main language code
17146 !! options
17147 language=zh variant=zh title=[[ZH]] showtitle
17148 !! wikitext
17149 -{T|zh-cn:CN;zh-tw:TW}-
17150 !! html
17151 ZH
17152 <p>
17153 </p>
17154 !! end
17155
17156 !! test
17157 Partly disable title conversion if variant == main language code, more
17158 !! options
17159 language=zh variant=zh title=[[ZH]] showtitle
17160 !! wikitext
17161 -{T|TW}-
17162 !! html
17163 ZH
17164 <p>
17165 </p>
17166 !! end
17167
17168 !! test
17169 Raw output of variant escape tags (R flag)
17170 !! options
17171 language=zh variant=zh-tw
17172 !! wikitext
17173 Raw: -{R|zh:China;zh-tw:Taiwan}-
17174 !! html
17175 <p>Raw: zh:China;zh-tw:Taiwan
17176 </p>
17177 !! end
17178
17179 !! test
17180 Nested using of manual convert syntax
17181 !! options
17182 language=zh variant=zh-hk
17183 !! wikitext
17184 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17185 !! html
17186 <p>Nested: Hello Hong Kong!
17187 </p>
17188 !! end
17189
17190 !! test
17191 Proper conversion of text in external links
17192 !! options
17193 language=sr variant=sr-ec
17194 !! wikitext
17195 http://www.google.com
17196 gopher://www.google.com
17197 [http://www.google.com http://www.google.com]
17198 [gopher://www.google.com gopher://www.google.com]
17199 [https://www.google.com irc://www.google.com]
17200 [ftp://www.google.com www.google.com/ftp://dir]
17201 [//www.google.com www.google.com]
17202 !! html
17203 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17204 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17205 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17206 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17207 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17208 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17209 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17210 </p>
17211 !! end
17212
17213 !! test
17214 Do not convert roman numbers to language variants
17215 !! options
17216 language=sr variant=sr-ec
17217 !! wikitext
17218 Fridrih IV je car.
17219 !! html
17220 <p>Фридрих IV је цар.
17221 </p>
17222 !! end
17223
17224 !! test
17225 Unclosed language converter markup "-{"
17226 !! options
17227 language=sr
17228 !! wikitext
17229 -{T|hello
17230 !! html
17231 <p>-{T|hello
17232 </p>
17233 !! end
17234
17235 !! test
17236 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17237 !! options
17238 language=sr
17239 !! wikitext
17240 -{R|=&gt;}-
17241 !! html
17242 <p>=&gt;
17243 </p>
17244 !!end
17245
17246 !! test
17247 Don't break link parsing if language converter markup is in the caption.
17248 !! options
17249 language=sr variant=sr-ec
17250 !! wikitext
17251 [[Main Page|-{R|main page}-]]
17252 !! html
17253 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17254 </p>
17255 !! end
17256
17257 # This test is currently broken in the PHP parser (bug 52661)
17258 !! test
17259 Don't break image parsing if language converter markup is in the caption.
17260 !! options
17261 language=sr
17262 disabled
17263 !! wikitext
17264 [[File:Foobar.jpg|-{R|caption}-]]
17265 !! html
17266 <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>
17267 </p>
17268 !! end
17269
17270 # This test is currently broken in the PHP parser (bug 52661)
17271 !! test
17272 Don't break list handling if language converter markup is in the item.
17273 !! options
17274 language=zh variant=zh-cn
17275 disabled
17276 !! wikitext
17277 ;-{zh-cn:AAA;zh-tw:BBB}-
17278 !! html
17279 <dl><dt>AAA
17280 </dt></dl>
17281
17282 !! end
17283
17284 # This test is currently broken in the PHP parser (bug 52661)
17285 !! test
17286 Don't break table handling if language converter markup is in the cell.
17287 !! options
17288 language=sr variant=sr-ec
17289 disabled
17290 !! wikitext
17291 {|
17292 |-
17293 | -{R|B}-
17294 |}
17295 !! html
17296 <table>
17297
17298 <tr>
17299 <td> B
17300 </td></tr></table>
17301
17302 !! end
17303
17304 !! test
17305 Bug 529: Uncovered bullet
17306 !! wikitext
17307 * Foo {{bullet}}
17308 !! html
17309 <ul><li> Foo </li>
17310 <li> Bar</li></ul>
17311
17312 !! end
17313
17314 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17315 # Templates in Wikipedia rely on this behavior, as tidy has always been
17316 # enabled there. These tests are normally run *without* tidy, so specify the
17317 # full output here.
17318 # To test realistic parsing behavior, apply a tidy-like transformation to both
17319 # the expected output and your parser's output.
17320 !! test
17321 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17322 !! wikitext
17323 ******* Foo {{bullet}}
17324 !! html
17325 <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>
17326 <li> Bar</li></ul>
17327
17328 !! end
17329
17330 !! test
17331 Bug 529: Uncovered table already at line-start
17332 !! wikitext
17333 x
17334
17335 {{table}}
17336 y
17337 !! html
17338 <p>x
17339 </p>
17340 <table>
17341 <tr>
17342 <td> 1 </td>
17343 <td> 2
17344 </td></tr>
17345 <tr>
17346 <td> 3 </td>
17347 <td> 4
17348 </td></tr></table>
17349 <p>y
17350 </p>
17351 !! end
17352
17353 !! test
17354 Bug 529: Uncovered bullet in parser function result
17355 !! wikitext
17356 * Foo {{lc:{{bullet}} }}
17357 !! html
17358 <ul><li> Foo </li>
17359 <li> bar</li></ul>
17360
17361 !! end
17362
17363 !! test
17364 Bug 5678: Double-parsed template argument
17365 !! wikitext
17366 {{lc:{{{1}}}|hello}}
17367 !! html
17368 <p>{{{1}}}
17369 </p>
17370 !! end
17371
17372 !! test
17373 Bug 5678: Double-parsed template invocation
17374 !! wikitext
17375 {{lc:{{paramtest {{!}} param = hello }} }}
17376 !! html
17377 <p>{{paramtest | param = hello }}
17378 </p>
17379 !! end
17380
17381 !! test
17382 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17383 !! options
17384 language=cs
17385 title=[[Main Page]]
17386 !! wikitext
17387 {{PRVNÍVELKÉ:ěščř}}
17388 {{prvnívelké:ěščř}}
17389 {{PRVNÍMALÉ:ěščř}}
17390 {{prvnímalé:ěščř}}
17391 {{MALÁ:ěščř}}
17392 {{malá:ěščř}}
17393 {{VELKÁ:ěščř}}
17394 {{velká:ěščř}}
17395 !! html
17396 <p>Ěščř
17397 Ěščř
17398 ěščř
17399 ěščř
17400 ěščř
17401 ěščř
17402 ĚŠČŘ
17403 ĚŠČŘ
17404 </p>
17405 !! end
17406
17407 !! test
17408 Morwen/13: Unclosed link followed by heading
17409 !! wikitext
17410 [[link
17411 ==heading==
17412 !! html
17413 <p>[[link
17414 </p>
17415 <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>
17416
17417 !! end
17418
17419 !! test
17420 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17421 !! wikitext
17422 {{foo|
17423 =heading=
17424 !! html
17425 <p>{{foo|
17426 </p>
17427 <h1><span class="mw-headline" id="heading">heading</span></h1>
17428
17429 !! end
17430
17431 !! test
17432 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17433 !! wikitext
17434 {{foo|
17435 ==heading==
17436 !! html
17437 <p>{{foo|
17438 </p>
17439 <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>
17440
17441 !! end
17442
17443 !! test
17444 Tildes in comments
17445 !! options
17446 pst
17447 !! wikitext
17448 <!-- ~~~~ -->
17449 !! html
17450 <!-- ~~~~ -->
17451 !! end
17452
17453 !! test
17454 Paragraphs inside divs (no extra line breaks)
17455 !! wikitext
17456 <div>Line one
17457
17458 Line two</div>
17459 !! html
17460 <div>Line one
17461 Line two</div>
17462
17463 !! end
17464
17465 !! test
17466 Paragraphs inside divs (extra line break on open)
17467 !! wikitext
17468 <div>
17469 Line one
17470
17471 Line two</div>
17472 !! html
17473 <div>
17474 <p>Line one
17475 </p>
17476 Line two</div>
17477
17478 !! end
17479
17480 !! test
17481 Paragraphs inside divs (extra line break on close)
17482 !! wikitext
17483 <div>Line one
17484
17485 Line two
17486 </div>
17487 !! html
17488 <div>Line one
17489 <p>Line two
17490 </p>
17491 </div>
17492
17493 !! end
17494
17495 !! test
17496 Paragraphs inside divs (extra line break on open and close)
17497 !! wikitext
17498 <div>
17499 Line one
17500
17501 Line two
17502 </div>
17503 !! html
17504 <div>
17505 <p>Line one
17506 </p><p>Line two
17507 </p>
17508 </div>
17509
17510 !! end
17511
17512 !! test
17513 Nesting tags, paragraphs on lines which begin with <div>
17514 !! options
17515 disabled
17516 !! wikitext
17517 <div></div><strong>A
17518 B</strong>
17519 !! html
17520 <div></div>
17521 <p><strong>A
17522 B</strong>
17523 </p>
17524 !! end
17525
17526 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17527 !! test
17528 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17529 !! wikitext
17530 <blockquote>Line one
17531
17532 Line two</blockquote>
17533 !! html
17534 <blockquote>Line one
17535 Line two</blockquote>
17536
17537 !! html+tidy
17538 <blockquote>
17539 <p>Line one Line two</p>
17540 </blockquote>
17541 !! end
17542
17543 !! test
17544 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17545 !! wikitext
17546 <blockquote>
17547 Line one
17548
17549 Line two</blockquote>
17550 !! html
17551 <blockquote>
17552 <p>Line one
17553 </p>
17554 Line two</blockquote>
17555
17556 !! html+tidy
17557 <blockquote>
17558 <p>Line one</p>
17559 Line two</blockquote>
17560 !! end
17561
17562 !! test
17563 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17564 !! wikitext
17565 <blockquote>Line one
17566
17567 Line two
17568 </blockquote>
17569 !! html
17570 <blockquote>Line one
17571 <p>Line two
17572 </p>
17573 </blockquote>
17574
17575 !! html+tidy
17576 <blockquote>
17577 <p>Line one</p>
17578 <p>Line two</p>
17579 </blockquote>
17580 !! end
17581
17582 !! test
17583 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17584 !! wikitext
17585 <blockquote>
17586 Line one
17587
17588 Line two
17589 </blockquote>
17590 !! html
17591 <blockquote>
17592 <p>Line one
17593 </p><p>Line two
17594 </p>
17595 </blockquote>
17596
17597 !! html+tidy
17598 <blockquote>
17599 <p>Line one</p>
17600 <p>Line two</p>
17601 </blockquote>
17602 !! end
17603
17604 !! test
17605 Paragraphs inside blockquotes/divs (no extra line breaks)
17606 !! wikitext
17607 <blockquote><div>Line one
17608
17609 Line two</div></blockquote>
17610 !! html
17611 <blockquote><div>Line one
17612 Line two</div></blockquote>
17613
17614 !! end
17615
17616 !! test
17617 Paragraphs inside blockquotes/divs (extra line break on open)
17618 !! wikitext
17619 <blockquote><div>
17620 Line one
17621
17622 Line two</div></blockquote>
17623 !! html
17624 <blockquote><div>
17625 <p>Line one
17626 </p>
17627 Line two</div></blockquote>
17628
17629 !! end
17630
17631 !! test
17632 Paragraphs inside blockquotes/divs (extra line break on close)
17633 !! wikitext
17634 <blockquote><div>Line one
17635
17636 Line two
17637 </div></blockquote>
17638 !! html
17639 <blockquote><div>Line one
17640 <p>Line two
17641 </p>
17642 </div></blockquote>
17643
17644 !! end
17645
17646 !! test
17647 Paragraphs inside blockquotes/divs (extra line break on open and close)
17648 !! wikitext
17649 <blockquote><div>
17650 Line one
17651
17652 Line two
17653 </div></blockquote>
17654 !! html
17655 <blockquote><div>
17656 <p>Line one
17657 </p><p>Line two
17658 </p>
17659 </div></blockquote>
17660
17661 !! end
17662
17663 !! test
17664 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17665 !! options
17666 wgLinkHolderBatchSize=0
17667 !! wikitext
17668 [[meatball:1]]
17669 [[meatball:2]]
17670 [[meatball:3]]
17671 !! html
17672 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17673 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17674 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17675 </p>
17676 !! end
17677
17678 !! test
17679 Free external link invading image caption
17680 !! wikitext
17681 [[Image:Foobar.jpg|thumb|http://x|hello]]
17682 !! html
17683 <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"></a></div>hello</div></div></div>
17684
17685 !! end
17686
17687 !! test
17688 Bug 15196: localised external link numbers
17689 !! options
17690 language=fa
17691 !! wikitext
17692 [http://en.wikipedia.org/]
17693 !! html/php
17694 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17695 </p>
17696 !! html/parsoid
17697 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17698 !! end
17699
17700 !! test
17701 Multibyte character in padleft
17702 !! wikitext
17703 {{padleft:-Hello|7|Æ}}
17704 !! html
17705 <p>Æ-Hello
17706 </p>
17707 !! end
17708
17709 !! test
17710 Multibyte character in padright
17711 !! wikitext
17712 {{padright:Hello-|7|Æ}}
17713 !! html
17714 <p>Hello-Æ
17715 </p>
17716 !! end
17717
17718 !!test
17719 formatdate parser function
17720 !! wikitext
17721 {{#formatdate:2009-03-24}}
17722 !! html
17723 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17724 </p>
17725 !! end
17726
17727 !!test
17728 formatdate parser function, with default format
17729 !! wikitext
17730 {{#formatdate:2009-03-24|mdy}}
17731 !! html
17732 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17733 </p>
17734 !! end
17735
17736 !! test
17737 Spacing of numbers in formatted dates
17738 !! wikitext
17739 {{#formatdate:January 15}}
17740 !! html
17741 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17742 </p>
17743 !! end
17744
17745 !! test
17746 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
17747 !! options
17748 language=nl title=[[MediaWiki:Common.css]]
17749 !! wikitext
17750 {{#formatdate:2009-03-24|dmy}}
17751 !! html
17752 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17753 </p>
17754 !! end
17755
17756 #
17757 #
17758 #
17759
17760 #
17761 # Edit comments
17762 #
17763
17764 !! test
17765 Edit comment with link
17766 !! options
17767 comment
17768 !! wikitext
17769 I like the [[Main Page]] a lot
17770 !! html
17771 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17772 !!end
17773
17774 !! test
17775 Edit comment with link and link text
17776 !! options
17777 comment
17778 !! wikitext
17779 I like the [[Main Page|best pages]] a lot
17780 !! html
17781 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17782 !!end
17783
17784 !! test
17785 Edit comment with link and link text with suffix
17786 !! options
17787 comment
17788 !! wikitext
17789 I like the [[Main Page|best page]]s a lot
17790 !! html
17791 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17792 !!end
17793
17794 !! test
17795 Edit comment with section link (non-local, eg in history list)
17796 !! options
17797 comment title=[[Main Page]]
17798 !! wikitext
17799 /* External links */ removed bogus entries
17800 !! html
17801 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17802 !!end
17803
17804 !! test
17805 Edit comment with section link and text before it (non-local, eg in history list)
17806 !! options
17807 comment title=[[Main Page]]
17808 !! wikitext
17809 pre-comment text /* External links */ removed bogus entries
17810 !! html
17811 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>
17812 !!end
17813
17814 !! test
17815 Edit comment with section link (local, eg in diff view)
17816 !! options
17817 comment local title=[[Main Page]]
17818 !! wikitext
17819 /* External links */ removed bogus entries
17820 !! html
17821 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17822 !!end
17823
17824 !! test
17825 Edit comment with subpage link (bug 14080)
17826 !! options
17827 comment
17828 subpage
17829 title=[[Subpage test]]
17830 !! wikitext
17831 Poked at a [[/subpage]] here...
17832 !! html
17833 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17834 !!end
17835
17836 !! test
17837 Edit comment with subpage link and link text (bug 14080)
17838 !! options
17839 comment
17840 subpage
17841 title=[[Subpage test]]
17842 !! wikitext
17843 Poked at a [[/subpage|neat little page]] here...
17844 !! html
17845 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17846 !!end
17847
17848 !! test
17849 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17850 !! options
17851 comment
17852 title=[[Subpage test]]
17853 !! wikitext
17854 Poked at a [[/subpage]] here...
17855 !! html
17856 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...
17857 !!end
17858
17859 !! test
17860 Edit comment with bare anchor link (local, as on diff)
17861 !! options
17862 comment
17863 local
17864 title=[[Main Page]]
17865 !! wikitext
17866 [[#section]]
17867 !! html
17868 <a href="#section">#section</a>
17869 !! end
17870
17871 !! test
17872 Edit comment with bare anchor link (non-local, as on history)
17873 !! options
17874 comment
17875 title=[[Main Page]]
17876 !! wikitext
17877 [[#section]]
17878 !! html
17879 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17880 !! end
17881
17882 !! test
17883 Anchor starting with underscore
17884 !! wikitext
17885 [[#_ref|One]]
17886 !! html
17887 <p><a href="#_ref">One</a>
17888 </p>
17889 !! end
17890
17891 !! test
17892 Id starting with underscore
17893 !! wikitext
17894 <div id="_ref"></div>
17895 !! html
17896 <div id="_ref"></div>
17897
17898 !! end
17899
17900 !! test
17901 Space normalisation on autocomment (bug 22784)
17902 !! options
17903 comment
17904 title=[[Main Page]]
17905 !! wikitext
17906 /* __hello__world__ */
17907 !! html
17908 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17909 !! end
17910
17911 !! test
17912 percent-encoding and + signs in comments (Bug 26410)
17913 !! options
17914 comment
17915 !! wikitext
17916 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17917 !! html
17918 <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>
17919 !! end
17920
17921 !! test
17922 Bad images - basic functionality
17923 !! options
17924 disabled
17925 !! wikitext
17926 [[File:Bad.jpg]]
17927 !! html
17928 !! end
17929
17930 !! test
17931 Bad images - bug 16039: text after bad image disappears
17932 !! options
17933 disabled
17934 !! wikitext
17935 Foo bar
17936 [[File:Bad.jpg]]
17937 Bar foo
17938 !! html
17939 <p>Foo bar
17940 </p><p>Bar foo
17941 </p>
17942 !! end
17943
17944 !! test
17945 Verify that displaytitle works (bug #22501) no displaytitle
17946 !! options
17947 showtitle
17948 !! config
17949 wgAllowDisplayTitle=true
17950 wgRestrictDisplayTitle=false
17951 !! wikitext
17952 this is not the the title
17953 !! html
17954 Parser test
17955 <p>this is not the the title
17956 </p>
17957 !! end
17958
17959 !! test
17960 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17961 !! options
17962 showtitle
17963 title=[[Screen]]
17964 !! config
17965 wgAllowDisplayTitle=true
17966 wgRestrictDisplayTitle=false
17967 !! wikitext
17968 this is not the the title
17969 {{DISPLAYTITLE:whatever}}
17970 !! html
17971 whatever
17972 <p>this is not the the title
17973 </p>
17974 !! end
17975
17976 !! test
17977 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17978 !! options
17979 showtitle
17980 title=[[Screen]]
17981 !! config
17982 wgAllowDisplayTitle=true
17983 wgRestrictDisplayTitle=true
17984 !! wikitext
17985 this is not the the title
17986 {{DISPLAYTITLE:whatever}}
17987 !! html
17988 Screen
17989 <p>this is not the the title
17990 </p>
17991 !! end
17992
17993 !! test
17994 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17995 !! options
17996 showtitle
17997 title=[[Screen]]
17998 !! config
17999 wgAllowDisplayTitle=true
18000 wgRestrictDisplayTitle=true
18001 !! wikitext
18002 this is not the the title
18003 {{DISPLAYTITLE:screen}}
18004 !! html
18005 screen
18006 <p>this is not the the title
18007 </p>
18008 !! end
18009
18010 !! test
18011 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18012 !! options
18013 showtitle
18014 title=[[Screen]]
18015 !! config
18016 wgAllowDisplayTitle=false
18017 !! wikitext
18018 this is not the the title
18019 {{DISPLAYTITLE:screen}}
18020 !! html
18021 Screen
18022 <p>this is not the the title
18023 <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>
18024 </p>
18025 !! end
18026
18027 !! test
18028 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18029 !! options
18030 showtitle
18031 title=[[Screen]]
18032 !! config
18033 wgAllowDisplayTitle=false
18034 !! wikitext
18035 this is not the the title
18036 !! html
18037 Screen
18038 <p>this is not the the title
18039 </p>
18040 !! end
18041
18042 !! test
18043 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18044 !! options
18045 showtitle
18046 title=[[Screen]]
18047 !! config
18048 wgAllowDisplayTitle=true
18049 wgRestrictDisplayTitle=true
18050 !! wikitext
18051 this is not the the title
18052 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18053 !! html
18054 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18055 <p>this is not the the title
18056 </p>
18057 !! end
18058
18059 !! test
18060 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18061 !! options
18062 showtitle
18063 title=[[Screen]]
18064 !! config
18065 wgAllowDisplayTitle=true
18066 wgRestrictDisplayTitle=true
18067 !! wikitext
18068 this is not the the title
18069 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18070 !! html
18071 <span style="color: red;">s</span>creen
18072 <p>this is not the the title
18073 </p>
18074 !! end
18075
18076 !! test
18077 preload: check <noinclude> and <includeonly>
18078 !! options
18079 preload
18080 !! wikitext
18081 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18082 !! html
18083 Hello kind world.
18084 !! end
18085
18086 !! test
18087 preload: check <onlyinclude>
18088 !! options
18089 preload
18090 !! wikitext
18091 Goodbye <onlyinclude>Hello world</onlyinclude>
18092 !! html
18093 Hello world
18094 !! end
18095
18096 !! test
18097 preload: can pass tags through if we want to
18098 !! options
18099 preload
18100 !! wikitext
18101 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18102 !! html
18103 <includeonly>Hello world</includeonly>
18104 !! end
18105
18106 !! test
18107 preload: check that it doesn't try to do tricks
18108 !! options
18109 preload
18110 !! wikitext
18111 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18112 !! html
18113 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18114 !! end
18115
18116 !! test
18117 Play a bit with r67090 and bug 3158
18118 !! options
18119 disabled
18120 !! wikitext
18121 <div style="width:50% !important">&nbsp;</div>
18122 <div style="width:50%&nbsp;!important">&nbsp;</div>
18123 <div style="width:50%&#160;!important">&nbsp;</div>
18124 <div style="border : solid;">&nbsp;</div>
18125 !! html
18126 <div style="width:50% !important">&nbsp;</div>
18127 <div style="width:50% !important">&nbsp;</div>
18128 <div style="width:50% !important">&nbsp;</div>
18129 <div style="border&#160;: solid;">&nbsp;</div>
18130
18131 !! end
18132
18133 !! test
18134 HTML5 data attributes
18135 !! wikitext
18136 <span data-foo="bar">Baz</span>
18137 <p data-abc-def_hij="">Quuz</p>
18138 !! html
18139 <p><span data-foo="bar">Baz</span>
18140 </p>
18141 <p data-abc-def_hij="">Quuz</p>
18142
18143 !! end
18144
18145 !! test
18146 percent-encoding and + signs in internal links (Bug 26410)
18147 !! wikitext
18148 [[User:+%]] [[Page+title%]]
18149 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18150 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18151 [[%33%45]] [[%33%45+]]
18152 !! html
18153 <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>
18154 <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>
18155 <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>
18156 <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>
18157 </p>
18158 !! end
18159
18160 !! test
18161 Special characters in embedded file links (bug 27679)
18162 !! wikitext
18163 [[File:Contains & ampersand.jpg]]
18164 [[File:Does not exist.jpg|Title with & ampersand]]
18165 !! html
18166 <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>
18167 <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>
18168 </p>
18169 !! end
18170
18171
18172 !! test
18173 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18174 !! wikitext
18175 Text&apos;s been normalized?
18176 !! html
18177 <p>Text&#39;s been normalized?
18178 </p>
18179 !! end
18180
18181 !! test
18182 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18183 !! wikitext
18184 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18185 !! html
18186 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18187 </p>
18188 !! end
18189
18190 !! test
18191 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18192 !! wikitext
18193 [http://www.example.org/ ideograms]
18194 !! html
18195 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18196 </p>
18197 !! end
18198
18199 !! test
18200 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18201 !! wikitext
18202 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18203 !! html
18204 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18205 </p>
18206 !! end
18207
18208 !! article
18209 Mediawiki:loop1
18210 !! text
18211 {{Identical|A}}
18212 !! endarticle
18213
18214 !! article
18215 Mediawiki:loop2
18216 !! text
18217 {{Identical|B}}
18218 !! endarticle
18219
18220 !! article
18221 Template:Identical
18222 !! text
18223 {{int:loop1}}
18224 {{int:loop2}}
18225 !! endarticle
18226
18227 !! test
18228 Bug 31098 Template which includes system messages which includes the template
18229 !! wikitext
18230 {{Identical}}
18231 !! html
18232 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18233 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18234 </p>
18235 !! end
18236
18237 !! test
18238 Bug31490 Turkish: ucfirst 'blah'
18239 !! options
18240 language=tr
18241 !! wikitext
18242 {{ucfirst:blah}}
18243 !! html
18244 <p>Blah
18245 </p>
18246 !! end
18247
18248 !! test
18249 Bug31490 Turkish: ucfirst 'ix'
18250 !! options
18251 language=tr
18252 !! wikitext
18253 {{ucfirst:ix}}
18254 !! html
18255 <p>İx
18256 </p>
18257 !! end
18258
18259 !! test
18260 Bug31490 Turkish: lcfirst 'BLAH'
18261 !! options
18262 language=tr
18263 !! wikitext
18264 {{lcfirst:BLAH}}
18265 !! html
18266 <p>bLAH
18267 </p>
18268 !! end
18269
18270 !! test
18271 Bug31490 Turkish: ucfırst (with a dotless i)
18272 !! options
18273 language=tr
18274 !! wikitext
18275 {{ucfırst:blah}}
18276 !! html
18277 <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>
18278 </p>
18279 !! end
18280
18281 !! test
18282 Bug31490 ucfırst (with a dotless i) with English language
18283 !! options
18284 language=en
18285 !! wikitext
18286 {{ucfırst:blah}}
18287 !! html
18288 <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>
18289 </p>
18290 !! end
18291
18292 !! test
18293 Bug 26375: TOC with italics
18294 !! options
18295 title=[[Main Page]]
18296 !! wikitext
18297 __TOC__
18298 == ''Lost'' episodes ==
18299 !! html
18300 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18301 <ul>
18302 <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>
18303 </ul>
18304 </div>
18305
18306 <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>
18307
18308 !! end
18309
18310 !! test
18311 Bug 26375: TOC with bold
18312 !! options
18313 title=[[Main Page]]
18314 !! wikitext
18315 __TOC__
18316 == '''should be bold''' then normal text ==
18317 !! html
18318 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18319 <ul>
18320 <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>
18321 </ul>
18322 </div>
18323
18324 <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>
18325
18326 !! end
18327
18328 !! test
18329 Bug 33845: Headings become cursive in TOC when they contain an image
18330 !! options
18331 title=[[Main Page]]
18332 !! wikitext
18333 __TOC__
18334 == Image [[Image:foobar.jpg]] ==
18335 !! html
18336 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18337 <ul>
18338 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18339 </ul>
18340 </div>
18341
18342 <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>
18343
18344 !! end
18345
18346 !! test
18347 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18348 !! options
18349 title=[[Main Page]]
18350 !! wikitext
18351 __TOC__
18352 == <blockquote>Quote</blockquote> ==
18353 !! html
18354 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18355 <ul>
18356 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18357 </ul>
18358 </div>
18359
18360 <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>
18361
18362 !! html+tidy
18363 <div id="toc" class="toc">
18364 <div id="toctitle">
18365 <h2>Contents</h2>
18366 </div>
18367 <ul>
18368 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18369 </ul>
18370 </div>
18371 <h2><span class="mw-headline" id="Quote"></span></h2>
18372 <blockquote>
18373 <p><span class="mw-headline" id="Quote">Quote</span></p>
18374 </blockquote>
18375 <p><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></p>
18376 !! end
18377
18378 !! test
18379 Unclosed tags in TOC
18380 !! options
18381 title=[[Main Page]]
18382 !! wikitext
18383 __TOC__
18384 == Proof: 2 < 3 ==
18385 <small>Hanc marginis exiguitas non caperet.</small>
18386 QED
18387 !! html
18388 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18389 <ul>
18390 <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>
18391 </ul>
18392 </div>
18393
18394 <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>
18395 <p><small>Hanc marginis exiguitas non caperet.</small>
18396 QED
18397 </p>
18398 !! end
18399
18400 !! test
18401 Multiple tags in TOC
18402 !! wikitext
18403 __TOC__
18404 == <i>Foo</i> <b>Bar</b> ==
18405
18406 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18407 !! html
18408 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18409 <ul>
18410 <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>
18411 <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>
18412 </ul>
18413 </div>
18414
18415 <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>
18416 <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>
18417
18418 !! html+tidy
18419 <div id="toc" class="toc">
18420 <div id="toctitle">
18421 <h2>Contents</h2>
18422 </div>
18423 <ul>
18424 <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>
18425 <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>
18426 </ul>
18427 </div>
18428 <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>
18429 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18430 <blockquote>
18431 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18432 </blockquote>
18433 <p><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></p>
18434 !! end
18435
18436 !! test
18437 Tags with parameters in TOC
18438 !! wikitext
18439 __TOC__
18440 == <sup class="in-h2">Hello</sup> ==
18441
18442 == <sup class="a > b">Evilbye</sup> ==
18443 !! html
18444 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18445 <ul>
18446 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18447 <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>
18448 </ul>
18449 </div>
18450
18451 <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>
18452 <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>
18453
18454 !! end
18455
18456 !! test
18457 span tags with directionality in TOC
18458 !! wikitext
18459 __TOC__
18460 == <span dir="ltr">C++</span> ==
18461
18462 == <span dir="rtl">זבנג!</span> ==
18463
18464 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18465
18466 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18467
18468 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18469 !! html
18470 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18471 <ul>
18472 <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>
18473 <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>
18474 <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>
18475 <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>
18476 <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>
18477 </ul>
18478 </div>
18479
18480 <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>
18481 <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>
18482 <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>
18483 <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>
18484 <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>
18485
18486 !! end
18487
18488 !! article
18489 MediaWiki:Bug32057
18490 !! text
18491 == {{int:headline_sample}} ==
18492 !! endarticle
18493
18494 !! test
18495 Bug 32057: Title needed when expanding <h> nodes.
18496 !! options
18497 title=[[Main Page]]
18498 !! wikitext
18499 {{int:Bug32057}}
18500 !! html
18501 <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>
18502
18503 !! end
18504
18505 !! test
18506 Strip marker in urlencode
18507 !! wikitext
18508 {{urlencode:x<nowiki/>y}}
18509 {{urlencode:x<nowiki/>y|wiki}}
18510 {{urlencode:x<nowiki/>y|path}}
18511 !! html
18512 <p>xy
18513 xy
18514 xy
18515 </p>
18516 !! end
18517
18518 !! test
18519 Strip marker in lc
18520 !! wikitext
18521 {{lc:x<nowiki/>y}}
18522 !! html
18523 <p>xy
18524 </p>
18525 !! end
18526
18527 !! test
18528 Strip marker in uc
18529 !! wikitext
18530 {{uc:x<nowiki/>y}}
18531 !! html
18532 <p>XY
18533 </p>
18534 !! end
18535
18536 !! test
18537 Strip marker in formatNum
18538 !! wikitext
18539 {{formatnum:1<nowiki/>2}}
18540 {{formatnum:1<nowiki/>2|R}}
18541 !! html
18542 <p>12
18543 12
18544 </p>
18545 !! end
18546
18547 !! test
18548 Check noCommafy in formatNum
18549 !! options
18550 language=be-tarask
18551 !! wikitext
18552 {{formatnum:123456.78}}
18553 {{formatnum:123456.78|NOSEP}}
18554 !! html
18555 <p>123 456,78
18556 123456.78
18557 </p>
18558 !! end
18559
18560 !! test
18561 Wrong option for formatNum (bug 56199)
18562 !! wikitext
18563 {{formatnum:1,234.56|Random}}
18564 {{formatnum:1,234.56|EVERYTHING}}
18565 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18566 !! html
18567 <p>1,234.56
18568 1,234.56
18569 1,234.56
18570 </p>
18571 !! end
18572
18573 !! test
18574 Strip marker in grammar
18575 !! options
18576 language=fi
18577 !! wikitext
18578 {{grammar:elative|foo<nowiki/>bar}}
18579 !! html
18580 <p>foobarista
18581 </p>
18582 !! end
18583
18584 !! test
18585 Strip marker in padleft
18586 !! wikitext
18587 {{padleft:|2|x<nowiki/>y}}
18588 !! html
18589 <p>xy
18590 </p>
18591 !! end
18592
18593 !! test
18594 Strip marker in padright
18595 !! wikitext
18596 {{padright:|2|x<nowiki/>y}}
18597 !! html
18598 <p>xy
18599 </p>
18600 !! end
18601
18602 !! test
18603 Strip marker in anchorencode
18604 !! wikitext
18605 {{anchorencode:x<nowiki/>y}}
18606 !! html
18607 <p>xy
18608 </p>
18609 !! end
18610
18611 !! test
18612 nowiki inside link inside heading (bug 18295)
18613 !! wikitext
18614 ==[[foo|x<nowiki>y</nowiki>z]]==
18615 !! html
18616 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">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>
18617
18618 !! end
18619
18620 !! test
18621 new support for bdi element (bug 31817)
18622 !! wikitext
18623 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18624 !! html
18625 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18626
18627 !!end
18628
18629 !! test
18630 Ignore pipe between table row attributes
18631 !! wikitext
18632 {|
18633 | quux
18634 |- id=foo | style='color: red'
18635 | bar
18636 |}
18637 !! html
18638 <table>
18639 <tr>
18640 <td> quux
18641 </td></tr>
18642 <tr id="foo" style="color: red">
18643 <td> bar
18644 </td></tr></table>
18645
18646 !! end
18647
18648 !!test
18649 Gallery override link with WikiLink (bug 34852)
18650 !! wikitext
18651 <gallery>
18652 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18653 </gallery>
18654 !! html
18655 <ul class="gallery mw-gallery-traditional">
18656 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18657 <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>
18658 <div class="gallerytext">
18659 <p>caption
18660 </p>
18661 </div>
18662 </div></li>
18663 </ul>
18664
18665 !! end
18666
18667 !!test
18668 Gallery override link with absolute external link (bug 34852)
18669 !! wikitext
18670 <gallery>
18671 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18672 </gallery>
18673 !! html
18674 <ul class="gallery mw-gallery-traditional">
18675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18676 <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>
18677 <div class="gallerytext">
18678 <p>caption
18679 </p>
18680 </div>
18681 </div></li>
18682 </ul>
18683
18684 !! end
18685
18686 !!test
18687 Gallery override link with malicious javascript (bug 34852)
18688 !! wikitext
18689 <gallery>
18690 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18691 </gallery>
18692 !! html
18693 <ul class="gallery mw-gallery-traditional">
18694 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18695 <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>
18696 <div class="gallerytext">
18697 <p>caption
18698 </p>
18699 </div>
18700 </div></li>
18701 </ul>
18702
18703 !! end
18704
18705 !!test
18706 Gallery with invalid title as link (bug 43964)
18707 !! wikitext
18708 <gallery>
18709 File:foobar.jpg|link=<
18710 </gallery>
18711 !! html
18712 <ul class="gallery mw-gallery-traditional">
18713 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18714 <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>
18715 <div class="gallerytext">
18716 </div>
18717 </div></li>
18718 </ul>
18719
18720 !! end
18721
18722 !!test
18723 Language parser function
18724 !! wikitext
18725 {{#language:ar}}
18726 !! html
18727 <p>العربية
18728 </p>
18729 !! end
18730
18731 !!test
18732 Padleft and padright as substr
18733 !! wikitext
18734 {{padleft:|3|abcde}}
18735 {{padright:|3|abcde}}
18736 !! html
18737 <p>abc
18738 abc
18739 </p>
18740 !! end
18741
18742 !!test
18743 Special parser function
18744 !! wikitext
18745 {{#special:RandomPage}}
18746 {{#special:BaDtItLe}}
18747 {{#special:Foobar}}
18748 !! html
18749 <p>Special:Random
18750 Special:Badtitle
18751 Special:Foobar
18752 </p>
18753 !! end
18754
18755 !!test
18756 Bug 34939 - Case insensitive link parsing ([HttP://])
18757 !! wikitext
18758 [HttP://MediaWiki.Org/]
18759 !! html/php
18760 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18761 </p>
18762 !! html/parsoid
18763 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18764 !! end
18765
18766 !!test
18767 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18768 !! wikitext
18769 [HttP://MediaWiki.Org/ MediaWiki]
18770 !! html
18771 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18772 </p>
18773 !! end
18774
18775 !!test
18776 Bug 34939 - Case insensitive link parsing (HttP://)
18777 !! wikitext
18778 HttP://MediaWiki.Org/
18779 !! html/php
18780 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18781 </p>
18782 !! html/parsoid
18783 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18784 !! end
18785
18786 !!test
18787 Disable TOC
18788 !! options
18789 notoc
18790 !! wikitext
18791 Lead
18792 == Section 1 ==
18793 == Section 2 ==
18794 == Section 3 ==
18795 == Section 4 ==
18796 == Section 5 ==
18797 !! html
18798 <p>Lead
18799 </p>
18800
18801 <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>
18802 <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>
18803 <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>
18804 <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>
18805 <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>
18806
18807 !! end
18808
18809
18810 ###
18811 ### Parsoid-specific tests
18812 ### Parsoid-PHP parser incompatibilities
18813 ###
18814 !!test
18815 1. SOL-sensitive wikitext tokens as template-args
18816 !!options
18817 parsoid=wt2html,wt2wt
18818 !! wikitext
18819 {{echo|*a}}
18820 {{echo|#a}}
18821 {{echo|:a}}
18822 !! html
18823 <span about="#mwt1" typeof="mw:Transclusion">
18824 </span><ul about="#mwt1"><li>a</li>
18825 </ul>
18826 <span about="#mwt2" typeof="mw:Transclusion">
18827 </span><ol about="#mwt2"><li>a</li>
18828 </ol>
18829 <span about="#mwt3" typeof="mw:Transclusion">
18830 </span><dl about="#mwt3"><dd>a</dd>
18831 </dl>
18832 !!end
18833
18834 #### -----------------------------------------------------------------
18835 #### Parsoid-specific functionality tests
18836 #### -----------------------------------------------------------------
18837
18838 # Bug 63642: Formatting elt fixup is cleaned up.
18839 # We know wt2wt will fail, but we expect selser to pass.
18840 # Due to the nature of our testing, wt2wt and selser tests will enter the
18841 # blacklist and we'll catch selser regressions based on changes to the
18842 # blacklist entries for selser tests.
18843 !! test
18844 Bad treebuilder fixup of formatting elt is cleaned up
18845 !! options
18846 parsoid=wt2html,wt2wt
18847 !! wikitext
18848 {|
18849 |
18850 <small>
18851 [[Image:Foobar.jpg|right|Test]]
18852 </small>
18853 |}
18854 !! html/parsoid
18855 <table>
18856 <tbody><tr><td>
18857 <p><small></small></p>
18858 <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>
18859 <p></p></td></tr>
18860 </tbody></table>
18861 !! end
18862
18863 #### ----------------------------------------------------------------
18864 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18865 #### tags. Parsoid's output for these tags differs from that of the
18866 #### PHP parser.
18867 #### ----------------------------------------------------------------
18868
18869 !!test
18870 Ref: 1. ref-location should be replaced with an index span
18871 !!options
18872 parsoid
18873 !! wikitext
18874 A <ref>foo</ref>
18875 B <ref name="x">foo</ref>
18876 C <ref name="y" />
18877 !! html
18878 <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>
18879 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>
18880 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>
18881 !!end
18882
18883 !!test
18884 Ref: 2. ref-tags with identical names should all get the same index
18885 !!options
18886 parsoid
18887 !! wikitext
18888 A <ref name="x">foo</ref>
18889 B <ref name="x" />
18890 !! html
18891 <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>
18892 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>
18893 !!end
18894
18895 !!test
18896 Ref: 3. spaces in ref-names should be ignored
18897 !!options
18898 parsoid
18899 !! wikitext
18900 A <ref name="x">foo</ref>
18901 B <ref name=" x " />
18902 C <ref name= x />
18903 !! html
18904 <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>
18905 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>
18906 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>
18907 !!end
18908
18909 !!test
18910 Ref: 4. 'constructor' should be accepted as a valid ref-name
18911 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18912 !!options
18913 parsoid
18914 !! wikitext
18915 A <ref name="constructor">foo</ref>
18916 !! html
18917 <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>
18918 !!end
18919
18920 !!test
18921 Ref: 5. body should accept generic wikitext
18922 !!options
18923 parsoid
18924 !! wikitext
18925 A <ref>
18926 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18927 </ref>
18928
18929 <references />
18930 !! html
18931 <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\" title=\"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>
18932
18933 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18934 <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" title="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>
18935 </li>
18936 </ol>
18937 !!end
18938
18939 !!test
18940 Ref: 6. indent-pres should not be output in ref-body
18941 !!options
18942 parsoid
18943 !! wikitext
18944 A <ref>
18945 foo
18946 bar
18947 baz
18948 </ref>
18949
18950 <references />
18951 !! html
18952 <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>
18953
18954 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18955 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18956 bar
18957 baz
18958 </li>
18959 </ol>
18960 !!end
18961
18962 !!test
18963 Ref: 7. No p-wrapping in ref-body
18964 !!options
18965 parsoid
18966 !! wikitext
18967 A <ref>
18968 foo
18969
18970 bar
18971
18972
18973 baz
18974
18975
18976
18977 booz
18978 </ref>
18979
18980 <references />
18981 !! html
18982 <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>
18983
18984 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18985 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18986
18987 bar
18988
18989
18990 baz
18991
18992
18993
18994 booz
18995 </li>
18996 </ol>
18997 !!end
18998
18999 !!test
19000 Ref: 8. transclusion wikitext has lower precedence
19001 !!options
19002 parsoid
19003 !! wikitext
19004 A <ref> foo {{echo|</ref> B C}}
19005
19006 <references />
19007 !! html
19008 <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>
19009 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
19010 <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>
19011 </ol>
19012 !!end
19013
19014 !!test
19015 Ref: 9. unclosed comments should not leak out of ref-body
19016 !!options
19017 parsoid
19018 !! wikitext
19019 A <ref> foo <!--</ref> B C
19020 <references />
19021 !! html
19022 <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>
19023 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19024 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
19025 </ol>
19026 !!end
19027
19028 !!test
19029 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19030 !!options
19031 parsoid
19032 !! wikitext
19033 A <ref> <b> foo </ref> B C
19034
19035 <references />
19036 !! html
19037 <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>
19038
19039
19040 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
19041 <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>
19042 </ol>
19043 !!end
19044
19045 !!test
19046 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19047 !!options
19048 parsoid
19049 !! wikitext
19050 A <ref>foo</ref> B
19051 C <ref>bar</ref> D
19052 !! html
19053 <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
19054 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>
19055 !!end
19056
19057 !!test
19058 Ref: 12. ref-tags act as trailing newline migration barrier
19059 !!options
19060 parsoid
19061 !! wikitext
19062 <!--the newline at the end of this line moves out of the p-tag-->a
19063
19064 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19065 <ref />
19066
19067 c
19068 !! html
19069 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19070
19071
19072 <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>
19073 <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>
19074
19075
19076 <p>c</p>
19077 !!end
19078
19079 !!test
19080 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19081 !!options
19082 parsoid
19083 !! wikitext
19084 <ref>foo</ref> A
19085 <ref>bar
19086 </ref> B
19087 !! html
19088 <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
19089 <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>
19090 !!end
19091
19092 !!test
19093 Ref: 14. A nested ref-tag should be emitted as plain text
19094 !!options
19095 parsoid
19096 !! wikitext
19097 <ref>foo <ref>bar</ref> baz</ref>
19098
19099 <references />
19100 !! html
19101 <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>
19102
19103 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
19104 <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>
19105 </ol>
19106 !!end
19107
19108 !!test
19109 Ref: 15. ref-tags with identical names should get identical indexes
19110 !!options
19111 parsoid
19112 !! wikitext
19113 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19114 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19115
19116 <references />
19117 !! html
19118 <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>
19119 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>
19120
19121 <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>
19122 </ol>
19123 !!end
19124
19125 ## We don't bother wt2wt-ing non-standard whitespace
19126 !!test
19127 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19128 !!options
19129 parsoid=wt2html
19130 !! wikitext
19131 A <ref >foo</ref >
19132
19133 <references />
19134 !! html
19135 <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>
19136
19137 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19138 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19139 !!end
19140
19141 !!test
19142 References: 1. references tag without any refs should be handled properly
19143 !!options
19144 parsoid
19145 !! wikitext
19146 <references />
19147 !! html
19148 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19149 !!end
19150
19151 !!test
19152 References: 2. references tag with group only outputs references from that group
19153 !!options
19154 parsoid
19155 !! wikitext
19156 A <ref group="a">foo</ref>
19157 B <ref group="b">bar</ref>
19158
19159 <references group="a" />
19160 !! html
19161 <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>
19162 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>
19163
19164 <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>
19165 </ol>
19166 !!end
19167
19168 !!test
19169 References: 3. ref list should be cleared after processing references
19170 !!options
19171 parsoid
19172 !! wikitext
19173 A <ref>foo</ref>
19174
19175 <references />
19176
19177 B <ref>bar</ref>
19178
19179 <references />
19180 !! html
19181 <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>
19182
19183 <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>
19184 </ol>
19185
19186 <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>
19187
19188 <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>
19189 </ol>
19190 !!end
19191
19192 !!test
19193 References: 4. only referenced group should be cleared after processing references
19194 !!options
19195 parsoid
19196 !! wikitext
19197 A <ref group="a">afoo</ref>
19198 B <ref>bfoo</ref>
19199
19200 <references group="a" />
19201
19202 C <ref>cfoo</ref>
19203
19204 <references />
19205 !! html
19206 <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>
19207 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>
19208
19209 <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>
19210 </ol>
19211
19212 <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>
19213
19214 <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>
19215 </ol>
19216 !!end
19217
19218 !!test
19219 References: 5. ref tags in references should be processed while ignoring all other content
19220 !!options
19221 parsoid
19222 !! wikitext
19223 A <ref name="a" />
19224 B <ref name="b">bar</ref>
19225
19226 <references>
19227 <ref name="a">foo</ref>
19228 This should just get lost.
19229 </references>
19230 !! html
19231 <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>
19232 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>
19233
19234
19235 <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":{}}'>
19236 <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>
19237 <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>
19238 </ol>
19239 !!end
19240
19241 !!test
19242 References: 6. <references /> from a transclusion
19243 !!options
19244 parsoid
19245 !! wikitext
19246 <ref>Foo</ref> {{echo|<references />}}
19247 !! html
19248 <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>
19249 !!end
19250
19251 !! test
19252 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19253 !! options
19254 parsoid
19255 !! wikitext
19256 A <ref>foo bar for a</ref>
19257 B <ref group="X" name="b" />
19258
19259 <references />
19260
19261 <references group="X">
19262 <ref name="b">foo</ref>
19263 </references>
19264 !! html
19265 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span>
19266 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref group=\"X\" name=\"b\" />"}'><a href="#cite_note-b-2" data-parsoid="{}">[X 1]</a></span></p>
19267
19268 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><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 bar for a</li></ol>
19269
19270 <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-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-2-0" data-parsoid="{}">↑</a></span> foo</li></ol>
19271 !! end
19272
19273 !! test
19274 Entities in ref name
19275 !! options
19276 parsoid
19277 !! wikitext
19278 <ref name="test &amp; me">hi</ref>
19279 !! html
19280 <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>
19281 !! end
19282
19283 # This test is wt2html only because we're permitting the serializer to produce
19284 # dirty diffs, normalizing the unclosed references to the self-closed version.
19285 !! test
19286 Generate references for unclosed references tag
19287 !! options
19288 parsoid=wt2html
19289 !! wikitext
19290 a<ref>foo</ref>
19291
19292 <references>
19293 !! html
19294 <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>
19295
19296
19297 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
19298 <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>
19299 !! end
19300
19301 !! test
19302 New reference serializes on its own line
19303 !! options
19304 parsoid=wt2wt,html2wt
19305 !! wikitext
19306 foo
19307 <references />
19308 !! html
19309 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19310 !! end
19311
19312 #### ----------------------------------------------------------------
19313 #### The following section of tests are primarily to test
19314 #### wikitext escaping capabilities of Parsoid. Given that
19315 #### escaping can be done any number of ways, the wikitext (input)
19316 #### is always adjusted to reflect how Parsoid adds nowiki
19317 #### escape tags.
19318 ####
19319 #### We are marking several tests as parsoid-only since the
19320 #### HTML in the result section is different from what the
19321 #### PHP parser generates for it.
19322 #### ----------------------------------------------------------------
19323
19324
19325 #### --------------- Headings ---------------
19326 #### 0. Unnested
19327 #### 1. Nested inside html <h1>=foo=</h1>
19328 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19329 #### 3. Nested inside html with wikitext split by html tags
19330 #### 4. No escape needed
19331 #### 5. Empty headings <h1></h1>
19332 #### 6. Heading chars in SOL context
19333 #### ----------------------------------------
19334 !! test
19335 Headings: 0. Unnested
19336 !! options
19337 parsoid
19338 !! wikitext
19339 <nowiki>=foo=</nowiki>
19340
19341 <nowiki> =foo= </nowiki>
19342 <!--cmt-->
19343 <nowiki>=foo=</nowiki>
19344
19345 =foo''a''<nowiki>=</nowiki>
19346 !! html
19347 <p><span typeof="mw:Nowiki">=foo=</span></p>
19348
19349 <p><span typeof="mw:Nowiki"> =foo= </span>
19350 <!--cmt-->
19351 <span typeof="mw:Nowiki">=foo=</span></p>
19352
19353 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19354 !!end
19355
19356 !! test
19357 Headings: 1. Nested inside html
19358 (New headings and existing headings are handled differently)
19359 !! options
19360 parsoid=html2wt
19361 !! wikitext
19362 = =foo= =
19363
19364 == =foo= ==
19365
19366 === =foo= ===
19367
19368 =<nowiki>=foo=</nowiki>=
19369 ==<nowiki>=foo=</nowiki>==
19370 ===<nowiki>=foo=</nowiki>===
19371 ====<nowiki>=foo=</nowiki>====
19372 =====<nowiki>=foo=</nowiki>=====
19373 ======<nowiki>=foo=</nowiki>======
19374
19375 !! html
19376 <h1>=foo=</h1>
19377 <h2>=foo=</h2>
19378 <h3>=foo=</h3>
19379
19380 <h1 data-parsoid='{}'>=foo=</h1>
19381 <h2 data-parsoid='{}'>=foo=</h2>
19382 <h3 data-parsoid='{}'>=foo=</h3>
19383 <h4 data-parsoid='{}'>=foo=</h4>
19384 <h5 data-parsoid='{}'>=foo=</h5>
19385 <h6 data-parsoid='{}'>=foo=</h6>
19386 !!end
19387
19388 !! test
19389 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19390 !! options
19391 parsoid=html2wt
19392 !! wikitext
19393 = foo =
19394 <nowiki>*</nowiki>bar
19395
19396 = foo =
19397 =bar
19398
19399 = foo =
19400 <nowiki>=bar=</nowiki>
19401 !! html
19402 <h1>foo</h1>*bar
19403 <h1>foo</h1>=bar
19404 <h1>foo</h1>=bar=
19405 !!end
19406
19407 !! test
19408 Headings: 3. Nested inside html with wikitext split by html tags
19409 !! options
19410 parsoid=html2wt
19411 !! wikitext
19412 = ='''bold'''<nowiki>foo=</nowiki> =
19413 !! html
19414 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19415 !!end
19416
19417 !! test
19418 Headings: 4a. No escaping needed (testing just h1 and h2)
19419 !! options
19420 parsoid=html2wt
19421 !! wikitext
19422 = =foo =
19423
19424 = foo= =
19425
19426 = =foo= =
19427
19428 = =foo= bar =
19429
19430 == =foo ==
19431
19432 == foo= ==
19433
19434 = ''=''foo= =
19435
19436 = <nowiki>=</nowiki> =
19437 !! html
19438 <h1>=foo</h1>
19439 <h1>foo=</h1>
19440 <h1> =foo= </h1>
19441 <h1>=foo= bar</h1>
19442 <h2>=foo</h2>
19443 <h2>foo=</h2>
19444 <h1><i>=</i>foo=</h1>
19445 <h1><span typeof="mw:Nowiki">=</span></h1>
19446 !!end
19447
19448 !! test
19449 Headings: 4b. No escaping needed (inside p-tags)
19450 !! options
19451 parsoid=html2wt
19452 !! wikitext
19453 ===
19454 =foo= x
19455 =foo= <s></s>
19456 !! html
19457 <p>===
19458 =foo= x
19459 =foo= <s></s>
19460 </p>
19461 !!end
19462
19463 !! test
19464 Headings: 5. Empty headings
19465 !! options
19466 parsoid
19467 !! wikitext
19468 =<nowiki/>=
19469
19470 ==<nowiki/>==
19471
19472 ===<nowiki/>===
19473
19474 ====<nowiki/>====
19475
19476 =====<nowiki/>=====
19477
19478 ======<nowiki/>======
19479 !! html
19480 <h1></h1>
19481 <h2></h2>
19482 <h3></h3>
19483 <h4></h4>
19484 <h5></h5>
19485 <h6></h6>
19486 !!end
19487
19488 !! test
19489 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19490 !! options
19491 parsoid
19492 !! wikitext
19493 <nowiki>=a=</nowiki>
19494
19495 <nowiki>=a=</nowiki>
19496
19497 <nowiki>=a=</nowiki>
19498
19499 <nowiki>=a=</nowiki>
19500 !! html
19501 <p>=a=</p>
19502 <p>=a= </p>
19503 <p>=a= </p>
19504 <p>=a= </p>
19505 !!end
19506
19507 !! test
19508 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19509 !! options
19510 parsoid
19511 !! wikitext
19512 <nowiki>=a=
19513 b</nowiki>
19514
19515 <nowiki>=a=
19516 b</nowiki>
19517
19518 <nowiki>=a=
19519 b</nowiki>
19520
19521 <nowiki>=a=
19522 b</nowiki>
19523 !! html
19524 <p>=a=
19525 b</p>
19526 <p>=a=
19527 b</p>
19528 <p>=a=
19529 b</p>
19530 <p>=a=
19531 b</p>
19532 </p>
19533 !!end
19534
19535 !! test
19536 Headings: 6c. Heading chars in SOL context (leading newline break)
19537 !! options
19538 parsoid
19539 !! wikitext
19540 a
19541 <nowiki>=b=</nowiki>
19542 !! html
19543 <p>a
19544 =b=</p>
19545 !!end
19546
19547 !! test
19548 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19549 !! options
19550 parsoid
19551 !! wikitext
19552 <!--c0--><nowiki>=a=</nowiki>
19553
19554 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
19555 !! html
19556 <p><!--c0-->=a=</p>
19557 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
19558 !!end
19559
19560 !! test
19561 Headings: 6d. Heading chars in SOL context (No escaping needed)
19562 !! options
19563 parsoid=html2wt
19564 !! wikitext
19565 =a=<div>b</div>
19566 !! html
19567 =a=<div>b</div>
19568 !!end
19569
19570 #### --------------- Lists ---------------
19571 #### 0. Outside nests (*foo, etc.)
19572 #### 1. Nested inside html <ul><li>*foo</li></ul>
19573 #### 2. Inside definition lists
19574 #### 3. Only bullets at start should be escaped
19575 #### 4. No escapes needed
19576 #### 5. No unnecessary escapes
19577 #### 6. Escape bullets in SOL position
19578 #### 7. Escape bullets in a multi-line context
19579 #### ----------------------------------------
19580
19581 !! test
19582 Lists: 0. Outside nests
19583 !! wikitext
19584 <nowiki>*</nowiki>foo
19585
19586 <nowiki>#</nowiki>foo
19587
19588 <nowiki>;Foo:</nowiki>bar
19589 !! html
19590 <p>*foo
19591 </p><p>#foo
19592 </p><p>;Foo:bar
19593 </p>
19594 !!end
19595
19596 !! test
19597 Lists: 1. Nested inside html
19598 !! wikitext
19599 *<nowiki>*foo</nowiki>
19600
19601 *<nowiki>#foo</nowiki>
19602
19603 *<nowiki>:foo</nowiki>
19604
19605 *<nowiki>;foo</nowiki>
19606
19607 #<nowiki>*foo</nowiki>
19608
19609 #<nowiki>#foo</nowiki>
19610
19611 #<nowiki>:foo</nowiki>
19612
19613 #<nowiki>;foo</nowiki>
19614 !! html
19615 <ul><li>*foo</li></ul>
19616 <ul><li>#foo</li></ul>
19617 <ul><li>:foo</li></ul>
19618 <ul><li>;foo</li></ul>
19619 <ol><li>*foo</li></ol>
19620 <ol><li>#foo</li></ol>
19621 <ol><li>:foo</li></ol>
19622 <ol><li>;foo</li></ol>
19623
19624 !!end
19625
19626 !! test
19627 Lists: 2. Inside definition lists
19628 !! wikitext
19629 ;<nowiki>;foo</nowiki>
19630
19631 ;<nowiki>:foo</nowiki>
19632
19633 ;<nowiki>:foo</nowiki>
19634 :bar
19635
19636 :<nowiki>:foo</nowiki>
19637 !! html
19638 <dl><dt>;foo</dt></dl>
19639 <dl><dt>:foo</dt></dl>
19640 <dl><dt>:foo</dt>
19641 <dd>bar</dd></dl>
19642 <dl><dd>:foo</dd></dl>
19643
19644 !!end
19645
19646 !! test
19647 Lists: 3. Only bullets at start of text should be escaped
19648 !! wikitext
19649 *<nowiki>*foo*bar</nowiki>
19650
19651 *<nowiki>*foo</nowiki>''it''*bar
19652 !! html
19653 <ul><li>*foo*bar</li></ul>
19654 <ul><li>*foo<i>it</i>*bar</li></ul>
19655
19656 !!end
19657
19658 !! test
19659 Lists: 4. No escapes needed
19660 !! options
19661 parsoid
19662 !! wikitext
19663 *foo*bar
19664
19665 *''foo''*bar
19666
19667 *[[Foo]]: bar
19668
19669 *[[Foo]]*bar
19670 !! html
19671 <ul>
19672 <li>foo*bar
19673 </li>
19674 </ul>
19675 <ul>
19676 <li><i>foo</i>*bar
19677 </li>
19678 </ul>
19679 <ul>
19680 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
19681 </li>
19682 </ul>
19683 <ul>
19684 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
19685 </li>
19686 </ul>
19687 !!end
19688
19689 !! test
19690 Lists: 5. No unnecessary escapes
19691 !! wikitext
19692 * bar <span><nowiki>[[foo]]</nowiki></span>
19693
19694 *=bar <span><nowiki>[[foo]]</nowiki></span>
19695
19696 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19697
19698 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19699
19700 *=bar <span>foo]]</span>=
19701
19702 * <s></s>: a
19703 !! html
19704 <ul><li> bar <span>[[foo]]</span></li></ul>
19705 <ul><li>=bar <span>[[foo]]</span></li></ul>
19706 <ul><li>[[bar <span>[[foo]]</span></li></ul>
19707 <ul><li>]]bar <span>[[foo]]</span></li></ul>
19708 <ul><li>=bar <span>foo]]</span>=</li></ul>
19709 <ul><li> <s></s>: a</li></ul>
19710
19711 !!end
19712
19713 !! test
19714 Lists: 6. Escape bullets in SOL position
19715 !! options
19716 parsoid
19717 !! wikitext
19718 <!--cmt--><nowiki>*foo</nowiki>
19719 !! html
19720 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19721 !!end
19722
19723 !! test
19724 Lists: 7. Escape bullets in a multi-line context
19725 !! wikitext
19726 a
19727 <nowiki>*</nowiki>b
19728 !! html
19729 <p>a
19730 *b
19731 </p>
19732 !!end
19733
19734 #### --------------- HRs ---------------
19735 #### 1. Single line
19736 #### -----------------------------------
19737
19738 !! test
19739 HRs: 1. Single line
19740 !! options
19741 parsoid
19742 !! wikitext
19743 ----<nowiki>----</nowiki>
19744 ----=foo=
19745 ----*foo
19746 !! html
19747 <hr><span typeof="mw:Nowiki">----</span>
19748 <hr>=foo=
19749 <hr>*foo
19750 !! end
19751
19752 #### --------------- Tables ---------------
19753 #### 1a. Simple example
19754 #### 1b. No escaping needed (!foo)
19755 #### 1c. No escaping needed (|foo)
19756 #### 1d. No escaping needed (|}foo)
19757 ####
19758 #### 2a. Nested in td (<td>foo|bar</td>)
19759 #### 2b. Nested in td (<td>foo||bar</td>)
19760 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19761 ####
19762 #### 3a. Nested in th (<th>foo!bar</th>)
19763 #### 3b. Nested in th (<th>foo!!bar</th>)
19764 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19765 ####
19766 #### 4a. Escape -
19767 #### 4b. Escape +
19768 #### 4c. No escaping needed
19769 #### --------------------------------------
19770
19771 !! test
19772 Tables: 1a. Simple example
19773 !! wikitext
19774 <nowiki>{|
19775 |}</nowiki>
19776 !! html
19777 <p>{|
19778 |}
19779 </p>
19780 !! end
19781
19782 !! test
19783 Tables: 1b. No escaping needed
19784 !! wikitext
19785 !foo
19786 !! html
19787 <p>!foo
19788 </p>
19789 !! end
19790
19791 !! test
19792 Tables: 1c. No escaping needed
19793 !! wikitext
19794 |foo
19795 !! html
19796 <p>|foo
19797 </p>
19798 !! end
19799
19800 !! test
19801 Tables: 1d. No escaping needed
19802 !! wikitext
19803 |}foo
19804 !! html
19805 <p>|}foo
19806 </p>
19807 !! end
19808
19809 !! test
19810 Tables: 2a. Nested in td
19811 !! options
19812 parsoid=html2wt
19813 !! wikitext
19814 {|
19815 |<nowiki>foo|bar</nowiki>
19816 |-
19817 |x<div><nowiki>a|b</nowiki></div>
19818 |}
19819 !! html
19820 <table><tbody><tr>
19821 <td>foo|bar</td></tr>
19822 <tr><td>x<div>a|b</div></td>
19823 </tbody></table>
19824 !! end
19825
19826 !! test
19827 Tables: 2b. Nested in td
19828 !! options
19829 parsoid
19830 !! wikitext
19831 {|
19832 |<nowiki>foo||bar</nowiki>
19833 |''it''<nowiki>foo||bar</nowiki>
19834 |}
19835 !! html
19836 <table><tbody><tr>
19837 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19838 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19839 !! end
19840
19841 !! test
19842 Tables: 2c. Nested in td -- no escaping needed
19843 !! options
19844 parsoid
19845 !! wikitext
19846 {|
19847 |foo!!bar
19848 |}
19849 !! html
19850 <table><tbody><tr><td>foo!!bar
19851 </td></tr></tbody></table>
19852
19853 !! end
19854
19855 !! test
19856 Tables: 3a. Nested in th
19857 !! options
19858 parsoid
19859 !! wikitext
19860 {|
19861 !foo!bar
19862 |}
19863 !! html
19864 <table><tbody><tr><th>foo!bar
19865 </th></tr></tbody></table>
19866
19867 !! end
19868
19869 !! test
19870 Tables: 3b. Nested in th
19871 !! options
19872 parsoid
19873 !! wikitext
19874 {|
19875 !<nowiki>foo!!bar</nowiki>
19876 |}
19877 !! html
19878 <table>
19879 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19880 </tbody></table>
19881 !! end
19882
19883 !! test
19884 Tables: 3c. Nested in th -- no escaping needed
19885 !! options
19886 parsoid
19887 !! wikitext
19888 {|
19889 !<nowiki>foo||bar</nowiki>
19890 |}
19891 !! html
19892 <table><tbody><tr>
19893 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19894 !! end
19895
19896 !! test
19897 Tables: 4a. Escape -
19898 !! options
19899 parsoid
19900 !! wikitext
19901 {|
19902 !-bar
19903 |-
19904 |<nowiki>-bar</nowiki>
19905 |}
19906 !! html
19907 <table><tbody>
19908 <tr><th>-bar</th></tr>
19909 <tr>
19910 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19911 !! end
19912
19913 !! test
19914 Tables: 4b. Escape +
19915 !! options
19916 parsoid
19917 !! wikitext
19918 {|
19919 !+bar
19920 |-
19921 |<nowiki>+bar</nowiki>
19922 |}
19923 !! html
19924 <table><tbody>
19925 <tr><th>+bar</th></tr>
19926 <tr>
19927 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19928 !! end
19929
19930 !! test
19931 Tables: 4c. No escaping needed
19932 !! options
19933 parsoid
19934 !! wikitext
19935 {|
19936 |foo-bar
19937 |foo+bar
19938 |-
19939 |''foo''-bar
19940 |''foo''+bar
19941 |-
19942 |foo
19943 bar|baz
19944 +bar
19945 -bar
19946 |-
19947 |x
19948 <div>a|b</div>
19949 |}
19950 !! html
19951 <table><tbody>
19952 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19953 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19954 <tr><td>foo
19955 <p>bar|baz
19956 +bar
19957 -bar</p></td></tr>
19958 <tr><td>x
19959 <div>a|b</div></td>
19960 </tbody></table>
19961 !! end
19962
19963 !! test
19964 Tables: 4d. No escaping needed
19965 !! options
19966 parsoid
19967 !! wikitext
19968 {|
19969 |[[Foo]]-bar
19970 ||+1
19971 ||-2
19972 |}
19973 !! html
19974 <table>
19975 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
19976 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19977 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19978 </tbody></table>
19979 !! end
19980
19981 !! test
19982 Tables: Digest broken attributes on table and tr tag
19983 !! options
19984 parsoid=wt2html
19985 !! wikitext
19986 {| || |} ++
19987 |- || || ++ --
19988 |- > [
19989 |}
19990 !! html
19991 <table>
19992 <tbody>
19993 <tr></tr>
19994 <tr></tr>
19995 </tbody></table>
19996 !! end
19997
19998 #### --------------- Links ----------------
19999 #### 1. Quote marks in link text
20000 #### 2. Wikilinks: Escapes needed
20001 #### 3. Wikilinks: No escapes needed
20002 #### 4. Extlinks: Escapes needed
20003 #### 5. Extlinks: No escapes needed
20004 #### --------------------------------------
20005 !! test
20006 Links 1. Quote marks in link text
20007 !! options
20008 parsoid
20009 !! wikitext
20010 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20011 !! html
20012 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20013 !! end
20014
20015 !! test
20016 Links 2. WikiLinks: Escapes needed
20017 !! options
20018 parsoid
20019 !! wikitext
20020 [[Foo|[Foobar]]]
20021 [[Foo|<nowiki>Foobar]</nowiki>]]
20022 [[Foo|x [Foobar] x]]
20023 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20024 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20025 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20026 [[Foo|<nowiki>|Bar</nowiki>]]
20027 [[Foo|<nowiki>]]bar</nowiki>]]
20028 [[Foo|<nowiki>[[bar</nowiki>]]
20029 [[Foo|<nowiki>x [[ y</nowiki>]]
20030 [[Foo|<nowiki>x ]] y</nowiki>]]
20031 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20032 !! html
20033 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20034 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20035 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20036 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20037 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20038 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20039 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20040 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20041 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20042 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20043 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20044 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20045 !! end
20046
20047 !! test
20048 Links 3. WikiLinks: No escapes needed
20049 !! options
20050 parsoid
20051 !! wikitext
20052 [[Foo|[Foobar]]
20053 [[Foo|foo|bar]]
20054 !! html
20055 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20056 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20057 !! end
20058
20059 !! test
20060 Links 4. ExtLinks: Escapes needed
20061 !! options
20062 parsoid
20063 !! wikitext
20064 [http://google.com <nowiki>[google]</nowiki>]
20065 [http://google.com <nowiki>google]</nowiki>]
20066
20067 <nowiki>[http://google.com]</nowiki>
20068
20069 <nowiki>[http://google.com google]</nowiki>
20070
20071 !! html
20072 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20073 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20074 <p>[http://google.com]</p>
20075 <p>[http://google.com google]</p>
20076 !! end
20077
20078 !! test
20079 Links 5. ExtLinks: No escapes needed
20080 !! options
20081 parsoid
20082 !! wikitext
20083 [http://google.com [google]
20084 !! html
20085 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20086 !! end
20087
20088 !! test
20089 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20090 !! html/parsoid
20091 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20092 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20093 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20094 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20095 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20096 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20097 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20098 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20099 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20100 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20101 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20102 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20103 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20104 </p>
20105 !! wikitext
20106 x<nowiki/>http://example.com<nowiki/>y
20107 http://example.com<nowiki/>?x
20108 http://example.com<nowiki/>&x
20109 http://example.com<nowiki/>'x
20110 http://example.com<nowiki/>,x
20111 http://example.com<nowiki/>.x
20112 http://example.com<nowiki/>;x
20113 http://example.com<nowiki/>:x
20114 http://example.com<nowiki/>;x
20115 http://example.com<nowiki/>!x
20116 http://example.com<nowiki/>=x
20117 http://example.com<nowiki/>(x)
20118 http://example.com(x<nowiki/>)
20119 !! end
20120
20121 !! test
20122 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20123 !! html/parsoid
20124 <p>x
20125 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20126 y
20127 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20128 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20129 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20130 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20131 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20132 </p>
20133 !! wikitext
20134 x
20135 http://example.com
20136 y
20137 "http://example.com"
20138 (http://example.com)
20139 (http://example.com) foo
20140 http://example.com,
20141 http://example.com, foo
20142 !! end
20143
20144 ## Parsoid currently fails wt2html on this one!
20145 !! test
20146 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20147 !! html/parsoid
20148 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20149 !! wikitext
20150 http://example.com.,;:!?
20151 !! end
20152
20153 !! test
20154 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20155 !! html/parsoid
20156 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20157 !! wikitext
20158 RFC 123<nowiki/>4
20159 !! end
20160
20161 !! test
20162 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20163 !! html/parsoid
20164 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20165 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20166 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20167 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20168 </p>
20169 !! wikitext
20170 xRFC 123y
20171 XRFC 123y
20172 RFC 123?foo
20173 RFC 123&foo
20174 !! end
20175
20176 !! test
20177 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20178 !! html/parsoid
20179 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20180 !! wikitext
20181 PMID 123<nowiki/>4
20182 !! end
20183
20184 !! test
20185 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20186 !! html/parsoid
20187 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20188 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20189 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20190 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20191 </p>
20192 !! wikitext
20193 xPMID 123y
20194 XPMID 123y
20195 PMID 123?foo
20196 PMID 123&foo
20197 !! end
20198
20199 !! test
20200 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20201 !! html/parsoid
20202 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20203 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20204 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20205 </p>
20206 !! wikitext
20207 ISBN 1234567890<nowiki/>1
20208 ISBN 1234567890<nowiki/>x
20209 ISBN 1234567890<nowiki/>b
20210 !! end
20211
20212 !! test
20213 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20214 !! html/parsoid
20215 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20216 !! wikitext
20217 ISBN 1234567890's
20218 !! end
20219
20220 #### --------------- Quotes ---------------
20221 #### 1. Quotes inside <b> and <i>
20222 #### 2. Link fragments separated by <i> and <b> tags
20223 #### 3. Link fragments inside <i> and <b>
20224 #### 4. No escaping needed
20225 #### --------------------------------------
20226 !! test
20227 1. Quotes inside <b> and <i>
20228 !! options
20229 parsoid=html2wt,wt2wt
20230 !! wikitext
20231 ''<nowiki>'foo'</nowiki>''
20232 ''<nowiki>''foo''</nowiki>''
20233 ''<nowiki>'''foo'''</nowiki>''
20234 ''foo''<nowiki/>'s
20235 '''<nowiki>'foo'</nowiki>'''
20236 '''<nowiki>''foo''</nowiki>'''
20237 '''<nowiki>'''foo'''</nowiki>'''
20238 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20239 '''foo'''<nowiki/>'s
20240 '''foo''
20241 ''foo''<nowiki/>'
20242 '<nowiki/>''foo''<nowiki/>'
20243 ''''foo'''
20244 '''foo'''<nowiki/>'
20245 '<nowiki/>'''foo'''<nowiki/>'
20246 ''fools'<span> errand</span>''
20247 ''<span>fool</span>'s errand''
20248 !! html
20249 <p><i>'foo'</i>
20250 <i>''foo''</i>
20251 <i>'''foo'''</i>
20252 <i>foo</i>'s
20253 <b>'foo'</b>
20254 <b>''foo''</b>
20255 <b>'''foo'''</b>
20256 <b>foo'<i>bar'</i>baz</b>
20257 <b>foo</b>'s
20258 '<i>foo</i>
20259 <i>foo</i>'
20260 '<i>foo</i>'
20261 '<b>foo</b>
20262 <b>foo</b>'
20263 '<b>foo</b>'</p>
20264 <i>fools'<span> errand</span></i>
20265 <i><span>fool</span>'s errand</i>
20266 !! end
20267
20268 !! test
20269 2. Link fragments separated by <i> and <b> tags
20270 !! wikitext
20271 [[''foo''<nowiki>hello]]</nowiki>
20272
20273 [['''foo'''<nowiki>hello]]</nowiki>
20274 !! html
20275 <p>[[<i>foo</i>hello]]
20276 </p><p>[[<b>foo</b>hello]]
20277 </p>
20278 !! end
20279
20280 !! test
20281 3. Link fragments inside <i> and <b>
20282 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
20283 this is one of the shortcomings of this format)
20284 !! wikitext
20285 ''[[foo''<nowiki>]]</nowiki>
20286
20287 '''[[foo'''<nowiki>]]</nowiki>
20288 !! html
20289 <p><i>[[foo</i>]]
20290 </p><p><b>[[foo</b>]]
20291 </p>
20292 !! end
20293
20294 !! test
20295 4. No escaping needed
20296 !! wikitext
20297 '<span>''bar''</span>'
20298 '<span>'''bar'''</span>'
20299 !! html
20300 <p>'<span><i>bar</i></span>'
20301 '<span><b>bar</b></span>'
20302 </p>
20303 !! end
20304
20305 #### ----------- Paragraphs ---------------
20306 #### 1. No unnecessary escapes
20307 #### --------------------------------------
20308
20309 !! test
20310 1. No unnecessary escapes
20311 !! wikitext
20312 bar <span><nowiki>[[foo]]</nowiki></span>
20313
20314 =bar <span><nowiki>[[foo]]</nowiki></span>
20315
20316 [[bar <span><nowiki>[[foo]]</nowiki></span>
20317
20318 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20319
20320 =bar <span>foo]]</span><nowiki>=</nowiki>
20321 !! html
20322 <p>bar <span>[[foo]]</span>
20323 </p><p>=bar <span>[[foo]]</span>
20324 </p><p>[[bar <span>[[foo]]</span>
20325 </p><p>]]bar <span>[[foo]]</span>
20326 </p><p>=bar <span>foo]]</span>=
20327 </p>
20328 !!end
20329
20330 #### ----------------------- PRE --------------------------
20331 #### 1. Leading whitespace in SOL context should be escaped
20332 #### ------------------------------------------------------
20333 !! test
20334 1. Leading whitespace in SOL context should be escaped
20335 !! options
20336 parsoid
20337 !! wikitext
20338 <nowiki> </nowiki>a
20339
20340 <nowiki> </nowiki> a
20341
20342 <nowiki> </nowiki>a(tab)
20343
20344 <nowiki> </nowiki> a
20345 <!--cmt-->
20346 <nowiki> </nowiki> a
20347
20348 a
20349 <nowiki> </nowiki>b
20350
20351 a
20352 <nowiki> </nowiki>b
20353
20354 a
20355 <nowiki> </nowiki> b
20356 !! html
20357 <p> a</p>
20358 <p> a</p>
20359 <p> a(tab)</p>
20360 <p> a</p>
20361 <p><!--cmt--> a</p>
20362 <p>a
20363 b</p>
20364 <p>a
20365 b</p>
20366 <p>a
20367 b</p>
20368 !! end
20369
20370 !! test
20371 2. Leading whitespace in non-indent-pre contexts should not be escaped
20372 !! options
20373 parsoid
20374 !! wikitext
20375 foo <ref>''a''
20376 b</ref>
20377 !! html
20378 <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>
20379 !! end
20380
20381 !! test
20382 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20383 !! options
20384 parsoid
20385 !! wikitext
20386 <blockquote>
20387 a
20388 <span>b</span>
20389 c
20390 </blockquote>
20391 !! html
20392 <blockquote>
20393 <p>
20394 a
20395 <span>b</span>
20396 c</p>
20397 </blockquote>
20398 !! end
20399
20400 !! test
20401 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20402 !! options
20403 parsoid
20404 !! wikitext
20405 [[File:Foobar.jpg|thumb|caption]]
20406 !! html
20407 !! html/parsoid
20408 <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>
20409 !! end
20410
20411 !! test
20412 5. Nowiki escaping should account for indent-pres
20413 !! options
20414 parsoid=html2wt
20415 !! html
20416 <pre>==foo==</pre>
20417 !! wikitext
20418 ==foo==
20419 !! end
20420
20421 #### --------------- Behavior Switches --------------------
20422 !! test
20423 1. Valid behavior switches should be escaped
20424 !! options
20425 parsoid=html2wt
20426 !! wikitext
20427 <nowiki>__TOC__</nowiki>
20428 ''<nowiki>__TOC__</nowiki>''
20429 !! html
20430 __TOC__
20431 <i>__TOC__</i>
20432 !! end
20433
20434 !! test
20435 2. Invalid behavior switches should not be escaped
20436 !! options
20437 parsoid=html2wt
20438 !! wikitext
20439 __TOO__
20440 __|__
20441 !! html
20442 __TOO__
20443 __|__
20444 !! end
20445
20446 #### --------------- HTML tags ---------------
20447 #### 1. a tags
20448 #### 2. other tags
20449 #### 3. multi-line html tag
20450 #### 4. extension tags
20451 #### -----------------------------------------
20452 !! test
20453 1. a tags
20454 !! options
20455 parsoid
20456 !! wikitext
20457 <a href="http://google.com">google</a>
20458 !! html
20459 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20460 !! end
20461
20462 !! test
20463 2. other tags
20464 !! wikitext
20465 <nowiki><div>foo</div>
20466 <div style="color:red">foo</div></nowiki>
20467 !! html
20468 <p>&lt;div&gt;foo&lt;/div&gt;
20469 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20470 </p>
20471 !! end
20472
20473 !! test
20474 3. multi-line html tag
20475 !! wikitext
20476 <nowiki><div
20477 >foo</div
20478 ></nowiki>
20479 !! html
20480 <p>&lt;div
20481 &gt;foo&lt;/div
20482 &gt;
20483 </p>
20484 !! end
20485
20486 !! test
20487 4. extension tags
20488 !! wikitext
20489 <nowiki><ref>foo</ref></nowiki>
20490
20491 <nowiki><ref>bar</nowiki>
20492
20493 baz<nowiki></ref></nowiki>
20494 !! html
20495 <p>&lt;ref&gt;foo&lt;/ref&gt;
20496 </p><p>&lt;ref&gt;bar
20497 </p><p>baz&lt;/ref&gt;
20498 </p>
20499 !! end
20500
20501 #### --------------- Others ---------------
20502 !! test
20503 Escaping nowikis
20504 !! wikitext
20505 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20506 !! html
20507 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20508 </p>
20509 !! end
20510
20511 ## The quote-char in the input is necessary for triggering the bug
20512 !! test
20513 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20514 !! options
20515 parsoid=wt2wt,html2wt
20516 !! wikitext
20517 foo's bar :
20518 !! html
20519 <p>foo's bar :</p>
20520 !! end
20521
20522 !! test
20523
20524 Tag-like HTML structures are passed through as text
20525 !! wikitext
20526 <x y>
20527
20528 <x.y>
20529
20530 <x-y>
20531
20532 1>2
20533
20534 x<y
20535
20536 a>b
20537
20538 1<d e>f
20539 !! html
20540 <p>&lt;x y&gt;
20541 </p><p>&lt;x.y&gt;
20542 </p><p>&lt;x-y&gt;
20543 </p><p>1&gt;2
20544 </p><p>x&lt;y
20545 </p><p>a&gt;b
20546 </p><p>1&lt;d e&gt;f
20547 </p>
20548 !! end
20549
20550
20551 # This was a bug in the PHP parser (see bug 17663 and its dups,
20552 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20553 !! test
20554 Tag names followed by punctuation should not be recognized as tags
20555 !! wikitext
20556 <s.ome> text
20557 !! html
20558 <p>&lt;s.ome&gt; text
20559 </p>
20560 !! end
20561
20562 !! test
20563 HTML tag with necessary entities in attributes
20564 !! wikitext
20565 <span title="&amp;amp;">foo</span>
20566 !! html
20567 <p><span title="&amp;amp;">foo</span>
20568 </p>
20569 !! end
20570
20571 !! test
20572 HTML tag with 'unnecessary' entity encoding in attributes
20573 !! wikitext
20574 <span title="&amp;">foo</span>
20575 !! html
20576 <p><span title="&amp;">foo</span>
20577 </p>
20578 !! end
20579
20580 !! test
20581 HTML tag with broken attribute value quoting
20582 !! wikitext
20583 <span title="Hello world>Foo</span>
20584 !! html/php
20585 <p><span>Foo</span>
20586 </p>
20587 !! html/parsoid
20588 <p><span title="Hello world">Foo</span>
20589 </p>
20590 !! end
20591
20592 !! test
20593 Parsoid-only: HTML tag with broken attribute value quoting
20594 !! options
20595 parsoid
20596 !! wikitext
20597 <span title="Hello world>Foo</span>
20598 !! html
20599 <p><span title="Hello world">Foo</span>
20600 </p>
20601 !! end
20602
20603 !! test
20604 Table with broken attribute value quoting
20605 !! wikitext
20606 {|
20607 | title="Hello world|Foo
20608 |}
20609 !! html/php
20610 <table>
20611 <tr>
20612 <td>Foo
20613 </td></tr></table>
20614
20615 !! html/parsoid
20616 <table>
20617 <tr>
20618 <td title="Hello world">Foo
20619 </td></tr></table>
20620
20621 !! end
20622
20623 !! test
20624 Table with broken attribute value quoting on consecutive lines
20625 !! wikitext
20626 {|
20627 | title="Hello world|Foo
20628 | style="color:red|Bar
20629 |}
20630 !! html
20631 <table>
20632 <tr>
20633 <td>Foo
20634 </td>
20635 <td>Bar
20636 </td></tr></table>
20637
20638 !! end
20639
20640 !! test
20641 Parsoid-only: Table with broken attribute value quoting on consecutive lines
20642 !! options
20643 parsoid
20644 !! wikitext
20645 {|
20646 | title="Hello world|Foo
20647 | style="color:red|Bar
20648 |}
20649 !! html
20650 <table><tbody>
20651 <tr>
20652 <td title="Hello world">Foo
20653 </td><td style="color: red">Bar
20654 </td></tr></tbody></table>
20655
20656 !! end
20657
20658 !! test
20659 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20660 !! options
20661 parsoid
20662 !! wikitext
20663 {{}}
20664 !! html
20665 {{}}
20666 !! end
20667
20668 !! test
20669 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20670 !! options
20671 parsoid
20672 !! wikitext
20673 }}{{
20674 !! html
20675 }}{{
20676 !! end
20677
20678 !!test
20679 Accept empty td cell attribute
20680 !! wikitext
20681 {|
20682 | align="center" | foo || |
20683 |}
20684 !! html
20685 <table>
20686 <tr>
20687 <td align="center"> foo </td>
20688 <td>
20689 </td></tr></table>
20690
20691 !!end
20692
20693 !!test
20694 Non-empty attributes in th-cells
20695 !! wikitext
20696 {|
20697 ! Foo !! style="color: red" | Bar
20698 |}
20699 !! html
20700 <table>
20701 <tr>
20702 <th> Foo </th>
20703 <th style="color: red"> Bar
20704 </th></tr></table>
20705
20706 !!end
20707
20708 !!test
20709 Accept empty attributes in th-cells
20710 !! wikitext
20711 {|
20712 !| foo !!| bar
20713 |}
20714 !! html
20715 <table>
20716 <tr>
20717 <th> foo </th>
20718 <th> bar
20719 </th></tr></table>
20720
20721 !!end
20722
20723 !!test
20724 Empty table rows go away
20725 !! wikitext
20726 {|
20727 | Hello
20728 | there
20729 |- class="foo"
20730 |-
20731 |}
20732 !! html
20733 <table>
20734 <tr>
20735 <td> Hello
20736 </td>
20737 <td> there
20738 </td></tr>
20739
20740 </table>
20741
20742 !! end
20743
20744 ###
20745 ### Parsoid-centric tests for testing RTing of inter-element separators
20746 ### Edge cases not tested by existing parser tests and specific to
20747 ### Parsoid-specific serialization strategies.
20748 ###
20749
20750 !!test
20751 RT-ed inter-element separators should be valid separators
20752 !! wikitext
20753 {|
20754 |- [[foo]]
20755 |}
20756 !! html
20757 <table>
20758
20759 </table>
20760
20761 !!end
20762
20763 !!test
20764 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20765 (Parsoid-only since PHP parser relies on Tidy for correct output)
20766 !!options
20767 parsoid
20768 !! wikitext
20769 {|
20770 |<small>foo
20771 bar
20772 |}
20773
20774 {|
20775 |<small>foo<small>
20776 |}
20777 !! html
20778 !!end
20779
20780 !!test
20781 Empty TD followed by TD with tpl-generated attribute
20782 !! wikitext
20783 {|
20784 |-
20785 |
20786 |{{echo|style='color:red'}}|foo
20787 |}
20788 !! html
20789 <table>
20790
20791 <tr>
20792 <td>
20793 </td>
20794 <td>foo
20795 </td></tr></table>
20796
20797 !!end
20798
20799 !!test
20800 Indented table with an empty td
20801 !! wikitext
20802 {|
20803 |-
20804 |
20805 |foo
20806 |}
20807 !! html
20808 <table>
20809
20810 <tr>
20811 <td>
20812 </td>
20813 <td>foo
20814 </td></tr></table>
20815
20816 !!end
20817
20818 !!test
20819 Indented block & table
20820 !! wikitext
20821 <div>foo</div>
20822 {|
20823 |foo
20824 |}
20825 !! html/php
20826 <div>foo</div>
20827 <table>
20828 <tr>
20829 <td>foo
20830 </td></tr></table>
20831
20832 !! html/parsoid
20833 <div data-parsoid='{"stx":"html"}'>foo</div>
20834 <table><tbody>
20835 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20836 </tbody></table>
20837 !!end
20838
20839 !! test
20840 Indent and comment before table row
20841 !! wikitext
20842 {|
20843 <!--hi-->|-
20844 | there
20845 |}
20846 !! html/php
20847 <table>
20848
20849 <tr>
20850 <td> there
20851 </td></tr></table>
20852
20853 !! html/parsoid
20854 <table data-parsoid='{}'>
20855 <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20856 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20857 </tbody></table>
20858 !! end
20859
20860 !!test
20861 Empty TR followed by a template-generated TR
20862 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20863 !!options
20864 parsoid
20865 !! wikitext
20866 {|
20867 |-
20868 {{echo|<tr><td>foo</td></tr>}}
20869 |}
20870 !! html
20871 <table>
20872 <tbody>
20873 <tr></tr>
20874 <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}}]}'>
20875 <td>foo</td></tr>
20876 </tbody></table>
20877 !!end
20878
20879 ## PHP and parsoid output differ for this, and since this is primarily
20880 ## for testing Parsoid's serializer, marking this Parsoid only
20881 !!test
20882 Empty TR followed by mixed-ws-comment line should RT correctly
20883 !!options
20884 parsoid
20885 !! wikitext
20886 {|
20887 |-
20888 <!--c-->
20889 |-
20890 <!--c--> <!--d-->
20891 |}
20892 !! html
20893 <table>
20894 <tbody>
20895 <tr></tr>
20896 <!--c-->
20897 <tr>
20898 <!--c--> </tr><!--d-->
20899 </tbody></table>
20900
20901 !!end
20902
20903 !!test
20904 Multi-line image caption generated by templates with/without trailing newlines
20905 !!options
20906 parsoid
20907 !! wikitext
20908 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20909 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20910 !! html
20911 <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>
20912 <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>
20913
20914 !!end
20915
20916 !! test
20917 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20918 !! options
20919 parsoid=html2wt
20920 !! wikitext
20921 <includeonly>foo</includeonly>
20922 new para
20923
20924 [[./Category:Foo]]
20925
20926 = new heading =
20927 !! html
20928 <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>
20929
20930 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20931 !! end
20932
20933 ## PHP emits broken html for this, and since this is primarily
20934 ## a Parsoid serializer test, marking this Parsoid only
20935 !!test
20936 Improperly nested inline or quotes tags with whitespace in between
20937 !!options
20938 parsoid
20939 !! wikitext
20940 <span> <s>x</span> </s>
20941 ''' ''x''' ''
20942 !! html
20943 <p><span> <s>x</s></span><s> </s>
20944 <b> <i>x</i></b><i> </i>
20945 </p>
20946 !!end
20947
20948 !!test
20949 Encapsulate protected attributes from wt
20950 !!options
20951 parsoid
20952 !! wikitext
20953 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20954 !! html
20955 <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>
20956 </body>
20957 !!end
20958
20959 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20960 ## Having nested or stray pre tags results in the attempt to add duplicates,
20961 ## causing an assertion fail. This test tries to prevent that situation.
20962 !!test
20963 Ensure ParagraphWrapper can deal with stray closing pre tags
20964 !!options
20965 parsoid=wt2html
20966 !! wikitext
20967 plain text</pre>
20968 !! html
20969 plain text
20970 !!end
20971
20972 !!test
20973 1. Ensure fostered text content is wrapped in spans
20974 !!options
20975 parsoid=wt2html
20976 !! wikitext
20977 <table>hi</table><table>ho</table>
20978 !! html
20979 <span>hi</span>
20980 <table></table>
20981 <span>ho</span>
20982 <table></table>
20983 !!end
20984
20985 !!test
20986 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20987 !!options
20988 parsoid=wt2html,wt2wt
20989 !! wikitext
20990 <table>
20991 <tr> || ||
20992 <td> a
20993 </table>
20994 !! html
20995 <span> || ||</span>
20996 <table>
20997 <tbody>
20998 <tr>
20999 <td> a</td></tr>
21000 </tbody></table>
21001 !!end
21002
21003 !!test
21004 Encapsulation properly handles null DSR information from foster box
21005 !!options
21006 parsoid=wt2html,wt2wt
21007 !! wikitext
21008 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21009 !! html
21010 <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;
21011 <table>foo
21012 <tr>
21013 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
21014 <table>
21015 <tbody>
21016 <tr>
21017 <td>bar</td></tr></tbody></table>
21018 !!end
21019
21020 !!test
21021 1. Encapsulate foster-parented transclusion content
21022 !!options
21023 parsoid=wt2wt,wt2html
21024 !! wikitext
21025 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21026 !! html
21027 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21028 <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
21029 <tr>
21030 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
21031 <table>
21032 <tbody>
21033 <tr>
21034 <td>bar</td></tr></tbody></table>
21035 !!end
21036
21037 !!test
21038 2. Encapsulate foster-parented transclusion content
21039 !!options
21040 parsoid=wt2wt,wt2html
21041 !! wikitext
21042 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21043 !! html
21044 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21045 <table>
21046 <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>
21047 <tr>
21048 <td>bar</td></tr></table>&quot;]}">foo</div>
21049 <table>
21050 <tbody>
21051 <tr>
21052 <td>bar</td></tr></tbody></table>
21053 !!end
21054
21055 !!test
21056 3. Encapsulate foster-parented transclusion content
21057 !!options
21058 parsoid=wt2wt,wt2html
21059 !! wikitext
21060 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21061 !! html
21062 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21063 <table>
21064 <div>
21065 <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>
21066 <tr>
21067 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21068 <p>foo</p></div>
21069 <table>
21070 <tbody>
21071 <tr>
21072 <td>bar</td></tr></tbody></table>
21073 !!end
21074
21075 !!test
21076 4. Encapsulate foster-parented transclusion content
21077 !!options
21078 parsoid=wt2wt,wt2html
21079 !! wikitext
21080 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21081 !! html
21082 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21083 <table>
21084 <div>
21085 <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>
21086 <tr>
21087 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21088 <p>foo</p></div>
21089 <table>
21090 <tbody>
21091 <tr>
21092 <td>bar</td></tr></tbody></table>
21093 !!end
21094
21095 !!test
21096 5. Encapsulate foster-parented transclusion content
21097 !!options
21098 parsoid=wt2wt,wt2html
21099 !! wikitext
21100 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21101 !! html
21102 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21103 <table>
21104 <tr>
21105 <td>
21106 <div>
21107 <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>
21108 <table>
21109 <tbody>
21110 <tr>
21111 <td>
21112 <div>
21113 <p>foo</p></div></td></tr></tbody></table>
21114 !!end
21115
21116 !!test
21117 6. Encapsulate foster-parented transclusion content
21118 !!options
21119 parsoid=wt2wt,wt2html
21120 !! wikitext
21121 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21122 !! html
21123 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21124 <table>
21125 <tr>
21126 <td>
21127 <div>
21128 <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>
21129 <table>
21130 <tbody>
21131 <tr>
21132 <td>
21133 <div>
21134 <p>foo</p></div></td></tr></tbody></table>
21135 <p>ok</p>
21136 !!end
21137
21138 !!test
21139 7. Encapsulate foster-parented transclusion content
21140 !!options
21141 parsoid=wt2wt,wt2html
21142 !! wikitext
21143 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21144 !! html
21145 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21146 <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;
21147 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
21148 <td>bar</td></table>&quot;]}">foo</p>
21149 <table>
21150 <tbody>
21151 <tr>
21152 <td>bar</td></tr></tbody></table>
21153 !!end
21154
21155 !!test
21156 8. Encapsulate foster-parented transclusion content
21157 !!options
21158 parsoid=wt2wt,wt2html
21159 !! wikitext
21160 {{echo|a
21161 }}{|{{echo|style='color:red'}}
21162 |-
21163 |b
21164 |}
21165 !! html
21166 <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>
21167 <table>
21168 <tbody>
21169 <tr>
21170 <td>b</td></tr></tbody></table>
21171 !!end
21172
21173 !!test
21174 9. Encapsulate foster-parented transclusion content
21175 !!options
21176 parsoid=wt2wt,wt2html
21177 !! wikitext
21178 <table>{{echo|hi</table>hello}}
21179 !! html
21180 <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>
21181 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
21182 !!end
21183
21184 !!test
21185 Table in fosterable position
21186 !!options
21187 parsoid=wt2html,wt2wt
21188 !! wikitext
21189 {{OpenTable}}
21190 <div>
21191 {|
21192 |}
21193 </div>
21194 |}
21195 !! html
21196 <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="{}">
21197 </span>
21198 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21199
21200 <table>
21201 </table>
21202 !!end
21203
21204 # Parsoid only for bug 64747
21205 !! test
21206 Properly encapsulate empty-content transclusions in fosterable positions
21207 !! wikitext
21208 <table>
21209 {{#if:|
21210 <td>foo</td>
21211 }}
21212 </table>
21213 !! html/parsoid
21214 <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>"}'>
21215
21216 </table>
21217 !! end
21218
21219 !!test
21220 Support <object> element with .data attribute
21221 !!options
21222 parsoid=html2wt
21223 !! wikitext
21224 <object data="test.swf"></object>
21225 !! html
21226 <object data="test.swf"></object>
21227 !!end
21228
21229 # -----------------------------------------------------------------
21230 # The following section of tests are primarily to spec requirements
21231 # around serialization of new/edited content.
21232 #
21233 # All these tests are marked Parsoid html2wt and html2html only
21234 # ----------------------------------------------------------------
21235
21236 !! test
21237 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21238 !! options
21239 parsoid=html2wt
21240 language=es
21241 !! wikitext
21242 [[Foo]]
21243 !! html
21244 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
21245 !! end
21246
21247 !! test
21248 Image: Modifying size of an image (1)
21249 !! options
21250 parsoid={
21251 "modes": ["wt2wt"],
21252 "changes": [
21253 ["img[height]", "attr", "height", "22"],
21254 ["img[width]", "attr", "width", "200"]
21255 ]
21256 }
21257 !! wikitext
21258 [[Image:Foobar.jpg|230x230px]]
21259 !! wikitext/edited
21260 [[Image:Foobar.jpg|200x200px]]
21261 !!end
21262
21263 !! test
21264 Image: Modifying size of an image (2)
21265 !! options
21266 parsoid={
21267 "modes": ["wt2wt"],
21268 "changes": [
21269 ["img[height]", "attr", "height", "100"],
21270 ["img[width]", "attr", "width", "500"]
21271 ]
21272 }
21273 !! wikitext
21274 [[Image:Foobar.jpg|230x230px]]
21275 !! wikitext/edited
21276 [[Image:Foobar.jpg|500x500px]]
21277 !!end
21278
21279 # Change in size is ignored so long as class='mw-default-size'
21280 !! test
21281 Image: Modifying size of an image (3)
21282 !! options
21283 parsoid={
21284 "modes": ["wt2wt"],
21285 "changes": [
21286 ["figure[class]", "removeClass", "mw-default-size"],
21287 ["figure img", "attr", "height", "19"],
21288 ["figure img", "attr", "width", "170"]
21289 ]
21290 }
21291 !! wikitext
21292 [[Image:Foobar.jpg|thumb]]
21293 !! wikitext/edited
21294 [[Image:Foobar.jpg|thumb|170x170px]]
21295 !!end
21296
21297 !! test
21298 Image: Modifying alignment of an image (bug 48665)
21299 !! options
21300 parsoid={
21301 "modes": ["wt2wt"],
21302 "changes": [
21303 ["figure[class]", "removeClass", "mw-halign-right"],
21304 ["figure[class]", "addClass", "mw-halign-left"]
21305 ]
21306 }
21307 !! wikitext
21308 [[Image:Foobar.jpg|thumb|caption|right]]
21309 !! wikitext/edited
21310 [[Image:Foobar.jpg|thumb|caption|left]]
21311 !! end
21312
21313 !! test
21314 Image: Modifying mw-default-size of an frameless image (bug 62805)
21315 !! options
21316 parsoid={
21317 "modes": ["wt2wt"],
21318 "changes": [
21319 ["figure.mw-default-size", "removeClass", "mw-default-size"]
21320 ]
21321 }
21322 !! wikitext
21323 [[Image:Foobar.jpg|frameless|right]]
21324 !! wikitext/edited
21325 [[Image:Foobar.jpg|frameless|right|220x220px]]
21326 !! end
21327
21328 !! test
21329 Image: Modifying valign of an image (bug 49221)
21330 !! options
21331 parsoid={
21332 "modes": ["wt2wt"],
21333 "changes": [
21334 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21335 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21336 ]
21337 }
21338 !! wikitext
21339 [[File:Foobar.jpg|20px|middle]]
21340 !! wikitext/edited
21341 [[File:Foobar.jpg|20px|text-top]]
21342 !! end
21343
21344 !! test
21345 Image: Modifying alt attribute of an image (bug 56400)
21346 !! options
21347 parsoid={
21348 "modes": ["wt2wt"],
21349 "changes": [
21350 ["img[alt]", "attr", "alt", "some alternate edited text"]
21351 ]
21352 }
21353 !! wikitext
21354 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21355 !! wikitext/edited
21356 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21357 !!end
21358
21359 !! test
21360 Image: Modifying caption of an image
21361 !! options
21362 parsoid={
21363 "modes": ["wt2wt"],
21364 "changes": [
21365 ["figcaption", "text", "new caption"]
21366 ]
21367 }
21368 !! wikitext
21369 [[Image:Foobar.jpg|thumb|original caption]]
21370 !! wikitext/edited
21371 [[Image:Foobar.jpg|thumb|new caption]]
21372 !!end
21373
21374 !! test
21375 Image: empty alt attribute (bug 48924)
21376 !! options
21377 parsoid
21378 !! wikitext
21379 [[File:Foobar.jpg|thumb|alt=|bar]]
21380 !! html
21381 <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>
21382 !! end
21383
21384 #!! test
21385 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21386 #!! options
21387 #parsoid=html2wt
21388 #language=ar
21389 #!! input
21390 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21391 #!! result
21392 #<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>
21393 #!! end
21394
21395 !! test
21396 Image: Block level image should have \n before and after
21397 !! options
21398 parsoid
21399 !! wikitext
21400 123
21401 [[File:Foobar.jpg|right|thumb|150x150px]]
21402 456
21403 !! html
21404 <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>
21405 !!end
21406
21407 !! test
21408 Image: New block level image should have \n before and after (existing
21409 content)
21410 !! options
21411 parsoid
21412 !! wikitext
21413 123
21414 [[File:Foobar.jpg|right|thumb|150x150px]]
21415 456
21416 !! html
21417 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
21418 <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>
21419 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
21420 !!end
21421
21422 !! test
21423 Image: upright option (parsoid)
21424 !! options
21425 parsoid
21426 !! wikitext
21427 [[File:Foobar.jpg|thumb|upright|caption]]
21428 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21429 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21430 !! html
21431 <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>
21432 !!end
21433
21434 !! test
21435 Image: upright option is ignored on inline and frame images (parsoid)
21436 !! options
21437 parsoid
21438 !! wikitext
21439 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21440 !! html
21441 <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>
21442 !!end
21443
21444 !! test
21445 Image: from basic HTML (1)
21446 !! options
21447 parsoid=html2wt
21448 !! html/parsoid
21449 <span typeof="mw:Image">
21450 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21451 </span>
21452 !! wikitext
21453 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21454 !! end
21455
21456 !! test
21457 Image: from basic HTML (2)
21458 !! options
21459 parsoid=html2wt
21460 !! html/parsoid
21461 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21462 !! wikitext
21463 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21464 !! end
21465
21466 !! test
21467 Image: from basic HTML (3)
21468 !! options
21469 parsoid=html2wt
21470 !! html/parsoid
21471 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21472 !! wikitext
21473 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21474 !! end
21475
21476 !! test
21477 Image: from basic HTML (4)
21478 !! options
21479 parsoid=html2wt
21480 !! html/parsoid
21481 <img src="File:Foobar.jpg">
21482 !! wikitext
21483 [[File:Foobar.jpg|link=]]
21484 !! end
21485
21486 !! test
21487 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21488 !! options
21489 parsoid=html2wt
21490 !! wikitext
21491 * foo
21492 !! html
21493 <ul>
21494 <li><p>foo</p></li>
21495 </ul>
21496 !! end
21497
21498 !! test
21499 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21500 !! options
21501 parsoid=html2wt
21502 !! wikitext
21503 * foo
21504 !! html
21505 <ul> <li>foo</li></ul>
21506 !! end
21507
21508 !! test
21509 Don't strip leading whitespace when handling indent-pre suppressing tags
21510 !! options
21511 parsoid=html2wt
21512 !! wikitext
21513 {|
21514 | indented row
21515 |}
21516 <blockquote>
21517 '''This is very bold of you!'''
21518
21519 {|
21520 |
21521 indented cell (no pre-wrapping!)
21522 |}
21523 </blockquote>
21524 foo
21525 <div>bar</div>
21526 !! html
21527 <table>
21528 <tr><td> indented row</td></tr>
21529 </table>
21530 <blockquote><p>
21531 <b>This is very bold of you!</b>
21532 </p>
21533 <table><tr><td>
21534 indented cell (no pre-wrapping!)
21535 </td></tr></table>
21536 </blockquote>
21537 <p>foo</p>
21538 <div>bar</div>
21539 !! end
21540
21541 !! test
21542 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21543 !! options
21544 parsoid=html2wt
21545 !! wikitext
21546 foo
21547 <nowiki> </nowiki><span>bar</span>
21548
21549 <span>foo2
21550 <nowiki> </nowiki></span>bar2
21551
21552 <div>foo</div>
21553 <nowiki> </nowiki><span>bar</span>
21554
21555 <div>
21556 <nowiki> </nowiki><span>foo</span>
21557 </div>
21558 !! html
21559 <p>foo</p>
21560 <span>bar</span>
21561
21562 <span>foo2
21563 </span>bar2
21564
21565 <div>foo</div>
21566 <span>bar</span>
21567
21568 <div>
21569 <span>foo</span>
21570 </div>
21571 !! end
21572
21573 !! test
21574 Lists: Add space after bullets
21575 !! options
21576 parsoid=html2wt
21577 !! wikitext
21578 * foo
21579 * bar
21580 * <span> baz</span>
21581 !! html
21582 <ul>
21583 <li>foo</li>
21584 <li> bar</li>
21585 <li><span> baz</span></li>
21586 </ul>
21587 !! end
21588
21589 !! test
21590 Lists: Dont insert newlines in a serialized list item.
21591 !! options
21592 parsoid=html2wt
21593 !! wikitext
21594 * a<br>b
21595 * c
21596 !! html
21597 <ul><li>a<br>b</li><li>c</li></ul>
21598 !! end
21599
21600 !! test
21601 Headings: Add space before/after == (Bug 51744)
21602 !! options
21603 parsoid=html2wt
21604 !! wikitext
21605 == foo ==
21606
21607 == bar ==
21608
21609 == baz ==
21610
21611 == <span> baz</span> ==
21612 !! html
21613 <h2>foo</h2>
21614 <h2> bar</h2>
21615 <h2>baz </h2>
21616 <h2><span> baz</span></h2>
21617 !! end
21618
21619 !! test
21620 Parsoid: Serialize positional parameters with = in them as named parameter
21621 !! options
21622 parsoid=html2wt
21623 !! wikitext
21624 {{echo|1 = f=oo}}
21625
21626 {{echo|1 = f=oo|2 = bar}}
21627
21628 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21629 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21630 {{echo|<nowiki>f=oo</nowiki>|bar}}
21631 !! html
21632 <p about="#mwt1" typeof="mw:Transclusion"
21633 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21634
21635 <p about="#mwt1" typeof="mw:Transclusion"
21636 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21637
21638 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21639 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21640 <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>
21641 !! end
21642
21643 !! test
21644 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21645 !! options
21646 parsoid=html2wt
21647 !! wikitext
21648 <div>a
21649 b
21650 </div>
21651 <div>a
21652 b
21653 </div>
21654 <div>
21655 a
21656
21657 b
21658 </div>
21659 !! html
21660 <div>a<p>b</p></div>
21661 <div>a
21662 <p>b</p></div>
21663 <div>
21664 a
21665 <p>b</p></div>
21666 !! end
21667
21668 !! test
21669 Substrings resembling wikitext in hrefs should not get nowiki escapes
21670 !! options
21671 parsoid=html2wt
21672 !! wikitext
21673 [[Foo''bar''baz]]
21674 !! html
21675 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21676 !! end
21677
21678 #-----------------------------
21679 # I/B quote minimization tests
21680 #-----------------------------
21681
21682 !! test
21683 1. I/B quote minimization: wikitext-only tags should be combined
21684 !! options
21685 parsoid=html2wt
21686 !! wikitext
21687 ''AB''
21688
21689 '''AB'''
21690
21691 ''A'''B'''''
21692
21693 '''A''B'''''
21694
21695 '''A''BC''D'''
21696
21697 '''''AB'''''
21698
21699 '''''AB'''''
21700
21701 '''''AB'''''
21702 !! html
21703 <p><i>A</i><i>B</i></p>
21704 <p><b>A</b><b>B</b></p>
21705 <p><i>A</i><b><i>B</i></b></p>
21706 <p><b>A</b><i><b>B</b></i></p>
21707 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21708 <p><i><b>A</b></i><i><b>B</b></i></p>
21709 <p><i><b>A</b></i><b><i>B</i></b></p>
21710 <p><b><i>A</i></b><i><b>B</b></i></p>
21711 !! end
21712
21713 !! test
21714 2. I/B quote minimization: wikitext and html tags should not be combined
21715 !! options
21716 parsoid=html2wt
21717 !! wikitext
21718 ''A''<i>B</i>
21719
21720 ''A'''''<i>B</i>'''
21721 !! html
21722 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21723 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21724 !! end
21725
21726 !! test
21727 3. I/B quote minimization: templated content stops minimization
21728 !! options
21729 parsoid=html2wt
21730 !! wikitext
21731 ''A''{{echo|''B''}}
21732
21733 ''A''{{echo|'''''B'''''}}
21734 !! html
21735 <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>
21736 <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>
21737 !! end
21738
21739 !! test
21740 4. I/B quote minimization: new content should be mimimized with adjacent old content
21741 !! options
21742 parsoid=html2wt
21743 !! wikitext
21744 ''AB''
21745
21746 '''AB'''
21747
21748 ''A'''B'''''
21749 !! html
21750 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21751 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21752 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21753 !! end
21754
21755 #------------------------------------
21756 # End of I/B quote minimization tests
21757 #------------------------------------
21758
21759 !!test
21760 Bug 54262: New entities
21761 !! options
21762 parsoid=html2wt
21763 !! wikitext
21764 &nbsp;
21765 !! html
21766 <span typeof="mw:Entity">&nbsp;</span>
21767 !! end
21768
21769 ## Note that there is no wikitext output for 'unknownproperty' ##
21770 ## Unknown magic words are silently dropped ##
21771
21772 !! test
21773 Magic words
21774 !! options
21775 parsoid=html2wt
21776 !! wikitext
21777 __TOC__
21778 __NOTOC__
21779 __FORCETOC__
21780 __INDEX__
21781 __NOINDEX__
21782 __NOGALLERY__
21783 __NOEDITSECTION__
21784 __NOTITLECONVERT__
21785 __NOCONTENTCONVERT__
21786 !! html
21787 <meta property='mw:PageProp/toc' />
21788 <meta property='mw:PageProp/notoc' />
21789 <meta property='mw:PageProp/forcetoc' />
21790 <meta property='mw:PageProp/index' />
21791 <meta property='mw:PageProp/noindex' />
21792 <meta property='mw:PageProp/nogallery' />
21793 <meta property='mw:PageProp/noeditsection' />
21794 <meta property='mw:PageProp/notitleconvert' />
21795 <meta property='mw:PageProp/nocontentconvert' />
21796 <meta property='mw:PageProp/unknownproperty' />
21797 !! end
21798
21799 !! test
21800 Consecutive <pre>s should not get merged
21801 !! options
21802 parsoid=html2wt,html2html
21803 !! wikitext
21804 a
21805
21806 b
21807
21808 c
21809
21810 d
21811
21812 e
21813
21814
21815
21816 f
21817 !! html
21818 <pre>a</pre><pre>b</pre>
21819
21820 <pre>c
21821 </pre><pre>
21822 d</pre>
21823
21824 <pre>e
21825
21826 </pre><pre>
21827
21828 f</pre>
21829 !! end
21830
21831 !! test
21832 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21833 !! options
21834 parsoid=html2wt
21835 !! wikitext
21836 [[Special:BookSources/1234567890|ISBN 1234567895]]
21837 !! html
21838 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21839 !! end
21840
21841 !! test
21842 Edited RFC links not serializable as RFC links should serialize as extlinks
21843 !! options
21844 parsoid=html2wt
21845 !! wikitext
21846 [//tools.ietf.org/html/rfc123 New RFC]
21847 !! html
21848 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21849 !! end
21850
21851 !! test
21852 Edited PMID links not serializable as PMID links should serialize as extlinks
21853 !! options
21854 parsoid=html2wt
21855 !! wikitext
21856 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21857 !! html
21858 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21859 !! end
21860
21861 !! test
21862 Edited Redirect link should emit a non-piped wikitext link
21863 !! options
21864 parsoid=html2wt
21865 !! wikitext
21866 #REDIRECT [[Bar]]
21867 !! html
21868 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21869 !! end
21870
21871 # -----------------------------------------------------------------
21872 # End of section for Parsoid-only html2wt tests for serialization
21873 # of new content
21874 # -----------------------------------------------------------------
21875
21876 TODO:
21877 more images
21878 more tables
21879 character entities
21880 and much more
21881 Try for 100% code coverage