c4bd12d50d58f7f1be565e3e2eaefae41f5ee2b5
[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>5
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 Image with page parameter
15310 !! options
15311 djvu
15312 !! wikitext
15313 [[File:LoremIpsum.djvu|page=2]]
15314 !! html
15315 <p><a href="/index.php?title=File:LoremIpsum.djvu&amp;page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a>
15316 </p>
15317 !! end
15318
15319 !! test
15320 Another italics / bold test
15321 !! wikitext
15322 ''' ''x'
15323 !! html
15324 <pre>'<i> </i>x'
15325 </pre>
15326 !!end
15327
15328 # Note the results may be incorrect, as parserTest output included this:
15329 # XML error: Mismatched tag at byte 6120:
15330 # ...<dd> </dt></dl> </dd...
15331 !! test
15332 dt/dd/dl test
15333 !! options
15334 disabled
15335 !! wikitext
15336 :;;;::
15337 !! html
15338 <dl>
15339 <dd><dl>
15340 <dt><dl>
15341 <dt><dl>
15342 <dt><dl>
15343 <dd><dl>
15344 <dd>
15345 </dd>
15346 </dl>
15347 </dd>
15348 </dl>
15349 </dt>
15350 </dl>
15351 </dt>
15352 </dl>
15353 </dt>
15354 </dl>
15355 </dd>
15356 </dl>
15357
15358 !!end
15359
15360
15361 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15362 !! test
15363 Images with the "|" character in the comment
15364 !! wikitext
15365 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15366 !! html
15367 <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>
15368
15369 !!end
15370
15371 !! test
15372 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15373 !! wikitext
15374 <html><script>alert(1);</script></html>
15375 !! html
15376 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15377 </p>
15378 !! end
15379
15380 !! test
15381 HTML with raw HTML ($wgRawHtml==true)
15382 !! options
15383 wgRawHtml=1
15384 !! wikitext
15385 <html><script>alert(1);</script></html>
15386 !! html
15387 <p><script>alert(1);</script>
15388 </p>
15389 !! end
15390
15391 !! test
15392 Parents of subpages, one level up
15393 !! options
15394 subpage title=[[Subpage test/L1/L2/L3]]
15395 !! wikitext
15396 [[../|L2]]
15397 !! html
15398 <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>
15399 </p>
15400 !! end
15401
15402
15403 !! test
15404 Parents of subpages, one level up, not named
15405 !! options
15406 subpage title=[[Subpage test/L1/L2/L3]]
15407 !! wikitext
15408 [[../]]
15409 !! html
15410 <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>
15411 </p>
15412 !! end
15413
15414
15415
15416 !! test
15417 Parents of subpages, two levels up
15418 !! options
15419 subpage title=[[Subpage test/L1/L2/L3]]
15420 !! wikitext
15421 [[../../|L1]]2
15422
15423 [[../../|L1]]l
15424 !! html
15425 <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
15426 </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>
15427 </p>
15428 !! end
15429
15430 !! test
15431 Parents of subpages, two levels up, without trailing slash or name.
15432 !! options
15433 subpage title=[[Subpage test/L1/L2/L3]]
15434 !! wikitext
15435 [[../..]]
15436 !! html
15437 <p>[[../..]]
15438 </p>
15439 !! end
15440
15441 !! test
15442 Parents of subpages, two levels up, with lots of extra trailing slashes.
15443 !! options
15444 subpage title=[[Subpage test/L1/L2/L3]]
15445 !! wikitext
15446 [[../../////]]
15447 !! html
15448 <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>
15449 </p>
15450 !! end
15451
15452 !! article
15453 Subpage test/L1/L2/L3Sibling
15454 !! text
15455 Sibling article
15456 !! endarticle
15457
15458 !! test
15459 Transclusion of a sibling page (one level up)
15460 !! options
15461 subpage title=[[Subpage test/L1/L2/L3]]
15462 !! wikitext
15463 {{../L3Sibling}}
15464 !! html
15465 <p>Sibling article
15466 </p>
15467 !! end
15468
15469 !! test
15470 Transclusion of a child page
15471 !! options
15472 subpage title=[[Subpage test/L1/L2]]
15473 !! wikitext
15474 {{/L3Sibling}}
15475 !! html
15476 <p>Sibling article
15477 </p>
15478 !! end
15479
15480 !! test
15481 Non-transclusion because of too many up levels
15482 !! options
15483 subpage title=[[Subpage test/L1/L2/L3]]
15484 !! wikitext
15485 {{../../../../More than parent}}
15486 !! html
15487 <p>{{../../../../More than parent}}
15488 </p>
15489 !! end
15490
15491 !! test
15492 Definition list code coverage
15493 !! wikitext
15494 ; title : def
15495 ; title : def
15496 ;title: def
15497 !! html
15498 <dl>
15499 <dt> title &#160;</dt>
15500 <dd> def
15501 </dd>
15502 <dt> title&#160;</dt>
15503 <dd> def
15504 </dd>
15505 <dt>title</dt>
15506 <dd> def
15507 </dd>
15508 </dl>
15509
15510 !! end
15511
15512 !! test
15513 Don't fall for the self-closing div
15514 !! wikitext
15515 <div>hello world</div/>
15516 !! html
15517 <div>hello world</div>
15518
15519 !! end
15520
15521 !! test
15522 MSGNW magic word
15523 !! wikitext
15524 {{MSGNW:msg}}
15525 !! html
15526 <p>&#91;&#91;:Template:Msg&#93;&#93;
15527 </p>
15528 !! end
15529
15530 !! test
15531 RAW magic word
15532 !! wikitext
15533 {{RAW:QUERTY}}
15534 !! html
15535 <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>
15536 </p>
15537 !! end
15538
15539 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15540 !! test
15541 Always escape literal '>' in output, not just after '<'
15542 !! wikitext
15543 ><>
15544 !! html
15545 <p>&gt;&lt;&gt;
15546 </p>
15547 !! end
15548
15549 !! test
15550 Template caching
15551 !! wikitext
15552 {{Test}}
15553 {{Test}}
15554 !! html
15555 <p>This is a test template
15556 This is a test template
15557 </p>
15558 !! end
15559
15560
15561 !! article
15562 MediaWiki:Fake
15563 !! text
15564 ==header==
15565 !! endarticle
15566
15567 !! test
15568 Inclusion of !userCanEdit() content
15569 !! wikitext
15570 {{MediaWiki:Fake}}
15571 !! html
15572 <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>
15573
15574 !! end
15575
15576
15577 !! test
15578 Out-of-order TOC heading levels
15579 !! wikitext
15580 ==2==
15581 ======6======
15582 ===3===
15583 =1=
15584 =====5=====
15585 ==2==
15586 !! html
15587 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15588 <ul>
15589 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15590 <ul>
15591 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15592 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15593 </ul>
15594 </li>
15595 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15596 <ul>
15597 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15598 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15599 </ul>
15600 </li>
15601 </ul>
15602 </div>
15603
15604 <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>
15605 <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>
15606 <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>
15607 <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>
15608 <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>
15609 <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>
15610
15611 !! end
15612
15613
15614 !! test
15615 ISBN with a dummy number
15616 !! wikitext
15617 ISBN ---
15618 !! html
15619 <p>ISBN ---
15620 </p>
15621 !! end
15622
15623
15624 !! test
15625 ISBN with space-delimited number
15626 !! wikitext
15627 ISBN 92 9017 032 8
15628 !! html
15629 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15630 </p>
15631 !! end
15632
15633
15634 !! test
15635 ISBN with multiple spaces, no number
15636 !! wikitext
15637 ISBN foo
15638 !! html
15639 <p>ISBN foo
15640 </p>
15641 !! end
15642
15643
15644 !! test
15645 ISBN length
15646 !! wikitext
15647 ISBN 123456789
15648
15649 ISBN 1234567890
15650
15651 ISBN 12345678901
15652 !! html
15653 <p>ISBN 123456789
15654 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15655 </p><p>ISBN 12345678901
15656 </p>
15657 !! end
15658
15659
15660 !! test
15661 ISBN with trailing year (bug 8110)
15662 !! wikitext
15663 ISBN 1-234-56789-0 - 2006
15664
15665 ISBN 1 234 56789 0 - 2006
15666 !! html
15667 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15668 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15669 </p>
15670 !! end
15671
15672
15673 !! test
15674 anchorencode
15675 !! wikitext
15676 {{anchorencode:foo bar©#%n}}
15677 !! html
15678 <p>foo_bar.C2.A9.23.25n
15679 </p>
15680 !! end
15681
15682 !! test
15683 anchorencode trims spaces
15684 !! wikitext
15685 {{anchorencode: __pretty__please__}}
15686 !! html
15687 <p>pretty_please
15688 </p>
15689 !! end
15690
15691 !! test
15692 anchorencode deals with links
15693 !! wikitext
15694 {{anchorencode: [[hello|world]] [[hi]]}}
15695 !! html
15696 <p>world_hi
15697 </p>
15698 !! end
15699
15700 !! test
15701 anchorencode deals with templates
15702 !! wikitext
15703 {{anchorencode: {{Foo}} }}
15704 !! html
15705 <p>FOO
15706 </p>
15707 !! end
15708
15709 !! test
15710 anchorencode encodes like the TOC generator: (bug 18431)
15711 !! wikitext
15712 === _ +:.3A%3A&&amp;]] ===
15713 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15714 __NOEDITSECTION__
15715 !! html
15716 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15717 <p>.2B:.3A.253A.26.26.5D.5D
15718 </p>
15719 !! end
15720
15721 !! test
15722 Bug 6200: blockquotes and paragraph formatting
15723 !! wikitext
15724 <blockquote>
15725 foo
15726 </blockquote>
15727
15728 bar
15729
15730 baz
15731 !! html
15732 <blockquote>
15733 <p>foo
15734 </p>
15735 </blockquote>
15736 <p>bar
15737 </p>
15738 <pre>baz
15739 </pre>
15740 !! end
15741
15742 !! test
15743 Bug 8293: Use of center tag ruins paragraph formatting
15744 !! wikitext
15745 <center>
15746 foo
15747 </center>
15748
15749 bar
15750
15751 baz
15752 !! html
15753 <center>
15754 <p>foo
15755 </p>
15756 </center>
15757 <p>bar
15758 </p>
15759 <pre>baz
15760 </pre>
15761 !! end
15762
15763 !!test
15764 Parsing of overlapping (improperly nested) inline html tags
15765 !! wikitext
15766 <span><s>x</span></s>
15767 !! html/php
15768 <p><span><s>x&lt;/span&gt;</s></span>
15769 </p>
15770 !! html/parsoid
15771 <p><span><s>x</s></span>
15772 </p>
15773 !!end
15774
15775 ###
15776 ### Language variants related tests
15777 ###
15778 !! test
15779 Self-link in language variants
15780 !! options
15781 title=[[Dunav]] language=sr
15782 !! wikitext
15783 Both [[Dunav]] and [[Дунав]] are names for this river.
15784 !! html
15785 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15786 </p>
15787 !!end
15788
15789 !! article
15790 Дуна
15791 !! text
15792 content
15793 !! endarticle
15794
15795 !! test
15796 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15797 !! options
15798 title=[[Duna]] language=sr
15799 !! wikitext
15800 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15801 !! html
15802 <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.
15803 </p>
15804 !! end
15805
15806 !! test
15807 Link to a section of a variant of this title shouldn't be parsed as self-link
15808 !! options
15809 title=[[Duna]] language=sr
15810 !! wikitext
15811 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15812 !! html
15813 <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.
15814 </p>
15815 !! end
15816
15817 !! test
15818 Link to pages in language variants
15819 !! options
15820 language=sr
15821 !! wikitext
15822 Main Page can be written as [[Маин Паге]]
15823 !! html
15824 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15825 </p>
15826 !!end
15827
15828
15829 !! test
15830 Multiple links to pages in language variants
15831 !! options
15832 language=sr
15833 !! wikitext
15834 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15835 !! html
15836 <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>.
15837 </p>
15838 !!end
15839
15840
15841 !! test
15842 Simple template in language variants
15843 !! options
15844 language=sr
15845 !! wikitext
15846 {{тест}}
15847 !! html
15848 <p>This is a test template
15849 </p>
15850 !! end
15851
15852
15853 !! test
15854 Template with explicit namespace in language variants
15855 !! options
15856 language=sr
15857 !! wikitext
15858 {{Template:тест}}
15859 !! html
15860 <p>This is a test template
15861 </p>
15862 !! end
15863
15864
15865 !! test
15866 Basic test for template parameter in language variants
15867 !! options
15868 language=sr
15869 !! wikitext
15870 {{парамтест|param=foo}}
15871 !! html
15872 <p>This is a test template with parameter foo
15873 </p>
15874 !! end
15875
15876
15877 !! test
15878 Simple category in language variants
15879 !! options
15880 language=sr cat
15881 !! wikitext
15882 [[Category:МедиаWики Усер'с Гуиде]]
15883 !! html
15884 <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>
15885 !! end
15886
15887
15888 !! article
15889 Category:分类
15890 !! text
15891 blah
15892 !! endarticle
15893
15894 !! article
15895 Category:分類
15896 !! text
15897 blah
15898 !! endarticle
15899
15900 !! test
15901 Don't convert blue categorylinks to another variant (bug 33210)
15902 !! options
15903 language=zh cat
15904 !! wikitext
15905 [[A]][[Category:分类]]
15906 !! html
15907 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15908 !! end
15909
15910
15911 !! test
15912 Stripping -{}- tags (language variants)
15913 !! options
15914 language=sr
15915 !! wikitext
15916 Latin proverb: -{Ne nuntium necare}-
15917 !! html
15918 <p>Latin proverb: Ne nuntium necare
15919 </p>
15920 !! end
15921
15922
15923 !! test
15924 Prevent conversion with -{}- tags (language variants)
15925 !! options
15926 language=sr variant=sr-ec
15927 !! wikitext
15928 Latinski: -{Ne nuntium necare}-
15929 !! html
15930 <p>Латински: Ne nuntium necare
15931 </p>
15932 !! end
15933
15934
15935 !! test
15936 Prevent conversion of text with -{}- tags (language variants)
15937 !! options
15938 language=sr variant=sr-ec
15939 !! wikitext
15940 Latinski: -{Ne nuntium necare}-
15941 !! html
15942 <p>Латински: Ne nuntium necare
15943 </p>
15944 !! end
15945
15946
15947 !! test
15948 Prevent conversion of links with -{}- tags (language variants)
15949 !! options
15950 language=sr variant=sr-ec
15951 !! wikitext
15952 -{[[Main Page]]}-
15953 !! html
15954 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15955 </p>
15956 !! end
15957
15958
15959 !! test
15960 -{}- tags within headlines (within html for parserConvert())
15961 !! options
15962 language=sr variant=sr-ec
15963 !! wikitext
15964 == -{Naslov}- ==
15965 !! html
15966 <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>
15967
15968 !! end
15969
15970
15971 !! test
15972 Explicit definition of language variant alternatives
15973 !! options
15974 language=zh variant=zh-tw
15975 !! wikitext
15976 -{zh:China;zh-tw:Taiwan}-, not China
15977 !! html
15978 <p>Taiwan, not China
15979 </p>
15980 !! end
15981
15982
15983 !! test
15984 Conversion around HTML tags
15985 !! options
15986 language=sr variant=sr-ec
15987 !! wikitext
15988 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15989 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15990 !! html
15991 <p>
15992 <span title="ЛаCтин">ски</span>
15993 </p>
15994 !! end
15995
15996
15997 !! test
15998 Explicit session-wise language variant mapping (A flag and - flag)
15999 !! options
16000 language=zh variant=zh-tw
16001 !! wikitext
16002 Taiwan is not China.
16003 But -{A|zh:China;zh-tw:Taiwan}- is China,
16004 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16005 and -{China}- is China.
16006 !! html
16007 <p>Taiwan is not China.
16008 But Taiwan is Taiwan,
16009 (This should be stripped!)
16010 and China is China.
16011 </p>
16012 !! end
16013
16014 !! test
16015 Explicit session-wise language variant mapping (H flag for hide)
16016 !! options
16017 language=zh variant=zh-tw
16018 !! wikitext
16019 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16020 Taiwan is China.
16021 !! html
16022 <p>(This should be stripped!)
16023 Taiwan is Taiwan.
16024 </p>
16025 !! end
16026
16027 !! test
16028 Adding explicit conversion rule for title (T flag)
16029 !! options
16030 language=zh variant=zh-tw showtitle
16031 !! wikitext
16032 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16033 !! html
16034 Taiwan
16035 <p>Should be stripped!
16036 </p>
16037 !! end
16038
16039 !! test
16040 Testing that changing the language variant here in the tests actually works
16041 !! options
16042 language=zh variant=zh showtitle
16043 !! wikitext
16044 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16045 !! html
16046 China
16047 <p>Should be stripped!
16048 </p>
16049 !! end
16050
16051 !! test
16052 Recursive conversion of alt and title attrs shouldn't clear converter state
16053 !! options
16054 language=zh variant=zh-cn showtitle
16055 !! wikitext
16056 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16057 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16058 !! html
16059 China
16060 <p>
16061 Should be stripped<span title="Exclamation">!</span>
16062 </p>
16063 !! end
16064
16065 !! test
16066 Bug 24072: more test on conversion rule for title
16067 !! options
16068 language=zh variant=zh-tw showtitle
16069 !! wikitext
16070 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16071 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16072 !! html
16073 Taiwan
16074 <p>This should be stripped!
16075 This won't take interferes with the title rule.
16076 </p>
16077 !! end
16078
16079 !! test
16080 Partly disable title conversion if variant == main language code
16081 !! options
16082 language=zh variant=zh title=[[ZH]] showtitle
16083 !! wikitext
16084 -{T|zh-cn:CN;zh-tw:TW}-
16085 !! html
16086 ZH
16087 <p>
16088 </p>
16089 !! end
16090
16091 !! test
16092 Partly disable title conversion if variant == main language code, more
16093 !! options
16094 language=zh variant=zh title=[[ZH]] showtitle
16095 !! wikitext
16096 -{T|TW}-
16097 !! html
16098 ZH
16099 <p>
16100 </p>
16101 !! end
16102
16103 !! test
16104 Raw output of variant escape tags (R flag)
16105 !! options
16106 language=zh variant=zh-tw
16107 !! wikitext
16108 Raw: -{R|zh:China;zh-tw:Taiwan}-
16109 !! html
16110 <p>Raw: zh:China;zh-tw:Taiwan
16111 </p>
16112 !! end
16113
16114 !! test
16115 Nested using of manual convert syntax
16116 !! options
16117 language=zh variant=zh-hk
16118 !! wikitext
16119 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16120 !! html
16121 <p>Nested: Hello Hong Kong!
16122 </p>
16123 !! end
16124
16125 !! test
16126 Proper conversion of text in external links
16127 !! options
16128 language=sr variant=sr-ec
16129 !! wikitext
16130 http://www.google.com
16131 gopher://www.google.com
16132 [http://www.google.com http://www.google.com]
16133 [gopher://www.google.com gopher://www.google.com]
16134 [https://www.google.com irc://www.google.com]
16135 [ftp://www.google.com www.google.com/ftp://dir]
16136 [//www.google.com www.google.com]
16137 !! html
16138 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16139 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16140 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16141 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16142 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16143 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16144 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16145 </p>
16146 !! end
16147
16148 !! test
16149 Do not convert roman numbers to language variants
16150 !! options
16151 language=sr variant=sr-ec
16152 !! wikitext
16153 Fridrih IV je car.
16154 !! html
16155 <p>Фридрих IV је цар.
16156 </p>
16157 !! end
16158
16159 !! test
16160 Unclosed language converter markup "-{"
16161 !! options
16162 language=sr
16163 !! wikitext
16164 -{T|hello
16165 !! html
16166 <p>-{T|hello
16167 </p>
16168 !! end
16169
16170 !! test
16171 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16172 !! options
16173 language=sr
16174 !! wikitext
16175 -{R|=&gt;}-
16176 !! html
16177 <p>=&gt;
16178 </p>
16179 !!end
16180
16181 !! test
16182 Don't break link parsing if language converter markup is in the caption.
16183 !! options
16184 language=sr variant=sr-ec
16185 !! wikitext
16186 [[Main Page|-{R|main page}-]]
16187 !! html
16188 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16189 </p>
16190 !! end
16191
16192 # This test is currently broken in the PHP parser (bug 52661)
16193 !! test
16194 Don't break image parsing if language converter markup is in the caption.
16195 !! options
16196 language=sr
16197 disabled
16198 !! wikitext
16199 [[File:Foobar.jpg|-{R|caption}-]]
16200 !! html
16201 <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>
16202 </p>
16203 !! end
16204
16205 # This test is currently broken in the PHP parser (bug 52661)
16206 !! test
16207 Don't break list handling if language converter markup is in the item.
16208 !! options
16209 language=zh variant=zh-cn
16210 disabled
16211 !! wikitext
16212 ;-{zh-cn:AAA;zh-tw:BBB}-
16213 !! html
16214 <dl><dt>AAA
16215 </dt></dl>
16216
16217 !! end
16218
16219 # This test is currently broken in the PHP parser (bug 52661)
16220 !! test
16221 Don't break table handling if language converter markup is in the cell.
16222 !! options
16223 language=sr variant=sr-ec
16224 disabled
16225 !! wikitext
16226 {|
16227 |-
16228 | -{R|B}-
16229 |}
16230 !! html
16231 <table>
16232
16233 <tr>
16234 <td> B
16235 </td></tr></table>
16236
16237 !! end
16238
16239 !! test
16240 Bug 529: Uncovered bullet
16241 !! wikitext
16242 * Foo {{bullet}}
16243 !! html
16244 <ul>
16245 <li> Foo
16246 </li>
16247 <li> Bar
16248 </li>
16249 </ul>
16250
16251 !! end
16252
16253 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16254 # Templates in Wikipedia rely on this behavior, as tidy has always been
16255 # enabled there. These tests are normally run *without* tidy, so specify the
16256 # full output here.
16257 # To test realistic parsing behavior, apply a tidy-like transformation to both
16258 # the expected output and your parser's output.
16259 !! test
16260 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16261 !! wikitext
16262 ******* Foo {{bullet}}
16263 !! html
16264 <ul>
16265 <li><ul>
16266 <li><ul>
16267 <li><ul>
16268 <li><ul>
16269 <li><ul>
16270 <li><ul>
16271 <li> Foo
16272 </li>
16273 </ul>
16274 </li>
16275 </ul>
16276 </li>
16277 </ul>
16278 </li>
16279 </ul>
16280 </li>
16281 </ul>
16282 </li>
16283 </ul>
16284 </li>
16285 <li> Bar
16286 </li>
16287 </ul>
16288
16289 !! end
16290
16291 !! test
16292 Bug 529: Uncovered table already at line-start
16293 !! wikitext
16294 x
16295
16296 {{table}}
16297 y
16298 !! html
16299 <p>x
16300 </p>
16301 <table>
16302 <tr>
16303 <td> 1 </td>
16304 <td> 2
16305 </td></tr>
16306 <tr>
16307 <td> 3 </td>
16308 <td> 4
16309 </td></tr></table>
16310 <p>y
16311 </p>
16312 !! end
16313
16314 !! test
16315 Bug 529: Uncovered bullet in parser function result
16316 !! wikitext
16317 * Foo {{lc:{{bullet}} }}
16318 !! html
16319 <ul>
16320 <li> Foo
16321 </li>
16322 <li> bar
16323 </li>
16324 </ul>
16325
16326 !! end
16327
16328 !! test
16329 Bug 5678: Double-parsed template argument
16330 !! wikitext
16331 {{lc:{{{1}}}|hello}}
16332 !! html
16333 <p>{{{1}}}
16334 </p>
16335 !! end
16336
16337 !! test
16338 Bug 5678: Double-parsed template invocation
16339 !! wikitext
16340 {{lc:{{paramtest {{!}} param = hello }} }}
16341 !! html
16342 <p>{{paramtest | param = hello }}
16343 </p>
16344 !! end
16345
16346 !! test
16347 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16348 !! options
16349 language=cs
16350 title=[[Main Page]]
16351 !! wikitext
16352 {{PRVNÍVELKÉ:ěščř}}
16353 {{prvnívelké:ěščř}}
16354 {{PRVNÍMALÉ:ěščř}}
16355 {{prvnímalé:ěščř}}
16356 {{MALÁ:ěščř}}
16357 {{malá:ěščř}}
16358 {{VELKÁ:ěščř}}
16359 {{velká:ěščř}}
16360 !! html
16361 <p>Ěščř
16362 Ěščř
16363 ěščř
16364 ěščř
16365 ěščř
16366 ěščř
16367 ĚŠČŘ
16368 ĚŠČŘ
16369 </p>
16370 !! end
16371
16372 !! test
16373 Morwen/13: Unclosed link followed by heading
16374 !! wikitext
16375 [[link
16376 ==heading==
16377 !! html
16378 <p>[[link
16379 </p>
16380 <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>
16381
16382 !! end
16383
16384 !! test
16385 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16386 !! wikitext
16387 {{foo|
16388 =heading=
16389 !! html
16390 <p>{{foo|
16391 </p>
16392 <h1><span class="mw-headline" id="heading">heading</span></h1>
16393
16394 !! end
16395
16396 !! test
16397 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16398 !! wikitext
16399 {{foo|
16400 ==heading==
16401 !! html
16402 <p>{{foo|
16403 </p>
16404 <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>
16405
16406 !! end
16407
16408 !! test
16409 Tildes in comments
16410 !! options
16411 pst
16412 !! wikitext
16413 <!-- ~~~~ -->
16414 !! html
16415 <!-- ~~~~ -->
16416 !! end
16417
16418 !! test
16419 Paragraphs inside divs (no extra line breaks)
16420 !! wikitext
16421 <div>Line one
16422
16423 Line two</div>
16424 !! html
16425 <div>Line one
16426 Line two</div>
16427
16428 !! end
16429
16430 !! test
16431 Paragraphs inside divs (extra line break on open)
16432 !! wikitext
16433 <div>
16434 Line one
16435
16436 Line two</div>
16437 !! html
16438 <div>
16439 <p>Line one
16440 </p>
16441 Line two</div>
16442
16443 !! end
16444
16445 !! test
16446 Paragraphs inside divs (extra line break on close)
16447 !! wikitext
16448 <div>Line one
16449
16450 Line two
16451 </div>
16452 !! html
16453 <div>Line one
16454 <p>Line two
16455 </p>
16456 </div>
16457
16458 !! end
16459
16460 !! test
16461 Paragraphs inside divs (extra line break on open and close)
16462 !! wikitext
16463 <div>
16464 Line one
16465
16466 Line two
16467 </div>
16468 !! html
16469 <div>
16470 <p>Line one
16471 </p><p>Line two
16472 </p>
16473 </div>
16474
16475 !! end
16476
16477 !! test
16478 Nesting tags, paragraphs on lines which begin with <div>
16479 !! options
16480 disabled
16481 !! wikitext
16482 <div></div><strong>A
16483 B</strong>
16484 !! html
16485 <div></div>
16486 <p><strong>A
16487 B</strong>
16488 </p>
16489 !! end
16490
16491 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16492 !! test
16493 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16494 !! wikitext
16495 <blockquote>Line one
16496
16497 Line two</blockquote>
16498 !! html
16499 <blockquote>Line one
16500 Line two</blockquote>
16501
16502 !! end
16503
16504 !! test
16505 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16506 !! wikitext
16507 <blockquote>
16508 Line one
16509
16510 Line two</blockquote>
16511 !! html
16512 <blockquote>
16513 <p>Line one
16514 </p>
16515 Line two</blockquote>
16516
16517 !! end
16518
16519 !! test
16520 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16521 !! wikitext
16522 <blockquote>Line one
16523
16524 Line two
16525 </blockquote>
16526 !! html
16527 <blockquote>Line one
16528 <p>Line two
16529 </p>
16530 </blockquote>
16531
16532 !! end
16533
16534 !! test
16535 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16536 !! wikitext
16537 <blockquote>
16538 Line one
16539
16540 Line two
16541 </blockquote>
16542 !! html
16543 <blockquote>
16544 <p>Line one
16545 </p><p>Line two
16546 </p>
16547 </blockquote>
16548
16549 !! end
16550
16551 !! test
16552 Paragraphs inside blockquotes/divs (no extra line breaks)
16553 !! wikitext
16554 <blockquote><div>Line one
16555
16556 Line two</div></blockquote>
16557 !! html
16558 <blockquote><div>Line one
16559 Line two</div></blockquote>
16560
16561 !! end
16562
16563 !! test
16564 Paragraphs inside blockquotes/divs (extra line break on open)
16565 !! wikitext
16566 <blockquote><div>
16567 Line one
16568
16569 Line two</div></blockquote>
16570 !! html
16571 <blockquote><div>
16572 <p>Line one
16573 </p>
16574 Line two</div></blockquote>
16575
16576 !! end
16577
16578 !! test
16579 Paragraphs inside blockquotes/divs (extra line break on close)
16580 !! wikitext
16581 <blockquote><div>Line one
16582
16583 Line two
16584 </div></blockquote>
16585 !! html
16586 <blockquote><div>Line one
16587 <p>Line two
16588 </p>
16589 </div></blockquote>
16590
16591 !! end
16592
16593 !! test
16594 Paragraphs inside blockquotes/divs (extra line break on open and close)
16595 !! wikitext
16596 <blockquote><div>
16597 Line one
16598
16599 Line two
16600 </div></blockquote>
16601 !! html
16602 <blockquote><div>
16603 <p>Line one
16604 </p><p>Line two
16605 </p>
16606 </div></blockquote>
16607
16608 !! end
16609
16610 !! test
16611 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16612 !! options
16613 wgLinkHolderBatchSize=0
16614 !! wikitext
16615 [[meatball:1]]
16616 [[meatball:2]]
16617 [[meatball:3]]
16618 !! html
16619 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16620 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16621 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16622 </p>
16623 !! end
16624
16625 !! test
16626 Free external link invading image caption
16627 !! wikitext
16628 [[Image:Foobar.jpg|thumb|http://x|hello]]
16629 !! html
16630 <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>
16631
16632 !! end
16633
16634 !! test
16635 Bug 15196: localised external link numbers
16636 !! options
16637 language=fa
16638 !! wikitext
16639 [http://en.wikipedia.org/]
16640 !! html
16641 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16642 </p>
16643 !! end
16644
16645 !! test
16646 Multibyte character in padleft
16647 !! wikitext
16648 {{padleft:-Hello|7|Æ}}
16649 !! html
16650 <p>Æ-Hello
16651 </p>
16652 !! end
16653
16654 !! test
16655 Multibyte character in padright
16656 !! wikitext
16657 {{padright:Hello-|7|Æ}}
16658 !! html
16659 <p>Hello-Æ
16660 </p>
16661 !! end
16662
16663 !!test
16664 formatdate parser function
16665 !! wikitext
16666 {{#formatdate:2009-03-24}}
16667 !! html
16668 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16669 </p>
16670 !! end
16671
16672 !!test
16673 formatdate parser function, with default format
16674 !! wikitext
16675 {{#formatdate:2009-03-24|mdy}}
16676 !! html
16677 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16678 </p>
16679 !! end
16680
16681 !! test
16682 Spacing of numbers in formatted dates
16683 !! wikitext
16684 {{#formatdate:January 15}}
16685 !! html
16686 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16687 </p>
16688 !! end
16689
16690 !! test
16691 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
16692 !! options
16693 language=nl title=[[MediaWiki:Common.css]]
16694 !! wikitext
16695 {{#formatdate:2009-03-24|dmy}}
16696 !! html
16697 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16698 </p>
16699 !! end
16700
16701 #
16702 #
16703 #
16704
16705 #
16706 # Edit comments
16707 #
16708
16709 !! test
16710 Edit comment with link
16711 !! options
16712 comment
16713 !! wikitext
16714 I like the [[Main Page]] a lot
16715 !! html
16716 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16717 !!end
16718
16719 !! test
16720 Edit comment with link and link text
16721 !! options
16722 comment
16723 !! wikitext
16724 I like the [[Main Page|best pages]] a lot
16725 !! html
16726 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16727 !!end
16728
16729 !! test
16730 Edit comment with link and link text with suffix
16731 !! options
16732 comment
16733 !! wikitext
16734 I like the [[Main Page|best page]]s a lot
16735 !! html
16736 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16737 !!end
16738
16739 !! test
16740 Edit comment with section link (non-local, eg in history list)
16741 !! options
16742 comment title=[[Main Page]]
16743 !! wikitext
16744 /* External links */ removed bogus entries
16745 !! html
16746 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16747 !!end
16748
16749 !! test
16750 Edit comment with section link and text before it (non-local, eg in history list)
16751 !! options
16752 comment title=[[Main Page]]
16753 !! wikitext
16754 pre-comment text /* External links */ removed bogus entries
16755 !! html
16756 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>
16757 !!end
16758
16759 !! test
16760 Edit comment with section link (local, eg in diff view)
16761 !! options
16762 comment local title=[[Main Page]]
16763 !! wikitext
16764 /* External links */ removed bogus entries
16765 !! html
16766 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16767 !!end
16768
16769 !! test
16770 Edit comment with subpage link (bug 14080)
16771 !! options
16772 comment
16773 subpage
16774 title=[[Subpage test]]
16775 !! wikitext
16776 Poked at a [[/subpage]] here...
16777 !! html
16778 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16779 !!end
16780
16781 !! test
16782 Edit comment with subpage link and link text (bug 14080)
16783 !! options
16784 comment
16785 subpage
16786 title=[[Subpage test]]
16787 !! wikitext
16788 Poked at a [[/subpage|neat little page]] here...
16789 !! html
16790 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16791 !!end
16792
16793 !! test
16794 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16795 !! options
16796 comment
16797 title=[[Subpage test]]
16798 !! wikitext
16799 Poked at a [[/subpage]] here...
16800 !! html
16801 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...
16802 !!end
16803
16804 !! test
16805 Edit comment with bare anchor link (local, as on diff)
16806 !! options
16807 comment
16808 local
16809 title=[[Main Page]]
16810 !! wikitext
16811 [[#section]]
16812 !! html
16813 <a href="#section">#section</a>
16814 !! end
16815
16816 !! test
16817 Edit comment with bare anchor link (non-local, as on history)
16818 !! options
16819 comment
16820 title=[[Main Page]]
16821 !! wikitext
16822 [[#section]]
16823 !! html
16824 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16825 !! end
16826
16827 !! test
16828 Anchor starting with underscore
16829 !! wikitext
16830 [[#_ref|One]]
16831 !! html
16832 <p><a href="#_ref">One</a>
16833 </p>
16834 !! end
16835
16836 !! test
16837 Id starting with underscore
16838 !! wikitext
16839 <div id="_ref"></div>
16840 !! html
16841 <div id="_ref"></div>
16842
16843 !! end
16844
16845 !! test
16846 Space normalisation on autocomment (bug 22784)
16847 !! options
16848 comment
16849 title=[[Main Page]]
16850 !! wikitext
16851 /* __hello__world__ */
16852 !! html
16853 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16854 !! end
16855
16856 !! test
16857 percent-encoding and + signs in comments (Bug 26410)
16858 !! options
16859 comment
16860 !! wikitext
16861 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16862 !! html
16863 <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>
16864 !! end
16865
16866 !! test
16867 Bad images - basic functionality
16868 !! options
16869 disabled
16870 !! wikitext
16871 [[File:Bad.jpg]]
16872 !! html
16873 !! end
16874
16875 !! test
16876 Bad images - bug 16039: text after bad image disappears
16877 !! options
16878 disabled
16879 !! wikitext
16880 Foo bar
16881 [[File:Bad.jpg]]
16882 Bar foo
16883 !! html
16884 <p>Foo bar
16885 </p><p>Bar foo
16886 </p>
16887 !! end
16888
16889 !! test
16890 Verify that displaytitle works (bug #22501) no displaytitle
16891 !! options
16892 showtitle
16893 !! config
16894 wgAllowDisplayTitle=true
16895 wgRestrictDisplayTitle=false
16896 !! wikitext
16897 this is not the the title
16898 !! html
16899 Parser test
16900 <p>this is not the the title
16901 </p>
16902 !! end
16903
16904 !! test
16905 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16906 !! options
16907 showtitle
16908 title=[[Screen]]
16909 !! config
16910 wgAllowDisplayTitle=true
16911 wgRestrictDisplayTitle=false
16912 !! wikitext
16913 this is not the the title
16914 {{DISPLAYTITLE:whatever}}
16915 !! html
16916 whatever
16917 <p>this is not the the title
16918 </p>
16919 !! end
16920
16921 !! test
16922 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16923 !! options
16924 showtitle
16925 title=[[Screen]]
16926 !! config
16927 wgAllowDisplayTitle=true
16928 wgRestrictDisplayTitle=true
16929 !! wikitext
16930 this is not the the title
16931 {{DISPLAYTITLE:whatever}}
16932 !! html
16933 Screen
16934 <p>this is not the the title
16935 </p>
16936 !! end
16937
16938 !! test
16939 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16940 !! options
16941 showtitle
16942 title=[[Screen]]
16943 !! config
16944 wgAllowDisplayTitle=true
16945 wgRestrictDisplayTitle=true
16946 !! wikitext
16947 this is not the the title
16948 {{DISPLAYTITLE:screen}}
16949 !! html
16950 screen
16951 <p>this is not the the title
16952 </p>
16953 !! end
16954
16955 !! test
16956 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16957 !! options
16958 showtitle
16959 title=[[Screen]]
16960 !! config
16961 wgAllowDisplayTitle=false
16962 !! wikitext
16963 this is not the the title
16964 {{DISPLAYTITLE:screen}}
16965 !! html
16966 Screen
16967 <p>this is not the the title
16968 <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>
16969 </p>
16970 !! end
16971
16972 !! test
16973 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16974 !! options
16975 showtitle
16976 title=[[Screen]]
16977 !! config
16978 wgAllowDisplayTitle=false
16979 !! wikitext
16980 this is not the the title
16981 !! html
16982 Screen
16983 <p>this is not the the title
16984 </p>
16985 !! end
16986
16987 !! test
16988 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16989 !! options
16990 showtitle
16991 title=[[Screen]]
16992 !! config
16993 wgAllowDisplayTitle=true
16994 wgRestrictDisplayTitle=true
16995 !! wikitext
16996 this is not the the title
16997 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16998 !! html
16999 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17000 <p>this is not the the title
17001 </p>
17002 !! end
17003
17004 !! test
17005 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17006 !! options
17007 showtitle
17008 title=[[Screen]]
17009 !! config
17010 wgAllowDisplayTitle=true
17011 wgRestrictDisplayTitle=true
17012 !! wikitext
17013 this is not the the title
17014 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17015 !! html
17016 <span style="color: red;">s</span>creen
17017 <p>this is not the the title
17018 </p>
17019 !! end
17020
17021 !! test
17022 preload: check <noinclude> and <includeonly>
17023 !! options
17024 preload
17025 !! wikitext
17026 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17027 !! html
17028 Hello kind world.
17029 !! end
17030
17031 !! test
17032 preload: check <onlyinclude>
17033 !! options
17034 preload
17035 !! wikitext
17036 Goodbye <onlyinclude>Hello world</onlyinclude>
17037 !! html
17038 Hello world
17039 !! end
17040
17041 !! test
17042 preload: can pass tags through if we want to
17043 !! options
17044 preload
17045 !! wikitext
17046 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17047 !! html
17048 <includeonly>Hello world</includeonly>
17049 !! end
17050
17051 !! test
17052 preload: check that it doesn't try to do tricks
17053 !! options
17054 preload
17055 !! wikitext
17056 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17057 !! html
17058 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17059 !! end
17060
17061 !! test
17062 Play a bit with r67090 and bug 3158
17063 !! options
17064 disabled
17065 !! wikitext
17066 <div style="width:50% !important">&nbsp;</div>
17067 <div style="width:50%&nbsp;!important">&nbsp;</div>
17068 <div style="width:50%&#160;!important">&nbsp;</div>
17069 <div style="border : solid;">&nbsp;</div>
17070 !! html
17071 <div style="width:50% !important">&nbsp;</div>
17072 <div style="width:50% !important">&nbsp;</div>
17073 <div style="width:50% !important">&nbsp;</div>
17074 <div style="border&#160;: solid;">&nbsp;</div>
17075
17076 !! end
17077
17078 !! test
17079 HTML5 data attributes
17080 !! wikitext
17081 <span data-foo="bar">Baz</span>
17082 <p data-abc-def_hij="">Quuz</p>
17083 !! html
17084 <p><span data-foo="bar">Baz</span>
17085 </p>
17086 <p data-abc-def_hij="">Quuz</p>
17087
17088 !! end
17089
17090 !! test
17091 percent-encoding and + signs in internal links (Bug 26410)
17092 !! wikitext
17093 [[User:+%]] [[Page+title%]]
17094 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17095 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17096 [[%33%45]] [[%33%45+]]
17097 !! html
17098 <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>
17099 <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>
17100 <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>
17101 <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>
17102 </p>
17103 !! end
17104
17105 !! test
17106 Special characters in embedded file links (bug 27679)
17107 !! wikitext
17108 [[File:Contains & ampersand.jpg]]
17109 [[File:Does not exist.jpg|Title with & ampersand]]
17110 !! html
17111 <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>
17112 <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>
17113 </p>
17114 !! end
17115
17116
17117 !! test
17118 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17119 !! wikitext
17120 Text&apos;s been normalized?
17121 !! html
17122 <p>Text&#39;s been normalized?
17123 </p>
17124 !! end
17125
17126 !! test
17127 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17128 !! wikitext
17129 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17130 !! html
17131 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17132 </p>
17133 !! end
17134
17135 !! test
17136 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17137 !! wikitext
17138 [http://www.example.org/ ideograms]
17139 !! html
17140 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17141 </p>
17142 !! end
17143
17144 !! test
17145 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17146 !! wikitext
17147 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17148 !! html
17149 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17150 </p>
17151 !! end
17152
17153 !! article
17154 Mediawiki:loop1
17155 !! text
17156 {{Identical|A}}
17157 !! endarticle
17158
17159 !! article
17160 Mediawiki:loop2
17161 !! text
17162 {{Identical|B}}
17163 !! endarticle
17164
17165 !! article
17166 Template:Identical
17167 !! text
17168 {{int:loop1}}
17169 {{int:loop2}}
17170 !! endarticle
17171
17172 !! test
17173 Bug 31098 Template which includes system messages which includes the template
17174 !! wikitext
17175 {{Identical}}
17176 !! html
17177 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17178 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17179 </p>
17180 !! end
17181
17182 !! test
17183 Bug31490 Turkish: ucfirst 'blah'
17184 !! options
17185 language=tr
17186 !! wikitext
17187 {{ucfirst:blah}}
17188 !! html
17189 <p>Blah
17190 </p>
17191 !! end
17192
17193 !! test
17194 Bug31490 Turkish: ucfirst 'ix'
17195 !! options
17196 language=tr
17197 !! wikitext
17198 {{ucfirst:ix}}
17199 !! html
17200 <p>İx
17201 </p>
17202 !! end
17203
17204 !! test
17205 Bug31490 Turkish: lcfirst 'BLAH'
17206 !! options
17207 language=tr
17208 !! wikitext
17209 {{lcfirst:BLAH}}
17210 !! html
17211 <p>bLAH
17212 </p>
17213 !! end
17214
17215 !! test
17216 Bug31490 Turkish: ucfırst (with a dotless i)
17217 !! options
17218 language=tr
17219 !! wikitext
17220 {{ucfırst:blah}}
17221 !! html
17222 <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>
17223 </p>
17224 !! end
17225
17226 !! test
17227 Bug31490 ucfırst (with a dotless i) with English language
17228 !! options
17229 language=en
17230 !! wikitext
17231 {{ucfırst:blah}}
17232 !! html
17233 <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>
17234 </p>
17235 !! end
17236
17237 !! test
17238 Bug 26375: TOC with italics
17239 !! options
17240 title=[[Main Page]]
17241 !! wikitext
17242 __TOC__
17243 == ''Lost'' episodes ==
17244 !! html
17245 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17246 <ul>
17247 <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>
17248 </ul>
17249 </div>
17250
17251 <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>
17252
17253 !! end
17254
17255 !! test
17256 Bug 26375: TOC with bold
17257 !! options
17258 title=[[Main Page]]
17259 !! wikitext
17260 __TOC__
17261 == '''should be bold''' then normal text ==
17262 !! html
17263 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17264 <ul>
17265 <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>
17266 </ul>
17267 </div>
17268
17269 <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>
17270
17271 !! end
17272
17273 !! test
17274 Bug 33845: Headings become cursive in TOC when they contain an image
17275 !! options
17276 title=[[Main Page]]
17277 !! wikitext
17278 __TOC__
17279 == Image [[Image:foobar.jpg]] ==
17280 !! html
17281 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17282 <ul>
17283 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17284 </ul>
17285 </div>
17286
17287 <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>
17288
17289 !! end
17290
17291 !! test
17292 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17293 !! options
17294 title=[[Main Page]]
17295 !! wikitext
17296 __TOC__
17297 == <blockquote>Quote</blockquote> ==
17298 !! html
17299 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17300 <ul>
17301 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17302 </ul>
17303 </div>
17304
17305 <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>
17306
17307 !! end
17308
17309 !! test
17310 Unclosed tags in TOC
17311 !! options
17312 title=[[Main Page]]
17313 !! wikitext
17314 __TOC__
17315 == Proof: 2 < 3 ==
17316 <small>Hanc marginis exiguitas non caperet.</small>
17317 QED
17318 !! html
17319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17320 <ul>
17321 <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>
17322 </ul>
17323 </div>
17324
17325 <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>
17326 <p><small>Hanc marginis exiguitas non caperet.</small>
17327 QED
17328 </p>
17329 !! end
17330
17331 !! test
17332 Multiple tags in TOC
17333 !! wikitext
17334 __TOC__
17335 == <i>Foo</i> <b>Bar</b> ==
17336
17337 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17338 !! html
17339 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17340 <ul>
17341 <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>
17342 <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>
17343 </ul>
17344 </div>
17345
17346 <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>
17347 <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>
17348
17349 !! end
17350
17351 !! test
17352 Tags with parameters in TOC
17353 !! wikitext
17354 __TOC__
17355 == <sup class="in-h2">Hello</sup> ==
17356
17357 == <sup class="a > b">Evilbye</sup> ==
17358 !! html
17359 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17360 <ul>
17361 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17362 <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>
17363 </ul>
17364 </div>
17365
17366 <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>
17367 <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>
17368
17369 !! end
17370
17371 !! test
17372 span tags with directionality in TOC
17373 !! wikitext
17374 __TOC__
17375 == <span dir="ltr">C++</span> ==
17376
17377 == <span dir="rtl">זבנג!</span> ==
17378
17379 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17380
17381 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17382
17383 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17384 !! html
17385 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17386 <ul>
17387 <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>
17388 <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>
17389 <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>
17390 <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>
17391 <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>
17392 </ul>
17393 </div>
17394
17395 <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>
17396 <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>
17397 <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>
17398 <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>
17399 <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>
17400
17401 !! end
17402
17403 !! article
17404 MediaWiki:Bug32057
17405 !! text
17406 == {{int:headline_sample}} ==
17407 !! endarticle
17408
17409 !! test
17410 Bug 32057: Title needed when expanding <h> nodes.
17411 !! options
17412 title=[[Main Page]]
17413 !! wikitext
17414 {{int:Bug32057}}
17415 !! html
17416 <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>
17417
17418 !! end
17419
17420 !! test
17421 Strip marker in urlencode
17422 !! wikitext
17423 {{urlencode:x<nowiki/>y}}
17424 {{urlencode:x<nowiki/>y|wiki}}
17425 {{urlencode:x<nowiki/>y|path}}
17426 !! html
17427 <p>xy
17428 xy
17429 xy
17430 </p>
17431 !! end
17432
17433 !! test
17434 Strip marker in lc
17435 !! wikitext
17436 {{lc:x<nowiki/>y}}
17437 !! html
17438 <p>xy
17439 </p>
17440 !! end
17441
17442 !! test
17443 Strip marker in uc
17444 !! wikitext
17445 {{uc:x<nowiki/>y}}
17446 !! html
17447 <p>XY
17448 </p>
17449 !! end
17450
17451 !! test
17452 Strip marker in formatNum
17453 !! wikitext
17454 {{formatnum:1<nowiki/>2}}
17455 {{formatnum:1<nowiki/>2|R}}
17456 !! html
17457 <p>12
17458 12
17459 </p>
17460 !! end
17461
17462 !! test
17463 Check noCommafy in formatNum
17464 !! options
17465 language=be-tarask
17466 !! wikitext
17467 {{formatnum:123456.78}}
17468 {{formatnum:123456.78|NOSEP}}
17469 !! html
17470 <p>123 456,78
17471 123456.78
17472 </p>
17473 !! end
17474
17475 !! test
17476 Wrong option for formatNum (bug 56199)
17477 !! wikitext
17478 {{formatnum:1,234.56|Random}}
17479 {{formatnum:1,234.56|EVERYTHING}}
17480 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17481 !! html
17482 <p>1,234.56
17483 1,234.56
17484 1,234.56
17485 </p>
17486 !! end
17487
17488 !! test
17489 Strip marker in grammar
17490 !! options
17491 language=fi
17492 !! wikitext
17493 {{grammar:elative|foo<nowiki/>bar}}
17494 !! html
17495 <p>foobarista
17496 </p>
17497 !! end
17498
17499 !! test
17500 Strip marker in padleft
17501 !! wikitext
17502 {{padleft:|2|x<nowiki/>y}}
17503 !! html
17504 <p>xy
17505 </p>
17506 !! end
17507
17508 !! test
17509 Strip marker in padright
17510 !! wikitext
17511 {{padright:|2|x<nowiki/>y}}
17512 !! html
17513 <p>xy
17514 </p>
17515 !! end
17516
17517 !! test
17518 Strip marker in anchorencode
17519 !! wikitext
17520 {{anchorencode:x<nowiki/>y}}
17521 !! html
17522 <p>xy
17523 </p>
17524 !! end
17525
17526 !! test
17527 nowiki inside link inside heading (bug 18295)
17528 !! wikitext
17529 ==[[foo|x<nowiki>y</nowiki>z]]==
17530 !! html
17531 <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>
17532
17533 !! end
17534
17535 !! test
17536 new support for bdi element (bug 31817)
17537 !! wikitext
17538 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17539 !! html
17540 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17541
17542 !!end
17543
17544 !! test
17545 Ignore pipe between table row attributes
17546 !! wikitext
17547 {|
17548 | quux
17549 |- id=foo | style='color: red'
17550 | bar
17551 |}
17552 !! html
17553 <table>
17554 <tr>
17555 <td> quux
17556 </td></tr>
17557 <tr id="foo" style="color: red">
17558 <td> bar
17559 </td></tr></table>
17560
17561 !! end
17562
17563 !!test
17564 Gallery override link with WikiLink (bug 34852)
17565 !! wikitext
17566 <gallery>
17567 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17568 </gallery>
17569 !! html
17570 <ul class="gallery mw-gallery-traditional">
17571 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17572 <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>
17573 <div class="gallerytext">
17574 <p>caption
17575 </p>
17576 </div>
17577 </div></li>
17578 </ul>
17579
17580 !! end
17581
17582 !!test
17583 Gallery override link with absolute external link (bug 34852)
17584 !! wikitext
17585 <gallery>
17586 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17587 </gallery>
17588 !! html
17589 <ul class="gallery mw-gallery-traditional">
17590 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17591 <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>
17592 <div class="gallerytext">
17593 <p>caption
17594 </p>
17595 </div>
17596 </div></li>
17597 </ul>
17598
17599 !! end
17600
17601 !!test
17602 Gallery override link with malicious javascript (bug 34852)
17603 !! wikitext
17604 <gallery>
17605 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17606 </gallery>
17607 !! html
17608 <ul class="gallery mw-gallery-traditional">
17609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17610 <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>
17611 <div class="gallerytext">
17612 <p>caption
17613 </p>
17614 </div>
17615 </div></li>
17616 </ul>
17617
17618 !! end
17619
17620 !!test
17621 Gallery with invalid title as link (bug 43964)
17622 !! wikitext
17623 <gallery>
17624 File:foobar.jpg|link=<
17625 </gallery>
17626 !! html
17627 <ul class="gallery mw-gallery-traditional">
17628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17629 <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>
17630 <div class="gallerytext">
17631 </div>
17632 </div></li>
17633 </ul>
17634
17635 !! end
17636
17637 !!test
17638 Language parser function
17639 !! wikitext
17640 {{#language:ar}}
17641 !! html
17642 <p>العربية
17643 </p>
17644 !! end
17645
17646 !!test
17647 Padleft and padright as substr
17648 !! wikitext
17649 {{padleft:|3|abcde}}
17650 {{padright:|3|abcde}}
17651 !! html
17652 <p>abc
17653 abc
17654 </p>
17655 !! end
17656
17657 !!test
17658 Special parser function
17659 !! wikitext
17660 {{#special:RandomPage}}
17661 {{#special:BaDtItLe}}
17662 {{#special:Foobar}}
17663 !! html
17664 <p>Special:Random
17665 Special:Badtitle
17666 Special:Foobar
17667 </p>
17668 !! end
17669
17670 !!test
17671 Bug 34939 - Case insensitive link parsing ([HttP://])
17672 !! wikitext
17673 [HttP://MediaWiki.Org/]
17674 !! html
17675 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17676 </p>
17677 !! end
17678
17679 !!test
17680 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17681 !! wikitext
17682 [HttP://MediaWiki.Org/ MediaWiki]
17683 !! html
17684 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17685 </p>
17686 !! end
17687
17688 !!test
17689 Bug 34939 - Case insensitive link parsing (HttP://)
17690 !! wikitext
17691 HttP://MediaWiki.Org/
17692 !! html
17693 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17694 </p>
17695 !! end
17696
17697 !!test
17698 Disable TOC
17699 !! options
17700 notoc
17701 !! wikitext
17702 Lead
17703 == Section 1 ==
17704 == Section 2 ==
17705 == Section 3 ==
17706 == Section 4 ==
17707 == Section 5 ==
17708 !! html
17709 <p>Lead
17710 </p>
17711
17712 <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>
17713 <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>
17714 <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>
17715 <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>
17716 <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>
17717
17718 !! end
17719
17720
17721 ###
17722 ### Parsoids-specific tests
17723 ### Parsoid-PHP parser incompatibilities
17724 ###
17725 !!test
17726 1. SOL-sensitive wikitext tokens as template-args
17727 !!options
17728 parsoid=wt2html,wt2wt
17729 !! wikitext
17730 {{echo|*a}}
17731 {{echo|#a}}
17732 {{echo|:a}}
17733 !! html
17734 <span about="#mwt1" typeof="mw:Transclusion">
17735 </span><ul about="#mwt1"><li>a</li>
17736 </ul>
17737 <span about="#mwt2" typeof="mw:Transclusion">
17738 </span><ol about="#mwt2"><li>a</li>
17739 </ol>
17740 <span about="#mwt3" typeof="mw:Transclusion">
17741 </span><dl about="#mwt3"><dd>a</dd>
17742 </dl>
17743 !!end
17744
17745 #### ----------------------------------------------------------------
17746 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17747 #### tags. Parsoid's output for these tags differs from that of the
17748 #### PHP parser.
17749 #### ----------------------------------------------------------------
17750
17751 !!test
17752 Ref: 1. ref-location should be replaced with an index span
17753 !!options
17754 parsoid
17755 !! wikitext
17756 A <ref>foo</ref>
17757 B <ref name="x">foo</ref>
17758 C <ref name="y" />
17759 !! html
17760 <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>
17761 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>
17762 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>
17763 !!end
17764
17765 !!test
17766 Ref: 2. ref-tags with identical names should all get the same index
17767 !!options
17768 parsoid
17769 !! wikitext
17770 A <ref name="x">foo</ref>
17771 B <ref name="x" />
17772 !! html
17773 <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>
17774 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>
17775 !!end
17776
17777 !!test
17778 Ref: 3. spaces in ref-names should be ignored
17779 !!options
17780 parsoid
17781 !! wikitext
17782 A <ref name="x">foo</ref>
17783 B <ref name=" x " />
17784 C <ref name= x />
17785 !! html
17786 <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>
17787 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>
17788 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>
17789 !!end
17790
17791 !!test
17792 Ref: 4. 'constructor' should be accepted as a valid ref-name
17793 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17794 !!options
17795 parsoid
17796 !! wikitext
17797 A <ref name="constructor">foo</ref>
17798 !! html
17799 <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>
17800 !!end
17801
17802 !!test
17803 Ref: 5. body should accept generic wikitext
17804 !!options
17805 parsoid
17806 !! wikitext
17807 A <ref>
17808 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17809 </ref>
17810
17811 <references />
17812 !! html
17813 <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>
17814
17815 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17816 <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>
17817 </li>
17818 </ol>
17819 !!end
17820
17821 !!test
17822 Ref: 6. indent-pres should not be output in ref-body
17823 !!options
17824 parsoid
17825 !! wikitext
17826 A <ref>
17827 foo
17828 bar
17829 baz
17830 </ref>
17831
17832 <references />
17833 !! html
17834 <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>
17835
17836 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17837 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17838 bar
17839 baz
17840 </li>
17841 </ol>
17842 !!end
17843
17844 !!test
17845 Ref: 7. No p-wrapping in ref-body
17846 !!options
17847 parsoid
17848 !! wikitext
17849 A <ref>
17850 foo
17851
17852 bar
17853
17854
17855 baz
17856
17857
17858
17859 booz
17860 </ref>
17861
17862 <references />
17863 !! html
17864 <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>
17865
17866 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17867 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17868
17869 bar
17870
17871
17872 baz
17873
17874
17875
17876 booz
17877 </li>
17878 </ol>
17879 !!end
17880
17881 !!test
17882 Ref: 8. transclusion wikitext has lower precedence
17883 !!options
17884 parsoid
17885 !! wikitext
17886 A <ref> foo {{echo|</ref> B C}}
17887
17888 <references />
17889 !! html
17890 <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>
17891 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17892 <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>
17893 </ol>
17894 !!end
17895
17896 !!test
17897 Ref: 9. unclosed comments should not leak out of ref-body
17898 !!options
17899 parsoid
17900 !! wikitext
17901 A <ref> foo <!--</ref> B C
17902 <references />
17903 !! html
17904 <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>
17905 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17906 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17907 </ol>
17908 !!end
17909
17910 !!test
17911 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17912 !!options
17913 parsoid
17914 !! wikitext
17915 A <ref> <b> foo </ref> B C
17916
17917 <references />
17918 !! html
17919 <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>
17920
17921
17922 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17923 <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>
17924 </ol>
17925 !!end
17926
17927 !!test
17928 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17929 !!options
17930 parsoid
17931 !! wikitext
17932 A <ref>foo</ref> B
17933 C <ref>bar</ref> D
17934 !! html
17935 <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
17936 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>
17937 !!end
17938
17939 !!test
17940 Ref: 12. ref-tags act as trailing newline migration barrier
17941 !!options
17942 parsoid
17943 !! wikitext
17944 <!--the newline at the end of this line moves out of the p-tag-->a
17945
17946 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17947 <ref />
17948
17949 c
17950 !! html
17951 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17952
17953
17954 <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>
17955 <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>
17956
17957
17958 <p>c</p>
17959 !!end
17960
17961 !!test
17962 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17963 !!options
17964 parsoid
17965 !! wikitext
17966 <ref>foo</ref> A
17967 <ref>bar
17968 </ref> B
17969 !! html
17970 <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
17971 <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>
17972 !!end
17973
17974 !!test
17975 Ref: 14. A nested ref-tag should be emitted as plain text
17976 !!options
17977 parsoid
17978 !! wikitext
17979 <ref>foo <ref>bar</ref> baz</ref>
17980
17981 <references />
17982 !! html
17983 <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>
17984
17985 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17986 <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>
17987 </ol>
17988 !!end
17989
17990 !!test
17991 Ref: 15. ref-tags with identical names should get identical indexes
17992 !!options
17993 parsoid
17994 !! wikitext
17995 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17996 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17997
17998 <references />
17999 !! html
18000 <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>
18001 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>
18002
18003 <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>
18004 </ol>
18005 !!end
18006
18007 ## We don't bother wt2wt-ing non-standard whitespace
18008 !!test
18009 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18010 !!options
18011 parsoid=wt2html
18012 !! wikitext
18013 A <ref >foo</ref >
18014
18015 <references />
18016 !! html
18017 <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>
18018
18019 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18020 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18021 !!end
18022
18023 !!test
18024 References: 1. references tag without any refs should be handled properly
18025 !!options
18026 parsoid
18027 !! wikitext
18028 <references />
18029 !! html
18030 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18031 !!end
18032
18033 !!test
18034 References: 2. references tag with group only outputs references from that group
18035 !!options
18036 parsoid
18037 !! wikitext
18038 A <ref group="a">foo</ref>
18039 B <ref group="b">bar</ref>
18040
18041 <references group="a" />
18042 !! html
18043 <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>
18044 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>
18045
18046 <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>
18047 </ol>
18048 !!end
18049
18050 !!test
18051 References: 3. ref list should be cleared after processing references
18052 !!options
18053 parsoid
18054 !! wikitext
18055 A <ref>foo</ref>
18056
18057 <references />
18058
18059 B <ref>bar</ref>
18060
18061 <references />
18062 !! html
18063 <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>
18064
18065 <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>
18066 </ol>
18067
18068 <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>
18069
18070 <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>
18071 </ol>
18072 !!end
18073
18074 !!test
18075 References: 4. only referenced group should be cleared after processing references
18076 !!options
18077 parsoid
18078 !! wikitext
18079 A <ref group="a">afoo</ref>
18080 B <ref>bfoo</ref>
18081
18082 <references group="a" />
18083
18084 C <ref>cfoo</ref>
18085
18086 <references />
18087 !! html
18088 <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>
18089 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>
18090
18091 <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>
18092 </ol>
18093
18094 <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>
18095
18096 <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>
18097 </ol>
18098 !!end
18099
18100 !!test
18101 References: 5. ref tags in references should be processed while ignoring all other content
18102 !!options
18103 parsoid
18104 !! wikitext
18105 A <ref name="a" />
18106 B <ref name="b">bar</ref>
18107
18108 <references>
18109 <ref name="a">foo</ref>
18110 This should just get lost.
18111 </references>
18112 !! html
18113 <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>
18114 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>
18115
18116
18117 <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":{}}'>
18118 <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>
18119 <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>
18120 </ol>
18121 !!end
18122
18123 !!test
18124 References: 6. <references /> from a transclusion
18125 !!options
18126 parsoid
18127 !! wikitext
18128 <ref>Foo</ref> {{echo|<references />}}
18129 !! html
18130 <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>
18131 !!end
18132
18133 !! test
18134 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18135 !! options
18136 parsoid
18137 !! wikitext
18138 A <ref>foo bar for a</ref>
18139 B <ref group="X" name="b" />
18140
18141 <references />
18142
18143 <references group="X">
18144 <ref name="b">foo</ref>
18145 </references>
18146 !! html
18147 <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>
18148 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>
18149
18150 <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>
18151
18152 <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>
18153 !! end
18154
18155 # This test is wt2html only because we're permitting the serializer to produce
18156 # dirty diffs, normalizing the unclosed references to the self-closed version.
18157 !! test
18158 Generate references for unclosed references tag
18159 !! options
18160 parsoid=wt2html
18161 !! wikitext
18162 a<ref>foo</ref>
18163
18164 <references>
18165 !! html
18166 <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>
18167
18168
18169 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18170 <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>
18171 !! end
18172
18173 !! test
18174 New reference serializes on its own line
18175 !! options
18176 parsoid=wt2wt,html2wt
18177 !! wikitext
18178 foo
18179 <references />
18180 !! html
18181 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18182 !! end
18183
18184 #### ----------------------------------------------------------------
18185 #### The following section of tests are primarily to test
18186 #### wikitext escaping capabilities of Parsoid. Given that
18187 #### escaping can be done any number of ways, the wikitext (input)
18188 #### is always adjusted to reflect how Parsoid adds nowiki
18189 #### escape tags.
18190 ####
18191 #### We are marking several tests as parsoid-only since the
18192 #### HTML in the result section is different from what the
18193 #### PHP parser generates for it.
18194 #### ----------------------------------------------------------------
18195
18196
18197 #### --------------- Headings ---------------
18198 #### 0. Unnested
18199 #### 1. Nested inside html <h1>=foo=</h1>
18200 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18201 #### 3. Nested inside html with wikitext split by html tags
18202 #### 4. No escape needed
18203 #### 5. Empty headings <h1></h1>
18204 #### 6. Heading chars in SOL context
18205 #### ----------------------------------------
18206 !! test
18207 Headings: 0. Unnested
18208 !! options
18209 parsoid
18210 !! wikitext
18211 <nowiki>=foo=</nowiki>
18212
18213 <nowiki> =foo= </nowiki>
18214 <!--cmt-->
18215 <nowiki>=foo=</nowiki>
18216
18217 =foo''a''<nowiki>=</nowiki>
18218 !! html
18219 <p><span typeof="mw:Nowiki">=foo=</span></p>
18220
18221 <p><span typeof="mw:Nowiki"> =foo= </span>
18222 <!--cmt-->
18223 <span typeof="mw:Nowiki">=foo=</span></p>
18224
18225 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18226 !!end
18227
18228 !! test
18229 Headings: 1. Nested inside html
18230 (New headings and existing headings are handled differently)
18231 !! options
18232 parsoid=html2wt
18233 !! wikitext
18234 = =foo= =
18235
18236 == =foo= ==
18237
18238 === =foo= ===
18239
18240 =<nowiki>=foo=</nowiki>=
18241 ==<nowiki>=foo=</nowiki>==
18242 ===<nowiki>=foo=</nowiki>===
18243 ====<nowiki>=foo=</nowiki>====
18244 =====<nowiki>=foo=</nowiki>=====
18245 ======<nowiki>=foo=</nowiki>======
18246
18247 !! html
18248 <h1>=foo=</h1>
18249 <h2>=foo=</h2>
18250 <h3>=foo=</h3>
18251
18252 <h1 data-parsoid='{}'>=foo=</h1>
18253 <h2 data-parsoid='{}'>=foo=</h2>
18254 <h3 data-parsoid='{}'>=foo=</h3>
18255 <h4 data-parsoid='{}'>=foo=</h4>
18256 <h5 data-parsoid='{}'>=foo=</h5>
18257 <h6 data-parsoid='{}'>=foo=</h6>
18258 !!end
18259
18260 !! test
18261 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18262 !! options
18263 parsoid=html2wt
18264 !! wikitext
18265 = foo =
18266 <nowiki>*</nowiki>bar
18267
18268 = foo =
18269 =bar
18270
18271 = foo =
18272 <nowiki>=bar=</nowiki>
18273 !! html
18274 <h1>foo</h1>*bar
18275 <h1>foo</h1>=bar
18276 <h1>foo</h1>=bar=
18277 !!end
18278
18279 !! test
18280 Headings: 3. Nested inside html with wikitext split by html tags
18281 !! options
18282 parsoid=html2wt
18283 !! wikitext
18284 = ='''bold'''<nowiki>foo=</nowiki> =
18285 !! html
18286 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18287 !!end
18288
18289 !! test
18290 Headings: 4a. No escaping needed (testing just h1 and h2)
18291 !! options
18292 parsoid=html2wt
18293 !! wikitext
18294 = =foo =
18295
18296 = foo= =
18297
18298 = =foo= =
18299
18300 = =foo= bar =
18301
18302 == =foo ==
18303
18304 == foo= ==
18305
18306 = ''=''foo= =
18307
18308 = <nowiki>=</nowiki> =
18309 !! html
18310 <h1>=foo</h1>
18311 <h1>foo=</h1>
18312 <h1> =foo= </h1>
18313 <h1>=foo= bar</h1>
18314 <h2>=foo</h2>
18315 <h2>foo=</h2>
18316 <h1><i>=</i>foo=</h1>
18317 <h1><span typeof="mw:Nowiki">=</span></h1>
18318 !!end
18319
18320 !! test
18321 Headings: 4b. No escaping needed (inside p-tags)
18322 !! options
18323 parsoid=html2wt
18324 !! wikitext
18325 ===
18326 =foo= x
18327 =foo= <s></s>
18328 !! html
18329 <p>===
18330 =foo= x
18331 =foo= <s></s>
18332 </p>
18333 !!end
18334
18335 !! test
18336 Headings: 5. Empty headings
18337 !! options
18338 parsoid
18339 !! wikitext
18340 =<nowiki/>=
18341
18342 ==<nowiki/>==
18343
18344 ===<nowiki/>===
18345
18346 ====<nowiki/>====
18347
18348 =====<nowiki/>=====
18349
18350 ======<nowiki/>======
18351 !! html
18352 <h1></h1>
18353 <h2></h2>
18354 <h3></h3>
18355 <h4></h4>
18356 <h5></h5>
18357 <h6></h6>
18358 !!end
18359
18360 !! test
18361 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18362 !! options
18363 parsoid
18364 !! wikitext
18365 <nowiki>=a=</nowiki>
18366
18367 <nowiki>=a=</nowiki>
18368
18369 <nowiki>=a=</nowiki>
18370
18371 <nowiki>=a=</nowiki>
18372 !! html
18373 <p>=a=</p>
18374 <p>=a= </p>
18375 <p>=a= </p>
18376 <p>=a= </p>
18377 !!end
18378
18379 !! test
18380 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18381 !! options
18382 parsoid
18383 !! wikitext
18384 <nowiki>=a=
18385 b</nowiki>
18386
18387 <nowiki>=a=
18388 b</nowiki>
18389
18390 <nowiki>=a=
18391 b</nowiki>
18392
18393 <nowiki>=a=
18394 b</nowiki>
18395 !! html
18396 <p>=a=
18397 b</p>
18398 <p>=a=
18399 b</p>
18400 <p>=a=
18401 b</p>
18402 <p>=a=
18403 b</p>
18404 </p>
18405 !!end
18406
18407 !! test
18408 Headings: 6c. Heading chars in SOL context (leading newline break)
18409 !! options
18410 parsoid
18411 !! wikitext
18412 a
18413 <nowiki>=b=</nowiki>
18414 !! html
18415 <p>a
18416 =b=</p>
18417 !!end
18418
18419 !! test
18420 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18421 !! options
18422 parsoid
18423 !! wikitext
18424 <!--c0--><nowiki>=a=</nowiki>
18425
18426 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
18427 !! html
18428 <p><!--c0-->=a=</p>
18429 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
18430 !!end
18431
18432 !! test
18433 Headings: 6d. Heading chars in SOL context (No escaping needed)
18434 !! options
18435 parsoid=html2wt
18436 !! wikitext
18437 =a=<div>b</div>
18438 !! html
18439 =a=<div>b</div>
18440 !!end
18441
18442 #### --------------- Lists ---------------
18443 #### 0. Outside nests (*foo, etc.)
18444 #### 1. Nested inside html <ul><li>*foo</li></ul>
18445 #### 2. Inside definition lists
18446 #### 3. Only bullets at start should be escaped
18447 #### 4. No escapes needed
18448 #### 5. No unnecessary escapes
18449 #### 6. Escape bullets in SOL position
18450 #### 7. Escape bullets in a multi-line context
18451 #### ----------------------------------------
18452
18453 !! test
18454 Lists: 0. Outside nests
18455 !! wikitext
18456 <nowiki>*</nowiki>foo
18457
18458 <nowiki>#</nowiki>foo
18459 !! html
18460 <p>*foo
18461 </p><p>#foo
18462 </p>
18463 !!end
18464
18465 !! test
18466 Lists: 1. Nested inside html
18467 !! wikitext
18468 *<nowiki>*foo</nowiki>
18469
18470 *<nowiki>#foo</nowiki>
18471
18472 *<nowiki>:foo</nowiki>
18473
18474 *<nowiki>;foo</nowiki>
18475
18476 #<nowiki>*foo</nowiki>
18477
18478 #<nowiki>#foo</nowiki>
18479
18480 #<nowiki>:foo</nowiki>
18481
18482 #<nowiki>;foo</nowiki>
18483 !! html
18484 <ul>
18485 <li>*foo
18486 </li>
18487 </ul>
18488 <ul>
18489 <li>#foo
18490 </li>
18491 </ul>
18492 <ul>
18493 <li>:foo
18494 </li>
18495 </ul>
18496 <ul>
18497 <li>;foo
18498 </li>
18499 </ul>
18500 <ol>
18501 <li>*foo
18502 </li>
18503 </ol>
18504 <ol>
18505 <li>#foo
18506 </li>
18507 </ol>
18508 <ol>
18509 <li>:foo
18510 </li>
18511 </ol>
18512 <ol>
18513 <li>;foo
18514 </li>
18515 </ol>
18516
18517 !!end
18518
18519 !! test
18520 Lists: 2. Inside definition lists
18521 !! wikitext
18522 ;<nowiki>;foo</nowiki>
18523
18524 ;<nowiki>:foo</nowiki>
18525
18526 ;<nowiki>:foo</nowiki>
18527 :bar
18528
18529 :<nowiki>:foo</nowiki>
18530 !! html
18531 <dl>
18532 <dt>;foo
18533 </dt>
18534 </dl>
18535 <dl>
18536 <dt>:foo
18537 </dt>
18538 </dl>
18539 <dl>
18540 <dt>:foo
18541 </dt>
18542 <dd>bar
18543 </dd>
18544 </dl>
18545 <dl>
18546 <dd>:foo
18547 </dd>
18548 </dl>
18549
18550 !!end
18551
18552 !! test
18553 Lists: 3. Only bullets at start of text should be escaped
18554 !! wikitext
18555 *<nowiki>*foo*bar</nowiki>
18556
18557 *<nowiki>*foo</nowiki>''it''*bar
18558 !! html
18559 <ul>
18560 <li>*foo*bar
18561 </li>
18562 </ul>
18563 <ul>
18564 <li>*foo<i>it</i>*bar
18565 </li>
18566 </ul>
18567
18568 !!end
18569
18570 !! test
18571 Lists: 4. No escapes needed
18572 !! options
18573 parsoid
18574 !! wikitext
18575 *foo*bar
18576
18577 *''foo''*bar
18578
18579 *[[Foo]]: bar
18580
18581 *[[Foo]]*bar
18582 !! html
18583 <ul>
18584 <li>foo*bar
18585 </li>
18586 </ul>
18587 <ul>
18588 <li><i>foo</i>*bar
18589 </li>
18590 </ul>
18591 <ul>
18592 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18593 </li>
18594 </ul>
18595 <ul>
18596 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18597 </li>
18598 </ul>
18599 !!end
18600
18601 !! test
18602 Lists: 5. No unnecessary escapes
18603 !! wikitext
18604 * bar <span><nowiki>[[foo]]</nowiki></span>
18605
18606 *=bar <span><nowiki>[[foo]]</nowiki></span>
18607
18608 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18609
18610 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18611
18612 *=bar <span>foo]]</span>=
18613
18614 * <s></s>: a
18615 !! html
18616 <ul>
18617 <li> bar <span>[[foo]]</span>
18618 </li>
18619 </ul>
18620 <ul>
18621 <li>=bar <span>[[foo]]</span>
18622 </li>
18623 </ul>
18624 <ul>
18625 <li>[[bar <span>[[foo]]</span>
18626 </li>
18627 </ul>
18628 <ul>
18629 <li>]]bar <span>[[foo]]</span>
18630 </li>
18631 </ul>
18632 <ul>
18633 <li>=bar <span>foo]]</span>=
18634 </li>
18635 </ul>
18636 <ul>
18637 <li> <s></s>: a
18638 </li>
18639 </ul>
18640
18641 !!end
18642
18643 !! test
18644 Lists: 6. Escape bullets in SOL position
18645 !! options
18646 parsoid
18647 !! wikitext
18648 <!--cmt--><nowiki>*foo</nowiki>
18649 !! html
18650 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18651 !!end
18652
18653 !! test
18654 Lists: 7. Escape bullets in a multi-line context
18655 !! wikitext
18656 a
18657 <nowiki>*</nowiki>b
18658 !! html
18659 <p>a
18660 *b
18661 </p>
18662 !!end
18663
18664 #### --------------- HRs ---------------
18665 #### 1. Single line
18666 #### -----------------------------------
18667
18668 !! test
18669 HRs: 1. Single line
18670 !! options
18671 parsoid
18672 !! wikitext
18673 ----<nowiki>----</nowiki>
18674 ----=foo=
18675 ----*foo
18676 !! html
18677 <hr><span typeof="mw:Nowiki">----</span>
18678 <hr>=foo=
18679 <hr>*foo
18680 !! end
18681
18682 #### --------------- Tables ---------------
18683 #### 1a. Simple example
18684 #### 1b. No escaping needed (!foo)
18685 #### 1c. No escaping needed (|foo)
18686 #### 1d. No escaping needed (|}foo)
18687 ####
18688 #### 2a. Nested in td (<td>foo|bar</td>)
18689 #### 2b. Nested in td (<td>foo||bar</td>)
18690 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18691 ####
18692 #### 3a. Nested in th (<th>foo!bar</th>)
18693 #### 3b. Nested in th (<th>foo!!bar</th>)
18694 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18695 ####
18696 #### 4a. Escape -
18697 #### 4b. Escape +
18698 #### 4c. No escaping needed
18699 #### --------------------------------------
18700
18701 !! test
18702 Tables: 1a. Simple example
18703 !! wikitext
18704 <nowiki>{|
18705 |}</nowiki>
18706 !! html
18707 <p>{|
18708 |}
18709 </p>
18710 !! end
18711
18712 !! test
18713 Tables: 1b. No escaping needed
18714 !! wikitext
18715 !foo
18716 !! html
18717 <p>!foo
18718 </p>
18719 !! end
18720
18721 !! test
18722 Tables: 1c. No escaping needed
18723 !! wikitext
18724 |foo
18725 !! html
18726 <p>|foo
18727 </p>
18728 !! end
18729
18730 !! test
18731 Tables: 1d. No escaping needed
18732 !! wikitext
18733 |}foo
18734 !! html
18735 <p>|}foo
18736 </p>
18737 !! end
18738
18739 !! test
18740 Tables: 2a. Nested in td
18741 !! options
18742 parsoid=html2wt
18743 !! wikitext
18744 {|
18745 |<nowiki>foo|bar</nowiki>
18746 |-
18747 |x<div><nowiki>a|b</nowiki></div>
18748 |}
18749 !! html
18750 <table><tbody><tr>
18751 <td>foo|bar</td></tr>
18752 <tr><td>x<div>a|b</div></td>
18753 </tbody></table>
18754 !! end
18755
18756 !! test
18757 Tables: 2b. Nested in td
18758 !! options
18759 parsoid
18760 !! wikitext
18761 {|
18762 |<nowiki>foo||bar</nowiki>
18763 |''it''<nowiki>foo||bar</nowiki>
18764 |}
18765 !! html
18766 <table><tbody><tr>
18767 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18768 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18769 !! end
18770
18771 !! test
18772 Tables: 2c. Nested in td -- no escaping needed
18773 !! options
18774 parsoid
18775 !! wikitext
18776 {|
18777 |foo!!bar
18778 |}
18779 !! html
18780 <table><tbody><tr><td>foo!!bar
18781 </td></tr></tbody></table>
18782
18783 !! end
18784
18785 !! test
18786 Tables: 3a. Nested in th
18787 !! options
18788 parsoid
18789 !! wikitext
18790 {|
18791 !foo!bar
18792 |}
18793 !! html
18794 <table><tbody><tr><th>foo!bar
18795 </th></tr></tbody></table>
18796
18797 !! end
18798
18799 !! test
18800 Tables: 3b. Nested in th
18801 !! options
18802 parsoid
18803 !! wikitext
18804 {|
18805 !<nowiki>foo!!bar</nowiki>
18806 |}
18807 !! html
18808 <table>
18809 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18810 </tbody></table>
18811 !! end
18812
18813 !! test
18814 Tables: 3c. Nested in th -- no escaping needed
18815 !! options
18816 parsoid
18817 !! wikitext
18818 {|
18819 !<nowiki>foo||bar</nowiki>
18820 |}
18821 !! html
18822 <table><tbody><tr>
18823 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18824 !! end
18825
18826 !! test
18827 Tables: 4a. Escape -
18828 !! options
18829 parsoid
18830 !! wikitext
18831 {|
18832 !-bar
18833 |-
18834 |<nowiki>-bar</nowiki>
18835 |}
18836 !! html
18837 <table><tbody>
18838 <tr><th>-bar</th></tr>
18839 <tr>
18840 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18841 !! end
18842
18843 !! test
18844 Tables: 4b. Escape +
18845 !! options
18846 parsoid
18847 !! wikitext
18848 {|
18849 !+bar
18850 |-
18851 |<nowiki>+bar</nowiki>
18852 |}
18853 !! html
18854 <table><tbody>
18855 <tr><th>+bar</th></tr>
18856 <tr>
18857 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18858 !! end
18859
18860 !! test
18861 Tables: 4c. No escaping needed
18862 !! options
18863 parsoid
18864 !! wikitext
18865 {|
18866 |foo-bar
18867 |foo+bar
18868 |-
18869 |''foo''-bar
18870 |''foo''+bar
18871 |-
18872 |foo
18873 bar|baz
18874 +bar
18875 -bar
18876 |-
18877 |x
18878 <div>a|b</div>
18879 |}
18880 !! html
18881 <table><tbody>
18882 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18883 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18884 <tr><td>foo
18885 <p>bar|baz
18886 +bar
18887 -bar</p></td></tr>
18888 <tr><td>x
18889 <div>a|b</div></td>
18890 </tbody></table>
18891 !! end
18892
18893 !! test
18894 Tables: 4d. No escaping needed
18895 !! options
18896 parsoid
18897 !! wikitext
18898 {|
18899 |[[Foo]]-bar
18900 ||+1
18901 ||-2
18902 |}
18903 !! html
18904 <table>
18905 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18906 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18907 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18908 </tbody></table>
18909 !! end
18910
18911 !! test
18912 Tables: Digest broken attributes on table and tr tag
18913 !! options
18914 parsoid=wt2html
18915 !! wikitext
18916 {| || |} ++
18917 |- || || ++ --
18918 |- > [
18919 |}
18920 !! html
18921 <table>
18922 <tbody>
18923 <tr></tr>
18924 <tr></tr>
18925 </tbody></table>
18926 !! end
18927
18928 #### --------------- Links ----------------
18929 #### 1. Quote marks in link text
18930 #### 2. Wikilinks: Escapes needed
18931 #### 3. Wikilinks: No escapes needed
18932 #### 4. Extlinks: Escapes needed
18933 #### 5. Extlinks: No escapes needed
18934 #### --------------------------------------
18935 !! test
18936 Links 1. Quote marks in link text
18937 !! options
18938 parsoid
18939 !! wikitext
18940 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18941 !! html
18942 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18943 !! end
18944
18945 !! test
18946 Links 2. WikiLinks: Escapes needed
18947 !! options
18948 parsoid
18949 !! wikitext
18950 [[Foo|[Foobar]]]
18951 [[Foo|<nowiki>Foobar]</nowiki>]]
18952 [[Foo|x [Foobar] x]]
18953 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18954 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18955 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18956 [[Foo|<nowiki>|Bar</nowiki>]]
18957 [[Foo|<nowiki>]]bar</nowiki>]]
18958 [[Foo|<nowiki>[[bar</nowiki>]]
18959 [[Foo|<nowiki>x [[ y</nowiki>]]
18960 [[Foo|<nowiki>x ]] y</nowiki>]]
18961 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18962 !! html
18963 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18964 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18965 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18966 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18967 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18968 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18969 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18970 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18971 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18972 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18973 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18974 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18975 !! end
18976
18977 !! test
18978 Links 3. WikiLinks: No escapes needed
18979 !! options
18980 parsoid
18981 !! wikitext
18982 [[Foo|[Foobar]]
18983 [[Foo|foo|bar]]
18984 !! html
18985 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18986 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18987 !! end
18988
18989 !! test
18990 Links 4. ExtLinks: Escapes needed
18991 !! options
18992 parsoid
18993 !! wikitext
18994 [http://google.com <nowiki>[google]</nowiki>]
18995 [http://google.com <nowiki>google]</nowiki>]
18996
18997 <nowiki>[http://google.com]</nowiki>
18998
18999 <nowiki>[http://google.com google]</nowiki>
19000
19001 !! html
19002 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19003 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19004 <p>[http://google.com]</p>
19005 <p>[http://google.com google]</p>
19006 !! end
19007
19008 !! test
19009 Links 5. ExtLinks: No escapes needed
19010 !! options
19011 parsoid
19012 !! wikitext
19013 [http://google.com [google]
19014 !! html
19015 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19016 !! end
19017
19018 #### --------------- Quotes ---------------
19019 #### 1. Quotes inside <b> and <i>
19020 #### 2. Link fragments separated by <i> and <b> tags
19021 #### 3. Link fragments inside <i> and <b>
19022 #### 4. No escaping needed
19023 #### --------------------------------------
19024 !! test
19025 1. Quotes inside <b> and <i>
19026 !! options
19027 parsoid=html2wt,wt2wt
19028 !! wikitext
19029 ''<nowiki>'foo'</nowiki>''
19030 ''<nowiki>''foo''</nowiki>''
19031 ''<nowiki>'''foo'''</nowiki>''
19032 ''foo''<nowiki/>'s
19033 '''<nowiki>'foo'</nowiki>'''
19034 '''<nowiki>''foo''</nowiki>'''
19035 '''<nowiki>'''foo'''</nowiki>'''
19036 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19037 '''foo'''<nowiki/>'s
19038 '''foo''
19039 ''foo''<nowiki/>'
19040 '<nowiki/>''foo''<nowiki/>'
19041 ''''foo'''
19042 '''foo'''<nowiki/>'
19043 '<nowiki/>'''foo'''<nowiki/>'
19044 ''fools'<span> errand</span>''
19045 ''<span>fool</span>'s errand''
19046 !! html
19047 <p><i>'foo'</i>
19048 <i>''foo''</i>
19049 <i>'''foo'''</i>
19050 <i>foo</i>'s
19051 <b>'foo'</b>
19052 <b>''foo''</b>
19053 <b>'''foo'''</b>
19054 <b>foo'<i>bar'</i>baz</b>
19055 <b>foo</b>'s
19056 '<i>foo</i>
19057 <i>foo</i>'
19058 '<i>foo</i>'
19059 '<b>foo</b>
19060 <b>foo</b>'
19061 '<b>foo</b>'</p>
19062 <i>fools'<span> errand</span></i>
19063 <i><span>fool</span>'s errand</i>
19064 !! end
19065
19066 !! test
19067 2. Link fragments separated by <i> and <b> tags
19068 !! wikitext
19069 [[''foo''<nowiki>hello]]</nowiki>
19070
19071 [['''foo'''<nowiki>hello]]</nowiki>
19072 !! html
19073 <p>[[<i>foo</i>hello]]
19074 </p><p>[[<b>foo</b>hello]]
19075 </p>
19076 !! end
19077
19078 !! test
19079 3. Link fragments inside <i> and <b>
19080 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19081 this is one of the shortcomings of this format)
19082 !! wikitext
19083 ''[[foo''<nowiki>]]</nowiki>
19084
19085 '''[[foo'''<nowiki>]]</nowiki>
19086 !! html
19087 <p><i>[[foo</i>]]
19088 </p><p><b>[[foo</b>]]
19089 </p>
19090 !! end
19091
19092 !! test
19093 4. No escaping needed
19094 !! wikitext
19095 '<span>''bar''</span>'
19096 '<span>'''bar'''</span>'
19097 !! html
19098 <p>'<span><i>bar</i></span>'
19099 '<span><b>bar</b></span>'
19100 </p>
19101 !! end
19102
19103 #### ----------- Paragraphs ---------------
19104 #### 1. No unnecessary escapes
19105 #### --------------------------------------
19106
19107 !! test
19108 1. No unnecessary escapes
19109 !! wikitext
19110 bar <span><nowiki>[[foo]]</nowiki></span>
19111
19112 =bar <span><nowiki>[[foo]]</nowiki></span>
19113
19114 [[bar <span><nowiki>[[foo]]</nowiki></span>
19115
19116 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19117
19118 =bar <span>foo]]</span><nowiki>=</nowiki>
19119 !! html
19120 <p>bar <span>[[foo]]</span>
19121 </p><p>=bar <span>[[foo]]</span>
19122 </p><p>[[bar <span>[[foo]]</span>
19123 </p><p>]]bar <span>[[foo]]</span>
19124 </p><p>=bar <span>foo]]</span>=
19125 </p>
19126 !!end
19127
19128 #### ----------------------- PRE --------------------------
19129 #### 1. Leading whitespace in SOL context should be escaped
19130 #### ------------------------------------------------------
19131 !! test
19132 1. Leading whitespace in SOL context should be escaped
19133 !! options
19134 parsoid
19135 !! wikitext
19136 <nowiki> </nowiki>a
19137
19138 <nowiki> </nowiki> a
19139
19140 <nowiki> </nowiki>a(tab)
19141
19142 <nowiki> </nowiki> a
19143 <!--cmt-->
19144 <nowiki> </nowiki> a
19145
19146 a
19147 <nowiki> </nowiki>b
19148
19149 a
19150 <nowiki> </nowiki>b
19151
19152 a
19153 <nowiki> </nowiki> b
19154 !! html
19155 <p> a</p>
19156 <p> a</p>
19157 <p> a(tab)</p>
19158 <p> a</p>
19159 <p><!--cmt--> a</p>
19160 <p>a
19161 b</p>
19162 <p>a
19163 b</p>
19164 <p>a
19165 b</p>
19166 !! end
19167
19168 #### --------------- Behavior Switches --------------------
19169 !! test
19170 1. Valid behavior switches should be escaped
19171 !! options
19172 parsoid=html2wt
19173 !! wikitext
19174 <nowiki>__TOC__</nowiki>
19175 !! html
19176 __TOC__
19177 !! end
19178
19179 !! test
19180 2. Invalid behavior switches should not be escaped
19181 !! options
19182 parsoid=html2wt
19183 !! wikitext
19184 __TOO__
19185 __|__
19186 !! html
19187 __TOO__
19188 __|__
19189 !! end
19190
19191 #### --------------- HTML tags ---------------
19192 #### 1. a tags
19193 #### 2. other tags
19194 #### 3. multi-line html tag
19195 #### 4. extension tags
19196 #### -----------------------------------------
19197 !! test
19198 1. a tags
19199 !! options
19200 parsoid
19201 !! wikitext
19202 <a href="http://google.com">google</a>
19203 !! html
19204 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19205 !! end
19206
19207 !! test
19208 2. other tags
19209 !! wikitext
19210 <nowiki><div>foo</div>
19211 <div style="color:red">foo</div></nowiki>
19212 !! html
19213 <p>&lt;div&gt;foo&lt;/div&gt;
19214 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19215 </p>
19216 !! end
19217
19218 !! test
19219 3. multi-line html tag
19220 !! wikitext
19221 <nowiki><div
19222 >foo</div
19223 ></nowiki>
19224 !! html
19225 <p>&lt;div
19226 &gt;foo&lt;/div
19227 &gt;
19228 </p>
19229 !! end
19230
19231 !! test
19232 4. extension tags
19233 !! wikitext
19234 <nowiki><ref>foo</ref></nowiki>
19235
19236 <nowiki><ref>bar</nowiki>
19237
19238 baz<nowiki></ref></nowiki>
19239 !! html
19240 <p>&lt;ref&gt;foo&lt;/ref&gt;
19241 </p><p>&lt;ref&gt;bar
19242 </p><p>baz&lt;/ref&gt;
19243 </p>
19244 !! end
19245
19246 #### --------------- Others ---------------
19247 !! test
19248 Escaping nowikis
19249 !! wikitext
19250 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19251 !! html
19252 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19253 </p>
19254 !! end
19255
19256 ## The quote-char in the input is necessary for triggering the bug
19257 !! test
19258 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19259 !! options
19260 parsoid=wt2wt,html2wt
19261 !! wikitext
19262 foo's bar :
19263 !! html
19264 <p>foo's bar :</p>
19265 !! end
19266
19267 !! test
19268
19269 Tag-like HTML structures are passed through as text
19270 !! wikitext
19271 <x y>
19272
19273 <x.y>
19274
19275 <x-y>
19276
19277 1>2
19278
19279 x<y
19280
19281 a>b
19282
19283 1<d e>f
19284 !! html
19285 <p>&lt;x y&gt;
19286 </p><p>&lt;x.y&gt;
19287 </p><p>&lt;x-y&gt;
19288 </p><p>1&gt;2
19289 </p><p>x&lt;y
19290 </p><p>a&gt;b
19291 </p><p>1&lt;d e&gt;f
19292 </p>
19293 !! end
19294
19295
19296 # This was a bug in the PHP parser (see bug 17663 and its dups,
19297 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19298 !! test
19299 Tag names followed by punctuation should not be recognized as tags
19300 !! wikitext
19301 <s.ome> text
19302 !! html
19303 <p>&lt;s.ome&gt; text
19304 </p>
19305 !! end
19306
19307 !! test
19308 HTML tag with necessary entities in attributes
19309 !! wikitext
19310 <span title="&amp;amp;">foo</span>
19311 !! html
19312 <p><span title="&amp;amp;">foo</span>
19313 </p>
19314 !! end
19315
19316 !! test
19317 HTML tag with 'unnecessary' entity encoding in attributes
19318 !! wikitext
19319 <span title="&amp;">foo</span>
19320 !! html
19321 <p><span title="&amp;">foo</span>
19322 </p>
19323 !! end
19324
19325 !! test
19326 HTML tag with broken attribute value quoting
19327 !! wikitext
19328 <span title="Hello world>Foo</span>
19329 !! html
19330 <p><span>Foo</span>
19331 </p>
19332 !! end
19333
19334 !! test
19335 Parsoid-only: HTML tag with broken attribute value quoting
19336 !! options
19337 parsoid
19338 !! wikitext
19339 <span title="Hello world>Foo</span>
19340 !! html
19341 <p><span title="Hello world">Foo</span>
19342 </p>
19343 !! end
19344
19345 !! test
19346 Table with broken attribute value quoting
19347 !! wikitext
19348 {|
19349 | title="Hello world|Foo
19350 |}
19351 !! html
19352 <table>
19353 <tr>
19354 <td>Foo
19355 </td></tr></table>
19356
19357 !! end
19358
19359 !! test
19360 Table with broken attribute value quoting on consecutive lines
19361 !! wikitext
19362 {|
19363 | title="Hello world|Foo
19364 | style="color:red|Bar
19365 |}
19366 !! html
19367 <table>
19368 <tr>
19369 <td>Foo
19370 </td>
19371 <td>Bar
19372 </td></tr></table>
19373
19374 !! end
19375
19376 !! test
19377 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19378 !! options
19379 parsoid
19380 !! wikitext
19381 {|
19382 | title="Hello world|Foo
19383 | style="color:red|Bar
19384 |}
19385 !! html
19386 <table><tbody>
19387 <tr>
19388 <td title="Hello world">Foo
19389 </td><td style="color: red">Bar
19390 </td></tr></tbody></table>
19391
19392 !! end
19393
19394 !! test
19395 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19396 !! options
19397 parsoid
19398 !! wikitext
19399 {{}}
19400 !! html
19401 {{}}
19402 !! end
19403
19404 !! test
19405 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19406 !! options
19407 parsoid
19408 !! wikitext
19409 }}{{
19410 !! html
19411 }}{{
19412 !! end
19413
19414 !!test
19415 Accept empty td cell attribute
19416 !! wikitext
19417 {|
19418 | align="center" | foo || |
19419 |}
19420 !! html
19421 <table>
19422 <tr>
19423 <td align="center"> foo </td>
19424 <td>
19425 </td></tr></table>
19426
19427 !!end
19428
19429 !!test
19430 Non-empty attributes in th-cells
19431 !! wikitext
19432 {|
19433 ! Foo !! style="color: red" | Bar
19434 |}
19435 !! html
19436 <table>
19437 <tr>
19438 <th> Foo </th>
19439 <th style="color: red"> Bar
19440 </th></tr></table>
19441
19442 !!end
19443
19444 !!test
19445 Accept empty attributes in th-cells
19446 !! wikitext
19447 {|
19448 !| foo !!| bar
19449 |}
19450 !! html
19451 <table>
19452 <tr>
19453 <th> foo </th>
19454 <th> bar
19455 </th></tr></table>
19456
19457 !!end
19458
19459 !!test
19460 Empty table rows go away
19461 !! wikitext
19462 {|
19463 | Hello
19464 | there
19465 |- class="foo"
19466 |-
19467 |}
19468 !! html
19469 <table>
19470 <tr>
19471 <td> Hello
19472 </td>
19473 <td> there
19474 </td></tr>
19475
19476 </table>
19477
19478 !! end
19479
19480 ###
19481 ### Parsoid-centric tests for testing RTing of inter-element separators
19482 ### Edge cases not tested by existing parser tests and specific to
19483 ### Parsoid-specific serialization strategies.
19484 ###
19485
19486 !!test
19487 RT-ed inter-element separators should be valid separators
19488 !! wikitext
19489 {|
19490 |- [[foo]]
19491 |}
19492 !! html
19493 <table>
19494
19495 </table>
19496
19497 !!end
19498
19499 !!test
19500 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19501 (Parsoid-only since PHP parser relies on Tidy for correct output)
19502 !!options
19503 parsoid
19504 !! wikitext
19505 {|
19506 |<small>foo
19507 bar
19508 |}
19509
19510 {|
19511 |<small>foo<small>
19512 |}
19513 !! html
19514 !!end
19515
19516 !!test
19517 Empty TD followed by TD with tpl-generated attribute
19518 !! wikitext
19519 {|
19520 |-
19521 |
19522 |{{echo|style='color:red'}}|foo
19523 |}
19524 !! html
19525 <table>
19526
19527 <tr>
19528 <td>
19529 </td>
19530 <td>foo
19531 </td></tr></table>
19532
19533 !!end
19534
19535 !!test
19536 Indented table with an empty td
19537 !! wikitext
19538 {|
19539 |-
19540 |
19541 |foo
19542 |}
19543 !! html
19544 <table>
19545
19546 <tr>
19547 <td>
19548 </td>
19549 <td>foo
19550 </td></tr></table>
19551
19552 !!end
19553
19554 !!test
19555 Empty TR followed by a template-generated TR
19556 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19557 !!options
19558 parsoid
19559 !! wikitext
19560 {|
19561 |-
19562 {{echo|<tr><td>foo</td></tr>}}
19563 |}
19564 !! html
19565 <table>
19566 <tbody>
19567 <tr></tr>
19568 <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}}]}'>
19569 <td>foo</td></tr>
19570 </tbody></table>
19571 !!end
19572
19573 ## PHP and parsoid output differ for this, and since this is primarily
19574 ## for testing Parsoid's serializer, marking this Parsoid only
19575 !!test
19576 Empty TR followed by mixed-ws-comment line should RT correctly
19577 !!options
19578 parsoid
19579 !! wikitext
19580 {|
19581 |-
19582 <!--c-->
19583 |-
19584 <!--c--> <!--d-->
19585 |}
19586 !! html
19587 <table>
19588 <tbody>
19589 <tr></tr>
19590 <!--c-->
19591 <tr>
19592 <!--c--> </tr><!--d-->
19593 </tbody></table>
19594
19595 !!end
19596
19597 !!test
19598 Multi-line image caption generated by templates with/without trailing newlines
19599 !!options
19600 parsoid
19601 !! wikitext
19602 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19603 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19604 !! html
19605 <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>
19606 <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>
19607
19608 !!end
19609
19610 !! test
19611 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19612 !! options
19613 parsoid=html2wt
19614 !! wikitext
19615 <includeonly>foo</includeonly>
19616 new para
19617
19618 [[./Category:Foo]]
19619
19620 = new heading =
19621 !! html
19622 <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>
19623
19624 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19625 !! end
19626
19627 ## PHP emits broken html for this, and since this is primarily
19628 ## a Parsoid serializer test, marking this Parsoid only
19629 !!test
19630 Improperly nested inline or quotes tags with whitespace in between
19631 !!options
19632 parsoid
19633 !! wikitext
19634 <span> <s>x</span> </s>
19635 ''' ''x''' ''
19636 !! html
19637 <p><span> <s>x</s></span><s> </s>
19638 <b> <i>x</i></b><i> </i>
19639 </p>
19640 !!end
19641
19642 !!test
19643 Encapsulate protected attributes from wt
19644 !!options
19645 parsoid
19646 !! wikitext
19647 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19648 !! html
19649 <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>
19650 </body>
19651 !!end
19652
19653 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19654 ## Having nested or stray pre tags results in the attempt to add duplicates,
19655 ## causing an assertion fail. This test tries to prevent that situation.
19656 !!test
19657 Ensure ParagraphWrapper can deal with stray closing pre tags
19658 !!options
19659 parsoid=wt2html
19660 !! wikitext
19661 plain text</pre>
19662 !! html
19663 plain text
19664 !!end
19665
19666 !!test
19667 1. Ensure fostered text content is wrapped in spans
19668 !!options
19669 parsoid=wt2html
19670 !! wikitext
19671 <table>hi</table><table>ho</table>
19672 !! html
19673 <span>hi</span>
19674 <table></table>
19675 <span>ho</span>
19676 <table></table>
19677 !!end
19678
19679 !!test
19680 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19681 !!options
19682 parsoid=wt2html,wt2wt
19683 !! wikitext
19684 <table>
19685 <tr> || ||
19686 <td> a
19687 </table>
19688 !! html
19689 <span> || ||</span>
19690 <table>
19691 <tbody>
19692 <tr>
19693 <td> a</td></tr>
19694 </tbody></table>
19695 !!end
19696
19697 !!test
19698 Encapsulation properly handles null DSR information from foster box
19699 !!options
19700 parsoid=wt2html,wt2wt
19701 !! wikitext
19702 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19703 !! html
19704 <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;
19705 <table>foo
19706 <tr>
19707 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19708 <table>
19709 <tbody>
19710 <tr>
19711 <td>bar</td></tr></tbody></table>
19712 !!end
19713
19714 !!test
19715 1. Encapsulate foster-parented transclusion content
19716 !!options
19717 parsoid=wt2wt,wt2html
19718 !! wikitext
19719 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19720 !! html
19721 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19722 <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
19723 <tr>
19724 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19725 <table>
19726 <tbody>
19727 <tr>
19728 <td>bar</td></tr></tbody></table>
19729 !!end
19730
19731 !!test
19732 2. Encapsulate foster-parented transclusion content
19733 !!options
19734 parsoid=wt2wt,wt2html
19735 !! wikitext
19736 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19737 !! html
19738 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19739 <table>
19740 <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>
19741 <tr>
19742 <td>bar</td></tr></table>&quot;]}">foo</div>
19743 <table>
19744 <tbody>
19745 <tr>
19746 <td>bar</td></tr></tbody></table>
19747 !!end
19748
19749 !!test
19750 3. Encapsulate foster-parented transclusion content
19751 !!options
19752 parsoid=wt2wt,wt2html
19753 !! wikitext
19754 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19755 !! html
19756 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19757 <table>
19758 <div>
19759 <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>
19760 <tr>
19761 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19762 <p>foo</p></div>
19763 <table>
19764 <tbody>
19765 <tr>
19766 <td>bar</td></tr></tbody></table>
19767 !!end
19768
19769 !!test
19770 4. Encapsulate foster-parented transclusion content
19771 !!options
19772 parsoid=wt2wt,wt2html
19773 !! wikitext
19774 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19775 !! html
19776 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19777 <table>
19778 <div>
19779 <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>
19780 <tr>
19781 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19782 <p>foo</p></div>
19783 <table>
19784 <tbody>
19785 <tr>
19786 <td>bar</td></tr></tbody></table>
19787 !!end
19788
19789 !!test
19790 5. Encapsulate foster-parented transclusion content
19791 !!options
19792 parsoid=wt2wt,wt2html
19793 !! wikitext
19794 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19795 !! html
19796 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19797 <table>
19798 <tr>
19799 <td>
19800 <div>
19801 <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>
19802 <table>
19803 <tbody>
19804 <tr>
19805 <td>
19806 <div>
19807 <p>foo</p></div></td></tr></tbody></table>
19808 !!end
19809
19810 !!test
19811 6. Encapsulate foster-parented transclusion content
19812 !!options
19813 parsoid=wt2wt,wt2html
19814 !! wikitext
19815 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19816 !! html
19817 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19818 <table>
19819 <tr>
19820 <td>
19821 <div>
19822 <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>
19823 <table>
19824 <tbody>
19825 <tr>
19826 <td>
19827 <div>
19828 <p>foo</p></div></td></tr></tbody></table>
19829 <p>ok</p>
19830 !!end
19831
19832 !!test
19833 7. Encapsulate foster-parented transclusion content
19834 !!options
19835 parsoid=wt2wt,wt2html
19836 !! wikitext
19837 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19838 !! html
19839 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19840 <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;
19841 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19842 <td>bar</td></table>&quot;]}">foo</p>
19843 <table>
19844 <tbody>
19845 <tr>
19846 <td>bar</td></tr></tbody></table>
19847 !!end
19848
19849 !!test
19850 8. Encapsulate foster-parented transclusion content
19851 !!options
19852 parsoid=wt2wt,wt2html
19853 !! wikitext
19854 {{echo|a
19855 }}{|{{echo|style='color:red'}}
19856 |-
19857 |b
19858 |}
19859 !! html
19860 <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>
19861 <table>
19862 <tbody>
19863 <tr>
19864 <td>b</td></tr></tbody></table>
19865 !!end
19866
19867 !!test
19868 9. Encapsulate foster-parented transclusion content
19869 !!options
19870 parsoid=wt2wt,wt2html
19871 !! wikitext
19872 <table>{{echo|hi</table>hello}}
19873 !! html
19874 <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>
19875 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
19876 !!end
19877
19878 !!test
19879 Table in fosterable position
19880 !!options
19881 parsoid=wt2html,wt2wt
19882 !! wikitext
19883 {{OpenTable}}
19884 <div>
19885 {|
19886 |}
19887 </div>
19888 |}
19889 !! html
19890 <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="{}">
19891 </span>
19892 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19893
19894 <table>
19895 </table>
19896 !!end
19897
19898 !!test
19899 Support <object> element with .data attribute
19900 !!options
19901 parsoid=html2wt
19902 !! wikitext
19903 <object data="test.swf"></object>
19904 !! html
19905 <object data="test.swf"></object>
19906 !!end
19907
19908 # -----------------------------------------------------------------
19909 # The following section of tests are primarily to spec requirements
19910 # around serialization of new/edited content.
19911 #
19912 # All these tests are marked Parsoid html2wt and html2html only
19913 # ----------------------------------------------------------------
19914
19915 !! test
19916 Image: Modifying size of an image (1)
19917 !! options
19918 parsoid={
19919 "modes": ["wt2wt"],
19920 "changes": [
19921 ["img[height]", "attr", "height", "22"],
19922 ["img[width]", "attr", "width", "200"]
19923 ]
19924 }
19925 !! wikitext
19926 [[Image:Foobar.jpg|230x230px]]
19927 !! wikitext/edited
19928 [[Image:Foobar.jpg|200x200px]]
19929 !!end
19930
19931 !! test
19932 Image: Modifying size of an image (2)
19933 !! options
19934 parsoid={
19935 "modes": ["wt2wt"],
19936 "changes": [
19937 ["img[height]", "attr", "height", "100"],
19938 ["img[width]", "attr", "width", "500"]
19939 ]
19940 }
19941 !! wikitext
19942 [[Image:Foobar.jpg|230x230px]]
19943 !! wikitext/edited
19944 [[Image:Foobar.jpg|500x500px]]
19945 !!end
19946
19947 # Change in size is ignored so long as class='mw-default-size'
19948 !! test
19949 Image: Modifying size of an image (3)
19950 !! options
19951 parsoid={
19952 "modes": ["wt2wt"],
19953 "changes": [
19954 ["figure[class]", "removeClass", "mw-default-size"],
19955 ["figure img", "attr", "height", "19"],
19956 ["figure img", "attr", "width", "170"]
19957 ]
19958 }
19959 !! wikitext
19960 [[Image:Foobar.jpg|thumb]]
19961 !! wikitext/edited
19962 [[Image:Foobar.jpg|thumb|170x170px]]
19963 !!end
19964
19965 !! test
19966 Image: Modifying alignment of an image (bug 48665)
19967 !! options
19968 parsoid={
19969 "modes": ["wt2wt"],
19970 "changes": [
19971 ["figure[class]", "removeClass", "mw-halign-right"],
19972 ["figure[class]", "addClass", "mw-halign-left"]
19973 ]
19974 }
19975 !! wikitext
19976 [[Image:Foobar.jpg|thumb|caption|right]]
19977 !! wikitext/edited
19978 [[Image:Foobar.jpg|thumb|caption|left]]
19979 !! end
19980
19981 !! test
19982 Image: Modifying mw-default-size of an frameless image (bug 62805)
19983 !! options
19984 parsoid={
19985 "modes": ["wt2wt"],
19986 "changes": [
19987 ["figure.mw-default-size", "removeClass", "mw-default-size"]
19988 ]
19989 }
19990 !! wikitext
19991 [[Image:Foobar.jpg|frameless|right]]
19992 !! wikitext/edited
19993 [[Image:Foobar.jpg|frameless|right|220x220px]]
19994 !! end
19995
19996 !! test
19997 Image: Modifying valign of an image (bug 49221)
19998 !! options
19999 parsoid={
20000 "modes": ["wt2wt"],
20001 "changes": [
20002 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20003 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20004 ]
20005 }
20006 !! wikitext
20007 [[File:Foobar.jpg|20px|middle]]
20008 !! wikitext/edited
20009 [[File:Foobar.jpg|20px|text-top]]
20010 !! end
20011
20012 !! test
20013 Image: Modifying alt attribute of an image (bug 56400)
20014 !! options
20015 parsoid={
20016 "modes": ["wt2wt"],
20017 "changes": [
20018 ["img[alt]", "attr", "alt", "some alternate edited text"]
20019 ]
20020 }
20021 !! wikitext
20022 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20023 !! wikitext/edited
20024 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20025 !!end
20026
20027 !! test
20028 Image: Modifying caption of an image
20029 !! options
20030 parsoid={
20031 "modes": ["wt2wt"],
20032 "changes": [
20033 ["figcaption", "text", "new caption"]
20034 ]
20035 }
20036 !! wikitext
20037 [[Image:Foobar.jpg|thumb|original caption]]
20038 !! wikitext/edited
20039 [[Image:Foobar.jpg|thumb|new caption]]
20040 !!end
20041
20042 !! test
20043 Image: empty alt attribute (bug 48924)
20044 !! options
20045 parsoid
20046 !! wikitext
20047 [[File:Foobar.jpg|thumb|alt=|bar]]
20048 !! html
20049 <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>
20050 !! end
20051
20052 #!! test
20053 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20054 #!! options
20055 #parsoid=html2wt
20056 #language=ar
20057 #!! input
20058 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20059 #!! result
20060 #<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>
20061 #!! end
20062
20063 !! test
20064 Image: Block level image should have \n before and after
20065 !! options
20066 parsoid
20067 !! wikitext
20068 123
20069 [[File:Foobar.jpg|right|thumb|150x150px]]
20070 456
20071 !! html
20072 <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>
20073 !!end
20074
20075 !! test
20076 Image: New block level image should have \n before and after (existing
20077 content)
20078 !! options
20079 parsoid
20080 !! wikitext
20081 123
20082 [[File:Foobar.jpg|right|thumb|150x150px]]
20083 456
20084 !! html
20085 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20086 <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>
20087 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20088 !!end
20089
20090 !! test
20091 Image: upright option (parsoid)
20092 !! options
20093 parsoid
20094 !! wikitext
20095 [[File:Foobar.jpg|thumb|upright|caption]]
20096 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20097 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20098 !! html
20099 <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>
20100 !!end
20101
20102 !! test
20103 Image: upright option is ignored on inline and frame images (parsoid)
20104 !! options
20105 parsoid
20106 !! wikitext
20107 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20108 !! html
20109 <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>
20110 !!end
20111
20112 !! test
20113 Image: from basic HTML (1)
20114 !! options
20115 parsoid=html2wt
20116 !! html/parsoid
20117 <span typeof="mw:Image">
20118 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20119 </span>
20120 !! wikitext
20121 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20122 !! end
20123
20124 !! test
20125 Image: from basic HTML (2)
20126 !! options
20127 parsoid=html2wt
20128 !! html/parsoid
20129 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20130 !! wikitext
20131 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20132 !! end
20133
20134 !! test
20135 Image: from basic HTML (3)
20136 !! options
20137 parsoid=html2wt
20138 !! html/parsoid
20139 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20140 !! wikitext
20141 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20142 !! end
20143
20144 !! test
20145 Image: from basic HTML (4)
20146 !! options
20147 parsoid=html2wt
20148 !! html/parsoid
20149 <img src="File:Foobar.jpg">
20150 !! wikitext
20151 [[File:Foobar.jpg|link=]]
20152 !! end
20153
20154 !! test
20155 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20156 !! options
20157 parsoid=html2wt
20158 !! wikitext
20159 * foo
20160 !! html
20161 <ul>
20162 <li><p>foo</p></li>
20163 </ul>
20164 !! end
20165
20166 !! test
20167 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20168 !! options
20169 parsoid=html2wt
20170 !! wikitext
20171 * foo
20172 !! html
20173 <ul> <li>foo</li></ul>
20174 !! end
20175
20176 !! test
20177 Don't strip leading whitespace when handling indent-pre suppressing tags
20178 !! options
20179 parsoid=html2wt
20180 !! wikitext
20181 {|
20182 | indented row
20183 |}
20184 <blockquote>
20185 '''This is very bold of you!'''
20186
20187 {|
20188 |
20189 indented cell (no pre-wrapping!)
20190 |}
20191 </blockquote>
20192 foo
20193 <div>bar</div>
20194 !! html
20195 <table>
20196 <tr><td> indented row</td></tr>
20197 </table>
20198 <blockquote><p>
20199 <b>This is very bold of you!</b>
20200 </p>
20201 <table><tr><td>
20202 indented cell (no pre-wrapping!)
20203 </td></tr></table>
20204 </blockquote>
20205 <p>foo</p>
20206 <div>bar</div>
20207 !! end
20208
20209 !! test
20210 Strip leading whitespace when handling indent-pre inducing tags
20211 !! options
20212 parsoid=html2wt
20213 !! wikitext
20214 foo
20215 <span>bar</span>
20216
20217 <span>foo2
20218 </span>bar2
20219
20220 <div>foo</div>
20221 <span>bar</span>
20222
20223 <div>
20224 <span>foo</span>
20225 </div>
20226 !! html
20227 <p>foo</p>
20228 <span>bar</span>
20229
20230 <span>foo2
20231 </span>bar2
20232
20233 <div>foo</div>
20234 <span>bar</span>
20235
20236 <div>
20237 <span>foo</span>
20238 </div>
20239 !! end
20240
20241 !! test
20242 Lists: Add space after bullets
20243 !! options
20244 parsoid=html2wt
20245 !! wikitext
20246 * foo
20247 * bar
20248 * <span> baz</span>
20249 !! html
20250 <ul>
20251 <li>foo</li>
20252 <li> bar</li>
20253 <li><span> baz</span></li>
20254 </ul>
20255 !! end
20256
20257 !! test
20258 Lists: Dont insert newlines in a serialized list item.
20259 !! options
20260 parsoid=html2wt
20261 !! wikitext
20262 * a<br>b
20263 * c
20264 !! html
20265 <ul><li>a<br>b</li><li>c</li></ul>
20266 !! end
20267
20268 !! test
20269 Headings: Add space before/after == (Bug 51744)
20270 !! options
20271 parsoid=html2wt
20272 !! wikitext
20273 == foo ==
20274
20275 == bar ==
20276
20277 == baz ==
20278
20279 == <span> baz</span> ==
20280 !! html
20281 <h2>foo</h2>
20282 <h2> bar</h2>
20283 <h2>baz </h2>
20284 <h2><span> baz</span></h2>
20285 !! end
20286
20287 !! test
20288 Parsoid: Serialize positional parameters with = in them as named parameter
20289 !! options
20290 parsoid=html2wt
20291 !! wikitext
20292 {{echo|1 = f=oo}}
20293
20294 {{echo|1 = f=oo|2 = bar}}
20295
20296 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20297 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20298 {{echo|<nowiki>f=oo</nowiki>|bar}}
20299 !! html
20300 <p about="#mwt1" typeof="mw:Transclusion"
20301 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20302
20303 <p about="#mwt1" typeof="mw:Transclusion"
20304 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20305
20306 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20307 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20308 <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>
20309 !! end
20310
20311 !! test
20312 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20313 !! options
20314 parsoid=html2wt
20315 !! wikitext
20316 <div>a
20317 b
20318 </div>
20319 <div>a
20320 b
20321 </div>
20322 <div>
20323 a
20324
20325 b
20326 </div>
20327 !! html
20328 <div>a<p>b</p></div>
20329 <div>a
20330 <p>b</p></div>
20331 <div>
20332 a
20333 <p>b</p></div>
20334 !! end
20335
20336 #-----------------------------
20337 # I/B quote minimization tests
20338 #-----------------------------
20339
20340 !! test
20341 1. I/B quote minimization: wikitext-only tags should be combined
20342 !! options
20343 parsoid=html2wt
20344 !! wikitext
20345 ''AB''
20346
20347 '''AB'''
20348
20349 ''A'''B'''''
20350
20351 '''A''B'''''
20352
20353 '''A''BC''D'''
20354
20355 '''''AB'''''
20356
20357 '''''AB'''''
20358
20359 '''''AB'''''
20360 !! html
20361 <p><i>A</i><i>B</i></p>
20362 <p><b>A</b><b>B</b></p>
20363 <p><i>A</i><b><i>B</i></b></p>
20364 <p><b>A</b><i><b>B</b></i></p>
20365 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20366 <p><i><b>A</b></i><i><b>B</b></i></p>
20367 <p><i><b>A</b></i><b><i>B</i></b></p>
20368 <p><b><i>A</i></b><i><b>B</b></i></p>
20369 !! end
20370
20371 !! test
20372 2. I/B quote minimization: wikitext and html tags should not be combined
20373 !! options
20374 parsoid=html2wt
20375 !! wikitext
20376 ''A''<i>B</i>
20377
20378 ''A'''''<i>B</i>'''
20379 !! html
20380 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20381 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20382 !! end
20383
20384 !! test
20385 3. I/B quote minimization: templated content stops minimization
20386 !! options
20387 parsoid=html2wt
20388 !! wikitext
20389 ''A''{{echo|''B''}}
20390
20391 ''A''{{echo|'''''B'''''}}
20392 !! html
20393 <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>
20394 <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>
20395 !! end
20396
20397 !! test
20398 4. I/B quote minimization: new content should be mimimized with adjacent old content
20399 !! options
20400 parsoid=html2wt
20401 !! wikitext
20402 ''AB''
20403
20404 '''AB'''
20405
20406 ''A'''B'''''
20407 !! html
20408 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20409 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20410 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20411 !! end
20412
20413 #------------------------------------
20414 # End of I/B quote minimization tests
20415 #------------------------------------
20416
20417 !!test
20418 Bug 54262: New entities
20419 !! options
20420 parsoid=html2wt
20421 !! wikitext
20422 foo
20423 !! html
20424 <span typeof="mw:Entity">foo</span>
20425 !! end
20426
20427 ## Note that there is no wikitext output for 'unknownproperty' ##
20428 ## Unknown magic words are silently dropped ##
20429
20430 !! test
20431 Magic words
20432 !! options
20433 parsoid=html2wt
20434 !! wikitext
20435 __TOC__
20436 __NOTOC__
20437 __FORCETOC__
20438 __INDEX__
20439 __NOINDEX__
20440 __NOGALLERY__
20441 __NOEDITSECTION__
20442 __NOTITLECONVERT__
20443 __NOCONTENTCONVERT__
20444 !! html
20445 <meta property='mw:PageProp/toc' />
20446 <meta property='mw:PageProp/notoc' />
20447 <meta property='mw:PageProp/forcetoc' />
20448 <meta property='mw:PageProp/index' />
20449 <meta property='mw:PageProp/noindex' />
20450 <meta property='mw:PageProp/nogallery' />
20451 <meta property='mw:PageProp/noeditsection' />
20452 <meta property='mw:PageProp/notitleconvert' />
20453 <meta property='mw:PageProp/nocontentconvert' />
20454 <meta property='mw:PageProp/unknownproperty' />
20455 !! end
20456
20457 !! test
20458 Consecutive <pre>s should not get merged
20459 !! options
20460 parsoid=html2wt,html2html
20461 !! wikitext
20462 a
20463
20464 b
20465
20466 c
20467
20468 d
20469
20470 e
20471
20472
20473
20474 f
20475 !! html
20476 <pre>a</pre><pre>b</pre>
20477
20478 <pre>c
20479 </pre><pre>
20480 d</pre>
20481
20482 <pre>e
20483
20484 </pre><pre>
20485
20486 f</pre>
20487 !! end
20488
20489 !! test
20490 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20491 !! options
20492 parsoid=html2wt
20493 !! wikitext
20494 [[Special:BookSources/1234567890|ISBN 1234567895]]
20495 !! html
20496 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20497 !! end
20498
20499 !! test
20500 Edited RFC links not serializable as RFC links should serialize as extlinks
20501 !! options
20502 parsoid=html2wt
20503 !! wikitext
20504 [//tools.ietf.org/html/rfc123 New RFC]
20505 !! html
20506 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20507 !! end
20508
20509 !! test
20510 Edited PMID links not serializable as PMID links should serialize as extlinks
20511 !! options
20512 parsoid=html2wt
20513 !! wikitext
20514 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20515 !! html
20516 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20517 !! end
20518
20519 !! test
20520 Edited Redirect link should emit a non-piped wikitext link
20521 !! options
20522 parsoid=html2wt
20523 !! wikitext
20524 #REDIRECT [[Bar]]
20525 !! html
20526 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20527 !! end
20528
20529 # -----------------------------------------------------------------
20530 # End of section for Parsoid-only html2wt tests for serialization
20531 # of new content
20532 # -----------------------------------------------------------------
20533
20534 TODO:
20535 more images
20536 more tables
20537 character entities
20538 and much more
20539 Try for 100% code coverage