e2bf9f64fbb649604a92dd619dab0d2f64fee210
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # comment run through Linker::formatComment() instead of main parser
30 # local format section links in edit comment text as local links
31 # notoc disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
33 #
34 # You can also set the following parser properties via test options:
35 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 # wgLinkHolderBatchSize, wgRawHtml
37 #
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
41
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
48
49 !!article
50 Template:Foo
51 !!text
52 FOO
53 !!endarticle
54
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
59
60 !! article
61 Template:pipe
62 !! text
63 |
64 !! endarticle
65
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
71
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
77
78 !! article
79 Template:tbl-start
80 !! text
81 {|
82 !! endarticle
83
84 !! article
85 Template:tbl-end
86 !! text
87 |}
88 !! endarticle
89
90 !! article
91 Template:!
92 !! text
93 |
94 !! endarticle
95
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
101
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
107
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
113
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
119
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
126
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
132
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
139
140 !! article
141 A?b
142 !! text
143 Weirdo titles!
144 !! endarticle
145
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
151
152 !!article
153 Template:OpenTable
154 !!text
155 {|
156 !!endarticle
157
158 ###
159 ### Basic tests
160 ###
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
166
167
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
176
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
180 foo
181
182 bar
183
184
185 baz
186
187
188
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
194 baz
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
199
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
204 a
205 <!--foo-->
206 b
207 ----
208 a
209 <!--foo--><!--More than 1 comment, still stripped-->
210 b
211 ----
212 a
213 <!--foo--> <!----> <!-- bar -->
214 b
215 ----
216 a
217 <!--foo-->
218
219 b
220 ----
221 a
222
223 <!--foo-->
224 b
225 ----
226 a
227 <!--foo-->
228
229
230 b
231 ----
232 a
233
234
235 <!--foo-->
236 b
237 ----
238 !! html
239 <hr />
240 <p>a
241 b
242 </p>
243 <hr />
244 <p>a
245 b
246 </p>
247 <hr />
248 <p>a
249 b
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
262 b
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
267 b
268 </p>
269 <hr />
270
271 !! end
272
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
277 a
278
279 b
280 ----
281 a
282
283
284 b
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br />
294 b
295 </p>
296 <hr />
297
298 !! end
299
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
304 a
305 <!--foo-->
306 b
307 ----
308 a
309 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
310 b
311 ----
312 a
313
314 <!--foo-->
315 <!--bar-->
316 b
317 ----
318 a
319
320 <!--foo-->
321 <!--bar-->
322
323 b
324 ----
325 !! html
326 <hr />
327 <p>a
328 b
329 </p>
330 <hr />
331 <p>a
332 b
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br />
341 b
342 </p>
343 <hr />
344
345 !! end
346
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
350 a
351
352 <!--boo-->
353
354 b
355 !! html
356 <p>a
357 </p><p><br />
358 b
359 </p>
360 !!end
361
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
365 a
366
367
368
369 =b=
370 [[a]]
371
372
373 =b=
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
383
384 !! end
385
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
389 =b=
390
391
392
393 [[a]]
394 !! html
395 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
399
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
409
410 !! test
411 Simple list
412 !! wikitext
413 * Item 1
414 * Item 2
415 !! html
416 <ul>
417 <li> Item 1
418 </li>
419 <li> Item 2
420 </li>
421 </ul>
422
423 !! end
424
425 !! test
426 Italics and bold
427 !! wikitext
428 * plain
429 * plain''italic''plain
430 * plain''italic''plain''italic''plain
431 * plain'''bold'''plain
432 * plain'''bold'''plain'''bold'''plain
433 * plain''italic''plain'''bold'''plain
434 * plain'''bold'''plain''italic''plain
435 * plain''italic'''bold-italic'''italic''plain
436 * plain'''bold''bold-italic''bold'''plain
437 * plain'''''bold-italic'''italic''plain
438 * plain'''''bold-italic''bold'''plain
439 * plain''italic'''bold-italic'''''plain
440 * plain'''bold''bold-italic'''''plain
441 * plain l'''italic''plain
442 * plain l''''bold''' plain
443 !! html
444 <ul>
445 <li> plain
446 </li>
447 <li> plain<i>italic</i>plain
448 </li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain
450 </li>
451 <li> plain<b>bold</b>plain
452 </li>
453 <li> plain<b>bold</b>plain<b>bold</b>plain
454 </li>
455 <li> plain<i>italic</i>plain<b>bold</b>plain
456 </li>
457 <li> plain<b>bold</b>plain<i>italic</i>plain
458 </li>
459 <li> plain<i>italic<b>bold-italic</b>italic</i>plain
460 </li>
461 <li> plain<b>bold<i>bold-italic</i>bold</b>plain
462 </li>
463 <li> plain<i><b>bold-italic</b>italic</i>plain
464 </li>
465 <li> plain<b><i>bold-italic</i>bold</b>plain
466 </li>
467 <li> plain<i>italic<b>bold-italic</b></i>plain
468 </li>
469 <li> plain<b>bold<i>bold-italic</i></b>plain
470 </li>
471 <li> plain l'<i>italic</i>plain
472 </li>
473 <li> plain l'<b>bold</b> plain
474 </li>
475 </ul>
476
477 !! end
478
479 # this example taken from the [[simple:Moon]] article (bug 47326)
480 !! test
481 Italics and possessives (1)
482 !! wikitext
483 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
484 !! html
485 <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
486 </p>
487 !! end
488
489 # this example taken from [[en:Flaming Pie]] (bug 49926)
490 !! test
491 Italics and possessives (2)
492 !! wikitext
493 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
494 !! html
495 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
496 </p>
497 !! end
498
499 # this example taken from [[en:Dictionary]] (bug 49926)
500 !! test
501 Italics and possessives (3)
502 !! wikitext
503 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''.
504 !! html
505 <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>.
506 </p>
507 !! end
508
509
510 ###
511 ### 2-quote opening sequence tests
512 ###
513 !! test
514 Italics and bold: 2-quote opening sequence: (2,2)
515 !! wikitext
516 ''foo''
517 !! html
518 <p><i>foo</i>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 2-quote opening sequence: (2,3)
525 !! options
526 parsoid=wt2html
527 !! wikitext
528 ''foo'''
529 !! html/*
530 <p><i>foo'</i>
531 </p>
532 !!end
533
534
535 # same html as previous, but wikitext adjusted to match parsoid html2wt
536 !! test
537 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
538 !! wikitext
539 ''<nowiki>foo'</nowiki>''
540 !! html
541 <p><i>foo'</i>
542 </p>
543 !! end
544
545
546 !! test
547 Italics and bold: 2-quote opening sequence: (2,4)
548 !! options
549 parsoid=wt2html
550 !! wikitext
551 ''foo''''
552 !! html/*
553 <p><i>foo''</i>
554 </p>
555 !!end
556
557
558 # same html as previous, but wikitext adjusted to match parsoid html2wt
559 !! test
560 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
561 !! wikitext
562 ''<nowiki>foo''</nowiki>''
563 !! html
564 <p><i>foo''</i>
565 </p>
566 !! end
567
568
569 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
570 !! test
571 Italics and bold: 2-quote opening sequence: (2,5)
572 !! options
573 parsoid=wt2html
574 !! wikitext
575 ''foo'''''
576 !! html/php
577 <p><i>foo</i>
578 </p>
579 !! html/parsoid
580 <p><i>foo</i><b></b>
581 </p>
582 !!end
583
584 # same html as previous, but wikitext adjusted to match parsoid html2wt
585 !! test
586 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
587 !! wikitext
588 ''foo'''''<nowiki/>'''
589 !! html/php
590 <p><i>foo</i>
591 </p>
592 !! html/parsoid
593 <p><i>foo</i><b></b>
594 </p>
595 !! end
596
597
598 ###
599 ### 3-quote opening sequence tests
600 ###
601
602 !! test
603 Italics and bold: 3-quote opening sequence: (3,2)
604 !! wikitext
605 '''foo''
606 !! html
607 <p>'<i>foo</i>
608 </p>
609 !!end
610
611
612 !! test
613 Italics and bold: 3-quote opening sequence: (3,3)
614 !! wikitext
615 '''foo'''
616 !! html
617 <p><b>foo</b>
618 </p>
619 !!end
620
621
622 !! test
623 Italics and bold: 3-quote opening sequence: (3,4)
624 !! options
625 parsoid=wt2html
626 !! wikitext
627 '''foo''''
628 !! html/*
629 <p><b>foo'</b>
630 </p>
631 !!end
632
633
634 # same html as previous, but wikitext adjusted to match parsoid html2wt
635 !! test
636 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
637 !! wikitext
638 '''<nowiki>foo'</nowiki>'''
639 !! html
640 <p><b>foo'</b>
641 </p>
642 !! end
643
644
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: 3-quote opening sequence: (3,5)
648 !! options
649 parsoid=wt2html
650 !! wikitext
651 '''foo'''''
652 !! html/php
653 <p><b>foo</b>
654 </p>
655 !! html/parsoid
656 <p><b>foo</b><i></i>
657 </p>
658 !!end
659
660 # same html as previous, but wikitext adjusted to match parsoid html2wt
661 !! test
662 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
663 !! wikitext
664 '''foo'''''<nowiki/>''
665 !! html/php
666 <p><b>foo</b>
667 </p>
668 !! html/parsoid
669 <p><b>foo</b><i></i>
670 </p>
671 !! end
672
673
674 ###
675 ### 4-quote opening sequence tests
676 ###
677
678 !! test
679 Italics and bold: 4-quote opening sequence: (4,2)
680 !! options
681 parsoid=wt2html
682 !! wikitext
683 ''''foo''
684 !! html/*
685 <p>''<i>foo</i>
686 </p>
687 !!end
688
689
690 # same html as previous, but wikitext adjusted to match parsoid html2wt
691 !! test
692 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
693 !! wikitext
694 <nowiki>''</nowiki>''foo''
695 !! html
696 <p>''<i>foo</i>
697 </p>
698 !! end
699
700
701 !! test
702 Italics and bold: 4-quote opening sequence: (4,3)
703 !! wikitext
704 ''''foo'''
705 !! html
706 <p>'<b>foo</b>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: 4-quote opening sequence: (4,4)
713 !! options
714 parsoid=wt2html
715 !! wikitext
716 ''''foo''''
717 !! html/*
718 <p>'<b>foo'</b>
719 </p>
720 !!end
721
722
723 # same html as previous, but wikitext adjusted to match parsoid html2wt
724 !! test
725 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
726 !! wikitext
727 ''''<nowiki>foo'</nowiki>'''
728 !! html
729 <p>'<b>foo'</b>
730 </p>
731 !! end
732
733
734 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
735 !! test
736 Italics and bold: 4-quote opening sequence: (4,5)
737 !! options
738 parsoid=wt2html
739 !! wikitext
740 ''''foo'''''
741 !! html/php
742 <p>'<b>foo</b>
743 </p>
744 !! html/parsoid
745 <p>'<b>foo</b><i></i>
746 </p>
747 !!end
748
749 # same html as previous, but wikitext adjusted to match parsoid html2wt
750 !! test
751 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
752 !! wikitext
753 ''''foo'''''<nowiki/>''
754 !! html/php
755 <p>'<b>foo</b>
756 </p>
757 !! html/parsoid
758 <p>'<b>foo</b><i></i>
759 </p>
760 !! end
761
762
763 ###
764 ### 5-quote opening sequence tests
765 ###
766
767 !! test
768 Italics and bold: 5-quote opening sequence: (5,2)
769 !! options
770 parsoid=wt2html
771 !! wikitext
772 '''''foo''
773 !! html/*
774 <p><b><i>foo</i></b>
775 </p>
776 !!end
777
778
779 # same html as previous, but wikitext adjusted to match parsoid html2wt
780 # skipping wt2html and html2html because it wants to put <i> before <b>
781 !! test
782 Italics and bold: 5-quote opening sequence: (5,2+3)
783 !! options
784 parsoid=wt2wt,html2wt
785 !! wikitext
786 '''''foo'''''
787 !! html/*
788 <p><b><i>foo</i></b>
789 </p>
790 !! end
791
792 !! test
793 Italics and bold: 5-quote opening sequence: (5,3)
794 !! options
795 parsoid=wt2html
796 !! wikitext
797 '''''foo'''
798 !! html/*
799 <p><i><b>foo</b></i>
800 </p>
801 !!end
802
803
804 # same html as previous, but wikitext adjusted to match parsoid html2wt
805 !! test
806 Italics and bold: 5-quote opening sequence: (5,3+2)
807 !! wikitext
808 '''''foo'''''
809 !! html
810 <p><i><b>foo</b></i>
811 </p>
812 !! end
813
814
815 !! test
816 Italics and bold: 5-quote opening sequence: (5,4)
817 !! options
818 parsoid=wt2html
819 !! wikitext
820 '''''foo''''
821 !! html/*
822 <p><i><b>foo'</b></i>
823 </p>
824 !!end
825
826
827 # same html as previous, but wikitext adjusted to match parsoid html2wt
828 !! test
829 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
830 !! wikitext
831 '''''<nowiki>foo'</nowiki>'''''
832 !! html
833 <p><i><b>foo'</b></i>
834 </p>
835 !! end
836
837
838 !! test
839 Italics and bold: 5-quote opening sequence: (5,5)
840 !! wikitext
841 '''''foo'''''
842 !! html
843 <p><i><b>foo</b></i>
844 </p>
845 !!end
846
847 ###
848 ### multiple quote sequences in a line
849 ###
850 !! test
851 Italics and bold: multiple quote sequences: (2,4,2)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 ''foo''''bar''
856 !! html/*
857 <p><i>foo'<b>bar</b></i>
858 </p>
859 !!end
860
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
865 !! wikitext
866 ''<nowiki>foo'</nowiki>'''bar'''''
867 !! html
868 <p><i>foo'<b>bar</b></i>
869 </p>
870 !! end
871
872
873 !! test
874 Italics and bold: multiple quote sequences: (2,4,3)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 ''foo''''bar'''
879 !! html/*
880 <p><i>foo'<b>bar</b></i>
881 </p>
882 !!end
883
884
885 # same html as previous, but wikitext adjusted to match parsoid html2wt
886 !! test
887 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
888 !! wikitext
889 ''<nowiki>foo'</nowiki>'''bar'''''
890 !! html
891 <p><i>foo'<b>bar</b></i>
892 </p>
893 !! end
894
895
896 !! test
897 Italics and bold: multiple quote sequences: (2,4,4)
898 !! options
899 parsoid=wt2html
900 !! wikitext
901 ''foo''''bar''''
902 !! html/*
903 <p><i>foo'<b>bar'</b></i>
904 </p>
905 !!end
906
907
908 # same html as previous, but wikitext adjusted to match parsoid html2wt
909 !! test
910 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
911 !! wikitext
912 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
913 !! html
914 <p><i>foo'<b>bar'</b></i>
915 </p>
916 !! end
917
918
919 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
920 !! test
921 Italics and bold: multiple quote sequences: (3,4,2)
922 !! options
923 parsoid=wt2html
924 !! wikitext
925 '''foo''''bar''
926 !! html/php
927 <p><b>foo'</b>bar
928 </p>
929 !! html/parsoid
930 <p><b>foo'</b>bar<i></i>
931 </p>
932 !!end
933
934 # same html as previous, but wikitext adjusted to match parsoid html2wt
935 !! test
936 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
937 !! options
938 parsoid
939 !! wikitext
940 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
941 !! html/php
942 <p><b>foo'</b>bar
943 </p>
944 !! html/parsoid
945 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
946 </p>
947 !! end
948
949
950 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
951 !! test
952 Italics and bold: multiple quote sequences: (3,4,3)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 '''foo''''bar'''
957 !! html/php
958 <p><b>foo'</b>bar
959 </p>
960 !! html/parsoid
961 <p><b>foo'</b>bar<b></b>
962 </p>
963 !!end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
968 !! wikitext
969 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
970 !! html/php
971 <p><b>foo'</b>bar
972 </p>
973 !! html/parsoid
974 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
975 </p>
976 !! end
977
978 ###
979 ### other quote tests
980 ###
981 !! test
982 Italics and bold: other quote tests: (2,3,5)
983 !! wikitext
984 ''this is about '''foo's family'''''
985 !! html
986 <p><i>this is about <b>foo's family</b></i>
987 </p>
988 !!end
989
990
991 !! test
992 Italics and bold: other quote tests: (2,(3,3),2)
993 !! wikitext
994 ''this is about '''foo's''' family''
995 !! html
996 <p><i>this is about <b>foo's</b> family</i>
997 </p>
998 !!end
999
1000
1001 !! test
1002 Italics and bold: other quote tests: (3,2,3,2)
1003 !! options
1004 parsoid=wt2html
1005 !! wikitext
1006 '''this is about ''foo'''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 # same html as previous, but wikitext adjusted to match parsoid html2wt
1014 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1015 !! test
1016 Italics and bold: other quote tests: (3,2,3+2+2,2)
1017 !! options
1018 parsoid
1019 !! wikitext
1020 '''this is about ''foo'''''<nowiki/>''s family''
1021 !! html/*
1022 <p><b>this is about <i>foo</i></b><i>s family</i>
1023 </p>
1024 !! end
1025
1026
1027 !! test
1028 Italics and bold: other quote tests: (3,2,3,3)
1029 !! options
1030 !! wikitext
1031 '''this is about ''foo'''s family'''
1032 !! html
1033 <p>'<i>this is about </i>foo<b>s family</b>
1034 </p>
1035 !!end
1036
1037
1038 !! test
1039 Italics and bold: other quote tests: (3,(2,2),3)
1040 !! wikitext
1041 '''this is about ''foo's'' family'''
1042 !! html
1043 <p><b>this is about <i>foo's</i> family</b>
1044 </p>
1045 !!end
1046
1047
1048 !! test
1049 Italicized possessive
1050 !! wikitext
1051 The ''[[Main Page]]'''s talk page.
1052 !! html
1053 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1054 </p>
1055 !! end
1056
1057 !! test
1058 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1059 (Requires tidy for PHP parser output to be fixed up)
1060 !! options
1061 parsoid=wt2html,wt2wt
1062 !! wikitext
1063 {|
1064 !''a!!''b
1065 |''a||''b
1066 |}
1067 !! html
1068 <table>
1069 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1070 <td><i>a</i></td><td><i>b</i></td></tr>
1071 </tbody></table>
1072 !! end
1073
1074 ###
1075 ### Non-html5 tags
1076 ###
1077
1078 !! test
1079 Non-html5 tags should be accepted
1080 !! wikitext
1081 <center>''foo''</center>
1082 <big>''foo''</big>
1083 <font>''foo''</font>
1084 <strike>''foo''</strike>
1085 <tt>''foo''</tt>
1086 !! html
1087 <center><i>foo</i></center>
1088 <p><big><i>foo</i></big>
1089 <font><i>foo</i></font>
1090 <strike><i>foo</i></strike>
1091 <tt><i>foo</i></tt>
1092 </p>
1093 !! end
1094
1095 !! test
1096 <wbr> is valid wikitext (bug 52468)
1097 !! wikitext
1098 <wbr>
1099 !! html
1100 <p><wbr />
1101 </p>
1102 !! end
1103
1104 # <strike> is HTML4, <s> is HTML4/5.
1105 !! test
1106 <s> or <strike> for strikethrough
1107 !! wikitext
1108 <strike>strike</strike>
1109
1110 <s>s</s>
1111 !! html
1112 <p><strike>strike</strike>
1113 </p><p><s>s</s>
1114 </p>
1115 !! end
1116
1117 !! test
1118 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1119 !! wikitext
1120 <b→> doesn't work! </b→>
1121
1122 <bä> doesn't work! </bä>
1123
1124 <boo> works fine </boo>
1125
1126 <s.foo>s.foo</s.foo>
1127
1128 <sub-ID#1>
1129 !! html
1130 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1131 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1132 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1133 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1134 </p><p>&lt;sub-ID#1&gt;
1135 </p>
1136 !! end
1137
1138 !! test
1139 Isolated close tags should be treated as literal text (bug 52760)
1140 !! wikitext
1141 </b>
1142
1143 <s.foo>s</s>
1144 !! html
1145 <p>&lt;/b&gt;
1146 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1147 </p>
1148 !! end
1149
1150 ###
1151 ### Special characters
1152 ###
1153
1154 !! test
1155 Bare pipe character (bug 52363)
1156 !! wikitext
1157 |
1158 !! html
1159 <p>|
1160 </p>
1161 !! end
1162
1163 !! test
1164 Bare pipe character from a template (bug 52363)
1165 !! wikitext
1166 {{pipe}}
1167 !! html
1168 <p>|
1169 </p>
1170 !! end
1171
1172 ###
1173 ### <nowiki> test cases
1174 ###
1175
1176 !! test
1177 <nowiki> unordered list
1178 !! wikitext
1179 <nowiki>* This is not an unordered list item.</nowiki>
1180 !! html
1181 <p>* This is not an unordered list item.
1182 </p>
1183 !! end
1184
1185 !! test
1186 <nowiki> spacing
1187 !! wikitext
1188 <nowiki>Lorem ipsum dolor
1189
1190 sed abit.
1191 sed nullum.
1192
1193 :and a colon
1194 </nowiki>
1195 !! html
1196 <p>Lorem ipsum dolor
1197
1198 sed abit.
1199 sed nullum.
1200
1201 :and a colon
1202
1203 </p>
1204 !! end
1205
1206 !! test
1207 nowiki 3
1208 !! wikitext
1209 :There is not nowiki.
1210 :There is <nowiki>nowiki</nowiki>.
1211
1212 #There is not nowiki.
1213 #There is <nowiki>nowiki</nowiki>.
1214
1215 *There is not nowiki.
1216 *There is <nowiki>nowiki</nowiki>.
1217 !! html
1218 <dl>
1219 <dd>There is not nowiki.
1220 </dd>
1221 <dd>There is nowiki.
1222 </dd>
1223 </dl>
1224 <ol>
1225 <li>There is not nowiki.
1226 </li>
1227 <li>There is nowiki.
1228 </li>
1229 </ol>
1230 <ul>
1231 <li>There is not nowiki.
1232 </li>
1233 <li>There is nowiki.
1234 </li>
1235 </ul>
1236
1237 !! end
1238
1239 !! test
1240 Entities inside <nowiki>
1241 !! wikitext
1242 <nowiki>&lt;</nowiki>
1243 !! html
1244 <p>&lt;
1245 </p>
1246 !! end
1247
1248 !! test
1249 Entities inside template parameters
1250 !! options
1251 parsoid
1252 !! wikitext
1253 {{echo|&ndash;}}
1254 !! html
1255 <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>
1256 </p>
1257 !! end
1258
1259 ###
1260 ### Comments
1261 ###
1262 !! test
1263 Comments and Indent-Pre
1264 !! wikitext
1265 <!-- comment 1 --> asdf
1266
1267 <!-- comment 1 --> asdf
1268 <!-- comment 2 -->
1269
1270 <!-- comment 1 --> asdf
1271 <!-- comment 2 -->xyz
1272
1273 <!-- comment 1 --> asdf
1274 <!-- comment 2 --> xyz
1275 !! html
1276 <pre>asdf
1277 </pre>
1278 <pre>asdf
1279 </pre>
1280 <pre>asdf
1281 </pre>
1282 <p>xyz
1283 </p>
1284 <pre>asdf
1285 xyz
1286 </pre>
1287 !! end
1288
1289 !! test
1290 Comment test 2a
1291 !! wikitext
1292 asdf
1293 <!-- comment 1 -->
1294 jkl
1295 !! html
1296 <p>asdf
1297 jkl
1298 </p>
1299 !! end
1300
1301 !! test
1302 Comment test 2b
1303 !! wikitext
1304 asdf
1305 <!-- comment 1 -->
1306
1307 jkl
1308 !! html
1309 <p>asdf
1310 </p><p>jkl
1311 </p>
1312 !! end
1313
1314 !! test
1315 Comment test 3
1316 !! wikitext
1317 asdf
1318 <!-- comment 1 -->
1319 <!-- comment 2 -->
1320 jkl
1321 !! html
1322 <p>asdf
1323 jkl
1324 </p>
1325 !! end
1326
1327 !! test
1328 Comment test 4
1329 !! wikitext
1330 asdf<!-- comment 1 -->jkl
1331 !! html
1332 <p>asdfjkl
1333 </p>
1334 !! end
1335
1336 !! test
1337 Comment spacing
1338 !! wikitext
1339 a
1340 <!-- foo --> b <!-- bar -->
1341 c
1342 !! html
1343 <p>a
1344 </p>
1345 <pre> b
1346 </pre>
1347 <p>c
1348 </p>
1349 !! end
1350
1351 !! test
1352 Comment whitespace
1353 !! wikitext
1354 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1355 !! html
1356
1357 !! end
1358
1359 !! test
1360 Comment semantics and delimiters
1361 !! wikitext
1362 <!-- --><!----><!-----><!------>
1363 !! html
1364
1365 !! end
1366
1367 !! test
1368 Comment semantics and delimiters, redux
1369 !! wikitext
1370 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1371 -- foo -- funky huh? ... -->
1372 !! html
1373
1374 !! end
1375
1376 !! test
1377 Comment semantics and delimiters: directors cut
1378 !! wikitext
1379 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1380 everything starting with < followed by !-- until the first -- and > we see,
1381 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1382 -->-->
1383 !! html
1384 <p>--&gt;
1385 </p>
1386 !! end
1387
1388 !! test
1389 Comment semantics: nesting
1390 !! wikitext
1391 <!--<!-- no, we're not going to do anything fancy here -->-->
1392 !! html
1393 <p>--&gt;
1394 </p>
1395 !! end
1396
1397 !! test
1398 Comment semantics: unclosed comment at end
1399 !! wikitext
1400 <!--This comment will run out to the end of the document
1401 !! html
1402
1403 !! end
1404
1405 !! test
1406 Comment in template title
1407 !! wikitext
1408 {{f<!---->oo}}
1409 !! html
1410 <p>FOO
1411 </p>
1412 !! end
1413
1414 !! test
1415 Comment on its own line post-expand
1416 !! wikitext
1417 a
1418 {{blank}}<!---->
1419 b
1420 !! html
1421 <p>a
1422 </p><p>b
1423 </p>
1424 !! end
1425
1426 !! test
1427 Comment on its own line post-expand with non-significant whitespace
1428 !! wikitext
1429 a
1430 {{blank}} <!---->
1431 b
1432 !! html
1433 <p>a
1434 </p><p>b
1435 </p>
1436 !! end
1437
1438 !! test
1439 Multiple comments should still parse as SOL-transparent
1440 !! options
1441 parsoid=wt2html,wt2wt
1442 !! wikitext
1443 <!--c1-->*a
1444 <!--c2--><!--c3--><!--c4-->*b
1445 !! html
1446 <ul>
1447 <li>a
1448 </li>
1449 <li>b
1450 </li>
1451 </ul>
1452 !! end
1453
1454 ###
1455 ### paragraph wrapping tests
1456 ###
1457 !! test
1458 No block tags
1459 !! wikitext
1460 a
1461
1462 b
1463 !! html
1464 <p>a
1465 </p><p>b
1466 </p>
1467 !! end
1468
1469 !! test
1470 Block tag on one line (<div>)
1471 !! wikitext
1472 a <div>foo</div>
1473
1474 b
1475 !! html
1476 a <div>foo</div>
1477 <p>b
1478 </p>
1479 !! end
1480
1481 !! test
1482 Block tag on one line (<blockquote>)
1483 !! wikitext
1484 a <blockquote>foo</blockquote>
1485
1486 b
1487 !! html
1488 a <blockquote>foo</blockquote>
1489 <p>b
1490 </p>
1491 !! end
1492
1493 !! test
1494 Block tag on both lines (<div>)
1495 !! wikitext
1496 a <div>foo</div>
1497
1498 b <div>foo</div>
1499 !! html
1500 a <div>foo</div>
1501 b <div>foo</div>
1502
1503 !! end
1504
1505 !! test
1506 Block tag on both lines (<blockquote>)
1507 !! wikitext
1508 a <blockquote>foo</blockquote>
1509
1510 b <blockquote>foo</blockquote>
1511 !! html
1512 a <blockquote>foo</blockquote>
1513 b <blockquote>foo</blockquote>
1514
1515 !! end
1516
1517 !! test
1518 Multiple lines without block tags
1519 !! wikitext
1520 <div>foo</div> a
1521 b
1522 c
1523 d<!--foo--> e
1524 x <div>foo</div> z
1525 !! html
1526 <div>foo</div> a
1527 <p>b
1528 c
1529 d e
1530 </p>
1531 x <div>foo</div> z
1532
1533 !! end
1534
1535 !! test
1536 Empty lines between lines with block tags
1537 !! wikitext
1538 <div></div>
1539
1540
1541 <div></div>a
1542
1543 b
1544 <div>a</div>b
1545
1546 <div>b</div>d
1547
1548
1549 <div>e</div>
1550 !! html
1551 <div></div>
1552 <p><br />
1553 </p>
1554 <div></div>a
1555 <p>b
1556 </p>
1557 <div>a</div>b
1558 <div>b</div>d
1559 <p><br />
1560 </p>
1561 <div>e</div>
1562
1563 !! end
1564
1565 ## PHP parser emits output which is broken
1566 !! test
1567 Unclosed HTML p-tags should be handled properly
1568 !! wikitext
1569 <div><p>foo</div>
1570 a
1571
1572 b
1573 !! html/parsoid
1574 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1575 <p>a</p>
1576 <p>b</p>
1577 !! end
1578
1579 ###
1580 ### Preformatted text
1581 ###
1582 !! test
1583 Preformatted text
1584 !! wikitext
1585 This is some
1586 Preformatted text
1587 With ''italic''
1588 And '''bold'''
1589 And a [[Main Page|link]]
1590 !! html
1591 <pre>This is some
1592 Preformatted text
1593 With <i>italic</i>
1594 And <b>bold</b>
1595 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1596 </pre>
1597 !! end
1598
1599 !! test
1600 Tabs don't trigger preformatted text
1601 !! wikitext
1602 This is not
1603 preformatted text.
1604 This is preformatted text.
1605 So is this.
1606 !! html
1607 <p> This is not
1608 preformatted text.
1609 </p>
1610 <pre>This is preformatted text.
1611 So is this.
1612 </pre>
1613 !! end
1614
1615 !! test
1616 Ident preformatting with inline content
1617 !! wikitext
1618 a
1619 ''b''
1620 !! html
1621 <pre>a
1622 <i>b</i>
1623 </pre>
1624 !! end
1625
1626 !! test
1627 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1628 !! wikitext
1629 <pre><nowiki>
1630 <b>
1631 <cite>
1632 <em>
1633 </nowiki></pre>
1634 !! html
1635 <pre>
1636 &lt;b&gt;
1637 &lt;cite&gt;
1638 &lt;em&gt;
1639 </pre>
1640
1641 !! end
1642
1643 !! test
1644 Regression with preformatted in <center>
1645 !! wikitext
1646 <center>
1647 Blah
1648 </center>
1649 !! html
1650 <center>
1651 <pre>Blah
1652 </pre>
1653 </center>
1654
1655 !! end
1656
1657 !! test
1658 Bug 52763: Preformatted in <blockquote>
1659 !! wikitext
1660 <blockquote>
1661 Blah
1662 {|
1663 |
1664 indented cell (no pre-wrapping!)
1665 |}
1666 </blockquote>
1667 !! html
1668 <blockquote>
1669 <p> Blah
1670 </p>
1671 <table>
1672 <tr>
1673 <td>
1674 <p> indented cell (no pre-wrapping!)
1675 </p>
1676 </td></tr></table>
1677 </blockquote>
1678
1679 !! end
1680
1681 !! test
1682 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1683 !! wikitext
1684 <blockquote>
1685 Foo
1686
1687 Bar
1688 </blockquote>
1689 !! html
1690 <blockquote>
1691 <p>Foo
1692 </p><p>Bar
1693 </p>
1694 </blockquote>
1695
1696 !! end
1697
1698 !! test
1699 Bug 15491: <ins>/<del> in blockquote
1700 !! wikitext
1701 <blockquote>
1702 Foo <del>bar</del> <ins>baz</ins> quux
1703 </blockquote>
1704 !! html
1705 <blockquote>
1706 <p>Foo <del>bar</del> <ins>baz</ins> quux
1707 </p>
1708 </blockquote>
1709
1710 !! end
1711
1712 # Note that the p-wrapping is newline sensitive, which could be
1713 # considered a bug: tidy will wrap only the 'Foo' in the example
1714 # below in a <p> tag. (see comment 23-25 of bug #6200)
1715 !! test
1716 Bug 15491: <ins>/<del> in blockquote (2)
1717 !! wikitext
1718 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1719 </blockquote>
1720 !! html
1721 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1722 </blockquote>
1723
1724 !! end
1725
1726 !! test
1727 <pre> with attributes (bug 3202)
1728 !! wikitext
1729 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1730 !! html
1731 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1732
1733 !! end
1734
1735 !! test
1736 <pre> with width attribute (bug 3202)
1737 !! wikitext
1738 <pre width="8">Narrow screen goodies</pre>
1739 !! html
1740 <pre width="8">Narrow screen goodies</pre>
1741
1742 !! end
1743
1744 !! test
1745 <pre> with forbidden attribute (bug 3202)
1746 !! wikitext
1747 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1748 !! html
1749 <pre width="8">Narrow screen goodies</pre>
1750
1751 !! end
1752
1753 !! test
1754 Entities inside <pre>
1755 !! wikitext
1756 <pre>&lt;</pre>
1757 !! html
1758 <pre>&lt;</pre>
1759
1760 !! end
1761
1762 !! test
1763 <pre> with forbidden attribute values (bug 3202)
1764 !! wikitext
1765 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1766 !! html
1767 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1768
1769 !! end
1770
1771 !! test
1772 <nowiki> inside <pre> (bug 13238)
1773 !! wikitext
1774 <pre>
1775 <nowiki>
1776 </pre>
1777 <pre>
1778 <nowiki></nowiki>
1779 </pre>
1780 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1781 !! html
1782 <pre>
1783 &lt;nowiki&gt;
1784 </pre>
1785 <pre>
1786
1787 </pre>
1788 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1789
1790 !! end
1791
1792 !! test
1793 <nowiki> and <pre> preference (first one wins)
1794 !! wikitext
1795 <pre>
1796 <nowiki>
1797 </pre>
1798 </nowiki>
1799 </pre>
1800
1801 <nowiki>
1802 <pre>
1803 <nowiki>
1804 </pre>
1805 </nowiki>
1806 </pre>
1807
1808 !! html
1809 <pre>
1810 &lt;nowiki&gt;
1811 </pre>
1812 <p>&lt;/nowiki&gt;
1813 &lt;/pre&gt;
1814 </p><p>
1815 &lt;pre&gt;
1816 &lt;nowiki&gt;
1817 &lt;/pre&gt;
1818
1819 &lt;/pre&gt;
1820 </p>
1821 !! end
1822
1823 !! test
1824 </pre> inside nowiki
1825 !! wikitext
1826 <nowiki></pre></nowiki>
1827 !! html
1828 <p>&lt;/pre&gt;
1829 </p>
1830 !! end
1831
1832 !! test
1833 Empty pre; pre inside other HTML tags (bug 54946)
1834 !! wikitext
1835 a
1836
1837 <div><pre>
1838 foo
1839 </pre></div>
1840 <pre></pre>
1841 !! html
1842 <p>a
1843 </p>
1844 <div><pre>
1845 foo
1846 </pre></div>
1847 <pre></pre>
1848
1849 !! end
1850
1851 !! test
1852 HTML pre followed by indent-pre
1853 !! wikitext
1854 <pre>foo</pre>
1855 bar
1856 !! html
1857 <pre>foo</pre>
1858 <pre>bar
1859 </pre>
1860 !! end
1861
1862 !!test
1863 Block tag pre
1864 !!options
1865 parsoid
1866 !! wikitext
1867 <p><pre>foo</pre></p>
1868 !! html
1869 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1870 !!end
1871
1872 !!test
1873 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1874 !! wikitext
1875 {{echo|}}
1876 !! html
1877
1878 !!end
1879
1880 !!test
1881 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1882 !! wikitext
1883 {{echo|
1884 foo}}
1885 !! html
1886 <p>foo
1887 </p>
1888 !!end
1889
1890 !! test
1891 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1892 !! wikitext
1893 {{echo|a
1894 b}}
1895 !! html
1896 <pre>a
1897 </pre>
1898 <p>b
1899 </p>
1900 !!end
1901
1902 !! test
1903 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1904 !! wikitext
1905 {{echo|a
1906 b
1907 c
1908 d
1909 e
1910 }}
1911 !! html
1912 <pre>a
1913 </pre>
1914 <p>b
1915 c
1916 </p>
1917 <pre>d
1918 </pre>
1919 <p>e
1920 </p>
1921 !!end
1922
1923 !!test
1924 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1925 !! wikitext
1926 {{echo| foo}}
1927
1928 {{echo| foo}}{{echo| bar}}
1929
1930 {{echo| foo}}
1931 {{echo| bar}}
1932
1933 {{echo|<!--cmt--> foo}}
1934
1935 <!--cmt-->{{echo| foo}}
1936
1937 {{echo|{{echo| }}bar}}
1938 !! html
1939 <pre>foo
1940 </pre>
1941 <pre>foo bar
1942 </pre>
1943 <pre>foo
1944 bar
1945 </pre>
1946 <pre>foo
1947 </pre>
1948 <pre>foo
1949 </pre>
1950 <pre>bar
1951 </pre>
1952 !!end
1953
1954 !! test
1955 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1956 !! wikitext
1957 {{echo| }}a
1958
1959 {{echo|
1960 }}a
1961
1962 {{echo|
1963 b}}
1964
1965 {{echo|a
1966 }}b
1967
1968 {{echo|a
1969 }} b
1970 !! html
1971 <pre>a
1972 </pre>
1973 <p><br />
1974 </p>
1975 <pre>a
1976 </pre>
1977 <p><br />
1978 </p>
1979 <pre>b
1980 </pre>
1981 <p>a
1982 </p>
1983 <pre>b
1984 </pre>
1985 <p>a
1986 </p>
1987 <pre>b
1988 </pre>
1989 !!end
1990
1991 !! test
1992 Things that look like <pre> tags aren't treated as such
1993 !! wikitext
1994 Barack Obama <President> of the United States
1995 !! html
1996 <p>Barack Obama &lt;President&gt; of the United States
1997 </p>
1998 !! end
1999
2000 !! test
2001 Parsoid: handle pre with space after attribute
2002 !! options
2003 parsoid=wt2html
2004 !! wikitext
2005 <pre style="width:50%;" >{{echo|foo}}</pre>
2006 !! html
2007 <pre style="width:50%;">{{echo|foo}}</pre>
2008 !! end
2009
2010 # TODO / maybe: fix wt2wt for this
2011 !! test
2012 Parsoid: Don't paragraph-wrap fosterable content
2013 !! options
2014 parsoid=wt2html
2015 !! wikitext
2016 {|
2017 <td></td>
2018 <td></td>
2019
2020
2021
2022 |}
2023 !! html
2024 <table>
2025
2026 <tbody>
2027 <tr>
2028 <td></td>
2029
2030 <td></td></tr>
2031
2032
2033
2034 </tbody></table>
2035 !! end
2036
2037 !! test
2038 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2039 !! options
2040 parsoid=wt2html
2041 !! wikitext
2042 {|
2043 <td>
2044 <td>
2045 </td>
2046
2047
2048
2049 |}
2050 !! html
2051 <table>
2052
2053 <tbody>
2054 <tr>
2055 <td></td>
2056
2057 <td>
2058 </td></tr>
2059
2060
2061
2062 </tbody></table>
2063 !! end
2064
2065
2066 #--------------------------------------------------------------------
2067 # Transclusion parameter whitespace stripping tests
2068 # Behavior is different for positional and named parameters
2069 #--------------------------------------------------------------------
2070 !! test
2071 Templates: Strip leading and trailing whitespace from named-param values
2072 !! wikitext
2073 {{echo|1= a }}
2074
2075 {{echo|1= {{echo|b}} }}
2076
2077 {{echo| 1 =
2078 c }}
2079
2080 {{echo| 1 =
2081 * d
2082 }}
2083 !! html
2084 <p>a
2085 </p><p>b
2086 </p><p>c
2087 </p>
2088 <ul>
2089 <li> d
2090 </li>
2091 </ul>
2092
2093 !! end
2094
2095 !! test
2096 Templates: Don't strip whitespace from positional-param values
2097 !! wikitext
2098 {{echo|a }}
2099
2100 {{echo|{{echo|b}} }}
2101
2102 {{echo| c
2103 }}
2104
2105 {{echo| {{echo|d}}
2106 }}
2107
2108 {{echo|
2109 e}}
2110
2111 {{echo|
2112 * f}}
2113
2114 {{echo|
2115 }}g
2116 !! html
2117 <p>a
2118 </p><p>b
2119 </p>
2120 <pre>c
2121 </pre>
2122 <p><br />
2123 </p>
2124 <pre>d
2125 </pre>
2126 <p><br />
2127 </p>
2128 <pre>e
2129 </pre>
2130 <p><br />
2131 </p>
2132 <ul>
2133 <li> f
2134 </li>
2135 </ul>
2136 <p><br />
2137 </p>
2138 <pre>g
2139 </pre>
2140 !! end
2141
2142 !! test
2143 Templates: Handle empty comment-and-ws-only lines correctly
2144 !! wikitext
2145 {{echo|foo
2146 <!--should be ignored-->
2147 <!--should be ignored as well-->
2148 bar}}
2149 !! html
2150 <p>foo
2151 bar
2152 </p>
2153 !! end
2154
2155 !! test
2156 Templates: Handle comments in the target
2157 !! wikitext
2158 {{echo
2159 <!-- should be ignored -->
2160 |foo}}
2161
2162 {{echo<!-- should be ignored -->
2163 |foo}}
2164
2165 {{echo<!-- should be ignored -->|foo}}
2166
2167 {{<!-- should be ignored -->echo|foo}}
2168 !!html/parsoid
2169 <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>
2170
2171 <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>
2172
2173 <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>
2174
2175 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2176 !!end
2177
2178 #--------------------------------------------------------------------
2179 # Transclusion parameter escaping tests
2180 #--------------------------------------------------------------------
2181 !! test
2182 Templates: Parsoid parameter escaping test 1
2183 !! options
2184 parsoid
2185 !! wikitext
2186 {{echo|[foo]|{{echo|[bar]}}}}
2187 !! html
2188 <p about="#mwt1" typeof="mw:Transclusion"
2189 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2190 !! end
2191
2192 !! test
2193 Parsoid: Pipes in external links in template parameter
2194 !! options
2195 parsoid
2196 !! wikitext
2197 {{echo|[{{echo|http://example.com}} link]}}
2198 !! html
2199 <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>
2200 !! end
2201
2202 !! test
2203 Parsoid: pipe in transclusion parameter
2204 !! options
2205 parsoid
2206 !! wikitext
2207 {{echo|http://foo.com/a&#124;b}}
2208 !! html
2209 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2210 typeof="mw:Transclusion"
2211 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>
2212 !! end
2213
2214 !! test
2215 Parsoid: Pipe in external link target and content in template parameter
2216 !! options
2217 parsoid=html2wt,wt2wt
2218 !! wikitext
2219 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2220 !! html
2221 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2222 typeof="mw:Transclusion"
2223 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2224 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2225 !! end
2226
2227 !! test
2228 Templates: Don't escape already nowiki-escaped text in template parameters
2229 !! options
2230 parsoid=html2wt,wt2wt
2231 !! wikitext
2232 {{echo|foo<nowiki>|</nowiki>bar}}
2233 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2234 {{echo|<nowiki></nowiki>}}
2235 !! html
2236 <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>
2237 <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>
2238 <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>
2239 </p>
2240 !! end
2241
2242 ## Bug 52824
2243 !! test
2244 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2245 !! options
2246 parsoid=html2wt,wt2wt
2247 !! wikitext
2248 {{echo|{{echo|1=bar}}}}
2249 !! html
2250 <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>
2251 !! end
2252
2253 ## Bug 56733
2254 !! test
2255 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2256 !! options
2257 parsoid
2258 !! wikitext
2259 {{echo|a : b}}
2260 !! html
2261 <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>
2262 !! end
2263
2264 ###
2265 ### Parsoid-centric tests for testing RT edge cases for pre
2266 ###
2267
2268 !!test
2269 1a. Indent-Pre and Comments
2270 !! wikitext
2271 a
2272 <!--a-->
2273 c
2274 !! html
2275 <pre>a
2276 </pre>
2277 <p>c
2278 </p>
2279 !!end
2280
2281 !!test
2282 1b. Indent-Pre and Comments
2283 !! wikitext
2284 a
2285 <!--a-->
2286 c
2287 !! html
2288 <pre>a
2289 </pre>
2290 <p>c
2291 </p>
2292 !!end
2293
2294 !!test
2295 1c. Indent-Pre and Comments
2296 !! wikitext
2297 <!--a--> a
2298
2299 <!--a--> a
2300 !! html
2301 <pre> a
2302 </pre>
2303 <pre> a
2304 </pre>
2305 !!end
2306
2307 !!test
2308 1d. Indent-Pre and Comments
2309 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2310 !! wikitext
2311 <!--a--> a
2312
2313 <!--b-->b
2314 !! html
2315 <pre>a
2316 </pre>
2317 <pre>b
2318 </pre>
2319 !!end
2320
2321 !!test
2322 2a. Indent-Pre and tables
2323 !! wikitext
2324 {|
2325 |-
2326 !h1!!h2
2327 |foo||bar
2328 |}
2329 !! html
2330 <table>
2331
2332 <tr>
2333 <th>h1</th>
2334 <th>h2
2335 </th>
2336 <td>foo</td>
2337 <td>bar
2338 </td></tr></table>
2339
2340 !!end
2341
2342 !!test
2343 2b. Indent-Pre and tables
2344 !! wikitext
2345 {|
2346 |-
2347 |foo
2348 |}
2349 !! html
2350 <table>
2351
2352 <tr>
2353 <td>foo
2354 </td></tr></table>
2355
2356 !!end
2357
2358 !!test
2359 2c. Indent-Pre and tables (bug 42252)
2360 !! wikitext
2361 {|
2362 |+ foo
2363 ! | bar
2364 |}
2365 !! html
2366 <table>
2367 <caption> foo
2368 </caption>
2369 <tr>
2370 <th> bar
2371 </th></tr></table>
2372
2373 !!end
2374
2375 !!test
2376 3a. Indent-Pre and block tags (single-line html)
2377 !! wikitext
2378 a <p> foo </p>
2379 b <div> foo </div>
2380 c <blockquote> foo </blockquote>
2381 <span> foo </span>
2382 !! html
2383 a <p> foo </p>
2384 b <div> foo </div>
2385 c <blockquote> foo </blockquote>
2386 <pre><span> foo </span>
2387 </pre>
2388 !!end
2389
2390 !!test
2391 3b. Indent-Pre and block tags (multi-line html)
2392 !! wikitext
2393 a <span>foo</span>
2394 b <div> foo </div>
2395 !! html
2396 <pre>a <span>foo</span>
2397 </pre>
2398 b <div> foo </div>
2399
2400 !!end
2401
2402 !!test
2403 3c. Indent-Pre and block tags (pre-content on separate line)
2404 !! wikitext
2405 <p>
2406 foo
2407 </p>
2408
2409 <div>
2410 foo
2411 </div>
2412
2413 <center>
2414 foo
2415 </center>
2416
2417 <blockquote>
2418 foo
2419 </blockquote>
2420
2421 <blockquote>
2422 <pre>
2423 foo
2424 </pre>
2425 </blockquote>
2426
2427 <table><tr><td>
2428 foo
2429 </td></tr></table>
2430
2431 <ul><li>
2432 foo
2433 </li></ul>
2434
2435 !! html
2436 <p>
2437 foo
2438 </p>
2439 <div>
2440 <pre>foo
2441 </pre>
2442 </div>
2443 <center>
2444 <pre>foo
2445 </pre>
2446 </center>
2447 <blockquote>
2448 <p> foo
2449 </p>
2450 </blockquote>
2451 <blockquote>
2452 <pre>
2453 foo
2454 </pre>
2455 </blockquote>
2456 <table><tr><td>
2457 <pre>foo
2458 </pre>
2459 </td></tr></table>
2460 <ul><li>
2461 foo
2462 </li></ul>
2463
2464 !!end
2465
2466 !!test
2467 4. Indent-Pre and extension tags
2468 !! wikitext
2469 a <gallery>
2470 File:foobar.jpg
2471 </gallery>
2472 !! html
2473 a <ul class="gallery mw-gallery-traditional">
2474 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2475 <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>
2476 <div class="gallerytext">
2477 </div>
2478 </div></li>
2479 </ul>
2480
2481 !!end
2482
2483 !! test
2484 Leading pipes outside of tables
2485 !! options
2486 parsoid
2487 !! wikitext
2488 | foo
2489 !! html
2490 <p>| foo</p>
2491 !! end
2492
2493 !! test
2494 Leading pipes outside of tables 2
2495 !! options
2496 parsoid
2497 !! wikitext
2498 a
2499 | foo
2500 b
2501 !! html
2502 <p>a
2503 | foo
2504 b</p>
2505 !! end
2506
2507 !! test
2508 Leading pipes outside of tables 3
2509 !! options
2510 parsoid
2511 !! wikitext
2512 a
2513 | class="foo bar" | baz
2514 b
2515 !! html
2516 <p>a
2517 | class="foo bar" | baz
2518 b</p>
2519 !! end
2520
2521 !!test
2522 Render paragraphs when indent-pre is suppressed in blocklevels
2523 !! wikitext
2524 <blockquote>
2525 foo
2526
2527 bar
2528 </blockquote>
2529 !! html
2530 <blockquote>
2531 <p> foo
2532 </p><p> bar
2533 </p>
2534 </blockquote>
2535
2536 !!end
2537
2538 !!test
2539 4. Multiple spaces at start-of-line
2540 !! wikitext
2541 <p> foo </p>
2542 foo
2543 {|
2544 |foo
2545 |}
2546 !! html
2547 <p> foo </p>
2548 <pre> foo
2549 </pre>
2550 <table>
2551 <tr>
2552 <td>foo
2553 </td></tr></table>
2554
2555 !!end
2556
2557 ## NOTE: the leading white-space chars on empty line are significant
2558 !! test
2559 5a. White-space in indent-pre
2560 !! wikitext
2561 a<br />
2562
2563 b
2564 !! html
2565 <pre>a<br />
2566
2567 b
2568 </pre>
2569 !! end
2570
2571 ## NOTE: the leading white-space chars on empty line are significant
2572 !! test
2573 5b. White-space in indent-pre
2574 !! wikitext
2575 a
2576
2577 b
2578
2579
2580 c
2581 !! html
2582 <pre>a
2583
2584 b
2585
2586
2587 c
2588 </pre>
2589 !! end
2590
2591 !! test
2592 5c. White-space in indent-pre
2593 !! wikitext
2594 ''a''
2595 ''b''
2596 ''c''
2597 !! html
2598 <pre><i>a</i>
2599 <i>b</i>
2600 <i>c</i>
2601 </pre>
2602 !! end
2603
2604 !! test
2605 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2606 !! wikitext
2607 a
2608
2609 <!-- continue -->
2610 b
2611
2612 c
2613
2614 d
2615 !! html
2616 <pre>a
2617
2618 b
2619 </pre>
2620 <pre>c
2621
2622 </pre>
2623 <p>d
2624 </p>
2625 !! end
2626
2627 !! test
2628 7a. Indent-pre and category links
2629 !! options
2630 parsoid=wt2html,wt2wt
2631 !! wikitext
2632 [[Category:foo]] <!-- No pre-wrapping -->
2633 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2634 !! html
2635 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2636 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2637 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2638 !! end
2639
2640 !! test
2641 7b. Indent-pre and category links
2642 !! options
2643 parsoid=wt2html,wt2wt
2644 !! wikitext
2645 [[Category:foo]] a
2646 [[Category:foo]] {{echo|b}}
2647 !! html
2648 <pre>
2649 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2650
2651 <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>
2652 !! end
2653
2654 ###
2655 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2656 ###
2657
2658 !!test
2659 HTML-pre: 1. embedded newlines
2660 !! wikitext
2661 <pre>foo</pre>
2662
2663 <pre>
2664 foo
2665 </pre>
2666
2667 <pre>
2668
2669 foo
2670 </pre>
2671
2672 <pre>
2673
2674
2675 foo
2676 </pre>
2677 !! html
2678 <pre>foo</pre>
2679 <pre>
2680 foo
2681 </pre>
2682 <pre>
2683
2684 foo
2685 </pre>
2686 <pre>
2687
2688
2689 foo
2690 </pre>
2691
2692 !!end
2693
2694 !!test
2695 HTML-pre: 2: indented text
2696 !! wikitext
2697 <pre>
2698 foo
2699 </pre>
2700 !! html
2701 <pre>
2702 foo
2703 </pre>
2704
2705 !!end
2706
2707 !!test
2708 HTML-pre: 3: other wikitext
2709 !! wikitext
2710 <pre>
2711 * foo
2712 # bar
2713 = no-h =
2714 '' no-italic ''
2715 [[ NoLink ]]
2716 </pre>
2717 !! html
2718 <pre>
2719 * foo
2720 # bar
2721 = no-h =
2722 '' no-italic ''
2723 [[ NoLink ]]
2724 </pre>
2725
2726 !!end
2727
2728 ###
2729 ### Definition lists
2730 ###
2731 !! test
2732 Simple definition
2733 !! wikitext
2734 ; name : Definition
2735 !! html
2736 <dl>
2737 <dt> name&#160;</dt>
2738 <dd> Definition
2739 </dd>
2740 </dl>
2741
2742 !! end
2743
2744 !! test
2745 Definition list for indentation only
2746 !! wikitext
2747 : Indented text
2748 !! html
2749 <dl>
2750 <dd> Indented text
2751 </dd>
2752 </dl>
2753
2754 !! end
2755
2756 !! test
2757 Definition list with no space
2758 !! wikitext
2759 ;name:Definition
2760 !! html
2761 <dl>
2762 <dt>name</dt>
2763 <dd>Definition
2764 </dd>
2765 </dl>
2766
2767 !!end
2768
2769 !! test
2770 Definition list with URL link
2771 !! wikitext
2772 ; http://example.com/ : definition
2773 !! html
2774 <dl>
2775 <dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2776 <dd> definition
2777 </dd>
2778 </dl>
2779
2780 !! end
2781
2782 !! test
2783 Definition list with bracketed URL link
2784 !! wikitext
2785 ;[http://www.example.com/ Example]:Something about it
2786 !! html
2787 <dl>
2788 <dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2789 <dd>Something about it
2790 </dd>
2791 </dl>
2792
2793 !! end
2794
2795 !! test
2796 Definition list with wikilink containing colon
2797 !! wikitext
2798 ; [[Help:FAQ]]: The least-read page on Wikipedia
2799 !! html
2800 <dl>
2801 <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>
2802 <dd> The least-read page on Wikipedia
2803 </dd>
2804 </dl>
2805
2806 !! end
2807
2808 # At Brion's and JeLuF's insistence... :)
2809 !! test
2810 Definition list with news link containing colon
2811 !! wikitext
2812 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
2813 !! html
2814 <dl>
2815 <dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2816 <dd> This isn't even a real newsgroup!
2817 </dd>
2818 </dl>
2819
2820 !! end
2821
2822 !! test
2823 Malformed definition list with colon
2824 !! wikitext
2825 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2826 !! html
2827 <dl>
2828 <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
2829 </dt>
2830 </dl>
2831
2832 !! end
2833
2834 !! test
2835 Definition lists: colon in external link text
2836 !! wikitext
2837 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2838 !! html
2839 <dl>
2840 <dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2841 <dd> OK, I made that up
2842 </dd>
2843 </dl>
2844
2845 !! end
2846
2847 !! test
2848 Definition lists: colon in HTML attribute
2849 !! wikitext
2850 ;<b style="display: inline">bold</b>
2851 !! html
2852 <dl>
2853 <dt><b style="display: inline">bold</b>
2854 </dt>
2855 </dl>
2856
2857 !! end
2858
2859 !! test
2860 Definition lists: self-closed tag
2861 !! wikitext
2862 ;one<br/>two : two-line fun
2863 !! html
2864 <dl>
2865 <dt>one<br />two&#160;</dt>
2866 <dd> two-line fun
2867 </dd>
2868 </dl>
2869
2870 !! end
2871
2872 !! test
2873 Bug 11748: Literal closing tags
2874 !! wikitext
2875 <dl>
2876 <dt>test 1</dt>
2877 <dd>test test test test test</dd>
2878 <dt>test 2</dt>
2879 <dd>test test test test test</dd>
2880 </dl>
2881 !! html
2882 <dl>
2883 <dt>test 1</dt>
2884 <dd>test test test test test</dd>
2885 <dt>test 2</dt>
2886 <dd>test test test test test</dd>
2887 </dl>
2888
2889 !! end
2890
2891 !! test
2892 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2893 !! wikitext
2894 <ul><li>
2895 ; term : description
2896 * unordered
2897 </li></ul>
2898 !! html
2899 <ul><li>
2900 <dl>
2901 <dt> term&#160;</dt>
2902 <dd> description
2903 </dd>
2904 </dl>
2905 <ul>
2906 <li> unordered
2907 </li>
2908 </ul>
2909 </li></ul>
2910
2911 !! end
2912
2913 !! test
2914
2915 Definition list with empty definition and following paragraph
2916 !! wikitext
2917 ; term:
2918 Paragraph text
2919 !! html
2920 <dl>
2921 <dt> term</dt>
2922 <dd>
2923 </dd>
2924 </dl>
2925 <p>Paragraph text
2926 </p>
2927 !! end
2928
2929 !! test
2930 Nested definition lists using html syntax
2931 !! wikitext
2932 <dl><dd>
2933 <dl>
2934 <dd>Foo</dd>
2935 </dl>
2936 </dd></dl>
2937 !! html
2938 <dl><dd>
2939 <dl>
2940 <dd>Foo</dd>
2941 </dl>
2942 </dd></dl>
2943
2944 !! end
2945
2946 !! test
2947 Definition Lists: No nesting: Multiple dd's
2948 !! wikitext
2949 ;x
2950 :a
2951 :b
2952 !! html
2953 <dl>
2954 <dt>x
2955 </dt>
2956 <dd>a
2957 </dd>
2958 <dd>b
2959 </dd>
2960 </dl>
2961
2962 !! end
2963
2964 !! test
2965 Definition Lists: Indentation: Regular
2966 !! wikitext
2967 :i1
2968 ::i2
2969 :::i3
2970 !! html
2971 <dl>
2972 <dd>i1
2973 <dl>
2974 <dd>i2
2975 <dl>
2976 <dd>i3
2977 </dd>
2978 </dl>
2979 </dd>
2980 </dl>
2981 </dd>
2982 </dl>
2983
2984 !! end
2985
2986 !! test
2987 Definition Lists: Indentation: Missing 1st level
2988 !! wikitext
2989 ::i2
2990 :::i3
2991 !! html
2992 <dl>
2993 <dd><dl>
2994 <dd>i2
2995 <dl>
2996 <dd>i3
2997 </dd>
2998 </dl>
2999 </dd>
3000 </dl>
3001 </dd>
3002 </dl>
3003
3004 !! end
3005
3006 !! test
3007 Definition Lists: Indentation: Multi-level indent
3008 !! wikitext
3009 :::i3
3010 !! html
3011 <dl>
3012 <dd><dl>
3013 <dd><dl>
3014 <dd>i3
3015 </dd>
3016 </dl>
3017 </dd>
3018 </dl>
3019 </dd>
3020 </dl>
3021
3022 !! end
3023
3024 !! test
3025 Definition Lists: Hacky use to indent tables
3026 !! wikitext
3027 ::{|
3028 |foo
3029 |bar
3030 |}
3031 this text
3032 should be left alone
3033 !! html
3034 <dl><dd><dl><dd><table>
3035 <tr>
3036 <td>foo
3037 </td>
3038 <td>bar
3039 </td></tr></table></dd></dl></dd></dl>
3040 <p>this text
3041 should be left alone
3042 </p>
3043 !! end
3044
3045 # Bug 52473
3046 !! test
3047 Definition Lists: Hacky use to indent tables (WS-insensitive)
3048 !! options
3049 parsoid
3050 !! wikitext
3051 : {|
3052 |a
3053 |}
3054 !! html
3055 <dl>
3056 <dd> <table><tr><td>a</td></tr></table> </dd>
3057 </dl>
3058 !! end
3059 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3060 ## as an empty dt item. It also ignores all but the last ";" when followed
3061 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3062 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3063 ## ";"s.
3064 ##
3065 ## Ex: ";;t2 ::d2" is transformed into:
3066 ##
3067 ## <dl>
3068 ## <dt>t2 </dt>
3069 ## <dd>
3070 ## <dl>
3071 ## <dt></dt>
3072 ## <dd>d2</dd>
3073 ## </dl>
3074 ## </dd>
3075 ## </dl>
3076 ##
3077 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3078 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3079 ##
3080 ## <dl>
3081 ## <dt>
3082 ## <dl>
3083 ## <dt>t2 </dt>
3084 ## <dd>:d2</dd>
3085 ## </dl>
3086 ## </dt>
3087 ## </dl>
3088 ##
3089 ## All Parsoid only definition list tests have this difference.
3090 ##
3091 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3092 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3093
3094 !! test
3095 Table / list interaction: indented table with lists in table contents
3096 !! wikitext
3097 :{|
3098 |-
3099 | a
3100 * b
3101 |-
3102 | c
3103 * d
3104 |}
3105 !! html
3106 <dl><dd><table>
3107
3108 <tr>
3109 <td> a
3110 <ul>
3111 <li> b
3112 </li>
3113 </ul>
3114 </td></tr>
3115 <tr>
3116 <td> c
3117 <ul>
3118 <li> d
3119 </li>
3120 </ul>
3121 </td></tr></table></dd></dl>
3122
3123 !! end
3124
3125 !!test
3126 Table / list interaction: lists nested in tables nested in indented lists
3127 !! wikitext
3128 :{|
3129 |
3130 :a
3131 :b
3132 |
3133 *c
3134 *d
3135 |}
3136
3137 *e
3138 *f
3139 !! html
3140 <dl><dd><table>
3141 <tr>
3142 <td>
3143 <dl>
3144 <dd>a
3145 </dd>
3146 <dd>b
3147 </dd>
3148 </dl>
3149 </td>
3150 <td>
3151 <ul>
3152 <li>c
3153 </li>
3154 <li>d
3155 </li>
3156 </ul>
3157 </td></tr></table></dd></dl>
3158 <ul>
3159 <li>e
3160 </li>
3161 <li>f
3162 </li>
3163 </ul>
3164
3165 !!end
3166
3167 !! test
3168 Definition Lists: Nesting: Multi-level (Parsoid only)
3169 !! options
3170 parsoid
3171 !! wikitext
3172 ;t1 :d1
3173 ;;t2 ::d2
3174 ;;;t3 :::d3
3175 !! html
3176 <dl>
3177 <dt>t1 </dt>
3178 <dd>d1</dd>
3179 <dt>
3180 <dl>
3181 <dt>t2 </dt>
3182 <dd>:d2</dd>
3183 <dt>
3184 <dl>
3185 <dt>t3 </dt>
3186 <dd>::d3</dd>
3187 </dl>
3188 </dt>
3189 </dl>
3190 </dt>
3191 </dl>
3192
3193
3194 !! end
3195
3196
3197 !! test
3198 Definition Lists: Nesting: Test 2 (Parsoid only)
3199 !! options
3200 parsoid
3201 !! wikitext
3202 ;t1
3203 ::d2
3204 !! html
3205 <dl>
3206 <dt>t1</dt>
3207 <dd>
3208 <dl>
3209 <dd>d2</dd>
3210 </dl>
3211 </dd>
3212 </dl>
3213
3214 !! end
3215
3216
3217 !! test
3218 Definition Lists: Nesting: Test 3 (Parsoid only)
3219 !! options
3220 parsoid
3221 !! wikitext
3222 :;t1
3223 ::::d2
3224 !! html
3225 <dl>
3226 <dd>
3227 <dl>
3228 <dt>t1</dt>
3229 <dd>
3230 <dl>
3231 <dd>
3232 <dl>
3233 <dd>d2</dd>
3234 </dl>
3235 </dd>
3236 </dl>
3237 </dd>
3238 </dl>
3239 </dd>
3240 </dl>
3241
3242 !! end
3243
3244
3245 !! test
3246 Definition Lists: Nesting: Test 4
3247 !! wikitext
3248 ::;t3
3249 :::d3
3250 !! html
3251 <dl>
3252 <dd><dl>
3253 <dd><dl>
3254 <dt>t3
3255 </dt>
3256 <dd>d3
3257 </dd>
3258 </dl>
3259 </dd>
3260 </dl>
3261 </dd>
3262 </dl>
3263
3264 !! end
3265
3266
3267 ## The Parsoid team believes the following three test exposes a
3268 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3269 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3270 !! test
3271 Definition Lists: Mixed Lists: Test 1
3272 !! wikitext
3273 :;* foo
3274 ::* bar
3275 :; baz
3276 !! html/php
3277 <dl>
3278 <dd><dl>
3279 <dt><ul>
3280 <li> foo
3281 </li>
3282 <li> bar
3283 </li>
3284 </ul>
3285 </dt>
3286 </dl>
3287 <dl>
3288 <dt> baz
3289 </dt>
3290 </dl>
3291 </dd>
3292 </dl>
3293
3294 !! html/parsoid
3295 <dl>
3296 <dd><dl>
3297 <dt><ul>
3298 <li> foo
3299 </li>
3300 </ul></dt>
3301 <dd><ul>
3302 <li> bar
3303 </li>
3304 </ul></dd>
3305 <dt> baz</dt>
3306 </dl></dd>
3307 </dl>
3308 !! end
3309
3310 !! test
3311 Definition Lists: Mixed Lists: Test 2
3312 !! wikitext
3313 *: d1
3314 *: d2
3315 !! html
3316 <ul>
3317 <li><dl>
3318 <dd> d1
3319 </dd>
3320 <dd> d2
3321 </dd>
3322 </dl>
3323 </li>
3324 </ul>
3325
3326 !! end
3327
3328
3329 !! test
3330 Definition Lists: Mixed Lists: Test 3
3331 !! wikitext
3332 *::: d1
3333 *::: d2
3334 !! html
3335 <ul>
3336 <li><dl>
3337 <dd><dl>
3338 <dd><dl>
3339 <dd> d1
3340 </dd>
3341 <dd> d2
3342 </dd>
3343 </dl>
3344 </dd>
3345 </dl>
3346 </dd>
3347 </dl>
3348 </li>
3349 </ul>
3350
3351 !! end
3352
3353
3354 !! test
3355 Definition Lists: Mixed Lists: Test 4
3356 !! wikitext
3357 *;d1 :d2
3358 *;d3 :d4
3359 !! html
3360 <ul>
3361 <li><dl>
3362 <dt>d1&#160;</dt>
3363 <dd>d2
3364 </dd>
3365 <dt>d3&#160;</dt>
3366 <dd>d4
3367 </dd>
3368 </dl>
3369 </li>
3370 </ul>
3371
3372 !! end
3373
3374
3375 !! test
3376 Definition Lists: Mixed Lists: Test 5
3377 !! wikitext
3378 *:d1
3379 *:: d2
3380 !! html
3381 <ul>
3382 <li><dl>
3383 <dd>d1
3384 <dl>
3385 <dd> d2
3386 </dd>
3387 </dl>
3388 </dd>
3389 </dl>
3390 </li>
3391 </ul>
3392
3393 !! end
3394
3395
3396 !! test
3397 Definition Lists: Mixed Lists: Test 6
3398 !! wikitext
3399 #*:d1
3400 #*::: d3
3401 !! html
3402 <ol>
3403 <li><ul>
3404 <li><dl>
3405 <dd>d1
3406 <dl>
3407 <dd><dl>
3408 <dd> d3
3409 </dd>
3410 </dl>
3411 </dd>
3412 </dl>
3413 </dd>
3414 </dl>
3415 </li>
3416 </ul>
3417 </li>
3418 </ol>
3419
3420 !! end
3421
3422
3423 !! test
3424 Definition Lists: Mixed Lists: Test 7
3425 !! wikitext
3426 :* d1
3427 :* d2
3428 !! html
3429 <dl>
3430 <dd><ul>
3431 <li> d1
3432 </li>
3433 <li> d2
3434 </li>
3435 </ul>
3436 </dd>
3437 </dl>
3438
3439 !! end
3440
3441
3442 !! test
3443 Definition Lists: Mixed Lists: Test 8
3444 !! wikitext
3445 :* d1
3446 ::* d2
3447 !! html
3448 <dl>
3449 <dd><ul>
3450 <li> d1
3451 </li>
3452 </ul>
3453 <dl>
3454 <dd><ul>
3455 <li> d2
3456 </li>
3457 </ul>
3458 </dd>
3459 </dl>
3460 </dd>
3461 </dl>
3462
3463 !! end
3464
3465
3466 !! test
3467 Definition Lists: Mixed Lists: Test 9
3468 !! wikitext
3469 *;foo :bar
3470 !! html
3471 <ul>
3472 <li><dl>
3473 <dt>foo&#160;</dt>
3474 <dd>bar
3475 </dd>
3476 </dl>
3477 </li>
3478 </ul>
3479
3480 !! end
3481
3482
3483 !! test
3484 Definition Lists: Mixed Lists: Test 10
3485 !! wikitext
3486 *#;foo :bar
3487 !! html
3488 <ul>
3489 <li><ol>
3490 <li><dl>
3491 <dt>foo&#160;</dt>
3492 <dd>bar
3493 </dd>
3494 </dl>
3495 </li>
3496 </ol>
3497 </li>
3498 </ul>
3499
3500 !! end
3501
3502 # The Parsoid team disagrees with the PHP parser's seemingly-random
3503 # rules regarding dd/dt on the next two tests. Parsoid is more
3504 # consistent, and recognizes the shared nesting and keeps the
3505 # still-open tags around until the nesting is complete.
3506
3507 !! test
3508 Definition Lists: Mixed Lists: Test 11
3509 !! wikitext
3510 *#*#;*;;foo :bar
3511 *#*#;boo :baz
3512 !! html/php
3513 <ul>
3514 <li><ol>
3515 <li><ul>
3516 <li><ol>
3517 <li><dl>
3518 <dt>foo&#160;</dt>
3519 <dd><ul>
3520 <li><dl>
3521 <dt><dl>
3522 <dt>bar
3523 </dt>
3524 </dl>
3525 </dd>
3526 </dl>
3527 </li>
3528 </ul>
3529 </dd>
3530 </dl>
3531 <dl>
3532 <dt>boo&#160;</dt>
3533 <dd>baz
3534 </dd>
3535 </dl>
3536 </li>
3537 </ol>
3538 </li>
3539 </ul>
3540 </li>
3541 </ol>
3542 </li>
3543 </ul>
3544
3545 !! html/parsoid
3546 <ul>
3547 <li>
3548 <ol>
3549 <li>
3550 <ul>
3551 <li>
3552 <ol>
3553 <li>
3554 <dl>
3555 <dt>
3556 <ul>
3557 <li>
3558 <dl>
3559 <dt>
3560 <dl>
3561 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3562 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3563 </dl></dt>
3564 </dl></li>
3565 </ul></dt>
3566 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3567 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3568 </dl></li>
3569 </ol></li>
3570 </ul></li>
3571 </ol></li>
3572 </ul>
3573 !! end
3574
3575
3576 !! test
3577 Definition Lists: Weird Ones: Test 1
3578 !! wikitext
3579 *#;*::;; foo : bar (who uses this?)
3580 !! html/php
3581 <ul>
3582 <li><ol>
3583 <li><dl>
3584 <dt> foo&#160;</dt>
3585 <dd><ul>
3586 <li><dl>
3587 <dd><dl>
3588 <dd><dl>
3589 <dt><dl>
3590 <dt> bar (who uses this?)
3591 </dt>
3592 </dl>
3593 </dd>
3594 </dl>
3595 </dd>
3596 </dl>
3597 </dd>
3598 </dl>
3599 </li>
3600 </ul>
3601 </dd>
3602 </dl>
3603 </li>
3604 </ol>
3605 </li>
3606 </ul>
3607
3608 !! html/parsoid
3609 <ul>
3610 <li>
3611 <ol>
3612 <li>
3613 <dl>
3614 <dt>
3615 <ul>
3616 <li>
3617 <dl>
3618 <dd>
3619 <dl>
3620 <dd>
3621 <dl>
3622 <dt>
3623 <dl>
3624 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3625 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3626 </dl></dt>
3627 </dl></dd>
3628 </dl></dd>
3629 </dl></li>
3630 </ul></dt>
3631 </dl></li>
3632 </ol></li>
3633 </ul>
3634 !! end
3635
3636 ###
3637 ### External links
3638 ###
3639 !! test
3640 External links: non-bracketed
3641 !! wikitext
3642 Non-bracketed: http://example.com
3643 !! html
3644 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3645 </p>
3646 !! end
3647
3648 !! test
3649 External links: numbered
3650 !! wikitext
3651 Numbered: [http://example.com]
3652 Numbered: [http://example.net]
3653 Numbered: [http://example.com]
3654 !! html
3655 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3656 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3657 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3658 </p>
3659 !!end
3660
3661 !! test
3662 External links: specified text
3663 !! wikitext
3664 Specified text: [http://example.com link]
3665 !! html
3666 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3667 </p>
3668 !!end
3669
3670 !! test
3671 External links: trail
3672 !! wikitext
3673 Linktrails should not work for external links: [http://example.com link]s
3674 !! html
3675 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3676 </p>
3677 !! end
3678
3679 !! test
3680 External links: dollar sign in URL
3681 !! wikitext
3682 http://example.com/1$2345
3683 !! html
3684 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3685 </p>
3686 !! end
3687
3688 !! test
3689 External links: dollar sign in URL (named)
3690 !! wikitext
3691 [http://example.com/1$2345]
3692 !! html
3693 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3694 </p>
3695 !!end
3696
3697 !! test
3698 External links: open square bracket forbidden in URL (bug 4377)
3699 !! wikitext
3700 http://example.com/1[2345
3701 !! html
3702 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3703 </p>
3704 !! end
3705
3706 !! test
3707 External links: open square bracket forbidden in URL (named) (bug 4377)
3708 !! wikitext
3709 [http://example.com/1[2345]
3710 !! html
3711 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3712 </p>
3713 !!end
3714
3715 !! test
3716 External links: nowiki in URL link text (bug 6230)
3717 !! wikitext
3718 [http://example.com/ <nowiki>''example site''</nowiki>]
3719 !! html
3720 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3721 </p>
3722 !! end
3723
3724 !! test
3725 External links: newline forbidden in text (bug 6230 regression check)
3726 !! wikitext
3727 [http://example.com/ first
3728 second]
3729 !! html
3730 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3731 second]
3732 </p>
3733 !!end
3734
3735 !! test
3736 External links: Pipe char between url and text
3737 !! wikitext
3738 [http://example.com | link]
3739 !! html
3740 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3741 </p>
3742 !!end
3743
3744 !! test
3745 External links: protocol-relative URL in brackets
3746 !! wikitext
3747 [//example.com/ Test]
3748 !! html
3749 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3750 </p>
3751 !! end
3752
3753 !! test
3754 External links: protocol-relative URL in brackets without text
3755 !! wikitext
3756 [//example.com]
3757 !! html
3758 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3759 </p>
3760 !! end
3761
3762 !! test
3763 External links: protocol-relative URL in free text is left alone
3764 !! wikitext
3765 //example.com/Foo
3766 !! html
3767 <p>//example.com/Foo
3768 </p>
3769 !!end
3770
3771 !! test
3772 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3773 !! wikitext
3774 foo//example.com/Foo
3775 !! html
3776 <p>foo//example.com/Foo
3777 </p>
3778 !! end
3779
3780 !! test
3781 External image
3782 !! wikitext
3783 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3784 !! html
3785 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3786 </p>
3787 !! end
3788
3789 !! test
3790 External image from https
3791 !! wikitext
3792 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3793 !! html
3794 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3795 </p>
3796 !! end
3797
3798 !! test
3799 External image (when not allowed)
3800 !! options
3801 wgAllowExternalImages=0
3802 !! wikitext
3803 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3804 !! html
3805 <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>
3806 </p>
3807 !! end
3808
3809 !! test
3810 Link to non-http image, no img tag
3811 !! wikitext
3812 Link to non-http image, no img tag: ftp://example.com/test.jpg
3813 !! html
3814 <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>
3815 </p>
3816 !! end
3817
3818 !! test
3819 External links: terminating separator
3820 !! wikitext
3821 Terminating separator: http://example.com/thing,
3822 !! html
3823 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3824 </p>
3825 !! end
3826
3827 !! test
3828 External links: intervening separator
3829 !! wikitext
3830 Intervening separator: http://example.com/1,2,3
3831 !! html
3832 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3833 </p>
3834 !! end
3835
3836 !! test
3837 External links: old bug with URL in query
3838 !! wikitext
3839 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3840 !! html
3841 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3842 </p>
3843 !! end
3844
3845 !! test
3846 External links: old URL-in-URL bug, mixed protocols
3847 !! wikitext
3848 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3849 !! html
3850 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3851 </p>
3852 !!end
3853
3854 !! test
3855 External links: URL in text
3856 !! wikitext
3857 URL in text: [http://example.com http://example.com]
3858 !! html
3859 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3860 </p>
3861 !! end
3862
3863 !! test
3864 External links: Clickable images
3865 !! wikitext
3866 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3867 !! html
3868 <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>
3869 </p>
3870 !!end
3871
3872 !! test
3873 External links: raw ampersand
3874 !! wikitext
3875 Old &amp; use: http://x&y
3876 !! html
3877 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3878 </p>
3879 !! end
3880
3881 !! test
3882 External links: encoded ampersand
3883 !! wikitext
3884 Old &amp; use: http://x&amp;y
3885 !! html
3886 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3887 </p>
3888 !! end
3889
3890 !! test
3891 External links: encoded equals (bug 6102)
3892 !! wikitext
3893 http://example.com/?foo&#61;bar
3894 !! html
3895 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3896 </p>
3897 !! end
3898
3899 !! test
3900 External links: [raw ampersand]
3901 !! wikitext
3902 Old &amp; use: [http://x&y]
3903 !! html
3904 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3905 </p>
3906 !! end
3907
3908 !! test
3909 External links: [encoded ampersand]
3910 !! wikitext
3911 Old &amp; use: [http://x&amp;y]
3912 !! html
3913 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3914 </p>
3915 !! end
3916
3917 !! test
3918 External links: [encoded equals] (bug 6102)
3919 !! wikitext
3920 [http://example.com/?foo&#61;bar]
3921 !! html
3922 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3923 </p>
3924 !! end
3925
3926 !! test
3927 External links: [IDN ignored character reference in hostname; strip it right off]
3928 !! wikitext
3929 [http://e&zwnj;xample.com/]
3930 !! html
3931 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3932 </p>
3933 !! end
3934
3935 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3936 # Where an external link could easily circumvent the sanitization of the text of
3937 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3938 # test demands a higher standard. That's a bit strange.
3939 #
3940 # Example:
3941 #
3942 # http://e‌xample.com -> [http://example.com|http://example.com]
3943 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3944 #
3945 # The first example is sanitized, but the second is not. Any security benefits
3946 # from this production are trivial to circumvent. Either remove this test and
3947 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3948 # the test accordingly.
3949 #
3950 # All our love,
3951 # The Parsoid team.
3952 !! test
3953 External links: IDN ignored character reference in hostname; strip it right off
3954 !! wikitext
3955 http://e&zwnj;xample.com/
3956 !! html
3957 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3958 </p>
3959 !! end
3960
3961 !! test
3962 External links: www.jpeg.org (bug 554)
3963 !! wikitext
3964 http://www.jpeg.org
3965 !! html
3966 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3967 </p>
3968 !! end
3969
3970 !! test
3971 External links: URL within URL (original bug 2)
3972 !! wikitext
3973 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3974 !! html
3975 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3976 </p>
3977 !! end
3978
3979 !! test
3980 BUG 361: URL inside bracketed URL
3981 !! wikitext
3982 [http://www.example.com/foo http://www.example.com/bar]
3983 !! html
3984 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3985 </p>
3986 !! end
3987
3988 !! test
3989 BUG 361: URL within URL, not bracketed
3990 !! wikitext
3991 http://www.example.com/foo?=http://www.example.com/bar
3992 !! html
3993 <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>
3994 </p>
3995 !! end
3996
3997 !! test
3998 BUG 289: ">"-token in URL-tail
3999 !! wikitext
4000 http://www.example.com/<hello>
4001 !! html
4002 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4003 </p>
4004 !!end
4005
4006 !! test
4007 BUG 289: literal ">"-token in URL-tail
4008 !! wikitext
4009 http://www.example.com/<b>html</b>
4010 !! html
4011 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4012 </p>
4013 !!end
4014
4015 !! test
4016 BUG 289: ">"-token in bracketed URL
4017 !! wikitext
4018 [http://www.example.com/<hello> stuff]
4019 !! html
4020 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4021 </p>
4022 !!end
4023
4024 !! test
4025 BUG 289: literal ">"-token in bracketed URL
4026 !! wikitext
4027 [http://www.example.com/<b>html</b> stuff]
4028 !! html
4029 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4030 </p>
4031 !!end
4032
4033 !! test
4034 BUG 289: literal double quote at end of URL
4035 !! wikitext
4036 http://www.example.com/"hello"
4037 !! html
4038 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4039 </p>
4040 !!end
4041
4042 !! test
4043 BUG 289: literal double quote in bracketed URL
4044 !! wikitext
4045 [http://www.example.com/"hello" stuff]
4046 !! html
4047 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4048 </p>
4049 !!end
4050
4051 !! test
4052 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4053 !! wikitext
4054 [http://www.example.com test]
4055 !! html
4056 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4057 </p>
4058 !! end
4059
4060 !! test
4061 External links: link text with spaces
4062 !! wikitext
4063 [http://www.example.com a b c]
4064 [http://www.example.com ''a'' ''b'']
4065 !! html
4066 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4067 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4068 </p>
4069 !! end
4070
4071 !! test
4072 External links: wiki links within external link (Bug 3695)
4073 !! wikitext
4074 [http://example.com [[wikilink]] embedded in ext link]
4075 !! html/php
4076 <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>
4077 </p>
4078 !! html/parsoid
4079 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
4080 !! end
4081
4082 !! test
4083 BUG 787: Links with one slash after the url protocol are invalid
4084 !! wikitext
4085 http:/example.com
4086
4087 [http:/example.com title]
4088 !! html
4089 <p>http:/example.com
4090 </p><p>[http:/example.com title]
4091 </p>
4092 !! end
4093
4094 !! test
4095 Bracketed external links with template-generated invalid target
4096 !! wikitext
4097 [{{echo|http:/example.com}} title]
4098 !! html
4099 <p>[http:/example.com title]
4100 </p>
4101 !! end
4102
4103 !! test
4104 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4105 !! wikitext
4106 ''[http://example.com text'']
4107 [http://example.com '''text]'''
4108 ''Something [http://example.com in italic'']
4109 ''Something [http://example.com mixed''''', even bold]'''
4110 '''''Now [http://example.com both''''']
4111 !! html
4112 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4113 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4114 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4115 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4116 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4117 </p>
4118 !! end
4119
4120
4121 !! test
4122 Bug 4781: %26 in URL
4123 !! wikitext
4124 http://www.example.com/?title=AT%26T
4125 !! html
4126 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4127 </p>
4128 !! end
4129
4130 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4131 # % is actually legal in HTML5. Any change in output would need testing though.
4132 !! test
4133 Bug 4781, 5267: %25 in URL
4134 !! wikitext
4135 http://www.example.com/?title=100%25_Bran
4136 !! html
4137 <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>
4138 </p>
4139 !! end
4140
4141 !! test
4142 Bug 4781, 5267: %28, %29 in URL
4143 !! wikitext
4144 http://www.example.com/?title=Ben-Hur_%281959_film%29
4145 !! html
4146 <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>
4147 </p>
4148 !! end
4149
4150
4151 !! test
4152 Bug 4781: %26 in autonumber URL
4153 !! wikitext
4154 [http://www.example.com/?title=AT%26T]
4155 !! html
4156 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4157 </p>
4158 !! end
4159
4160 !! test
4161 Bug 4781, 5267: %26 in autonumber URL
4162 !! wikitext
4163 [http://www.example.com/?title=100%25_Bran]
4164 !! html
4165 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4166 </p>
4167 !! end
4168
4169 !! test
4170 Bug 4781, 5267: %28, %29 in autonumber URL
4171 !! wikitext
4172 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4173 !! html
4174 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4175 </p>
4176 !! end
4177
4178
4179 !! test
4180 Bug 4781: %26 in bracketed URL
4181 !! wikitext
4182 [http://www.example.com/?title=AT%26T link]
4183 !! html
4184 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4185 </p>
4186 !! end
4187
4188 !! test
4189 Bug 4781, 5267: %26 in bracketed URL
4190 !! wikitext
4191 [http://www.example.com/?title=100%25_Bran link]
4192 !! html
4193 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4194 </p>
4195 !! end
4196
4197 !! test
4198 Bug 4781, 5267: %28, %29 in bracketed URL
4199 !! wikitext
4200 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4201 !! html
4202 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4203 </p>
4204 !! end
4205
4206 !! test
4207 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4208 !! wikitext
4209 Some [http://example.com/ pretty ''italics'' and stuff]!
4210 !! html
4211 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4212 </p>
4213 !! end
4214
4215 !! test
4216 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4217 !! wikitext
4218 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4219 !! html
4220 <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>
4221 </p>
4222 !! end
4223
4224 !! test
4225 External link containing double-single-quotes with no space separating the url from text in italics
4226 !! wikitext
4227 [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]].]
4228 !! html/php
4229 <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>
4230 </p>
4231 !! html/parsoid
4232 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)">Museo Picasso</a><span>.</span></p>
4233 !! end
4234
4235 !! test
4236 External link with comments in link text
4237 !! wikitext
4238 [http://www.google.com Google <!-- comment -->]
4239 !! html
4240 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4241 </p>
4242 !! end
4243
4244 !! test
4245 URL-encoding in URL functions (single parameter)
4246 !! wikitext
4247 {{localurl:Some page|amp=&}}
4248 !! html
4249 <p>/index.php?title=Some_page&amp;amp=&amp;
4250 </p>
4251 !! end
4252
4253 !! test
4254 URL-encoding in URL functions (multiple parameters)
4255 !! wikitext
4256 {{localurl:Some page|q=?&amp=&}}
4257 !! html
4258 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4259 </p>
4260 !! end
4261
4262 !! test
4263 Brackets in urls
4264 !! wikitext
4265 http://example.com/index.php?foozoid%5B%5D=bar
4266
4267 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4268 !! html
4269 <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>
4270 </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>
4271 </p>
4272 !! end
4273
4274 !! test
4275 IPv6 urls (bug 21261)
4276 !! options
4277 disabled
4278 !! wikitext
4279 http://[2404:130:0:1000::187:2]/index.php
4280 !! html
4281 <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>
4282 </p>
4283 !! end
4284
4285 !! test
4286 Non-extlinks in brackets
4287 !! wikitext
4288 [foo]
4289 [foo bar]
4290 [foo ''bar'']
4291 [fool's] errand
4292 [fool's errand]
4293 [{{echo|foo}}]
4294 [{{echo|foo}} bar]
4295 [{{echo|foo}} ''bar'']
4296 [{{echo|foo}}l's] errand
4297 [{{echo|foo}}l's errand]
4298 [url={{echo|foo}}]
4299 [url=http://example.com]
4300 !! html
4301 <p>[foo]
4302 [foo bar]
4303 [foo <i>bar</i>]
4304 [fool's] errand
4305 [fool's errand]
4306 [foo]
4307 [foo bar]
4308 [foo <i>bar</i>]
4309 [fool's] errand
4310 [fool's errand]
4311 [url=foo]
4312 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4313 </p>
4314 !! end
4315
4316 !! test
4317 Percent encoding in external links
4318 !! wikitext
4319 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4320 !! html/php
4321 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4322 </p>
4323 !! html/parsoid
4324 <p><a rel="mw:ExtLink"
4325 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4326 !! end
4327
4328 !! test
4329 Use url link syntax for links where the content is equal the link target
4330 !! wikitext
4331 http://example.com
4332 !! html/php
4333 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4334 </p>
4335 !! html/parsoid
4336 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4337 !! end
4338
4339 !! test
4340 Parenthesis in external links, especially URL links
4341 !! wikitext
4342 http://example.com)
4343
4344 http://example.com/test)
4345
4346 http://example.com/(test)
4347
4348 http://example.com/((test)
4349
4350 (http://example.com/(test))
4351
4352 (http://example.com/(test)))))
4353
4354 http://example.com/a)b
4355
4356 [http://example.com) foo]
4357 !! html/php
4358 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4359 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4360 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4361 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4362 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4363 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4364 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4365 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4366 </p>
4367 !! html/parsoid
4368 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4369 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4370 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4371 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4372 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4373 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4374 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4375 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4376 !! end
4377
4378 !! test
4379 Parenthesis in external links, w/ transclusion or comment
4380 !! wikitext
4381 (http://example.com/{{echo|hi}})
4382
4383 (http://example.com<!-- hi -->)
4384 !! html/php
4385 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4386 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4387 </p>
4388 !! html/parsoid
4389 <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;dsr&amp;quot;:[20,31,null,null],&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;]}]]}\">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>
4390
4391 <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>
4392 !! end
4393
4394 ###
4395 ### Quotes
4396 ###
4397
4398 !! test
4399 Quotes
4400 !! wikitext
4401 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4402
4403 Normal text. '''''Bold italic text.''''' Normal text.
4404 !! html
4405 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4406 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4407 </p>
4408 !! end
4409
4410
4411 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4412 # parser strips. The wikitext contains just the first half of the bold
4413 # quote pair.
4414 !! test
4415 Unclosed and unmatched quotes
4416 !! wikitext
4417 '''''Bold italic text '''with bold deactivated''' in between.'''''
4418
4419 '''''Bold italic text ''with italic deactivated'' in between.'''''
4420
4421 '''Bold text..
4422
4423 ..spanning two paragraphs (should not work).'''
4424
4425 '''Bold tag left open
4426
4427 ''Italic tag left open
4428
4429 Normal text.
4430
4431 <!-- Unmatching number of opening, closing tags: -->
4432 '''This year''''s election ''should'' beat '''last year''''s.
4433
4434 ''Tom'''s car is bigger than ''Susan'''s.
4435
4436 Plain ''italic'''s plain
4437 !! html/php
4438 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4439 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4440 </p><p><b>Bold text..</b>
4441 </p><p>..spanning two paragraphs (should not work).
4442 </p><p><b>Bold tag left open</b>
4443 </p><p><i>Italic tag left open</i>
4444 </p><p>Normal text.
4445 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4446 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4447 </p><p>Plain <i>italic'</i>s plain
4448 </p>
4449 !! html/parsoid
4450 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4451 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4452 </p><p><b>Bold text..</b>
4453 </p><p>..spanning two paragraphs (should not work).<b></b>
4454 </p><p><b>Bold tag left open</b>
4455 </p><p><i>Italic tag left open</i>
4456 </p><p>Normal text.
4457 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4458 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4459 </p><p>Plain <i>italic'</i>s plain
4460 </p>
4461 !! end
4462
4463 ###
4464 ### Tables
4465 ###
4466 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4467 ###
4468
4469 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4470 # is the bare minimum required by the spec, see:
4471 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4472 # Parsoid team replies: empty table tags are legal in HTML5
4473 !! test
4474 A table with no data.
4475 !! options
4476 parsoid=wt2html
4477 !! wikitext
4478 {||}
4479 !! html/php
4480
4481 !! html/parsoid
4482 <table></table>
4483
4484 !! end
4485
4486 !! test
4487 A table with stray table end tags on start tag line (wt2html)
4488 !! options
4489 parsoid=wt2html
4490 !! wikitext
4491 {|style="color: red;"|}
4492
4493 {|style="color: red;" |}
4494 |foo
4495 |}
4496
4497 {|style="color: red;"|} id="foo"
4498 |foo
4499 |}
4500
4501 {|style="color: red;" |} id="foo"
4502 |foo
4503 |}
4504 !! html
4505 <table style="color: red;"></table>
4506
4507 <table style="color: red;">
4508 <tbody><tr>
4509 <td>foo</td>
4510 </tr></tbody>
4511 </table>
4512
4513 <table style="color: red;" id="foo">
4514 <tbody><tr>
4515 <td>foo</td>
4516 </tr></tbody>
4517 </table>
4518
4519 <table style="color: red;" id="foo">
4520 <tbody><tr>
4521 <td>foo</td>
4522 </tr></tbody>
4523 </table>
4524
4525 !! end
4526
4527 !! test
4528 A table with no data (take 2)
4529 !! wikitext
4530 {|
4531 |}
4532 !! html/parsoid
4533 <table></table>
4534 !! end
4535
4536 # A table with nothing but a caption is invalid XHTML, we might want to render
4537 # this as <p>caption</p>
4538 # Parsoid team replies: table with only a caption is legal in HTML5
4539 !! test
4540 A table with nothing but a caption
4541 !! wikitext
4542 {|
4543 |+ caption
4544 |}
4545 !! html/php
4546 <table>
4547 <caption> caption
4548 </caption><tr><td></td></tr></table>
4549
4550 !! html/parsoid
4551 <table><caption> caption</caption></table>
4552 !! end
4553
4554 !! test
4555 A table with caption with default-spaced attributes and a table row
4556 !! wikitext
4557 {|
4558 |+ style="color: red;" | caption1
4559 |-
4560 | foo
4561 |}
4562 !! html
4563 <table>
4564 <caption style="color: red;"> caption1
4565 </caption>
4566 <tr>
4567 <td> foo
4568 </td></tr></table>
4569
4570 !! end
4571
4572 !! test
4573 A table with captions with non-default spaced attributes and a table row
4574 !! wikitext
4575 {|
4576 |+style="color: red;"|caption2
4577 |+ style="color: red;"| caption3
4578 |-
4579 | foo
4580 |}
4581 !! html
4582 <table>
4583 <caption style="color: red;">caption2
4584 </caption>
4585 <caption style="color: red;"> caption3
4586 </caption>
4587 <tr>
4588 <td> foo
4589 </td></tr></table>
4590
4591 !! end
4592
4593 !! test
4594 Table td-cell syntax variations
4595 !! wikitext
4596 {|
4597 | foo bar foo | baz
4598 | foo bar foo || baz
4599 | style='color:red;' | baz
4600 | style='color:red;' || baz
4601 |}
4602 !! html
4603 <table>
4604 <tr>
4605 <td> baz
4606 </td>
4607 <td> foo bar foo </td>
4608 <td> baz
4609 </td>
4610 <td style="color:red;"> baz
4611 </td>
4612 <td> style='color:red;' </td>
4613 <td> baz
4614 </td></tr></table>
4615
4616 !! end
4617
4618 !! test
4619 Simple table
4620 !! wikitext
4621 {|
4622 | 1 || 2
4623 |-
4624 | 3 || 4
4625 |}
4626 !! html
4627 <table>
4628 <tr>
4629 <td> 1 </td>
4630 <td> 2
4631 </td></tr>
4632 <tr>
4633 <td> 3 </td>
4634 <td> 4
4635 </td></tr></table>
4636
4637 !! end
4638
4639 !! test
4640 Simple table but with multiple dashes for row wikitext
4641 !! wikitext
4642 {|
4643 | foo
4644 |-----
4645 | bar
4646 |}
4647 !! html
4648 <table>
4649 <tr>
4650 <td> foo
4651 </td></tr>
4652 <tr>
4653 <td> bar
4654 </td></tr></table>
4655
4656 !! end
4657 !! test
4658 Multiplication table
4659 !! wikitext
4660 {| border="1" cellpadding="2"
4661 |+Multiplication table
4662 |-
4663 ! &times; !! 1 !! 2 !! 3
4664 |-
4665 ! 1
4666 | 1 || 2 || 3
4667 |-
4668 ! 2
4669 | 2 || 4 || 6
4670 |-
4671 ! 3
4672 | 3 || 6 || 9
4673 |-
4674 ! 4
4675 | 4 || 8 || 12
4676 |-
4677 ! 5
4678 | 5 || 10 || 15
4679 |}
4680 !! html
4681 <table border="1" cellpadding="2">
4682 <caption>Multiplication table
4683 </caption>
4684 <tr>
4685 <th> &#215; </th>
4686 <th> 1 </th>
4687 <th> 2 </th>
4688 <th> 3
4689 </th></tr>
4690 <tr>
4691 <th> 1
4692 </th>
4693 <td> 1 </td>
4694 <td> 2 </td>
4695 <td> 3
4696 </td></tr>
4697 <tr>
4698 <th> 2
4699 </th>
4700 <td> 2 </td>
4701 <td> 4 </td>
4702 <td> 6
4703 </td></tr>
4704 <tr>
4705 <th> 3
4706 </th>
4707 <td> 3 </td>
4708 <td> 6 </td>
4709 <td> 9
4710 </td></tr>
4711 <tr>
4712 <th> 4
4713 </th>
4714 <td> 4 </td>
4715 <td> 8 </td>
4716 <td> 12
4717 </td></tr>
4718 <tr>
4719 <th> 5
4720 </th>
4721 <td> 5 </td>
4722 <td> 10 </td>
4723 <td> 15
4724 </td></tr></table>
4725
4726 !! end
4727
4728 !! test
4729 Accept "||" in table headings
4730 !! wikitext
4731 {|
4732 !h1 || h2
4733 |}
4734 !! html
4735 <table>
4736 <tr>
4737 <th>h1 </th>
4738 <th> h2
4739 </th></tr></table>
4740
4741 !! end
4742
4743 !! test
4744 Accept "||" in indented table headings
4745 !! wikitext
4746 :{|
4747 !h1 || h2
4748 |}
4749 !! html
4750 <dl><dd><table>
4751 <tr>
4752 <th>h1 </th>
4753 <th> h2
4754 </th></tr></table></dd></dl>
4755
4756 !! end
4757
4758 !! test
4759 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4760 !! wikitext
4761 {|
4762 !| h1
4763 || a
4764 |}
4765 !! html
4766 <table>
4767 <tr>
4768 <th> h1
4769 </th>
4770 <td> a
4771 </td></tr></table>
4772
4773 !! end
4774
4775 !!test
4776 Accept "| !" at start of line in tables (ignore !-attribute)
4777 !! wikitext
4778 {|
4779 |-
4780 | !style="color:red" | bar
4781 |}
4782 !! html
4783 <table>
4784
4785 <tr>
4786 <td> bar
4787 </td></tr></table>
4788
4789 !!end
4790
4791 !!test
4792 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 +/-
4793 !! wikitext
4794 {|
4795 |-
4796 |style='color:red;'|+1
4797 |style='color:blue;'|-1
4798 |-
4799 | 1 || 2 || 3
4800 | 1 ||+2 ||-3
4801 |-
4802 | +1
4803 | -1
4804 |}
4805 !! html
4806 <table>
4807
4808 <tr>
4809 <td style="color:red;">+1
4810 </td>
4811 <td style="color:blue;">-1
4812 </td></tr>
4813 <tr>
4814 <td> 1 </td>
4815 <td> 2 </td>
4816 <td> 3
4817 </td>
4818 <td> 1 </td>
4819 <td>+2 </td>
4820 <td>-3
4821 </td></tr>
4822 <tr>
4823 <td> +1
4824 </td>
4825 <td> -1
4826 </td></tr></table>
4827
4828 !!end
4829
4830 !! test
4831 Table rowspan
4832 !! wikitext
4833 {| border=1
4834 | Cell 1, row 1
4835 |rowspan=2| Cell 2, row 1 (and 2)
4836 | Cell 3, row 1
4837 |-
4838 | Cell 1, row 2
4839 | Cell 3, row 2
4840 |}
4841 !! html
4842 <table border="1">
4843 <tr>
4844 <td> Cell 1, row 1
4845 </td>
4846 <td rowspan="2"> Cell 2, row 1 (and 2)
4847 </td>
4848 <td> Cell 3, row 1
4849 </td></tr>
4850 <tr>
4851 <td> Cell 1, row 2
4852 </td>
4853 <td> Cell 3, row 2
4854 </td></tr></table>
4855
4856 !! end
4857
4858 !! test
4859 Nested table
4860 !! wikitext
4861 {| border=1
4862 | &alpha;
4863 |
4864 {| bgcolor=#ABCDEF border=2
4865 |nested
4866 |-
4867 |table
4868 |}
4869 |the original table again
4870 |}
4871 !! html
4872 <table border="1">
4873 <tr>
4874 <td> &#945;
4875 </td>
4876 <td>
4877 <table bgcolor="#ABCDEF" border="2">
4878 <tr>
4879 <td>nested
4880 </td></tr>
4881 <tr>
4882 <td>table
4883 </td></tr></table>
4884 </td>
4885 <td>the original table again
4886 </td></tr></table>
4887
4888 !! end
4889
4890 !! test
4891 Invalid attributes in table cell (bug 1830)
4892 !! wikitext
4893 {|
4894 |Cell:|broken
4895 |}
4896 !! html
4897 <table>
4898 <tr>
4899 <td>broken
4900 </td></tr></table>
4901
4902 !! end
4903
4904
4905 !! test
4906 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4907 !! wikitext
4908 {|
4909 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4910 !! html
4911 <table>
4912 <tr>
4913 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4914 <td>]" onmouseover="alert(document.cookie)"&gt;test
4915 </td>
4916 </tr>
4917 </table>
4918
4919 !! end
4920
4921
4922 !! test
4923 Indented table markup mixed with indented pre content (proposed in bug 6200)
4924 !! wikitext
4925 <table>
4926 <tr>
4927 <td>
4928 Text that should be rendered preformatted
4929 </td>
4930 </tr>
4931 </table>
4932 !! html
4933 <table>
4934 <tr>
4935 <td>
4936 <pre>Text that should be rendered preformatted
4937 </pre>
4938 </td>
4939 </tr>
4940 </table>
4941
4942 !! end
4943
4944 !! test
4945 Template-generated table cell attributes and cell content
4946 !! wikitext
4947 {|
4948 |{{table_attribs}}
4949 | {{table_attribs}}
4950 |}
4951 !! html
4952 <table>
4953 <tr>
4954 <td style="color: red"> Foo
4955 </td>
4956 <td style="color: red"> Foo
4957 </td></tr></table>
4958
4959 !! end
4960
4961 !! test
4962 Template-generated table cell attributes and cell content (2)
4963 !! wikitext
4964 {|
4965 |align=center {{table_attribs}}
4966 |}
4967 !! html
4968 <table>
4969 <tr>
4970 <td align="center" style="color: red"> Foo
4971 </td></tr></table>
4972
4973 !! end
4974
4975 !! test
4976 Template-generated table cell attributes and cell content (3)
4977 !! wikitext
4978 {|
4979 |align=center {{table_cells}}
4980 |}
4981 !! html
4982 <table>
4983 <tr>
4984 <td align="center" style="color: red"> Foo </td>
4985 <td> Bar </td>
4986 <td> Baz
4987 </td></tr></table>
4988
4989 !! end
4990
4991 !! test
4992 Table with row followed by newlines and table heading
4993 !! wikitext
4994 {|
4995 |-
4996
4997 ! foo
4998 |}
4999 !! html
5000 <table>
5001
5002
5003 <tr>
5004 <th> foo
5005 </th></tr></table>
5006
5007 !! end
5008
5009 !! test
5010 Table with empty line following the start tag
5011 !! wikitext
5012 {|
5013
5014 |-
5015 | foo
5016 |}
5017 !! html
5018 <table>
5019
5020
5021 <tr>
5022 <td> foo
5023 </td></tr></table>
5024
5025 !! end
5026
5027 # FIXME: Preserve the attribute properly (with an empty string as value) in
5028 # the PHP parser. Parsoid implements the behavior below.
5029 !! test
5030 Table attributes with empty value
5031 !! wikitext
5032 {|
5033 | style=| hello
5034 |}
5035 !! html/parsoid
5036 <table>
5037 <tbody>
5038 <tr>
5039 <td style=""> hello
5040 </td></tr></tbody></table>
5041
5042 !! end
5043
5044 !! test
5045 Wikitext table with a lot of comments
5046 !! wikitext
5047 {|
5048 <!-- c0 -->
5049 | foo
5050 <!-- c1 -->
5051 |- <!-- c2 -->
5052 <!-- c3 -->
5053 |<!-- c4 -->
5054 <!-- c5 -->
5055 |}
5056 !! html
5057 <table>
5058 <tr>
5059 <td> foo
5060 </td></tr>
5061 <tr>
5062 <td>
5063 </td></tr></table>
5064
5065 !! end
5066
5067 !! test
5068 Wikitext table with double-line table cell
5069 !! wikitext
5070 {|
5071 |a
5072 b
5073 |}
5074 !! html
5075 <table>
5076 <tr>
5077 <td>a
5078 <p>b
5079 </p>
5080 </td></tr></table>
5081
5082 !! end
5083
5084 !! test
5085 Table cell with a single comment
5086 !! wikitext
5087 {|
5088 | <!-- c1 -->
5089 | a
5090 |}
5091 !! html
5092 <table>
5093 <tr>
5094 <td>
5095 </td>
5096 <td> a
5097 </td></tr></table>
5098
5099 !! end
5100
5101 # The expected HTML structure in this test is debatable. The PHP parser does
5102 # not parse this kind of table at all. The main focus for Parsoid is on
5103 # round-tripping, so this output is ok for now. TODO: revisit!
5104 !! test
5105 Wikitext table with html-syntax row
5106 !! wikitext
5107 {|
5108 |-
5109 <td>foo</td>
5110 |}
5111 !! html/parsoid
5112 <table>
5113 <tbody>
5114 <tr>
5115 <td>foo</td></tr></tbody></table>
5116 !! end
5117
5118 !! test
5119 Implicit <td> after a |-
5120 (PHP parser relies on Tidy to add the missing <td> tags)
5121 !! options
5122 parsoid=wt2html,wt2wt
5123 !! wikitext
5124 {|
5125 |-
5126 a
5127 |}
5128 !! html
5129 <table>
5130 <tr><td>a</td></tr>
5131 </table>
5132 !! end
5133
5134 !! test
5135 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5136 (PHP parser relies on Tidy to add the missing <td> tags)
5137 !! options
5138 parsoid=wt2html,wt2wt
5139 !! wikitext
5140 {|
5141 |-
5142 |
5143 a
5144 |-
5145 b
5146 |}
5147 !! html
5148 <table>
5149 <tbody>
5150 <tr><td><pre>a</pre></td></tr>
5151 <tr><td> b</td></tr>
5152 </tbody>
5153 </table>
5154 !! end
5155
5156 !! test
5157 Lists should be recognized in an implicit <td> context
5158 (PHP parser relies on Tidy to add the missing <td> tags)
5159 !! options
5160 parsoid=wt2html,wt2wt
5161 !! wikitext
5162 {|
5163 |-
5164 *a
5165 |}
5166 !! html
5167 <table>
5168 <tr>
5169 <td><ul>
5170 <li>a</li>
5171 </ul></td>
5172 </tr>
5173 </table>
5174 !! end
5175
5176 !! test
5177 Parsoid: Round-trip tables directly followed by content (bug 51219)
5178 !! options
5179 parsoid=wt2html,wt2wt
5180 !! wikitext
5181 {|
5182 |foo
5183 |} bar
5184
5185 {|
5186 |baz
5187 |}<b>quux</b>
5188 !! html
5189 <table><tbody>
5190 <tr>
5191 <td>foo</td></tr></tbody></table> bar
5192 <table>
5193 <tbody>
5194 <tr>
5195 <td>baz</td></tr></tbody></table><b>quux</b>
5196 !! end
5197
5198 !! test
5199 Parsoid: Default to a newline after tables in new content (bug 51219)
5200 !! options
5201 parsoid=html2wt
5202 !! wikitext
5203 {|
5204 |foo
5205 |}
5206 <nowiki> </nowiki>bar
5207 {|
5208 |baz
5209 |}
5210 '''quux'''
5211 !! html
5212 <table><tbody>
5213 <tr><td>foo</td></tr></tbody></table> bar
5214 <table><tbody>
5215 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5216 !! end
5217
5218 !! test
5219 Parsoid: newline inducing block nodes don't suppress <nowiki>
5220 !! options
5221 parsoid=html2wt
5222 !! wikitext
5223 <nowiki> </nowiki>a
5224
5225 = foo =
5226 !! html
5227 a<h1>foo</h1>
5228 !! end
5229
5230 ###
5231 ### Internal links
5232 ###
5233 !! test
5234 Plain link, capitalized
5235 !! wikitext
5236 [[Main Page]]
5237 !! html
5238 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5239 </p>
5240 !! end
5241
5242 !! test
5243 Plain link, uncapitalized
5244 !! wikitext
5245 [[main Page]]
5246 !! html
5247 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5248 </p>
5249 !! end
5250
5251 !! test
5252 Piped link
5253 !! wikitext
5254 [[Main Page|The Main Page]]
5255 !! html
5256 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5257 </p>
5258 !! end
5259
5260 !! test
5261 Piped link with comment in link text
5262 !! wikitext
5263 [[Main Page|The Main<!--front--> Page]]
5264 !! html
5265 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5266 </p>
5267 !! end
5268
5269 !! test
5270 Broken link
5271 !! wikitext
5272 [[Zigzagzogzagzig]]
5273 !! html
5274 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5275 </p>
5276 !! end
5277
5278 !! test
5279 Broken link with fragment
5280 !! wikitext
5281 [[Zigzagzogzagzig#zug]]
5282 !! html
5283 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5284 </p>
5285 !! end
5286
5287 !! test
5288 Special page link with fragment
5289 !! wikitext
5290 [[Special:Version#anchor]]
5291 !! html
5292 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5293 </p>
5294 !! end
5295
5296 !! test
5297 Nonexistent special page link with fragment
5298 !! wikitext
5299 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5300 !! html
5301 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5302 </p>
5303 !! end
5304
5305 !! test
5306 Link with prefix
5307 !! wikitext
5308 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5309 !! html
5310 <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>
5311 </p>
5312 !! end
5313
5314 !! test
5315 Link with suffix
5316 !! wikitext
5317 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5318 !! html
5319 <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>!!!
5320 </p>
5321 !! end
5322
5323 !! article
5324 prefixed article
5325 !! text
5326 Some text
5327 !! endarticle
5328
5329 !! test
5330 Bug 43661: Piped links with identical prefixes
5331 !! wikitext
5332 [[prefixed article|prefixed articles with spaces]]
5333
5334 [[prefixed article|prefixed articlesaoeu]]
5335
5336 [[Main Page|Main Page test]]
5337 !! html
5338 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5339 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5340 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5341 </p>
5342 !! end
5343
5344
5345 !! test
5346 Link with HTML entity in suffix / tail
5347 !! wikitext
5348 [[Main Page]]&quot;, [[Main Page]]&#97;
5349 !! html
5350 <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;
5351 </p>
5352 !! end
5353
5354 !! test
5355 Link with 3 brackets
5356 !! wikitext
5357 [[[Main Page]]]
5358 !! html
5359 <p>[[[Main Page]]]
5360 </p>
5361 !! end
5362
5363 !! test
5364 Link with 4 brackets
5365 !! wikitext
5366 [[[[Main Page]]]]
5367 !! html
5368 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5369 </p>
5370 !! end
5371
5372 !! test
5373 Piped link with 3 brackets
5374 !! wikitext
5375 [[[main page|the main page]]]
5376 !! html
5377 <p>[[[main page|the main page]]]
5378 </p>
5379 !! end
5380
5381 !! test
5382 Piped link with extlink-like text
5383 !! wikitext
5384 [[Main Page|[bar]]]
5385 [[Main Page|This is a [bar]]]
5386 !! html
5387 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5388 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5389 </p>
5390 !! end
5391
5392 !! test
5393 Link with multiple pipes
5394 !! wikitext
5395 [[Main Page|The|Main|Page]]
5396 !! html
5397 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5398 </p>
5399 !! end
5400
5401 !! test
5402 Link to namespaces
5403 !! wikitext
5404 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5405 !! html
5406 <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>
5407 </p>
5408 !! end
5409
5410 !! article
5411 MemoryAlpha:AlphaTest
5412 !! text
5413 This is an article in the MemoryAlpha namespace
5414 (which shadows the memoryalpha interwiki link).
5415 !! endarticle
5416
5417 !! test
5418 Namespace takes precedence over interwiki link (bug 51680)
5419 !! wikitext
5420 [[MemoryAlpha:AlphaTest]]
5421 !! html
5422 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5423 </p>
5424 !! end
5425
5426 # The previous test doesn't work correctly in html2*, due to not recognizing the
5427 # link as an internal one. This one checks for the correct behavior.
5428 !! test
5429 Link to namespace preferred over interwiki with correct rel attribute
5430 !! options
5431 parsoid=html2wt,html2html
5432 !! wikitext
5433 [[MemoryAlpha:AlphaTest]]
5434 !! html
5435 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5436 </p>
5437 !! end
5438
5439 !! test
5440 Piped link to namespace
5441 !! wikitext
5442 [[Meta:Disclaimers|The disclaimers]]
5443 !! html
5444 <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>
5445 </p>
5446 !! end
5447
5448 !! test
5449 Link containing }
5450 !! wikitext
5451 [[Usually caused by a typo (oops}]]
5452 !! html
5453 <p>[[Usually caused by a typo (oops}]]
5454 </p>
5455 !! end
5456
5457 !! test
5458 Link containing % (not as a hex sequence)
5459 !! wikitext
5460 [[7% Solution]]
5461 !! html
5462 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5463 </p>
5464 !! end
5465
5466 !! test
5467 Link containing % as a single hex sequence interpreted to char
5468 !! wikitext
5469 [[7%25 Solution]]
5470 !! html
5471 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
5472 </p>
5473 !!end
5474
5475 !! test
5476 Link containing % as a double hex sequence interpreted to hex sequence
5477 !! wikitext
5478 [[7%2525 Solution]]
5479 !! html
5480 <p>[[7%2525 Solution]]
5481 </p>
5482 !!end
5483
5484 !! test
5485 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5486 Example for such a section: == < ==
5487 !! wikitext
5488 [[%23%3c]][[%23%3e]]
5489 !! html
5490 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5491 </p>
5492 !! end
5493
5494 !! test
5495 Link containing "<#" and ">#" as a hex sequences
5496 !! wikitext
5497 [[%3c%23]][[%3e%23]]
5498 !! html
5499 <p>[[%3c%23]][[%3e%23]]
5500 </p>
5501 !! end
5502
5503 !! test
5504 Link containing an equals sign
5505 !! wikitext
5506 [[Special:BookSources/isbn=4-00-026157-6]]
5507 !! html
5508 <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>
5509 </p>
5510 !! end
5511
5512 !! article
5513 Foo~bar
5514 !! text
5515 Just a test of an article title containing a tilde.
5516 !! endarticle
5517
5518 # note that links containing signatures, like [[Foo~~~~]], are
5519 # massaged by the pre-save transform (PST) and so the tildes are never
5520 # seen by the parser.
5521 !! test
5522 Link containing a tilde
5523 !! wikitext
5524 [[Foo~bar]]
5525 !! html
5526 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5527 </p>
5528 !! end
5529
5530 !! test
5531 Link containing double-single-quotes '' (bug 4598)
5532 !! wikitext
5533 [[Lista d''e paise d''o munno]]
5534 !! html
5535 <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>
5536 </p>
5537 !! end
5538
5539 !! test
5540 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5541 !! wikitext
5542 Some [[Link|pretty ''italics'' and stuff]]!
5543 !! html
5544 <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>!
5545 </p>
5546 !! end
5547
5548 !! test
5549 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5550 !! wikitext
5551 ''Some [[Link|pretty ''italics'' and stuff]]!
5552 !! html
5553 <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>
5554 </p>
5555 !! end
5556
5557 !! test
5558 Link with double quotes in title part (literal) and alternate part (interpreted)
5559 !! wikitext
5560 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5561
5562 [[''Pentecoste'']]
5563
5564 [[''Pentecoste''|Pentecoste]]
5565
5566 [[''Pentecoste''|''Pentecoste'']]
5567 !! html
5568 <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>
5569 </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>
5570 </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>
5571 </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>
5572 </p>
5573 !! end
5574
5575 !! test
5576 Broken image links with HTML captions (bug 39700)
5577 !! wikitext
5578 [[File:Nonexistent|<script></script>]]
5579 [[File:Nonexistent|100px|<script></script>]]
5580 [[File:Nonexistent|&lt;]]
5581 [[File:Nonexistent|a<i>b</i>c]]
5582 !! html
5583 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5584 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5585 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5586 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5587 </p>
5588 !! end
5589
5590 !! test
5591 Plain link to URL
5592 !! wikitext
5593 [[http://www.example.com]]
5594 !! html
5595 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5596 </p>
5597 !! end
5598
5599 !! test
5600 Plain link to URL with link text
5601 !! wikitext
5602 [[http://www.example.com Link text]]
5603 !! html
5604 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5605 </p>
5606 !! end
5607
5608 !! test
5609 Plain link to protocol-relative URL
5610 !! wikitext
5611 [[//www.example.com]]
5612 !! html
5613 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5614 </p>
5615 !! end
5616
5617 !! test
5618 Plain link to protocol-relative URL with link text
5619 !! wikitext
5620 [[//www.example.com Link text]]
5621 !! html
5622 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5623 </p>
5624 !! end
5625
5626 !! test
5627 Plain link to page with question mark in title
5628 !! wikitext
5629 [[A?b]]
5630
5631 [[A?b|Baz]]
5632 !! html
5633 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5634 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5635 </p>
5636 !! end
5637
5638
5639 # I'm fairly sure the expected result here is wrong.
5640 # We want these to be URL links, not pseudo-pages with URLs for titles....
5641 # However the current output is also pretty screwy.
5642 #
5643 # ----
5644 # I'm changing it to match the current output--it arguably makes more
5645 # sense in the light of the test above. Old expected result was:
5646 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5647 #</p>
5648 # But I think this test is bordering on "garbage in, garbage out" anyway.
5649 # -- wtm
5650 !! test
5651 Piped link to URL
5652 !! wikitext
5653 Piped link to URL: [[http://www.example.com|an example URL]]
5654 !! html
5655 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5656 </p>
5657 !! end
5658
5659 !! test
5660 BUG 2: [[page|http://url/]] should link to page, not http://url/
5661 !! wikitext
5662 [[Main Page|http://url/]]
5663 !! html
5664 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5665 </p>
5666 !! end
5667
5668 !! test
5669 BUG 337: Escaped self-links should be bold
5670 !! options
5671 title=[[Bug462]]
5672 !! wikitext
5673 [[Bu&#103;462]] [[Bug462]]
5674 !! html
5675 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5676 </p>
5677 !! end
5678
5679 !! test
5680 Self-link to section should not be bold
5681 !! options
5682 title=[[Main Page]]
5683 !! wikitext
5684 [[Main Page#section]]
5685 !! html
5686 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5687 </p>
5688 !! end
5689
5690 !! article
5691 00
5692 !! text
5693 This is 00.
5694 !! endarticle
5695
5696 !!test
5697 Self-link to numeric title
5698 !!options
5699 title=[[0]]
5700 !! wikitext
5701 [[0]]
5702 !! html
5703 <p><strong class="selflink">0</strong>
5704 </p>
5705 !!end
5706
5707 !!test
5708 Link to numeric-equivalent title
5709 !!options
5710 title=[[0]]
5711 !! wikitext
5712 [[00]]
5713 !! html
5714 <p><a href="/wiki/00" title="00">00</a>
5715 </p>
5716 !!end
5717
5718 !! test
5719 <nowiki> inside a link
5720 !! wikitext
5721 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5722 !! html
5723 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5724 </p>
5725 !! end
5726
5727 !! test
5728 Non-breaking spaces in title
5729 !! wikitext
5730 [[&nbsp; Main &nbsp; Page &nbsp;]]
5731 !! html
5732 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5733 </p>
5734 !!end
5735
5736 !! test
5737 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5738 !! options
5739 language=ca
5740 !! wikitext
5741 '''[[Main Page]]'''
5742 !! html
5743 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5744 </p>
5745 !! end
5746
5747 !! test
5748 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5749 !! options
5750 language=ca
5751 !! wikitext
5752 ''[[Main Page]]''
5753 !! html
5754 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5755 </p>
5756 !! end
5757
5758 !! test
5759 Internal link with en linktrail: no apostrophes (bug 27473)
5760 !! options
5761 language=en
5762 !! wikitext
5763 [[Something]]'nice
5764 !! html
5765 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5766 </p>
5767 !! end
5768
5769 !! test
5770 Internal link with ca linktrail with apostrophes (bug 27473)
5771 !! options
5772 language=ca
5773 !! wikitext
5774 [[Something]]'nice
5775 !! html
5776 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5777 </p>
5778 !! end
5779
5780 !! test
5781 Internal link with kaa linktrail with apostrophes (bug 27473)
5782 !! options
5783 language=kaa
5784 !! wikitext
5785 [[Something]]'nice
5786 !! html
5787 <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>
5788 </p>
5789 !! end
5790
5791 !! test
5792 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
5793 !! wikitext
5794 [[User:Foo/Test/63636:Bar|Test]]
5795 !! html/php
5796 <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>
5797 </p>
5798 !! html/parsoid
5799 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
5800 !! end
5801
5802 !! test
5803 1. Interaction of linktrail and template encapsulation
5804 !! options
5805 parsoid
5806 !! wikitext
5807 {{echo|[[Foo]]}}l
5808 !! html
5809 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
5810 !! end
5811
5812 !! test
5813 2. Interaction of linktrail and template encapsulation
5814 !! options
5815 parsoid
5816 !! wikitext
5817 {{echo|Some [[Fool]]}}s
5818 !! html
5819 <p data-parsoid='{}'><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
5820 !! end
5821
5822 !! test
5823 3. Interaction of linktrail and template encapsulation
5824 !! options
5825 parsoid
5826 !! wikitext
5827 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5828 !! html
5829 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
5830 !! end
5831
5832 !! article
5833 Söfnuður
5834 !! text
5835 Test.
5836 !! endarticle
5837
5838 !! test
5839 Internal link with is link prefix
5840 !! options
5841 language=is
5842 !! wikitext
5843 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5844 !! html
5845 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5846 </p>
5847 !! end
5848
5849 !! article
5850 Mótmælendatrú
5851 !! text
5852 Test.
5853 !! endarticle
5854
5855 !! test
5856 Internal link with is link trail and link prefix
5857 !! options
5858 language=is
5859 !! wikitext
5860 [[mótmælendatrú|xxx]]ar
5861 [[mótmælendatrú]]ar
5862 mótmælenda[[söfnuður]]
5863 mótmælenda[[söfnuður|söfnuðir]]
5864 mótmælenda[[söfnuður|söfnuðir]]xxx
5865 !! html
5866 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5867 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5868 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5869 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5870 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5871 </p>
5872 !! end
5873
5874 !! test
5875 Parsoid link trail escaping
5876 !! options
5877 parsoid=html2wt,html2html
5878 !! wikitext
5879 [[apple]]<nowiki/>s
5880 !! html
5881 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5882 !! end
5883
5884 !! test
5885 Parsoid link prefix escaping
5886 !! options
5887 language=is
5888 parsoid=html2wt,html2html
5889 !! wikitext
5890 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5891 !! html
5892 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5893 !! end
5894
5895 !! test
5896 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5897 !! wikitext
5898 [[Foo| bar]]
5899
5900 [[Foo| ''bar'']]
5901
5902 [http://wp.org foo]
5903
5904 [http://wp.org ''foo'']
5905 !! html
5906 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
5907 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
5908 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5909 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5910 </p>
5911 !! end
5912
5913 !! test
5914 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5915 !! options
5916 parsoid
5917 !! wikitext
5918 [[Foo|{{echo|a}} b {{echo|c}}]]
5919 !! html
5920 <p><a rel="mw:WikiLink" href="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
5921 !! end
5922
5923 ###
5924 ### Interwiki links (see maintenance/interwiki.sql)
5925 ###
5926
5927 !! test
5928 Inline interwiki link
5929 !! wikitext
5930 [[MeatBall:SoftSecurity]]
5931 !! html
5932 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5933 </p>
5934 !! end
5935
5936 !! test
5937 Inline interwiki link with empty title (bug 2372)
5938 !! wikitext
5939 [[MeatBall:]]
5940 !! html
5941 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5942 </p>
5943 !! end
5944
5945 !! test
5946 Interwiki link encoding conversion (bug 1636)
5947 !! wikitext
5948 *[[Wikipedia:ro:Olteni&#0355;a]]
5949 *[[Wikipedia:ro:Olteni&#355;a]]
5950 !! html
5951 <ul>
5952 <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>
5953 </li>
5954 <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>
5955 </li>
5956 </ul>
5957
5958 !! end
5959
5960 !! test
5961 Interwiki link with fragment (bug 2130)
5962 !! wikitext
5963 [[MeatBall:SoftSecurity#foo]]
5964 !! html
5965 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5966 </p>
5967 !! end
5968
5969 # Ideally the wikipedia: prefix here should be proto-relative too
5970 !! test
5971 Different interwiki prefixes mapping to the same URL
5972 !! wikitext
5973 [[:en:Foo]]
5974
5975 [[:en:Foo|Foo]]
5976
5977 [[wikipedia:Foo]]
5978
5979 [[:wikipedia:Foo|Foo]]
5980
5981 [[wikipedia:en:Foo]]
5982
5983 [[:wikipedia:en:Foo]]
5984 !! html/parsoid
5985 <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>
5986
5987 <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>
5988
5989 <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>
5990
5991 <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>
5992
5993 <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>
5994
5995 <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>
5996 !! end
5997
5998 !! test
5999 Interwiki links that cannot be represented in wiki syntax
6000 !! options
6001 parsoid
6002 !! wikitext
6003 [[meatball:ok]]
6004 [[meatball:ok#foo|ok with fragment]]
6005 [[meatball:ok_as_well?|ok ending with ? mark]]
6006 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6007 [http://de.wikipedia.org/wiki/#foo is just fragment]
6008
6009 !! html
6010 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6011 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6012 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F">ok ending with ? mark</a>
6013 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6014 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6015 !! end
6016
6017 !! test
6018 Interwiki links: trail
6019 !! options
6020 parsoid
6021 !! wikitext
6022 [[wikipedia:Foo|Ba]]r
6023 !! html
6024 <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>
6025 !! end
6026
6027 ###
6028 ### Interlanguage links
6029 ### Language links (so that searching for '### language' matches..)
6030 ###
6031
6032 !! test
6033 Interlanguage link
6034 !! wikitext
6035 Blah blah blah
6036 [[zh:Chinese]]
6037 !! html
6038 <p>Blah blah blah
6039 </p>
6040 !! end
6041
6042 !! test
6043 Double interlanguage link
6044 !! wikitext
6045 Blah blah blah
6046 [[es:Spanish]]
6047 [[zh:Chinese]]
6048 !! html
6049 <p>Blah blah blah
6050 </p>
6051 !! end
6052
6053 !! test
6054 Interlanguage link, with prefix links
6055 !! options
6056 language=ln
6057 !! wikitext
6058 Blah blah blah
6059 [[zh:Chinese]]
6060 !! html
6061 <p>Blah blah blah
6062 </p>
6063 !! end
6064
6065 !! test
6066 Double interlanguage link, with prefix links (bug 8897)
6067 !! options
6068 language=ln
6069 !! wikitext
6070 Blah blah blah
6071 [[es:Spanish]]
6072 [[zh:Chinese]]
6073 !! html
6074 <p>Blah blah blah
6075 </p>
6076 !! end
6077
6078 !! test
6079 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6080 !! options
6081 language=ln
6082 !! wikitext
6083 [[WW&nbsp;II]]
6084 !! html
6085 <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>
6086 </p>
6087 !! end
6088
6089 !! test
6090 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6091 !! options
6092 parsoid=html2wt
6093 !! wikitext
6094 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6095
6096 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6097 !! html
6098 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6099 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6100 !! end
6101
6102 !! test
6103 Parsoid: handle constructor well
6104 !! options
6105 parsoid
6106 !! wikitext
6107 [[constructor]]
6108
6109 [[constructor:foo]]
6110 !! html
6111 <p><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
6112
6113 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
6114 !! end
6115
6116 !! test
6117 Parsoid: recognize interlanguage links without a target page
6118 !! options
6119 parsoid
6120 !! wikitext
6121 [[ko:]]
6122 !! html
6123 <p>
6124 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6125 !! end
6126
6127 !! test
6128 Parsoid: recognize interwiki links without a target page
6129 !! options
6130 parsoid
6131 !! wikitext
6132 [[:ko:]]
6133 !! html
6134 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6135 !! end
6136
6137 !! test
6138 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6139 !! options
6140 parsoid
6141 !! wikitext
6142 [[en:Foo]]
6143 !! html
6144 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6145 !! end
6146
6147 ###
6148 ### Redirects, Parsoid-only
6149 ###
6150 !! test
6151 1. Simple redirect to page
6152 !! options
6153 parsoid
6154 !! wikitext
6155 #REDIRECT [[Main Page]]
6156 !! html
6157 <link rel="mw:PageProp/redirect" href="./Main_Page">
6158 !! end
6159
6160 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6161 !! test
6162 2. Other redirect variants
6163 !! options
6164 parsoid=wt2html,wt2wt
6165 !! wikitext
6166 #REDIRECT [[Main_Page]]
6167 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6168 !! html
6169 <link rel="mw:PageProp/redirect" href="./Main_Page">
6170 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6171 !! end
6172
6173 !! test
6174 Optional colon in #REDIRECT
6175 !! options
6176 # the colon is archaic syntax. we support it for wt2html, but we
6177 # don't care that it roundtrips back to the modern syntax.
6178 parsoid=wt2html,html2html
6179 !! wikitext
6180 #REDIRECT:[[Main Page]]
6181 !! html
6182 <link rel="mw:PageProp/redirect" href="./Main_Page">
6183 !! end
6184
6185 !! test
6186 Whitespace in #REDIRECT with optional colon
6187 !! options
6188 # the colon and gratuitous whitespace is archaic syntax. we support
6189 # it for wt2html, but we don't care that it roundtrips back to the
6190 # modern syntax (without extra whitespace)
6191 parsoid=wt2html,html2html
6192 !! wikitext
6193
6194 #REDIRECT
6195 :
6196 [[Main Page]]
6197 !! html
6198 <link rel="mw:PageProp/redirect" href="./Main_Page">
6199 !! end
6200
6201 !! test
6202 Piped link in #REDIRECT
6203 !! options
6204 # content after piped link is ignored. we support this syntax,
6205 # but don't care that the piped link is lost when we roundtrip this.
6206 parsoid=wt2html
6207 !! wikitext
6208 #REDIRECT [[Main Page|bar]]
6209 !! html
6210 <link rel="mw:PageProp/redirect" href="./Main_Page">
6211 !! end
6212
6213 !! test
6214 Redirect to category
6215 !! options
6216 parsoid=wt2html
6217 !! wikitext
6218 #REDIRECT [[Category:Foo]]
6219 !! html
6220 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6221 !! end
6222
6223 !! test
6224 Redirect to category with URL encoding
6225 !! options
6226 parsoid=wt2html
6227 !! wikitext
6228 #REDIRECT [[Category%3AFoo]]
6229 !! html
6230 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6231 !! end
6232
6233 !! test
6234 Redirect to category page
6235 !! options
6236 parsoid=wt2html,html2html
6237 !! wikitext
6238 #REDIRECT [[:Category:Foo]]
6239 !! html
6240 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6241 !! end
6242
6243 !! test
6244 Redirect to image page (1)
6245 !! options
6246 parsoid
6247 !! wikitext
6248 #REDIRECT [[File:Wiki.png]]
6249 !! html
6250 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6251 !! end
6252
6253 !! test
6254 Redirect to image page (2)
6255 !! options
6256 parsoid
6257 !! wikitext
6258 #REDIRECT [[Image:Wiki.png]]
6259 !! html
6260 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6261 !! end
6262
6263 !! test
6264 Redirect to language
6265 !! options
6266 parsoid
6267 !! wikitext
6268 #REDIRECT [[en:File:Wiki.png]]
6269 !! html
6270 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6271 !! end
6272
6273 !! test
6274 Redirect to interwiki
6275 !! options
6276 parsoid
6277 !! wikitext
6278 #REDIRECT [[meatball:File:Wiki.png]]
6279 !! html
6280 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6281 !! end
6282
6283 !! test
6284 Non-English #REDIRECT
6285 !! options
6286 parsoid
6287 language=is
6288 !! wikitext
6289 #TILVÍSUN [[Main Page]]
6290 !! html
6291 <link rel="mw:PageProp/redirect" href="./Main_Page">
6292 !! end
6293
6294 !! test
6295 New redirect
6296 !! options
6297 parsoid=html2wt
6298 !! wikitext
6299 Foo
6300 #REDIRECT [[Foo]]
6301 !! html
6302 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6303 !! end
6304
6305 ##
6306 ## XHTML tidiness
6307 ###
6308
6309 !! test
6310 <br> to <br />
6311 !! wikitext
6312 1<br>2<br />3
6313 !! html
6314 <p>1<br />2<br />3
6315 </p>
6316 !! end
6317
6318 !! test
6319 Broken br tag sanitization
6320 !! wikitext
6321 </br>
6322 !! html/php
6323 <p>&lt;/br&gt;
6324 </p>
6325 !! end
6326
6327 # TODO: Fix html2html mode (bug 51055)!
6328 !! test
6329 Parsoid: Broken br tag recognition
6330 !! options
6331 parsoid=wt2html
6332 !! wikitext
6333 </br>
6334 !! html/parsoid
6335 <p><br></p>
6336 !! end
6337
6338 !! test
6339 Incorrecly removing closing slashes from correctly formed XHTML
6340 !! wikitext
6341 <br style="clear:both;" />
6342 !! html
6343 <p><br style="clear:both;" />
6344 </p>
6345 !! end
6346
6347 !! test
6348 Failing to transform badly formed HTML into correct XHTML
6349 !! wikitext
6350 <br style="clear: left;">
6351 <br style="clear: right;">
6352 <br style="clear: both;">
6353 !! html
6354 <p><br style="clear: left;" />
6355 <br style="clear: right;" />
6356 <br style="clear: both;" />
6357 </p>
6358 !!end
6359
6360 !! test
6361 Handling html with a div self-closing tag
6362 !! wikitext
6363 <div title />
6364 <div title/>
6365 <div title/ >
6366 <div title=bar />
6367 <div title=bar/>
6368 <div title=bar/ >
6369 !! html
6370 <p>&lt;div title /&gt;
6371 &lt;div title/&gt;
6372 </p>
6373 <div>
6374 <p>&lt;div title=bar /&gt;
6375 &lt;div title=bar/&gt;
6376 </p>
6377 <div title="bar/"></div>
6378 </div>
6379
6380 !! end
6381
6382 !! test
6383 Handling html with a br self-closing tag
6384 !! wikitext
6385 <br title />
6386 <br title/>
6387 <br title/ >
6388 <br title=bar />
6389 <br title=bar/>
6390 <br title=bar/ >
6391 !! html
6392 <p><br title="title" />
6393 <br title="title" />
6394 <br />
6395 <br title="bar" />
6396 <br title="bar" />
6397 <br title="bar/" />
6398 </p>
6399 !! end
6400
6401 !! test
6402 Horizontal ruler (should it add that extra space?)
6403 !! wikitext
6404 <hr>
6405 <hr >
6406 foo <hr
6407 > bar
6408 !! html
6409 <hr />
6410 <hr />
6411 foo <hr /> bar
6412
6413 !! end
6414
6415 !! test
6416 Horizontal ruler -- 4+ dashes render hr
6417 !! wikitext
6418 ----
6419 !! html
6420 <hr />
6421
6422 !! end
6423
6424 !! test
6425 Horizontal ruler -- eats additional dashes on the same line
6426 !! wikitext
6427 ---------
6428 !! html
6429 <hr />
6430
6431 !! end
6432
6433 !! test
6434 Horizontal ruler -- does not collapse dashes on consecutive lines
6435 !! wikitext
6436 ----
6437 ----
6438 !! html
6439 <hr />
6440 <hr />
6441
6442 !! end
6443
6444 !! test
6445 Horizontal ruler -- <4 dashes render as plain text
6446 !! wikitext
6447 ---
6448 !! html
6449 <p>---
6450 </p>
6451 !! end
6452
6453 !! test
6454 Horizontal ruler -- Supports content following dashes on same line
6455 !! wikitext
6456 ---- Foo
6457 !! html
6458 <hr /> Foo
6459
6460 !! end
6461
6462 ###
6463 ### Block-level elements
6464 ###
6465 !! test
6466 Common list
6467 !! wikitext
6468 *Common list
6469 * item 2
6470 *item 3
6471 !! html
6472 <ul>
6473 <li>Common list
6474 </li>
6475 <li> item 2
6476 </li>
6477 <li>item 3
6478 </li>
6479 </ul>
6480
6481 !! end
6482
6483 !! test
6484 Numbered list
6485 !! wikitext
6486 #Numbered list
6487 #item 2
6488 # item 3
6489 !! html
6490 <ol>
6491 <li>Numbered list
6492 </li>
6493 <li>item 2
6494 </li>
6495 <li> item 3
6496 </li>
6497 </ol>
6498
6499 !! end
6500
6501 !! test
6502 Mixed list
6503 !! wikitext
6504 *Mixed list
6505 *# with numbers
6506 ** and bullets
6507 *# and numbers
6508 *bullets again
6509 **bullet level 2
6510 ***bullet level 3
6511 ***#Number on level 4
6512 **bullet level 2
6513 **#Number on level 3
6514 **#Number on level 3
6515 *#number level 2
6516 *Level 1
6517 *** Level 3
6518 #** Level 3, but ordered
6519 !! html
6520 <ul>
6521 <li>Mixed list
6522 <ol>
6523 <li> with numbers
6524 </li>
6525 </ol>
6526 <ul>
6527 <li> and bullets
6528 </li>
6529 </ul>
6530 <ol>
6531 <li> and numbers
6532 </li>
6533 </ol>
6534 </li>
6535 <li>bullets again
6536 <ul>
6537 <li>bullet level 2
6538 <ul>
6539 <li>bullet level 3
6540 <ol>
6541 <li>Number on level 4
6542 </li>
6543 </ol>
6544 </li>
6545 </ul>
6546 </li>
6547 <li>bullet level 2
6548 <ol>
6549 <li>Number on level 3
6550 </li>
6551 <li>Number on level 3
6552 </li>
6553 </ol>
6554 </li>
6555 </ul>
6556 <ol>
6557 <li>number level 2
6558 </li>
6559 </ol>
6560 </li>
6561 <li>Level 1
6562 <ul>
6563 <li><ul>
6564 <li> Level 3
6565 </li>
6566 </ul>
6567 </li>
6568 </ul>
6569 </li>
6570 </ul>
6571 <ol>
6572 <li><ul>
6573 <li><ul>
6574 <li> Level 3, but ordered
6575 </li>
6576 </ul>
6577 </li>
6578 </ul>
6579 </li>
6580 </ol>
6581
6582 !! end
6583
6584 !! test
6585 Nested lists 1
6586 !! wikitext
6587 *foo
6588 **bar
6589 !! html
6590 <ul>
6591 <li>foo
6592 <ul>
6593 <li>bar
6594 </li>
6595 </ul>
6596 </li>
6597 </ul>
6598
6599 !! end
6600
6601 !! test
6602 Nested lists 2
6603 !! wikitext
6604 **foo
6605 *bar
6606 !! html
6607 <ul>
6608 <li><ul>
6609 <li>foo
6610 </li>
6611 </ul>
6612 </li>
6613 <li>bar
6614 </li>
6615 </ul>
6616
6617 !! end
6618
6619 !! test
6620 Nested lists 3 (first element empty)
6621 !! wikitext
6622 *
6623 **bar
6624 !! html
6625 <ul>
6626 <li>
6627 <ul>
6628 <li>bar
6629 </li>
6630 </ul>
6631 </li>
6632 </ul>
6633
6634 !! end
6635
6636 !! test
6637 Nested lists 4 (first element empty)
6638 !! wikitext
6639 **
6640 *bar
6641 !! html
6642 <ul>
6643 <li><ul>
6644 <li>
6645 </li>
6646 </ul>
6647 </li>
6648 <li>bar
6649 </li>
6650 </ul>
6651
6652 !! end
6653
6654 !! test
6655 Nested lists 5 (both elements empty)
6656 !! wikitext
6657 **
6658 *
6659 !! html
6660 <ul>
6661 <li><ul>
6662 <li>
6663 </li>
6664 </ul>
6665 </li>
6666 <li>
6667 </li>
6668 </ul>
6669
6670 !! end
6671
6672 !! test
6673 Nested lists 6 (both elements empty)
6674 !! wikitext
6675 *
6676 **
6677 !! html
6678 <ul>
6679 <li>
6680 <ul>
6681 <li>
6682 </li>
6683 </ul>
6684 </li>
6685 </ul>
6686
6687 !! end
6688
6689 !! test
6690 Nested lists 7 (skip initial nesting levels)
6691 !! wikitext
6692 *** foo
6693 !! html
6694 <ul>
6695 <li><ul>
6696 <li><ul>
6697 <li> foo
6698 </li>
6699 </ul>
6700 </li>
6701 </ul>
6702 </li>
6703 </ul>
6704
6705 !! end
6706
6707 !! test
6708 Nested lists 8 (multiple nesting transitions)
6709 !! wikitext
6710 * foo
6711 *** bar
6712 ** baz
6713 * boo
6714 !! html
6715 <ul>
6716 <li> foo
6717 <ul>
6718 <li><ul>
6719 <li> bar
6720 </li>
6721 </ul>
6722 </li>
6723 <li> baz
6724 </li>
6725 </ul>
6726 </li>
6727 <li> boo
6728 </li>
6729 </ul>
6730
6731 !! end
6732
6733 !! test
6734 1. Lists with start-of-line-transparent tokens before bullets: Comments
6735 !! wikitext
6736 *foo
6737 *<!--cmt-->bar
6738 <!--cmt-->*baz
6739 !! html
6740 <ul>
6741 <li>foo
6742 </li>
6743 <li>bar
6744 </li>
6745 <li>baz
6746 </li>
6747 </ul>
6748
6749 !! end
6750
6751 !! test
6752 2. Lists with start-of-line-transparent tokens before bullets: Template close
6753 !! wikitext
6754 *foo {{echo|bar
6755 }}*baz
6756 !! html
6757 <ul>
6758 <li>foo bar
6759 </li>
6760 <li>baz
6761 </li>
6762 </ul>
6763
6764 !! end
6765
6766 !! test
6767 List items are not parsed correctly following a <pre> block (bug 785)
6768 !! wikitext
6769 * <pre>foo</pre>
6770 * <pre>bar</pre>
6771 * zar
6772 !! html
6773 <ul>
6774 <li> <pre>foo</pre>
6775 </li>
6776 <li> <pre>bar</pre>
6777 </li>
6778 <li> zar
6779 </li>
6780 </ul>
6781
6782 !! end
6783
6784 !! test
6785 List items from template
6786 !! wikitext
6787
6788 {{inner list}}
6789 * item 2
6790
6791 * item 0
6792 {{inner list}}
6793 * item 2
6794
6795 * item 0
6796 * notSOL{{inner list}}
6797 * item 2
6798 !! html
6799 <ul>
6800 <li> item 1
6801 </li>
6802 <li> item 2
6803 </li>
6804 </ul>
6805 <ul>
6806 <li> item 0
6807 </li>
6808 <li> item 1
6809 </li>
6810 <li> item 2
6811 </li>
6812 </ul>
6813 <ul>
6814 <li> item 0
6815 </li>
6816 <li> notSOL
6817 </li>
6818 <li> item 1
6819 </li>
6820 <li> item 2
6821 </li>
6822 </ul>
6823
6824 !! end
6825
6826 !! test
6827 List interrupted by empty line or heading
6828 !! wikitext
6829 * foo
6830
6831 ** bar
6832 == A heading ==
6833 * Another list item
6834 !! html
6835 <ul>
6836 <li> foo
6837 </li>
6838 </ul>
6839 <ul>
6840 <li><ul>
6841 <li> bar
6842 </li>
6843 </ul>
6844 </li>
6845 </ul>
6846 <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>
6847 <ul>
6848 <li> Another list item
6849 </li>
6850 </ul>
6851
6852 !!end
6853
6854 !!test
6855 Multiple list tags generated by templates
6856 !! wikitext
6857 {{echo|<li>}}a
6858 {{echo|<li>}}b
6859 {{echo|<li>}}c
6860 !! html
6861 <li>a
6862 <li>b
6863 <li>c</li>
6864 </li>
6865 </li>
6866
6867 !!end
6868
6869 !!test
6870 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6871 !! wikitext
6872 *a
6873 <!--This line will NOT split the list-->
6874 *b
6875 <!--This line will NOT split the list either-->
6876 *c
6877 <!--foo--> <!----> <!--This line NOT split the list either-->
6878 *d
6879 !! html
6880 <ul>
6881 <li>a
6882 </li>
6883 <li>b
6884 </li>
6885 <li>c
6886 </li>
6887 <li>d
6888 </li>
6889 </ul>
6890
6891 !!end
6892
6893 !!test
6894 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6895 !! wikitext
6896 *a
6897 <!--This line will NOT split the list-->
6898 *b
6899 <!--This line will NOT split the list either-->
6900 *c
6901 <!--foo--> <!----> <!--This line NOT split the list
6902 either-->
6903 *d
6904 !! html
6905 <ul>
6906 <li>a
6907 </li>
6908 <li>b
6909 </li>
6910 <li>c
6911 </li>
6912 <li>d
6913 </li>
6914 </ul>
6915
6916 !!end
6917
6918 !!test
6919 Test the li-hack
6920 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6921 !!options
6922 parsoid=wt2html,wt2wt
6923 !! wikitext
6924 * foo
6925 * <li>li-hack
6926 * {{echo|<li>templated li-hack}}
6927 * <!--foo--> <li> unsupported li-hack with preceding comments
6928
6929 <ul>
6930 <li><li>not a li-hack
6931 </li>
6932 </ul>
6933 !! html
6934 <ul>
6935 <li> foo</li>
6936 <li>li-hack</li>
6937 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6938 <li> <!--foo--> </li>
6939 <li> li-hack with preceding comments</li>
6940 </ul>
6941
6942 <ul>
6943 <li></li>
6944 <li>not a li-hack
6945 </li>
6946 </ul>
6947 !!end
6948
6949 !! test
6950 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6951 !! options
6952 parsoid
6953 !! wikitext
6954 # foo
6955 ## bar
6956 * foo
6957 ** bar
6958 : foo
6959 :: bar
6960 !! html
6961 <ol>
6962 <li> foo<ol>
6963 <li> bar</li>
6964 </ol></li>
6965 </ol><ul>
6966 <li> foo<ul>
6967 <li> bar</li>
6968 </ul></li>
6969 </ul><dl>
6970 <dd> foo<dl>
6971 <dd> bar</dd>
6972 </dl></dd>
6973 </dl>
6974 !! end
6975
6976 !! test
6977 Parsoid: Test of whitespace serialization with Templated bullets
6978 !! options
6979 parsoid
6980 !! wikitext
6981 * {{bullet}}
6982 !! html
6983 <ul>
6984 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6985 </ul>
6986 !! end
6987
6988 # ------------------------------------------------------------------------
6989 # The next set of tests are about Parsoid's ability to handle badly nested
6990 # tags (parse, minimize scope of fixup, and roundtrip back)
6991 # ------------------------------------------------------------------------
6992
6993 !! test
6994 Unbalanced closing block tags break a list
6995 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6996 !! wikitext
6997 <div>
6998 *a</div><div>
6999 *b</div>
7000 !! html/parsoid
7001 <div>
7002 <ul>
7003 <li>a
7004 </li>
7005 </ul></div><div>
7006 <ul>
7007 <li>b
7008 </li>
7009 </ul></div>
7010 !! end
7011
7012 !! test
7013 Unbalanced closing non-block tags don't break a list
7014 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7015 !! wikitext
7016 <span>
7017 *a</span><span>
7018 *b</span>
7019 !! html/parsoid
7020 <p><span></span>
7021 </p>
7022 <ul>
7023 <li>a<span></span>
7024 </li>
7025 <li>b
7026 </li>
7027 </ul>
7028 !! end
7029
7030 !! test
7031 Unclosed formatting tags that straddle lists are closed and reopened
7032 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7033 !! wikitext
7034 # <s> a
7035 # b </s>
7036 !! html/parsoid
7037 <ol>
7038 <li> <s> a </s>
7039 </li>
7040 <li> <s> b </s>
7041 </li>
7042 </ol>
7043 !! end
7044
7045 !!test
7046 List embedded in a non-block tag
7047 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7048 !! wikitext
7049 <small>
7050 * foo
7051 </small>
7052 !! html/parsoid
7053 <p><small></small></p>
7054 <small>
7055 <ul>
7056 <li> foo</li>
7057 </ul>
7058 </small>
7059 <p><small></small></p>
7060 !!end
7061
7062 !! test
7063 Table with missing opening <tr> tag
7064 !! options
7065 parsoid=wt2html,wt2wt
7066 !! wikitext
7067 <table>
7068 <td>foo</td>
7069 </tr>
7070 </table>
7071 !! html/parsoid
7072 <table>
7073 <tr>
7074 <td>foo</td>
7075 </tr>
7076 </table>
7077 !! end
7078
7079 ###
7080 ### Magic Words
7081 ###
7082
7083 # Note that the current date is hard-coded as
7084 # 1970-01-01T00:02:03Z (a Thursday)
7085 # when running parser tests. The timezone is also fixed to GMT, so
7086 # local date will be identical to current date.
7087
7088 !! test
7089 Magic Word: {{CURRENTDAY}}
7090 !! wikitext
7091 {{CURRENTDAY}}
7092 !! html
7093 <p>1
7094 </p>
7095 !! end
7096
7097 !! test
7098 Magic Word: {{CURRENTDAY2}}
7099 !! wikitext
7100 {{CURRENTDAY2}}
7101 !! html
7102 <p>01
7103 </p>
7104 !! end
7105
7106 !! test
7107 Magic Word: {{CURRENTDAYNAME}}
7108 !! wikitext
7109 {{CURRENTDAYNAME}}
7110 !! html
7111 <p>Thursday
7112 </p>
7113 !! end
7114
7115 !! test
7116 Magic Word: {{CURRENTDOW}}
7117 !! wikitext
7118 {{CURRENTDOW}}
7119 !! html
7120 <p>4
7121 </p>
7122 !! end
7123
7124 !! test
7125 Magic Word: {{CURRENTMONTH}}
7126 !! wikitext
7127 {{CURRENTMONTH}}
7128 !! html
7129 <p>01
7130 </p>
7131 !! end
7132
7133 !! test
7134 Magic Word: {{CURRENTMONTH1}}
7135 !! wikitext
7136 {{CURRENTMONTH1}}
7137 !! html
7138 <p>1
7139 </p>
7140 !! end
7141
7142 !! test
7143 Magic Word: {{CURRENTMONTHABBREV}}
7144 !! wikitext
7145 {{CURRENTMONTHABBREV}}
7146 !! html
7147 <p>Jan
7148 </p>
7149 !! end
7150
7151 !! test
7152 Magic Word: {{CURRENTMONTHNAME}}
7153 !! wikitext
7154 {{CURRENTMONTHNAME}}
7155 !! html
7156 <p>January
7157 </p>
7158 !! end
7159
7160 !! test
7161 Magic Word: {{CURRENTMONTHNAMEGEN}}
7162 !! wikitext
7163 {{CURRENTMONTHNAMEGEN}}
7164 !! html
7165 <p>January
7166 </p>
7167 !! end
7168
7169 !! test
7170 Magic Word: {{CURRENTTIME}}
7171 !! wikitext
7172 {{CURRENTTIME}}
7173 !! html
7174 <p>00:02
7175 </p>
7176 !! end
7177
7178 !! test
7179 Magic Word: {{CURRENTHOUR}}
7180 !! wikitext
7181 {{CURRENTHOUR}}
7182 !! html
7183 <p>00
7184 </p>
7185 !! end
7186
7187 !! test
7188 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7189 !! wikitext
7190 {{CURRENTWEEK}}
7191 !! html
7192 <p>1
7193 </p>
7194 !! end
7195
7196 !! test
7197 Magic Word: {{CURRENTYEAR}}
7198 !! wikitext
7199 {{CURRENTYEAR}}
7200 !! html
7201 <p>1970
7202 </p>
7203 !! end
7204
7205 !! test
7206 Magic Word: {{CURRENTTIMESTAMP}}
7207 !! wikitext
7208 {{CURRENTTIMESTAMP}}
7209 !! html
7210 <p>19700101000203
7211 </p>
7212 !! end
7213
7214 !! test
7215 Magic Words LOCAL (UTC)
7216 !! wikitext
7217 * {{LOCALMONTH}}
7218 * {{LOCALMONTH1}}
7219 * {{LOCALMONTHNAME}}
7220 * {{LOCALMONTHNAMEGEN}}
7221 * {{LOCALMONTHABBREV}}
7222 * {{LOCALDAY}}
7223 * {{LOCALDAY2}}
7224 * {{LOCALDAYNAME}}
7225 * {{LOCALYEAR}}
7226 * {{LOCALTIME}}
7227 * {{LOCALHOUR}}
7228 * {{LOCALWEEK}}
7229 * {{LOCALDOW}}
7230 * {{LOCALTIMESTAMP}}
7231 !! html
7232 <ul>
7233 <li> 01
7234 </li>
7235 <li> 1
7236 </li>
7237 <li> January
7238 </li>
7239 <li> January
7240 </li>
7241 <li> Jan
7242 </li>
7243 <li> 1
7244 </li>
7245 <li> 01
7246 </li>
7247 <li> Thursday
7248 </li>
7249 <li> 1970
7250 </li>
7251 <li> 00:02
7252 </li>
7253 <li> 00
7254 </li>
7255 <li> 1
7256 </li>
7257 <li> 4
7258 </li>
7259 <li> 19700101000203
7260 </li>
7261 </ul>
7262
7263 !! end
7264
7265 !! test
7266 Magic Word: {{FULLPAGENAME}}
7267 !! options
7268 title=[[User:Ævar Arnfjörð Bjarmason]]
7269 !! wikitext
7270 {{FULLPAGENAME}}
7271 !! html
7272 <p>User:Ævar Arnfjörð Bjarmason
7273 </p>
7274 !! end
7275
7276 !! test
7277 Magic Word: {{FULLPAGENAMEE}}
7278 !! options
7279 title=[[User:Ævar Arnfjörð Bjarmason]]
7280 !! wikitext
7281 {{FULLPAGENAMEE}}
7282 !! html
7283 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7284 </p>
7285 !! end
7286
7287 !! test
7288 Magic Word: {{TALKSPACE}}
7289 !! options
7290 title=[[User:Ævar Arnfjörð Bjarmason]]
7291 !! wikitext
7292 {{TALKSPACE}}
7293 !! html
7294 <p>User talk
7295 </p>
7296 !! end
7297
7298 !! test
7299 Magic Word: {{TALKSPACE}}, same namespace
7300 !! options
7301 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7302 !! wikitext
7303 {{TALKSPACE}}
7304 !! html
7305 <p>User talk
7306 </p>
7307 !! end
7308
7309 !! test
7310 Magic Word: {{TALKSPACE}}, main namespace
7311 !! options
7312 title=[[Parser Test]]
7313 !! wikitext
7314 {{TALKSPACE}}
7315 !! html
7316 <p>Talk
7317 </p>
7318 !! end
7319
7320 !! test
7321 Magic Word: {{TALKSPACEE}}
7322 !! options
7323 title=[[User:Ævar Arnfjörð Bjarmason]]
7324 !! wikitext
7325 {{TALKSPACEE}}
7326 !! html
7327 <p>User_talk
7328 </p>
7329 !! end
7330
7331 !! test
7332 Magic Word: {{SUBJECTSPACE}}
7333 !! options
7334 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7335 !! wikitext
7336 {{SUBJECTSPACE}}
7337 !! html
7338 <p>User
7339 </p>
7340 !! end
7341
7342 !! test
7343 Magic Word: {{SUBJECTSPACE}}, same namespace
7344 !! options
7345 title=[[User:Ævar Arnfjörð Bjarmason]]
7346 !! wikitext
7347 {{SUBJECTSPACE}}
7348 !! html
7349 <p>User
7350 </p>
7351 !! end
7352
7353 !! test
7354 Magic Word: {{SUBJECTSPACE}}, main namespace
7355 !! options
7356 title=[[Parser Test]]
7357 !! wikitext
7358 {{SUBJECTSPACE}}
7359 !! html
7360
7361 !! end
7362
7363 !! test
7364 Magic Word: {{SUBJECTSPACEE}}
7365 !! options
7366 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7367 !! wikitext
7368 {{SUBJECTSPACEE}}
7369 !! html
7370 <p>User
7371 </p>
7372 !! end
7373
7374 !! test
7375 Magic Word: {{NAMESPACE}}
7376 !! options
7377 title=[[User:Ævar Arnfjörð Bjarmason]]
7378 !! wikitext
7379 {{NAMESPACE}}
7380 !! html
7381 <p>User
7382 </p>
7383 !! end
7384
7385 !! test
7386 Magic Word: {{NAMESPACEE}}
7387 !! options
7388 title=[[User:Ævar Arnfjörð Bjarmason]]
7389 !! wikitext
7390 {{NAMESPACEE}}
7391 !! html
7392 <p>User
7393 </p>
7394 !! end
7395
7396 !! test
7397 Magic Word: {{NAMESPACENUMBER}}
7398 !! options
7399 title=[[User:Ævar Arnfjörð Bjarmason]]
7400 !! wikitext
7401 {{NAMESPACENUMBER}}
7402 !! html
7403 <p>2
7404 </p>
7405 !! end
7406
7407 !! test
7408 Magic Word: {{SUBPAGENAME}}
7409 !! options
7410 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7411 !! wikitext
7412 {{SUBPAGENAME}}
7413 !! html
7414 <p>sub ö
7415 </p>
7416 !! end
7417
7418 !! test
7419 Magic Word: {{SUBPAGENAMEE}}
7420 !! options
7421 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7422 !! wikitext
7423 {{SUBPAGENAMEE}}
7424 !! html
7425 <p>sub_%C3%B6
7426 </p>
7427 !! end
7428
7429 !! test
7430 Magic Word: {{ROOTPAGENAME}}
7431 !! options
7432 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7433 !! wikitext
7434 {{ROOTPAGENAME}}
7435 !! html
7436 <p>Ævar Arnfjörð Bjarmason
7437 </p>
7438 !! end
7439
7440 !! test
7441 Magic Word: {{ROOTPAGENAMEE}}
7442 !! options
7443 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7444 !! wikitext
7445 {{ROOTPAGENAMEE}}
7446 !! html
7447 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7448 </p>
7449 !! end
7450
7451 !! test
7452 Magic Word: {{BASEPAGENAME}}
7453 !! options
7454 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7455 !! wikitext
7456 {{BASEPAGENAME}}
7457 !! html
7458 <p>Ævar Arnfjörð Bjarmason
7459 </p>
7460 !! end
7461
7462 !! test
7463 Magic Word: {{BASEPAGENAMEE}}
7464 !! options
7465 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7466 !! wikitext
7467 {{BASEPAGENAMEE}}
7468 !! html
7469 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7470 </p>
7471 !! end
7472
7473 !! test
7474 Magic Word: {{TALKPAGENAME}}
7475 !! options
7476 title=[[User:Ævar Arnfjörð Bjarmason]]
7477 !! wikitext
7478 {{TALKPAGENAME}}
7479 !! html
7480 <p>User talk:Ævar Arnfjörð Bjarmason
7481 </p>
7482 !! end
7483
7484 !! test
7485 Magic Word: {{TALKPAGENAMEE}}
7486 !! options
7487 title=[[User:Ævar Arnfjörð Bjarmason]]
7488 !! wikitext
7489 {{TALKPAGENAMEE}}
7490 !! html
7491 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7492 </p>
7493 !! end
7494
7495 !! test
7496 Magic Word: {{SUBJECTPAGENAME}}
7497 !! options
7498 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7499 !! wikitext
7500 {{SUBJECTPAGENAME}}
7501 !! html
7502 <p>User:Ævar Arnfjörð Bjarmason
7503 </p>
7504 !! end
7505
7506 !! test
7507 Magic Word: {{SUBJECTPAGENAMEE}}
7508 !! options
7509 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7510 !! wikitext
7511 {{SUBJECTPAGENAMEE}}
7512 !! html
7513 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7514 </p>
7515 !! end
7516
7517 !! test
7518 Magic Word: {{NUMBEROFFILES}}
7519 !! wikitext
7520 {{NUMBEROFFILES}}
7521 !! html
7522 <p>4
7523 </p>
7524 !! end
7525
7526 !! test
7527 Magic Word: {{PAGENAME}}
7528 !! options
7529 title=[[User:Ævar Arnfjörð Bjarmason]]
7530 !! wikitext
7531 {{PAGENAME}}
7532 !! html
7533 <p>Ævar Arnfjörð Bjarmason
7534 </p>
7535 !! end
7536
7537 !! test
7538 Magic Word: {{PAGENAME}} with metacharacters
7539 !! options
7540 title=[['foo & bar = baz']]
7541 !! wikitext
7542 ''{{PAGENAME}}''
7543 !! html
7544 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7545 </p>
7546 !! end
7547
7548 !! test
7549 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7550 !! options
7551 title=[[*RFC 1234 http://example.com/]]
7552 !! wikitext
7553 {{PAGENAME}}
7554 !! html
7555 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7556 </p>
7557 !! end
7558
7559 !! test
7560 Magic Word: {{PAGENAMEE}}
7561 !! options
7562 title=[[User:Ævar Arnfjörð Bjarmason]]
7563 !! wikitext
7564 {{PAGENAMEE}}
7565 !! html
7566 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7567 </p>
7568 !! end
7569
7570 !! test
7571 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7572 !! options
7573 title=[[*RFC 1234 http://example.com/]]
7574 !! wikitext
7575 {{PAGENAMEE}}
7576 !! html
7577 <p>&#42;RFC_1234_http&#58;//example.com/
7578 </p>
7579 !! end
7580
7581 !! test
7582 Magic Word: {{REVISIONID}}
7583 !! wikitext
7584 {{REVISIONID}}
7585 !! html
7586 <p>1337
7587 </p>
7588 !! end
7589
7590 !! test
7591 Magic Word: {{SCRIPTPATH}}
7592 !! wikitext
7593 {{SCRIPTPATH}}
7594 !! html
7595 <p>/
7596 </p>
7597 !! end
7598
7599 !! test
7600 Magic Word: {{STYLEPATH}}
7601 !! wikitext
7602 {{STYLEPATH}}
7603 !! html
7604 <p>/skins
7605 </p>
7606 !! end
7607
7608 !! test
7609 Magic Word: {{SERVER}}
7610 !! wikitext
7611 {{SERVER}}
7612 !! html
7613 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7614 </p>
7615 !! end
7616
7617 !! test
7618 Magic Word: {{SERVERNAME}}
7619 !! wikitext
7620 {{SERVERNAME}}
7621 !! html
7622 <p>example.org
7623 </p>
7624 !! end
7625
7626 !! test
7627 Magic Word: {{SITENAME}}
7628 !! wikitext
7629 {{SITENAME}}
7630 !! html
7631 <p>MediaWiki
7632 </p>
7633 !! end
7634
7635 !! test
7636 Case-sensitive magic words, when cased differently, should just be template transclusions
7637 !! wikitext
7638 {{CurrentMonth}}
7639 {{currentday}}
7640 {{cURreNTweEK}}
7641 {{currentHour}}
7642 !! html
7643 <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>
7644 <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>
7645 <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>
7646 <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>
7647 </p>
7648 !! end
7649
7650 !! test
7651 Case-insensitive magic words should still work with weird casing.
7652 !! wikitext
7653 {{sErVeRNaMe}}
7654 {{LCFirst:AOEU}}
7655 {{ucFIRST:aoeu}}
7656 {{SERver}}
7657 !! html
7658 <p>example.org
7659 aOEU
7660 Aoeu
7661 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7662 </p>
7663 !! end
7664
7665 !! test
7666 Namespace 1 {{ns:1}}
7667 !! wikitext
7668 {{ns:1}}
7669 !! html
7670 <p>Talk
7671 </p>
7672 !! end
7673
7674 !! test
7675 Namespace 1 {{ns:01}}
7676 !! wikitext
7677 {{ns:01}}
7678 !! html
7679 <p>Talk
7680 </p>
7681 !! end
7682
7683 !! test
7684 Namespace 0 {{ns:0}} (bug 4783)
7685 !! wikitext
7686 {{ns:0}}
7687 !! html
7688
7689 !! end
7690
7691 !! test
7692 Namespace 0 {{ns:00}} (bug 4783)
7693 !! wikitext
7694 {{ns:00}}
7695 !! html
7696
7697 !! end
7698
7699 !! test
7700 Namespace -1 {{ns:-1}}
7701 !! wikitext
7702 {{ns:-1}}
7703 !! html
7704 <p>Special
7705 </p>
7706 !! end
7707
7708 !! test
7709 Namespace User {{ns:User}}
7710 !! wikitext
7711 {{ns:User}}
7712 !! html
7713 <p>User
7714 </p>
7715 !! end
7716
7717 !! test
7718 Namespace User talk {{ns:User_talk}}
7719 !! wikitext
7720 {{ns:User_talk}}
7721 !! html
7722 <p>User talk
7723 </p>
7724 !! end
7725
7726 !! test
7727 Namespace User talk {{ns:uSeR tAlK}}
7728 !! wikitext
7729 {{ns:uSeR tAlK}}
7730 !! html
7731 <p>User talk
7732 </p>
7733 !! end
7734
7735 !! test
7736 Namespace File {{ns:File}}
7737 !! wikitext
7738 {{ns:File}}
7739 !! html
7740 <p>File
7741 </p>
7742 !! end
7743
7744 !! test
7745 Namespace File {{ns:Image}}
7746 !! wikitext
7747 {{ns:Image}}
7748 !! html
7749 <p>File
7750 </p>
7751 !! end
7752
7753 !! test
7754 Namespace (lang=de) Benutzer {{ns:User}}
7755 !! options
7756 language=de
7757 !! wikitext
7758 {{ns:User}}
7759 !! html
7760 <p>Benutzer
7761 </p>
7762 !! end
7763
7764 !! test
7765 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7766 !! options
7767 language=de
7768 !! wikitext
7769 {{ns:3}}
7770 !! html
7771 <p>Benutzer Diskussion
7772 </p>
7773 !! end
7774
7775
7776 !! test
7777 Urlencode
7778 !! wikitext
7779 {{urlencode:hi world?!}}
7780 {{urlencode:hi world?!|WIKI}}
7781 {{urlencode:hi world?!|PATH}}
7782 {{urlencode:hi world?!|QUERY}}
7783 !! html
7784 <p>hi+world%3F%21
7785 hi_world%3F!
7786 hi%20world%3F%21
7787 hi+world%3F%21
7788 </p>
7789 !! end
7790
7791 !! test
7792 Magic Word: prioritize type info over data-parsoid
7793 !! options
7794 parsoid=html2wt
7795 !! wikitext
7796 __FORCETOC__
7797 !! html
7798 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7799 !! end
7800
7801 !! test
7802 Magic Word: serialize on separate line (parsoid)
7803 !! options
7804 parsoid=wt2wt,html2wt
7805 !! wikitext
7806 foo
7807 __NOTOC__
7808 bar
7809 !! html
7810 foo<meta property="mw:PageProp/notoc"/>bar
7811 !! end
7812
7813 !! test
7814 Magic Word: rt non-english wikis
7815 !! options
7816 parsoid=wt2wt
7817 language=de
7818 !! wikitext
7819 __NOEDITSECTION__
7820 !! html
7821 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7822 !! end
7823
7824 ###
7825 ### Magic links
7826 ###
7827 !! test
7828 Magic links: internal link to RFC (bug 479)
7829 !! wikitext
7830 [[RFC 123]]
7831 !! html
7832 <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>
7833 </p>
7834 !! end
7835
7836 !! test
7837 Magic links: RFC (bug 479)
7838 !! wikitext
7839 RFC 822
7840 !! html
7841 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7842 </p>
7843 !! end
7844
7845 !! test
7846 Magic links: ISBN (bug 1937)
7847 !! wikitext
7848 ISBN 0-306-40615-2
7849 !! html
7850 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7851 </p>
7852 !! end
7853
7854 !! test
7855 Magic links: PMID incorrectly converts space to underscore
7856 !! wikitext
7857 PMID 1234
7858 !! html
7859 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7860 </p>
7861 !! end
7862
7863 ###
7864 ### Templates
7865 ####
7866
7867 !! test
7868 Nonexistent template
7869 !! wikitext
7870 {{thistemplatedoesnotexist}}
7871 !! html
7872 <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>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Template with invalid target containing tags
7878 !! wikitext
7879 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7880 !! html
7881 <p>{{a<b>b</b>|foo|a=b|a = b}}
7882 </p>
7883 !! end
7884
7885 !! test
7886 Template with invalid target containing unclosed tag
7887 !! wikitext
7888 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7889 !! html
7890 <p>{{a<b>|foo|a=b|a = b}}</b>
7891 </p>
7892 !! end
7893
7894 !! test
7895 Template with invalid target containing wikilink
7896 !! wikitext
7897 {{[[Main Page]]}}
7898 !! html/php
7899 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7900 </p>
7901 !! html/parsoid
7902 <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>
7903 !! end
7904
7905 !! article
7906 Template:test
7907 !! text
7908 This is a test template
7909 !! endarticle
7910
7911 !! test
7912 Simple template
7913 !! wikitext
7914 {{test}}
7915 !! html
7916 <p>This is a test template
7917 </p>
7918 !! end
7919
7920 !! test
7921 Template with explicit namespace
7922 !! wikitext
7923 {{Template:test}}
7924 !! html
7925 <p>This is a test template
7926 </p>
7927 !! end
7928
7929
7930 !! article
7931 Template:paramtest
7932 !! text
7933 This is a test template with parameter {{{param}}}
7934 !! endarticle
7935
7936 !! test
7937 Template parameter
7938 !! wikitext
7939 {{paramtest|param=foo}}
7940 !! html
7941 <p>This is a test template with parameter foo
7942 </p>
7943 !! end
7944
7945 !! article
7946 Template:paramtestnum
7947 !! text
7948 [[{{{1}}}|{{{2}}}]]
7949 !! endarticle
7950
7951 !! test
7952 Template unnamed parameter
7953 !! wikitext
7954 {{paramtestnum|Main Page|the main page}}
7955 !! html
7956 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7957 </p>
7958 !! end
7959
7960 !! article
7961 Template:templatesimple
7962 !! text
7963 (test)
7964 !! endarticle
7965
7966 !! article
7967 Template:templateredirect
7968 !! text
7969 #redirect [[Template:templatesimple]]
7970 !! endarticle
7971
7972 !! article
7973 Template:templateasargtestnum
7974 !! text
7975 {{{{{1}}}}}
7976 !! endarticle
7977
7978 !! article
7979 Template:templateasargtest
7980 !! text
7981 {{template{{{templ}}}}}
7982 !! endarticle
7983
7984 !! article
7985 Template:templateasargtest2
7986 !! text
7987 {{{{{templ}}}}}
7988 !! endarticle
7989
7990 !! test
7991 Template with template name as unnamed argument
7992 !! wikitext
7993 {{templateasargtestnum|templatesimple}}
7994 !! html
7995 <p>(test)
7996 </p>
7997 !! end
7998
7999 !! test
8000 Template with template name as argument
8001 !! wikitext
8002 {{templateasargtest|templ=simple}}
8003 !! html
8004 <p>(test)
8005 </p>
8006 !! end
8007
8008 !! test
8009 Template with template name as argument (2)
8010 !! wikitext
8011 {{templateasargtest2|templ=templatesimple}}
8012 !! html
8013 <p>(test)
8014 </p>
8015 !! end
8016
8017 !! article
8018 Template:templateasargtestdefault
8019 !! text
8020 {{{{{templ|templatesimple}}}}}
8021 !! endarticle
8022
8023 !! article
8024 Template:templa
8025 !! text
8026 '''templ'''
8027 !! endarticle
8028
8029 !! test
8030 Template with default value
8031 !! wikitext
8032 {{templateasargtestdefault}}
8033 !! html
8034 <p>(test)
8035 </p>
8036 !! end
8037
8038 !! test
8039 Template with default value (value set)
8040 !! wikitext
8041 {{templateasargtestdefault|templ=templa}}
8042 !! html
8043 <p><b>templ</b>
8044 </p>
8045 !! end
8046
8047 !! test
8048 Template redirect
8049 !! wikitext
8050 {{templateredirect}}
8051 !! html
8052 <p>(test)
8053 </p>
8054 !! end
8055
8056 !! test
8057 Template with argument in separate line
8058 !! wikitext
8059 {{ templateasargtest |
8060 templ = simple }}
8061 !! html
8062 <p>(test)
8063 </p>
8064 !! end
8065
8066 !! test
8067 Template with complex template as argument
8068 !! wikitext
8069 {{paramtest|
8070 param ={{ templateasargtest |
8071 templ = simple }}}}
8072 !! html
8073 <p>This is a test template with parameter (test)
8074 </p>
8075 !! end
8076
8077 !! test
8078 Template with thumb image (with link in description)
8079 !! wikitext
8080 {{paramtest|
8081 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8082 !! html
8083 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>
8084
8085 !! end
8086
8087 !! article
8088 Template:complextemplate
8089 !! text
8090 {{{1}}} {{paramtest|
8091 param ={{{param}}}}}
8092 !! endarticle
8093
8094 !! test
8095 Template with complex arguments
8096 !! wikitext
8097 {{complextemplate|
8098 param ={{ templateasargtest |
8099 templ = simple }}|[[Template:complextemplate|link]]}}
8100 !! html
8101 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8102 </p>
8103 !! end
8104
8105 !! test
8106 BUG 553: link with two variables in a piped link
8107 !! wikitext
8108 {|
8109 |[[{{{1}}}|{{{2}}}]]
8110 |}
8111 !! html
8112 <table>
8113 <tr>
8114 <td>[[{{{1}}}|{{{2}}}]]
8115 </td></tr></table>
8116
8117 !! end
8118
8119 !! test
8120 Magic variable as template parameter
8121 !! wikitext
8122 {{paramtest|param={{SITENAME}}}}
8123 !! html
8124 <p>This is a test template with parameter MediaWiki
8125 </p>
8126 !! end
8127
8128 !! article
8129 Template:linktest
8130 !! text
8131 [[{{{param}}}|link]]
8132 !! endarticle
8133
8134 !! test
8135 Template parameter as link source
8136 !! wikitext
8137 {{linktest|param=Main Page}}
8138 !! html
8139 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8140 </p>
8141 !! end
8142
8143 !!test
8144 Template-generated attribute string (k='v')
8145 !! wikitext
8146 <span {{attr_str|id|v1}}>bar</span>
8147 !! html
8148 <p><span id="v1">bar</span>
8149 </p>
8150 !!end
8151
8152 !!article
8153 Template:paramtest2
8154 !! text
8155 including another template, {{paramtest|param={{{arg}}}}}
8156 !! endarticle
8157
8158 !! test
8159 Template passing argument to another template
8160 !! wikitext
8161 {{paramtest2|arg='hmm'}}
8162 !! html
8163 <p>including another template, This is a test template with parameter 'hmm'
8164 </p>
8165 !! end
8166
8167 !! article
8168 Template:Linktest2
8169 !! text
8170 Main Page
8171 !! endarticle
8172
8173 !! test
8174 Template as link source
8175 !! wikitext
8176 [[{{linktest2}}]]
8177
8178 [[{{linktest2}}|Main Page]]
8179
8180 [[{{linktest2}}]]Page
8181 !! html
8182 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8183 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8184 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8185 </p>
8186 !! end
8187
8188
8189 !! article
8190 Template:loop1
8191 !! text
8192 {{loop2}}
8193 !! endarticle
8194
8195 !! article
8196 Template:loop2
8197 !! text
8198 {{loop1}}
8199 !! endarticle
8200
8201 !! test
8202 Template infinite loop
8203 !! wikitext
8204 {{loop1}}
8205 !! html
8206 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8207 </p>
8208 !! end
8209
8210 !! test
8211 Template from main namespace
8212 !! wikitext
8213 {{:Main Page}}
8214 !! html
8215 <p>blah blah
8216 </p>
8217 !! end
8218
8219 !! article
8220 Template:table
8221 !! text
8222 {|
8223 | 1 || 2
8224 |-
8225 | 3 || 4
8226 |}
8227 !! endarticle
8228
8229 !! test
8230 BUG 529: Template with table, not included at beginning of line
8231 !! wikitext
8232 foo {{table}}
8233 !! html
8234 <p>foo
8235 </p>
8236 <table>
8237 <tr>
8238 <td> 1 </td>
8239 <td> 2
8240 </td></tr>
8241 <tr>
8242 <td> 3 </td>
8243 <td> 4
8244 </td></tr></table>
8245
8246 !! end
8247
8248 !! test
8249 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8250 !! wikitext
8251 foo
8252 {{table}}
8253 !! html
8254 <p>foo
8255 </p>
8256 <table>
8257 <tr>
8258 <td> 1 </td>
8259 <td> 2
8260 </td></tr>
8261 <tr>
8262 <td> 3 </td>
8263 <td> 4
8264 </td></tr></table>
8265
8266 !! end
8267
8268 !! test
8269 BUG 41: Template parameters shown as broken links
8270 !! wikitext
8271 {{{parameter}}}
8272 !! html
8273 <p>{{{parameter}}}
8274 </p>
8275 !! end
8276
8277 !! test
8278 Template with targets containing wikilinks
8279 !! wikitext
8280 {{[[foo]]}}
8281
8282 {{[[{{echo|foo}}]]}}
8283
8284 {{{{echo|[[foo}}]]}}
8285 !! html
8286 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8287 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8288 </p><p>{{[[foo}}]]
8289 </p>
8290 !! end
8291
8292 !! article
8293 Template:MSGNW test
8294 !! text
8295 ''None'' of '''this''' should be
8296 * interpreted
8297 but rather passed unmodified
8298 {{test}}
8299 !! endarticle
8300
8301 # hmm, fix this or just deprecate msgnw and document its behavior?
8302 !! test
8303 msgnw keyword
8304 !! options
8305 disabled
8306 !! wikitext
8307 {{msgnw:MSGNW test}}
8308 !! html
8309 <p>''None'' of '''this''' should be
8310 * interpreted
8311 but rather passed unmodified
8312 {{test}}
8313 </p>
8314 !! end
8315
8316 !! test
8317 int keyword
8318 !! wikitext
8319 {{int:youhavenewmessages|lots of money|not!}}
8320 !! html
8321 <p>You have lots of money (not!).
8322 </p>
8323 !! end
8324
8325 !! article
8326 Template:Includes
8327 !! text
8328 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8329 !! endarticle
8330
8331 !! test
8332 <includeonly> and <noinclude> being included
8333 !! wikitext
8334 {{Includes}}
8335 !! html
8336 <p>Foobar
8337 </p>
8338 !! end
8339
8340 !! article
8341 Template:Includes2
8342 !! text
8343 <onlyinclude>Foo</onlyinclude>bar
8344 !! endarticle
8345
8346 !! test
8347 <onlyinclude> being included
8348 !! wikitext
8349 {{Includes2}}
8350 !! html
8351 <p>Foo
8352 </p>
8353 !! end
8354
8355
8356 !! article
8357 Template:Includes3
8358 !! text
8359 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8360 !! endarticle
8361
8362 !! test
8363 <onlyinclude> and <includeonly> being included
8364 !! wikitext
8365 {{Includes3}}
8366 !! html
8367 <p>Foo
8368 </p>
8369 !! end
8370
8371 !! test
8372 <includeonly> and <noinclude> on a page
8373 !! wikitext
8374 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8375 !! html
8376 <p>Foozar
8377 </p>
8378 !! end
8379
8380 !! test
8381 Un-closed <noinclude>
8382 !! wikitext
8383 <noinclude>
8384 !! html
8385 !! end
8386
8387 !! test
8388 <onlyinclude> on a page
8389 !! wikitext
8390 <onlyinclude>Foo</onlyinclude>bar
8391 !! html
8392 <p>Foobar
8393 </p>
8394 !! end
8395
8396 !! test
8397 Un-closed <onlyinclude>
8398 !! wikitext
8399 <onlyinclude>
8400 !! html
8401 !! end
8402
8403 !!test
8404 Self-closed noinclude, includeonly, onlyinclude tags
8405 !! wikitext
8406 <noinclude />
8407 <includeonly />
8408 <onlyinclude />
8409 !! html
8410 <p><br />
8411 </p>
8412 !!end
8413
8414 !!test
8415 Unbalanced includeonly and noinclude tags
8416 !! wikitext
8417 {|
8418 |a</noinclude>
8419 |b</noinclude></noinclude>
8420 |c</noinclude></includeonly>
8421 |d</includeonly></includeonly>
8422 |}
8423 !! html
8424 <table>
8425 <tr>
8426 <td>a
8427 </td>
8428 <td>b
8429 </td>
8430 <td>c&lt;/includeonly&gt;
8431 </td>
8432 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8433 </td></tr></table>
8434
8435 !!end
8436
8437 !! article
8438 Template:Includeonly section
8439 !! text
8440 <includeonly>
8441 ==Includeonly section==
8442 </includeonly>
8443 ==Section T-1==
8444 !!endarticle
8445
8446 !! test
8447 Bug 6563: Edit link generation for section shown by <includeonly>
8448 !! wikitext
8449 {{includeonly section}}
8450 !! html
8451 <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>
8452 <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>
8453
8454 !! end
8455
8456 # Uses same input as the contents of [[Template:Includeonly section]]
8457 !! test
8458 Bug 6563: Section extraction for section shown by <includeonly>
8459 !! options
8460 section=T-2
8461 !! wikitext
8462 <includeonly>
8463 ==Includeonly section==
8464 </includeonly>
8465 ==Section T-2==
8466 !! html
8467 ==Section T-2==
8468 !! end
8469
8470 !! test
8471 Bug 6563: Edit link generation for section suppressed by <includeonly>
8472 !! wikitext
8473 <includeonly>
8474 ==Includeonly section==
8475 </includeonly>
8476 ==Section 1==
8477 !! html
8478 <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>
8479
8480 !! end
8481
8482 !! test
8483 Bug 6563: Section extraction for section suppressed by <includeonly>
8484 !! options
8485 section=1
8486 !! wikitext
8487 <includeonly>
8488 ==Includeonly section==
8489 </includeonly>
8490 ==Section 1==
8491 !! html
8492 ==Section 1==
8493 !! end
8494
8495 !! test
8496 Un-closed <includeonly>
8497 !! wikitext
8498 <includeonly>
8499 !! html
8500 !! end
8501
8502 # TODO: test with DOM fragment reuse!
8503 !! test
8504 Parsoid: DOM fragment reuse
8505 !! options
8506 parsoid=wt2wt,wt2html
8507 !! wikitext
8508 a{{echo|b<table></table>c}}d
8509
8510 a{{echo|b
8511 <table></table>
8512 c}}d
8513
8514 {{echo|a
8515
8516 <table></table>
8517
8518 b}}
8519 !! html
8520 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8521 <table></table>c"}},"i":0}}]}'>b</span>
8522 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8523
8524
8525 <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">
8526 </span>
8527 <table about="#mwt2"></table><span about="#mwt2">
8528 </span>
8529 <p about="#mwt2">cd</p>
8530
8531
8532 <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">
8533
8534 </span>
8535 <table about="#mwt3"></table><span about="#mwt3">
8536
8537 </span>
8538 <p about="#mwt3">b</p>
8539 !! end
8540
8541 !! test
8542 Parsoid: Merge double tds (bug 50603)
8543 !! options
8544 parsoid
8545 !! wikitext
8546 {|
8547 |{{echo|{{!}} foo}}
8548 |}
8549 !! html
8550 <table><tbody>
8551 <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>
8552 </tbody></table>
8553 !! end
8554
8555 !! test
8556 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8557 !! options
8558 parsoid
8559 !! wikitext
8560 {{echo|<div>}}
8561 {|
8562 |{{echo|{{!}} foo}}
8563 |}
8564 {{echo|</div>}}
8565 !! html
8566 <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}}]}'>
8567 <table><tbody>
8568 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8569 </tbody></table>
8570 </div>
8571 !! end
8572
8573 ###
8574 ### <includeonly> and <noinclude> in attributes
8575 ###
8576 !!test
8577 0. includeonly around the entire attribute
8578 !! wikitext
8579 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8580 !! html
8581 <p><span id="v2">bar</span>
8582 </p>
8583 !!end
8584
8585 !!test
8586 1. includeonly in html attr key
8587 !! wikitext
8588 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8589 !! html
8590 <p><span id="foo">bar</span>
8591 </p>
8592 !!end
8593
8594 !!test
8595 2. includeonly in html attr value
8596 !! wikitext
8597 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8598 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8599 !! html
8600 <p><span id="v1">bar</span>
8601 <span id="v1">bar</span>
8602 </p>
8603 !!end
8604
8605 !!test
8606 3. includeonly in part of an attr value
8607 !! wikitext
8608 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8609 !! html
8610 <p><span style="color:red;">bar</span>
8611 </p>
8612 !!end
8613
8614 !!test
8615 4. includeonly in table attributes
8616 !! wikitext
8617 {|
8618 |- <noinclude>
8619 |-
8620 |a
8621 </noinclude>
8622 |- <includeonly>
8623 |-
8624 |b
8625 </includeonly>
8626 |}
8627 !! html
8628 <table>
8629
8630
8631 <tr>
8632 <td>a
8633 </td></tr>
8634 </table>
8635
8636 !!end
8637
8638 ###
8639 ### Testing parsing of templates where a template arg
8640 ### has the same name as the template itself.
8641 ###
8642
8643 !! article
8644 Template:quote
8645 !! text
8646 {{{quote|{{{1}}}}}}
8647 !! endarticle
8648
8649 !!test
8650 Templates: Template Name/Arg clash: 1. Use of positional param
8651 !! wikitext
8652 {{quote|foo}}
8653 !! html
8654 <p>foo
8655 </p>
8656 !!end
8657
8658 !!test
8659 Templates: Template Name/Arg clash: 2. Use of named param
8660 !! wikitext
8661 {{quote|quote=foo}}
8662 !! html
8663 <p>foo
8664 </p>
8665 !!end
8666
8667 !!test
8668 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8669 !! wikitext
8670 {{quote|quote}}
8671 !! html
8672 <p>quote
8673 </p>
8674 !!end
8675
8676 ###
8677 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8678 ###
8679
8680 !!test
8681 Templates: 1. Simple use
8682 !! wikitext
8683 {{echo|Foo}}
8684 !! html
8685 <p>Foo
8686 </p>
8687 !!end
8688
8689 !!test
8690 Templates: 2. Inside a block tag
8691 !! wikitext
8692 <div>{{echo|Foo}}</div>
8693 <blockquote>{{echo|Foo}}</blockquote>
8694 !! html
8695 <div>Foo</div>
8696 <blockquote>Foo</blockquote>
8697
8698 !!end
8699
8700 !!test
8701 Templates: P-wrapping: 1a. Templates on consecutive lines
8702 !! wikitext
8703 {{echo|Foo}}
8704 {{echo|bar}}
8705 !! html
8706 <p>Foo
8707 bar
8708 </p>
8709 !!end
8710
8711 !!test
8712 Templates: P-wrapping: 1b. Templates on consecutive lines
8713 !! wikitext
8714 Foo
8715
8716 {{echo|bar}}
8717 {{echo|baz}}
8718 !! html
8719 <p>Foo
8720 </p><p>bar
8721 baz
8722 </p>
8723 !!end
8724
8725 !!test
8726 Templates: P-wrapping: 1c. Templates on consecutive lines
8727 !! wikitext
8728 {{echo|Foo}}
8729 {{echo|bar}} <div>baz</div>
8730 !! html
8731 <p>Foo
8732 </p>
8733 bar <div>baz</div>
8734
8735 !!end
8736
8737 !!test
8738 Templates: P-wrapping: 1d. Template preceded by comment-only line
8739 !!options
8740 parsoid
8741 !! wikitext
8742 <!-- foo -->
8743 {{echo|Bar}}
8744 !! html
8745 <!-- foo -->
8746
8747 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8748 !!end
8749
8750 !!test
8751 Templates: Inline Text: 1. Multiple tmeplate uses
8752 !! wikitext
8753 {{echo|Foo}}bar{{echo|baz}}
8754 !! html
8755 <p>Foobarbaz
8756 </p>
8757 !!end
8758
8759 !!test
8760 Templates: Inline Text: 2. Back-to-back template uses
8761 !! wikitext
8762 {{echo|Foo}}{{echo|bar}}
8763 !! html
8764 <p>Foobar
8765 </p>
8766 !!end
8767
8768 !!test
8769 Templates: Block Tags: 1. Multiple template uses
8770 !! wikitext
8771 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8772 !! html
8773 <div>Foo</div><div>bar</div><div>baz</div>
8774
8775 !!end
8776
8777 !!test
8778 Templates: Block Tags: 2. Back-to-back template uses
8779 !! wikitext
8780 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8781 !! html
8782 <div>Foo</div><div>bar</div>
8783
8784 !!end
8785
8786 !!test
8787 Templates: Links: 1. Simple example
8788 !! wikitext
8789 {{echo|[[Foo|bar]]}}
8790 !! html
8791 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8792 </p>
8793 !!end
8794
8795 !!test
8796 Templates: Links: 2. Generation of link href
8797 !! wikitext
8798 [[{{echo|Foo}}|bar]]
8799 !! html
8800 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8801 </p>
8802 !!end
8803
8804 !!test
8805 Templates: Links: 3. Generation of part of a link href
8806 !! wikitext
8807 [[Fo{{echo|o}}|bar]]
8808
8809 [[Foo{{echo|bar}}]]
8810
8811 [[Foo{{echo|bar}}baz]]
8812
8813 [[Foo{{echo|bar}}|bar]]
8814
8815 [[:Foo{{echo|bar}}]]
8816
8817 [[:Foo{{echo|bar}}|bar]]
8818 !! html
8819 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8820 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8821 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8822 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8823 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8824 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8825 </p>
8826 !!end
8827
8828 !!test
8829 Templates: Links: 4. Multiple templates generating link href
8830 !! wikitext
8831 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8832 !! html
8833 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8834 </p>
8835 !!end
8836
8837 !!test
8838 Templates: Links: 5. Generation of link text
8839 !! wikitext
8840 [[Foo|{{echo|bar}}]]
8841 !! html
8842 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8843 </p>
8844 !!end
8845
8846 !!test
8847 Templates: Links: 5. Nested templates (only outermost template should be marked)
8848 !! wikitext
8849 {{echo|[[{{echo|Foo}}|bar]]}}
8850 !! html
8851 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8852 </p>
8853 !!end
8854
8855 !!test
8856 Templates: HTML Tag: 1. Generation of HTML attr. key
8857 !! wikitext
8858 <div {{echo|style}}="color:red;">foo</div>
8859 !! html
8860 <div style="color:red;">foo</div>
8861
8862 !!end
8863
8864 !!test
8865 Templates: HTML Tag: 2. Generation of HTML attr. value
8866 !! wikitext
8867 <div style={{echo|'color:red;'}}>foo</div>
8868 !! html
8869 <div style="color:red;">foo</div>
8870
8871 !!end
8872
8873 !!test
8874 Templates: HTML Tag: 3. Generation of HTML attr key and value
8875 !! wikitext
8876 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8877 !! html
8878 <div style="color:red;">foo</div>
8879
8880 !!end
8881
8882 !!test
8883 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8884 !! wikitext
8885 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8886 !! html
8887 <div title="This is a long title with just one piece templated">foo</div>
8888
8889 !!end
8890
8891 !!test
8892 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8893 !! wikitext
8894 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8895 !! html
8896 <div title="This is a long title with just one piece templated">foo</div>
8897
8898 !!end
8899
8900 !!test
8901 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8902 !! wikitext
8903 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8904 !! html
8905 <div title="This is a long title with just one piece templated">foo</div>
8906
8907 !!end
8908
8909 !!test
8910 Templates: HTML Tag: 7. Generation of partial attribute key string
8911 !! wikitext
8912 <div st{{echo|yle}}="color:red;">foo</div>
8913 !! html
8914 <div style="color:red;">foo</div>
8915
8916 !!end
8917
8918 !!test
8919 Templates: HTML Tables: 1. Generating start of a HTML table
8920 !! wikitext
8921 {{echo|<table><tr><td>foo</td>}}</tr></table>
8922 !! html
8923 <table><tr><td>foo</td></tr></table>
8924
8925 !!end
8926
8927 !!test
8928 Templates: HTML Tables: 2a. Generating middle of a HTML table
8929 !! wikitext
8930 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8931 !! html
8932 <table><tr><td>foo</td></tr></table>
8933
8934 !!end
8935
8936 !!test
8937 Templates: HTML Tables: 2b. Generating middle of a HTML table
8938 !! wikitext
8939 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8940 !! html
8941 <table><tr><td>foo</td></tr></table>
8942
8943 !!end
8944
8945 !!test
8946 Templates: HTML Tables: 3. Generating end of a HTML table
8947 !! wikitext
8948 <table><tr>{{echo|<td>foo</td></tr></table>}}
8949 !! html
8950 <table><tr><td>foo</td></tr></table>
8951
8952 !!end
8953
8954 !!test
8955 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8956 !! wikitext
8957 {{echo|<table>}}<tr><td>foo</td></tr></table>
8958 !! html
8959 <table><tr><td>foo</td></tr></table>
8960
8961 !!end
8962
8963 !!test
8964 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8965 !! wikitext
8966 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8967 !! html
8968 <table><tr><td>foo</td></tr></table>
8969
8970 !!end
8971
8972 !!test
8973 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8974 !! wikitext
8975 <table><tr>{{echo|<td>}}foo</td></tr></table>
8976 !! html
8977 <table><tr><td>foo</td></tr></table>
8978
8979 !!end
8980
8981 !!test
8982 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8983 !! wikitext
8984 <table><tr><td>foo{{echo|</td>}}</tr></table>
8985 !! html
8986 <table><tr><td>foo</td></tr></table>
8987
8988 !!end
8989
8990 !!test
8991 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8992 !! wikitext
8993 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8994 !! html
8995 <table><tr><td>foo</td></tr></table>
8996
8997 !!end
8998
8999 !!test
9000 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9001 !! wikitext
9002 <table><tr><td>foo</td></tr>{{echo|</table>}}
9003 !! html
9004 <table><tr><td>foo</td></tr></table>
9005
9006 !!end
9007
9008 !!test
9009 Templates: HTML Tables: 5. Proper fostering of categories from inside
9010 !!options
9011 parsoid=wt2html,wt2wt
9012 !! wikitext
9013 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9014 <!--Two categories (Bug 50330)-->
9015 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9016 !! html
9017 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9018 <!--Two categories (Bug 50330)-->
9019 <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>
9020 !!end
9021
9022 !!test
9023 Templates: Wiki Tables: 1a. Fostering of entire template content
9024 !! wikitext
9025 {|
9026 {{echo|a}}
9027 |}
9028 !! html
9029 <table>
9030 a
9031 <tr><td></td></tr></table>
9032
9033 !!end
9034
9035 !!test
9036 Templates: Wiki Tables: 1b. Fostering of entire template content
9037 !! wikitext
9038 {|
9039 {{echo|<div>}}
9040 foo
9041 {{echo|</div>}}
9042 |}
9043 !! html
9044 <table>
9045 <div>
9046 <p>foo
9047 </p>
9048 </div>
9049 <tr><td></td></tr></table>
9050
9051 !!end
9052
9053 !!test
9054 Templates: Wiki Tables: 2. Fostering of partial template content
9055 !! wikitext
9056 {|
9057 {{echo|a
9058 <div>b</div>}}
9059 |}
9060 !! html
9061 <table>
9062 a
9063 <div>b</div>
9064 <tr><td></td></tr></table>
9065
9066 !!end
9067
9068 !!test
9069 Templates: Wiki Tables: 3. td-content via multiple templates
9070 !! wikitext
9071 {|
9072 {{echo|{{pipe}}a}}{{echo|b}}
9073 |}
9074 !! html
9075 <table>
9076 <tr>
9077 <td>ab
9078 </td></tr></table>
9079
9080 !!end
9081
9082 !!test
9083 Templates: Wiki Tables: 4. Templated tags, no content
9084 !! wikitext
9085 {{tbl-start}}
9086 {{tbl-end}}
9087 !! html
9088 <table>
9089 <tr><td></td></tr></table>
9090
9091 !!end
9092
9093 !!test
9094 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9095 !! wikitext
9096 {{tbl-start}}
9097 |foo
9098 {{tbl-end}}
9099 !! html
9100 <table>
9101 <tr>
9102 <td>foo
9103 </td></tr></table>
9104
9105 !!end
9106
9107 !!test
9108 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9109 !! wikitext
9110 {{tbl-start}}
9111 {{!}}foo
9112 {{tbl-end}}
9113 !! html
9114 <table>
9115 <tr>
9116 <td>foo
9117 </td></tr></table>
9118
9119 !!end
9120
9121 !!test
9122 Templates: Lists: Multi-line list-items via templates
9123 !! wikitext
9124 *{{echo|a {{nonexistent|
9125 unused}}}}
9126 *{{echo|b {{nonexistent|
9127 unused}}}}
9128 !! html
9129 <ul>
9130 <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>
9131 </li>
9132 <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>
9133 </li>
9134 </ul>
9135
9136 !!end
9137
9138 !!test
9139 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9140 !! wikitext
9141 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9142 !! html
9143 <p><i>ab</i>c<i>d</i>e
9144 </p>
9145 !!end
9146
9147 !!test
9148 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9149 (PHP parser generates misnested html)
9150 !! wikitext
9151 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9152 !! html/parsoid
9153 <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>
9154 !!end
9155
9156 !!test
9157 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9158 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9159 !! options
9160 parsoid=wt2html,wt2wt
9161 !! wikitext
9162 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9163 !! html
9164 <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>
9165 <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>
9166 <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>
9167 !!end
9168
9169 !!test
9170 Templates: Ugly nesting: 4. Divs opened/closed across templates
9171 !! wikitext
9172 a<div>b{{echo|c</div>d}}e
9173 !! html
9174 a<div>bc</div>de
9175
9176 !!end
9177
9178 !!test
9179 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9180 (Parsoid-centric)
9181 !! options
9182 parsoid
9183 !! wikitext
9184 {|
9185 |{{echo|foo</table>}}
9186 |bar
9187 |}
9188 !! html
9189 <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|}"]}'>
9190
9191 <tbody>
9192 <tr>
9193 <td>foo</td></tr></tbody></table><span about="#mwt1">
9194 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9195 |}</span>
9196 !!end
9197
9198 !!test
9199 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9200 (Parsoid-centric)
9201 !! options
9202 parsoid
9203 !! wikitext
9204 <table>
9205 <tr>
9206 <td>
9207 <table>
9208 <tr>
9209 <td>1. {{echo|foo </table>}}</td>
9210 <td> bar </td>
9211 <td>2. {{echo|baz </table>}}</td>
9212 </tr>
9213 <tr>
9214 <td>abc</td>
9215 </tr>
9216 </table>
9217 </td>
9218 </tr>
9219 <tr>
9220 <td>xyz</td>
9221 </tr>
9222 </table>
9223 !! html
9224 <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>"]}'>
9225 <tbody><tr>
9226 <td>
9227 <table>
9228 <tbody><tr>
9229 <td>1. foo </td></tr></tbody></table></td>
9230 <td> bar </td>
9231 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9232 </span><span about="#mwt2">
9233 </span><span about="#mwt2">
9234 </span><span about="#mwt2">abc</span><span about="#mwt2">
9235 </span><span about="#mwt2">
9236 </span><span about="#mwt2">
9237 </span><span about="#mwt2">
9238 </span><span about="#mwt2">
9239 </span><span about="#mwt2">
9240 </span><span about="#mwt2">xyz</span><span about="#mwt2">
9241 </span><span about="#mwt2">
9242 </span>
9243 !!end
9244
9245 !! test
9246 Templates: Ugly templates: 3. newline-only template parameter
9247 !! wikitext
9248 foo {{echo|
9249 }}
9250 !! html
9251 <p>foo
9252 </p>
9253 !! end
9254
9255 # This looks like a bug: a single newline triggers p/br for some reason.
9256 !! test
9257 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9258 !! wikitext
9259 {{echo|
9260 }}
9261 !! html
9262 <p><br />
9263 </p>
9264 !! end
9265
9266
9267 !!test
9268 Parser Functions: 1. Simple example
9269 !! wikitext
9270 {{uc:foo}}
9271 !! html
9272 <p>FOO
9273 </p>
9274 !!end
9275
9276 !!test
9277 Parser Functions: 2. Nested use (only outermost should be marked up)
9278 !! wikitext
9279 {{uc:{{lc:FOO}}}}
9280 !! html
9281 <p>FOO
9282 </p>
9283 !!end
9284
9285 ###
9286 ### Pre-save transform tests
9287 ###
9288 !! test
9289 pre-save transform: subst:
9290 !! options
9291 PST
9292 !! wikitext
9293 {{subst:test}}
9294 !! html
9295 This is a test template
9296 !! end
9297
9298 !! test
9299 pre-save transform: normal template
9300 !! options
9301 PST
9302 !! wikitext
9303 {{test}}
9304 !! html
9305 {{test}}
9306 !! end
9307
9308 !! test
9309 pre-save transform: nonexistent template
9310 !! options
9311 PST
9312 !! wikitext
9313 {{thistemplatedoesnotexist}}
9314 !! html
9315 {{thistemplatedoesnotexist}}
9316 !! end
9317
9318
9319 !! test
9320 pre-save transform: subst magic variables
9321 !! options
9322 PST
9323 !! wikitext
9324 {{subst:SITENAME}}
9325 !! html
9326 MediaWiki
9327 !! end
9328
9329 # This is bug 89, which I fixed. -- wtm
9330 !! test
9331 pre-save transform: subst: templates with parameters
9332 !! options
9333 pst
9334 !! wikitext
9335 {{subst:paramtest|param="something else"}}
9336 !! html
9337 This is a test template with parameter "something else"
9338 !! end
9339
9340 !! article
9341 Template:nowikitest
9342 !! text
9343 <nowiki>'''not wiki'''</nowiki>
9344 !! endarticle
9345
9346 !! test
9347 pre-save transform: nowiki in subst (bug 1188)
9348 !! options
9349 pst
9350 !! wikitext
9351 {{subst:nowikitest}}
9352 !! html
9353 <nowiki>'''not wiki'''</nowiki>
9354 !! end
9355
9356
9357 !! article
9358 Template:commenttest
9359 !! text
9360 This template has <!-- a comment --> in it.
9361 !! endarticle
9362
9363 !! test
9364 pre-save transform: comment in subst (bug 1936)
9365 !! options
9366 pst
9367 !! wikitext
9368 {{subst:commenttest}}
9369 !! html
9370 This template has <!-- a comment --> in it.
9371 !! end
9372
9373 !! test
9374 pre-save transform: unclosed tag
9375 !! options
9376 pst noxml
9377 !! wikitext
9378 <nowiki>'''not wiki'''
9379 !! html
9380 <nowiki>'''not wiki'''
9381 !! end
9382
9383 !! test
9384 pre-save transform: mixed tag case
9385 !! options
9386 pst noxml
9387 !! wikitext
9388 <NOwiki>'''not wiki'''</noWIKI>
9389 !! html
9390 <NOwiki>'''not wiki'''</noWIKI>
9391 !! end
9392
9393 !! test
9394 pre-save transform: unclosed comment in <nowiki>
9395 !! options
9396 pst noxml
9397 !! wikitext
9398 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9399 !! html
9400 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9401 !!end
9402
9403 # Leading @ in this template definition works around a limitation
9404 # in parsoid's parserTests which otherwise strips the <span> from the
9405 # result (confusing it for a template wrapper)
9406 !! article
9407 Template:dangerous
9408 !!text
9409 @<span onmouseover="alert('crap')">Oh no</span>
9410 !!endarticle
9411
9412 !!test
9413 (confirming safety of fix for subst bug 1936)
9414 !! wikitext
9415 {{Template:dangerous}}
9416 !! html
9417 <p>@<span>Oh no</span>
9418 </p>
9419 !! end
9420
9421 !! test
9422 pre-save transform: comment containing gallery (bug 5024)
9423 !! options
9424 pst
9425 !! wikitext
9426 <!-- <gallery>data</gallery> -->
9427 !! html
9428 <!-- <gallery>data</gallery> -->
9429 !!end
9430
9431 !! test
9432 pre-save transform: comment containing extension
9433 !! options
9434 pst
9435 !! wikitext
9436 <!-- <tag>data</tag> -->
9437 !! html
9438 <!-- <tag>data</tag> -->
9439 !!end
9440
9441 !! test
9442 pre-save transform: comment containing nowiki
9443 !! options
9444 pst
9445 !! wikitext
9446 <!-- <nowiki>data</nowiki> -->
9447 !! html
9448 <!-- <nowiki>data</nowiki> -->
9449 !!end
9450
9451 !! test
9452 pre-save transform: <noinclude> in subst (bug 3298)
9453 !! options
9454 pst
9455 !! wikitext
9456 {{subst:Includes}}
9457 !! html
9458 Foobar
9459 !! end
9460
9461 !! test
9462 pre-save transform: <onlyinclude> in subst (bug 3298)
9463 !! options
9464 pst
9465 !! wikitext
9466 {{subst:Includes2}}
9467 !! html
9468 Foo
9469 !! end
9470
9471 !! article
9472 Template:SubstTest
9473 !!text
9474 {{<includeonly>subst:</includeonly>Includes}}
9475 !! endarticle
9476
9477 !! article
9478 Template:SafeSubstTest
9479 !! text
9480 {{<includeonly>safesubst:</includeonly>Includes}}
9481 !! endarticle
9482
9483 !! test
9484 bug 22297: safesubst: works during PST
9485 !! options
9486 pst
9487 !! wikitext
9488 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9489 !! html
9490 FoobarFoobar
9491 !! end
9492
9493 !! test
9494 bug 22297: safesubst: works during normal parse
9495 !! wikitext
9496 {{SafeSubstTest}}
9497 !! html
9498 <p>Foobar
9499 </p>
9500 !! end
9501
9502 !! test
9503 subst: does not work during normal parse
9504 !! wikitext
9505 {{SubstTest}}
9506 !! html
9507 <p>{{subst:Includes}}
9508 </p>
9509 !! end
9510
9511 !! test
9512 pre-save transform: context links ("pipe trick")
9513 !! options
9514 pst
9515 !! wikitext
9516 [[Article (context)|]]
9517 [[Bar:Article|]]
9518 [[:Bar:Article|]]
9519 [[Bar:Article (context)|]]
9520 [[:Bar:Article (context)|]]
9521 [[|Article]]
9522 [[|Article (context)]]
9523 [[Bar:X (Y) Z|]]
9524 [[:Bar:X (Y) Z|]]
9525 !! html
9526 [[Article (context)|Article]]
9527 [[Bar:Article|Article]]
9528 [[:Bar:Article|Article]]
9529 [[Bar:Article (context)|Article]]
9530 [[:Bar:Article (context)|Article]]
9531 [[Article]]
9532 [[Article (context)]]
9533 [[Bar:X (Y) Z|X (Y) Z]]
9534 [[:Bar:X (Y) Z|X (Y) Z]]
9535 !! end
9536
9537 !! test
9538 pre-save transform: context links ("pipe trick") with interwiki prefix
9539 !! options
9540 pst
9541 !! wikitext
9542 [[interwiki:Article|]]
9543 [[:interwiki:Article|]]
9544 [[interwiki:Bar:Article|]]
9545 [[:interwiki:Bar:Article|]]
9546 !! html
9547 [[interwiki:Article|Article]]
9548 [[:interwiki:Article|Article]]
9549 [[interwiki:Bar:Article|Bar:Article]]
9550 [[:interwiki:Bar:Article|Bar:Article]]
9551 !! end
9552
9553 !! test
9554 pre-save transform: context links ("pipe trick") with parens in title
9555 !! options
9556 pst title=[[Somearticle (context)]]
9557 !! wikitext
9558 [[|Article]]
9559 !! html
9560 [[Article (context)|Article]]
9561 !! end
9562
9563 !! test
9564 pre-save transform: context links ("pipe trick") with comma in title
9565 !! options
9566 pst title=[[Someplace, Somewhere]]
9567 !! wikitext
9568 [[|Otherplace]]
9569 [[Otherplace, Elsewhere|]]
9570 [[Otherplace, Elsewhere, Anywhere|]]
9571 !! html
9572 [[Otherplace, Somewhere|Otherplace]]
9573 [[Otherplace, Elsewhere|Otherplace]]
9574 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9575 !! end
9576
9577 !! test
9578 pre-save transform: context links ("pipe trick") with parens and comma
9579 !! options
9580 pst title=[[Someplace (IGNORED), Somewhere]]
9581 !! wikitext
9582 [[|Otherplace]]
9583 [[Otherplace (place), Elsewhere|]]
9584 !! html
9585 [[Otherplace, Somewhere|Otherplace]]
9586 [[Otherplace (place), Elsewhere|Otherplace]]
9587 !! end
9588
9589 !! test
9590 pre-save transform: context links ("pipe trick") with comma and parens
9591 !! options
9592 pst title=[[Who, me? (context)]]
9593 !! wikitext
9594 [[|Yes, you.]]
9595 [[Me, Myself, and I (1937 song)|]]
9596 !! html
9597 [[Yes, you. (context)|Yes, you.]]
9598 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9599 !! end
9600
9601 !! test
9602 pre-save transform: context links ("pipe trick") with namespace
9603 !! options
9604 pst title=[[Ns:Somearticle]]
9605 !! wikitext
9606 [[|Article]]
9607 !! html
9608 [[Ns:Article|Article]]
9609 !! end
9610
9611 !! test
9612 pre-save transform: context links ("pipe trick") with namespace and parens
9613 !! options
9614 pst title=[[Ns:Somearticle (context)]]
9615 !! wikitext
9616 [[|Article]]
9617 !! html
9618 [[Ns:Article (context)|Article]]
9619 !! end
9620
9621 !! test
9622 pre-save transform: context links ("pipe trick") with namespace and comma
9623 !! options
9624 pst title=[[Ns:Somearticle, Context, Whatever]]
9625 !! wikitext
9626 [[|Article]]
9627 !! html
9628 [[Ns:Article, Context, Whatever|Article]]
9629 !! end
9630
9631 !! test
9632 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9633 !! options
9634 pst title=[[Ns:Somearticle, Context (context)]]
9635 !! wikitext
9636 [[|Article]]
9637 !! html
9638 [[Ns:Article (context)|Article]]
9639 !! end
9640
9641 !! test
9642 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9643 !! options
9644 pst title=[[Ns:Somearticle (IGNORED), Context]]
9645 !! wikitext
9646 [[|Article]]
9647 !! html
9648 [[Ns:Article, Context|Article]]
9649 !! end
9650
9651 !! test
9652 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9653 !! options
9654 pst
9655 !! wikitext
9656 [[Article(context)|]]
9657 [[Bar:Article(context)|]]
9658 [[:Bar:Article(context)|]]
9659 [[|Article(context)]]
9660 [[Bar:X(Y)Z|]]
9661 [[:Bar:X(Y)Z|]]
9662 !! html
9663 [[Article(context)|Article]]
9664 [[Bar:Article(context)|Article]]
9665 [[:Bar:Article(context)|Article]]
9666 [[Article(context)]]
9667 [[Bar:X(Y)Z|X(Y)Z]]
9668 [[:Bar:X(Y)Z|X(Y)Z]]
9669 !! end
9670
9671 !! test
9672 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9673 !! options
9674 pst
9675 !! wikitext
9676 [[Article (context)|]]
9677 [[Bar:Article (context)|]]
9678 [[:Bar:Article (context)|]]
9679 [[|Article (context)]]
9680 [[Bar:X (Y) Z|]]
9681 [[:Bar:X (Y) Z|]]
9682 !! html
9683 [[Article (context)|Article]]
9684 [[Bar:Article (context)|Article]]
9685 [[:Bar:Article (context)|Article]]
9686 [[Article (context)]]
9687 [[Bar:X (Y) Z|X (Y) Z]]
9688 [[:Bar:X (Y) Z|X (Y) Z]]
9689 !! end
9690
9691 !! test
9692 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9693 !! options
9694 pst
9695 !! wikitext
9696 [[Article(context)|]]
9697 [[Bar:Article(context)|]]
9698 [[:Bar:Article(context)|]]
9699 [[|Article(context)]]
9700 [[Bar:X(Y)Z|]]
9701 [[:Bar:X(Y)Z|]]
9702 !! html
9703 [[Article(context)|Article]]
9704 [[Bar:Article(context)|Article]]
9705 [[:Bar:Article(context)|Article]]
9706 [[Article(context)]]
9707 [[Bar:X(Y)Z|X(Y)Z]]
9708 [[:Bar:X(Y)Z|X(Y)Z]]
9709 !! end
9710
9711 !! test
9712 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9713 !! options
9714 pst
9715 !! wikitext
9716 [[Article (context), context|]]
9717 [[Article (context),context|]]
9718 [[Bar:Article (context), context|]]
9719 [[Bar:Article (context),context|]]
9720 [[:Bar:Article (context), context|]]
9721 [[:Bar:Article (context),context|]]
9722 !! html
9723 [[Article (context), context|Article]]
9724 [[Article (context),context|Article]]
9725 [[Bar:Article (context), context|Article]]
9726 [[Bar:Article (context),context|Article]]
9727 [[:Bar:Article (context), context|Article]]
9728 [[:Bar:Article (context),context|Article]]
9729 !! end
9730
9731 !! test
9732 pre-save transform: trim trailing empty lines
9733 !! options
9734 pst
9735 !! wikitext
9736 Empty lines are trimmed
9737
9738
9739
9740
9741 !! html
9742 Empty lines are trimmed
9743 !! end
9744
9745 !! test
9746 pre-save transform: Signature expansion
9747 !! options
9748 pst
9749 !! wikitext
9750 * ~~~
9751 * <noinclude>~~~</noinclude>
9752 * <includeonly>~~~</includeonly>
9753 * <onlyinclude>~~~</onlyinclude>
9754 !! html
9755 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9756 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9757 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9758 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9759 !! end
9760
9761
9762 !! test
9763 pre-save transform: Signature expansion in nowiki tags (bug 93)
9764 !! options
9765 pst disabled
9766 !! wikitext
9767 Shall not expand:
9768
9769 <nowiki>~~~~</nowiki>
9770
9771 <includeonly><nowiki>~~~~</nowiki></includeonly>
9772
9773 <noinclude><nowiki>~~~~</nowiki></noinclude>
9774
9775 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9776
9777 {{subst:Foo}} shall be converted to FOO
9778
9779 As well as inside noinclude/onlyinclude
9780 <noinclude>{{subst:Foo}}</noinclude>
9781 <onlyinclude>{{subst:Foo}}</onlyinclude>
9782
9783 But not inside includeonly
9784 <includeonly>{{subst:Foo}}</includeonly>
9785 !! html
9786 Shall not expand:
9787
9788 <nowiki>~~~~</nowiki>
9789
9790 <includeonly><nowiki>~~~~</nowiki></includeonly>
9791
9792 <noinclude><nowiki>~~~~</nowiki></noinclude>
9793
9794 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9795
9796 FOO shall be converted to FOO
9797
9798 As well as inside noinclude/onlyinclude
9799 <noinclude>FOO</noinclude>
9800 <onlyinclude>FOO</onlyinclude>
9801
9802 But not inside includeonly
9803 <includeonly>{{subst:Foo}}</includeonly>
9804 !! end
9805
9806 !! test
9807 Parsoid: Recognize nowiki with trailing space in tags
9808 !! options
9809 parsoid=wt2html
9810 !! wikitext
9811 <nowiki ><div>[[foo]]</nowiki >
9812
9813 a<nowiki / >b
9814
9815 c<nowiki />d
9816
9817 e<nowiki/ >f
9818 !! html
9819 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9820 <p>ab</p>
9821 <p>cd</p>
9822 <p>ef</p>
9823 !! end
9824
9825 !! test
9826 Parsoid: Recognize nowiki with odd capitalization
9827 !! options
9828 parsoid=wt2html
9829 !! wikitext
9830 <noWikI ><div>[[foo]]</Nowiki >
9831 !! html
9832 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9833 !! end
9834
9835
9836 !! test
9837 Parsoid: Escape nowiki with trailing space in tags
9838 !! options
9839 parsoid=html2wt
9840 !! wikitext
9841 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9842
9843 a&lt;nowiki /&gt;b
9844
9845 c&lt;nowiki/ &gt;d
9846 !! html
9847 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9848 <p>a&lt;nowiki /&gt;b</p>
9849 <p>c&lt;nowiki/ &gt;d</p>
9850 !! end
9851
9852 !! test
9853 Parsoid: Escape weird noWikI capitalizations
9854 !! options
9855 parsoid=html2wt
9856 !! wikitext
9857 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9858 !! html
9859 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9860 !! end
9861
9862 ###
9863 ### Message transform tests
9864 ###
9865 !! test
9866 message transform: magic variables
9867 !! options
9868 msg
9869 !! wikitext
9870 {{SITENAME}}
9871 !! html
9872 MediaWiki
9873 !! end
9874
9875 !! test
9876 message transform: should not transform wiki markup
9877 !! options
9878 msg
9879 !! wikitext
9880 ''test''
9881 !! html
9882 ''test''
9883 !! end
9884
9885 !! test
9886 message transform: <noinclude> in transcluded template (bug 4926)
9887 !! options
9888 msg
9889 !! wikitext
9890 {{Includes}}
9891 !! html
9892 Foobar
9893 !! end
9894
9895 !! test
9896 message transform: <onlyinclude> in transcluded template (bug 4926)
9897 !! options
9898 msg
9899 !! wikitext
9900 {{Includes2}}
9901 !! html
9902 Foo
9903 !! end
9904
9905 !! test
9906 {{#special:}} page name, known
9907 !! options
9908 msg
9909 !! wikitext
9910 {{#special:Recentchanges}}
9911 !! html
9912 Special:RecentChanges
9913 !! end
9914
9915 !! test
9916 {{#special:}} page name with subpage, known
9917 !! options
9918 msg
9919 !! wikitext
9920 {{#special:Recentchanges/param}}
9921 !! html
9922 Special:RecentChanges/param
9923 !! end
9924
9925 !! test
9926 {{#special:}} page name, unknown
9927 !! options
9928 msg
9929 !! wikitext
9930 {{#special:foobar nonexistent}}
9931 !! html
9932 Special:Foobar nonexistent
9933 !! end
9934
9935 !! test
9936 {{#speciale:}} page name, known
9937 !! options
9938 msg
9939 !! wikitext
9940 {{#speciale:Recentchanges}}
9941 !! html
9942 Special:RecentChanges
9943 !! end
9944
9945 !! test
9946 {{#speciale:}} page name with subpage, known
9947 !! options
9948 msg
9949 !! wikitext
9950 {{#speciale:Recentchanges/param}}
9951 !! html
9952 Special:RecentChanges/param
9953 !! end
9954
9955 !! test
9956 {{#speciale:}} page name, unknown
9957 !! options
9958 msg
9959 !! wikitext
9960 {{#speciale:foobar nonexistent}}
9961 !! html
9962 Special:Foobar_nonexistent
9963 !! end
9964
9965 ###
9966 ### Images
9967 ###
9968 ### For Parsoid-specific tests, see
9969 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9970
9971 !! test
9972 Simple image
9973 !! options
9974 parsoid=wt2html,wt2wt,html2html
9975 !! wikitext
9976 [[Image:foobar.jpg]]
9977 !! html/php
9978 <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>
9979 </p>
9980 !! html/parsoid
9981 <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>
9982 </p>
9983 !! end
9984
9985 !! test
9986 Simple image (using File: namespace, now canonical)
9987 !! wikitext
9988 [[File:Foobar.jpg]]
9989 !! html/php
9990 <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>
9991 </p>
9992 !! html/parsoid
9993 <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>
9994 </p>
9995 !! end
9996
9997 !! test
9998 Right-aligned image
9999 !! wikitext
10000 [[File:Foobar.jpg|right]]
10001 !! html/php
10002 <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>
10003
10004 !! html/parsoid
10005 <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>
10006 !! end
10007
10008 !! test
10009 Image with caption
10010 !! wikitext
10011 [[File:Foobar.jpg|right|Caption text]]
10012 !! html/php
10013 <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>
10014
10015 !! html/parsoid
10016 <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>
10017 !! end
10018
10019 !! test
10020 Image with caption, bug 53312 #1
10021 !! wikitext
10022 [[File:Foobar.jpg|right|Caption page stuff]]
10023 !! html/php
10024 <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>
10025
10026 !! html/parsoid
10027 <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>
10028 !! end
10029
10030 !! test
10031 Image with caption, bug 53312 #2
10032 !! wikitext
10033 [[File:Foobar.jpg|right|Caption page=]]
10034 !! html/php
10035 <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>
10036
10037 !! html/parsoid
10038 <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>
10039 !! end
10040
10041 !! test
10042 Image with caption, bug 53312 #3
10043 !! wikitext
10044 [[File:Foobar.jpg|right|Caption page=stuff]]
10045 !! html/php
10046 <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>
10047
10048 !! html/parsoid
10049 <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>
10050 !! end
10051
10052 !! test
10053 Allow empty links in image captions (Bug 60753)
10054 !! options
10055 thumbsize=220
10056 !! wikitext
10057 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10058 [[]]
10059 [[Link2]]
10060 ]]
10061 !! html/php
10062 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
10063
10064 !! html/parsoid
10065 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
10066 [[]]
10067 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10068 </figcaption></figure>
10069 !! end
10070
10071 !! test
10072 Link with empty target
10073 !! wikitext
10074 [[]]
10075 !! html
10076 <p>[[]]
10077 </p>
10078 !! end
10079
10080 !! test
10081 Image with empty attribute
10082 !! options
10083 parsoid=wt2html,wt2wt,html2html
10084 !! wikitext
10085 [[File:Foobar.jpg|right||Caption text]]
10086 !! html/php
10087 <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>
10088
10089 !! html/parsoid
10090 <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>
10091 !! end
10092
10093 !! test
10094 1. Block image with individual attributes from templates
10095 !! wikitext
10096 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10097 !! html/php
10098 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
10099
10100 !! html/parsoid
10101 <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;dsr&amp;quot;:[24,38,null,null],&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;]}]]}\">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>
10102 !! end
10103
10104 !! test
10105 2. Block Image with individual attributes from templates
10106 !! wikitext
10107 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10108 !! html/php
10109 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
10110
10111 !! html/parsoid
10112 <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;dsr&amp;quot;:[18,32,null,null],&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;]}]]}\">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;dsr&amp;quot;:[33,47,null,null],&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;]}]]}\">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>
10113 !! end
10114
10115 !! test
10116 3. Inline image with individual attributes from templates
10117 !! wikitext
10118 [[File:Foobar.jpg|{{echo|50px}}]]
10119 !! html/php
10120 <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>
10121 </p>
10122 !! html/parsoid
10123 <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;dsr&amp;quot;:[18,31,null,null],&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;]}]]}\">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>
10124 !! end
10125
10126 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10127 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10128 !! test
10129 Image with multiple attributes from the same template
10130 !! wikitext
10131 [[File:Foobar.jpg|{{image_attribs}}]]
10132 !! html/php
10133 <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>
10134
10135 !! html/parsoid
10136 <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>
10137 !! end
10138
10139 !! test
10140 Image with link tails
10141 !! options
10142 thumbsize=220
10143 !! wikitext
10144 123[[File:Foobar.jpg]]456
10145 123[[File:Foobar.jpg|right]]456
10146 123[[File:Foobar.jpg|thumb]]456
10147 !! html/php
10148 <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
10149 </p>
10150 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
10151 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
10152
10153 !! html/parsoid
10154 <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>
10155 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
10156 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
10157 !! end
10158
10159 !! test
10160 Image with multiple captions -- only last one is accepted
10161 !! wikitext
10162 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10163 !! html/php
10164 <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>
10165
10166 !! html/parsoid
10167 <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>
10168 !! end
10169
10170 !! test
10171 Image with multiple widths -- use last
10172 !! wikitext
10173 [[File:Foobar.jpg|200px|300px|caption]]
10174 !! html/php
10175 <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>
10176 </p>
10177 !! html/parsoid
10178 <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>
10179 !! end
10180
10181 !! test
10182 Image with multiple alignments -- use first (bug 48664)
10183 !! options
10184 thumbsize=220
10185 !! wikitext
10186 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10187
10188 [[File:Foobar.jpg|middle|text-top|caption]]
10189 !! html/php
10190 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10191 <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>
10192 </p>
10193 !! html/parsoid
10194 <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>
10195 <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>
10196 !! end
10197
10198 !! test
10199 Image with width attribute at different positions
10200 !! wikitext
10201 [[File:Foobar.jpg|200px|right|Caption]]
10202 [[File:Foobar.jpg|right|200px|Caption]]
10203 [[File:Foobar.jpg|right|Caption|200px]]
10204 !! html/php
10205 <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>
10206 <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>
10207 <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>
10208
10209 !! html/parsoid
10210 <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>
10211 <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>
10212 <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>
10213 !! end
10214
10215 # a sad bit of backward-compatibility
10216 !! test
10217 Image with size specified with pxpx (bug 13500, 51628)
10218 !! options
10219 parsoid=wt2html,wt2wt,html2html
10220 !! wikitext
10221 [[File:Foobar.jpg|20pxpx]]
10222 [[File:Foobar.jpg|200x20pxpx]]
10223 !! html/php
10224 <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>
10225 <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>
10226 </p>
10227 !! html/parsoid
10228 <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>
10229 !! end
10230
10231 !! test
10232 Image with link parameter, wiki target
10233 !! wikitext
10234 [[File:Foobar.jpg|link=Main Page]]
10235 !! html/php
10236 <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>
10237 </p>
10238 !! html/parsoid
10239 <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>
10240 !! end
10241
10242 # parsoid bug 49293 (part 1)
10243 !! test
10244 Image with link parameter, URL target
10245 !! wikitext
10246 [[File:Foobar.jpg|link=http://example.com/]]
10247 !! html/php
10248 <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>
10249 </p>
10250 !! html/parsoid
10251 <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>
10252 !! end
10253
10254 # parsoid bug 49293 (part 2)
10255 !! test
10256 Image with link parameter, protocol-less URL target
10257 !! wikitext
10258 [[File:Foobar.jpg|link=//example.com/]]
10259 !! html/php
10260 <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>
10261 </p>
10262 !! html/parsoid
10263 <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>
10264 !! end
10265
10266 !! test
10267 Image with link parameter, wgExternalLinkTarget
10268 !! wikitext
10269 [[Image:foobar.jpg|link=http://example.com/]]
10270 !! config
10271 wgExternalLinkTarget='foobar'
10272 !! html
10273 <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>
10274 </p>
10275 !! end
10276
10277 !! test
10278 Image with link parameter, wgNoFollowLinks set to false
10279 !! wikitext
10280 [[Image:foobar.jpg|link=http://example.com/]]
10281 !! config
10282 wgNoFollowLinks=false
10283 !! html
10284 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10285 </p>
10286 !! end
10287
10288 !! test
10289 Image with link parameter, wgNoFollowDomainExceptions
10290 !! wikitext
10291 [[Image:foobar.jpg|link=http://example.com/]]
10292 !! config
10293 wgNoFollowDomainExceptions='example.com'
10294 !! html
10295 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10296 </p>
10297 !! end
10298
10299 !! test
10300 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10301 !! wikitext
10302 [[Image:foobar.jpg|link=http://example.com/|Title]]
10303 !! config
10304 wgExternalLinkTarget='foobar'
10305 !! html
10306 <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>
10307 </p>
10308 !! end
10309
10310 !! test
10311 Image with empty link parameter
10312 !! wikitext
10313 [[File:Foobar.jpg|link=]]
10314 !! html/php
10315 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10316 </p>
10317 !! html/parsoid
10318 <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>
10319 !! end
10320
10321 !! test
10322 Image with link parameter (wiki target) and unnamed parameter
10323 !! wikitext
10324 [[File:Foobar.jpg|link=Main_Page|Title]]
10325 !! html/php
10326 <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>
10327 </p>
10328 !! html/parsoid
10329 <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>
10330 !! end
10331
10332 !! test
10333 Image with link parameter (URL target) and unnamed parameter
10334 !! wikitext
10335 [[File:Foobar.jpg|link=http://example.com/|Title]]
10336 !! html/php
10337 <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>
10338 </p>
10339 !! html/parsoid
10340 <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>
10341 !! end
10342
10343 !! test
10344 Thumbnail image with link parameter
10345 !! options
10346 thumbsize=220
10347 parsoid=wt2html,wt2wt,html2html
10348 !! wikitext
10349 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10350 !! html/php
10351 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10352
10353 !! html/parsoid
10354 <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>
10355 !! end
10356
10357 !! test
10358 Manually-specified thumbnail image
10359 !! options
10360 thumbsize=220
10361 !! wikitext
10362 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10363 !! html/php
10364 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10365
10366 !! html/parsoid
10367 <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>
10368 !! end
10369
10370 !! test
10371 Manually-specified thumbnail image with explicit link to wiki page
10372 !! options
10373 thumbsize=220
10374 parsoid=wt2html,wt2wt,html2html
10375 !! wikitext
10376 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10377 !! html/php
10378 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10379
10380 !! html/parsoid
10381 <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>
10382 !! end
10383
10384 !! test
10385 Manually-specified thumbnail image with explicit link to url
10386 !! options
10387 thumbsize=220
10388 parsoid=wt2html,wt2wt,html2html
10389 !! wikitext
10390 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10391 !! html/php
10392 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10393
10394 !! html/parsoid
10395 <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>
10396 !! end
10397
10398 !! test
10399 Manually-specified thumbnail image with explicit no link
10400 !! options
10401 thumbsize=220
10402 parsoid=wt2html,wt2wt,html2html
10403 !! wikitext
10404 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10405 !! html/php
10406 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10407
10408 !! html/parsoid
10409 <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>
10410 !! end
10411
10412 !! test
10413 Manually-specified thumbnail image with explicit link and alt text
10414 !! options
10415 thumbsize=220
10416 parsoid=wt2html,wt2wt,html2html
10417 !! wikitext
10418 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10419 !! html/php
10420 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10421
10422 !! html/parsoid
10423 <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>
10424 !! end
10425
10426 !! test
10427 Image with frame and link
10428 !! options
10429 parsoid=wt2html,wt2wt,html2html
10430 !! wikitext
10431 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10432 !! html/php
10433 <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>
10434
10435 !! html/parsoid
10436 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page">Main Page</a></figcaption></figure>
10437 !! end
10438
10439 !! test
10440 Image with frame and link and explicit alt
10441 !! options
10442 parsoid=wt2html,wt2wt,html2html
10443 !! wikitext
10444 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10445 !! html/php
10446 <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>
10447
10448 !! html/parsoid
10449 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page">Main Page</a></figcaption></figure>
10450 !! end
10451
10452 !! test
10453 Image with wiki markup in implicit alt
10454 !! options
10455 parsoid=wt2html,wt2wt,html2html
10456 !! wikitext
10457 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10458
10459 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10460 !! html/php
10461 <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>
10462 </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>
10463 </p>
10464 !! html/parsoid
10465 <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>
10466 <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>
10467 !! end
10468
10469 ###################
10470 # Conflicting image format options.
10471 # First option specified should 'win'.
10472 # All three cases in each test should be identical.
10473
10474 !! test
10475 Image with 'frameless' first.
10476 !! wikitext
10477 [[File:Foobar.jpg|frameless|caption]]
10478
10479 [[File:Foobar.jpg|frameless|frame|caption]]
10480
10481 [[File:Foobar.jpg|frameless|thumb|caption]]
10482 !! html/php
10483 <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>
10484 </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>
10485 </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>
10486 </p>
10487 !! end
10488
10489 !! test
10490 Image with 'frame' first.
10491 !! wikitext
10492 [[File:Foobar.jpg|frame|caption]]
10493 [[File:Foobar.jpg|frame|frameless|caption]]
10494 [[File:Foobar.jpg|frame|thumb|caption]]
10495 !! html/php
10496 <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>
10497 <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>
10498 <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>
10499
10500 !! end
10501
10502 !! test
10503 Image with 'thumb' first.
10504 !! wikitext
10505 [[File:Foobar.jpg|thumb|caption]]
10506 [[File:Foobar.jpg|thumb|frameless|caption]]
10507 [[File:Foobar.jpg|thumb|frame|caption]]
10508 !! html/php
10509 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10510 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10511 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10512
10513 !! end
10514
10515 ###################
10516 # Image sizing.
10517 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10518 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10519 # Foobar has actual size of 1941x220
10520 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10521 # a scalable format.
10522 # 2. Framed images always ignore size options; always render at default size.
10523 # 3. "Unspecified format" and border are the only types which can be
10524 # enlarged.
10525
10526 !! test
10527 Image: "unspecified format" and border enlarge
10528 !! options
10529 parsoid=wt2html,wt2wt,html2html
10530 !! wikitext
10531 [[File:Foobar.jpg|2000px]]
10532
10533 [[File:Foobar.jpg|border|2000px]]
10534 !! html/php
10535 <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>
10536 </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>
10537 </p>
10538 !! html/parsoid
10539 <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>
10540 <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>
10541 !! end
10542
10543 !! test
10544 Image: "unspecified format" and border reduce
10545 !! options
10546 parsoid=wt2html,wt2wt,html2html
10547 !! wikitext
10548 [[File:Foobar.jpg|1000px]]
10549
10550 [[File:Foobar.jpg|border|1000px]]
10551 !! html/php
10552 <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>
10553 </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>
10554 </p>
10555 !! html/parsoid
10556 <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>
10557 <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>
10558 !! end
10559
10560 !! test
10561 Image: thumbs reduce
10562 !! options
10563 parsoid=wt2html,wt2wt,html2html
10564 !! wikitext
10565 [[File:Foobar.jpg|thumb|50px]]
10566 !! html/php
10567 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10568
10569 !! html/parsoid
10570 <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>
10571 !! end
10572
10573 !! test
10574 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10575 !! options
10576 parsoid=wt2html,wt2wt,html2html
10577 !! wikitext
10578 [[File:Foobar.jpg|thumb|2000px]]
10579
10580 [[File:Foobar.svg|thumb|2000px]]
10581 !! html/php
10582 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10583 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10584
10585 !! html/parsoid
10586 <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>
10587 <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>
10588 !! end
10589
10590 !! test
10591 Image: frameless can reduce in size
10592 !! options
10593 parsoid=wt2html,wt2wt,html2html
10594 !! wikitext
10595 [[File:Foobar.jpg|frameless|50px]]
10596 !! html/php
10597 <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>
10598 </p>
10599 !! html/parsoid
10600 <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>
10601 !! end
10602
10603 !! test
10604 Image: bitmap frameless can't be enlarged past original size, but vector can
10605 !! options
10606 parsoid=wt2html,wt2wt,html2html
10607 !! wikitext
10608 [[File:Foobar.jpg|frameless|2000px]]
10609
10610 [[File:Foobar.svg|frameless|2000px]]
10611 !! html/php
10612 <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>
10613 </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>
10614 </p>
10615 !! html/parsoid
10616 <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>
10617 <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>
10618 !! end
10619
10620 !! test
10621 Image: framed images are always unscaled.
10622 !! options
10623 parsoid=wt2html,wt2wt,html2html
10624 !! wikitext
10625 [[File:Foobar.jpg|frame]]
10626
10627 [[File:Foobar.jpg|frame|50px]]
10628
10629 [[File:Foobar.jpg|frame|50x50px]]
10630
10631 [[File:Foobar.jpg|frame|2000px]]
10632 !! html/php
10633 <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>
10634 <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>
10635 <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>
10636 <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>
10637
10638 !! html/parsoid
10639 <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>
10640 !! end
10641
10642 ###################
10643
10644 !! test
10645 Link to image page- image page normally doesn't exists, hence edit link
10646 Add test with existing image page
10647 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10648 !! wikitext
10649 [[:Image:test]]
10650 !! html
10651 <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>
10652 </p>
10653 !! end
10654
10655 !! test
10656 bug 18784 Link to non-existent image page with caption should use caption as link text
10657 !! wikitext
10658 [[:Image:test|caption]]
10659 !! html
10660 <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>
10661 </p>
10662 !! end
10663
10664 !! test
10665 Frameless image caption with a free URL
10666 !! wikitext
10667 [[File:Foobar.jpg|http://example.com]]
10668 !! html/php
10669 <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>
10670 </p>
10671 !! html/parsoid
10672 <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>
10673 !! end
10674
10675 !! test
10676 Thumbnail image caption with a free URL
10677 !! options
10678 thumbsize=220
10679 !! wikitext
10680 [[File:Foobar.jpg|thumb|http://example.com]]
10681 !! html/php
10682 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10683
10684 !! html/parsoid
10685 <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>
10686 !! end
10687
10688 !! test
10689 Thumbnail image caption with a free URL and explicit alt
10690 !! options
10691 thumbsize=220
10692 parsoid=wt2html,wt2wt,html2html
10693 !! wikitext
10694 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10695 !! html/php
10696 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10697
10698 !! html/parsoid
10699 <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>
10700 !! end
10701
10702 !! test
10703 SVG thumbnails with no language set
10704 !! options
10705 !! wikitext
10706 [[File:Foobar.svg|thumb|caption]]
10707 !! html/php
10708 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10709
10710 !! html/parsoid
10711 <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>
10712 !! end
10713
10714 !! test
10715 SVG thumbnails with language de
10716 !! options
10717 parsoid=wt2html,wt2wt,html2html
10718 !! wikitext
10719 [[File:Foobar.svg|thumb|caption|lang=de]]
10720 !! html/php
10721 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10722
10723 !! html/parsoid
10724 <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>
10725 !! end
10726
10727 !! test
10728 SVG thumbnails with invalid language code
10729 !! options
10730 parsoid=wt2html,wt2wt,html2html
10731 !! wikitext
10732 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10733 !! html/php
10734 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
10735
10736 !! html/parsoid
10737 <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>
10738 !! end
10739
10740 !! test
10741 BUG 1887: A ISBN with a thumbnail
10742 !! wikitext
10743 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10744 !! html/php
10745 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
10746
10747 !! html/parsoid
10748 <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>
10749 !! end
10750
10751 !! test
10752 BUG 1887: A RFC with a thumbnail
10753 !! wikitext
10754 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10755 !! html/php
10756 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
10757
10758 !! html/parsoid
10759 <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>
10760 !! end
10761
10762 !! test
10763 BUG 1887: A mailto link with a thumbnail
10764 !! wikitext
10765 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10766 !! html/php
10767 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
10768
10769 !! html/parsoid
10770 <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>
10771 !! end
10772
10773 # Pending resolution to bug 368
10774 !! test
10775 BUG 648: Frameless image caption with a link
10776 !! wikitext
10777 [[File:Foobar.jpg|text with a [[link]] in it]]
10778 !! html/php
10779 <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>
10780 </p>
10781 !! html/parsoid
10782 <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>
10783 !! end
10784
10785 !! test
10786 BUG 648: Frameless image caption with a link (suffix)
10787 !! wikitext
10788 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10789 !! html/php
10790 <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>
10791 </p>
10792 !! html/parsoid
10793 <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>
10794 !! end
10795
10796 !! test
10797 BUG 648: Frameless image caption with an interwiki link
10798 !! wikitext
10799 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10800 !! html/php
10801 <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>
10802 </p>
10803 !! html/parsoid
10804 <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>
10805 !! end
10806
10807 !! test
10808 BUG 648: Frameless image caption with a piped interwiki link
10809 !! wikitext
10810 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10811 !! html/php
10812 <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>
10813 </p>
10814 !! html/parsoid
10815 <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>
10816 !! end
10817
10818 !! test
10819 Escape HTML special chars in image alt text
10820 !! wikitext
10821 [[File:Foobar.jpg|& < > "]]
10822 !! html/php
10823 <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>
10824 </p>
10825 !! html/parsoid
10826 <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>
10827 !! end
10828
10829 !! test
10830 BUG 499: Alt text should have &#1234;, not &amp;1234;
10831 !! wikitext
10832 [[File:Foobar.jpg|&#9792;]]
10833 !! html/php
10834 <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>
10835 </p>
10836 !! html/parsoid
10837 <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>
10838 !! end
10839
10840 !! test
10841 Broken image caption with link
10842 !! options
10843 parsoid=wt2html,wt2wt,html2html
10844 !! wikitext
10845 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10846 !! html/php
10847 <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.
10848 </p>
10849 !! html/parsoid
10850 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page">this</a> is just an ordinary link.</p>
10851 !! end
10852
10853 !! test
10854 Image caption containing another image
10855 !! wikitext
10856 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10857 !! html/php
10858 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
10859
10860 !! html/parsoid
10861 <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>
10862 !! end
10863
10864 !! test
10865 Image: caption containing a newline
10866 !! wikitext
10867 [[File:Foobar.jpg|This
10868 *is some text]]
10869 !! html/php
10870 <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>
10871 </p>
10872 !! html/parsoid
10873 <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>
10874 !!end
10875
10876 !!test
10877 Image: caption containing leading space
10878 (The leading space should not trigger nowiki escaping in wt2wt mode)
10879 !! wikitext
10880 [[File:Foobar.jpg|thumb| bar]]
10881 !! html/php
10882 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
10883
10884 !! html/parsoid
10885 <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>
10886 !!end
10887
10888 !! test
10889 Image: caption containing a table
10890 !! options
10891 parsoid=wt2html,wt2wt,html2html
10892 !! wikitext
10893 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10894 {|
10895 ! Foo !! Bar
10896 |-
10897 | Foo1 || Bar1
10898 |}
10899 and some more text.]]
10900 !! html/php
10901 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
10902
10903 !! html/parsoid
10904 <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
10905 <table>
10906 <tbody>
10907 <tr><th>Foo </th><th>Bar</th></tr>
10908 <tr>
10909 <td>Foo1 </td>
10910 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10911 !! end
10912
10913 !! test
10914 Bug 3090: External links other than http: in image captions
10915 !! wikitext
10916 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10917 !! html/php
10918 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
10919
10920 !! html/parsoid
10921 <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>
10922 !! end
10923
10924 !! test
10925 Custom class
10926 !! options
10927 parsoid=wt2html,wt2wt,html2html
10928 !! wikitext
10929 [[Image:foobar.jpg|a|class=b]]
10930 !! html/php
10931 <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>
10932 </p>
10933 !! html/parsoid
10934 <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>
10935 !! end
10936
10937 !! test
10938 Localized image handling (1).
10939 !! options
10940 parsoid=wt2html,wt2wt,html2html
10941 language=es
10942 !! wikitext
10943 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10944 !! html/php
10945 <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>
10946
10947 !! html/parsoid
10948 <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>
10949 !! end
10950
10951 !! test
10952 Localized image handling (2).
10953 !! options
10954 thumbsize=220
10955 parsoid=wt2html,wt2wt,html2html
10956 language=es
10957 !! wikitext
10958 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10959 !! html/php
10960 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10961
10962 !! html/parsoid
10963 <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>
10964 !! end
10965
10966 !! test
10967 "border", "frameless" and "class" attributes on an image.
10968 !! options
10969 thumbsize=220
10970 parsoid=wt2html,wt2wt,html2html
10971 !! wikitext
10972 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10973 !! html/php
10974 <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>
10975 </p>
10976 !! html/parsoid
10977 <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>
10978 !! end
10979
10980 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10981 !! test
10982 Invalid image attributes (bug 62500)
10983 !! options
10984 thumbsize=220
10985 parsoid=wt2html,wt2wt,html2html
10986 !! wikitext
10987 [[File:Foobar.jpg|thumb|float|left|caption]]
10988
10989 [[File:Foobar.jpg|thumb|righ|caption]]
10990
10991 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10992 !! html/php
10993 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10994 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10995 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10996
10997 !! html/parsoid
10998 <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>
10999 !! end
11000
11001 !! article
11002 File:Barfoo.jpg
11003 !! text
11004 #REDIRECT [[File:Barfoo.jpg]]
11005 !! endarticle
11006
11007 !! test
11008 Redirected image
11009 !! wikitext
11010 [[Image:Barfoo.jpg]]
11011 !! html
11012 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11013 </p>
11014 !! end
11015
11016 !! test
11017 Missing image with uploads disabled
11018 !! options
11019 wgEnableUploads=0
11020 !! wikitext
11021 [[Image:Foobaz.jpg]]
11022 !! html
11023 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11024 </p>
11025 !! end
11026
11027 # Parsoid-specific testing for images
11028 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11029 # Currently imperfect due to a flaw in the Parsoid testrunner
11030 # Work in progress
11031 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11032 # image tests.
11033
11034 !! test
11035 Parsoid-specific image handling - simple image with size and middle alignment
11036 !! wikitext
11037 [[File:Foobar.jpg|middle|50px]]
11038 !! html/parsoid
11039 <p><span class="mw-valign-middle" typeof="mw:Image">
11040 <a href="File:Foobar.jpg">
11041 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11042 </a>
11043 </span>
11044 </p>
11045 !! end
11046
11047 !! test
11048 Parsoid-specific image handling - simple image with size, middle alignment,
11049 non-standard namespace alias
11050 !! options
11051 parsoid=wt2wt,wt2html,html2html
11052 !! wikitext
11053 [[Image:Foobar.jpg|middle|50px]]
11054 !! html/parsoid
11055 <p><span class="mw-valign-middle" typeof="mw:Image">
11056 <a href="File:Foobar.jpg">
11057 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11058 </a>
11059 </span>
11060 </p>
11061 !! end
11062
11063 !! test
11064 Parsoid-specific image handling - simple image with size and middle alignment
11065 (existing content)
11066 !! wikitext
11067 [[File:Foobar.jpg|50px|middle]]
11068 !! html/parsoid
11069 <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>
11070 !! end
11071
11072 !! test
11073 Parsoid-specific image handling - simple image with size and middle alignment
11074 and non-standard namespace name
11075 !! options
11076 parsoid=wt2html,wt2wt,html2html
11077 !! wikitext
11078 [[Image:Foobar.jpg|50px|middle]]
11079 !! html/parsoid
11080 <p><span class="mw-valign-middle" typeof="mw:Image">
11081 <a href="File:Foobar.jpg">
11082 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11083 </a>
11084 </span>
11085 </p>
11086 !! end
11087
11088 !! test
11089 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11090 !! wikitext
11091 [[File:Foobar.jpg|500x10px|baseline|caption]]
11092 !! html/parsoid
11093 <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>
11094 !! end
11095
11096 !! test
11097 Parsoid-specific image handling - simple image with border and size spec
11098 !! wikitext
11099 [[File:Foobar.jpg|50px|border|caption]]
11100 !! html/parsoid
11101 <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>
11102 !! end
11103
11104 !! test
11105 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11106 !! wikitext
11107 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11108 !! html/parsoid
11109 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11110 <a href="File:Foobar.jpg">
11111 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11112 </a>
11113 <figcaption>caption content</figcaption>
11114 </figure>
11115 !! end
11116
11117 !! test
11118 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11119 (existing content)
11120 !! wikitext
11121 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11122 !! html/parsoid
11123 <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>
11124 !! end
11125
11126 !! test
11127 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11128 !! wikitext
11129 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11130 !! html/parsoid
11131 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11132 <a href="File:Foobar.jpg">
11133 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11134 </a>
11135 <figcaption>caption</figcaption>
11136 </figure>
11137 !! end
11138
11139 !! test
11140 Parsoid-specific image handling - thumbnail with specific size, halign,
11141 valign, and caption (existing content)
11142 !! wikitext
11143 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11144 !! html/parsoid
11145 <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>
11146 !! end
11147
11148 !! test
11149 Parsoid-specific image handling - framed image with specific size and caption
11150 (size is ignored)
11151 !! options
11152 parsoid=wt2html,wt2wt,html2html
11153 !! wikitext
11154 [[File:Foobar.jpg|frame|500x50px|caption]]
11155 !! html/parsoid
11156 <figure typeof="mw:Image/Frame">
11157 <a href="File:Foobar.jpg">
11158 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11159 </a>
11160 <figcaption>caption</figcaption>
11161 </figure>
11162 !! end
11163
11164 !! test
11165 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11166 (size is ignored)
11167 !! options
11168 parsoid=wt2html,wt2wt,html2html
11169 !! wikitext
11170 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11171 !! html/parsoid
11172 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11173 <a href="File:Foobar.jpg">
11174 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11175 </a>
11176 <figcaption>caption</figcaption>
11177 </figure>
11178 !! end
11179
11180 !! test
11181 Parsoid-specific image handling - frameless image with specific size, border, and caption
11182 !! wikitext
11183 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11184 !! html/parsoid
11185 <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>
11186 !! end
11187
11188 !! test
11189 Parsoid-specific image handling - simple image with a formatted caption
11190 !! wikitext
11191 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11192 !! html/parsoid
11193 <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>"}'>
11194 <a href="File:Foobar.jpg">
11195 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11196 </a></span></p>
11197 !! end
11198
11199 !! test
11200 Parsoid-specific image handling - caption with a template in it
11201 !! wikitext
11202 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11203 !! html/parsoid
11204 <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>
11205 !! end
11206
11207 !! test
11208 Parsoid-specific image handling - caption with unbalanced tags in it
11209 !! options
11210 parsoid=wt2html,wt2wt,html2html
11211 !! wikitext
11212 foo
11213 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11214 bar
11215 !! html/parsoid
11216 <p>foo</p>
11217 <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>
11218 <p>bar</p>
11219 !! end
11220
11221 !! test
11222 Parsoid-specific image handling - empty caption (1)
11223 !! options
11224 parsoid=wt2html,wt2wt
11225 !! wikitext
11226 [[File:Foobar.jpg|thumb|]]
11227 !! html/parsoid
11228 <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>
11229 !! end
11230
11231 # empty captions don't get serialized unless we're in the "round trip" case
11232 !! test
11233 Parsoid-specific image handling - empty caption (2)
11234 !! options
11235 parsoid=html2wt
11236 !! html/parsoid
11237 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11238 <a href="File:Foobar.jpg">
11239 <img resource="./File:Foobar.jpg"
11240 src="//example.com/images/3/3a/Foobar.jpg"
11241 height="25" width="220"/>
11242 </a>
11243 <figcaption></figcaption>
11244 </figure>
11245 !! wikitext
11246 [[File:Foobar.jpg|thumb]]
11247 !! end
11248
11249 !! test
11250 Parsoid-specific image handling - whitespace caption
11251 !! wikitext
11252 [[File:Foobar.jpg|thumb| ]]
11253 !! html/parsoid
11254 <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>
11255 !! end
11256
11257 !! test
11258 Parsoid-specific image handling - lang option
11259 !! wikitext
11260 foo
11261 [[File:Foobar.svg|lang=de|caption]]
11262 bar
11263 !! html/parsoid
11264 <p>foo
11265 <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>
11266 bar</p>
11267 !! end
11268
11269
11270 ###
11271 ### Subpages
11272 ###
11273 !! article
11274 Subpage test/subpage
11275 !! text
11276 foo
11277 !! endarticle
11278
11279 !! test
11280 Subpage link
11281 !! options
11282 subpage title=[[Subpage test]]
11283 !! wikitext
11284 [[/subpage]]
11285 !! html
11286 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11287 </p>
11288 !! end
11289
11290 !! test
11291 Subpage noslash link
11292 !! options
11293 subpage title=[[Subpage test]]
11294 !! wikitext
11295 [[/subpage/]]
11296 !! html
11297 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11298 </p>
11299 !! end
11300
11301 # TODO: make this PHP-parser compatible!
11302 !! test
11303 Relative subpage noslash link
11304 !! options
11305 parsoid=wt2wt,wt2html,html2html
11306 subpage title=[[Subpage test/1/2/3/4]]
11307 !! wikitext
11308 [[../../subpage/]]
11309
11310 [[../../subpage]]
11311 !! html
11312 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11313 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11314 !! end
11315
11316 !! test
11317 Parsoid: dot-slash prefixed wikilinks
11318 !! wikitext
11319 [[./foo]]
11320
11321 [[././bar]]
11322
11323 [[././baz/]]
11324 !! html/php
11325 <p>[[./foo]]
11326 </p><p>[[././bar]]
11327 </p><p>[[././baz/]]
11328 </p>
11329 !! html/parsoid
11330 <p>[[./foo]]
11331 </p><p>[[././bar]]
11332 </p><p>[[././baz/]]
11333 </p>
11334 !! end
11335
11336 !! test
11337 Render invalid page names as plain text (bug 51090)
11338 !! wikitext
11339 [[./../foo|bar]]
11340 [[foo�|bar]]
11341 [[foo/.|bar]]
11342 [[foo/..|bar]]
11343 [[foo~~~bar]]
11344 [[foo>bar]]
11345 [[foo[bar]]
11346 [[.]]
11347 [[..]]
11348 [[foo././bar]]
11349
11350 [[{{echo|./../foo}}|bar]]
11351 [[{{echo|foo/.}}|bar]]
11352 [[{{echo|foo/..}}|bar]]
11353 [[{{echo|foo~~~~bar}}]]
11354 [[{{echo|foo>bar}}]]
11355 [[{{echo|foo././bar}}]]
11356 [[{{echo|foo{bar}}]]
11357 [[{{echo|foo}bar}}]]
11358 [[{{echo|foo[bar}}]]
11359 [[{{echo|foo]bar}}]]
11360 [[{{echo|foo<bar}}]]
11361 !!html/php
11362 <p>[[./../foo|bar]]
11363 [[foo�|bar]]
11364 [[foo/.|bar]]
11365 [[foo/..|bar]]
11366 [[foo~~~bar]]
11367 [[foo&gt;bar]]
11368 [[foo[bar]]
11369 [[.]]
11370 [[..]]
11371 [[foo././bar]]
11372 </p><p>[[./../foo|bar]]
11373 [[foo/.|bar]]
11374 [[foo/..|bar]]
11375 [[foo~~~~bar]]
11376 [[foo&gt;bar]]
11377 [[foo././bar]]
11378 [[foo{bar]]
11379 [[foo}bar]]
11380 [[foo[bar]]
11381 [[foo]bar]]
11382 [[foo&lt;bar]]
11383 </p>
11384 !!html/parsoid
11385 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11386 <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>
11387 !!end
11388
11389 !! test
11390 Disabled subpages
11391 !! wikitext
11392 [[/subpage]]
11393 !! html
11394 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11395 </p>
11396 !! end
11397
11398 !! test
11399 BUG 561: {{/Subpage}}
11400 !! options
11401 subpage title=[[Page]]
11402 !! wikitext
11403 {{/Subpage}}
11404 !! html
11405 <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>
11406 </p>
11407 !! end
11408
11409 ###
11410 ### Categories
11411 ###
11412 !! article
11413 Category:MediaWiki User's Guide
11414 !! text
11415 blah
11416 !! endarticle
11417
11418 !! test
11419 Link to category
11420 !! wikitext
11421 [[:Category:MediaWiki User's Guide]]
11422 !! html
11423 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11424 </p>
11425 !! end
11426
11427 !! test
11428 Simple category
11429 !! options
11430 cat
11431 !! wikitext
11432 [[Category:MediaWiki User's Guide]]
11433 !! html
11434 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11435 !! end
11436
11437 !! test
11438 PAGESINCATEGORY invalid title fatal (r33546 fix)
11439 !! wikitext
11440 {{PAGESINCATEGORY:<bogus>}}
11441 !! html
11442 <p>0
11443 </p>
11444 !! end
11445
11446 !! test
11447 Category with different sort key
11448 !! options
11449 cat
11450 !! wikitext
11451 [[Category:MediaWiki User's Guide|Foo]]
11452 !! html
11453 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11454 !! end
11455
11456 !! test
11457 Category with identical sort key
11458 !! options
11459 cat
11460 !! wikitext
11461 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11462 !! html
11463 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11464 !! end
11465
11466 !! test
11467 Category with empty sort key
11468 !! options
11469 cat
11470 pst
11471 !! wikitext
11472 [[Category:MediaWiki User's Guide|]]
11473 !! html
11474 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11475 !! end
11476
11477 !! test
11478 Category with empty sort key and parentheses
11479 !! options
11480 cat
11481 pst
11482 !! wikitext
11483 [[Category:Foo (bar)|]]
11484 !! html
11485 [[Category:Foo (bar)|Foo]]
11486 !! end
11487
11488 !! test
11489 Category with link tail
11490 !! options
11491 cat
11492 pst
11493 !! wikitext
11494 123[[Category:Foo]]456
11495 !! html
11496 123[[Category:Foo]]456
11497 !! end
11498
11499 !! test
11500 Category with template
11501 !! options
11502 cat
11503 pst
11504 !! wikitext
11505 [[Category:{{echo|Foo}}]]
11506 !! html
11507 [[Category:{{echo|Foo}}]]
11508 !! end
11509
11510 !! test
11511 Category with template in sort key
11512 !! options
11513 cat
11514 pst
11515 !! wikitext
11516 [[Category:Foo|{{echo|Bar}}]]
11517 !! html
11518 [[Category:Foo|{{echo|Bar}}]]
11519 !! end
11520
11521 !! test
11522 Category with template in sort key and title
11523 !! options
11524 cat
11525 pst
11526 !! wikitext
11527 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11528 !! html
11529 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11530 !! end
11531
11532 !! test
11533 Category / paragraph interactions
11534 !! wikitext
11535 Foo [[Category:Baz]] Bar
11536
11537 Foo [[Category:Baz]]
11538 Bar
11539
11540 Foo
11541 [[Category:Baz]]
11542 Bar
11543
11544 Foo
11545 [[Category:Baz]] Bar
11546
11547 Foo
11548 [[Category:Baz]]
11549 [[Category:Baz]]
11550 [[Category:Baz]]
11551 Bar
11552
11553 [[Category:Baz]]
11554 [[Category:Baz]]
11555 [[Category:Baz]]
11556
11557 [[Category:Baz]]
11558 {{echo|[[Category:Baz]]}}
11559 [[Category:Baz]]
11560 !! html
11561 <p>Foo Bar
11562 </p><p>Foo
11563 Bar
11564 </p><p>Foo
11565 Bar
11566 </p><p>Foo Bar
11567 </p><p>Foo
11568 Bar
11569 </p>
11570 !! end
11571
11572 !! test
11573 Parsoid: Serialize link to category page with colon escape
11574 !! options
11575 parsoid
11576 !! wikitext
11577
11578 [[:Category:Foo]]
11579 [[:Category:Foo|Bar]]
11580 !! html
11581 <p>
11582 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11583 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11584 </p>
11585 !! end
11586
11587 !! test
11588 Parsoid: Link prefix/suffixes aren't applied to category links
11589 !! options
11590 parsoid=wt2html,wt2wt,html2html
11591 language=is
11592 !! wikitext
11593 x[[Category:Foo]]y
11594 !! html
11595 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11596 !! end
11597
11598 !! test
11599 Parsoid: Serialize link to file page with colon escape
11600 !! options
11601 parsoid
11602 !! wikitext
11603
11604 [[:File:Foo.png]]
11605 [[:File:Foo.png|Bar]]
11606 !! html
11607 <p>
11608 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11609 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11610 </p>
11611 !! end
11612
11613 !! test
11614 Parsoid: Serialize a genuine category link without colon escape
11615 !! options
11616 parsoid
11617 !! wikitext
11618 [[Category:Foo]]
11619 [[Category:Foo|Bar]]
11620 !! html
11621 <link rel="mw:PageProp/Category" href="Category:Foo">
11622 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11623 !! end
11624
11625 !! test
11626 Parsoid: Defaultsort
11627 !! options
11628 parsoid
11629 !! wikitext
11630 {{DEFAULTSORT:Foo}}
11631 !! html
11632 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11633 !! end
11634
11635 ###
11636 ### Inter-language links
11637 ###
11638 !! test
11639 Inter-language links
11640 !! options
11641 ill
11642 !! wikitext
11643 [[es:Alimento]]
11644 [[fr:Nourriture]]
11645 [[zh:&#39135;&#21697;]]
11646 !! html
11647 es:Alimento fr:Nourriture zh:食品
11648 !! end
11649
11650 !! test
11651 Duplicate interlanguage links (bug 24502)
11652 !! options
11653 ill
11654 !! wikitext
11655 [[es:1]]
11656 [[es:2]]
11657 [[fr:1]]
11658 [[fr:2]]
11659 !! html
11660 es:1 fr:1
11661 !! end
11662
11663 ###
11664 ### Sections
11665 ###
11666 !! test
11667 Basic section headings
11668 !! wikitext
11669 == Headline 1 ==
11670 Some text
11671
11672 ==Headline 2==
11673 More
11674 ===Smaller headline===
11675 Blah blah
11676 !! html
11677 <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>
11678 <p>Some text
11679 </p>
11680 <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>
11681 <p>More
11682 </p>
11683 <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>
11684 <p>Blah blah
11685 </p>
11686 !! end
11687
11688 !! test
11689 Section headings with TOC
11690 !! wikitext
11691 == Headline 1 ==
11692 === Subheadline 1 ===
11693 ===== Skipping a level =====
11694 ====== Skipping a level ======
11695
11696 == Headline 2 ==
11697 Some text
11698 ===Another headline===
11699 !! html
11700 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11701 <ul>
11702 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11703 <ul>
11704 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11705 <ul>
11706 <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>
11707 <ul>
11708 <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>
11709 </ul>
11710 </li>
11711 </ul>
11712 </li>
11713 </ul>
11714 </li>
11715 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11716 <ul>
11717 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11718 </ul>
11719 </li>
11720 </ul>
11721 </div>
11722
11723 <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>
11724 <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>
11725 <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>
11726 <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>
11727 <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>
11728 <p>Some text
11729 </p>
11730 <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>
11731
11732 !! end
11733
11734 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11735 !! test
11736 Handling of sections up to level 6 and beyond
11737 !! wikitext
11738 = Level 1 Heading=
11739 == Level 2 Heading==
11740 === Level 3 Heading===
11741 ==== Level 4 Heading====
11742 ===== Level 5 Heading=====
11743 ====== Level 6 Heading======
11744 ======= Level 7 Heading=======
11745 ======== Level 8 Heading========
11746 ========= Level 9 Heading=========
11747 ========== Level 10 Heading==========
11748 !! html
11749 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11750 <ul>
11751 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11752 <ul>
11753 <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>
11754 <ul>
11755 <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>
11756 <ul>
11757 <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>
11758 <ul>
11759 <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>
11760 <ul>
11761 <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>
11762 <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>
11763 <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>
11764 <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>
11765 <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>
11766 </ul>
11767 </li>
11768 </ul>
11769 </li>
11770 </ul>
11771 </li>
11772 </ul>
11773 </li>
11774 </ul>
11775 </li>
11776 </ul>
11777 </div>
11778
11779 <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>
11780 <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>
11781 <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>
11782 <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>
11783 <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>
11784 <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>
11785 <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>
11786 <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>
11787 <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>
11788 <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>
11789
11790 !! end
11791
11792 !! test
11793 TOC regression (bug 9764)
11794 !! wikitext
11795 == title 1 ==
11796 === title 1.1 ===
11797 ==== title 1.1.1 ====
11798 === title 1.2 ===
11799 == title 2 ==
11800 === title 2.1 ===
11801 !! html
11802 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11803 <ul>
11804 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11805 <ul>
11806 <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>
11807 <ul>
11808 <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>
11809 </ul>
11810 </li>
11811 <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>
11812 </ul>
11813 </li>
11814 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11815 <ul>
11816 <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>
11817 </ul>
11818 </li>
11819 </ul>
11820 </div>
11821
11822 <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>
11823 <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>
11824 <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>
11825 <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>
11826 <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>
11827 <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>
11828
11829 !! end
11830
11831 !! test
11832 TOC with wgMaxTocLevel=3 (bug 6204)
11833 !! options
11834 wgMaxTocLevel=3
11835 !! wikitext
11836 == title 1 ==
11837 === title 1.1 ===
11838 ==== title 1.1.1 ====
11839 === title 1.2 ===
11840 == title 2 ==
11841 === title 2.1 ===
11842 !! html
11843 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11844 <ul>
11845 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11846 <ul>
11847 <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>
11848 <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>
11849 </ul>
11850 </li>
11851 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11852 <ul>
11853 <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>
11854 </ul>
11855 </li>
11856 </ul>
11857 </div>
11858
11859 <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>
11860 <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>
11861 <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>
11862 <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>
11863 <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>
11864 <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>
11865
11866 !! end
11867
11868 !! test
11869 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11870 !! options
11871 wgMaxTocLevel=3
11872 !! wikitext
11873 ==Section 1==
11874 ===Section 1.1===
11875 ====Section 1.1.1====
11876 ====Section 1.1.1.1====
11877 ==Section 2==
11878 !! html
11879 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11880 <ul>
11881 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11882 <ul>
11883 <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>
11884 </ul>
11885 </li>
11886 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11887 </ul>
11888 </div>
11889
11890 <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>
11891 <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>
11892 <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>
11893 <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>
11894 <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>
11895
11896 !! end
11897
11898
11899 !! test
11900 Resolving duplicate section names
11901 !! wikitext
11902 == Foo bar ==
11903 == Foo bar ==
11904 !! html
11905 <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>
11906 <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>
11907
11908 !! end
11909
11910 !! test
11911 Resolving duplicate section names with differing case (bug 10721)
11912 !! wikitext
11913 == Foo bar ==
11914 == Foo Bar ==
11915 !! html
11916 <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>
11917 <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>
11918
11919 !! end
11920
11921 !! article
11922 Template:sections
11923 !! text
11924 ===Section 1===
11925 ==Section 2==
11926 !! endarticle
11927
11928 !! test
11929 Template with sections, __NOTOC__
11930 !! wikitext
11931 __NOTOC__
11932 ==Section 0==
11933 {{sections}}
11934 ==Section 4==
11935 !! html
11936 <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>
11937 <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>
11938 <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>
11939 <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>
11940
11941 !! end
11942
11943 !! test
11944 __NOEDITSECTION__ keyword
11945 !! wikitext
11946 __NOEDITSECTION__
11947 ==Section 1==
11948 ==Section 2==
11949 !! html
11950 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11951 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11952
11953 !! end
11954
11955 !! test
11956 Link inside a section heading
11957 !! wikitext
11958 ==Section with a [[Main Page|link]] in it==
11959 !! html
11960 <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>
11961
11962 !! end
11963
11964 !! test
11965 TOC regression (bug 12077)
11966 !! wikitext
11967 __TOC__
11968 == title 1 ==
11969 === title 1.1 ===
11970 == title 2 ==
11971 !! html
11972 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11973 <ul>
11974 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11975 <ul>
11976 <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>
11977 </ul>
11978 </li>
11979 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11980 </ul>
11981 </div>
11982
11983 <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>
11984 <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>
11985 <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>
11986
11987 !! end
11988
11989 !! test
11990 BUG 1219 URL next to image (good)
11991 !! wikitext
11992 http://example.com [[Image:foobar.jpg]]
11993 !! html
11994 <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>
11995 </p>
11996 !!end
11997
11998 !! test
11999 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12000 !! wikitext
12001 ===
12002 The line above must have a trailing space!
12003 === <!--
12004 --> <!-- -->
12005 But just in case it doesn't...
12006 !! html
12007 <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>
12008 <p>The line above must have a trailing space!
12009 </p>
12010 <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>
12011 <p>But just in case it doesn't...
12012 </p>
12013 !! end
12014
12015 !! test
12016 Header with special characters (bug 25462)
12017 !! wikitext
12018 The tooltips shall not show entities to the user (ie. be double escaped)
12019
12020 == text > text ==
12021 section 1
12022
12023 == text < text ==
12024 section 2
12025
12026 == text & text ==
12027 section 3
12028
12029 == text ' text ==
12030 section 4
12031
12032 == text " text ==
12033 section 5
12034 !! html
12035 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12036 </p>
12037 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12038 <ul>
12039 <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>
12040 <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>
12041 <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>
12042 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12043 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12044 </ul>
12045 </div>
12046
12047 <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>
12048 <p>section 1
12049 </p>
12050 <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>
12051 <p>section 2
12052 </p>
12053 <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>
12054 <p>section 3
12055 </p>
12056 <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>
12057 <p>section 4
12058 </p>
12059 <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>
12060 <p>section 5
12061 </p>
12062 !! end
12063
12064 !! test
12065 Headers with excess '=' characters
12066 (Are similar tests necessary beyond the 1st level?)
12067 !! wikitext
12068 =foo==
12069 ==foo=
12070 =''italic'' heading==
12071 ==''italic'' heading=
12072 !! html
12073 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12074 <ul>
12075 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12076 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12077 <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>
12078 <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>
12079 </ul>
12080 </div>
12081
12082 <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>
12083 <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>
12084 <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>
12085 <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>
12086
12087 !! end
12088
12089 !! test
12090 HTML headers vs TOC (bug 23393)
12091 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12092 !! wikitext
12093 <h1>Header 1</h1>
12094 == Header 1.1 ==
12095 == Header 1.2 ==
12096
12097 <h1>Header 2
12098 </h1>
12099 == Header 2.1 ==
12100 == Header 2.2 ==
12101 __NOEDITSECTION__
12102 !! html
12103 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12104 <ul>
12105 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12106 <ul>
12107 <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>
12108 <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>
12109 </ul>
12110 </li>
12111 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12112 <ul>
12113 <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>
12114 <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>
12115 </ul>
12116 </li>
12117 </ul>
12118 </div>
12119
12120 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12121 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12122 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12123 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12124 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12125 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12126
12127 !! end
12128
12129 !! test
12130 Single-line or multiline-comments can follow headings
12131 !! options
12132 parsoid=wt2html,wt2wt
12133 !! wikitext
12134 ==foo==<!---->
12135 ==bar==<!--c1-->
12136 ==baz==<!--
12137 c2
12138 c3-->
12139 !! html
12140 <h2><span class="mw-headline" id="foo">foo</span></h2>
12141 <h2><span class="mw-headline" id="bar">bar</span></h2>
12142 <h2><span class="mw-headline" id="baz">baz</span></h2>
12143
12144 !! end
12145
12146 !! test
12147 BUG 1219 URL next to image (broken)
12148 !! wikitext
12149 http://example.com[[Image:foobar.jpg]]
12150 !! html
12151 <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>
12152 </p>
12153 !!end
12154
12155 !! test
12156 Bug 1186 news: in the middle of text
12157 !! wikitext
12158 http://en.wikinews.org/wiki/Wikinews:Workplace
12159 !! html
12160 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12161 </p>
12162 !!end
12163
12164
12165 !! test
12166 Namespaced link must have a title
12167 !! wikitext
12168 [[Project:]]
12169 !! html
12170 <p>[[Project:]]
12171 </p>
12172 !!end
12173
12174 !! test
12175 Namespaced link must have a title (bad fragment version)
12176 !! wikitext
12177 [[Project:#fragment]]
12178 !! html
12179 <p>[[Project:#fragment]]
12180 </p>
12181 !!end
12182
12183
12184 ###
12185 ### HTML tags and HTML attributes
12186 ###
12187
12188 !! test
12189 div with no attributes
12190 !! wikitext
12191 <div>HTML rocks</div>
12192 !! html
12193 <div>HTML rocks</div>
12194
12195 !! end
12196
12197 !! test
12198 div with double-quoted attribute
12199 !! wikitext
12200 <div id="rock">HTML rocks</div>
12201 !! html
12202 <div id="rock">HTML rocks</div>
12203
12204 !! end
12205
12206 !! test
12207 div with single-quoted attribute
12208 !! wikitext
12209 <div id='rock'>HTML rocks</div>
12210 !! html
12211 <div id="rock">HTML rocks</div>
12212
12213 !! end
12214
12215 !! test
12216 div with unquoted attribute
12217 !! wikitext
12218 <div id=rock>HTML rocks</div>
12219 !! html
12220 <div id="rock">HTML rocks</div>
12221
12222 !! end
12223
12224 !! test
12225 div with illegal double attributes
12226 !! wikitext
12227 <div id="a" id="b">HTML rocks</div>
12228 !! html
12229 <div id="b">HTML rocks</div>
12230
12231 !!end
12232
12233 # FIXME: produce empty string instead of "class" in the PHP parser, following
12234 # the HTML5 spec.
12235 !! test
12236 div with empty attribute value, space before equals
12237 !! options
12238 parsoid
12239 !! wikitext
12240 <div class =>HTML rocks</div>
12241 !! html
12242 <div class="">HTML rocks</div>
12243
12244 !! end
12245
12246 # The PHP parser escapes the opening brace to &#123; for some reason, so
12247 # disabled this test for it.
12248 !! test
12249 div with braces in attribute value
12250 !! options
12251 parsoid
12252 !! wikitext
12253 <div title="{}">Foo</div>
12254 !! html
12255 <div title="{}">Foo</div>
12256 !! end
12257
12258 # This it very inconsistent in the PHP parser: it returns
12259 # class="class" if there is a space between the name and the equal sign (see
12260 # 'div with empty attribute value, space before equals'), but strips the
12261 # attribute completely if the space is missing. We hope that not much content
12262 # depends on this, so are implementing the behavior below in Parsoid for
12263 # consistencies' sake. Disabled for the PHP parser.
12264 # FIXME: fix this behavior in the PHP parser?
12265 !! test
12266 div with empty attribute value, no space before equals
12267 !! options
12268 parsoid
12269 !! wikitext
12270 <div class=>HTML rocks</div>
12271 !! html
12272 <div class="">HTML rocks</div>
12273
12274 !! end
12275
12276 !! test
12277 HTML multiple attributes correction
12278 !! wikitext
12279 <p class="error" class="awesome">Awesome!</p>
12280 !! html
12281 <p class="awesome">Awesome!</p>
12282
12283 !!end
12284
12285 !! test
12286 Table multiple attributes correction
12287 !! wikitext
12288 {|
12289 !+ class="error" class="awesome"| status
12290 |}
12291 !! html
12292 <table>
12293 <tr>
12294 <th class="awesome"> status
12295 </th></tr></table>
12296
12297 !!end
12298
12299 !! test
12300 DIV IN UPPERCASE
12301 !! wikitext
12302 <DIV ID="x">HTML ROCKS</DIV>
12303 !! html
12304 <div id="x">HTML ROCKS</div>
12305
12306 !!end
12307
12308 !! test
12309 Non-ASCII pseudo-tags are rendered as text
12310 !! wikitext
12311 <khyô>
12312 !! html
12313 <p>&lt;khyô&gt;
12314 </p>
12315 !! end
12316
12317 !! test
12318 Pseudo-tag with URL 'name' renders as url link
12319 !! wikitext
12320 <http://example.com/>
12321 !! html
12322 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12323 </p>
12324 !! end
12325
12326 !! test
12327 text with amp in the middle of nowhere
12328 !! wikitext
12329 Remember AT&T?
12330 !! html
12331 <p>Remember AT&amp;T?
12332 </p>
12333 !! end
12334
12335 !! test
12336 text with character entity: eacute
12337 !! wikitext
12338 I always thought &eacute; was a cute letter.
12339 !! html
12340 <p>I always thought &#233; was a cute letter.
12341 </p>
12342 !! end
12343
12344 !! test
12345 text with entity-escaped character entity-like string: eacute
12346 !! wikitext
12347 I always thought &amp;eacute; was a cute letter.
12348 !! html
12349 <p>I always thought &amp;eacute; was a cute letter.
12350 </p>
12351 !! end
12352
12353 !! test
12354 text with undefined character entity: xacute
12355 !! wikitext
12356 I always thought &xacute; was a cute letter.
12357 !! html
12358 <p>I always thought &amp;xacute; was a cute letter.
12359 </p>
12360 !! end
12361
12362 # TODO: generalize to PHP parser?
12363 !! test
12364 HTML5 tags
12365 !! options
12366 parsoid
12367 !! wikitext
12368 <data value="5">five</data>
12369 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12370 <mark>This highlighted text</mark>
12371 !! html
12372 <p><data value="5">five</data>
12373 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12374 <mark>This highlighted text</mark></p>
12375 !! end
12376
12377 !! test
12378 HTML tag with leading space is parsed as text
12379 !! wikitext
12380 < div>foo< /div>
12381 !! html
12382 <p>&lt; div&gt;foo&lt; /div&gt;
12383 </p>
12384 !! end
12385
12386 ###
12387 ### Nesting tests (see bug 41545, 50604, 51081)
12388 ###
12389
12390 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12391 # Note that html2wt is considerably more difficult if we use <b> in
12392 # the test case, instead of <big>
12393 !! test
12394 Ensure that HTML adoption agency algorithm is properly implemented.
12395 !! wikitext
12396 <big>X<big>Y</big>Z</big>
12397 !! html
12398 <p><big>X<big>Y</big>Z</big>
12399 </p>
12400 !! end
12401
12402 # This was bug 41545 in the PHP parser.
12403 !! test
12404 Nesting of <kbd>
12405 !! wikitext
12406 <kbd>X<kbd>Y</kbd>Z</kbd>
12407 !! html
12408 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12409 </p>
12410 !! end
12411
12412 # The following cases were bug 51081 in the PHP parser.
12413 # Note that there are some other nestable tags (b, i, etc) which are
12414 # not covered; see bug 51081 for discussion.
12415 !! test
12416 Nesting of <em>
12417 !! wikitext
12418 <em>X<em>Y</em>Z</em>
12419 !! html
12420 <p><em>X<em>Y</em>Z</em>
12421 </p>
12422 !! end
12423
12424 !! test
12425 Nesting of <strong>
12426 !! wikitext
12427 <strong>X<strong>Y</strong>Z</strong>
12428 !! html
12429 <p><strong>X<strong>Y</strong>Z</strong>
12430 </p>
12431 !! end
12432
12433 !! test
12434 Nesting of <q>
12435 !! wikitext
12436 <q>X<q>Y</q>Z</q>
12437 !! html
12438 <p><q>X<q>Y</q>Z</q>
12439 </p>
12440 !! end
12441
12442 !! test
12443 Nesting of <ruby>
12444 !! wikitext
12445 <ruby>X<ruby>Y</ruby>Z</ruby>
12446 !! html
12447 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12448 </p>
12449 !! end
12450
12451 !! test
12452 Nesting of <bdo>
12453 !! wikitext
12454 <bdo>X<bdo>Y</bdo>Z</bdo>
12455 !! html
12456 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12457 </p>
12458 !! end
12459
12460
12461 ###
12462 ### Media links
12463 ###
12464
12465 !! test
12466 Media link
12467 !! wikitext
12468 [[Media:Foobar.jpg]]
12469 !! html
12470 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12471 </p>
12472 !! end
12473
12474 !! test
12475 Media link with text
12476 !! wikitext
12477 [[Media:Foobar.jpg|A neat file to look at]]
12478 !! html
12479 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12480 </p>
12481 !! end
12482
12483 # FIXME: this is still bad HTML tag nesting
12484 !! test
12485 Media link with nasty text
12486 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12487 !! wikitext
12488 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12489 !! html
12490 <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>
12491
12492 !! end
12493
12494 !! test
12495 Media link to nonexistent file (bug 1702)
12496 !! wikitext
12497 [[Media:No such.jpg]]
12498 !! html
12499 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12500 </p>
12501 !! end
12502
12503 !! test
12504 Image link to nonexistent file (bug 1850 - good)
12505 !! wikitext
12506 [[Image:No such.jpg]]
12507 !! html
12508 <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>
12509 </p>
12510 !! end
12511
12512 !! test
12513 :Image link to nonexistent file (bug 1850 - bad)
12514 !! wikitext
12515 [[:Image:No such.jpg]]
12516 !! html
12517 <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>
12518 </p>
12519 !! end
12520
12521
12522
12523 !! test
12524 Character reference normalization in link text (bug 1938)
12525 !! wikitext
12526 [[Main Page|this&that]]
12527 !! html
12528 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12529 </p>
12530 !!end
12531
12532 !! article
12533 אַ
12534 !! text
12535 Test for unicode normalization
12536
12537 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12538 !! endarticle
12539
12540 !! test
12541 (bug 19451) Links should refer to the normalized form.
12542 !! wikitext
12543 [[&#xFB2E;]]
12544 [[&#x5d0;&#x5b7;]]
12545 [[&#x5d0;ַ]]
12546 [[א&#x5b7;]]
12547 [[אַ]]
12548 !! html
12549 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12550 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12551 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12552 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12553 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12554 </p>
12555 !! end
12556
12557 !! test
12558 Empty attribute crash test (bug 2067)
12559 !! wikitext
12560 <font color="">foo</font>
12561 !! html
12562 <p><font color="">foo</font>
12563 </p>
12564 !! end
12565
12566 !! test
12567 Empty attribute crash test single-quotes (bug 2067)
12568 !! wikitext
12569 <font color=''>foo</font>
12570 !! html
12571 <p><font color="">foo</font>
12572 </p>
12573 !! end
12574
12575 !! test
12576 Attribute test: equals, then nothing
12577 !! wikitext
12578 <font color=>foo</font>
12579 !! html
12580 <p><font>foo</font>
12581 </p>
12582 !! end
12583
12584 !! test
12585 Attribute test: unquoted value
12586 !! wikitext
12587 <font color=x>foo</font>
12588 !! html
12589 <p><font color="x">foo</font>
12590 </p>
12591 !! end
12592
12593 !! test
12594 Attribute test: unquoted but illegal value (hash)
12595 !! wikitext
12596 <font color=#x>foo</font>
12597 !! html
12598 <p><font color="#x">foo</font>
12599 </p>
12600 !! end
12601
12602 !! test
12603 Attribute test: no value
12604 !! wikitext
12605 <font color>foo</font>
12606 !! html
12607 <p><font color="color">foo</font>
12608 </p>
12609 !! end
12610
12611 !! test
12612 Bug 2095: link with three closing brackets
12613 !! wikitext
12614 [[Main Page]]]
12615 !! html
12616 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12617 </p>
12618 !! end
12619
12620 !! test
12621 Bug 2095: link with pipe and three closing brackets
12622 !! wikitext
12623 [[Main Page|link]]]
12624 !! html
12625 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12626 </p>
12627 !! end
12628
12629 !! test
12630 Bug 2095: link with pipe and three closing brackets, version 2
12631 !! wikitext
12632 [[Main Page|[http://example.com/]]]
12633 !! html
12634 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12635 </p>
12636 !! end
12637
12638
12639 ###
12640 ### Safety
12641 ###
12642
12643 !! article
12644 Template:Dangerous attribute
12645 !! text
12646 " onmouseover="alert(document.cookie)
12647 !! endarticle
12648
12649 !! article
12650 Template:Dangerous style attribute
12651 !! text
12652 border-size: expression(alert(document.cookie))
12653 !! endarticle
12654
12655 !! article
12656 Template:Div style
12657 !! text
12658 <div style="float: right; {{{1}}}">Magic div</div>
12659 !! endarticle
12660
12661 !! test
12662 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12663 !! wikitext
12664 <div title="{{test}}"></div>
12665 !! html
12666 <div title="This is a test template"></div>
12667
12668 !! end
12669
12670 !! test
12671 Bug 2304: HTML attribute safety (dangerous template; 2309)
12672 !! wikitext
12673 <div title="{{dangerous attribute}}"></div>
12674 !! html
12675 <div title=""></div>
12676
12677 !! end
12678
12679 !! test
12680 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12681 !! wikitext
12682 <div style="{{dangerous style attribute}}"></div>
12683 !! html
12684 <div style="/* insecure input */"></div>
12685
12686 !! end
12687
12688 !! test
12689 Bug 2304: HTML attribute safety (safe parameter; 2309)
12690 !! wikitext
12691 {{div style|width: 200px}}
12692 !! html
12693 <div style="float: right; width: 200px">Magic div</div>
12694
12695 !! end
12696
12697 !! test
12698 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12699 !! wikitext
12700 {{div style|width: expression(alert(document.cookie))}}
12701 !! html
12702 <div style="/* insecure input */">Magic div</div>
12703
12704 !! end
12705
12706 !! test
12707 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12708 !! wikitext
12709 {{div style|"><script>alert(document.cookie)</script>}}
12710 !! html
12711 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12712
12713 !! end
12714
12715 !! test
12716 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12717 !! wikitext
12718 {{div style|" ><script>alert(document.cookie)</script>}}
12719 !! html
12720 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12721
12722 !! end
12723
12724 !! test
12725 Bug 2304: HTML attribute safety (link)
12726 !! wikitext
12727 <div title="[[Main Page]]"></div>
12728 !! html
12729 <div title="&#91;&#91;Main Page]]"></div>
12730
12731 !! end
12732
12733 !! test
12734 Bug 2304: HTML attribute safety (italics)
12735 !! wikitext
12736 <div title="''foobar''"></div>
12737 !! html
12738 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12739
12740 !! end
12741
12742 !! test
12743 Bug 2304: HTML attribute safety (bold)
12744 !! wikitext
12745 <div title="'''foobar'''"></div>
12746 !! html
12747 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12748
12749 !! end
12750
12751
12752 !! test
12753 Bug 2304: HTML attribute safety (ISBN)
12754 !! wikitext
12755 <div title="ISBN 1234567890"></div>
12756 !! html
12757 <div title="&#73;SBN 1234567890"></div>
12758
12759 !! end
12760
12761 !! test
12762 Bug 2304: HTML attribute safety (RFC)
12763 !! wikitext
12764 <div title="RFC 1234"></div>
12765 !! html
12766 <div title="&#82;FC 1234"></div>
12767
12768 !! end
12769
12770 !! test
12771 Bug 2304: HTML attribute safety (PMID)
12772 !! wikitext
12773 <div title="PMID 1234567890"></div>
12774 !! html
12775 <div title="&#80;MID 1234567890"></div>
12776
12777 !! end
12778
12779 !! test
12780 Bug 2304: HTML attribute safety (web link)
12781 !! wikitext
12782 <div title="http://example.com/"></div>
12783 !! html
12784 <div title="http&#58;//example.com/"></div>
12785
12786 !! end
12787
12788 !! test
12789 Bug 2304: HTML attribute safety (named web link)
12790 !! wikitext
12791 <div title="[http://example.com/ link]"></div>
12792 !! html
12793 <div title="&#91;http&#58;//example.com/ link]"></div>
12794
12795 !! end
12796
12797 !! test
12798 Bug 3244: HTML attribute safety (extension; safe)
12799 !! wikitext
12800 <div style="<nowiki>background:blue</nowiki>"></div>
12801 !! html
12802 <div style="background:blue"></div>
12803
12804 !! end
12805
12806 !! test
12807 Bug 3244: HTML attribute safety (extension; unsafe)
12808 !! wikitext
12809 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12810 !! html
12811 <div style="/* insecure input */"></div>
12812
12813 !! end
12814
12815 # More MSIE fun discovered by Tom Gilder
12816
12817 !! test
12818 MSIE CSS safety test: spurious slash
12819 !! wikitext
12820 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12821 !! html
12822 <div style="/* insecure input */">evil</div>
12823
12824 !! end
12825
12826 !! test
12827 MSIE CSS safety test: hex code
12828 !! wikitext
12829 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12830 !! html
12831 <div style="/* insecure input */">evil</div>
12832
12833 !! end
12834
12835 !! test
12836 MSIE CSS safety test: comment in url
12837 !! wikitext
12838 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12839 !! html
12840 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12841
12842 !! end
12843
12844 !! test
12845 MSIE CSS safety test: comment in expression
12846 !! wikitext
12847 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12848 !! html
12849 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12850
12851 !! end
12852
12853 !! test
12854 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12855 !! wikitext
12856 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12857 !! html
12858 <p style="/* invalid control char */">A</p>
12859
12860 !! end
12861
12862 !! test
12863 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12864 !! wikitext
12865 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12866 <div style="top:EXPRESSION(alert())">B</div>
12867 !! html
12868 <p style="/* insecure input */">A</p>
12869 <div style="/* insecure input */">B</div>
12870
12871 !! end
12872
12873 !! test
12874 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12875 !! wikitext
12876 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12877 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12878 !! html
12879 <div style="/* insecure input */">A</div>
12880 <p style="/* insecure input */">B</p>
12881
12882 !! end
12883
12884 !! test
12885 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12886 !! wikitext
12887 <div style="background-image:url⁽javascript:alert())">A</div>
12888 <div style="background-image:url₍javascript:alert())">B</div>
12889 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12890 !! html
12891 <div style="/* insecure input */">A</div>
12892 <div style="/* insecure input */">B</div>
12893 <p style="/* insecure input */">C</p>
12894
12895 !! end
12896
12897 !! test
12898 Opera -o-link CSS
12899 !! wikitext
12900 <div
12901 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;"
12902 style="-o-link:attr(title);-o-link-source:current">X</div>
12903 !! html
12904 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12905
12906 !! end
12907
12908 !! test
12909 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12910 !! wikitext
12911 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12912 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12913 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12914 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12915 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12916 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12917 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12918 !! html
12919 <p style="/* insecure input */">A</p>
12920 <p style="/* insecure input */">B</p>
12921 <p style="/* insecure input */">C</p>
12922 <p style="/* insecure input */">D</p>
12923 <p style="/* insecure input */">E</p>
12924 <p style="/* insecure input */">F</p>
12925 <p style="/* insecure input */">G</p>
12926
12927 !! end
12928
12929 !! test
12930 Table attribute legitimate extension
12931 !! wikitext
12932 {|
12933 !+ style="<nowiki>color:blue</nowiki>"| status
12934 |}
12935 !! html
12936 <table>
12937 <tr>
12938 <th style="color:blue"> status
12939 </th></tr></table>
12940
12941 !!end
12942
12943 !! test
12944 Table attribute safety
12945 !! wikitext
12946 {|
12947 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12948 |}
12949 !! html
12950 <table>
12951 <tr>
12952 <th style="/* insecure input */"> status
12953 </th></tr></table>
12954
12955 !! end
12956
12957 !! test
12958 CSS line continuation 1
12959 !! wikitext
12960 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12961 !! html
12962 <div style="/* insecure input */"></div>
12963
12964 !! end
12965
12966 !! test
12967 CSS line continuation 2
12968 !! wikitext
12969 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12970 !! html
12971 <div style="/* insecure input */"></div>
12972
12973 !! end
12974
12975 !! article
12976 Template:Identity
12977 !! text
12978 {{{1}}}
12979 !! endarticle
12980
12981 !! test
12982 Expansion of multi-line templates in attribute values (bug 6255)
12983 !! wikitext
12984 <div style="background: {{identity|#00FF00}}">-</div>
12985 !! html
12986 <div style="background: #00FF00">-</div>
12987
12988 !! end
12989
12990
12991 !! test
12992 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12993 !! wikitext
12994 <div style="background:
12995 #00FF00">-</div>
12996 !! html
12997 <div style="background: #00FF00">-</div>
12998
12999 !! end
13000
13001 !! test
13002 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13003 !! wikitext
13004 <div style="background: &#10;#00FF00">-</div>
13005 !! html
13006 <div style="background: &#10;#00FF00">-</div>
13007
13008 !! end
13009
13010 ###
13011 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13012 ###
13013 !! test
13014 Parser hook: empty input
13015 !! wikitext
13016 <tag></tag>
13017 !! html
13018 <pre>
13019 ''
13020 array (
13021 )
13022 </pre>
13023
13024 !! end
13025
13026 !! test
13027 Parser hook: empty input using terminated empty elements
13028 !! wikitext
13029 <tag/>
13030 !! html
13031 <pre>
13032 NULL
13033 array (
13034 )
13035 </pre>
13036
13037 !! end
13038
13039 !! test
13040 Parser hook: empty input using terminated empty elements (space before)
13041 !! wikitext
13042 <tag />
13043 !! html
13044 <pre>
13045 NULL
13046 array (
13047 )
13048 </pre>
13049
13050 !! end
13051
13052 !! test
13053 Parser hook: basic input
13054 !! wikitext
13055 <tag>input</tag>
13056 !! html
13057 <pre>
13058 'input'
13059 array (
13060 )
13061 </pre>
13062
13063 !! end
13064
13065
13066 !! test
13067 Parser hook: case insensitive
13068 !! wikitext
13069 <TAG>input</TAG>
13070 !! html
13071 <pre>
13072 'input'
13073 array (
13074 )
13075 </pre>
13076
13077 !! end
13078
13079
13080 !! test
13081 Parser hook: case insensitive, redux
13082 !! wikitext
13083 <TaG>input</TAg>
13084 !! html
13085 <pre>
13086 'input'
13087 array (
13088 )
13089 </pre>
13090
13091 !! end
13092
13093 !! test
13094 Parser hook: nested tags
13095 !! options
13096 noxml
13097 !! wikitext
13098 <tag><tag></tag></tag>
13099 !! html
13100 <pre>
13101 '<tag>'
13102 array (
13103 )
13104 </pre>&lt;/tag&gt;
13105
13106 !! end
13107
13108 !! test
13109 Parser hook: basic arguments
13110 !! wikitext
13111 <tag width=200 height = "100" depth = '50' square></tag>
13112 !! html
13113 <pre>
13114 ''
13115 array (
13116 'width' => '200',
13117 'height' => '100',
13118 'depth' => '50',
13119 'square' => 'square',
13120 )
13121 </pre>
13122
13123 !! end
13124
13125 !! test
13126 Parser hook: argument containing a forward slash (bug 5344)
13127 !! wikitext
13128 <tag filename='/tmp/bla'></tag>
13129 !! html
13130 <pre>
13131 ''
13132 array (
13133 'filename' => '/tmp/bla',
13134 )
13135 </pre>
13136
13137 !! end
13138
13139 !! test
13140 Parser hook: empty input using terminated empty elements (bug 2374)
13141 !! wikitext
13142 <tag foo=bar/>text
13143 !! html
13144 <pre>
13145 NULL
13146 array (
13147 'foo' => 'bar',
13148 )
13149 </pre>text
13150
13151 !! end
13152
13153 # </tag> should be output literally since there is no matching tag that begins it
13154 !! test
13155 Parser hook: basic arguments using terminated empty elements (bug 2374)
13156 !! wikitext
13157 <tag width=200 height = "100" depth = '50' square/>
13158 other stuff
13159 </tag>
13160 !! html
13161 <pre>
13162 NULL
13163 array (
13164 'width' => '200',
13165 'height' => '100',
13166 'depth' => '50',
13167 'square' => 'square',
13168 )
13169 </pre>
13170 <p>other stuff
13171 &lt;/tag&gt;
13172 </p>
13173 !! end
13174
13175 ###
13176 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13177 ###
13178
13179 !! test
13180 Parser hook: static parser hook not inside a comment
13181 !! wikitext
13182 <statictag>hello, world</statictag>
13183 <statictag action=flush/>
13184 !! html
13185 <p>hello, world
13186 </p>
13187 !! end
13188
13189
13190 !! test
13191 Parser hook: static parser hook inside a comment
13192 !! wikitext
13193 <!-- <statictag>hello, world</statictag> -->
13194 <statictag action=flush/>
13195 !! html
13196 <p><br />
13197 </p>
13198 !! end
13199
13200 # Nested template calls; this case was broken by Parser.php rev 1.506,
13201 # since reverted.
13202
13203 !! article
13204 Template:One-parameter
13205 !! text
13206 (My parameter is: {{{1}}})
13207 !! endarticle
13208
13209 !! article
13210 Template:Map-one-parameter
13211 !! text
13212 {{{{{1}}}|{{{2}}}}}
13213 !! endarticle
13214
13215 !! test
13216 Nested template calls
13217 !! wikitext
13218 {{Map-one-parameter|One-parameter|param}}
13219 !! html
13220 <p>(My parameter is: param)
13221 </p>
13222 !! end
13223
13224
13225 ###
13226 ### Sanitizer
13227 ###
13228 !! test
13229 Sanitizer: Closing of open tags
13230 !! wikitext
13231 <s></s><table></table>
13232 !! html
13233 <s></s><table></table>
13234
13235 !! end
13236
13237 !! test
13238 Sanitizer: Closing of open but not closed tags
13239 !! wikitext
13240 <s>foo
13241 !! html
13242 <p><s>foo</s>
13243 </p>
13244 !! end
13245
13246 !! test
13247 Sanitizer: Closing of closed but not open tags
13248 !! wikitext
13249 </s>
13250 !! html
13251 <p>&lt;/s&gt;
13252 </p>
13253 !! end
13254
13255 !! test
13256 Sanitizer: Closing of closed but not open table tags
13257 !! wikitext
13258 Table not started</td></tr></table>
13259 !! html
13260 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13261 </p>
13262 !! end
13263
13264 !! test
13265 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13266 !! wikitext
13267 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13268 !! html
13269 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13270 </p>
13271 !! end
13272
13273 !! test
13274 Sanitizer: Validating the contents of the id attribute (bug 4515)
13275 !! options
13276 disabled
13277 !! wikitext
13278 <br id=9 />
13279 !! html
13280 Something, but definitely not <br id="9" />...
13281 !! end
13282
13283 !! test
13284 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13285 !! options
13286 disabled
13287 !! wikitext
13288 <br id="foo" /><br id="foo" />
13289 !! html
13290 Something need to be done. foo-2 ?
13291 !! end
13292
13293 !! test
13294 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13295 !! wikitext
13296 <div itemscope>
13297 <meta itemprop="hello" content="world">
13298 <meta http-equiv="refresh" content="5">
13299 <meta itemprop="hello" http-equiv="refresh" content="5">
13300 <link itemprop="hello" href="{{SERVER}}">
13301 <link rel="stylesheet" href="{{SERVER}}">
13302 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13303 </div>
13304 !! html
13305 <div itemscope="itemscope">
13306 <p> <meta itemprop="hello" content="world" />
13307 &lt;meta http-equiv="refresh" content="5"&gt;
13308 <meta itemprop="hello" content="5" />
13309 </p>
13310 <link itemprop="hello" href="http&#58;//example.org" />
13311 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13312 <link itemprop="hello" href="http&#58;//example.org" />
13313 </div>
13314
13315 !! end
13316
13317 !! test
13318 Language converter: output gets cut off unexpectedly (bug 5757)
13319 !! options
13320 language=zh
13321 !! wikitext
13322 this bit is safe: }-
13323
13324 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13325
13326 then we get cut off here: }-
13327
13328 all additional text is vanished
13329 !! html
13330 <p>this bit is safe: }-
13331 </p><p>but if we add a conversion instance: xxx
13332 </p><p>then we get cut off here: }-
13333 </p><p>all additional text is vanished
13334 </p>
13335 !! end
13336
13337 !! test
13338 Self closed html pairs (bug 5487)
13339 !! options
13340 !! wikitext
13341 <center><font id="bug" />Centered text</center>
13342 <div><font id="bug2" />In div text</div>
13343 !! html
13344 <center>&lt;font id="bug" /&gt;Centered text</center>
13345 <div>&lt;font id="bug2" /&gt;In div text</div>
13346
13347 !! end
13348
13349 #
13350 #
13351 #
13352
13353 !! test
13354 Punctuation: nbsp before exclamation
13355 !! wikitext
13356 C'est grave !
13357 !! html
13358 <p>C'est grave&#160;!
13359 </p>
13360 !! end
13361
13362 !! test
13363 Punctuation: CSS !important (bug 11874)
13364 !! wikitext
13365 <div style="width:50% !important">important</div>
13366 !! html
13367 <div style="width:50% !important">important</div>
13368
13369 !!end
13370
13371 !! test
13372 Punctuation: CSS ! important (bug 11874; with space after)
13373 !! wikitext
13374 <div style="width:50% ! important">important</div>
13375 !! html
13376 <div style="width:50% ! important">important</div>
13377
13378 !!end
13379
13380
13381 !! test
13382 HTML bullet list, closed tags (bug 5497)
13383 !! wikitext
13384 <ul>
13385 <li>One</li>
13386 <li>Two</li>
13387 </ul>
13388 !! html
13389 <ul>
13390 <li>One</li>
13391 <li>Two</li>
13392 </ul>
13393
13394 !! end
13395
13396 !! test
13397 HTML bullet list, unclosed tags (bug 5497)
13398 !! options
13399 disabled
13400 !! wikitext
13401 <ul>
13402 <li>One
13403 <li>Two
13404 </ul>
13405 !! html
13406 <ul>
13407 <li>One
13408 </li>
13409 <li>Two
13410 </li>
13411 </ul>
13412
13413 !! end
13414
13415 !! test
13416 HTML ordered list, closed tags (bug 5497)
13417 !! wikitext
13418 <ol>
13419 <li>One</li>
13420 <li>Two</li>
13421 </ol>
13422 !! html
13423 <ol>
13424 <li>One</li>
13425 <li>Two</li>
13426 </ol>
13427
13428 !! end
13429
13430 !! test
13431 HTML ordered list, unclosed tags (bug 5497)
13432 !! options
13433 disabled
13434 !! wikitext
13435 <ol>
13436 <li>One
13437 <li>Two
13438 </ol>
13439 !! html
13440 <ol>
13441 <li>One
13442 </li>
13443 <li>Two
13444 </li>
13445 </ol>
13446
13447 !! end
13448
13449 !! test
13450 HTML nested bullet list, closed tags (bug 5497)
13451 !! wikitext
13452 <ul>
13453 <li>One</li>
13454 <li>Two:
13455 <ul>
13456 <li>Sub-one</li>
13457 <li>Sub-two</li>
13458 </ul>
13459 </li>
13460 </ul>
13461 !! html
13462 <ul>
13463 <li>One</li>
13464 <li>Two:
13465 <ul>
13466 <li>Sub-one</li>
13467 <li>Sub-two</li>
13468 </ul>
13469 </li>
13470 </ul>
13471
13472 !! end
13473
13474 !! test
13475 HTML nested bullet list, open tags (bug 5497)
13476 !! options
13477 disabled
13478 !! wikitext
13479 <ul>
13480 <li>One
13481 <li>Two:
13482 <ul>
13483 <li>Sub-one
13484 <li>Sub-two
13485 </ul>
13486 </ul>
13487 !! html
13488 <ul>
13489 <li>One
13490 </li>
13491 <li>Two:
13492 <ul>
13493 <li>Sub-one
13494 </li>
13495 <li>Sub-two
13496 </li>
13497 </ul>
13498 </li>
13499 </ul>
13500
13501 !! end
13502
13503 !! test
13504 HTML nested ordered list, closed tags (bug 5497)
13505 !! wikitext
13506 <ol>
13507 <li>One</li>
13508 <li>Two:
13509 <ol>
13510 <li>Sub-one</li>
13511 <li>Sub-two</li>
13512 </ol>
13513 </li>
13514 </ol>
13515 !! html
13516 <ol>
13517 <li>One</li>
13518 <li>Two:
13519 <ol>
13520 <li>Sub-one</li>
13521 <li>Sub-two</li>
13522 </ol>
13523 </li>
13524 </ol>
13525
13526 !! end
13527
13528 !! test
13529 HTML nested ordered list, open tags (bug 5497)
13530 !! options
13531 disabled
13532 !! wikitext
13533 <ol>
13534 <li>One
13535 <li>Two:
13536 <ol>
13537 <li>Sub-one
13538 <li>Sub-two
13539 </ol>
13540 </ol>
13541 !! html
13542 <ol>
13543 <li>One
13544 </li>
13545 <li>Two:
13546 <ol>
13547 <li>Sub-one
13548 </li>
13549 <li>Sub-two
13550 </li>
13551 </ol>
13552 </li>
13553 </ol>
13554
13555 !! end
13556
13557 !! test
13558 HTML ordered list item with parameters oddity
13559 !! wikitext
13560 <ol><li id="fragment">One</li>
13561 </ol>
13562 !! html
13563 <ol><li id="fragment">One</li>
13564 </ol>
13565
13566 !! end
13567
13568 !!test
13569 bug 5918: autonumbering
13570 !! wikitext
13571 [http://first/] [http://second] [ftp://ftp]
13572
13573 ftp://inlineftp
13574
13575 [mailto:enclosed@mail.tld With target]
13576
13577 [mailto:enclosed@mail.tld]
13578
13579 mailto:inline@mail.tld
13580 !! html
13581 <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>
13582 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13583 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13584 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13585 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13586 </p>
13587 !! end
13588
13589
13590 #
13591 # Security and HTML correctness
13592 # From Nick Jenkins' fuzz testing
13593 #
13594
13595 !! test
13596 Fuzz testing: Parser13
13597 !! wikitext
13598 {|
13599 | http://a|
13600 !! html
13601 <table>
13602 <tr>
13603 <td>
13604 </td>
13605 </tr>
13606 </table>
13607
13608 !! end
13609
13610 !! test
13611 Fuzz testing: Parser14
13612 !! wikitext
13613 == onmouseover= ==
13614 http://__TOC__
13615 !! html
13616 <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>
13617 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13618 <ul>
13619 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13620 </ul>
13621 </div>
13622
13623
13624 !! end
13625
13626 !! test
13627 Fuzz testing: Parser14-table
13628 !! wikitext
13629 ==a==
13630 {| STYLE=__TOC__
13631 !! html
13632 <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>
13633 <table style="&#95;_TOC&#95;_">
13634 <tr><td></td></tr>
13635 </table>
13636
13637 !! end
13638
13639 # Known to produce bogus xml (extra </td>)
13640 !! test
13641 Fuzz testing: Parser16
13642 !! options
13643 noxml
13644 !! wikitext
13645 {|
13646 !https://||||||
13647 !! html
13648 <table>
13649 <tr>
13650 <th>https://</th>
13651 <th></th>
13652 <th></th>
13653 <th>
13654 </td>
13655 </tr>
13656 </table>
13657
13658 !! end
13659
13660 !! test
13661 Fuzz testing: Parser21
13662 !! wikitext
13663 {|
13664 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13665 |
13666 !! html
13667 <table>
13668 <tr>
13669 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13670 </th>
13671 <td>
13672 </td>
13673 </tr>
13674 </table>
13675
13676 !! end
13677
13678 !! test
13679 Fuzz testing: Parser22
13680 !! wikitext
13681 http://===r:::https://b
13682
13683 {|
13684 !! html
13685 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13686 </p>
13687 <table>
13688 <tr><td></td></tr>
13689 </table>
13690
13691 !! end
13692
13693 # Known to produce bad XML for now
13694 !! test
13695 Fuzz testing: Parser24
13696 !! options
13697 noxml
13698 !! wikitext
13699 {|
13700 {{{|
13701 <u CLASS=
13702 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13703 <br style="onmouseover='alert(document.cookie);' " />
13704
13705 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13706 |
13707 !! html
13708 <table>
13709 {{{|
13710 <u class="&#124;">}}}} &gt;
13711 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13712
13713 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13714 <tr>
13715 <td></u>
13716 </td>
13717 </tr>
13718 </table>
13719
13720 !! end
13721
13722 # Note: the current result listed for this is not what the original one was,
13723 # but the original bug was JavaScript injection, which is fixed in any case.
13724 # It's not clear that the original result listed was any more correct than the
13725 # current one. Original result:
13726 # <p>{{{|
13727 # </p>
13728 # <li class="&#124;&#124;">
13729 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13730 !!test
13731 Fuzz testing: Parser25 (bug 6055)
13732 !! wikitext
13733 {{{
13734 |
13735 <LI CLASS=||
13736 >
13737 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13738 !! html
13739 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13740 </p>
13741 !! end
13742
13743 !!test
13744 Fuzz testing: URL adjacent extension (with space, clean)
13745 !! options
13746 !! wikitext
13747 http://example.com <nowiki>junk</nowiki>
13748 !! html
13749 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13750 </p>
13751 !!end
13752
13753 !!test
13754 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13755 !! options
13756 !! wikitext
13757 http://example.com<nowiki>junk</nowiki>
13758 !! html
13759 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13760 </p>
13761 !!end
13762
13763 !!test
13764 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13765 !! options
13766 !! wikitext
13767 http://example.com<pre>junk</pre>
13768 !! html
13769 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13770
13771 !!end
13772
13773 !!test
13774 Fuzz testing: image with bogus manual thumbnail
13775 !! wikitext
13776 [[Image:foobar.jpg|thumbnail= ]]
13777 !! html/php
13778 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
13779
13780 !! html/parsoid
13781 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13782 !!end
13783
13784 !! test
13785 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13786 !! wikitext
13787 <pre dir="&#10;"></pre>
13788 !! html
13789 <pre dir="&#10;"></pre>
13790
13791 !! end
13792
13793 !! test
13794 Parsing optional HTML elements (Bug 6171)
13795 !! options
13796 !! wikitext
13797 <table>
13798 <tr>
13799 <td> Some tabular data</td>
13800 <td> More tabular data ...
13801 <td> And yet som tabular data</td>
13802 </tr>
13803 </table>
13804 !! html
13805 <table>
13806 <tr>
13807 <td> Some tabular data</td>
13808 <td> More tabular data ...
13809 </td><td> And yet som tabular data</td>
13810 </tr>
13811 </table>
13812
13813 !! end
13814
13815 !! test
13816 Correct handling of <td>, <tr> (Bug 6171)
13817 !! options
13818 !! wikitext
13819 <table>
13820 <tr>
13821 <td> Some tabular data</td>
13822 <td> More tabular data ...</td>
13823 <td> And yet som tabular data</td>
13824 </tr>
13825 </table>
13826 !! html
13827 <table>
13828 <tr>
13829 <td> Some tabular data</td>
13830 <td> More tabular data ...</td>
13831 <td> And yet som tabular data</td>
13832 </tr>
13833 </table>
13834
13835 !! end
13836
13837
13838 !! test
13839 Parsing crashing regression (fr:JavaScript)
13840 !! wikitext
13841 </body></x>
13842 !! html
13843 <p>&lt;/body&gt;&lt;/x&gt;
13844 </p>
13845 !! end
13846
13847 !! test
13848 Inline wiki vs wiki block nesting
13849 !! wikitext
13850 '''Bold paragraph
13851
13852 New wiki paragraph
13853 !! html
13854 <p><b>Bold paragraph</b>
13855 </p><p>New wiki paragraph
13856 </p>
13857 !! end
13858
13859 !! test
13860 Inline HTML vs wiki block nesting
13861 !! options
13862 disabled
13863 !! wikitext
13864 <b>Bold paragraph
13865
13866 New wiki paragraph
13867 !! html
13868 <p><b>Bold paragraph</b>
13869 </p><p>New wiki paragraph
13870 </p>
13871 !! end
13872
13873 # Original result was this:
13874 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13875 # </p>
13876 # While that might be marginally more intuitive, maybe, the six-apostrophe
13877 # construct is clearly pathological and the result stated here (which is what
13878 # the parser actually does) is about as reasonable as anything.
13879 !!test
13880 Mixing markup for italics and bold
13881 !! options
13882 !! wikitext
13883 '''bold''''''bold''bolditalics'''''
13884 !! html
13885 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13886 </p>
13887 !! end
13888
13889
13890 !! article
13891 Xyzzyx
13892 !! text
13893 Article for special page transclusion test
13894 !! endarticle
13895
13896 !! test
13897 Special page transclusion
13898 !! options
13899 !! wikitext
13900 {{Special:Prefixindex/Xyzzyx}}
13901 !! html
13902 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13903
13904 !! end
13905
13906 !! test
13907 Special page transclusion twice (bug 5021)
13908 !! options
13909 !! wikitext
13910 {{Special:Prefixindex/Xyzzyx}}
13911 {{Special:Prefixindex/Xyzzyx}}
13912 !! html
13913 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13914 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13915
13916 !! end
13917
13918 !! test
13919 Transclusion of default MediaWiki message
13920 !! wikitext
13921 {{MediaWiki:Mainpage}}
13922 !! html
13923 <p>Main Page
13924 </p>
13925 !! end
13926
13927 !! test
13928 Transclusion of nonexistent MediaWiki message
13929 !! wikitext
13930 {{MediaWiki:Mainpagexxx}}
13931 !! html
13932 <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>
13933 </p>
13934 !! end
13935
13936 !! test
13937 Transclusion of MediaWiki message with underscore
13938 !! wikitext
13939 {{MediaWiki:history_short}}
13940 !! html
13941 <p>History
13942 </p>
13943 !! end
13944
13945 !! test
13946 Transclusion of MediaWiki message with space
13947 !! wikitext
13948 {{MediaWiki:history short}}
13949 !! html
13950 <p>History
13951 </p>
13952 !! end
13953
13954 !! test
13955 Invalid header with following text
13956 !! wikitext
13957 = x = y
13958 !! html
13959 <p>= x = y
13960 </p>
13961 !! end
13962
13963
13964 !! test
13965 Section extraction test (section 0)
13966 !! options
13967 section=0
13968 !! wikitext
13969 start
13970 ==a==
13971 ===aa===
13972 ====aaa====
13973 ==b==
13974 ===ba===
13975 ===bb===
13976 ====bba====
13977 ===bc===
13978 ==c==
13979 ===ca===
13980 !! html
13981 start
13982 !! end
13983
13984 !! test
13985 Section extraction test (section 1)
13986 !! options
13987 section=1
13988 !! wikitext
13989 start
13990 ==a==
13991 ===aa===
13992 ====aaa====
13993 ==b==
13994 ===ba===
13995 ===bb===
13996 ====bba====
13997 ===bc===
13998 ==c==
13999 ===ca===
14000 !! html
14001 ==a==
14002 ===aa===
14003 ====aaa====
14004 !! end
14005
14006 !! test
14007 Section extraction test (section 2)
14008 !! options
14009 section=2
14010 !! wikitext
14011 start
14012 ==a==
14013 ===aa===
14014 ====aaa====
14015 ==b==
14016 ===ba===
14017 ===bb===
14018 ====bba====
14019 ===bc===
14020 ==c==
14021 ===ca===
14022 !! html
14023 ===aa===
14024 ====aaa====
14025 !! end
14026
14027 !! test
14028 Section extraction test (section 3)
14029 !! options
14030 section=3
14031 !! wikitext
14032 start
14033 ==a==
14034 ===aa===
14035 ====aaa====
14036 ==b==
14037 ===ba===
14038 ===bb===
14039 ====bba====
14040 ===bc===
14041 ==c==
14042 ===ca===
14043 !! html
14044 ====aaa====
14045 !! end
14046
14047 !! test
14048 Section extraction test (section 4)
14049 !! options
14050 section=4
14051 !! wikitext
14052 start
14053 ==a==
14054 ===aa===
14055 ====aaa====
14056 ==b==
14057 ===ba===
14058 ===bb===
14059 ====bba====
14060 ===bc===
14061 ==c==
14062 ===ca===
14063 !! html
14064 ==b==
14065 ===ba===
14066 ===bb===
14067 ====bba====
14068 ===bc===
14069 !! end
14070
14071 !! test
14072 Section extraction test (section 5)
14073 !! options
14074 section=5
14075 !! wikitext
14076 start
14077 ==a==
14078 ===aa===
14079 ====aaa====
14080 ==b==
14081 ===ba===
14082 ===bb===
14083 ====bba====
14084 ===bc===
14085 ==c==
14086 ===ca===
14087 !! html
14088 ===ba===
14089 !! end
14090
14091 !! test
14092 Section extraction test (section 6)
14093 !! options
14094 section=6
14095 !! wikitext
14096 start
14097 ==a==
14098 ===aa===
14099 ====aaa====
14100 ==b==
14101 ===ba===
14102 ===bb===
14103 ====bba====
14104 ===bc===
14105 ==c==
14106 ===ca===
14107 !! html
14108 ===bb===
14109 ====bba====
14110 !! end
14111
14112 !! test
14113 Section extraction test (section 7)
14114 !! options
14115 section=7
14116 !! wikitext
14117 start
14118 ==a==
14119 ===aa===
14120 ====aaa====
14121 ==b==
14122 ===ba===
14123 ===bb===
14124 ====bba====
14125 ===bc===
14126 ==c==
14127 ===ca===
14128 !! html
14129 ====bba====
14130 !! end
14131
14132 !! test
14133 Section extraction test (section 8)
14134 !! options
14135 section=8
14136 !! wikitext
14137 start
14138 ==a==
14139 ===aa===
14140 ====aaa====
14141 ==b==
14142 ===ba===
14143 ===bb===
14144 ====bba====
14145 ===bc===
14146 ==c==
14147 ===ca===
14148 !! html
14149 ===bc===
14150 !! end
14151
14152 !! test
14153 Section extraction test (section 9)
14154 !! options
14155 section=9
14156 !! wikitext
14157 start
14158 ==a==
14159 ===aa===
14160 ====aaa====
14161 ==b==
14162 ===ba===
14163 ===bb===
14164 ====bba====
14165 ===bc===
14166 ==c==
14167 ===ca===
14168 !! html
14169 ==c==
14170 ===ca===
14171 !! end
14172
14173 !! test
14174 Section extraction test (section 10)
14175 !! options
14176 section=10
14177 !! wikitext
14178 start
14179 ==a==
14180 ===aa===
14181 ====aaa====
14182 ==b==
14183 ===ba===
14184 ===bb===
14185 ====bba====
14186 ===bc===
14187 ==c==
14188 ===ca===
14189 !! html
14190 ===ca===
14191 !! end
14192
14193 !! test
14194 Section extraction test (nonexistent section 11)
14195 !! options
14196 section=11
14197 !! wikitext
14198 start
14199 ==a==
14200 ===aa===
14201 ====aaa====
14202 ==b==
14203 ===ba===
14204 ===bb===
14205 ====bba====
14206 ===bc===
14207 ==c==
14208 ===ca===
14209 !! html
14210 !! end
14211
14212 !! test
14213 Section extraction test with bogus heading (section 1)
14214 !! options
14215 section=1
14216 !! wikitext
14217 ==a==
14218 ==bogus== not a legal section
14219 ==b==
14220 !! html
14221 ==a==
14222 ==bogus== not a legal section
14223 !! end
14224
14225 !! test
14226 Section extraction test with bogus heading (section 2)
14227 !! options
14228 section=2
14229 !! wikitext
14230 ==a==
14231 ==bogus== not a legal section
14232 ==b==
14233 !! html
14234 ==b==
14235 !! end
14236
14237 !! test
14238 Section extraction test with comment after heading (section 1)
14239 !! options
14240 section=1
14241 !! wikitext
14242 ==a==
14243 ==b== <!-- -->
14244 ==c==
14245 !! html
14246 ==a==
14247 !! end
14248
14249 !! test
14250 Section extraction test with comment after heading (section 2)
14251 !! options
14252 section=2
14253 !! wikitext
14254 ==a==
14255 ==b== <!-- -->
14256 ==c==
14257 !! html
14258 ==b== <!-- -->
14259 !! end
14260
14261 !! test
14262 Section extraction test with bogus <nowiki> heading (section 1)
14263 !! options
14264 section=1
14265 !! wikitext
14266 ==a==
14267 ==bogus== <nowiki>not a legal section</nowiki>
14268 ==b==
14269 !! html
14270 ==a==
14271 ==bogus== <nowiki>not a legal section</nowiki>
14272 !! end
14273
14274 !! test
14275 Section extraction test with bogus <nowiki> heading (section 2)
14276 !! options
14277 section=2
14278 !! wikitext
14279 ==a==
14280 ==bogus== <nowiki>not a legal section</nowiki>
14281 ==b==
14282 !! html
14283 ==b==
14284 !! end
14285
14286
14287 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14288 # instead of respecting commented sections
14289 !! test
14290 Section extraction prefixed by comment (section 1)
14291 !! options
14292 section=1
14293 !! wikitext
14294 <!-- -->==sec1==
14295 ==sec2==
14296 !! html
14297 ==sec2==
14298 !!end
14299
14300 !! test
14301 Section extraction prefixed by comment (section 2)
14302 !! options
14303 section=2
14304 !! wikitext
14305 <!-- -->==sec1==
14306 ==sec2==
14307 !! html
14308
14309 !!end
14310
14311
14312 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14313 # instead of respecting HTML-style headings
14314 !! test
14315 Section extraction, mixed wiki and html (section 1)
14316 !! options
14317 section=1
14318 !! wikitext
14319 <h2>unmarked</h2>
14320 unmarked
14321 ==1==
14322 one
14323 ==2==
14324 two
14325 !! html
14326 ==1==
14327 one
14328 !! end
14329
14330 !! test
14331 Section extraction, mixed wiki and html (section 2)
14332 !! options
14333 section=2
14334 !! wikitext
14335 <h2>unmarked</h2>
14336 unmarked
14337 ==1==
14338 one
14339 ==2==
14340 two
14341 !! html
14342 ==2==
14343 two
14344 !! end
14345
14346
14347 # Formerly testing for bug 3342
14348 !! test
14349 Section extraction, heading surrounded by <noinclude>
14350 !! options
14351 section=1
14352 !! wikitext
14353 <noinclude>==unmarked==</noinclude>
14354 ==marked==
14355 !! html
14356 ==marked==
14357 !!end
14358
14359 # Test behavior of bug 19910
14360 !! test
14361 Sectiion with all-equals
14362 !! options
14363 section=2
14364 !! wikitext
14365 ===
14366 The line above must have a trailing space
14367 === <!--
14368 --> <!-- -->
14369 But just in case it doesn't...
14370 !! html
14371 === <!--
14372 --> <!-- -->
14373 But just in case it doesn't...
14374 !! end
14375
14376 !! test
14377 Section replacement test (section 0)
14378 !! options
14379 replace=0,"xxx"
14380 !! wikitext
14381 start
14382 ==a==
14383 ===aa===
14384 ====aaa====
14385 ==b==
14386 ===ba===
14387 ===bb===
14388 ====bba====
14389 ===bc===
14390 ==c==
14391 ===ca===
14392 !! html
14393 xxx
14394
14395 ==a==
14396 ===aa===
14397 ====aaa====
14398 ==b==
14399 ===ba===
14400 ===bb===
14401 ====bba====
14402 ===bc===
14403 ==c==
14404 ===ca===
14405 !! end
14406
14407 !! test
14408 Section replacement test (section 1)
14409 !! options
14410 replace=1,"xxx"
14411 !! wikitext
14412 start
14413 ==a==
14414 ===aa===
14415 ====aaa====
14416 ==b==
14417 ===ba===
14418 ===bb===
14419 ====bba====
14420 ===bc===
14421 ==c==
14422 ===ca===
14423 !! html
14424 start
14425 xxx
14426
14427 ==b==
14428 ===ba===
14429 ===bb===
14430 ====bba====
14431 ===bc===
14432 ==c==
14433 ===ca===
14434 !! end
14435
14436 !! test
14437 Section replacement test (section 2)
14438 !! options
14439 replace=2,"xxx"
14440 !! wikitext
14441 start
14442 ==a==
14443 ===aa===
14444 ====aaa====
14445 ==b==
14446 ===ba===
14447 ===bb===
14448 ====bba====
14449 ===bc===
14450 ==c==
14451 ===ca===
14452 !! html
14453 start
14454 ==a==
14455 xxx
14456
14457 ==b==
14458 ===ba===
14459 ===bb===
14460 ====bba====
14461 ===bc===
14462 ==c==
14463 ===ca===
14464 !! end
14465
14466 !! test
14467 Section replacement test (section 3)
14468 !! options
14469 replace=3,"xxx"
14470 !! wikitext
14471 start
14472 ==a==
14473 ===aa===
14474 ====aaa====
14475 ==b==
14476 ===ba===
14477 ===bb===
14478 ====bba====
14479 ===bc===
14480 ==c==
14481 ===ca===
14482 !! html
14483 start
14484 ==a==
14485 ===aa===
14486 xxx
14487
14488 ==b==
14489 ===ba===
14490 ===bb===
14491 ====bba====
14492 ===bc===
14493 ==c==
14494 ===ca===
14495 !! end
14496
14497 !! test
14498 Section replacement test (section 4)
14499 !! options
14500 replace=4,"xxx"
14501 !! wikitext
14502 start
14503 ==a==
14504 ===aa===
14505 ====aaa====
14506 ==b==
14507 ===ba===
14508 ===bb===
14509 ====bba====
14510 ===bc===
14511 ==c==
14512 ===ca===
14513 !! html
14514 start
14515 ==a==
14516 ===aa===
14517 ====aaa====
14518 xxx
14519
14520 ==c==
14521 ===ca===
14522 !! end
14523
14524 !! test
14525 Section replacement test (section 5)
14526 !! options
14527 replace=5,"xxx"
14528 !! wikitext
14529 start
14530 ==a==
14531 ===aa===
14532 ====aaa====
14533 ==b==
14534 ===ba===
14535 ===bb===
14536 ====bba====
14537 ===bc===
14538 ==c==
14539 ===ca===
14540 !! html
14541 start
14542 ==a==
14543 ===aa===
14544 ====aaa====
14545 ==b==
14546 xxx
14547
14548 ===bb===
14549 ====bba====
14550 ===bc===
14551 ==c==
14552 ===ca===
14553 !! end
14554
14555 !! test
14556 Section replacement test (section 6)
14557 !! options
14558 replace=6,"xxx"
14559 !! wikitext
14560 start
14561 ==a==
14562 ===aa===
14563 ====aaa====
14564 ==b==
14565 ===ba===
14566 ===bb===
14567 ====bba====
14568 ===bc===
14569 ==c==
14570 ===ca===
14571 !! html
14572 start
14573 ==a==
14574 ===aa===
14575 ====aaa====
14576 ==b==
14577 ===ba===
14578 xxx
14579
14580 ===bc===
14581 ==c==
14582 ===ca===
14583 !! end
14584
14585 !! test
14586 Section replacement test (section 7)
14587 !! options
14588 replace=7,"xxx"
14589 !! wikitext
14590 start
14591 ==a==
14592 ===aa===
14593 ====aaa====
14594 ==b==
14595 ===ba===
14596 ===bb===
14597 ====bba====
14598 ===bc===
14599 ==c==
14600 ===ca===
14601 !! html
14602 start
14603 ==a==
14604 ===aa===
14605 ====aaa====
14606 ==b==
14607 ===ba===
14608 ===bb===
14609 xxx
14610
14611 ===bc===
14612 ==c==
14613 ===ca===
14614 !! end
14615
14616 !! test
14617 Section replacement test (section 8)
14618 !! options
14619 replace=8,"xxx"
14620 !! wikitext
14621 start
14622 ==a==
14623 ===aa===
14624 ====aaa====
14625 ==b==
14626 ===ba===
14627 ===bb===
14628 ====bba====
14629 ===bc===
14630 ==c==
14631 ===ca===
14632 !! html
14633 start
14634 ==a==
14635 ===aa===
14636 ====aaa====
14637 ==b==
14638 ===ba===
14639 ===bb===
14640 ====bba====
14641 xxx
14642
14643 ==c==
14644 ===ca===
14645 !!end
14646
14647 !! test
14648 Section replacement test (section 9)
14649 !! options
14650 replace=9,"xxx"
14651 !! wikitext
14652 start
14653 ==a==
14654 ===aa===
14655 ====aaa====
14656 ==b==
14657 ===ba===
14658 ===bb===
14659 ====bba====
14660 ===bc===
14661 ==c==
14662 ===ca===
14663 !! html
14664 start
14665 ==a==
14666 ===aa===
14667 ====aaa====
14668 ==b==
14669 ===ba===
14670 ===bb===
14671 ====bba====
14672 ===bc===
14673 xxx
14674 !! end
14675
14676 !! test
14677 Section replacement test (section 10)
14678 !! options
14679 replace=10,"xxx"
14680 !! wikitext
14681 start
14682 ==a==
14683 ===aa===
14684 ====aaa====
14685 ==b==
14686 ===ba===
14687 ===bb===
14688 ====bba====
14689 ===bc===
14690 ==c==
14691 ===ca===
14692 !! html
14693 start
14694 ==a==
14695 ===aa===
14696 ====aaa====
14697 ==b==
14698 ===ba===
14699 ===bb===
14700 ====bba====
14701 ===bc===
14702 ==c==
14703 xxx
14704 !! end
14705
14706 !! test
14707 Section replacement test with initial whitespace (bug 13728)
14708 !! options
14709 replace=2,"xxx"
14710 !! wikitext
14711 Preformatted initial line
14712 ==a==
14713 ===a===
14714 !! html
14715 Preformatted initial line
14716 ==a==
14717 xxx
14718 !! end
14719
14720
14721 !! test
14722 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14723 !! options
14724 section=1
14725 !! wikitext
14726 ==a==
14727 a
14728 !! html
14729 ==a==
14730 a
14731 !! end
14732
14733 !! test
14734 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14735 !! options
14736 section=1
14737 !! wikitext
14738 ==a==
14739 a
14740 !! html
14741 ==a==
14742 a
14743 !! end
14744
14745
14746 !! test
14747 Section extraction, <pre> around bogus header (bug 10309)
14748 !! options
14749 noxml section=2
14750 !! wikitext
14751 == Section One ==
14752 <pre>
14753 =======
14754 </pre>
14755
14756 == Section Two ==
14757 stuff
14758 !! html
14759 == Section Two ==
14760 stuff
14761 !! end
14762
14763 !! test
14764 Section replacement, <pre> around bogus header (bug 10309)
14765 !! options
14766 noxml replace=2,"xxx"
14767 !! wikitext
14768 == Section One ==
14769 <pre>
14770 =======
14771 </pre>
14772
14773 == Section Two ==
14774 stuff
14775 !! html
14776 == Section One ==
14777 <pre>
14778 =======
14779 </pre>
14780
14781 xxx
14782 !! end
14783
14784
14785
14786 !! test
14787 Handling of &#x0A; in URLs
14788 !! wikitext
14789 **irc://&#x0A;a
14790 !! html
14791 <ul>
14792 <li><ul>
14793 <li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
14794 </li>
14795 </ul>
14796 </li>
14797 </ul>
14798
14799 !!end
14800
14801 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14802 !! test
14803 5 quotes, code coverage +1 line
14804 !! options
14805 parsoid=wt2html
14806 !! wikitext
14807 '''''
14808 !! html/php
14809 !! html/parsoid
14810 <p><b><i></i></b></p>
14811 !! end
14812
14813 # same html as previous, but wikitext adjusted to match parsoid html2wt
14814 # note that wt2html and html2html will put the <i> before the <b>
14815 !! test
14816 5 quotes, code coverage +1 line w/ nowiki (1)
14817 !! options
14818 parsoid=wt2wt,html2wt
14819 !! wikitext
14820 '''''<nowiki/>'''''
14821 !! html/php
14822 <p><i></i>
14823 </p>
14824 !! html/parsoid
14825 <p><b><i></i></b></p>
14826 !! end
14827
14828 # same as previous, just swapping the <i> and <b>
14829 !! test
14830 5 quotes, code coverage +1 line w/ nowiki (2)
14831 !! wikitext
14832 '''''<nowiki/>'''''
14833 !! html/php
14834 <p><i></i>
14835 </p>
14836 !! html/parsoid
14837 <p><i><b></b></i></p>
14838 !! end
14839
14840 !! test
14841 Special:Search page linking.
14842 !! wikitext
14843 {{Special:search}}
14844 !! html
14845 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14846 </p>
14847 !! end
14848
14849 !! test
14850 Say the magic word
14851 !! options
14852 title=[[Parser test]]
14853 !! wikitext
14854 * {{PAGENAME}}
14855 * {{PAGENAMEE}}
14856 * {{FULLPAGENAME}}
14857 * {{FULLPAGENAMEE}}
14858 * {{BASEPAGENAME}}
14859 * {{BASEPAGENAMEE}}
14860 * {{SUBPAGENAME}}
14861 * {{SUBPAGENAMEE}}
14862 * {{ROOTPAGENAME}}
14863 * {{ROOTPAGENAMEE}}
14864 * {{TALKPAGENAME}}
14865 * {{TALKPAGENAMEE}}
14866 * {{SUBJECTPAGENAME}}
14867 * {{SUBJECTPAGENAMEE}}
14868 * {{NAMESPACEE}}
14869 * {{NAMESPACE}}
14870 * {{NAMESPACENUMBER}}
14871 * {{TALKSPACE}}
14872 * {{TALKSPACEE}}
14873 * {{SUBJECTSPACE}}
14874 * {{SUBJECTSPACEE}}
14875 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14876 !! html
14877 <ul>
14878 <li> Parser test
14879 </li>
14880 <li> Parser_test
14881 </li>
14882 <li> Parser test
14883 </li>
14884 <li> Parser_test
14885 </li>
14886 <li> Parser test
14887 </li>
14888 <li> Parser_test
14889 </li>
14890 <li> Parser test
14891 </li>
14892 <li> Parser_test
14893 </li>
14894 <li> Parser test
14895 </li>
14896 <li> Parser_test
14897 </li>
14898 <li> Talk:Parser test
14899 </li>
14900 <li> Talk:Parser_test
14901 </li>
14902 <li> Parser test
14903 </li>
14904 <li> Parser_test
14905 </li>
14906 <li>
14907 </li>
14908 <li>
14909 </li>
14910 <li> 0
14911 </li>
14912 <li> Talk
14913 </li>
14914 <li> Talk
14915 </li>
14916 <li>
14917 </li>
14918 <li>
14919 </li>
14920 <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>
14921 </li>
14922 </ul>
14923
14924 !! end
14925 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14926
14927 !! test
14928 Gallery
14929 !! wikitext
14930 <gallery>
14931 image1.png |
14932 image2.gif|||||
14933
14934 image3|
14935 image4 |300px| centre
14936 image5.svg| http://///////
14937 [[x|xx]]]]
14938 * image6
14939 </gallery>
14940 !! html
14941 <ul class="gallery mw-gallery-traditional">
14942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14943 <div class="thumb" style="height: 150px;">Image1.png</div>
14944 <div class="gallerytext">
14945 </div>
14946 </div></li>
14947 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14948 <div class="thumb" style="height: 150px;">Image2.gif</div>
14949 <div class="gallerytext">
14950 <p>||||
14951 </p>
14952 </div>
14953 </div></li>
14954 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14955 <div class="thumb" style="height: 150px;">Image3</div>
14956 <div class="gallerytext">
14957 </div>
14958 </div></li>
14959 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14960 <div class="thumb" style="height: 150px;">Image4</div>
14961 <div class="gallerytext">
14962 <p>300px| centre
14963 </p>
14964 </div>
14965 </div></li>
14966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14967 <div class="thumb" style="height: 150px;">Image5.svg</div>
14968 <div class="gallerytext">
14969 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14970 </p>
14971 </div>
14972 </div></li>
14973 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14974 <div class="thumb" style="height: 150px;">* image6</div>
14975 <div class="gallerytext">
14976 </div>
14977 </div></li>
14978 </ul>
14979
14980 !! end
14981
14982 !! test
14983 Gallery (with options)
14984 !! wikitext
14985 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14986 File:Nonexistant.jpg|caption
14987 File:Nonexistant.jpg
14988 image:foobar.jpg|some '''caption''' [[Main Page]]
14989 image:foobar.jpg
14990 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14991 </gallery>
14992 !! html
14993 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14994 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14995 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14996 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14997 <div class="gallerytext">
14998 <p>caption
14999 </p>
15000 </div>
15001 </div></li>
15002 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15003 <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15004 <div class="gallerytext">
15005 </div>
15006 </div></li>
15007 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15008 <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>
15009 <div class="gallerytext">
15010 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15011 </p>
15012 </div>
15013 </div></li>
15014 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15015 <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>
15016 <div class="gallerytext">
15017 </div>
15018 </div></li>
15019 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15020 <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>
15021 <div class="gallerytext">
15022 <p>Blabla|blabla.
15023 </p>
15024 </div>
15025 </div></li>
15026 </ul>
15027
15028 !! end
15029
15030 !! test
15031 Gallery with wikitext inside caption
15032 !! wikitext
15033 <gallery>
15034 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15035 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15036 </gallery>
15037 !! html
15038 <ul class="gallery mw-gallery-traditional">
15039 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15040 <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>
15041 <div class="gallerytext">
15042 <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>
15043 </p>
15044 </div>
15045 </div></li>
15046 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15047 <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>
15048 <div class="gallerytext">
15049 <p>This is a test template
15050 </p>
15051 </div>
15052 </div></li>
15053 </ul>
15054
15055 !! end
15056
15057 !! test
15058 gallery (with showfilename option)
15059 !! wikitext
15060 <gallery showfilename>
15061 File:Nonexistant.jpg|caption
15062 File:Nonexistant.jpg
15063 image:foobar.jpg|some '''caption''' [[Main Page]]
15064 File:Foobar.jpg
15065 </gallery>
15066 !! html
15067 <ul class="gallery mw-gallery-traditional">
15068 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15069 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15070 <div class="gallerytext">
15071 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15072 caption
15073 </p>
15074 </div>
15075 </div></li>
15076 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15077 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15078 <div class="gallerytext">
15079 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15080 </p>
15081 </div>
15082 </div></li>
15083 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15084 <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>
15085 <div class="gallerytext">
15086 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15087 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15088 </p>
15089 </div>
15090 </div></li>
15091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15092 <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>
15093 <div class="gallerytext">
15094 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15095 </p>
15096 </div>
15097 </div></li>
15098 </ul>
15099
15100 !! end
15101
15102 !! test
15103 Gallery (with namespace-less filenames)
15104 !! wikitext
15105 <gallery>
15106 File:Nonexistant.jpg
15107 Nonexistant.jpg
15108 image:foobar.jpg
15109 foobar.jpg
15110 </gallery>
15111 !! html
15112 <ul class="gallery mw-gallery-traditional">
15113 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15114 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15115 <div class="gallerytext">
15116 </div>
15117 </div></li>
15118 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15119 <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15120 <div class="gallerytext">
15121 </div>
15122 </div></li>
15123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15124 <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>
15125 <div class="gallerytext">
15126 </div>
15127 </div></li>
15128 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15129 <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>
15130 <div class="gallerytext">
15131 </div>
15132 </div></li>
15133 </ul>
15134
15135 !! end
15136
15137 !! test
15138 HTML Hex character encoding (spells the word "JavaScript")
15139 !! wikitext
15140 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15141 !! html
15142 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15143 </p>
15144 !! end
15145
15146 !! test
15147 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15148 !! wikitext
15149 &#xsee;&#XSEE;
15150 !! html
15151 <p>&amp;#xsee;&amp;#XSEE;
15152 </p>
15153 !! end
15154
15155 !! test
15156 HTML Hex character encoding mixed case
15157 !! wikitext
15158 &#xEE;&#Xee;
15159 !! html
15160 <p>&#xee;&#xee;
15161 </p>
15162 !! end
15163
15164 !! test
15165 __FORCETOC__ override
15166 !! wikitext
15167 __NEWSECTIONLINK__
15168 __FORCETOC__
15169 !! html
15170 <p><br />
15171 </p>
15172 !! end
15173
15174 !! test
15175 ISBN code coverage
15176 !! wikitext
15177 ISBN 978-0-1234-56&#x20;789
15178 !! html
15179 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15180 </p>
15181 !! end
15182
15183 !! test
15184 ISBN followed by 5 spaces
15185 !! wikitext
15186 ISBN
15187 !! html
15188 <p>ISBN
15189 </p>
15190 !! end
15191
15192 !! test
15193 Double ISBN
15194 !! wikitext
15195 ISBN ISBN 1234567890
15196 !! html
15197 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15198 </p>
15199 !! end
15200
15201 !! test
15202 ISBN with an X
15203 !! wikitext
15204 ISBN 3-462-04561-X
15205 !! html
15206 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15207 </p>
15208 !! end
15209
15210 !! test
15211 ISBN with empty prefix (parsoid test)
15212 !! wikitext
15213 ISBN 1234567890
15214 !! html/parsoid
15215 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15216 !! end
15217
15218 !! test
15219 Bug 22905: <abbr> followed by ISBN followed by </a>
15220 !! wikitext
15221 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15222 !! html
15223 <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>
15224 </p>
15225 !! end
15226
15227 !! test
15228 Double RFC
15229 !! wikitext
15230 RFC RFC 1234
15231 !! html
15232 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15233 </p>
15234 !! end
15235
15236 !! test
15237 Double RFC with a wiki link
15238 !! wikitext
15239 RFC [[RFC 1234]]
15240 !! html
15241 <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>
15242 </p>
15243 !! end
15244
15245 !! test
15246 RFC code coverage
15247 !! wikitext
15248 RFC 983&#x20;987
15249 !! html
15250 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15251 </p>
15252 !! end
15253
15254 !! test
15255 Centre-aligned image
15256 !! wikitext
15257 [[Image:foobar.jpg|centre]]
15258 !! html
15259 <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>
15260
15261 !!end
15262
15263 !! test
15264 None-aligned image
15265 !! wikitext
15266 [[Image:foobar.jpg|none]]
15267 !! html
15268 <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>
15269
15270 !!end
15271
15272 !! test
15273 Width + Height sized image (using px) (height is ignored)
15274 !! wikitext
15275 [[Image:foobar.jpg|640x480px]]
15276 !! html
15277 <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>
15278 </p>
15279 !!end
15280
15281 !! test
15282 Width-sized image (using px, no following whitespace)
15283 !! wikitext
15284 [[Image:foobar.jpg|640px]]
15285 !! html
15286 <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>
15287 </p>
15288 !!end
15289
15290 !! test
15291 Width-sized image (using px, with following whitespace - test regression from r39467)
15292 !! wikitext
15293 [[Image:foobar.jpg|640px ]]
15294 !! html
15295 <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>
15296 </p>
15297 !!end
15298
15299 !! test
15300 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15301 !! wikitext
15302 [[Image:foobar.jpg| 640px]]
15303 !! html
15304 <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>
15305 </p>
15306 !!end
15307
15308 !! test
15309 Another italics / bold test
15310 !! wikitext
15311 ''' ''x'
15312 !! html
15313 <pre>'<i> </i>x'
15314 </pre>
15315 !!end
15316
15317 # Note the results may be incorrect, as parserTest output included this:
15318 # XML error: Mismatched tag at byte 6120:
15319 # ...<dd> </dt></dl> </dd...
15320 !! test
15321 dt/dd/dl test
15322 !! options
15323 disabled
15324 !! wikitext
15325 :;;;::
15326 !! html
15327 <dl>
15328 <dd><dl>
15329 <dt><dl>
15330 <dt><dl>
15331 <dt><dl>
15332 <dd><dl>
15333 <dd>
15334 </dd>
15335 </dl>
15336 </dd>
15337 </dl>
15338 </dt>
15339 </dl>
15340 </dt>
15341 </dl>
15342 </dt>
15343 </dl>
15344 </dd>
15345 </dl>
15346
15347 !!end
15348
15349
15350 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15351 !! test
15352 Images with the "|" character in the comment
15353 !! wikitext
15354 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15355 !! html
15356 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
15357
15358 !!end
15359
15360 !! test
15361 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15362 !! wikitext
15363 <html><script>alert(1);</script></html>
15364 !! html
15365 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15366 </p>
15367 !! end
15368
15369 !! test
15370 HTML with raw HTML ($wgRawHtml==true)
15371 !! options
15372 wgRawHtml=1
15373 !! wikitext
15374 <html><script>alert(1);</script></html>
15375 !! html
15376 <p><script>alert(1);</script>
15377 </p>
15378 !! end
15379
15380 !! test
15381 Parents of subpages, one level up
15382 !! options
15383 subpage title=[[Subpage test/L1/L2/L3]]
15384 !! wikitext
15385 [[../|L2]]
15386 !! html
15387 <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>
15388 </p>
15389 !! end
15390
15391
15392 !! test
15393 Parents of subpages, one level up, not named
15394 !! options
15395 subpage title=[[Subpage test/L1/L2/L3]]
15396 !! wikitext
15397 [[../]]
15398 !! html
15399 <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>
15400 </p>
15401 !! end
15402
15403
15404
15405 !! test
15406 Parents of subpages, two levels up
15407 !! options
15408 subpage title=[[Subpage test/L1/L2/L3]]
15409 !! wikitext
15410 [[../../|L1]]2
15411
15412 [[../../|L1]]l
15413 !! html
15414 <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
15415 </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>
15416 </p>
15417 !! end
15418
15419 !! test
15420 Parents of subpages, two levels up, without trailing slash or name.
15421 !! options
15422 subpage title=[[Subpage test/L1/L2/L3]]
15423 !! wikitext
15424 [[../..]]
15425 !! html
15426 <p>[[../..]]
15427 </p>
15428 !! end
15429
15430 !! test
15431 Parents of subpages, two levels up, with lots of extra trailing slashes.
15432 !! options
15433 subpage title=[[Subpage test/L1/L2/L3]]
15434 !! wikitext
15435 [[../../////]]
15436 !! html
15437 <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>
15438 </p>
15439 !! end
15440
15441 !! article
15442 Subpage test/L1/L2/L3Sibling
15443 !! text
15444 Sibling article
15445 !! endarticle
15446
15447 !! test
15448 Transclusion of a sibling page (one level up)
15449 !! options
15450 subpage title=[[Subpage test/L1/L2/L3]]
15451 !! wikitext
15452 {{../L3Sibling}}
15453 !! html
15454 <p>Sibling article
15455 </p>
15456 !! end
15457
15458 !! test
15459 Transclusion of a child page
15460 !! options
15461 subpage title=[[Subpage test/L1/L2]]
15462 !! wikitext
15463 {{/L3Sibling}}
15464 !! html
15465 <p>Sibling article
15466 </p>
15467 !! end
15468
15469 !! test
15470 Non-transclusion because of too many up levels
15471 !! options
15472 subpage title=[[Subpage test/L1/L2/L3]]
15473 !! wikitext
15474 {{../../../../More than parent}}
15475 !! html
15476 <p>{{../../../../More than parent}}
15477 </p>
15478 !! end
15479
15480 !! test
15481 Definition list code coverage
15482 !! wikitext
15483 ; title : def
15484 ; title : def
15485 ;title: def
15486 !! html
15487 <dl>
15488 <dt> title &#160;</dt>
15489 <dd> def
15490 </dd>
15491 <dt> title&#160;</dt>
15492 <dd> def
15493 </dd>
15494 <dt>title</dt>
15495 <dd> def
15496 </dd>
15497 </dl>
15498
15499 !! end
15500
15501 !! test
15502 Don't fall for the self-closing div
15503 !! wikitext
15504 <div>hello world</div/>
15505 !! html
15506 <div>hello world</div>
15507
15508 !! end
15509
15510 !! test
15511 MSGNW magic word
15512 !! wikitext
15513 {{MSGNW:msg}}
15514 !! html
15515 <p>&#91;&#91;:Template:Msg&#93;&#93;
15516 </p>
15517 !! end
15518
15519 !! test
15520 RAW magic word
15521 !! wikitext
15522 {{RAW:QUERTY}}
15523 !! html
15524 <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>
15525 </p>
15526 !! end
15527
15528 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15529 !! test
15530 Always escape literal '>' in output, not just after '<'
15531 !! wikitext
15532 ><>
15533 !! html
15534 <p>&gt;&lt;&gt;
15535 </p>
15536 !! end
15537
15538 !! test
15539 Template caching
15540 !! wikitext
15541 {{Test}}
15542 {{Test}}
15543 !! html
15544 <p>This is a test template
15545 This is a test template
15546 </p>
15547 !! end
15548
15549
15550 !! article
15551 MediaWiki:Fake
15552 !! text
15553 ==header==
15554 !! endarticle
15555
15556 !! test
15557 Inclusion of !userCanEdit() content
15558 !! wikitext
15559 {{MediaWiki:Fake}}
15560 !! html
15561 <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>
15562
15563 !! end
15564
15565
15566 !! test
15567 Out-of-order TOC heading levels
15568 !! wikitext
15569 ==2==
15570 ======6======
15571 ===3===
15572 =1=
15573 =====5=====
15574 ==2==
15575 !! html
15576 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15577 <ul>
15578 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15579 <ul>
15580 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15581 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15582 </ul>
15583 </li>
15584 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15585 <ul>
15586 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15587 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15588 </ul>
15589 </li>
15590 </ul>
15591 </div>
15592
15593 <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>
15594 <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>
15595 <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>
15596 <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>
15597 <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>
15598 <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>
15599
15600 !! end
15601
15602
15603 !! test
15604 ISBN with a dummy number
15605 !! wikitext
15606 ISBN ---
15607 !! html
15608 <p>ISBN ---
15609 </p>
15610 !! end
15611
15612
15613 !! test
15614 ISBN with space-delimited number
15615 !! wikitext
15616 ISBN 92 9017 032 8
15617 !! html
15618 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15619 </p>
15620 !! end
15621
15622
15623 !! test
15624 ISBN with multiple spaces, no number
15625 !! wikitext
15626 ISBN foo
15627 !! html
15628 <p>ISBN foo
15629 </p>
15630 !! end
15631
15632
15633 !! test
15634 ISBN length
15635 !! wikitext
15636 ISBN 123456789
15637
15638 ISBN 1234567890
15639
15640 ISBN 12345678901
15641 !! html
15642 <p>ISBN 123456789
15643 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15644 </p><p>ISBN 12345678901
15645 </p>
15646 !! end
15647
15648
15649 !! test
15650 ISBN with trailing year (bug 8110)
15651 !! wikitext
15652 ISBN 1-234-56789-0 - 2006
15653
15654 ISBN 1 234 56789 0 - 2006
15655 !! html
15656 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15657 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15658 </p>
15659 !! end
15660
15661
15662 !! test
15663 anchorencode
15664 !! wikitext
15665 {{anchorencode:foo bar©#%n}}
15666 !! html
15667 <p>foo_bar.C2.A9.23.25n
15668 </p>
15669 !! end
15670
15671 !! test
15672 anchorencode trims spaces
15673 !! wikitext
15674 {{anchorencode: __pretty__please__}}
15675 !! html
15676 <p>pretty_please
15677 </p>
15678 !! end
15679
15680 !! test
15681 anchorencode deals with links
15682 !! wikitext
15683 {{anchorencode: [[hello|world]] [[hi]]}}
15684 !! html
15685 <p>world_hi
15686 </p>
15687 !! end
15688
15689 !! test
15690 anchorencode deals with templates
15691 !! wikitext
15692 {{anchorencode: {{Foo}} }}
15693 !! html
15694 <p>FOO
15695 </p>
15696 !! end
15697
15698 !! test
15699 anchorencode encodes like the TOC generator: (bug 18431)
15700 !! wikitext
15701 === _ +:.3A%3A&&amp;]] ===
15702 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15703 __NOEDITSECTION__
15704 !! html
15705 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15706 <p>.2B:.3A.253A.26.26.5D.5D
15707 </p>
15708 !! end
15709
15710 !! test
15711 Bug 6200: blockquotes and paragraph formatting
15712 !! wikitext
15713 <blockquote>
15714 foo
15715 </blockquote>
15716
15717 bar
15718
15719 baz
15720 !! html
15721 <blockquote>
15722 <p>foo
15723 </p>
15724 </blockquote>
15725 <p>bar
15726 </p>
15727 <pre>baz
15728 </pre>
15729 !! end
15730
15731 !! test
15732 Bug 8293: Use of center tag ruins paragraph formatting
15733 !! wikitext
15734 <center>
15735 foo
15736 </center>
15737
15738 bar
15739
15740 baz
15741 !! html
15742 <center>
15743 <p>foo
15744 </p>
15745 </center>
15746 <p>bar
15747 </p>
15748 <pre>baz
15749 </pre>
15750 !! end
15751
15752 !!test
15753 Parsing of overlapping (improperly nested) inline html tags
15754 !! wikitext
15755 <span><s>x</span></s>
15756 !! html/php
15757 <p><span><s>x&lt;/span&gt;</s></span>
15758 </p>
15759 !! html/parsoid
15760 <p><span><s>x</s></span>
15761 </p>
15762 !!end
15763
15764 ###
15765 ### Language variants related tests
15766 ###
15767 !! test
15768 Self-link in language variants
15769 !! options
15770 title=[[Dunav]] language=sr
15771 !! wikitext
15772 Both [[Dunav]] and [[Дунав]] are names for this river.
15773 !! html
15774 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15775 </p>
15776 !!end
15777
15778 !! article
15779 Дуна
15780 !! text
15781 content
15782 !! endarticle
15783
15784 !! test
15785 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15786 !! options
15787 title=[[Duna]] language=sr
15788 !! wikitext
15789 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15790 !! html
15791 <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.
15792 </p>
15793 !! end
15794
15795 !! test
15796 Link to a section of a variant of this title shouldn't be parsed as self-link
15797 !! options
15798 title=[[Duna]] language=sr
15799 !! wikitext
15800 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15801 !! html
15802 <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.
15803 </p>
15804 !! end
15805
15806 !! test
15807 Link to pages in language variants
15808 !! options
15809 language=sr
15810 !! wikitext
15811 Main Page can be written as [[Маин Паге]]
15812 !! html
15813 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15814 </p>
15815 !!end
15816
15817
15818 !! test
15819 Multiple links to pages in language variants
15820 !! options
15821 language=sr
15822 !! wikitext
15823 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15824 !! html
15825 <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>.
15826 </p>
15827 !!end
15828
15829
15830 !! test
15831 Simple template in language variants
15832 !! options
15833 language=sr
15834 !! wikitext
15835 {{тест}}
15836 !! html
15837 <p>This is a test template
15838 </p>
15839 !! end
15840
15841
15842 !! test
15843 Template with explicit namespace in language variants
15844 !! options
15845 language=sr
15846 !! wikitext
15847 {{Template:тест}}
15848 !! html
15849 <p>This is a test template
15850 </p>
15851 !! end
15852
15853
15854 !! test
15855 Basic test for template parameter in language variants
15856 !! options
15857 language=sr
15858 !! wikitext
15859 {{парамтест|param=foo}}
15860 !! html
15861 <p>This is a test template with parameter foo
15862 </p>
15863 !! end
15864
15865
15866 !! test
15867 Simple category in language variants
15868 !! options
15869 language=sr cat
15870 !! wikitext
15871 [[Category:МедиаWики Усер'с Гуиде]]
15872 !! html
15873 <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>
15874 !! end
15875
15876
15877 !! article
15878 Category:分类
15879 !! text
15880 blah
15881 !! endarticle
15882
15883 !! article
15884 Category:分類
15885 !! text
15886 blah
15887 !! endarticle
15888
15889 !! test
15890 Don't convert blue categorylinks to another variant (bug 33210)
15891 !! options
15892 language=zh cat
15893 !! wikitext
15894 [[A]][[Category:分类]]
15895 !! html
15896 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15897 !! end
15898
15899
15900 !! test
15901 Stripping -{}- tags (language variants)
15902 !! options
15903 language=sr
15904 !! wikitext
15905 Latin proverb: -{Ne nuntium necare}-
15906 !! html
15907 <p>Latin proverb: Ne nuntium necare
15908 </p>
15909 !! end
15910
15911
15912 !! test
15913 Prevent conversion with -{}- tags (language variants)
15914 !! options
15915 language=sr variant=sr-ec
15916 !! wikitext
15917 Latinski: -{Ne nuntium necare}-
15918 !! html
15919 <p>Латински: Ne nuntium necare
15920 </p>
15921 !! end
15922
15923
15924 !! test
15925 Prevent conversion of text with -{}- tags (language variants)
15926 !! options
15927 language=sr variant=sr-ec
15928 !! wikitext
15929 Latinski: -{Ne nuntium necare}-
15930 !! html
15931 <p>Латински: Ne nuntium necare
15932 </p>
15933 !! end
15934
15935
15936 !! test
15937 Prevent conversion of links with -{}- tags (language variants)
15938 !! options
15939 language=sr variant=sr-ec
15940 !! wikitext
15941 -{[[Main Page]]}-
15942 !! html
15943 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15944 </p>
15945 !! end
15946
15947
15948 !! test
15949 -{}- tags within headlines (within html for parserConvert())
15950 !! options
15951 language=sr variant=sr-ec
15952 !! wikitext
15953 == -{Naslov}- ==
15954 !! html
15955 <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>
15956
15957 !! end
15958
15959
15960 !! test
15961 Explicit definition of language variant alternatives
15962 !! options
15963 language=zh variant=zh-tw
15964 !! wikitext
15965 -{zh:China;zh-tw:Taiwan}-, not China
15966 !! html
15967 <p>Taiwan, not China
15968 </p>
15969 !! end
15970
15971
15972 !! test
15973 Conversion around HTML tags
15974 !! options
15975 language=sr variant=sr-ec
15976 !! wikitext
15977 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15978 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15979 !! html
15980 <p>
15981 <span title="ЛаCтин">ски</span>
15982 </p>
15983 !! end
15984
15985
15986 !! test
15987 Explicit session-wise language variant mapping (A flag and - flag)
15988 !! options
15989 language=zh variant=zh-tw
15990 !! wikitext
15991 Taiwan is not China.
15992 But -{A|zh:China;zh-tw:Taiwan}- is China,
15993 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15994 and -{China}- is China.
15995 !! html
15996 <p>Taiwan is not China.
15997 But Taiwan is Taiwan,
15998 (This should be stripped!)
15999 and China is China.
16000 </p>
16001 !! end
16002
16003 !! test
16004 Explicit session-wise language variant mapping (H flag for hide)
16005 !! options
16006 language=zh variant=zh-tw
16007 !! wikitext
16008 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16009 Taiwan is China.
16010 !! html
16011 <p>(This should be stripped!)
16012 Taiwan is Taiwan.
16013 </p>
16014 !! end
16015
16016 !! test
16017 Adding explicit conversion rule for title (T flag)
16018 !! options
16019 language=zh variant=zh-tw showtitle
16020 !! wikitext
16021 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16022 !! html
16023 Taiwan
16024 <p>Should be stripped!
16025 </p>
16026 !! end
16027
16028 !! test
16029 Testing that changing the language variant here in the tests actually works
16030 !! options
16031 language=zh variant=zh showtitle
16032 !! wikitext
16033 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16034 !! html
16035 China
16036 <p>Should be stripped!
16037 </p>
16038 !! end
16039
16040 !! test
16041 Recursive conversion of alt and title attrs shouldn't clear converter state
16042 !! options
16043 language=zh variant=zh-cn showtitle
16044 !! wikitext
16045 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16046 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16047 !! html
16048 China
16049 <p>
16050 Should be stripped<span title="Exclamation">!</span>
16051 </p>
16052 !! end
16053
16054 !! test
16055 Bug 24072: more test on conversion rule for title
16056 !! options
16057 language=zh variant=zh-tw showtitle
16058 !! wikitext
16059 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16060 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16061 !! html
16062 Taiwan
16063 <p>This should be stripped!
16064 This won't take interferes with the title rule.
16065 </p>
16066 !! end
16067
16068 !! test
16069 Partly disable title conversion if variant == main language code
16070 !! options
16071 language=zh variant=zh title=[[ZH]] showtitle
16072 !! wikitext
16073 -{T|zh-cn:CN;zh-tw:TW}-
16074 !! html
16075 ZH
16076 <p>
16077 </p>
16078 !! end
16079
16080 !! test
16081 Partly disable title conversion if variant == main language code, more
16082 !! options
16083 language=zh variant=zh title=[[ZH]] showtitle
16084 !! wikitext
16085 -{T|TW}-
16086 !! html
16087 ZH
16088 <p>
16089 </p>
16090 !! end
16091
16092 !! test
16093 Raw output of variant escape tags (R flag)
16094 !! options
16095 language=zh variant=zh-tw
16096 !! wikitext
16097 Raw: -{R|zh:China;zh-tw:Taiwan}-
16098 !! html
16099 <p>Raw: zh:China;zh-tw:Taiwan
16100 </p>
16101 !! end
16102
16103 !! test
16104 Nested using of manual convert syntax
16105 !! options
16106 language=zh variant=zh-hk
16107 !! wikitext
16108 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16109 !! html
16110 <p>Nested: Hello Hong Kong!
16111 </p>
16112 !! end
16113
16114 !! test
16115 Proper conversion of text in external links
16116 !! options
16117 language=sr variant=sr-ec
16118 !! wikitext
16119 http://www.google.com
16120 gopher://www.google.com
16121 [http://www.google.com http://www.google.com]
16122 [gopher://www.google.com gopher://www.google.com]
16123 [https://www.google.com irc://www.google.com]
16124 [ftp://www.google.com www.google.com/ftp://dir]
16125 [//www.google.com www.google.com]
16126 !! html
16127 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16128 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16129 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16130 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16131 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16132 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16133 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16134 </p>
16135 !! end
16136
16137 !! test
16138 Do not convert roman numbers to language variants
16139 !! options
16140 language=sr variant=sr-ec
16141 !! wikitext
16142 Fridrih IV je car.
16143 !! html
16144 <p>Фридрих IV је цар.
16145 </p>
16146 !! end
16147
16148 !! test
16149 Unclosed language converter markup "-{"
16150 !! options
16151 language=sr
16152 !! wikitext
16153 -{T|hello
16154 !! html
16155 <p>-{T|hello
16156 </p>
16157 !! end
16158
16159 !! test
16160 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16161 !! options
16162 language=sr
16163 !! wikitext
16164 -{R|=&gt;}-
16165 !! html
16166 <p>=&gt;
16167 </p>
16168 !!end
16169
16170 !! test
16171 Don't break link parsing if language converter markup is in the caption.
16172 !! options
16173 language=sr variant=sr-ec
16174 !! wikitext
16175 [[Main Page|-{R|main page}-]]
16176 !! html
16177 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16178 </p>
16179 !! end
16180
16181 # This test is currently broken in the PHP parser (bug 52661)
16182 !! test
16183 Don't break image parsing if language converter markup is in the caption.
16184 !! options
16185 language=sr
16186 disabled
16187 !! wikitext
16188 [[File:Foobar.jpg|-{R|caption}-]]
16189 !! html
16190 <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>
16191 </p>
16192 !! end
16193
16194 # This test is currently broken in the PHP parser (bug 52661)
16195 !! test
16196 Don't break list handling if language converter markup is in the item.
16197 !! options
16198 language=zh variant=zh-cn
16199 disabled
16200 !! wikitext
16201 ;-{zh-cn:AAA;zh-tw:BBB}-
16202 !! html
16203 <dl><dt>AAA
16204 </dt></dl>
16205
16206 !! end
16207
16208 # This test is currently broken in the PHP parser (bug 52661)
16209 !! test
16210 Don't break table handling if language converter markup is in the cell.
16211 !! options
16212 language=sr variant=sr-ec
16213 disabled
16214 !! wikitext
16215 {|
16216 |-
16217 | -{R|B}-
16218 |}
16219 !! html
16220 <table>
16221
16222 <tr>
16223 <td> B
16224 </td></tr></table>
16225
16226 !! end
16227
16228 !! test
16229 Bug 529: Uncovered bullet
16230 !! wikitext
16231 * Foo {{bullet}}
16232 !! html
16233 <ul>
16234 <li> Foo
16235 </li>
16236 <li> Bar
16237 </li>
16238 </ul>
16239
16240 !! end
16241
16242 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16243 # Templates in Wikipedia rely on this behavior, as tidy has always been
16244 # enabled there. These tests are normally run *without* tidy, so specify the
16245 # full output here.
16246 # To test realistic parsing behavior, apply a tidy-like transformation to both
16247 # the expected output and your parser's output.
16248 !! test
16249 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16250 !! wikitext
16251 ******* Foo {{bullet}}
16252 !! html
16253 <ul>
16254 <li><ul>
16255 <li><ul>
16256 <li><ul>
16257 <li><ul>
16258 <li><ul>
16259 <li><ul>
16260 <li> Foo
16261 </li>
16262 </ul>
16263 </li>
16264 </ul>
16265 </li>
16266 </ul>
16267 </li>
16268 </ul>
16269 </li>
16270 </ul>
16271 </li>
16272 </ul>
16273 </li>
16274 <li> Bar
16275 </li>
16276 </ul>
16277
16278 !! end
16279
16280 !! test
16281 Bug 529: Uncovered table already at line-start
16282 !! wikitext
16283 x
16284
16285 {{table}}
16286 y
16287 !! html
16288 <p>x
16289 </p>
16290 <table>
16291 <tr>
16292 <td> 1 </td>
16293 <td> 2
16294 </td></tr>
16295 <tr>
16296 <td> 3 </td>
16297 <td> 4
16298 </td></tr></table>
16299 <p>y
16300 </p>
16301 !! end
16302
16303 !! test
16304 Bug 529: Uncovered bullet in parser function result
16305 !! wikitext
16306 * Foo {{lc:{{bullet}} }}
16307 !! html
16308 <ul>
16309 <li> Foo
16310 </li>
16311 <li> bar
16312 </li>
16313 </ul>
16314
16315 !! end
16316
16317 !! test
16318 Bug 5678: Double-parsed template argument
16319 !! wikitext
16320 {{lc:{{{1}}}|hello}}
16321 !! html
16322 <p>{{{1}}}
16323 </p>
16324 !! end
16325
16326 !! test
16327 Bug 5678: Double-parsed template invocation
16328 !! wikitext
16329 {{lc:{{paramtest {{!}} param = hello }} }}
16330 !! html
16331 <p>{{paramtest | param = hello }}
16332 </p>
16333 !! end
16334
16335 !! test
16336 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16337 !! options
16338 language=cs
16339 title=[[Main Page]]
16340 !! wikitext
16341 {{PRVNÍVELKÉ:ěščř}}
16342 {{prvnívelké:ěščř}}
16343 {{PRVNÍMALÉ:ěščř}}
16344 {{prvnímalé:ěščř}}
16345 {{MALÁ:ěščř}}
16346 {{malá:ěščř}}
16347 {{VELKÁ:ěščř}}
16348 {{velká:ěščř}}
16349 !! html
16350 <p>Ěščř
16351 Ěščř
16352 ěščř
16353 ěščř
16354 ěščř
16355 ěščř
16356 ĚŠČŘ
16357 ĚŠČŘ
16358 </p>
16359 !! end
16360
16361 !! test
16362 Morwen/13: Unclosed link followed by heading
16363 !! wikitext
16364 [[link
16365 ==heading==
16366 !! html
16367 <p>[[link
16368 </p>
16369 <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>
16370
16371 !! end
16372
16373 !! test
16374 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16375 !! wikitext
16376 {{foo|
16377 =heading=
16378 !! html
16379 <p>{{foo|
16380 </p>
16381 <h1><span class="mw-headline" id="heading">heading</span></h1>
16382
16383 !! end
16384
16385 !! test
16386 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16387 !! wikitext
16388 {{foo|
16389 ==heading==
16390 !! html
16391 <p>{{foo|
16392 </p>
16393 <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>
16394
16395 !! end
16396
16397 !! test
16398 Tildes in comments
16399 !! options
16400 pst
16401 !! wikitext
16402 <!-- ~~~~ -->
16403 !! html
16404 <!-- ~~~~ -->
16405 !! end
16406
16407 !! test
16408 Paragraphs inside divs (no extra line breaks)
16409 !! wikitext
16410 <div>Line one
16411
16412 Line two</div>
16413 !! html
16414 <div>Line one
16415 Line two</div>
16416
16417 !! end
16418
16419 !! test
16420 Paragraphs inside divs (extra line break on open)
16421 !! wikitext
16422 <div>
16423 Line one
16424
16425 Line two</div>
16426 !! html
16427 <div>
16428 <p>Line one
16429 </p>
16430 Line two</div>
16431
16432 !! end
16433
16434 !! test
16435 Paragraphs inside divs (extra line break on close)
16436 !! wikitext
16437 <div>Line one
16438
16439 Line two
16440 </div>
16441 !! html
16442 <div>Line one
16443 <p>Line two
16444 </p>
16445 </div>
16446
16447 !! end
16448
16449 !! test
16450 Paragraphs inside divs (extra line break on open and close)
16451 !! wikitext
16452 <div>
16453 Line one
16454
16455 Line two
16456 </div>
16457 !! html
16458 <div>
16459 <p>Line one
16460 </p><p>Line two
16461 </p>
16462 </div>
16463
16464 !! end
16465
16466 !! test
16467 Nesting tags, paragraphs on lines which begin with <div>
16468 !! options
16469 disabled
16470 !! wikitext
16471 <div></div><strong>A
16472 B</strong>
16473 !! html
16474 <div></div>
16475 <p><strong>A
16476 B</strong>
16477 </p>
16478 !! end
16479
16480 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16481 !! test
16482 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16483 !! wikitext
16484 <blockquote>Line one
16485
16486 Line two</blockquote>
16487 !! html
16488 <blockquote>Line one
16489 Line two</blockquote>
16490
16491 !! end
16492
16493 !! test
16494 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16495 !! wikitext
16496 <blockquote>
16497 Line one
16498
16499 Line two</blockquote>
16500 !! html
16501 <blockquote>
16502 <p>Line one
16503 </p>
16504 Line two</blockquote>
16505
16506 !! end
16507
16508 !! test
16509 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16510 !! wikitext
16511 <blockquote>Line one
16512
16513 Line two
16514 </blockquote>
16515 !! html
16516 <blockquote>Line one
16517 <p>Line two
16518 </p>
16519 </blockquote>
16520
16521 !! end
16522
16523 !! test
16524 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16525 !! wikitext
16526 <blockquote>
16527 Line one
16528
16529 Line two
16530 </blockquote>
16531 !! html
16532 <blockquote>
16533 <p>Line one
16534 </p><p>Line two
16535 </p>
16536 </blockquote>
16537
16538 !! end
16539
16540 !! test
16541 Paragraphs inside blockquotes/divs (no extra line breaks)
16542 !! wikitext
16543 <blockquote><div>Line one
16544
16545 Line two</div></blockquote>
16546 !! html
16547 <blockquote><div>Line one
16548 Line two</div></blockquote>
16549
16550 !! end
16551
16552 !! test
16553 Paragraphs inside blockquotes/divs (extra line break on open)
16554 !! wikitext
16555 <blockquote><div>
16556 Line one
16557
16558 Line two</div></blockquote>
16559 !! html
16560 <blockquote><div>
16561 <p>Line one
16562 </p>
16563 Line two</div></blockquote>
16564
16565 !! end
16566
16567 !! test
16568 Paragraphs inside blockquotes/divs (extra line break on close)
16569 !! wikitext
16570 <blockquote><div>Line one
16571
16572 Line two
16573 </div></blockquote>
16574 !! html
16575 <blockquote><div>Line one
16576 <p>Line two
16577 </p>
16578 </div></blockquote>
16579
16580 !! end
16581
16582 !! test
16583 Paragraphs inside blockquotes/divs (extra line break on open and close)
16584 !! wikitext
16585 <blockquote><div>
16586 Line one
16587
16588 Line two
16589 </div></blockquote>
16590 !! html
16591 <blockquote><div>
16592 <p>Line one
16593 </p><p>Line two
16594 </p>
16595 </div></blockquote>
16596
16597 !! end
16598
16599 !! test
16600 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16601 !! options
16602 wgLinkHolderBatchSize=0
16603 !! wikitext
16604 [[meatball:1]]
16605 [[meatball:2]]
16606 [[meatball:3]]
16607 !! html
16608 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16609 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16610 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16611 </p>
16612 !! end
16613
16614 !! test
16615 Free external link invading image caption
16616 !! wikitext
16617 [[Image:Foobar.jpg|thumb|http://x|hello]]
16618 !! html
16619 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
16620
16621 !! end
16622
16623 !! test
16624 Bug 15196: localised external link numbers
16625 !! options
16626 language=fa
16627 !! wikitext
16628 [http://en.wikipedia.org/]
16629 !! html
16630 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16631 </p>
16632 !! end
16633
16634 !! test
16635 Multibyte character in padleft
16636 !! wikitext
16637 {{padleft:-Hello|7|Æ}}
16638 !! html
16639 <p>Æ-Hello
16640 </p>
16641 !! end
16642
16643 !! test
16644 Multibyte character in padright
16645 !! wikitext
16646 {{padright:Hello-|7|Æ}}
16647 !! html
16648 <p>Hello-Æ
16649 </p>
16650 !! end
16651
16652 !!test
16653 formatdate parser function
16654 !! wikitext
16655 {{#formatdate:2009-03-24}}
16656 !! html
16657 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16658 </p>
16659 !! end
16660
16661 !!test
16662 formatdate parser function, with default format
16663 !! wikitext
16664 {{#formatdate:2009-03-24|mdy}}
16665 !! html
16666 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16667 </p>
16668 !! end
16669
16670 !! test
16671 Spacing of numbers in formatted dates
16672 !! wikitext
16673 {{#formatdate:January 15}}
16674 !! html
16675 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16676 </p>
16677 !! end
16678
16679 !! test
16680 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
16681 !! options
16682 language=nl title=[[MediaWiki:Common.css]]
16683 !! wikitext
16684 {{#formatdate:2009-03-24|dmy}}
16685 !! html
16686 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16687 </p>
16688 !! end
16689
16690 #
16691 #
16692 #
16693
16694 #
16695 # Edit comments
16696 #
16697
16698 !! test
16699 Edit comment with link
16700 !! options
16701 comment
16702 !! wikitext
16703 I like the [[Main Page]] a lot
16704 !! html
16705 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16706 !!end
16707
16708 !! test
16709 Edit comment with link and link text
16710 !! options
16711 comment
16712 !! wikitext
16713 I like the [[Main Page|best pages]] a lot
16714 !! html
16715 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16716 !!end
16717
16718 !! test
16719 Edit comment with link and link text with suffix
16720 !! options
16721 comment
16722 !! wikitext
16723 I like the [[Main Page|best page]]s a lot
16724 !! html
16725 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16726 !!end
16727
16728 !! test
16729 Edit comment with section link (non-local, eg in history list)
16730 !! options
16731 comment title=[[Main Page]]
16732 !! wikitext
16733 /* External links */ removed bogus entries
16734 !! html
16735 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16736 !!end
16737
16738 !! test
16739 Edit comment with section link and text before it (non-local, eg in history list)
16740 !! options
16741 comment title=[[Main Page]]
16742 !! wikitext
16743 pre-comment text /* External links */ removed bogus entries
16744 !! html
16745 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>
16746 !!end
16747
16748 !! test
16749 Edit comment with section link (local, eg in diff view)
16750 !! options
16751 comment local title=[[Main Page]]
16752 !! wikitext
16753 /* External links */ removed bogus entries
16754 !! html
16755 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16756 !!end
16757
16758 !! test
16759 Edit comment with subpage link (bug 14080)
16760 !! options
16761 comment
16762 subpage
16763 title=[[Subpage test]]
16764 !! wikitext
16765 Poked at a [[/subpage]] here...
16766 !! html
16767 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16768 !!end
16769
16770 !! test
16771 Edit comment with subpage link and link text (bug 14080)
16772 !! options
16773 comment
16774 subpage
16775 title=[[Subpage test]]
16776 !! wikitext
16777 Poked at a [[/subpage|neat little page]] here...
16778 !! html
16779 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16780 !!end
16781
16782 !! test
16783 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16784 !! options
16785 comment
16786 title=[[Subpage test]]
16787 !! wikitext
16788 Poked at a [[/subpage]] here...
16789 !! html
16790 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...
16791 !!end
16792
16793 !! test
16794 Edit comment with bare anchor link (local, as on diff)
16795 !! options
16796 comment
16797 local
16798 title=[[Main Page]]
16799 !! wikitext
16800 [[#section]]
16801 !! html
16802 <a href="#section">#section</a>
16803 !! end
16804
16805 !! test
16806 Edit comment with bare anchor link (non-local, as on history)
16807 !! options
16808 comment
16809 title=[[Main Page]]
16810 !! wikitext
16811 [[#section]]
16812 !! html
16813 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16814 !! end
16815
16816 !! test
16817 Anchor starting with underscore
16818 !! wikitext
16819 [[#_ref|One]]
16820 !! html
16821 <p><a href="#_ref">One</a>
16822 </p>
16823 !! end
16824
16825 !! test
16826 Id starting with underscore
16827 !! wikitext
16828 <div id="_ref"></div>
16829 !! html
16830 <div id="_ref"></div>
16831
16832 !! end
16833
16834 !! test
16835 Space normalisation on autocomment (bug 22784)
16836 !! options
16837 comment
16838 title=[[Main Page]]
16839 !! wikitext
16840 /* __hello__world__ */
16841 !! html
16842 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16843 !! end
16844
16845 !! test
16846 percent-encoding and + signs in comments (Bug 26410)
16847 !! options
16848 comment
16849 !! wikitext
16850 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16851 !! html
16852 <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>
16853 !! end
16854
16855 !! test
16856 Bad images - basic functionality
16857 !! options
16858 disabled
16859 !! wikitext
16860 [[File:Bad.jpg]]
16861 !! html
16862 !! end
16863
16864 !! test
16865 Bad images - bug 16039: text after bad image disappears
16866 !! options
16867 disabled
16868 !! wikitext
16869 Foo bar
16870 [[File:Bad.jpg]]
16871 Bar foo
16872 !! html
16873 <p>Foo bar
16874 </p><p>Bar foo
16875 </p>
16876 !! end
16877
16878 !! test
16879 Verify that displaytitle works (bug #22501) no displaytitle
16880 !! options
16881 showtitle
16882 !! config
16883 wgAllowDisplayTitle=true
16884 wgRestrictDisplayTitle=false
16885 !! wikitext
16886 this is not the the title
16887 !! html
16888 Parser test
16889 <p>this is not the the title
16890 </p>
16891 !! end
16892
16893 !! test
16894 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16895 !! options
16896 showtitle
16897 title=[[Screen]]
16898 !! config
16899 wgAllowDisplayTitle=true
16900 wgRestrictDisplayTitle=false
16901 !! wikitext
16902 this is not the the title
16903 {{DISPLAYTITLE:whatever}}
16904 !! html
16905 whatever
16906 <p>this is not the the title
16907 </p>
16908 !! end
16909
16910 !! test
16911 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16912 !! options
16913 showtitle
16914 title=[[Screen]]
16915 !! config
16916 wgAllowDisplayTitle=true
16917 wgRestrictDisplayTitle=true
16918 !! wikitext
16919 this is not the the title
16920 {{DISPLAYTITLE:whatever}}
16921 !! html
16922 Screen
16923 <p>this is not the the title
16924 </p>
16925 !! end
16926
16927 !! test
16928 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16929 !! options
16930 showtitle
16931 title=[[Screen]]
16932 !! config
16933 wgAllowDisplayTitle=true
16934 wgRestrictDisplayTitle=true
16935 !! wikitext
16936 this is not the the title
16937 {{DISPLAYTITLE:screen}}
16938 !! html
16939 screen
16940 <p>this is not the the title
16941 </p>
16942 !! end
16943
16944 !! test
16945 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16946 !! options
16947 showtitle
16948 title=[[Screen]]
16949 !! config
16950 wgAllowDisplayTitle=false
16951 !! wikitext
16952 this is not the the title
16953 {{DISPLAYTITLE:screen}}
16954 !! html
16955 Screen
16956 <p>this is not the the title
16957 <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>
16958 </p>
16959 !! end
16960
16961 !! test
16962 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16963 !! options
16964 showtitle
16965 title=[[Screen]]
16966 !! config
16967 wgAllowDisplayTitle=false
16968 !! wikitext
16969 this is not the the title
16970 !! html
16971 Screen
16972 <p>this is not the the title
16973 </p>
16974 !! end
16975
16976 !! test
16977 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16978 !! options
16979 showtitle
16980 title=[[Screen]]
16981 !! config
16982 wgAllowDisplayTitle=true
16983 wgRestrictDisplayTitle=true
16984 !! wikitext
16985 this is not the the title
16986 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16987 !! html
16988 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16989 <p>this is not the the title
16990 </p>
16991 !! end
16992
16993 !! test
16994 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16995 !! options
16996 showtitle
16997 title=[[Screen]]
16998 !! config
16999 wgAllowDisplayTitle=true
17000 wgRestrictDisplayTitle=true
17001 !! wikitext
17002 this is not the the title
17003 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17004 !! html
17005 <span style="color: red;">s</span>creen
17006 <p>this is not the the title
17007 </p>
17008 !! end
17009
17010 !! test
17011 preload: check <noinclude> and <includeonly>
17012 !! options
17013 preload
17014 !! wikitext
17015 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17016 !! html
17017 Hello kind world.
17018 !! end
17019
17020 !! test
17021 preload: check <onlyinclude>
17022 !! options
17023 preload
17024 !! wikitext
17025 Goodbye <onlyinclude>Hello world</onlyinclude>
17026 !! html
17027 Hello world
17028 !! end
17029
17030 !! test
17031 preload: can pass tags through if we want to
17032 !! options
17033 preload
17034 !! wikitext
17035 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17036 !! html
17037 <includeonly>Hello world</includeonly>
17038 !! end
17039
17040 !! test
17041 preload: check that it doesn't try to do tricks
17042 !! options
17043 preload
17044 !! wikitext
17045 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17046 !! html
17047 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17048 !! end
17049
17050 !! test
17051 Play a bit with r67090 and bug 3158
17052 !! options
17053 disabled
17054 !! wikitext
17055 <div style="width:50% !important">&nbsp;</div>
17056 <div style="width:50%&nbsp;!important">&nbsp;</div>
17057 <div style="width:50%&#160;!important">&nbsp;</div>
17058 <div style="border : solid;">&nbsp;</div>
17059 !! html
17060 <div style="width:50% !important">&nbsp;</div>
17061 <div style="width:50% !important">&nbsp;</div>
17062 <div style="width:50% !important">&nbsp;</div>
17063 <div style="border&#160;: solid;">&nbsp;</div>
17064
17065 !! end
17066
17067 !! test
17068 HTML5 data attributes
17069 !! wikitext
17070 <span data-foo="bar">Baz</span>
17071 <p data-abc-def_hij="">Quuz</p>
17072 !! html
17073 <p><span data-foo="bar">Baz</span>
17074 </p>
17075 <p data-abc-def_hij="">Quuz</p>
17076
17077 !! end
17078
17079 !! test
17080 percent-encoding and + signs in internal links (Bug 26410)
17081 !! wikitext
17082 [[User:+%]] [[Page+title%]]
17083 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17084 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17085 [[%33%45]] [[%33%45+]]
17086 !! html
17087 <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>
17088 <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>
17089 <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>
17090 <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>
17091 </p>
17092 !! end
17093
17094 !! test
17095 Special characters in embedded file links (bug 27679)
17096 !! wikitext
17097 [[File:Contains & ampersand.jpg]]
17098 [[File:Does not exist.jpg|Title with & ampersand]]
17099 !! html
17100 <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>
17101 <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>
17102 </p>
17103 !! end
17104
17105
17106 !! test
17107 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17108 !! wikitext
17109 Text&apos;s been normalized?
17110 !! html
17111 <p>Text&#39;s been normalized?
17112 </p>
17113 !! end
17114
17115 !! test
17116 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17117 !! wikitext
17118 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17119 !! html
17120 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17121 </p>
17122 !! end
17123
17124 !! test
17125 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17126 !! wikitext
17127 [http://www.example.org/ ideograms]
17128 !! html
17129 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17130 </p>
17131 !! end
17132
17133 !! test
17134 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17135 !! wikitext
17136 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17137 !! html
17138 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17139 </p>
17140 !! end
17141
17142 !! article
17143 Mediawiki:loop1
17144 !! text
17145 {{Identical|A}}
17146 !! endarticle
17147
17148 !! article
17149 Mediawiki:loop2
17150 !! text
17151 {{Identical|B}}
17152 !! endarticle
17153
17154 !! article
17155 Template:Identical
17156 !! text
17157 {{int:loop1}}
17158 {{int:loop2}}
17159 !! endarticle
17160
17161 !! test
17162 Bug 31098 Template which includes system messages which includes the template
17163 !! wikitext
17164 {{Identical}}
17165 !! html
17166 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17167 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17168 </p>
17169 !! end
17170
17171 !! test
17172 Bug31490 Turkish: ucfirst 'blah'
17173 !! options
17174 language=tr
17175 !! wikitext
17176 {{ucfirst:blah}}
17177 !! html
17178 <p>Blah
17179 </p>
17180 !! end
17181
17182 !! test
17183 Bug31490 Turkish: ucfirst 'ix'
17184 !! options
17185 language=tr
17186 !! wikitext
17187 {{ucfirst:ix}}
17188 !! html
17189 <p>İx
17190 </p>
17191 !! end
17192
17193 !! test
17194 Bug31490 Turkish: lcfirst 'BLAH'
17195 !! options
17196 language=tr
17197 !! wikitext
17198 {{lcfirst:BLAH}}
17199 !! html
17200 <p>bLAH
17201 </p>
17202 !! end
17203
17204 !! test
17205 Bug31490 Turkish: ucfırst (with a dotless i)
17206 !! options
17207 language=tr
17208 !! wikitext
17209 {{ucfırst:blah}}
17210 !! html
17211 <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>
17212 </p>
17213 !! end
17214
17215 !! test
17216 Bug31490 ucfırst (with a dotless i) with English language
17217 !! options
17218 language=en
17219 !! wikitext
17220 {{ucfırst:blah}}
17221 !! html
17222 <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>
17223 </p>
17224 !! end
17225
17226 !! test
17227 Bug 26375: TOC with italics
17228 !! options
17229 title=[[Main Page]]
17230 !! wikitext
17231 __TOC__
17232 == ''Lost'' episodes ==
17233 !! html
17234 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17235 <ul>
17236 <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>
17237 </ul>
17238 </div>
17239
17240 <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>
17241
17242 !! end
17243
17244 !! test
17245 Bug 26375: TOC with bold
17246 !! options
17247 title=[[Main Page]]
17248 !! wikitext
17249 __TOC__
17250 == '''should be bold''' then normal text ==
17251 !! html
17252 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17253 <ul>
17254 <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>
17255 </ul>
17256 </div>
17257
17258 <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>
17259
17260 !! end
17261
17262 !! test
17263 Bug 33845: Headings become cursive in TOC when they contain an image
17264 !! options
17265 title=[[Main Page]]
17266 !! wikitext
17267 __TOC__
17268 == Image [[Image:foobar.jpg]] ==
17269 !! html
17270 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17271 <ul>
17272 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17273 </ul>
17274 </div>
17275
17276 <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>
17277
17278 !! end
17279
17280 !! test
17281 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17282 !! options
17283 title=[[Main Page]]
17284 !! wikitext
17285 __TOC__
17286 == <blockquote>Quote</blockquote> ==
17287 !! html
17288 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17289 <ul>
17290 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17291 </ul>
17292 </div>
17293
17294 <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>
17295
17296 !! end
17297
17298 !! test
17299 Unclosed tags in TOC
17300 !! options
17301 title=[[Main Page]]
17302 !! wikitext
17303 __TOC__
17304 == Proof: 2 < 3 ==
17305 <small>Hanc marginis exiguitas non caperet.</small>
17306 QED
17307 !! html
17308 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17309 <ul>
17310 <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>
17311 </ul>
17312 </div>
17313
17314 <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>
17315 <p><small>Hanc marginis exiguitas non caperet.</small>
17316 QED
17317 </p>
17318 !! end
17319
17320 !! test
17321 Multiple tags in TOC
17322 !! wikitext
17323 __TOC__
17324 == <i>Foo</i> <b>Bar</b> ==
17325
17326 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17327 !! html
17328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17329 <ul>
17330 <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>
17331 <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>
17332 </ul>
17333 </div>
17334
17335 <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>
17336 <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>
17337
17338 !! end
17339
17340 !! test
17341 Tags with parameters in TOC
17342 !! wikitext
17343 __TOC__
17344 == <sup class="in-h2">Hello</sup> ==
17345
17346 == <sup class="a > b">Evilbye</sup> ==
17347 !! html
17348 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17349 <ul>
17350 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17351 <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>
17352 </ul>
17353 </div>
17354
17355 <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>
17356 <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>
17357
17358 !! end
17359
17360 !! test
17361 span tags with directionality in TOC
17362 !! wikitext
17363 __TOC__
17364 == <span dir="ltr">C++</span> ==
17365
17366 == <span dir="rtl">זבנג!</span> ==
17367
17368 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17369
17370 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17371
17372 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17373 !! html
17374 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17375 <ul>
17376 <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>
17377 <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>
17378 <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>
17379 <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>
17380 <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>
17381 </ul>
17382 </div>
17383
17384 <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>
17385 <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>
17386 <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>
17387 <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>
17388 <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>
17389
17390 !! end
17391
17392 !! article
17393 MediaWiki:Bug32057
17394 !! text
17395 == {{int:headline_sample}} ==
17396 !! endarticle
17397
17398 !! test
17399 Bug 32057: Title needed when expanding <h> nodes.
17400 !! options
17401 title=[[Main Page]]
17402 !! wikitext
17403 {{int:Bug32057}}
17404 !! html
17405 <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>
17406
17407 !! end
17408
17409 !! test
17410 Strip marker in urlencode
17411 !! wikitext
17412 {{urlencode:x<nowiki/>y}}
17413 {{urlencode:x<nowiki/>y|wiki}}
17414 {{urlencode:x<nowiki/>y|path}}
17415 !! html
17416 <p>xy
17417 xy
17418 xy
17419 </p>
17420 !! end
17421
17422 !! test
17423 Strip marker in lc
17424 !! wikitext
17425 {{lc:x<nowiki/>y}}
17426 !! html
17427 <p>xy
17428 </p>
17429 !! end
17430
17431 !! test
17432 Strip marker in uc
17433 !! wikitext
17434 {{uc:x<nowiki/>y}}
17435 !! html
17436 <p>XY
17437 </p>
17438 !! end
17439
17440 !! test
17441 Strip marker in formatNum
17442 !! wikitext
17443 {{formatnum:1<nowiki/>2}}
17444 {{formatnum:1<nowiki/>2|R}}
17445 !! html
17446 <p>12
17447 12
17448 </p>
17449 !! end
17450
17451 !! test
17452 Check noCommafy in formatNum
17453 !! options
17454 language=be-tarask
17455 !! wikitext
17456 {{formatnum:123456.78}}
17457 {{formatnum:123456.78|NOSEP}}
17458 !! html
17459 <p>123 456,78
17460 123456.78
17461 </p>
17462 !! end
17463
17464 !! test
17465 Wrong option for formatNum (bug 56199)
17466 !! wikitext
17467 {{formatnum:1,234.56|Random}}
17468 {{formatnum:1,234.56|EVERYTHING}}
17469 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17470 !! html
17471 <p>1,234.56
17472 1,234.56
17473 1,234.56
17474 </p>
17475 !! end
17476
17477 !! test
17478 Strip marker in grammar
17479 !! options
17480 language=fi
17481 !! wikitext
17482 {{grammar:elative|foo<nowiki/>bar}}
17483 !! html
17484 <p>foobarista
17485 </p>
17486 !! end
17487
17488 !! test
17489 Strip marker in padleft
17490 !! wikitext
17491 {{padleft:|2|x<nowiki/>y}}
17492 !! html
17493 <p>xy
17494 </p>
17495 !! end
17496
17497 !! test
17498 Strip marker in padright
17499 !! wikitext
17500 {{padright:|2|x<nowiki/>y}}
17501 !! html
17502 <p>xy
17503 </p>
17504 !! end
17505
17506 !! test
17507 Strip marker in anchorencode
17508 !! wikitext
17509 {{anchorencode:x<nowiki/>y}}
17510 !! html
17511 <p>xy
17512 </p>
17513 !! end
17514
17515 !! test
17516 nowiki inside link inside heading (bug 18295)
17517 !! wikitext
17518 ==[[foo|x<nowiki>y</nowiki>z]]==
17519 !! html
17520 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17521
17522 !! end
17523
17524 !! test
17525 new support for bdi element (bug 31817)
17526 !! wikitext
17527 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17528 !! html
17529 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17530
17531 !!end
17532
17533 !! test
17534 Ignore pipe between table row attributes
17535 !! wikitext
17536 {|
17537 | quux
17538 |- id=foo | style='color: red'
17539 | bar
17540 |}
17541 !! html
17542 <table>
17543 <tr>
17544 <td> quux
17545 </td></tr>
17546 <tr id="foo" style="color: red">
17547 <td> bar
17548 </td></tr></table>
17549
17550 !! end
17551
17552 !!test
17553 Gallery override link with WikiLink (bug 34852)
17554 !! wikitext
17555 <gallery>
17556 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17557 </gallery>
17558 !! html
17559 <ul class="gallery mw-gallery-traditional">
17560 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17561 <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>
17562 <div class="gallerytext">
17563 <p>caption
17564 </p>
17565 </div>
17566 </div></li>
17567 </ul>
17568
17569 !! end
17570
17571 !!test
17572 Gallery override link with absolute external link (bug 34852)
17573 !! wikitext
17574 <gallery>
17575 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17576 </gallery>
17577 !! html
17578 <ul class="gallery mw-gallery-traditional">
17579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17580 <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>
17581 <div class="gallerytext">
17582 <p>caption
17583 </p>
17584 </div>
17585 </div></li>
17586 </ul>
17587
17588 !! end
17589
17590 !!test
17591 Gallery override link with malicious javascript (bug 34852)
17592 !! wikitext
17593 <gallery>
17594 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17595 </gallery>
17596 !! html
17597 <ul class="gallery mw-gallery-traditional">
17598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17599 <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>
17600 <div class="gallerytext">
17601 <p>caption
17602 </p>
17603 </div>
17604 </div></li>
17605 </ul>
17606
17607 !! end
17608
17609 !!test
17610 Gallery with invalid title as link (bug 43964)
17611 !! wikitext
17612 <gallery>
17613 File:foobar.jpg|link=<
17614 </gallery>
17615 !! html
17616 <ul class="gallery mw-gallery-traditional">
17617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17618 <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>
17619 <div class="gallerytext">
17620 </div>
17621 </div></li>
17622 </ul>
17623
17624 !! end
17625
17626 !!test
17627 Language parser function
17628 !! wikitext
17629 {{#language:ar}}
17630 !! html
17631 <p>العربية
17632 </p>
17633 !! end
17634
17635 !!test
17636 Padleft and padright as substr
17637 !! wikitext
17638 {{padleft:|3|abcde}}
17639 {{padright:|3|abcde}}
17640 !! html
17641 <p>abc
17642 abc
17643 </p>
17644 !! end
17645
17646 !!test
17647 Special parser function
17648 !! wikitext
17649 {{#special:RandomPage}}
17650 {{#special:BaDtItLe}}
17651 {{#special:Foobar}}
17652 !! html
17653 <p>Special:Random
17654 Special:Badtitle
17655 Special:Foobar
17656 </p>
17657 !! end
17658
17659 !!test
17660 Bug 34939 - Case insensitive link parsing ([HttP://])
17661 !! wikitext
17662 [HttP://MediaWiki.Org/]
17663 !! html
17664 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17665 </p>
17666 !! end
17667
17668 !!test
17669 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17670 !! wikitext
17671 [HttP://MediaWiki.Org/ MediaWiki]
17672 !! html
17673 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17674 </p>
17675 !! end
17676
17677 !!test
17678 Bug 34939 - Case insensitive link parsing (HttP://)
17679 !! wikitext
17680 HttP://MediaWiki.Org/
17681 !! html
17682 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17683 </p>
17684 !! end
17685
17686 !!test
17687 Disable TOC
17688 !! options
17689 notoc
17690 !! wikitext
17691 Lead
17692 == Section 1 ==
17693 == Section 2 ==
17694 == Section 3 ==
17695 == Section 4 ==
17696 == Section 5 ==
17697 !! html
17698 <p>Lead
17699 </p>
17700
17701 <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>
17702 <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>
17703 <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>
17704 <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>
17705 <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>
17706
17707 !! end
17708
17709
17710 ###
17711 ### Parsoids-specific tests
17712 ### Parsoid-PHP parser incompatibilities
17713 ###
17714 !!test
17715 1. SOL-sensitive wikitext tokens as template-args
17716 !!options
17717 parsoid=wt2html,wt2wt
17718 !! wikitext
17719 {{echo|*a}}
17720 {{echo|#a}}
17721 {{echo|:a}}
17722 !! html
17723 <span about="#mwt1" typeof="mw:Transclusion">
17724 </span><ul about="#mwt1"><li>a</li>
17725 </ul>
17726 <span about="#mwt2" typeof="mw:Transclusion">
17727 </span><ol about="#mwt2"><li>a</li>
17728 </ol>
17729 <span about="#mwt3" typeof="mw:Transclusion">
17730 </span><dl about="#mwt3"><dd>a</dd>
17731 </dl>
17732 !!end
17733
17734 #### ----------------------------------------------------------------
17735 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17736 #### tags. Parsoid's output for these tags differs from that of the
17737 #### PHP parser.
17738 #### ----------------------------------------------------------------
17739
17740 !!test
17741 Ref: 1. ref-location should be replaced with an index span
17742 !!options
17743 parsoid
17744 !! wikitext
17745 A <ref>foo</ref>
17746 B <ref name="x">foo</ref>
17747 C <ref name="y" />
17748 !! html
17749 <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>
17750 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>
17751 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>
17752 !!end
17753
17754 !!test
17755 Ref: 2. ref-tags with identical names should all get the same index
17756 !!options
17757 parsoid
17758 !! wikitext
17759 A <ref name="x">foo</ref>
17760 B <ref name="x" />
17761 !! html
17762 <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>
17763 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>
17764 !!end
17765
17766 !!test
17767 Ref: 3. spaces in ref-names should be ignored
17768 !!options
17769 parsoid
17770 !! wikitext
17771 A <ref name="x">foo</ref>
17772 B <ref name=" x " />
17773 C <ref name= x />
17774 !! html
17775 <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>
17776 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>
17777 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>
17778 !!end
17779
17780 !!test
17781 Ref: 4. 'constructor' should be accepted as a valid ref-name
17782 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17783 !!options
17784 parsoid
17785 !! wikitext
17786 A <ref name="constructor">foo</ref>
17787 !! html
17788 <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>
17789 !!end
17790
17791 !!test
17792 Ref: 5. body should accept generic wikitext
17793 !!options
17794 parsoid
17795 !! wikitext
17796 A <ref>
17797 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17798 </ref>
17799
17800 <references />
17801 !! html
17802 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"dsr\":[55,76,null,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]]}&#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>
17803
17804 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17805 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
17806 </li>
17807 </ol>
17808 !!end
17809
17810 !!test
17811 Ref: 6. indent-pres should not be output in ref-body
17812 !!options
17813 parsoid
17814 !! wikitext
17815 A <ref>
17816 foo
17817 bar
17818 baz
17819 </ref>
17820
17821 <references />
17822 !! html
17823 <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>
17824
17825 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17826 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17827 bar
17828 baz
17829 </li>
17830 </ol>
17831 !!end
17832
17833 !!test
17834 Ref: 7. No p-wrapping in ref-body
17835 !!options
17836 parsoid
17837 !! wikitext
17838 A <ref>
17839 foo
17840
17841 bar
17842
17843
17844 baz
17845
17846
17847
17848 booz
17849 </ref>
17850
17851 <references />
17852 !! html
17853 <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>
17854
17855 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17856 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17857
17858 bar
17859
17860
17861 baz
17862
17863
17864
17865 booz
17866 </li>
17867 </ol>
17868 !!end
17869
17870 !!test
17871 Ref: 8. transclusion wikitext has lower precedence
17872 !!options
17873 parsoid
17874 !! wikitext
17875 A <ref> foo {{echo|</ref> B C}}
17876
17877 <references />
17878 !! html
17879 <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>
17880 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17881 <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>
17882 </ol>
17883 !!end
17884
17885 !!test
17886 Ref: 9. unclosed comments should not leak out of ref-body
17887 !!options
17888 parsoid
17889 !! wikitext
17890 A <ref> foo <!--</ref> B C
17891 <references />
17892 !! html
17893 <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>
17894 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17895 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17896 </ol>
17897 !!end
17898
17899 !!test
17900 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17901 !!options
17902 parsoid
17903 !! wikitext
17904 A <ref> <b> foo </ref> B C
17905
17906 <references />
17907 !! html
17908 <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>
17909
17910
17911 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17912 <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>
17913 </ol>
17914 !!end
17915
17916 !!test
17917 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17918 !!options
17919 parsoid
17920 !! wikitext
17921 A <ref>foo</ref> B
17922 C <ref>bar</ref> D
17923 !! html
17924 <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
17925 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>
17926 !!end
17927
17928 !!test
17929 Ref: 12. ref-tags act as trailing newline migration barrier
17930 !!options
17931 parsoid
17932 !! wikitext
17933 <!--the newline at the end of this line moves out of the p-tag-->a
17934
17935 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17936 <ref />
17937
17938 c
17939 !! html
17940 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17941
17942
17943 <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>
17944 <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>
17945
17946
17947 <p>c</p>
17948 !!end
17949
17950 !!test
17951 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17952 !!options
17953 parsoid
17954 !! wikitext
17955 <ref>foo</ref> A
17956 <ref>bar
17957 </ref> B
17958 !! html
17959 <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
17960 <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>
17961 !!end
17962
17963 !!test
17964 Ref: 14. A nested ref-tag should be emitted as plain text
17965 !!options
17966 parsoid
17967 !! wikitext
17968 <ref>foo <ref>bar</ref> baz</ref>
17969
17970 <references />
17971 !! html
17972 <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>
17973
17974 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17975 <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>
17976 </ol>
17977 !!end
17978
17979 !!test
17980 Ref: 15. ref-tags with identical names should get identical indexes
17981 !!options
17982 parsoid
17983 !! wikitext
17984 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17985 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17986
17987 <references />
17988 !! html
17989 <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>
17990 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>
17991
17992 <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>
17993 </ol>
17994 !!end
17995
17996 ## We don't bother wt2wt-ing non-standard whitespace
17997 !!test
17998 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17999 !!options
18000 parsoid=wt2html
18001 !! wikitext
18002 A <ref >foo</ref >
18003
18004 <references />
18005 !! html
18006 <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>
18007
18008 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18009 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18010 !!end
18011
18012 !!test
18013 References: 1. references tag without any refs should be handled properly
18014 !!options
18015 parsoid
18016 !! wikitext
18017 <references />
18018 !! html
18019 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18020 !!end
18021
18022 !!test
18023 References: 2. references tag with group only outputs references from that group
18024 !!options
18025 parsoid
18026 !! wikitext
18027 A <ref group="a">foo</ref>
18028 B <ref group="b">bar</ref>
18029
18030 <references group="a" />
18031 !! html
18032 <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>
18033 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>
18034
18035 <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>
18036 </ol>
18037 !!end
18038
18039 !!test
18040 References: 3. ref list should be cleared after processing references
18041 !!options
18042 parsoid
18043 !! wikitext
18044 A <ref>foo</ref>
18045
18046 <references />
18047
18048 B <ref>bar</ref>
18049
18050 <references />
18051 !! html
18052 <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>
18053
18054 <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>
18055 </ol>
18056
18057 <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>
18058
18059 <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>
18060 </ol>
18061 !!end
18062
18063 !!test
18064 References: 4. only referenced group should be cleared after processing references
18065 !!options
18066 parsoid
18067 !! wikitext
18068 A <ref group="a">afoo</ref>
18069 B <ref>bfoo</ref>
18070
18071 <references group="a" />
18072
18073 C <ref>cfoo</ref>
18074
18075 <references />
18076 !! html
18077 <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>
18078 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>
18079
18080 <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>
18081 </ol>
18082
18083 <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>
18084
18085 <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>
18086 </ol>
18087 !!end
18088
18089 !!test
18090 References: 5. ref tags in references should be processed while ignoring all other content
18091 !!options
18092 parsoid
18093 !! wikitext
18094 A <ref name="a" />
18095 B <ref name="b">bar</ref>
18096
18097 <references>
18098 <ref name="a">foo</ref>
18099 This should just get lost.
18100 </references>
18101 !! html
18102 <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>
18103 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>
18104
18105
18106 <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":{}}'>
18107 <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>
18108 <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>
18109 </ol>
18110 !!end
18111
18112 !!test
18113 References: 6. <references /> from a transclusion
18114 !!options
18115 parsoid
18116 !! wikitext
18117 <ref>Foo</ref> {{echo|<references />}}
18118 !! html
18119 <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>
18120 !!end
18121
18122 !! test
18123 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18124 !! options
18125 parsoid
18126 !! wikitext
18127 A <ref>foo bar for a</ref>
18128 B <ref group="X" name="b" />
18129
18130 <references />
18131
18132 <references group="X">
18133 <ref name="b">foo</ref>
18134 </references>
18135 !! html
18136 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-2" data-parsoid="{}">[2]</a></span>
18137 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-3-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\" group=\"X\" />"}'><a href="#cite_note-b-3" data-parsoid="{}">[X 1]</a></span></p>
18138
18139 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}">↑</span> foo</li><li about="#cite_note-2" id="cite_note-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-2-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
18140
18141 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-b-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-3" id="cite_note-b-3" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-3-0" data-parsoid="{}">↑</a></span> </li></ol>
18142 !! end
18143
18144 # This test is wt2html only because we're permitting the serializer to produce
18145 # dirty diffs, normalizing the unclosed references to the self-closed version.
18146 !! test
18147 Generate references for unclosed references tag
18148 !! options
18149 parsoid=wt2html
18150 !! wikitext
18151 a<ref>foo</ref>
18152
18153 <references>
18154 !! html
18155 <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>
18156
18157
18158 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18159 <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>
18160 !! end
18161
18162 !! test
18163 New reference serializes on its own line
18164 !! options
18165 parsoid=wt2wt,html2wt
18166 !! wikitext
18167 foo
18168 <references />
18169 !! html
18170 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18171 !! end
18172
18173 #### ----------------------------------------------------------------
18174 #### The following section of tests are primarily to test
18175 #### wikitext escaping capabilities of Parsoid. Given that
18176 #### escaping can be done any number of ways, the wikitext (input)
18177 #### is always adjusted to reflect how Parsoid adds nowiki
18178 #### escape tags.
18179 ####
18180 #### We are marking several tests as parsoid-only since the
18181 #### HTML in the result section is different from what the
18182 #### PHP parser generates for it.
18183 #### ----------------------------------------------------------------
18184
18185
18186 #### --------------- Headings ---------------
18187 #### 0. Unnested
18188 #### 1. Nested inside html <h1>=foo=</h1>
18189 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18190 #### 3. Nested inside html with wikitext split by html tags
18191 #### 4. No escape needed
18192 #### 5. Empty headings <h1></h1>
18193 #### 6. Heading chars in SOL context
18194 #### ----------------------------------------
18195 !! test
18196 Headings: 0. Unnested
18197 !! options
18198 parsoid
18199 !! wikitext
18200 <nowiki>=foo=</nowiki>
18201
18202 <nowiki> =foo= </nowiki>
18203 <!--cmt-->
18204 <nowiki>=foo=</nowiki>
18205
18206 =foo''a''<nowiki>=</nowiki>
18207 !! html
18208 <p><span typeof="mw:Nowiki">=foo=</span></p>
18209
18210 <p><span typeof="mw:Nowiki"> =foo= </span>
18211 <!--cmt-->
18212 <span typeof="mw:Nowiki">=foo=</span></p>
18213
18214 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18215 !!end
18216
18217 !! test
18218 Headings: 1. Nested inside html
18219 (New headings and existing headings are handled differently)
18220 !! options
18221 parsoid=html2wt
18222 !! wikitext
18223 = =foo= =
18224
18225 == =foo= ==
18226
18227 === =foo= ===
18228
18229 =<nowiki>=foo=</nowiki>=
18230 ==<nowiki>=foo=</nowiki>==
18231 ===<nowiki>=foo=</nowiki>===
18232 ====<nowiki>=foo=</nowiki>====
18233 =====<nowiki>=foo=</nowiki>=====
18234 ======<nowiki>=foo=</nowiki>======
18235
18236 !! html
18237 <h1>=foo=</h1>
18238 <h2>=foo=</h2>
18239 <h3>=foo=</h3>
18240
18241 <h1 data-parsoid='{}'>=foo=</h1>
18242 <h2 data-parsoid='{}'>=foo=</h2>
18243 <h3 data-parsoid='{}'>=foo=</h3>
18244 <h4 data-parsoid='{}'>=foo=</h4>
18245 <h5 data-parsoid='{}'>=foo=</h5>
18246 <h6 data-parsoid='{}'>=foo=</h6>
18247 !!end
18248
18249 !! test
18250 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18251 !! options
18252 parsoid=html2wt
18253 !! wikitext
18254 = foo =
18255 <nowiki>*</nowiki>bar
18256
18257 = foo =
18258 =bar
18259
18260 = foo =
18261 <nowiki>=bar=</nowiki>
18262 !! html
18263 <h1>foo</h1>*bar
18264 <h1>foo</h1>=bar
18265 <h1>foo</h1>=bar=
18266 !!end
18267
18268 !! test
18269 Headings: 3. Nested inside html with wikitext split by html tags
18270 !! options
18271 parsoid=html2wt
18272 !! wikitext
18273 = ='''bold'''<nowiki>foo=</nowiki> =
18274 !! html
18275 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18276 !!end
18277
18278 !! test
18279 Headings: 4a. No escaping needed (testing just h1 and h2)
18280 !! options
18281 parsoid=html2wt
18282 !! wikitext
18283 = =foo =
18284
18285 = foo= =
18286
18287 = =foo= =
18288
18289 = =foo= bar =
18290
18291 == =foo ==
18292
18293 == foo= ==
18294
18295 = ''=''foo= =
18296
18297 = <nowiki>=</nowiki> =
18298 !! html
18299 <h1>=foo</h1>
18300 <h1>foo=</h1>
18301 <h1> =foo= </h1>
18302 <h1>=foo= bar</h1>
18303 <h2>=foo</h2>
18304 <h2>foo=</h2>
18305 <h1><i>=</i>foo=</h1>
18306 <h1><span typeof="mw:Nowiki">=</span></h1>
18307 !!end
18308
18309 !! test
18310 Headings: 4b. No escaping needed (inside p-tags)
18311 !! options
18312 parsoid=html2wt
18313 !! wikitext
18314 ===
18315 =foo= x
18316 =foo= <s></s>
18317 !! html
18318 <p>===
18319 =foo= x
18320 =foo= <s></s>
18321 </p>
18322 !!end
18323
18324 !! test
18325 Headings: 5. Empty headings
18326 !! options
18327 parsoid
18328 !! wikitext
18329 =<nowiki/>=
18330
18331 ==<nowiki/>==
18332
18333 ===<nowiki/>===
18334
18335 ====<nowiki/>====
18336
18337 =====<nowiki/>=====
18338
18339 ======<nowiki/>======
18340 !! html
18341 <h1></h1>
18342 <h2></h2>
18343 <h3></h3>
18344 <h4></h4>
18345 <h5></h5>
18346 <h6></h6>
18347 !!end
18348
18349 !! test
18350 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18351 !! options
18352 parsoid
18353 !! wikitext
18354 <nowiki>=a=</nowiki>
18355
18356 <nowiki>=a=</nowiki>
18357
18358 <nowiki>=a=</nowiki>
18359
18360 <nowiki>=a=</nowiki>
18361 !! html
18362 <p>=a=</p>
18363 <p>=a= </p>
18364 <p>=a= </p>
18365 <p>=a= </p>
18366 !!end
18367
18368 !! test
18369 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18370 !! options
18371 parsoid
18372 !! wikitext
18373 <nowiki>=a=
18374 b</nowiki>
18375
18376 <nowiki>=a=
18377 b</nowiki>
18378
18379 <nowiki>=a=
18380 b</nowiki>
18381
18382 <nowiki>=a=
18383 b</nowiki>
18384 !! html
18385 <p>=a=
18386 b</p>
18387 <p>=a=
18388 b</p>
18389 <p>=a=
18390 b</p>
18391 <p>=a=
18392 b</p>
18393 </p>
18394 !!end
18395
18396 !! test
18397 Headings: 6c. Heading chars in SOL context (leading newline break)
18398 !! options
18399 parsoid
18400 !! wikitext
18401 a
18402 <nowiki>=b=</nowiki>
18403 !! html
18404 <p>a
18405 =b=</p>
18406 !!end
18407
18408 !! test
18409 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18410 !! options
18411 parsoid
18412 !! wikitext
18413 <!--c0--><nowiki>=a=</nowiki>
18414
18415 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18416 !! html
18417 <p><!--c0-->=a=</p>
18418 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18419 !!end
18420
18421 !! test
18422 Headings: 6d. Heading chars in SOL context (No escaping needed)
18423 !! options
18424 parsoid=html2wt
18425 !! wikitext
18426 =a=<div>b</div>
18427 !! html
18428 =a=<div>b</div>
18429 !!end
18430
18431 #### --------------- Lists ---------------
18432 #### 0. Outside nests (*foo, etc.)
18433 #### 1. Nested inside html <ul><li>*foo</li></ul>
18434 #### 2. Inside definition lists
18435 #### 3. Only bullets at start should be escaped
18436 #### 4. No escapes needed
18437 #### 5. No unnecessary escapes
18438 #### 6. Escape bullets in SOL position
18439 #### 7. Escape bullets in a multi-line context
18440 #### ----------------------------------------
18441
18442 !! test
18443 Lists: 0. Outside nests
18444 !! wikitext
18445 <nowiki>*</nowiki>foo
18446
18447 <nowiki>#</nowiki>foo
18448 !! html
18449 <p>*foo
18450 </p><p>#foo
18451 </p>
18452 !!end
18453
18454 !! test
18455 Lists: 1. Nested inside html
18456 !! wikitext
18457 *<nowiki>*foo</nowiki>
18458
18459 *<nowiki>#foo</nowiki>
18460
18461 *<nowiki>:foo</nowiki>
18462
18463 *<nowiki>;foo</nowiki>
18464
18465 #<nowiki>*foo</nowiki>
18466
18467 #<nowiki>#foo</nowiki>
18468
18469 #<nowiki>:foo</nowiki>
18470
18471 #<nowiki>;foo</nowiki>
18472 !! html
18473 <ul>
18474 <li>*foo
18475 </li>
18476 </ul>
18477 <ul>
18478 <li>#foo
18479 </li>
18480 </ul>
18481 <ul>
18482 <li>:foo
18483 </li>
18484 </ul>
18485 <ul>
18486 <li>;foo
18487 </li>
18488 </ul>
18489 <ol>
18490 <li>*foo
18491 </li>
18492 </ol>
18493 <ol>
18494 <li>#foo
18495 </li>
18496 </ol>
18497 <ol>
18498 <li>:foo
18499 </li>
18500 </ol>
18501 <ol>
18502 <li>;foo
18503 </li>
18504 </ol>
18505
18506 !!end
18507
18508 !! test
18509 Lists: 2. Inside definition lists
18510 !! wikitext
18511 ;<nowiki>;foo</nowiki>
18512
18513 ;<nowiki>:foo</nowiki>
18514
18515 ;<nowiki>:foo</nowiki>
18516 :bar
18517
18518 :<nowiki>:foo</nowiki>
18519 !! html
18520 <dl>
18521 <dt>;foo
18522 </dt>
18523 </dl>
18524 <dl>
18525 <dt>:foo
18526 </dt>
18527 </dl>
18528 <dl>
18529 <dt>:foo
18530 </dt>
18531 <dd>bar
18532 </dd>
18533 </dl>
18534 <dl>
18535 <dd>:foo
18536 </dd>
18537 </dl>
18538
18539 !!end
18540
18541 !! test
18542 Lists: 3. Only bullets at start of text should be escaped
18543 !! wikitext
18544 *<nowiki>*foo*bar</nowiki>
18545
18546 *<nowiki>*foo</nowiki>''it''*bar
18547 !! html
18548 <ul>
18549 <li>*foo*bar
18550 </li>
18551 </ul>
18552 <ul>
18553 <li>*foo<i>it</i>*bar
18554 </li>
18555 </ul>
18556
18557 !!end
18558
18559 !! test
18560 Lists: 4. No escapes needed
18561 !! options
18562 parsoid
18563 !! wikitext
18564 *foo*bar
18565
18566 *''foo''*bar
18567
18568 *[[Foo]]: bar
18569
18570 *[[Foo]]*bar
18571 !! html
18572 <ul>
18573 <li>foo*bar
18574 </li>
18575 </ul>
18576 <ul>
18577 <li><i>foo</i>*bar
18578 </li>
18579 </ul>
18580 <ul>
18581 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18582 </li>
18583 </ul>
18584 <ul>
18585 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18586 </li>
18587 </ul>
18588 !!end
18589
18590 !! test
18591 Lists: 5. No unnecessary escapes
18592 !! wikitext
18593 * bar <span><nowiki>[[foo]]</nowiki></span>
18594
18595 *=bar <span><nowiki>[[foo]]</nowiki></span>
18596
18597 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18598
18599 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18600
18601 *=bar <span>foo]]</span>=
18602
18603 * <s></s>: a
18604 !! html
18605 <ul>
18606 <li> bar <span>[[foo]]</span>
18607 </li>
18608 </ul>
18609 <ul>
18610 <li>=bar <span>[[foo]]</span>
18611 </li>
18612 </ul>
18613 <ul>
18614 <li>[[bar <span>[[foo]]</span>
18615 </li>
18616 </ul>
18617 <ul>
18618 <li>]]bar <span>[[foo]]</span>
18619 </li>
18620 </ul>
18621 <ul>
18622 <li>=bar <span>foo]]</span>=
18623 </li>
18624 </ul>
18625 <ul>
18626 <li> <s></s>: a
18627 </li>
18628 </ul>
18629
18630 !!end
18631
18632 !! test
18633 Lists: 6. Escape bullets in SOL position
18634 !! options
18635 parsoid
18636 !! wikitext
18637 <!--cmt--><nowiki>*foo</nowiki>
18638 !! html
18639 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18640 !!end
18641
18642 !! test
18643 Lists: 7. Escape bullets in a multi-line context
18644 !! wikitext
18645 a
18646 <nowiki>*</nowiki>b
18647 !! html
18648 <p>a
18649 *b
18650 </p>
18651 !!end
18652
18653 #### --------------- HRs ---------------
18654 #### 1. Single line
18655 #### -----------------------------------
18656
18657 !! test
18658 HRs: 1. Single line
18659 !! options
18660 parsoid
18661 !! wikitext
18662 ----<nowiki>----</nowiki>
18663 ----=foo=
18664 ----*foo
18665 !! html
18666 <hr><span typeof="mw:Nowiki">----</span>
18667 <hr>=foo=
18668 <hr>*foo
18669 !! end
18670
18671 #### --------------- Tables ---------------
18672 #### 1a. Simple example
18673 #### 1b. No escaping needed (!foo)
18674 #### 1c. No escaping needed (|foo)
18675 #### 1d. No escaping needed (|}foo)
18676 ####
18677 #### 2a. Nested in td (<td>foo|bar</td>)
18678 #### 2b. Nested in td (<td>foo||bar</td>)
18679 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18680 ####
18681 #### 3a. Nested in th (<th>foo!bar</th>)
18682 #### 3b. Nested in th (<th>foo!!bar</th>)
18683 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18684 ####
18685 #### 4a. Escape -
18686 #### 4b. Escape +
18687 #### 4c. No escaping needed
18688 #### --------------------------------------
18689
18690 !! test
18691 Tables: 1a. Simple example
18692 !! wikitext
18693 <nowiki>{|
18694 |}</nowiki>
18695 !! html
18696 <p>{|
18697 |}
18698 </p>
18699 !! end
18700
18701 !! test
18702 Tables: 1b. No escaping needed
18703 !! wikitext
18704 !foo
18705 !! html
18706 <p>!foo
18707 </p>
18708 !! end
18709
18710 !! test
18711 Tables: 1c. No escaping needed
18712 !! wikitext
18713 |foo
18714 !! html
18715 <p>|foo
18716 </p>
18717 !! end
18718
18719 !! test
18720 Tables: 1d. No escaping needed
18721 !! wikitext
18722 |}foo
18723 !! html
18724 <p>|}foo
18725 </p>
18726 !! end
18727
18728 !! test
18729 Tables: 2a. Nested in td
18730 !! options
18731 parsoid=html2wt
18732 !! wikitext
18733 {|
18734 |<nowiki>foo|bar</nowiki>
18735 |-
18736 |x<div><nowiki>a|b</nowiki></div>
18737 |}
18738 !! html
18739 <table><tbody><tr>
18740 <td>foo|bar</td></tr>
18741 <tr><td>x<div>a|b</div></td>
18742 </tbody></table>
18743 !! end
18744
18745 !! test
18746 Tables: 2b. Nested in td
18747 !! options
18748 parsoid
18749 !! wikitext
18750 {|
18751 |<nowiki>foo||bar</nowiki>
18752 |''it''<nowiki>foo||bar</nowiki>
18753 |}
18754 !! html
18755 <table><tbody><tr>
18756 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18757 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18758 !! end
18759
18760 !! test
18761 Tables: 2c. Nested in td -- no escaping needed
18762 !! options
18763 parsoid
18764 !! wikitext
18765 {|
18766 |foo!!bar
18767 |}
18768 !! html
18769 <table><tbody><tr><td>foo!!bar
18770 </td></tr></tbody></table>
18771
18772 !! end
18773
18774 !! test
18775 Tables: 3a. Nested in th
18776 !! options
18777 parsoid
18778 !! wikitext
18779 {|
18780 !foo!bar
18781 |}
18782 !! html
18783 <table><tbody><tr><th>foo!bar
18784 </th></tr></tbody></table>
18785
18786 !! end
18787
18788 !! test
18789 Tables: 3b. Nested in th
18790 !! options
18791 parsoid
18792 !! wikitext
18793 {|
18794 !<nowiki>foo!!bar</nowiki>
18795 |}
18796 !! html
18797 <table>
18798 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18799 </tbody></table>
18800 !! end
18801
18802 !! test
18803 Tables: 3c. Nested in th -- no escaping needed
18804 !! options
18805 parsoid
18806 !! wikitext
18807 {|
18808 !<nowiki>foo||bar</nowiki>
18809 |}
18810 !! html
18811 <table><tbody><tr>
18812 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18813 !! end
18814
18815 !! test
18816 Tables: 4a. Escape -
18817 !! options
18818 parsoid
18819 !! wikitext
18820 {|
18821 !-bar
18822 |-
18823 |<nowiki>-bar</nowiki>
18824 |}
18825 !! html
18826 <table><tbody>
18827 <tr><th>-bar</th></tr>
18828 <tr>
18829 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18830 !! end
18831
18832 !! test
18833 Tables: 4b. Escape +
18834 !! options
18835 parsoid
18836 !! wikitext
18837 {|
18838 !+bar
18839 |-
18840 |<nowiki>+bar</nowiki>
18841 |}
18842 !! html
18843 <table><tbody>
18844 <tr><th>+bar</th></tr>
18845 <tr>
18846 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18847 !! end
18848
18849 !! test
18850 Tables: 4c. No escaping needed
18851 !! options
18852 parsoid
18853 !! wikitext
18854 {|
18855 |foo-bar
18856 |foo+bar
18857 |-
18858 |''foo''-bar
18859 |''foo''+bar
18860 |-
18861 |foo
18862 bar|baz
18863 +bar
18864 -bar
18865 |-
18866 |x
18867 <div>a|b</div>
18868 |}
18869 !! html
18870 <table><tbody>
18871 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18872 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18873 <tr><td>foo
18874 <p>bar|baz
18875 +bar
18876 -bar</p></td></tr>
18877 <tr><td>x
18878 <div>a|b</div></td>
18879 </tbody></table>
18880 !! end
18881
18882 !! test
18883 Tables: 4d. No escaping needed
18884 !! options
18885 parsoid
18886 !! wikitext
18887 {|
18888 |[[Foo]]-bar
18889 ||+1
18890 ||-2
18891 |}
18892 !! html
18893 <table>
18894 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18895 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18896 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18897 </tbody></table>
18898 !! end
18899
18900 !! test
18901 Tables: Digest broken attributes on table and tr tag
18902 !! options
18903 parsoid=wt2html
18904 !! wikitext
18905 {| || |} ++
18906 |- || || ++ --
18907 |- > [
18908 |}
18909 !! html
18910 <table>
18911 <tbody>
18912 <tr></tr>
18913 <tr></tr>
18914 </tbody></table>
18915 !! end
18916
18917 #### --------------- Links ----------------
18918 #### 1. Quote marks in link text
18919 #### 2. Wikilinks: Escapes needed
18920 #### 3. Wikilinks: No escapes needed
18921 #### 4. Extlinks: Escapes needed
18922 #### 5. Extlinks: No escapes needed
18923 #### --------------------------------------
18924 !! test
18925 Links 1. Quote marks in link text
18926 !! options
18927 parsoid
18928 !! wikitext
18929 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18930 !! html
18931 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18932 !! end
18933
18934 !! test
18935 Links 2. WikiLinks: Escapes needed
18936 !! options
18937 parsoid
18938 !! wikitext
18939 [[Foo|[Foobar]]]
18940 [[Foo|<nowiki>Foobar]</nowiki>]]
18941 [[Foo|x [Foobar] x]]
18942 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18943 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18944 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18945 [[Foo|<nowiki>|Bar</nowiki>]]
18946 [[Foo|<nowiki>]]bar</nowiki>]]
18947 [[Foo|<nowiki>[[bar</nowiki>]]
18948 [[Foo|<nowiki>x [[ y</nowiki>]]
18949 [[Foo|<nowiki>x ]] y</nowiki>]]
18950 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18951 !! html
18952 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18953 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18954 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18955 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18956 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18957 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18958 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18959 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18960 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18961 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18962 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18963 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18964 !! end
18965
18966 !! test
18967 Links 3. WikiLinks: No escapes needed
18968 !! options
18969 parsoid
18970 !! wikitext
18971 [[Foo|[Foobar]]
18972 [[Foo|foo|bar]]
18973 !! html
18974 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18975 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18976 !! end
18977
18978 !! test
18979 Links 4. ExtLinks: Escapes needed
18980 !! options
18981 parsoid
18982 !! wikitext
18983 [http://google.com <nowiki>[google]</nowiki>]
18984 [http://google.com <nowiki>google]</nowiki>]
18985
18986 <nowiki>[http://google.com]</nowiki>
18987
18988 <nowiki>[http://google.com google]</nowiki>
18989
18990 !! html
18991 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18992 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18993 <p>[http://google.com]</p>
18994 <p>[http://google.com google]</p>
18995 !! end
18996
18997 !! test
18998 Links 5. ExtLinks: No escapes needed
18999 !! options
19000 parsoid
19001 !! wikitext
19002 [http://google.com [google]
19003 !! html
19004 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19005 !! end
19006
19007 #### --------------- Quotes ---------------
19008 #### 1. Quotes inside <b> and <i>
19009 #### 2. Link fragments separated by <i> and <b> tags
19010 #### 3. Link fragments inside <i> and <b>
19011 #### 4. No escaping needed
19012 #### --------------------------------------
19013 !! test
19014 1. Quotes inside <b> and <i>
19015 !! options
19016 parsoid=html2wt,wt2wt
19017 !! wikitext
19018 ''<nowiki>'foo'</nowiki>''
19019 ''<nowiki>''foo''</nowiki>''
19020 ''<nowiki>'''foo'''</nowiki>''
19021 ''foo''<nowiki/>'s
19022 '''<nowiki>'foo'</nowiki>'''
19023 '''<nowiki>''foo''</nowiki>'''
19024 '''<nowiki>'''foo'''</nowiki>'''
19025 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19026 '''foo'''<nowiki/>'s
19027 '''foo''
19028 ''foo''<nowiki/>'
19029 '<nowiki/>''foo''<nowiki/>'
19030 ''''foo'''
19031 '''foo'''<nowiki/>'
19032 '<nowiki/>'''foo'''<nowiki/>'
19033 ''fools'<span> errand</span>''
19034 ''<span>fool</span>'s errand''
19035 !! html
19036 <p><i>'foo'</i>
19037 <i>''foo''</i>
19038 <i>'''foo'''</i>
19039 <i>foo</i>'s
19040 <b>'foo'</b>
19041 <b>''foo''</b>
19042 <b>'''foo'''</b>
19043 <b>foo'<i>bar'</i>baz</b>
19044 <b>foo</b>'s
19045 '<i>foo</i>
19046 <i>foo</i>'
19047 '<i>foo</i>'
19048 '<b>foo</b>
19049 <b>foo</b>'
19050 '<b>foo</b>'</p>
19051 <i>fools'<span> errand</span></i>
19052 <i><span>fool</span>'s errand</i>
19053 !! end
19054
19055 !! test
19056 2. Link fragments separated by <i> and <b> tags
19057 !! wikitext
19058 [[''foo''<nowiki>hello]]</nowiki>
19059
19060 [['''foo'''<nowiki>hello]]</nowiki>
19061 !! html
19062 <p>[[<i>foo</i>hello]]
19063 </p><p>[[<b>foo</b>hello]]
19064 </p>
19065 !! end
19066
19067 !! test
19068 3. Link fragments inside <i> and <b>
19069 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19070 this is one of the shortcomings of this format)
19071 !! wikitext
19072 ''[[foo''<nowiki>]]</nowiki>
19073
19074 '''[[foo'''<nowiki>]]</nowiki>
19075 !! html
19076 <p><i>[[foo</i>]]
19077 </p><p><b>[[foo</b>]]
19078 </p>
19079 !! end
19080
19081 !! test
19082 4. No escaping needed
19083 !! wikitext
19084 '<span>''bar''</span>'
19085 '<span>'''bar'''</span>'
19086 !! html
19087 <p>'<span><i>bar</i></span>'
19088 '<span><b>bar</b></span>'
19089 </p>
19090 !! end
19091
19092 #### ----------- Paragraphs ---------------
19093 #### 1. No unnecessary escapes
19094 #### --------------------------------------
19095
19096 !! test
19097 1. No unnecessary escapes
19098 !! wikitext
19099 bar <span><nowiki>[[foo]]</nowiki></span>
19100
19101 =bar <span><nowiki>[[foo]]</nowiki></span>
19102
19103 [[bar <span><nowiki>[[foo]]</nowiki></span>
19104
19105 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19106
19107 =bar <span>foo]]</span><nowiki>=</nowiki>
19108 !! html
19109 <p>bar <span>[[foo]]</span>
19110 </p><p>=bar <span>[[foo]]</span>
19111 </p><p>[[bar <span>[[foo]]</span>
19112 </p><p>]]bar <span>[[foo]]</span>
19113 </p><p>=bar <span>foo]]</span>=
19114 </p>
19115 !!end
19116
19117 #### ----------------------- PRE --------------------------
19118 #### 1. Leading whitespace in SOL context should be escaped
19119 #### ------------------------------------------------------
19120 !! test
19121 1. Leading whitespace in SOL context should be escaped
19122 !! options
19123 parsoid
19124 !! wikitext
19125 <nowiki> </nowiki>a
19126
19127 <nowiki> </nowiki> a
19128
19129 <nowiki> </nowiki>a(tab)
19130
19131 <nowiki> </nowiki> a
19132 <!--cmt-->
19133 <nowiki> </nowiki> a
19134
19135 a
19136 <nowiki> </nowiki>b
19137
19138 a
19139 <nowiki> </nowiki>b
19140
19141 a
19142 <nowiki> </nowiki> b
19143 !! html
19144 <p> a</p>
19145 <p> a</p>
19146 <p> a(tab)</p>
19147 <p> a</p>
19148 <p><!--cmt--> a</p>
19149 <p>a
19150 b</p>
19151 <p>a
19152 b</p>
19153 <p>a
19154 b</p>
19155 !! end
19156
19157 #### --------------- Behavior Switches --------------------
19158 !! test
19159 1. Valid behavior switches should be escaped
19160 !! options
19161 parsoid=html2wt
19162 !! wikitext
19163 <nowiki>__TOC__</nowiki>
19164 !! html
19165 __TOC__
19166 !! end
19167
19168 !! test
19169 2. Invalid behavior switches should not be escaped
19170 !! options
19171 parsoid=html2wt
19172 !! wikitext
19173 __TOO__
19174 __|__
19175 !! html
19176 __TOO__
19177 __|__
19178 !! end
19179
19180 #### --------------- HTML tags ---------------
19181 #### 1. a tags
19182 #### 2. other tags
19183 #### 3. multi-line html tag
19184 #### 4. extension tags
19185 #### -----------------------------------------
19186 !! test
19187 1. a tags
19188 !! options
19189 parsoid
19190 !! wikitext
19191 <a href="http://google.com">google</a>
19192 !! html
19193 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19194 !! end
19195
19196 !! test
19197 2. other tags
19198 !! wikitext
19199 <nowiki><div>foo</div>
19200 <div style="color:red">foo</div></nowiki>
19201 !! html
19202 <p>&lt;div&gt;foo&lt;/div&gt;
19203 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19204 </p>
19205 !! end
19206
19207 !! test
19208 3. multi-line html tag
19209 !! wikitext
19210 <nowiki><div
19211 >foo</div
19212 ></nowiki>
19213 !! html
19214 <p>&lt;div
19215 &gt;foo&lt;/div
19216 &gt;
19217 </p>
19218 !! end
19219
19220 !! test
19221 4. extension tags
19222 !! wikitext
19223 <nowiki><ref>foo</ref></nowiki>
19224
19225 <nowiki><ref>bar</nowiki>
19226
19227 baz<nowiki></ref></nowiki>
19228 !! html
19229 <p>&lt;ref&gt;foo&lt;/ref&gt;
19230 </p><p>&lt;ref&gt;bar
19231 </p><p>baz&lt;/ref&gt;
19232 </p>
19233 !! end
19234
19235 #### --------------- Others ---------------
19236 !! test
19237 Escaping nowikis
19238 !! wikitext
19239 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19240 !! html
19241 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19242 </p>
19243 !! end
19244
19245 ## The quote-char in the input is necessary for triggering the bug
19246 !! test
19247 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19248 !! options
19249 parsoid=wt2wt,html2wt
19250 !! wikitext
19251 foo's bar :
19252 !! html
19253 <p>foo's bar :</p>
19254 !! end
19255
19256 !! test
19257
19258 Tag-like HTML structures are passed through as text
19259 !! wikitext
19260 <x y>
19261
19262 <x.y>
19263
19264 <x-y>
19265
19266 1>2
19267
19268 x<y
19269
19270 a>b
19271
19272 1<d e>f
19273 !! html
19274 <p>&lt;x y&gt;
19275 </p><p>&lt;x.y&gt;
19276 </p><p>&lt;x-y&gt;
19277 </p><p>1&gt;2
19278 </p><p>x&lt;y
19279 </p><p>a&gt;b
19280 </p><p>1&lt;d e&gt;f
19281 </p>
19282 !! end
19283
19284
19285 # This was a bug in the PHP parser (see bug 17663 and its dups,
19286 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19287 !! test
19288 Tag names followed by punctuation should not be recognized as tags
19289 !! wikitext
19290 <s.ome> text
19291 !! html
19292 <p>&lt;s.ome&gt; text
19293 </p>
19294 !! end
19295
19296 !! test
19297 HTML tag with necessary entities in attributes
19298 !! wikitext
19299 <span title="&amp;amp;">foo</span>
19300 !! html
19301 <p><span title="&amp;amp;">foo</span>
19302 </p>
19303 !! end
19304
19305 !! test
19306 HTML tag with 'unnecessary' entity encoding in attributes
19307 !! wikitext
19308 <span title="&amp;">foo</span>
19309 !! html
19310 <p><span title="&amp;">foo</span>
19311 </p>
19312 !! end
19313
19314 !! test
19315 HTML tag with broken attribute value quoting
19316 !! wikitext
19317 <span title="Hello world>Foo</span>
19318 !! html
19319 <p><span>Foo</span>
19320 </p>
19321 !! end
19322
19323 !! test
19324 Parsoid-only: HTML tag with broken attribute value quoting
19325 !! options
19326 parsoid
19327 !! wikitext
19328 <span title="Hello world>Foo</span>
19329 !! html
19330 <p><span title="Hello world">Foo</span>
19331 </p>
19332 !! end
19333
19334 !! test
19335 Table with broken attribute value quoting
19336 !! wikitext
19337 {|
19338 | title="Hello world|Foo
19339 |}
19340 !! html
19341 <table>
19342 <tr>
19343 <td>Foo
19344 </td></tr></table>
19345
19346 !! end
19347
19348 !! test
19349 Table with broken attribute value quoting on consecutive lines
19350 !! wikitext
19351 {|
19352 | title="Hello world|Foo
19353 | style="color:red|Bar
19354 |}
19355 !! html
19356 <table>
19357 <tr>
19358 <td>Foo
19359 </td>
19360 <td>Bar
19361 </td></tr></table>
19362
19363 !! end
19364
19365 !! test
19366 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19367 !! options
19368 parsoid
19369 !! wikitext
19370 {|
19371 | title="Hello world|Foo
19372 | style="color:red|Bar
19373 |}
19374 !! html
19375 <table><tbody>
19376 <tr>
19377 <td title="Hello world">Foo
19378 </td><td style="color: red">Bar
19379 </td></tr></tbody></table>
19380
19381 !! end
19382
19383 !! test
19384 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19385 !! options
19386 parsoid
19387 !! wikitext
19388 {{}}
19389 !! html
19390 {{}}
19391 !! end
19392
19393 !! test
19394 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19395 !! options
19396 parsoid
19397 !! wikitext
19398 }}{{
19399 !! html
19400 }}{{
19401 !! end
19402
19403 !!test
19404 Accept empty td cell attribute
19405 !! wikitext
19406 {|
19407 | align="center" | foo || |
19408 |}
19409 !! html
19410 <table>
19411 <tr>
19412 <td align="center"> foo </td>
19413 <td>
19414 </td></tr></table>
19415
19416 !!end
19417
19418 !!test
19419 Non-empty attributes in th-cells
19420 !! wikitext
19421 {|
19422 ! Foo !! style="color: red" | Bar
19423 |}
19424 !! html
19425 <table>
19426 <tr>
19427 <th> Foo </th>
19428 <th style="color: red"> Bar
19429 </th></tr></table>
19430
19431 !!end
19432
19433 !!test
19434 Accept empty attributes in th-cells
19435 !! wikitext
19436 {|
19437 !| foo !!| bar
19438 |}
19439 !! html
19440 <table>
19441 <tr>
19442 <th> foo </th>
19443 <th> bar
19444 </th></tr></table>
19445
19446 !!end
19447
19448 !!test
19449 Empty table rows go away
19450 !! wikitext
19451 {|
19452 | Hello
19453 | there
19454 |- class="foo"
19455 |-
19456 |}
19457 !! html
19458 <table>
19459 <tr>
19460 <td> Hello
19461 </td>
19462 <td> there
19463 </td></tr>
19464
19465 </table>
19466
19467 !! end
19468
19469 ###
19470 ### Parsoid-centric tests for testing RTing of inter-element separators
19471 ### Edge cases not tested by existing parser tests and specific to
19472 ### Parsoid-specific serialization strategies.
19473 ###
19474
19475 !!test
19476 RT-ed inter-element separators should be valid separators
19477 !! wikitext
19478 {|
19479 |- [[foo]]
19480 |}
19481 !! html
19482 <table>
19483
19484 </table>
19485
19486 !!end
19487
19488 !!test
19489 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19490 (Parsoid-only since PHP parser relies on Tidy for correct output)
19491 !!options
19492 parsoid
19493 !! wikitext
19494 {|
19495 |<small>foo
19496 bar
19497 |}
19498
19499 {|
19500 |<small>foo<small>
19501 |}
19502 !! html
19503 !!end
19504
19505 !!test
19506 Empty TD followed by TD with tpl-generated attribute
19507 !! wikitext
19508 {|
19509 |-
19510 |
19511 |{{echo|style='color:red'}}|foo
19512 |}
19513 !! html
19514 <table>
19515
19516 <tr>
19517 <td>
19518 </td>
19519 <td>foo
19520 </td></tr></table>
19521
19522 !!end
19523
19524 !!test
19525 Indented table with an empty td
19526 !! wikitext
19527 {|
19528 |-
19529 |
19530 |foo
19531 |}
19532 !! html
19533 <table>
19534
19535 <tr>
19536 <td>
19537 </td>
19538 <td>foo
19539 </td></tr></table>
19540
19541 !!end
19542
19543 !!test
19544 Empty TR followed by a template-generated TR
19545 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19546 !!options
19547 parsoid
19548 !! wikitext
19549 {|
19550 |-
19551 {{echo|<tr><td>foo</td></tr>}}
19552 |}
19553 !! html
19554 <table>
19555 <tbody>
19556 <tr></tr>
19557 <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}}]}'>
19558 <td>foo</td></tr>
19559 </tbody></table>
19560 !!end
19561
19562 ## PHP and parsoid output differ for this, and since this is primarily
19563 ## for testing Parsoid's serializer, marking this Parsoid only
19564 !!test
19565 Empty TR followed by mixed-ws-comment line should RT correctly
19566 !!options
19567 parsoid
19568 !! wikitext
19569 {|
19570 |-
19571 <!--c-->
19572 |-
19573 <!--c--> <!--d-->
19574 |}
19575 !! html
19576 <table>
19577 <tbody>
19578 <tr></tr>
19579 <!--c-->
19580 <tr>
19581 <!--c--> </tr><!--d-->
19582 </tbody></table>
19583
19584 !!end
19585
19586 !!test
19587 Multi-line image caption generated by templates with/without trailing newlines
19588 !!options
19589 parsoid
19590 !! wikitext
19591 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19592 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19593 !! html
19594 <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>
19595 <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>
19596
19597 !!end
19598
19599 !! test
19600 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19601 !! options
19602 parsoid=html2wt
19603 !! wikitext
19604 <includeonly>foo</includeonly>
19605 new para
19606
19607 [[./Category:Foo]]
19608
19609 = new heading =
19610 !! html
19611 <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>
19612
19613 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19614 !! end
19615
19616 ## PHP emits broken html for this, and since this is primarily
19617 ## a Parsoid serializer test, marking this Parsoid only
19618 !!test
19619 Improperly nested inline or quotes tags with whitespace in between
19620 !!options
19621 parsoid
19622 !! wikitext
19623 <span> <s>x</span> </s>
19624 ''' ''x''' ''
19625 !! html
19626 <p><span> <s>x</s></span><s> </s>
19627 <b> <i>x</i></b><i> </i>
19628 </p>
19629 !!end
19630
19631 !!test
19632 Encapsulate protected attributes from wt
19633 !!options
19634 parsoid
19635 !! wikitext
19636 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19637 !! html
19638 <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>
19639 </body>
19640 !!end
19641
19642 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19643 ## Having nested or stray pre tags results in the attempt to add duplicates,
19644 ## causing an assertion fail. This test tries to prevent that situation.
19645 !!test
19646 Ensure ParagraphWrapper can deal with stray closing pre tags
19647 !!options
19648 parsoid=wt2html
19649 !! wikitext
19650 plain text</pre>
19651 !! html
19652 plain text
19653 !!end
19654
19655 !!test
19656 1. Ensure fostered text content is wrapped in spans
19657 !!options
19658 parsoid=wt2html
19659 !! wikitext
19660 <table>hi</table><table>ho</table>
19661 !! html
19662 <span>hi</span>
19663 <table></table>
19664 <span>ho</span>
19665 <table></table>
19666 !!end
19667
19668 !!test
19669 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19670 !!options
19671 parsoid=wt2html,wt2wt
19672 !! wikitext
19673 <table>
19674 <tr> || ||
19675 <td> a
19676 </table>
19677 !! html
19678 <span> || ||</span>
19679 <table>
19680 <tbody>
19681 <tr>
19682 <td> a</td></tr>
19683 </tbody></table>
19684 !!end
19685
19686 !!test
19687 Encapsulation properly handles null DSR information from foster box
19688 !!options
19689 parsoid=wt2html,wt2wt
19690 !! wikitext
19691 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19692 !! html
19693 <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;
19694 <table>foo
19695 <tr>
19696 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19697 <table>
19698 <tbody>
19699 <tr>
19700 <td>bar</td></tr></tbody></table>
19701 !!end
19702
19703 !!test
19704 1. Encapsulate foster-parented transclusion content
19705 !!options
19706 parsoid=wt2wt,wt2html
19707 !! wikitext
19708 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19709 !! html
19710 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19711 <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
19712 <tr>
19713 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19714 <table>
19715 <tbody>
19716 <tr>
19717 <td>bar</td></tr></tbody></table>
19718 !!end
19719
19720 !!test
19721 2. Encapsulate foster-parented transclusion content
19722 !!options
19723 parsoid=wt2wt,wt2html
19724 !! wikitext
19725 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19726 !! html
19727 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19728 <table>
19729 <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>
19730 <tr>
19731 <td>bar</td></tr></table>&quot;]}">foo</div>
19732 <table>
19733 <tbody>
19734 <tr>
19735 <td>bar</td></tr></tbody></table>
19736 !!end
19737
19738 !!test
19739 3. Encapsulate foster-parented transclusion content
19740 !!options
19741 parsoid=wt2wt,wt2html
19742 !! wikitext
19743 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19744 !! html
19745 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19746 <table>
19747 <div>
19748 <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>
19749 <tr>
19750 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19751 <p>foo</p></div>
19752 <table>
19753 <tbody>
19754 <tr>
19755 <td>bar</td></tr></tbody></table>
19756 !!end
19757
19758 !!test
19759 4. Encapsulate foster-parented transclusion content
19760 !!options
19761 parsoid=wt2wt,wt2html
19762 !! wikitext
19763 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19764 !! html
19765 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19766 <table>
19767 <div>
19768 <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>
19769 <tr>
19770 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19771 <p>foo</p></div>
19772 <table>
19773 <tbody>
19774 <tr>
19775 <td>bar</td></tr></tbody></table>
19776 !!end
19777
19778 !!test
19779 5. Encapsulate foster-parented transclusion content
19780 !!options
19781 parsoid=wt2wt,wt2html
19782 !! wikitext
19783 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19784 !! html
19785 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19786 <table>
19787 <tr>
19788 <td>
19789 <div>
19790 <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>
19791 <table>
19792 <tbody>
19793 <tr>
19794 <td>
19795 <div>
19796 <p>foo</p></div></td></tr></tbody></table>
19797 !!end
19798
19799 !!test
19800 6. Encapsulate foster-parented transclusion content
19801 !!options
19802 parsoid=wt2wt,wt2html
19803 !! wikitext
19804 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19805 !! html
19806 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19807 <table>
19808 <tr>
19809 <td>
19810 <div>
19811 <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>
19812 <table>
19813 <tbody>
19814 <tr>
19815 <td>
19816 <div>
19817 <p>foo</p></div></td></tr></tbody></table>
19818 <p>ok</p>
19819 !!end
19820
19821 !!test
19822 7. Encapsulate foster-parented transclusion content
19823 !!options
19824 parsoid=wt2wt,wt2html
19825 !! wikitext
19826 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19827 !! html
19828 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19829 <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;
19830 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19831 <td>bar</td></table>&quot;]}">foo</p>
19832 <table>
19833 <tbody>
19834 <tr>
19835 <td>bar</td></tr></tbody></table>
19836 !!end
19837
19838 !!test
19839 8. Encapsulate foster-parented transclusion content
19840 !!options
19841 parsoid=wt2wt,wt2html
19842 !! wikitext
19843 {{echo|a
19844 }}{|{{echo|style='color:red'}}
19845 |-
19846 |b
19847 |}
19848 !! html
19849 <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>
19850 <table>
19851 <tbody>
19852 <tr>
19853 <td>b</td></tr></tbody></table>
19854 !!end
19855
19856 !!test
19857 9. Encapsulate foster-parented transclusion content
19858 !!options
19859 parsoid=wt2wt,wt2html
19860 !! wikitext
19861 <table>{{echo|hi</table>hello}}
19862 !! html
19863 <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>
19864 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
19865 !!end
19866
19867 !!test
19868 Table in fosterable position
19869 !!options
19870 parsoid=wt2html,wt2wt
19871 !! wikitext
19872 {{OpenTable}}
19873 <div>
19874 {|
19875 |}
19876 </div>
19877 |}
19878 !! html
19879 <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="{}">
19880 </span>
19881 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19882
19883 <table>
19884 </table>
19885 !!end
19886
19887 !!test
19888 Support <object> element with .data attribute
19889 !!options
19890 parsoid=html2wt
19891 !! wikitext
19892 <object data="test.swf"></object>
19893 !! html
19894 <object data="test.swf"></object>
19895 !!end
19896
19897 # -----------------------------------------------------------------
19898 # The following section of tests are primarily to spec requirements
19899 # around serialization of new/edited content.
19900 #
19901 # All these tests are marked Parsoid html2wt and html2html only
19902 # ----------------------------------------------------------------
19903
19904 !! test
19905 Image: Modifying size of an image (1)
19906 !! options
19907 parsoid={
19908 "modes": ["wt2wt"],
19909 "changes": [
19910 ["img[height]", "attr", "height", "22"],
19911 ["img[width]", "attr", "width", "200"]
19912 ]
19913 }
19914 !! wikitext
19915 [[Image:Foobar.jpg|230x230px]]
19916 !! wikitext/edited
19917 [[Image:Foobar.jpg|200x200px]]
19918 !!end
19919
19920 !! test
19921 Image: Modifying size of an image (2)
19922 !! options
19923 parsoid={
19924 "modes": ["wt2wt"],
19925 "changes": [
19926 ["img[height]", "attr", "height", "100"],
19927 ["img[width]", "attr", "width", "500"]
19928 ]
19929 }
19930 !! wikitext
19931 [[Image:Foobar.jpg|230x230px]]
19932 !! wikitext/edited
19933 [[Image:Foobar.jpg|500x500px]]
19934 !!end
19935
19936 # Change in size is ignored so long as class='mw-default-size'
19937 !! test
19938 Image: Modifying size of an image (3)
19939 !! options
19940 parsoid={
19941 "modes": ["wt2wt"],
19942 "changes": [
19943 ["figure[class]", "removeClass", "mw-default-size"],
19944 ["figure img", "attr", "height", "19"],
19945 ["figure img", "attr", "width", "170"]
19946 ]
19947 }
19948 !! wikitext
19949 [[Image:Foobar.jpg|thumb]]
19950 !! wikitext/edited
19951 [[Image:Foobar.jpg|thumb|170x170px]]
19952 !!end
19953
19954 !! test
19955 Image: Modifying alignment of an image (bug 48665)
19956 !! options
19957 parsoid={
19958 "modes": ["wt2wt"],
19959 "changes": [
19960 ["figure[class]", "removeClass", "mw-halign-right"],
19961 ["figure[class]", "addClass", "mw-halign-left"]
19962 ]
19963 }
19964 !! wikitext
19965 [[Image:Foobar.jpg|thumb|caption|right]]
19966 !! wikitext/edited
19967 [[Image:Foobar.jpg|thumb|caption|left]]
19968 !! end
19969
19970 !! test
19971 Image: Modifying mw-default-size of an frameless image (bug 62805)
19972 !! options
19973 parsoid={
19974 "modes": ["wt2wt"],
19975 "changes": [
19976 ["figure.mw-default-size", "removeClass", "mw-default-size"]
19977 ]
19978 }
19979 !! wikitext
19980 [[Image:Foobar.jpg|frameless|right]]
19981 !! wikitext/edited
19982 [[Image:Foobar.jpg|frameless|right|220x220px]]
19983 !! end
19984
19985 !! test
19986 Image: Modifying valign of an image (bug 49221)
19987 !! options
19988 parsoid={
19989 "modes": ["wt2wt"],
19990 "changes": [
19991 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
19992 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
19993 ]
19994 }
19995 !! wikitext
19996 [[File:Foobar.jpg|20px|middle]]
19997 !! wikitext/edited
19998 [[File:Foobar.jpg|20px|text-top]]
19999 !! end
20000
20001 !! test
20002 Image: Modifying alt attribute of an image (bug 56400)
20003 !! options
20004 parsoid={
20005 "modes": ["wt2wt"],
20006 "changes": [
20007 ["img[alt]", "attr", "alt", "some alternate edited text"]
20008 ]
20009 }
20010 !! wikitext
20011 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20012 !! wikitext/edited
20013 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20014 !!end
20015
20016 !! test
20017 Image: Modifying caption of an image
20018 !! options
20019 parsoid={
20020 "modes": ["wt2wt"],
20021 "changes": [
20022 ["figcaption", "text", "new caption"]
20023 ]
20024 }
20025 !! wikitext
20026 [[Image:Foobar.jpg|thumb|original caption]]
20027 !! wikitext/edited
20028 [[Image:Foobar.jpg|thumb|new caption]]
20029 !!end
20030
20031 !! test
20032 Image: empty alt attribute (bug 48924)
20033 !! options
20034 parsoid
20035 !! wikitext
20036 [[File:Foobar.jpg|thumb|alt=|bar]]
20037 !! html
20038 <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>
20039 !! end
20040
20041 #!! test
20042 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20043 #!! options
20044 #parsoid=html2wt
20045 #language=ar
20046 #!! input
20047 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20048 #!! result
20049 #<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>
20050 #!! end
20051
20052 !! test
20053 Image: Block level image should have \n before and after
20054 !! options
20055 parsoid
20056 !! wikitext
20057 123
20058 [[File:Foobar.jpg|right|thumb|150x150px]]
20059 456
20060 !! html
20061 <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>
20062 !!end
20063
20064 !! test
20065 Image: New block level image should have \n before and after (existing
20066 content)
20067 !! options
20068 parsoid
20069 !! wikitext
20070 123
20071 [[File:Foobar.jpg|right|thumb|150x150px]]
20072 456
20073 !! html
20074 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20075 <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>
20076 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20077 !!end
20078
20079 !! test
20080 Image: upright option (parsoid)
20081 !! options
20082 parsoid
20083 !! wikitext
20084 [[File:Foobar.jpg|thumb|upright|caption]]
20085 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20086 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20087 !! html
20088 <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="19" width="170"/></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>
20089 !!end
20090
20091 !! test
20092 Image: upright option is ignored on inline and frame images (parsoid)
20093 !! options
20094 parsoid
20095 !! wikitext
20096 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20097 !! html
20098 <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>
20099 !!end
20100
20101 !! test
20102 Image: from basic HTML (1)
20103 !! options
20104 parsoid=html2wt
20105 !! html/parsoid
20106 <span typeof="mw:Image">
20107 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20108 </span>
20109 !! wikitext
20110 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20111 !! end
20112
20113 !! test
20114 Image: from basic HTML (2)
20115 !! options
20116 parsoid=html2wt
20117 !! html/parsoid
20118 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20119 !! wikitext
20120 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20121 !! end
20122
20123 !! test
20124 Image: from basic HTML (3)
20125 !! options
20126 parsoid=html2wt
20127 !! html/parsoid
20128 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20129 !! wikitext
20130 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20131 !! end
20132
20133 !! test
20134 Image: from basic HTML (4)
20135 !! options
20136 parsoid=html2wt
20137 !! html/parsoid
20138 <img src="File:Foobar.jpg">
20139 !! wikitext
20140 [[File:Foobar.jpg|link=]]
20141 !! end
20142
20143 !! test
20144 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20145 !! options
20146 parsoid=html2wt
20147 !! wikitext
20148 * foo
20149 !! html
20150 <ul>
20151 <li><p>foo</p></li>
20152 </ul>
20153 !! end
20154
20155 !! test
20156 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20157 !! options
20158 parsoid=html2wt
20159 !! wikitext
20160 * foo
20161 !! html
20162 <ul> <li>foo</li></ul>
20163 !! end
20164
20165 !! test
20166 Don't strip leading whitespace when handling indent-pre suppressing tags
20167 !! options
20168 parsoid=html2wt
20169 !! wikitext
20170 {|
20171 | indented row
20172 |}
20173 <blockquote>
20174 '''This is very bold of you!'''
20175
20176 {|
20177 |
20178 indented cell (no pre-wrapping!)
20179 |}
20180 </blockquote>
20181 foo
20182 <div>bar</div>
20183 !! html
20184 <table>
20185 <tr><td> indented row</td></tr>
20186 </table>
20187 <blockquote><p>
20188 <b>This is very bold of you!</b>
20189 </p>
20190 <table><tr><td>
20191 indented cell (no pre-wrapping!)
20192 </td></tr></table>
20193 </blockquote>
20194 <p>foo</p>
20195 <div>bar</div>
20196 !! end
20197
20198 !! test
20199 Strip leading whitespace when handling indent-pre inducing tags
20200 !! options
20201 parsoid=html2wt
20202 !! wikitext
20203 foo
20204 <span>bar</span>
20205
20206 <span>foo2
20207 </span>bar2
20208
20209 <div>foo</div>
20210 <span>bar</span>
20211
20212 <div>
20213 <span>foo</span>
20214 </div>
20215 !! html
20216 <p>foo</p>
20217 <span>bar</span>
20218
20219 <span>foo2
20220 </span>bar2
20221
20222 <div>foo</div>
20223 <span>bar</span>
20224
20225 <div>
20226 <span>foo</span>
20227 </div>
20228 !! end
20229
20230 !! test
20231 Lists: Add space after bullets
20232 !! options
20233 parsoid=html2wt
20234 !! wikitext
20235 * foo
20236 * bar
20237 * <span> baz</span>
20238 !! html
20239 <ul>
20240 <li>foo</li>
20241 <li> bar</li>
20242 <li><span> baz</span></li>
20243 </ul>
20244 !! end
20245
20246 !! test
20247 Lists: Dont insert newlines in a serialized list item.
20248 !! options
20249 parsoid=html2wt
20250 !! wikitext
20251 * a<br>b
20252 * c
20253 !! html
20254 <ul><li>a<br>b</li><li>c</li></ul>
20255 !! end
20256
20257 !! test
20258 Headings: Add space before/after == (Bug 51744)
20259 !! options
20260 parsoid=html2wt
20261 !! wikitext
20262 == foo ==
20263
20264 == bar ==
20265
20266 == baz ==
20267
20268 == <span> baz</span> ==
20269 !! html
20270 <h2>foo</h2>
20271 <h2> bar</h2>
20272 <h2>baz </h2>
20273 <h2><span> baz</span></h2>
20274 !! end
20275
20276 !! test
20277 Parsoid: Serialize positional parameters with = in them as named parameter
20278 !! options
20279 parsoid=html2wt
20280 !! wikitext
20281 {{echo|1 = f=oo}}
20282
20283 {{echo|1 = f=oo|2 = bar}}
20284
20285 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20286 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20287 {{echo|<nowiki>f=oo</nowiki>|bar}}
20288 !! html
20289 <p about="#mwt1" typeof="mw:Transclusion"
20290 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20291
20292 <p about="#mwt1" typeof="mw:Transclusion"
20293 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20294
20295 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20296 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20297 <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>
20298 !! end
20299
20300 !! test
20301 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20302 !! options
20303 parsoid=html2wt
20304 !! wikitext
20305 <div>a
20306 b
20307 </div>
20308 <div>a
20309 b
20310 </div>
20311 <div>
20312 a
20313
20314 b
20315 </div>
20316 !! html
20317 <div>a<p>b</p></div>
20318 <div>a
20319 <p>b</p></div>
20320 <div>
20321 a
20322 <p>b</p></div>
20323 !! end
20324
20325 #-----------------------------
20326 # I/B quote minimization tests
20327 #-----------------------------
20328
20329 !! test
20330 1. I/B quote minimization: wikitext-only tags should be combined
20331 !! options
20332 parsoid=html2wt
20333 !! wikitext
20334 ''AB''
20335
20336 '''AB'''
20337
20338 ''A'''B'''''
20339
20340 '''A''B'''''
20341
20342 '''A''BC''D'''
20343
20344 '''''AB'''''
20345
20346 '''''AB'''''
20347
20348 '''''AB'''''
20349 !! html
20350 <p><i>A</i><i>B</i></p>
20351 <p><b>A</b><b>B</b></p>
20352 <p><i>A</i><b><i>B</i></b></p>
20353 <p><b>A</b><i><b>B</b></i></p>
20354 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20355 <p><i><b>A</b></i><i><b>B</b></i></p>
20356 <p><i><b>A</b></i><b><i>B</i></b></p>
20357 <p><b><i>A</i></b><i><b>B</b></i></p>
20358 !! end
20359
20360 !! test
20361 2. I/B quote minimization: wikitext and html tags should not be combined
20362 !! options
20363 parsoid=html2wt
20364 !! wikitext
20365 ''A''<i>B</i>
20366
20367 ''A'''''<i>B</i>'''
20368 !! html
20369 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20370 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20371 !! end
20372
20373 !! test
20374 3. I/B quote minimization: templated content stops minimization
20375 !! options
20376 parsoid=html2wt
20377 !! wikitext
20378 ''A''{{echo|''B''}}
20379
20380 ''A''{{echo|'''''B'''''}}
20381 !! html
20382 <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>
20383 <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>
20384 !! end
20385
20386 !! test
20387 4. I/B quote minimization: new content should be mimimized with adjacent old content
20388 !! options
20389 parsoid=html2wt
20390 !! wikitext
20391 ''AB''
20392
20393 '''AB'''
20394
20395 ''A'''B'''''
20396 !! html
20397 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20398 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20399 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20400 !! end
20401
20402 #------------------------------------
20403 # End of I/B quote minimization tests
20404 #------------------------------------
20405
20406 !!test
20407 Bug 54262: New entities
20408 !! options
20409 parsoid=html2wt
20410 !! wikitext
20411 foo
20412 !! html
20413 <span typeof="mw:Entity">foo</span>
20414 !! end
20415
20416 ## Note that there is no wikitext output for 'unknownproperty' ##
20417 ## Unknown magic words are silently dropped ##
20418
20419 !! test
20420 Magic words
20421 !! options
20422 parsoid=html2wt
20423 !! wikitext
20424 __TOC__
20425 __NOTOC__
20426 __FORCETOC__
20427 __INDEX__
20428 __NOINDEX__
20429 __NOGALLERY__
20430 __NOEDITSECTION__
20431 __NOTITLECONVERT__
20432 __NOCONTENTCONVERT__
20433 !! html
20434 <meta property='mw:PageProp/toc' />
20435 <meta property='mw:PageProp/notoc' />
20436 <meta property='mw:PageProp/forcetoc' />
20437 <meta property='mw:PageProp/index' />
20438 <meta property='mw:PageProp/noindex' />
20439 <meta property='mw:PageProp/nogallery' />
20440 <meta property='mw:PageProp/noeditsection' />
20441 <meta property='mw:PageProp/notitleconvert' />
20442 <meta property='mw:PageProp/nocontentconvert' />
20443 <meta property='mw:PageProp/unknownproperty' />
20444 !! end
20445
20446 !! test
20447 Consecutive <pre>s should not get merged
20448 !! options
20449 parsoid=html2wt,html2html
20450 !! wikitext
20451 a
20452
20453 b
20454
20455 c
20456
20457 d
20458
20459 e
20460
20461
20462
20463 f
20464 !! html
20465 <pre>a</pre><pre>b</pre>
20466
20467 <pre>c
20468 </pre><pre>
20469 d</pre>
20470
20471 <pre>e
20472
20473 </pre><pre>
20474
20475 f</pre>
20476 !! end
20477
20478 !! test
20479 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20480 !! options
20481 parsoid=html2wt
20482 !! wikitext
20483 [[Special:BookSources/1234567890|ISBN 1234567895]]
20484 !! html
20485 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20486 !! end
20487
20488 !! test
20489 Edited RFC links not serializable as RFC links should serialize as extlinks
20490 !! options
20491 parsoid=html2wt
20492 !! wikitext
20493 [//tools.ietf.org/html/rfc123 New RFC]
20494 !! html
20495 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20496 !! end
20497
20498 !! test
20499 Edited PMID links not serializable as PMID links should serialize as extlinks
20500 !! options
20501 parsoid=html2wt
20502 !! wikitext
20503 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20504 !! html
20505 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20506 !! end
20507
20508 !! test
20509 Edited Redirect link should emit a non-piped wikitext link
20510 !! options
20511 parsoid=html2wt
20512 !! wikitext
20513 #REDIRECT [[Bar]]
20514 !! html
20515 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20516 !! end
20517
20518 # -----------------------------------------------------------------
20519 # End of section for Parsoid-only html2wt tests for serialization
20520 # of new content
20521 # -----------------------------------------------------------------
20522
20523 TODO:
20524 more images
20525 more tables
20526 character entities
20527 and much more
20528 Try for 100% code coverage